[ns] Generating packets on queue events
Teerawat Issariyakul
teerawat at ece.ubc.ca
Wed Oct 29 04:15:20 PDT 2008
Hi,
In NS2, generating a new packet is not that complicated. Class Packet has
a function alloc() which returns a pointer to the created packet. You
may find the detail in file ~/ns/common/packet.h.
At the receiving end, you may process the packet in the function
recv(p,h), where p is a pointer to a packet.
There is a detailed packets (Chapter 8) and function recv(p,h) (Chapter
5) can be found in the following book from Springer:
T. Issaraiyakul and E. Hossain, "Introduction to Network Simulator
NS2", Springer 2008.
Here is the link:
http://www.springer.com/engineering/signals/book/978-0-387-71759-3
You might also find the following slide useful:
http://www.ece.ubc.ca/~teerawat/NS2.htm<http://www.ece.ubc.ca/%7Eteerawat/NS2.htm>
Best,
Teerawat
On 10/28/2008, "Prajjwal Devkota" <prajjwal at gmail.com> wrote:
>
>Hi everyone,
>
>I am thinking of generating packets on certain queue events. The packets
>would be:
>
> 1. generated by the link layer (in real life, but not necessarily in
> ns-2, an approximation would do)
> 2. processed by the link layer on the receiving end, and acted upon
>
>I am thinking of this as one possible implementation of a project I am
>trying to do, though I am looking at other approaches too. (Such as using
>global variables in conjunction for timers: where I have a problem of waking
>up intervals right now).
>
More information about the Ns-users
mailing list