Changes in uspace/srv/net/nil/eth/eth_header.h [6067284:aadf01e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/nil/eth/eth_header.h
r6067284 raadf01e 32 32 33 33 /** @file 34 * Ethernet protocol header definitions.35 * Based on the IEEE802.3-200536 */ 37 38 #ifndef NET_ETH_HEADER_H_39 #define NET_ETH_HEADER_H_34 * Ethernet protocol header definitions. 35 * Based on the IEEE~802.3-2005 36 */ 37 38 #ifndef __NET_ETH_HEADER_H__ 39 #define __NET_ETH_HEADER_H__ 40 40 41 41 #include <sys/types.h> 42 42 43 /** Ethernet address length. */ 44 #define ETH_ADDR 6 45 46 /** Ethernet header preamble value. */ 43 /** Ethernet address length. 44 */ 45 #define ETH_ADDR 6 46 47 /** Ethernet header preamble value. 48 */ 47 49 #define ETH_PREAMBLE 0x55 48 50 49 /** Ethernet header start of frame value. */ 50 #define ETH_SFD 0xD5 51 52 /** IEEE 802.2 unordered information control field. */ 51 /** Ethernet header start of frame value. 52 */ 53 #define ETH_SFD 0xD5 54 55 /** IEEE 802.2 unordered information control field. 56 */ 53 57 #define IEEE_8023_2_UI 0x03 54 58 55 59 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 56 * @see eth_header_snap 57 */ 58 typedef struct eth_header_snap eth_header_snap_t; 59 60 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions 61 * pointer. 62 * 63 * @see eth_header_snap 64 */ 65 typedef eth_header_snap_t *eth_header_snap_ref; 60 * @see eth_header_snap 61 */ 62 typedef struct eth_header_snap eth_header_snap_t; 63 64 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions pointer. 65 * @see eth_header_snap 66 */ 67 typedef eth_header_snap_t * eth_header_snap_ref; 66 68 67 69 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 68 * @see eth_header_lsap69 */ 70 typedef struct eth_header_lsap 70 * @see eth_header_lsap 71 */ 72 typedef struct eth_header_lsap eth_header_lsap_t; 71 73 72 74 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 extension pointer. 73 * @see eth_header_lsap74 */ 75 typedef eth_header_lsap_t * eth_header_lsap_ref;75 * @see eth_header_lsap 76 */ 77 typedef eth_header_lsap_t * eth_header_lsap_ref; 76 78 77 79 /** Type definition of the Ethernet header LSAP extension. 78 * @see eth_ieee_lsap79 */ 80 typedef struct eth_ieee_lsap 80 * @see eth_ieee_lsap 81 */ 82 typedef struct eth_ieee_lsap eth_ieee_lsap_t; 81 83 82 84 /** Type definition of the Ethernet header LSAP extension pointer. 83 * @see eth_ieee_lsap84 */ 85 typedef eth_ieee_lsap_t * eth_ieee_lsap_ref;85 * @see eth_ieee_lsap 86 */ 87 typedef eth_ieee_lsap_t * eth_ieee_lsap_ref; 86 88 87 89 /** Type definition of the Ethernet header SNAP extension. 88 * @see eth_snap89 */ 90 typedef struct eth_snap 90 * @see eth_snap 91 */ 92 typedef struct eth_snap eth_snap_t; 91 93 92 94 /** Type definition of the Ethernet header SNAP extension pointer. 93 * @see eth_snap94 */ 95 typedef eth_snap_t * eth_snap_ref;95 * @see eth_snap 96 */ 97 typedef eth_snap_t * eth_snap_ref; 96 98 97 99 /** Type definition of the Ethernet header preamble. 98 * @see preamble99 */ 100 typedef struct eth_preamble 100 * @see preamble 101 */ 102 typedef struct eth_preamble eth_preamble_t; 101 103 102 104 /** Type definition of the Ethernet header preamble pointer. 103 * @see eth_preamble104 */ 105 typedef eth_preamble_t * eth_preamble_ref;105 * @see eth_preamble 106 */ 107 typedef eth_preamble_t * eth_preamble_ref; 106 108 107 109 /** Type definition of the Ethernet header. 108 * @see eth_header109 */ 110 typedef struct eth_header 110 * @see eth_header 111 */ 112 typedef struct eth_header eth_header_t; 111 113 112 114 /** Type definition of the Ethernet header pointer. 113 * @see eth_header114 */ 115 typedef eth_header_t * eth_header_ref;116 117 /** Ethernet header Link Service Access Point extension. */118 struct eth_ieee_lsap { 119 /** 120 115 * @see eth_header 116 */ 117 typedef eth_header_t * eth_header_ref; 118 119 /** Ethernet header Link Service Access Point extension. 120 */ 121 struct eth_ieee_lsap{ 122 /** Destination Service Access Point identifier. 121 123 * The possible values are assigned by an IEEE committee. 122 124 */ 123 125 uint8_t dsap; 124 125 /** 126 * Source Service Access Point identifier. 126 /** Source Service Access Point identifier. 127 127 * The possible values are assigned by an IEEE committee. 128 128 */ 129 129 uint8_t ssap; 130 131 /** 132 * Control parameter. 130 /** Control parameter. 133 131 * The possible values are assigned by an IEEE committee. 134 132 */ … … 136 134 } __attribute__ ((packed)); 137 135 138 /** Ethernet header SNAP extension. */ 139 struct eth_snap { 140 /** Protocol identifier or organization code. */ 136 /** Ethernet header SNAP extension. 137 */ 138 struct eth_snap{ 139 /** Protocol identifier or organization code. 140 */ 141 141 uint8_t protocol[3]; 142 143 /** 144 * Ethernet protocol identifier in the network byte order (big endian). 145 * @see ethernet_protocols.h 142 /** Ethernet protocol identifier in the network byte order (big endian). 143 * @see ethernet_protocols.h 146 144 */ 147 145 uint16_t ethertype; … … 149 147 150 148 /** Ethernet header preamble. 151 * 152 * Used for dummy devices. 153 */ 154 struct eth_preamble { 155 /** 156 * Controlling preamble used for the frame transmission synchronization. 157 * All should be set to ETH_PREAMBLE. 149 * Used for dummy devices. 150 */ 151 struct eth_preamble{ 152 /** Controlling preamble used for the frame transmission synchronization. 153 * All should be set to ETH_PREAMBLE. 158 154 */ 159 155 uint8_t preamble[7]; 160 161 /** 162 * Start of Frame Delimiter used for the frame transmission 163 * synchronization. 164 * Should be set to ETH_SFD. 156 /** Start of Frame Delimiter used for the frame transmission synchronization. 157 * Should be set to ETH_SFD. 165 158 */ 166 159 uint8_t sfd; 167 160 } __attribute__ ((packed)); 168 161 169 /** Ethernet header. */ 170 struct eth_header { 171 /** Destination host Ethernet address (MAC address). */ 162 /** Ethernet header. 163 */ 164 struct eth_header{ 165 /** Destination host Ethernet address (MAC address). 166 */ 172 167 uint8_t destination_address[ETH_ADDR]; 173 /** Source host Ethernet address (MAC address). */ 168 /** Source host Ethernet address (MAC address). 169 */ 174 170 uint8_t source_address[ETH_ADDR]; 175 176 /** 177 * Ethernet protocol identifier in the network byte order (big endian). 178 * @see ethernet_protocols.h 171 /** Ethernet protocol identifier in the network byte order (big endian). 172 * @see ethernet_protocols.h 179 173 */ 180 174 uint16_t ethertype; 181 175 } __attribute__ ((packed)); 182 176 183 /** Ethernet header IEEE 802.3 + 802.2 extension. */ 184 struct eth_header_lsap { 185 /** Ethernet header. */ 177 /** Ethernet header IEEE 802.3 + 802.2 extension. 178 */ 179 struct eth_header_lsap{ 180 /** Ethernet header. 181 */ 186 182 eth_header_t header; 187 188 /** 189 * LSAP extension. 190 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being 191 * used. 192 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet 193 * without any extensions is being used and the frame content starts 194 * rigth after the two fields. 183 /** LSAP extension. 184 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being used. 185 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet without any extensions is being used and the frame content starts rigth after the two fields. 195 186 */ 196 187 eth_ieee_lsap_t lsap; 197 188 } __attribute__ ((packed)); 198 189 199 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. */ 200 struct eth_header_snap { 201 /** Ethernet header. */ 190 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 191 */ 192 struct eth_header_snap{ 193 /** Ethernet header. 194 */ 202 195 eth_header_t header; 203 204 /** 205 * LSAP extension. 206 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being 207 * used. 208 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet 209 * without any extensions is being used and the frame content starts 210 * rigth after the two fields. 196 /** LSAP extension. 197 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being used. 198 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet without any extensions is being used and the frame content starts rigth after the two fields. 211 199 */ 212 200 eth_ieee_lsap_t lsap; 213 214 /** SNAP extension.*/201 /** SNAP extension. 202 */ 215 203 eth_snap_t snap; 216 204 } __attribute__ ((packed)); 217 205 218 /** Ethernet Frame Check Sequence. */ 219 typedef uint32_t eth_fcs_t; 220 221 /** Ethernet Frame Check Sequence pointer. */ 222 typedef eth_fcs_t *eth_fcs_ref; 206 /** Ethernet Frame Check Sequence. 207 */ 208 typedef uint32_t eth_fcs_t; 209 210 /** Ethernet Frame Check Sequence pointer. 211 */ 212 typedef eth_fcs_t * eth_fcs_ref; 223 213 224 214 #endif
Note:
See TracChangeset
for help on using the changeset viewer.