46#include <mmac-clmsg.h>
60 : TclClass(
"Module/UW/MLL")
89 return Module::crLayCommand(m);
95 return Module::crLayCommand(m);
101 return Module::recvSyncClMsg(m);
107 Tcl &tcl = Tcl::instance();
109 if (strcasecmp(argv[1],
"reset") == 0) {
112 }
else if (strcasecmp(argv[1],
"getArpPacketDrop") == 0) {
118 if (strcasecmp(argv[1],
"addentry") == 0) {
119 nsaddr_t ipaddr = atoi(argv[2]);
127 return Module::command(argc, argv);
139 hdr_cmn *ch = HDR_CMN(p);
140 if (ch->direction() == hdr_cmn::UP) {
143 ch->direction() = hdr_cmn::DOWN;
151 hdr_cmn *ch = HDR_CMN(p);
153 nsaddr_t dst = ih->
daddr();
154 hdr_ll *llh = HDR_LL(p);
155 hdr_mac *mh = HDR_MAC(p);
158 llh->lltype() = LL_DATA;
161 mh->hdr_type() = ETHERTYPE_IP;
165 std::cout << NOW <<
"::UWMLL::SENDDOWN::SOURCE_MAC::" << mh->macSA()
166 <<
"::NEXT_HOP::" << ch->next_hop()
167 <<
"::DESTINATION::" << (uint)ih->
daddr()
171 switch (ch->addr_type()) {
175 mh->macDA() = ch->next_hop();
181 dst = ch->next_hop();
182 else if (ch->next_hop() <= 0)
185 dst = ch->next_hop();
191 mh->macDA() = MAC_BROADCAST;
200 mh->macDA() = MAC_BROADCAST;
208 std::cerr << NOW <<
"Node(" << mh->macSA()
209 <<
")::UwMLL_Module -> WARNING: Entry not found for IP "
211 << dst <<
" Packet dropped" << endl;
223 hdr_mac *mh = HDR_MAC(p);
228 if (llinfo && llinfo->
up_) {
246 c =
new MacClMsgGetAddr(UNICAST, downId);
247 sendSyncClMsgDown(c);
249 c =
new MacClMsgGetAddr(BROADCAST, CLBROADCASTADDR);
250 sendSyncClMsgDown(c);
252 int val = c->getAddr();
UWARPEntry * lookup(nsaddr_t addr)
Lookup entry in table.
void clear()
Remove all entries in table.
void addEntry(UWARPEntry *entry)
Add entry to ARP table.
Class that represents the binding with the tcl configuration script.
UWMllModuleClass()
Constructor of the class.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
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)
UWMllModule()
Constructor.
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 seqno_
Link layer sequence number.
~UWMllModule()
Desctructor.
UWARPTable * arptable_
Pointer to an arptable.
hdr_uwip describes UWIP packets.
uint8_t & daddr()
Reference to the daddr_ variable.
Cross layer messages definition for the UWIP Module.
static const uint8_t UWIP_BROADCAST
Variable used to represent a broadcast UWIP.
UWMllModuleClass class_uwll
Provides the declaration of UWMllModule class that represents the MLL class.
#define UWMLL_DROP_REASON_NOT_IN_ARP_LIST