MLLModule Class Reference

#include <mll-module.h>

Inheritance diagram for MLLModule:

Inheritance graph
[legend]
Collaboration diagram for MLLModule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MLLModule ()
 ~MLLModule ()
virtual int crLayCommand (ClMessage *m)
virtual int recvAsyncClMsg (ClMessage *m)
virtual int command (int argc, const char *const *argv)
virtual void recv (Packet *p)
virtual void recv (Packet *p, int idSrc)

Protected Member Functions

virtual void sendDown (Packet *p)
virtual void sendUp (Packet *p)
virtual void processARP (Packet *p, int idSrc)
virtual bool netAddrPresent (nsaddr_t addr)
virtual void fillNetAddrTable ()
virtual int getDownAddr (int downId=-1)
virtual int arpResolve (nsaddr_t dst, Packet *p)
virtual void arpRequest (nsaddr_t src, nsaddr_t dst)

Protected Attributes

MARPTablearptable_
vector< nsaddr_t > netAddr
int seqno_
int ackno_

Detailed Description

Module for ARP-resolve. Should live between one or more IPModule and one MMacModule NOTE: You should only use one MMacModule below this module, else behavior is undef

Definition at line 50 of file mll-module.h.


Constructor & Destructor Documentation

MLLModule::MLLModule (  ) 

Constructor

Definition at line 45 of file mll-module.cc.

References arptable_.

MLLModule::~MLLModule (  ) 

Desctructor

Definition at line 50 of file mll-module.cc.


Member Function Documentation

int MLLModule::crLayCommand ( ClMessage m  )  [virtual]

Receive asyncronous commands In Practive only IPModule telling us its IP-address

Parameters:
m Pointer to message object
Returns:
1 on success

Reimplemented from PlugIn.

Definition at line 54 of file mll-module.cc.

References PlugIn::crLayCommand(), netAddr, and ClMessage::type().

Here is the call graph for this function:

int MLLModule::recvAsyncClMsg ( ClMessage m  )  [virtual]

Cross-Layer messages asynchronous interpreter.

It has to be properly extended in order to interpret custom cross-layer messages used by this particular plug-in. This type of communication does not necessarily need a reply.

Note:
Each implementation of this method is responsible for deleting the ClMessage instance referred to by ClMessage* m when the message is received
Normally, classes inheriting from other classes should call the recvAsyncClMsg() method of the parent when an unknown ClMsg is detected, in order to allow the parent to handle unknown message types.

A very importan exception to this rule are classes inheriting directly from either Plugin or Module. These classes should NOT call neither Plugin::recvAsyncClMsg() nor Module::recvAsyncClMsg() for unknown messages; instead, they should just free the memory associated with ClMessage* m

Parameters:
m an instance of ClMessage that represent the message received
Returns:
0 if the method was re-implemented by somebody, RETVAL_NOT_IMPLEMENTED if it is the implementation provided by the parent Plugin class (note that Module does not re-implement it, so also Module::recvAsyncClMsg() returns RETVAL_NOT_IMPLEMENTED)
See also:
NodeCore, ClMessage, ClSAP, ClTracer

Reimplemented from PlugIn.

Definition at line 67 of file mll-module.cc.

References PlugIn::crLayCommand(), netAddr, and ClMessage::type().

Here is the call graph for this function:

int MLLModule::command ( int  argc,
const char *const *  argv 
) [virtual]

TCL Command handler

Reimplemented from Module.

Definition at line 80 of file mll-module.cc.

References MARPTable::addEntry(), arptable_, MARPTable::clear(), Module::command(), MARPEntry::macaddr_, and MARPEntry::up_.

Here is the call graph for this function:

void MLLModule::recv ( Packet *  p  )  [virtual]

Retrieve packets from other modules

Implements Module.

Definition at line 104 of file mll-module.cc.

void MLLModule::recv ( Packet *  p,
int  idSrc 
) [virtual]

Retrieve packets from other modules This method is used to know which mac-module to send ARP-replies to

Reimplemented from Module.

Definition at line 109 of file mll-module.cc.

References DOWN, processARP(), sendDown(), sendUp(), and UP.

Here is the call graph for this function:

