Changeset 8fb1bf82 in mainline for uspace/srv/net/nil/eth/eth_header.h


Ignore:
Timestamp:
2010-11-25T13:42:50Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8df8415
Parents:
a93d79a (diff), eb667613 (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

    ra93d79a r8fb1bf82  
    3232
    3333/** @file
    34  *  Ethernet protocol header definitions.
    35  *  Based on the IEEE~802.3-2005
     34 * Ethernet protocol header definitions.
     35 * Based on the IEEE 802.3-2005
    3636 */
    3737
    38 #ifndef __NET_ETH_HEADER_H__
    39 #define __NET_ETH_HEADER_H__
     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
     43/** Ethernet address length. */
     44#define ETH_ADDR        6
    4645
    47 /** Ethernet header preamble value.
    48  */
     46/** Ethernet header preamble value. */
    4947#define ETH_PREAMBLE    0x55
    5048
    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
    5451
    55 /** IEEE 802.2 unordered information control field.
    56  */
     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
     56 * @see eth_header_snap
    6157 */
    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;
     58typedef struct eth_header_snap eth_header_snap_t;
    6859
    6960/** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions.
    70  *  @see eth_header_lsap
     61 * @see eth_header_lsap
    7162 */
    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;
     63typedef struct eth_header_lsap eth_header_lsap_t;
    7864
    7965/** Type definition of the Ethernet header LSAP extension.
    80  *  @see eth_ieee_lsap
     66 * @see eth_ieee_lsap
    8167 */
    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;
     68typedef struct eth_ieee_lsap eth_ieee_lsap_t;
    8869
    8970/** Type definition of the Ethernet header SNAP extension.
    90  *  @see eth_snap
     71 * @see eth_snap
    9172 */
    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;
     73typedef struct eth_snap eth_snap_t;
    9874
    9975/** Type definition of the Ethernet header preamble.
    100  *  @see preamble
     76 * @see preamble
    10177 */
    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;
     78typedef struct eth_preamble eth_preamble_t;
    10879
    10980/** Type definition of the Ethernet header.
    110  *  @see eth_header
     81 * @see eth_header
    11182 */
    112 typedef struct eth_header       eth_header_t;
     83typedef struct eth_header eth_header_t;
    11384
    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. */
     86struct eth_ieee_lsap {
     87        /**
     88         * Destination Service Access Point identifier.
    12389         * The possible values are assigned by an IEEE committee.
    12490         */
    12591        uint8_t dsap;
    126         /** Source Service Access Point identifier.
     92       
     93        /**
     94         * Source Service Access Point identifier.
    12795         * The possible values are assigned by an IEEE committee.
    12896         */
    12997        uint8_t ssap;
    130         /** Control parameter.
     98       
     99        /**
     100         * Control parameter.
    131101         * The possible values are assigned by an IEEE committee.
    132102         */
     
    134104} __attribute__ ((packed));
    135105
    136 /** Ethernet header SNAP extension.
    137  */
    138 struct eth_snap{
    139         /** Protocol identifier or organization code.
    140          */
     106/** Ethernet header SNAP extension. */
     107struct eth_snap {
     108        /** Protocol identifier or organization code. */
    141109        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
    144114         */
    145115        uint16_t ethertype;
     
    147117
    148118/** Ethernet header preamble.
    149  *  Used for dummy devices.
     119 *
     120 * Used for dummy devices.
    150121 */
    151 struct eth_preamble{
    152         /** Controlling preamble used for the frame transmission synchronization.
    153          *  All should be set to ETH_PREAMBLE.
     122struct eth_preamble {
     123        /**
     124         * Controlling preamble used for the frame transmission synchronization.
     125         * All should be set to ETH_PREAMBLE.
    154126         */
    155127        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.
    158133         */
    159134        uint8_t sfd;
    160135} __attribute__ ((packed));
    161136
    162 /** Ethernet header.
    163  */
    164 struct eth_header{
    165         /** Destination host Ethernet address (MAC address).
    166          */
     137/** Ethernet header. */
     138struct eth_header {
     139        /** Destination host Ethernet address (MAC address). */
    167140        uint8_t destination_address[ETH_ADDR];
    168         /** Source host Ethernet address (MAC address).
    169          */
     141        /** Source host Ethernet address (MAC address). */
    170142        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
    173147         */
    174148        uint16_t ethertype;
    175149} __attribute__ ((packed));
    176150
    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. */
     152struct eth_header_lsap {
     153        /** Ethernet header. */
    182154        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.
    186163         */
    187164        eth_ieee_lsap_t lsap;
    188165} __attribute__ ((packed));
    189166
    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. */
     168struct eth_header_snap {
     169        /** Ethernet header. */
    195170        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.
    199179         */
    200180        eth_ieee_lsap_t lsap;
    201         /** SNAP extension.
    202         */
     181       
     182        /** SNAP extension. */
    203183        eth_snap_t snap;
    204184} __attribute__ ((packed));
    205185
    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. */
     187typedef uint32_t eth_fcs_t;
    213188
    214189#endif
Note: See TracChangeset for help on using the changeset viewer.