[Click] ipprint.cc

Eddie Kohler kohler at cs.ucla.edu
Tue May 2 12:24:55 EDT 2006


Homayara

Homayara Akter wrote:
> Hi,
>    
>   Would anybody please tell me ,in ipprint.cc element 
>    
>   if (_contents > 0) {
>     int amt = 3*_bytes + (_bytes/4+1) + 3*(_bytes/24+1) + 1;
>       char *buf = sa.reserve(amt);
>    
>   here _bytes=15000

1500 is more likely.

>   what does amt do?

IPPrint prints the packet's contents in the following format.

   00112233 44556677 8899AABB CCDDEEFF 00112233 44556677
   8899AABB CCDDEEFF ...

That is, in hex, with spaces every 4 bytes, and "\n  " every 24 bytes.  Amt is 
a conservative approximation for the number of bytes it will take to create 
this contents string

>   what does store in buf ?

Printed contents

>   what does sa.reserve() do ?

Reserves space for contents

E

>    
>   Thanks in advance.
>    
>   Homayara
>    
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list