Re: [ns] Generating packets on queue events

2008-10-29 Thread Teerawat Issariyakul


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

Best,
Teerawat








On 10/28/2008, "Prajjwal Devkota" <[EMAIL PROTECTED]> 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).
>



Re: [ns] Generating packets on queue events

2008-10-28 Thread Prajjwal Devkota

It seems I pasted incompletely, sorry about that:

On Tue, Oct 28, 2008 at 12:38 PM, Prajjwal Devkota <[EMAIL PROTECTED]>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).


Could anyone suggest any good pointers to getting started with packet
generation and handling (without creating an agent would be nice).  As to
the approach I have tried using global variables, my only problem seems to
be of resuming the queue on time: I am thinking of using a wakeup timer
every given interval, but is there a better way than that?

Thank you for your help,
Prajjwal


[ns] Generating packets on queue events

2008-10-28 Thread Prajjwal Devkota

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).