void MLLModule::sendDown ( Packet *  p  )  [protected, virtual]

Handle packet going down

Definition at line 126 of file mll-module.cc.

References arpResolve(), getDownAddr(), Module::sendDown(), and seqno_.

Referenced by recv().

Here is the call graph for this function:

void MLLModule::sendUp ( Packet *  p  )  [protected, virtual]

Handle packet going up

Definition at line 175 of file mll-module.cc.

References Module::sendUp().

Referenced by recv().

Here is the call graph for this function:

void MLLModule::processARP ( Packet *  p,
int  idSrc 
) [protected, virtual]

Process a ARP-request/-response packet

Definition at line 180 of file mll-module.cc.

References MARPTable::addEntry(), arptable_, DOWN, getDownAddr(), MARPEntry::hold_, MARPTable::lookup(), MARPEntry::macaddr_, netAddrPresent(), Module::sendDown(), and MARPEntry::up_.

Referenced by recv().

Here is the call graph for this function:

bool MLLModule::netAddrPresent ( nsaddr_t  addr  )  [protected, virtual]

Check if a given IP-address is present in our stack Sends cl-messages to upper layer requesting their IP-addresses

Parameters:
addr IP address to look for
Returns:
True if addr exists

Definition at line 256 of file mll-module.cc.

References fillNetAddrTable(), and netAddr.

Referenced by processARP().

Here is the call graph for this function:

void MLLModule::fillNetAddrTable (  )  [protected, virtual]

Fill the table of upper layer network addresses

Definition at line 263 of file mll-module.cc.

References CLBROADCASTADDR, PlugIn::getId(), netAddr, Module::sendSyncClMsgUp(), and ClMessage::setDest().

Referenced by arpResolve(), and netAddrPresent().

Here is the call graph for this function:

int MLLModule::getDownAddr ( int  downId = -1  )  [protected, virtual]

Retrieve MAC address for lower layer

Parameters:
downId id of downward module if> -1, only the module with id downId will be asked, else request is broadcasted
Returns:
the MAC address of lower layer

Definition at line 272 of file mll-module.cc.

References BROADCAST, CLBROADCASTADDR, MacClMsgGetAddr::getAddr(), Module::sendSyncClMsgDown(), and UNICAST.

Referenced by arpRequest(), processARP(), and sendDown().

Here is the call graph for this function:

int MLLModule::arpResolve ( nsaddr_t  dst,
Packet *  p 
) [protected, virtual]

Resolve MAC address for given dst address

Parameters:
dst IP destination address
p packet which requested the resolv, will be cached
Returns:
0 if ARP request successfully sent, otherwise some error number

Definition at line 290 of file mll-module.cc.

References MARPTable::addEntry(), arpRequest(), arptable_, MARPEntry::count_, Module::drop(), fillNetAddrTable(), MARPEntry::hold_, MARPTable::lookup(), MARPEntry::macaddr_, netAddr, and MARPEntry::up_.

Referenced by sendDown().

Here is the call graph for this function:

void MLLModule::arpRequest ( nsaddr_t  src,
nsaddr_t  dst 
) [protected, virtual]

Builds and sends an ARP request for the given dst IP address

Parameters:
src Our source address
dst The destination address we are looking for

Definition at line 367 of file mll-module.cc.

References DOWN, getDownAddr(), and Module::sendDown().

Referenced by arpResolve().

Here is the call graph for this function:


Member Data Documentation

MARPTable* MLLModule::arptable_ [protected]

Pointer to an arptable

Definition at line 127 of file mll-module.h.

Referenced by arpResolve(), command(), MLLModule(), and processARP().

vector<nsaddr_t> MLLModule::netAddr [protected]

List of IP address to our upper layers

Definition at line 130 of file mll-module.h.

Referenced by arpResolve(), crLayCommand(), fillNetAddrTable(), netAddrPresent(), and recvAsyncClMsg().

int MLLModule::seqno_ [protected]

Link layer sequence number

Definition at line 133 of file mll-module.h.

Referenced by sendDown().

int MLLModule::ackno_ [protected]

ACK received so far

Definition at line 136 of file mll-module.h.


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 15:49:23 2008 for NS-MIRACLE library by  doxygen 1.5.2