DESERT 3.5.1
Loading...
Searching...
No Matches
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 <module.h>
49#include <packet.h>
50#include <arp.h>
51#include <mac.h>
52#include <uwip-module.h>
53
54#include <vector>
55#include <algorithm>
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
ARP table.
Definition marptable.h:95
Module for ARP-resolve.
virtual int arpResolve(nsaddr_t dst, Packet *p)
Resolve MAC address for given dst address.
virtual int getDownAddr(int downId=-1)
Retrieve MAC address for lower layer.
virtual void recv(Packet *p)
Retrieve packets from other modules.
virtual void sendUp(Packet *p)
Handle packet going up.
virtual int recvAsyncClMsg(ClMessage *m)
vector< nsaddr_t > netAddr
List of IP address to our upper layers.
UWMllModule()
Constructor.
void incrArpPktDrop()
virtual int recvSyncClMsg(ClMessage *m)
virtual void sendDown(Packet *p)
Handle packet going down.
virtual int command(int argc, const char *const *argv)
TCL Command handler.
virtual int crLayCommand(ClMessage *m)
Receive asyncronous commands In Practive only IPModule telling us its IP-address.
int getArpPktDropped()
int seqno_
Link layer sequence number.
~UWMllModule()
Desctructor.
UWARPTable * arptable_
Pointer to an arptable.
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.