1 /* Copyright (C) 2007-2021 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  */
23 
24 #ifndef __DECODE_ETHERNET_H__
25 #define __DECODE_ETHERNET_H__
26 
27 #define ETHERNET_HEADER_LEN           14
28 
29 /* Cisco Fabric Path / DCE header length. */
30 #define ETHERNET_DCE_HEADER_LEN       (ETHERNET_HEADER_LEN + 2)
31 
32 /* Ethernet types -- taken from Snort and Libdnet */
33 #define ETHERNET_TYPE_PUP             0x0200 /* PUP protocol */
34 #define ETHERNET_TYPE_IP              0x0800
35 #define ETHERNET_TYPE_ARP             0x0806
36 #define ETHERNET_TYPE_BRIDGE          0x6558 /* transparant ethernet bridge (GRE) */
37 #define ETHERNET_TYPE_REVARP          0x8035
38 #define ETHERNET_TYPE_EAPOL           0x888e
39 #define ETHERNET_TYPE_IPV6            0x86dd
40 #define ETHERNET_TYPE_IPX             0x8137
41 #define ETHERNET_TYPE_PPPOE_DISC      0x8863 /* discovery stage */
42 #define ETHERNET_TYPE_PPPOE_SESS      0x8864 /* session stage */
43 #define ETHERNET_TYPE_8021AD          0x88a8
44 #define ETHERNET_TYPE_8021AH          0x88e7
45 #define ETHERNET_TYPE_8021Q           0x8100
46 #define ETHERNET_TYPE_LOOP            0x9000
47 #define ETHERNET_TYPE_8021QINQ        0x9100
48 #define ETHERNET_TYPE_ERSPAN          0x88BE
49 #define ETHERNET_TYPE_DCE             0x8903 /* Data center ethernet,
50                                               * Cisco Fabric Path */
51 #define ETHERNET_TYPE_VNTAG 0x8926           /* 802.1Qbh */
52 
53 typedef struct EthernetHdr_ {
54     uint8_t eth_dst[6];
55     uint8_t eth_src[6];
56     uint16_t eth_type;
57 } __attribute__((__packed__)) EthernetHdr;
58 
59 void DecodeEthernetRegisterTests(void);
60 
61 #endif /* __DECODE_ETHERNET_H__ */
62 
63