Changeset 41811af in mainline for uspace/lib/net/include/ip_header.h
- Timestamp:
- 2011-06-10T10:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab547063
- Parents:
- 9536e6e (diff), 390d80d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/ip_header.h
r9536e6e r41811af 64 64 */ 65 65 #define IP_FRAGMENT_OFFSET(header) \ 66 ((( (header)->fragment_offset_high<< 8) + \66 (((GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) << 8) + \ 67 67 (header)->fragment_offset_low) * 8U) 68 68 … … 83 83 */ 84 84 #define IP_HEADER_LENGTH(header) \ 85 ( (header)->header_length* 4U)85 (GET_IP_HEADER_LENGTH(header) * 4U) 86 86 87 87 /** Returns the actual IP packet total length. … … 143 143 */ 144 144 struct ip_header { 145 #ifdef ARCH_IS_BIG_ENDIAN 146 uint8_t version : 4; 147 uint8_t header_length : 4; 148 #else 149 uint8_t header_length : 4; 150 uint8_t version : 4; 151 #endif 145 uint8_t vhl; /* version, header_length */ 146 147 #define GET_IP_HEADER_VERSION(header) \ 148 (((header)->vhl & 0xf0) >> 4) 149 #define SET_IP_HEADER_VERSION(header, version) \ 150 ((header)->vhl = \ 151 ((version & 0x0f) << 4) | ((header)->vhl & 0x0f)) 152 153 #define GET_IP_HEADER_LENGTH(header) \ 154 ((header)->vhl & 0x0f) 155 #define SET_IP_HEADER_LENGTH(header, length) \ 156 ((header)->vhl = \ 157 (length & 0x0f) | ((header)->vhl & 0xf0)) 152 158 153 159 uint8_t tos; … … 155 161 uint16_t identification; 156 162 157 #ifdef ARCH_IS_BIG_ENDIAN 158 uint8_t flags : 3; 159 uint8_t fragment_offset_high : 5; 160 #else 161 uint8_t fragment_offset_high : 5; 162 uint8_t flags : 3; 163 #endif 163 uint8_t ffoh; /* flags, fragment_offset_high */ 164 165 #define GET_IP_HEADER_FLAGS(header) \ 166 (((header)->ffoh & 0xe0) >> 5) 167 #define SET_IP_HEADER_FLAGS(header, flags) \ 168 ((header)->ffoh = \ 169 ((flags & 0x07) << 5) | ((header)->ffoh & 0x1f)) 170 171 #define GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) \ 172 ((header)->ffoh & 0x1f) 173 #define SET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header, fragment_offset_high) \ 174 ((header)->ffoh = \ 175 (fragment_offset_high & 0x1f) | ((header)->ffoh & 0xe0)) 164 176 165 177 uint8_t fragment_offset_low; … … 181 193 uint8_t pointer; 182 194 183 #ifdef ARCH_IS_BIG_ENDIAN 184 uint8_t overflow : 4; 185 uint8_t flags : 4; 186 #else 187 uint8_t flags : 4; 188 uint8_t overflow : 4; 189 #endif 195 uint8_t of; /* overflow, flags */ 196 197 #define GET_IP_OPTION_OVERFLOW(option) \ 198 (((option)->of & 0xf0) >> 4) 199 #define SET_IP_OPTION_OVERFLOW(option, overflow) \ 200 ((option)->of = \ 201 ((overflow & 0x0f) << 4) | ((option)->of & 0x0f)) 202 203 #define GET_IP_OPTION_FLAGS(option) \ 204 ((option)->of & 0x0f) 205 #define SET_IP_OPTION_FLAGS(option, flags) \ 206 ((option)->of = \ 207 (flags & 0x0f) | ((option)->of & 0xf0)) 208 190 209 } __attribute__ ((packed)); 191 210
Note:
See TracChangeset
for help on using the changeset viewer.