[Click] Modification(handling) of an ip packet data field ?

Beyers Cronje bcronje at cs.co.za
Wed Oct 20 06:38:50 EDT 2004


Hi Yacine,

On TCP packets I use the following to access data:

unsigned data_offset = (iph->ip_hl << 2) + (tcph->th_off << 2);  // IP Header length + TCP Header length
unsigned char *data = p->data() + data_offset;

The above non-const data pointer should only work on a writeable packet gained via uniqueify or make as Eddie pointed out.

Cheer

Beyers

-----Original Message-----
From: click-bounces at amsterdam.lcs.mit.edu
[mailto:click-bounces at amsterdam.lcs.mit.edu]On Behalf Of ystar master
Sent: Wednesday, October 20, 2004 9:07 AM
To: Eddie Kohler
Cc: click at amsterdam.lcs.mit.edu
Subject: Re: [Click] Modification(handling) of an ip packet data field ?


Hi Eddie,

Thank you for informations that you have provided. I
think that i have found the solution to access the
data  field by using th_off defined in the
include/clicknet/tcp.h. If there are another mean to
access data field, please inform me.

Thanks again
YacineI


 --- Eddie Kohler <kohler at cs.ucla.edu> a écrit : 

> Hi Yacine,
> 
> The general pattern is to "uniqueify" the packet,
> making sure that it is not 
> shared.  Then the "ip_header()" and "tcp_header()"
> return values will become 
> writable.  See IPMirror (elements/ip/ipmirror.cc)
> for an example.
> 
> Eddie



	

	
		
Vous manquez d'espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click
This is an email from CS Holdings. It is confidential to the ordinary user of the email address
to which it is addressed and may contain copyright and/or legally privileged information. No one
else may read, print, store, copy, forward or act in reliance upon all or any part of it or its 
attachments. If you received this email in error please notify its sender.



More information about the click mailing list