DESERT 4.0.0
uwmll-module.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
30// This module has only slightly modification as respect to the mll module
31// contained in Miracle,
32// released under the same BSD copyright and implemented by
33// Erik Andersson, Emil Ljungdahl, Lars-Olof Moilanen (Karlstad University)
34
45#ifndef UWMLL_MODULE_H
46#define UWMLL_MODULE_H
47
48#include <arp.h>
49#include <mac.h>
50#include <module.h>
51#include <packet.h>
52#include <uwip-module.h>
53
54#include <algorithm>
55#include <vector>
56
57#include "marptable.h"
58
59#define UWMLL_DROP_REASON_NOT_IN_ARP_LIST "NAL"
60
67class UWMllModule : public Module
68{
69public:
74
81 virtual int crLayCommand(ClMessage *m);
82 virtual int recvAsyncClMsg(ClMessage *m);
83 virtual int recvSyncClMsg(ClMessage *m);
84
86 virtual int command(int argc, const char *const *argv);
87
89 virtual void recv(Packet *p);
90
95 virtual void recv(Packet *p, int idSrc);
96
97protected:
99 virtual void sendDown(Packet *p);
100
102 virtual void sendUp(Packet *p);
103
111 virtual int getDownAddr(int downId = -1);
112
119 virtual int arpResolve(nsaddr_t dst, Packet *p);
120
121 inline void
123 {
125 }
126
127 inline int
129 {
130 return n_arp_pkt_drop;
131 }
132
135
137 vector<nsaddr_t> netAddr;
138
141
143
147};
148
149#endif
Definition marptable.h:95
Definition uwmll-module.h:68
virtual int arpResolve(nsaddr_t dst, Packet *p)
Definition uwmll-module.cpp:220
virtual int getDownAddr(int downId=-1)
Definition uwmll-module.cpp:241
virtual void recv(Packet *p)
Definition uwmll-module.cpp:131
virtual void sendUp(Packet *p)
Definition uwmll-module.cpp:235
virtual int recvAsyncClMsg(ClMessage *m)
Definition uwmll-module.cpp:93
vector< nsaddr_t > netAddr
Definition uwmll-module.h:137
UWMllModule()
Definition uwmll-module.cpp:74
void incrArpPktDrop()
Definition uwmll-module.h:122
virtual int recvSyncClMsg(ClMessage *m)
Definition uwmll-module.cpp:99
virtual void sendDown(Packet *p)
Definition uwmll-module.cpp:149
virtual int command(int argc, const char *const *argv)
Definition uwmll-module.cpp:105
virtual int crLayCommand(ClMessage *m)
Definition uwmll-module.cpp:87
int getArpPktDropped()
Definition uwmll-module.h:128
int seqno_
Definition uwmll-module.h:140
int enable_addr_copy
Definition uwmll-module.h:144
int n_arp_pkt_drop
Definition uwmll-module.h:142
~UWMllModule()
Definition uwmll-module.cpp:82
UWARPTable * arptable_
Definition uwmll-module.h:134
Provides the definition of the ARP table of MLL module.
Provides the UWIP packets header description. Definition of the class that define the network layer.