Changeset 41811af in mainline for uspace/srv/net/tl/tcp/tcp_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/srv/net/tl/tcp/tcp_header.h
r9536e6e r41811af 47 47 * @param[in] header The TCP packet header. 48 48 */ 49 #define TCP_HEADER_LENGTH(header) ( (header)->header_length* 4U)49 #define TCP_HEADER_LENGTH(header) (GET_TCP_HEADER_LENGTH(header) * 4U) 50 50 51 51 /** Returns the TCP header length. … … 73 73 uint32_t sequence_number; 74 74 uint32_t acknowledgement_number; 75 76 #ifdef ARCH_IS_BIG_ENDIAN77 uint8_t header_length:4;78 uint8_t reserved1:4;79 #else80 uint8_t reserved1:4;81 uint8_t header_length:4;82 #endif83 75 84 #ifdef ARCH_IS_BIG_ENDIAN 85 uint8_t reserved2:2; 86 uint8_t urgent:1; 87 uint8_t acknowledge:1; 88 uint8_t push:1; 89 uint8_t reset:1; 90 uint8_t synchronize:1; 91 uint8_t finalize:1; 92 #else 93 uint8_t finalize:1; 94 uint8_t synchronize:1; 95 uint8_t reset:1; 96 uint8_t push:1; 97 uint8_t acknowledge:1; 98 uint8_t urgent:1; 99 uint8_t reserved2:2; 100 #endif 76 uint8_t hlr; /* header length, reserved1 */ 77 78 #define GET_TCP_HEADER_LENGTH(header) \ 79 (((header)->hlr & 0xf0) >> 4) 80 #define SET_TCP_HEADER_LENGTH(header, length) \ 81 ((header)->hlr = \ 82 ((length & 0x0f) << 4) | ((header)->hlr & 0x0f)) 83 84 #define GET_TCP_HEADER_RESERVED1(header) \ 85 ((header)->hlr & 0x0f) 86 #define SET_TCP_HEADER_RESERVED1(header, reserved1) \ 87 ((header)->hlr = \ 88 (reserved1 & 0x0f) | ((header)->hlr & 0xf0)) 89 90 /* reserved2, urgent, acknowledge, push, reset, synchronize, finalize */ 91 uint8_t ruaprsf; 92 93 #define GET_TCP_HEADER_RESERVED2(header) \ 94 (((header)->ruaprsf & 0xc0) >> 6) 95 #define SET_TCP_HEADER_RESERVED2(header, reserved2) \ 96 ((header)->ruaprsf = \ 97 ((reserved2 & 0x03) << 6) | ((header)->ruaprsf & 0x3f)) 98 99 #define GET_TCP_HEADER_URGENT(header) \ 100 (((header)->ruaprsf & 0x20) >> 5) 101 #define SET_TCP_HEADER_URGENT(header, urgent) \ 102 ((header)->ruaprsf = \ 103 ((urgent & 0x01) << 5) | ((header)->ruaprsf & 0xdf)) 104 105 #define GET_TCP_HEADER_ACKNOWLEDGE(header) \ 106 (((header)->ruaprsf & 0x10) >> 4) 107 #define SET_TCP_HEADER_ACKNOWLEDGE(header, acknowledge) \ 108 ((header)->ruaprsf = \ 109 ((acknowledge & 0x01) << 4) | ((header)->ruaprsf & 0xef)) 110 111 #define GET_TCP_HEADER_PUSH(header) \ 112 (((header)->ruaprsf & 0x08) >> 3) 113 #define SET_TCP_HEADER_PUSH(header, push) \ 114 ((header)->ruaprsf = \ 115 ((push & 0x01) << 3) | ((header)->ruaprsf & 0xf7)) 116 117 #define GET_TCP_HEADER_RESET(header) \ 118 (((header)->ruaprsf & 0x04) >> 2) 119 #define SET_TCP_HEADER_RESET(header, reset) \ 120 ((header)->ruaprsf = \ 121 ((reset & 0x01) << 2) | ((header)->ruaprsf & 0xfb)) 122 123 #define GET_TCP_HEADER_SYNCHRONIZE(header) \ 124 (((header)->ruaprsf & 0x02) >> 1) 125 #define SET_TCP_HEADER_SYNCHRONIZE(header, synchronize) \ 126 ((header)->ruaprsf = \ 127 ((synchronize & 0x01) << 1) | ((header)->ruaprsf & 0xfd)) 128 129 #define GET_TCP_HEADER_FINALIZE(header) \ 130 ((header)->ruaprsf & 0x01) 131 #define SET_TCP_HEADER_FINALIZE(header, finalize) \ 132 ((header)->ruaprsf = \ 133 (finalize & 0x01) | ((header)->ruaprsf & 0xfe)) 101 134 102 135 uint16_t window;
Note:
See TracChangeset
for help on using the changeset viewer.