The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Structures and functions for parsing ethernet headers. More...
#include <freeradius-devel/util/inet.h>
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | ethernet_header_t |
Structure of a DEC/Intel/Xerox or 802.3 Ethernet header. More... | |
struct | fr_ethernet_proto_ctx_t |
Src/dst link layer information. More... | |
struct | vlan_header_t |
A VLAN header. More... | |
Macros | |
#define | ETHER_ADDR_LEN 6 |
#define | VLAN_DEI_UNPACK(_vlan) (((*(uint8_t const *)&(_vlan)->tag_control) & 0x10) >> 4) |
Unpack the Drop Eligible Indicator from the TCI. More... | |
#define | VLAN_PCP_UNPACK(_vlan) (((*(uint8_t const *)&(_vlan)->tag_control) & 0xe0) >> 5) |
Unpack the Priority Code Point from the TCI. More... | |
#define | VLAN_TCI_PACK(_pcp, _dei, _vid) htons((((uint16_t)(_pcp) & 0xe0) << 13) | (((uint16_t)(_dei) & 0x01) << 12) | ((_vid) & 0x0fff)) |
Pack the PCP (Priority Code Point) DEI (Drop Eligible Indicator) and VID (VLAN ID) More... | |
#define | VLAN_VID_UNPACK(_vlan) ((htons((_vlan)->tag_control) & 0x0fff)) |
Unpack the VLAN ID from the TCI. More... | |
Enumerations | |
enum | fr_ethernet_options_t { PROTO_OPT_ETHERNET_SVLAN_TPID = 0 , PROTO_OPT_ETHERNET_SVLAN_PCP , PROTO_OPT_ETHERNET_SVLAN_DEI , PROTO_OPT_ETHERNET_SVLAN_VID , PROTO_OPT_ETHERNET_CVLAN_TPID , PROTO_OPT_ETHERNET_CVLAN_PCP , PROTO_OPT_ETHERNET_CVLAN_DEI , PROTO_OPT_ETHERNET_CVLAN_VID } |
Protocol options for ethernet. More... | |
Structures and functions for parsing ethernet headers.
Definition in file ethernet.h.
struct ethernet_header_t |
Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
Definition at line 78 of file ethernet.h.
Data Fields | ||
---|---|---|
uint8_t | dst_addr[ETHER_ADDR_LEN] | |
uint16_t | ether_type | |
uint8_t | src_addr[ETHER_ADDR_LEN] |
struct fr_ethernet_proto_ctx_t |
Src/dst link layer information.
Definition at line 87 of file ethernet.h.
Data Fields | ||
---|---|---|
uint8_t | cvlan_dei | CVLAN drop eligible indicator. |
uint8_t | cvlan_pcp | CVLAN priority code point 0-6. |
uint16_t | cvlan_tpid | CVLAN tag type. If 0, no CVLAN/SVLAN present. |
uint16_t | cvlan_vid | CVLAN vlan ID. |
fr_ethernet_t | dst_addr | |
uint16_t | ether_type | Ether type. Usually 0x0800 (IPv4) 0x086DD (IPv6). |
size_t | payload_len | Remaining bytes after the ethernet header has been parsed. |
fr_ethernet_t | src_addr | |
uint8_t | svlan_dei | SVLAN drop eligible indicator. |
uint8_t | svlan_pcp | SVLAN priority code point 0-6. |
uint16_t | svlan_tpid | SVLAN tag type. If 0, no SVLAN present. |
uint16_t | svlan_vid | SVLAN vlan ID. |
struct vlan_header_t |
A VLAN header.
Represents a single layer of 802.1Q or QinQ tagging.
Definition at line 67 of file ethernet.h.
Data Fields | ||
---|---|---|
uint16_t | tag_control |
|
uint16_t | tag_type |
Tag type. One of (0x8100 - CVLAN, 0x9100, 0x9200, 0x9300 - SVLAN). |
#define ETHER_ADDR_LEN 6 |
Definition at line 33 of file ethernet.h.
Unpack the Drop Eligible Indicator from the TCI.
Definition at line 43 of file ethernet.h.
Unpack the Priority Code Point from the TCI.
Definition at line 38 of file ethernet.h.
#define VLAN_TCI_PACK | ( | _pcp, | |
_dei, | |||
_vid | |||
) | htons((((uint16_t)(_pcp) & 0xe0) << 13) | (((uint16_t)(_dei) & 0x01) << 12) | ((_vid) & 0x0fff)) |
Pack the PCP (Priority Code Point) DEI (Drop Eligible Indicator) and VID (VLAN ID)
Packs the PCP, DEI and VID into the TCI (Tag control information). Output will be a 16bit integer in network byte order.
[in] | _pcp | Priority Code Point, a 3 bit value indicating the relative priority of the packet. |
[in] | _dei | Drop eligible indicator. Boolean indicating whether this packet should be dropped in case of congestion. |
[in] | _vid | 12 bit VLAN identifier. |
Definition at line 61 of file ethernet.h.
#define VLAN_VID_UNPACK | ( | _vlan | ) | ((htons((_vlan)->tag_control) & 0x0fff)) |
Unpack the VLAN ID from the TCI.
Definition at line 48 of file ethernet.h.
Protocol options for ethernet.
Definition at line 108 of file ethernet.h.