Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch7: Link and Buffer Management. 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier:

Similar presentations


Presentation on theme: "Ch7: Link and Buffer Management. 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier:"— Presentation transcript:

1 Ch7: Link and Buffer Management

2 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier: Forwarding Agent: Protocol Entity Node Entry LL: Link layer object IFQ: Interface queue MAC: Mac object PHY: Net interface protocol agent routing agent addr classifier port classifier 255 IFQ defaulttarget_ Radio propagation/ antenna models Prop/ant

3 Introduction Link : an OTcl object which connects two nodes and carries packets from the beginning node to the terminating node. focuses on a class of SimpleLink objects. In real environment: packets buffered in nodes In NS2: packets buffered in Links

4 7.1 Introduction to SimpleLink Objects 7.1.1 Main Components of a SimpleLink Basic object

5 Tracing Objects be inserted only if instvar $traceAllFile_ of the is defined.

6 7.1.2 Instprocs for Configuring a SimpleLink Object In the OTcl domain, uni-directional Instproc duplex-link{...} creates two SimpleLink objects:

7 7.1.3 The Constructor of Class SimpleLink 初始化 7.2

8 7.2 Modeling Packet Departure NS2 models packet departure by using a C++ class Linkdelay  OTcl class DelayLink object. packet transmission time propagation delay.

9 when a LinkDelay object receives a packet, it places these two events on the simulation timeline: (i) Packet departure from an upstream object: Wait for packet transmission time Packet arrival at a downstream node: an entire packet needs a period of “packet transmission time + propagation delay” to reach the destination. schedules a packet reception event at the downstream node after this period.

10 7.2.2 C++ Class LinkDelay bandwidth_: link bandwidth delay_: propagation delay, Class LinkDelay stores all packets in-transit in its buffer itq_ (Line 17), variable intr_ is a dummy Event object, which represent a packet departure (from the transmitting node) event. txttime(p): calculates the packet transmission time of packet *p send(p,h): sends packet *p to the connecting downstream object handle(e): Scheduler dispatches an event recv(p,h): schedules packet departure and packet arrival events.

11 (i) Packet departure event Calculate packet transmission time (call txttime(p)) Schedule dummy event “txt” seconds later After txt seconds, Scheduler dispatches this event by invoking “h” to inform the upstream object of a packet departure.  the upstream object responds by transmitting another packet, if available

12 (ii) Packet arrival: Class LinkDelay also passes the packet to its downstream object (*target_). Line 8 schedules an event cast from the input packet *p with delay txt+delay_ seconds, After “txt+delay_” seconds, h.handle(p) will invoke function recv(p) (see Program 4.2)  packet *p will be passed to *target_ after txt+delay_ seconds. The major difference between scheduling packet departure and arrival events schedule only one packet departure event More than one packet arrival event

13 7.3 Buffer Management class Queue derives from class Connector, and can be used to connect two NsObjects.  packet buffering.  buffer size callback mechanism,

14 7.3.1 Class PacketQueue: A Model for Packet Buffering Class PacketQueue is a linked list of Packets remove(p) searches for a matching packet *p and removes it from the buffer packet admitting/dropping is the functionality of class, Queue, of class PacketQueue.

15 7.3.2 Queue Handler Derived from class Handler (see Line 1 in Program 7.7), class QueueHandler is closely related to the (event) Scheduler. (function handle(e).) 主要功能就是 resume

16 To associate a Queue object with a QueueHandler object Classe Queue: declare qh_ (a pointer) Classe QueueHandler: declare queue_ (a reference) These two variables are initialized when a Queue object is instantiated (Line 12 in Program 7.7). (queue 的建構子 ) The constructor of qh_ then sets its member variable queue_ to share the same address as the input Queue object (i.e. queue_(q) in Line 3 of Program 7.7),

17 7.3.3 Queue Blocking and Callback Mechanism queue blocking: indicate whether a queue is currently transmitting a packet a queue can transmit one packet at a time A queue is said to be blocked or unblocked (i.e., blocked_ = 1 or blocked_ = 0), allowed to transmit a packet “target_->recv(p,&qh_)” Called by scheduler

18 Callback Mechanism 設定兩個 event LinkDelay object schedules an event which calls back to unblock the upstream Queue

19 如果有 packet 就繼續送, blocked_ 不用變

20 7.3.4 Class DropTail: A Child Class of Class Queue DropTail, a child class of class Queue, which is bound to the OTcl class Queue/DropTail class DropTail refers to its buffer by q_ overrides function enque(p)

21 Remark: enque() 在 Class Queue 中只有一個 virtual 的空殼子

22 7.4.1 Network Construction

23 7.4.2 Packet Flow Mechanism

24


Download ppt "Ch7: Link and Buffer Management. 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier:"

Similar presentations


Ads by Google