pandora-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pandora] struct tcphdr


From: Simon Patarin
Subject: Re: [Pandora] struct tcphdr
Date: Wed, 5 Mar 2003 15:07:35 +0100 (CET)


Hello,


>   struct tcphdr {
>           u_int16_t       th_sport;               /* source port */
>           u_int16_t       th_dport;               /* destination port */
>           tcp_seq         th_seq;                 /* sequence number */
>           tcp_seq         th_ack;                 /* acknowledgement numb
>   er */
>           u_int8_t        th_offx2;               /* data offset, rsvd */
>           u_int8_t        th_flags;
>
>
> I think:
>
>       data offset + reserved = 10 bits
>       flags = 6 bits

Maybe the comment are a little bit misleading, but everything works as
expected.

RFC 793 defines TCP header like this:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Source Port          |       Destination Port        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        Sequence Number                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Acknowledgment Number                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Data |           |U|A|P|R|S|F|                               |
   | Offset| Reserved  |R|C|S|S|Y|I|            Window             |
   |       |           |G|K|H|T|N|N|                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Checksum            |         Urgent Pointer        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             data                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Furthermore reserved bits should be 0. Since Pandora only uses flags with
logical masks (like: flags & TH_SYN) absorbing 2 bits from the reserved
part in the field is not very important (besides working with 6-bit long
integers is a little tricky :). The same apply for the 4-bit offset:
Pandora knows how to extract it. So do not worry if the boundaries are
not well positioned!

Simon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]