[Click] Accessing port values from header

Daniel Braund danbraund at yahoo.co.uk
Thu Apr 6 17:04:20 EDT 2006


Excellent. Thanks everyone who responded.

Dan

Beyers Cronje wrote:
> Daniel,
> 
> To add to what Michael and Jason said, keep in mind the udp and tcp 
> source/destination ports are in network byte order, so use ntohs() 
> function to convert to host byte order.
> 
> Beyers
> 
> On 4/6/06, *Daniel Braund* <D.Braund-01 at student.lboro.ac.uk 
> <mailto:D.Braund-01 at student.lboro.ac.uk>> wrote:
> 
>     Hi. I am running in circles trying to figure out how to extract the
>     port value
>     for a packet in a similar manner to the way I extract a packets
>     source and
>     destination addresses:
> 
>     packet_src=iph->ip_src.s_addr;
>     packet_dst=iph->ip_dst.s_addr;
> 
>     essentially I want to know if I can do something like
> 
>     packet_port=iph->ip_dst.port;
> 
>     I have looked, but cannot find a list or description of what values
>     I can plug
>     into here to gain the data I want. Does one exist somewhere? Also,
>     s_addr I
>     assume implies string, is there a binary/hex variant?
> 
>     Thanks in advance for any insight you can offer me.
> 
>     Daniel
>     _______________________________________________
>     click mailing list
>     click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
>     https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>     <https://amsterdam.lcs.mit.edu/mailman/listinfo/click>
> 
> 



		
___________________________________________________________ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars online! http://uk.cars.yahoo.com/


More information about the click mailing list