On 10/17/06, Dan Dechene <[EMAIL PROTECTED]> wrote:
>
> Dear ns Users,
>
> I just had a question with regards to analyzing a packet type. I want to
> keep a running counter in my C++ code of how many packets are of a certain
> type are passed to Wireless::sendup. But I wanted to know how I can grab
> that packet type in that function (ie CBR, RTS, etc). Any assistance would
> be greatly appreciated.
>

if your sendup code has a Packet *p then you can add something like this:
hdr_cmn *cmn = HDR_CMN(p);
switch(cmn->ptype_) {
 case PT_TCP:
   //count packet type
  break;
 case PT_ACK:
 case PT_CBR:
 case PT_RTP:
}

This is gleaned from the NS2 manual packet section and reading the
code in packet.h.

Reply via email to