[Click] Accessing port values from header

Beyers Cronje bcronje at gmail.com
Thu Apr 6 14:11:07 EDT 2006


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> 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
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list