Changeset 71b00dcc in mainline for uspace/srv/net/tl/tcp/tcp_header.h


Ignore:
Timestamp:
2010-03-07T22:51:38Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60ab6c3
Parents:
b5cbff4 (diff), 31c80a5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~lukasmejdrech/helenos/network.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/tcp/tcp_header.h

    rb5cbff4 r71b00dcc  
    4343/** TCP header size in bytes.
    4444 */
    45 #define TCP_HEADER_SIZE                 sizeof( tcp_header_t )
     45#define TCP_HEADER_SIZE                 sizeof(tcp_header_t)
    4646
    4747/** Returns the actual TCP header length in bytes.
    4848 *  @param[in] header The TCP packet header.
    4949 */
    50 #define TCP_HEADER_LENGTH( header )             (( header )->header_length * 4u )
     50#define TCP_HEADER_LENGTH(header)               ((header)->header_length * 4u)
    5151
    5252/** Returns the TCP header length.
    5353 *  @param[in] length The TCP header length in bytes.
    5454 */
    55 #define TCP_COMPUTE_HEADER_LENGTH( length )             (( uint8_t ) (( length ) / 4u ))
     55#define TCP_COMPUTE_HEADER_LENGTH(length)               ((uint8_t) ((length) / 4u))
    5656
    5757/** Type definition of the transmission datagram header.
     
    9090        /** The source port number.
    9191         */
    92         uint16_t        source_port;
     92        uint16_t source_port;
    9393        /** The destination port number.
    9494         */
    95         uint16_t        destination_port;
     95        uint16_t destination_port;
    9696        /** The sequence number of the first data octet in this segment (except when SYN is present).
    9797         *  If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1.
    9898         */
    99         uint32_t        sequence_number;
     99        uint32_t sequence_number;
    100100        /** If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive.
    101101         *  Once a~connection is established this is always sent.
    102102         *  @see acknowledge
    103103         */
    104         uint32_t        acknowledgement_number;
     104        uint32_t acknowledgement_number;
    105105#ifdef ARCH_IS_BIG_ENDIAN
    106106        /** The number of 32~bit words in the TCP Header.
     
    108108         *  The TCP header (even one including options) is an integral number of 32~bits long.
    109109         */
    110         uint8_t header_length:4;
     110        uint8_t header_length:4;
    111111        /** Four bits reserved for future use.
    112112         *  Must be zero.
    113113         */
    114         uint8_t reserved1:4;
     114        uint8_t reserved1:4;
    115115#else
    116116        /** Four bits reserved for future use.
    117117         *  Must be zero.
    118118         */
    119         uint8_t reserved1:4;
     119        uint8_t reserved1:4;
    120120        /** The number of 32~bit words in the TCP Header.
    121121         *  This indicates where the data begins.
    122122         *  The TCP header (even one including options) is an integral number of 32~bits long.
    123123         */
    124         uint8_t header_length:4;
     124        uint8_t header_length:4;
    125125#endif
    126126#ifdef ARCH_IS_BIG_ENDIAN
     
    128128         *  Must be zero.
    129129         */
    130         uint8_t reserved2:2;
     130        uint8_t reserved2:2;
    131131        /** Urgent Pointer field significant.
    132132         *  @see tcp_header:urgent_pointer
    133133         */
    134         uint8_t urgent:1;
     134        uint8_t urgent:1;
    135135        /** Acknowledgment field significant
    136136         *  @see tcp_header:acknowledgement_number
    137137         */
    138         uint8_t acknowledge:1;
     138        uint8_t acknowledge:1;
    139139        /** Push function.
    140140         */
    141         uint8_t push:1;
     141        uint8_t push:1;
    142142        /** Reset the connection.
    143143         */
    144         uint8_t reset:1;
     144        uint8_t reset:1;
    145145        /** Synchronize the sequence numbers.
    146146         */
    147         uint8_t synchronize:1;
     147        uint8_t synchronize:1;
    148148        /** No more data from the sender.
    149149         */
    150         uint8_t finalize:1;
     150        uint8_t finalize:1;
    151151#else
    152152        /** No more data from the sender.
    153153         */
    154         uint8_t finalize:1;
     154        uint8_t finalize:1;
    155155        /** Synchronize the sequence numbers.
    156156         */
    157         uint8_t synchronize:1;
     157        uint8_t synchronize:1;
    158158        /** Reset the connection.
    159159         */
    160         uint8_t reset:1;
     160        uint8_t reset:1;
    161161        /** Push function.
    162162         */
    163         uint8_t push:1;
     163        uint8_t push:1;
    164164        /** Acknowledgment field significant.
    165165         *  @see tcp_header:acknowledgement_number
    166166         */
    167         uint8_t acknowledge:1;
     167        uint8_t acknowledge:1;
    168168        /** Urgent Pointer field significant.
    169169         *  @see tcp_header:urgent_pointer
    170170         */
    171         uint8_t urgent:1;
     171        uint8_t urgent:1;
    172172        /** Two bits reserved for future use.
    173173         *  Must be zero.
    174174         */
    175         uint8_t reserved2:2;
     175        uint8_t reserved2:2;
    176176#endif
    177177        /** The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
    178178         *  @see tcp_header:acknowledge
    179179         */
    180         uint16_t        window;
     180        uint16_t window;
    181181        /** The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header and text.
    182182         *  If a~segment contains an odd number of header and text octets to be checksummed, the last octet is padded on the right with zeros to form a~16~bit word for checksum purposes.
     
    188188         *  If the computed checksum is zero, it is transmitted as all ones (the equivalent in one's complement arithmetic).
    189189         */
    190         uint16_t        checksum;
     190        uint16_t checksum;
    191191        /** This field communicates the current value of the urgent pointer as a~positive offset from the sequence number in this segment.
    192192         *  The urgent pointer points to the sequence number of the octet following the urgent data.
     
    194194         *  @see tcp_header:urgent
    195195         */
    196         uint16_t        urgent_pointer;
     196        uint16_t urgent_pointer;
    197197} __attribute__ ((packed));
    198198
     
    202202        /** Option type.
    203203         */
    204         uint8_t         type;
     204        uint8_t type;
    205205        /** Option length.
    206206         */
    207         uint8_t         length;
     207        uint8_t length;
    208208};
    209209
     
    215215         *  @see TCPOPT_MAX_SEGMENT_SIZE_LENGTH
    216216         */
    217         tcp_option_t    option;
     217        tcp_option_t option;
    218218        /** Maximum segment size in bytes.
    219219         */
    220         uint16_t                max_segment_size;
     220        uint16_t max_segment_size;
    221221} __attribute__ ((packed));
    222222
Note: See TracChangeset for help on using the changeset viewer.