14.6.1 LL Class in C++

The C++ class LL derives from the LinkDelay class. Since it is a duplex object, it keeps a separate pointer for the send target, sendtarget, and the receive target, recvtarget. It also defines the methods recvfrom() and sendto() to handle the incoming and outgoing packets respectively.

   class LL : public LinkDelay {
   	   virtual void recv(Packet* p, Handler* h);
   	   virtual Packet* sendto(Packet* p, Handler* h = 0);
   	   virtual Packet* recvfrom(Packet* p);
   	   inline int seqno() { return seqno_; }
   	   inline int ackno() { return ackno_; }
   	   inline int macDA() { return macDA_; }
   	   inline Queue *ifq() { return ifq_; }
   	   inline NsObject* sendtarget() { return sendtarget_; }
   	   inline NsObject* recvtarget() { return recvtarget_; }
   	   int command(int argc, const char*const* argv);
   	   void handle(Event* e) { recv((Packet*)e, 0); }
   	   inline virtual int arp (int ip_addr) { return ip_addr; } 
   	   int seqno_;			// link-layer sequence number
   	   int ackno_;			// ACK received so far
   	   int macDA_;			// destination MAC address
   	   Queue* ifq_;			// interface queue
   	   NsObject* sendtarget_;		// for outgoing packet 
   	   NsObject* recvtarget_;		// for incoming packet
   	   LanRouter* lanrouter_; // for lookups of the next hop

Tom Henderson 2011-11-05