Changeset 0b749a3 in mainline for uspace/srv/net/nil/eth/eth_header.h
- Timestamp:
- 2010-11-22T15:39:53Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eddb76, aae339e9
- Parents:
- 9a1d8ab (diff), 8cd1aa5e (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/nil/eth/eth_header.h
r9a1d8ab r0b749a3 32 32 33 33 /** @file 34 * 35 * Based on the IEEE~802.3-200534 * Ethernet protocol header definitions. 35 * Based on the IEEE 802.3-2005 36 36 */ 37 37 38 #ifndef __NET_ETH_HEADER_H__39 #define __NET_ETH_HEADER_H__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 */ 45 #define ETH_ADDR 6 43 /** Ethernet address length. */ 44 #define ETH_ADDR 6 46 45 47 /** Ethernet header preamble value. 48 */ 46 /** Ethernet header preamble value. */ 49 47 #define ETH_PREAMBLE 0x55 50 48 51 /** Ethernet header start of frame value. 52 */ 53 #define ETH_SFD 0xD5 49 /** Ethernet header start of frame value. */ 50 #define ETH_SFD 0xD5 54 51 55 /** IEEE 802.2 unordered information control field. 56 */ 52 /** IEEE 802.2 unordered information control field. */ 57 53 #define IEEE_8023_2_UI 0x03 58 54 59 55 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 60 * 56 * @see eth_header_snap 61 57 */ 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; 58 typedef struct eth_header_snap eth_header_snap_t; 68 59 69 60 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 70 * 61 * @see eth_header_lsap 71 62 */ 72 typedef struct eth_header_lsap eth_header_lsap_t; 73 74 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 extension pointer. 75 * @see eth_header_lsap 76 */ 77 typedef eth_header_lsap_t * eth_header_lsap_ref; 63 typedef struct eth_header_lsap eth_header_lsap_t; 78 64 79 65 /** Type definition of the Ethernet header LSAP extension. 80 * 66 * @see eth_ieee_lsap 81 67 */ 82 typedef struct eth_ieee_lsap eth_ieee_lsap_t; 83 84 /** Type definition of the Ethernet header LSAP extension pointer. 85 * @see eth_ieee_lsap 86 */ 87 typedef eth_ieee_lsap_t * eth_ieee_lsap_ref; 68 typedef struct eth_ieee_lsap eth_ieee_lsap_t; 88 69 89 70 /** Type definition of the Ethernet header SNAP extension. 90 * 71 * @see eth_snap 91 72 */ 92 typedef struct eth_snap eth_snap_t; 93 94 /** Type definition of the Ethernet header SNAP extension pointer. 95 * @see eth_snap 96 */ 97 typedef eth_snap_t * eth_snap_ref; 73 typedef struct eth_snap eth_snap_t; 98 74 99 75 /** Type definition of the Ethernet header preamble. 100 * 76 * @see preamble 101 77 */ 102 typedef struct eth_preamble eth_preamble_t; 103 104 /** Type definition of the Ethernet header preamble pointer. 105 * @see eth_preamble 106 */ 107 typedef eth_preamble_t * eth_preamble_ref; 78 typedef struct eth_preamble eth_preamble_t; 108 79 109 80 /** Type definition of the Ethernet header. 110 * 81 * @see eth_header 111 82 */ 112 typedef struct eth_header 83 typedef struct eth_header eth_header_t; 113 84 114 /** Type definition of the Ethernet header pointer. 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. 85 /** Ethernet header Link Service Access Point extension. */ 86 struct eth_ieee_lsap { 87 /** 88 * Destination Service Access Point identifier. 123 89 * The possible values are assigned by an IEEE committee. 124 90 */ 125 91 uint8_t dsap; 126 /** Source Service Access Point identifier. 92 93 /** 94 * Source Service Access Point identifier. 127 95 * The possible values are assigned by an IEEE committee. 128 96 */ 129 97 uint8_t ssap; 130 /** Control parameter. 98 99 /** 100 * Control parameter. 131 101 * The possible values are assigned by an IEEE committee. 132 102 */ … … 134 104 } __attribute__ ((packed)); 135 105 136 /** Ethernet header SNAP extension. 137 */ 138 struct eth_snap{ 139 /** Protocol identifier or organization code. 140 */ 106 /** Ethernet header SNAP extension. */ 107 struct eth_snap { 108 /** Protocol identifier or organization code. */ 141 109 uint8_t protocol[3]; 142 /** Ethernet protocol identifier in the network byte order (big endian). 143 * @see ethernet_protocols.h 110 111 /** 112 * Ethernet protocol identifier in the network byte order (big endian). 113 * @see ethernet_protocols.h 144 114 */ 145 115 uint16_t ethertype; … … 147 117 148 118 /** Ethernet header preamble. 149 * Used for dummy devices. 119 * 120 * Used for dummy devices. 150 121 */ 151 struct eth_preamble{ 152 /** Controlling preamble used for the frame transmission synchronization. 153 * All should be set to ETH_PREAMBLE. 122 struct eth_preamble { 123 /** 124 * Controlling preamble used for the frame transmission synchronization. 125 * All should be set to ETH_PREAMBLE. 154 126 */ 155 127 uint8_t preamble[7]; 156 /** Start of Frame Delimiter used for the frame transmission synchronization. 157 * Should be set to ETH_SFD. 128 129 /** 130 * Start of Frame Delimiter used for the frame transmission 131 * synchronization. 132 * Should be set to ETH_SFD. 158 133 */ 159 134 uint8_t sfd; 160 135 } __attribute__ ((packed)); 161 136 162 /** Ethernet header. 163 */ 164 struct eth_header{ 165 /** Destination host Ethernet address (MAC address). 166 */ 137 /** Ethernet header. */ 138 struct eth_header { 139 /** Destination host Ethernet address (MAC address). */ 167 140 uint8_t destination_address[ETH_ADDR]; 168 /** Source host Ethernet address (MAC address). 169 */ 141 /** Source host Ethernet address (MAC address). */ 170 142 uint8_t source_address[ETH_ADDR]; 171 /** Ethernet protocol identifier in the network byte order (big endian). 172 * @see ethernet_protocols.h 143 144 /** 145 * Ethernet protocol identifier in the network byte order (big endian). 146 * @see ethernet_protocols.h 173 147 */ 174 148 uint16_t ethertype; 175 149 } __attribute__ ((packed)); 176 150 177 /** Ethernet header IEEE 802.3 + 802.2 extension. 178 */ 179 struct eth_header_lsap{ 180 /** Ethernet header. 181 */ 151 /** Ethernet header IEEE 802.3 + 802.2 extension. */ 152 struct eth_header_lsap { 153 /** Ethernet header. */ 182 154 eth_header_t header; 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. 155 156 /** 157 * LSAP extension. 158 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being 159 * used. 160 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet 161 * without any extensions is being used and the frame content starts 162 * rigth after the two fields. 186 163 */ 187 164 eth_ieee_lsap_t lsap; 188 165 } __attribute__ ((packed)); 189 166 190 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 191 */ 192 struct eth_header_snap{ 193 /** Ethernet header. 194 */ 167 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. */ 168 struct eth_header_snap { 169 /** Ethernet header. */ 195 170 eth_header_t header; 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. 171 172 /** 173 * LSAP extension. 174 * If DSAP and SSAP are set to ETH_LSAP_SNAP the SNAP extension is being 175 * used. 176 * If DSAP and SSAP fields are equal to ETH_RAW the raw Ethernet packet 177 * without any extensions is being used and the frame content starts 178 * rigth after the two fields. 199 179 */ 200 180 eth_ieee_lsap_t lsap; 201 /** SNAP extension.202 */181 182 /** SNAP extension. */ 203 183 eth_snap_t snap; 204 184 } __attribute__ ((packed)); 205 185 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; 186 /** Ethernet Frame Check Sequence. */ 187 typedef uint32_t eth_fcs_t; 213 188 214 189 #endif
Note:
See TracChangeset
for help on using the changeset viewer.