Subversion Repositories HelenOS

Rev

Rev 4728 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4728 Rev 4731
Line 65... Line 65...
65
 *  @param header The IP packet header. Input parameter.
65
 *  @param header The IP packet header. Input parameter.
66
 */
66
 */
67
#define IP_HEADER_CHECKSUM( header )    ( htons( ip_checksum(( uint8_t * )( header ), IP_HEADER_LENGTH( header ))))
67
#define IP_HEADER_CHECKSUM( header )    ( htons( ip_checksum(( uint8_t * )( header ), IP_HEADER_LENGTH( header ))))
68
 
68
 
69
/** Returns the fragment offest.
69
/** Returns the fragment offest.
-
 
70
 *  @param header The IP packet header. Input parameter.
-
 
71
 */
-
 
72
#define IP_FRAGMENT_OFFSET( header ) (((( header )->fragment_offset_high << 8 ) + ( header )->fragment_offset_low ) * 8u )
-
 
73
 
-
 
74
/** Returns the fragment offest high bits.
-
 
75
 *  @param length The prefixed data total length. Input parameter.
-
 
76
 */
-
 
77
#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH( length ) (((( length ) / 8u ) & 0x1F00 ) >> 8 )
-
 
78
 
-
 
79
/** Returns the fragment offest low bits.
70
 *  @param length The prefixed data total length. Input parameter.
80
 *  @param length The prefixed data total length. Input parameter.
71
 */
81
 */
72
#define IP_COMPUTE_FRAGMENT_OFFSET( length ) (( length ) / 8 )
82
#define IP_COMPUTE_FRAGMENT_OFFSET_LOW( length ) ((( length ) / 8u ) & 0xFF )
73
 
83
 
74
/** Type definition of the internet header.
84
/** Type definition of the internet header.
75
 *  @see ip_header
85
 *  @see ip_header
76
 */
86
 */
77
typedef struct ip_header    ip_header_t;
87
typedef struct ip_header    ip_header_t;
Line 115... Line 125...
115
    /** An identifying value assigned by the sender to aid in assembling the fragments of a~datagram.
125
    /** An identifying value assigned by the sender to aid in assembling the fragments of a~datagram.
116
     */
126
     */
117
    uint16_t    identification;
127
    uint16_t    identification;
118
#ifdef ARCH_IS_BIG_ENDIAN
128
#ifdef ARCH_IS_BIG_ENDIAN
119
    /** Various control flags.
129
    /** Various control flags.
120
     *  @see
-
 
121
     */
130
     */
122
    uint16_t    flags:3;
131
    uint8_t flags:3;
123
    /** This field indicates where in the datagram this fragment belongs.
132
    /** This field indicates where in the datagram this fragment belongs.
-
 
133
     *  High bits.
124
     */
134
     */
125
    uint16_t    fragment_offset:3;
135
    uint8_t fragment_offset_high:5;
126
#else
136
#else
127
    /** This field indicates where in the datagram this fragment belongs.
137
    /** This field indicates where in the datagram this fragment belongs.
-
 
138
     *  High bits.
128
     */
139
     */
129
    uint16_t    fragment_offset:13;
140
    uint8_t fragment_offset_high:5;
130
    /** Various control flags.
141
    /** Various control flags.
131
     */
142
     */
132
    uint16_t    flags:3;
143
    uint8_t flags:3;
133
#endif
144
#endif
-
 
145
    /** This field indicates where in the datagram this fragment belongs.
-
 
146
     *  Low bits.
-
 
147
     */
-
 
148
    uint8_t fragment_offset_low;
134
    /** This field indicates the maximum time the datagram is allowed to remain in the internet system.
149
    /** This field indicates the maximum time the datagram is allowed to remain in the internet system.
135
     *  If this field contains the value zero, then the datagram must be destroyed.
150
     *  If this field contains the value zero, then the datagram must be destroyed.
136
     *  This field is modified in internet header processing.
151
     *  This field is modified in internet header processing.
137
     *  The time is measured in units of seconds, but since every module that processes a~datagram must decrease the TTL by at least one even if it process the datagram in less than a~second, the TTL must be thought of only as an upper bound on the time a~datagram may exist.
152
     *  The time is measured in units of seconds, but since every module that processes a~datagram must decrease the TTL by at least one even if it process the datagram in less than a~second, the TTL must be thought of only as an upper bound on the time a~datagram may exist.
138
     *  The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.
153
     *  The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.