Changeset 4687a26c in mainline for uspace/srv/net/nil/eth/eth_header.h


Ignore:
Timestamp:
2010-11-02T18:29:01Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/nil/eth/eth_header.h

    r76e1121f r4687a26c  
    3232
    3333/** @file
    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__
     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_
    4040
    4141#include <sys/types.h>
    4242
    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. */
    4947#define ETH_PREAMBLE    0x55
    5048
    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. */
    5753#define IEEE_8023_2_UI  0x03
    5854
    5955/** 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 */
     58typedef 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 */
     65typedef eth_header_snap_t *eth_header_snap_ref;
    6866
    6967/** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions.
    70  *  @see eth_header_lsap
    71  */
    72 typedef struct eth_header_lsap  eth_header_lsap_t;
     68 * @see eth_header_lsap
     69 */
     70typedef struct eth_header_lsap eth_header_lsap_t;
    7371
    7472/** 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;
     73 * @see eth_header_lsap
     74 */
     75typedef eth_header_lsap_t *eth_header_lsap_ref;
    7876
    7977/** Type definition of the Ethernet header LSAP extension.
    80  *  @see eth_ieee_lsap
    81  */
    82 typedef struct eth_ieee_lsap    eth_ieee_lsap_t;
     78 * @see eth_ieee_lsap
     79 */
     80typedef struct eth_ieee_lsap eth_ieee_lsap_t;
    8381
    8482/** 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;
     83 * @see eth_ieee_lsap
     84 */
     85typedef eth_ieee_lsap_t *eth_ieee_lsap_ref;
    8886
    8987/** Type definition of the Ethernet header SNAP extension.
    90  *  @see eth_snap
    91  */
    92 typedef struct eth_snap         eth_snap_t;
     88 * @see eth_snap
     89 */
     90typedef struct eth_snap eth_snap_t;
    9391
    9492/** Type definition of the Ethernet header SNAP extension pointer.
    95  *  @see eth_snap
    96  */
    97 typedef eth_snap_t *            eth_snap_ref;
     93 * @see eth_snap
     94 */
     95typedef eth_snap_t *eth_snap_ref;
    9896
    9997/** Type definition of the Ethernet header preamble.
    100  *  @see preamble
    101  */
    102 typedef struct eth_preamble     eth_preamble_t;
     98 * @see preamble
     99 */
     100typedef struct eth_preamble eth_preamble_t;
    103101
    104102/** Type definition of the Ethernet header preamble pointer.
    105  *  @see eth_preamble
    106  */
    107 typedef eth_preamble_t *        eth_preamble_ref;
     103 * @see eth_preamble
     104 */
     105typedef eth_preamble_t *eth_preamble_ref;
    108106
    109107/** Type definition of the Ethernet header.
    110  *  @see eth_header
    111  */
    112 typedef struct eth_header       eth_header_t;
     108 * @see eth_header
     109 */
     110typedef struct eth_header eth_header_t;
    113111
    114112/** 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.
     113 * @see eth_header
     114 */
     115typedef eth_header_t *eth_header_ref;
     116
     117/** Ethernet header Link Service Access Point extension. */
     118struct eth_ieee_lsap {
     119        /**
     120         * Destination Service Access Point identifier.
    123121         * The possible values are assigned by an IEEE committee.
    124122         */
    125123        uint8_t dsap;
    126         /** Source Service Access Point identifier.
     124       
     125        /**
     126         * Source Service Access Point identifier.
    127127         * The possible values are assigned by an IEEE committee.
    128128         */
    129129        uint8_t ssap;
    130         /** Control parameter.
     130       
     131        /**
     132         * Control parameter.
    131133         * The possible values are assigned by an IEEE committee.
    132134         */
     
    134136} __attribute__ ((packed));
    135137
    136 /** Ethernet header SNAP extension.
    137  */
    138 struct eth_snap{
    139         /** Protocol identifier or organization code.
    140          */
     138/** Ethernet header SNAP extension. */
     139struct eth_snap {
     140        /** Protocol identifier or organization code. */
    141141        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
    144146         */
    145147        uint16_t ethertype;
     
    147149
    148150/** 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 */
     154struct eth_preamble {
     155        /**
     156         * Controlling preamble used for the frame transmission synchronization.
     157         * All should be set to ETH_PREAMBLE.
    154158         */
    155159        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.
    158165         */
    159166        uint8_t sfd;
    160167} __attribute__ ((packed));
    161168
    162 /** Ethernet header.
    163  */
    164 struct eth_header{
    165         /** Destination host Ethernet address (MAC address).
    166          */
     169/** Ethernet header. */
     170struct eth_header {
     171        /** Destination host Ethernet address (MAC address). */
    167172        uint8_t destination_address[ETH_ADDR];
    168         /** Source host Ethernet address (MAC address).
    169          */
     173        /** Source host Ethernet address (MAC address). */
    170174        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
    173179         */
    174180        uint16_t ethertype;
    175181} __attribute__ ((packed));
    176182
    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. */
     184struct eth_header_lsap {
     185        /** Ethernet header. */
    182186        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.
    186195         */
    187196        eth_ieee_lsap_t lsap;
    188197} __attribute__ ((packed));
    189198
    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. */
     200struct eth_header_snap {
     201        /** Ethernet header. */
    195202        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.
    199211         */
    200212        eth_ieee_lsap_t lsap;
    201         /** SNAP extension.
    202         */
     213       
     214        /** SNAP extension. */
    203215        eth_snap_t snap;
    204216} __attribute__ ((packed));
    205217
    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. */
     219typedef uint32_t eth_fcs_t;
     220
     221/** Ethernet Frame Check Sequence pointer. */
     222typedef eth_fcs_t *eth_fcs_ref;
    213223
    214224#endif
Note: See TracChangeset for help on using the changeset viewer.