Changeset 4687a26c in mainline for uspace/srv/net/nil/eth/eth_header.h
- Timestamp:
- 2010-11-02T18:29:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f35b9ff
- Parents:
- 76e1121f (diff), 28f4adb (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
r76e1121f r4687a26c 32 32 33 33 /** @file 34 * 35 * Based on the IEEE~802.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 */ 45 #define ETH_ADDR 6 46 47 /** Ethernet header preamble value. 48 */ 43 /** Ethernet address length. */ 44 #define ETH_ADDR 6 45 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 54 55 /** IEEE 802.2 unordered information control field. 56 */ 49 /** Ethernet header start of frame value. */ 50 #define ETH_SFD 0xD5 51 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 * @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; 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; 68 66 69 67 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 70 * 71 */ 72 typedef struct eth_header_lsap 68 * @see eth_header_lsap 69 */ 70 typedef struct eth_header_lsap eth_header_lsap_t; 73 71 74 72 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 extension pointer. 75 * 76 */ 77 typedef eth_header_lsap_t * 73 * @see eth_header_lsap 74 */ 75 typedef eth_header_lsap_t *eth_header_lsap_ref; 78 76 79 77 /** Type definition of the Ethernet header LSAP extension. 80 * 81 */ 82 typedef struct eth_ieee_lsap 78 * @see eth_ieee_lsap 79 */ 80 typedef struct eth_ieee_lsap eth_ieee_lsap_t; 83 81 84 82 /** Type definition of the Ethernet header LSAP extension pointer. 85 * 86 */ 87 typedef eth_ieee_lsap_t * 83 * @see eth_ieee_lsap 84 */ 85 typedef eth_ieee_lsap_t *eth_ieee_lsap_ref; 88 86 89 87 /** Type definition of the Ethernet header SNAP extension. 90 * 91 */ 92 typedef struct eth_snap 88 * @see eth_snap 89 */ 90 typedef struct eth_snap eth_snap_t; 93 91 94 92 /** Type definition of the Ethernet header SNAP extension pointer. 95 * 96 */ 97 typedef eth_snap_t * 93 * @see eth_snap 94 */ 95 typedef eth_snap_t *eth_snap_ref; 98 96 99 97 /** Type definition of the Ethernet header preamble. 100 * 101 */ 102 typedef struct eth_preamble 98 * @see preamble 99 */ 100 typedef struct eth_preamble eth_preamble_t; 103 101 104 102 /** Type definition of the Ethernet header preamble pointer. 105 * 106 */ 107 typedef eth_preamble_t * 103 * @see eth_preamble 104 */ 105 typedef eth_preamble_t *eth_preamble_ref; 108 106 109 107 /** Type definition of the Ethernet header. 110 * 111 */ 112 typedef struct eth_header 108 * @see eth_header 109 */ 110 typedef struct eth_header eth_header_t; 113 111 114 112 /** Type definition of the Ethernet header pointer. 115 * 116 */ 117 typedef eth_header_t * 118 119 /** Ethernet header Link Service Access Point extension. 120 */ 121 struct eth_ieee_lsap{ 122 /** Destination Service Access Point identifier.113 * @see eth_header 114 */ 115 typedef eth_header_t *eth_header_ref; 116 117 /** Ethernet header Link Service Access Point extension. */ 118 struct eth_ieee_lsap { 119 /** 120 * Destination Service Access Point identifier. 123 121 * The possible values are assigned by an IEEE committee. 124 122 */ 125 123 uint8_t dsap; 126 /** Source Service Access Point identifier. 124 125 /** 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 /** Control parameter. 130 131 /** 132 * Control parameter. 131 133 * The possible values are assigned by an IEEE committee. 132 134 */ … … 134 136 } __attribute__ ((packed)); 135 137 136 /** Ethernet header SNAP extension. 137 */ 138 struct eth_snap{ 139 /** Protocol identifier or organization code. 140 */ 138 /** Ethernet header SNAP extension. */ 139 struct eth_snap { 140 /** Protocol identifier or organization code. */ 141 141 uint8_t protocol[3]; 142 /** Ethernet protocol identifier in the network byte order (big endian). 143 * @see ethernet_protocols.h 142 143 /** 144 * Ethernet protocol identifier in the network byte order (big endian). 145 * @see ethernet_protocols.h 144 146 */ 145 147 uint16_t ethertype; … … 147 149 148 150 /** Ethernet header 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. 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. 154 158 */ 155 159 uint8_t preamble[7]; 156 /** Start of Frame Delimiter used for the frame transmission synchronization. 157 * Should be set to ETH_SFD. 160 161 /** 162 * Start of Frame Delimiter used for the frame transmission 163 * synchronization. 164 * Should be set to ETH_SFD. 158 165 */ 159 166 uint8_t sfd; 160 167 } __attribute__ ((packed)); 161 168 162 /** Ethernet header. 163 */ 164 struct eth_header{ 165 /** Destination host Ethernet address (MAC address). 166 */ 169 /** Ethernet header. */ 170 struct eth_header { 171 /** Destination host Ethernet address (MAC address). */ 167 172 uint8_t destination_address[ETH_ADDR]; 168 /** Source host Ethernet address (MAC address). 169 */ 173 /** Source host Ethernet address (MAC address). */ 170 174 uint8_t source_address[ETH_ADDR]; 171 /** Ethernet protocol identifier in the network byte order (big endian). 172 * @see ethernet_protocols.h 175 176 /** 177 * Ethernet protocol identifier in the network byte order (big endian). 178 * @see ethernet_protocols.h 173 179 */ 174 180 uint16_t ethertype; 175 181 } __attribute__ ((packed)); 176 182 177 /** Ethernet header IEEE 802.3 + 802.2 extension. 178 */ 179 struct eth_header_lsap{ 180 /** Ethernet header. 181 */ 183 /** Ethernet header IEEE 802.3 + 802.2 extension. */ 184 struct eth_header_lsap { 185 /** Ethernet header. */ 182 186 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. 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. 186 195 */ 187 196 eth_ieee_lsap_t lsap; 188 197 } __attribute__ ((packed)); 189 198 190 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 191 */ 192 struct eth_header_snap{ 193 /** Ethernet header. 194 */ 199 /** Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. */ 200 struct eth_header_snap { 201 /** Ethernet header. */ 195 202 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. 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. 199 211 */ 200 212 eth_ieee_lsap_t lsap; 201 /** SNAP extension.202 */213 214 /** SNAP extension. */ 203 215 eth_snap_t snap; 204 216 } __attribute__ ((packed)); 205 217 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; 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; 213 223 214 224 #endif
Note:
See TracChangeset
for help on using the changeset viewer.