suricata
decode-vlan.h
Go to the documentation of this file.
1
/* Copyright (C) 2007-2022 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 Breno Silva <breno.silva@gmail.com>
22
*/
23
24
#ifndef SURICATA_DECODE_VLAN_H
25
#define SURICATA_DECODE_VLAN_H
26
27
/* return vlan id in host byte order */
28
uint16_t
DecodeVLANGetId
(
const
struct
Packet_
*, uint8_t layer);
29
30
/** Vlan type */
31
#define ETHERNET_TYPE_VLAN 0x8100
32
33
/** Vlan macros to access Vlan priority, Vlan CFI and VID */
34
#define GET_VLAN_PRIORITY(vlanh) ((SCNtohs((vlanh)->vlan_cfi) & 0xe000) >> 13)
35
#define GET_VLAN_CFI(vlanh) ((SCNtohs((vlanh)->vlan_cfi) & 0x0100) >> 12)
36
#define GET_VLAN_ID(vlanh) ((uint16_t)(SCNtohs((vlanh)->vlan_cfi) & 0x0FFF))
37
#define GET_VLAN_PROTO(vlanh) ((SCNtohs((vlanh)->protocol)))
38
39
/** Vlan header struct */
40
typedef
struct
VLANHdr_
{
41
uint16_t
vlan_cfi
;
42
uint16_t
protocol
;
/**< protocol field */
43
}
__attribute__
((__packed__)) VLANHdr;
44
45
/** VLAN header length */
46
#define VLAN_HEADER_LEN 4
47
48
void
DecodeVLANRegisterTests
(
void
);
49
50
/** VLAN max encapsulation layer count/index */
51
#define VLAN_MAX_LAYERS 3
52
#define VLAN_MAX_LAYER_IDX (VLAN_MAX_LAYERS - 1)
53
54
#endif
/* SURICATA_DECODE_VLAN_H */
__attribute__
struct VLANHdr_ __attribute__((__packed__)) VLANHdr
DNP3 link header.
Definition:
decode-vlan.c:103
VLANHdr_::protocol
uint16_t protocol
Definition:
decode-vlan.h:42
VLANHdr_::vlan_cfi
uint16_t vlan_cfi
Definition:
decode-vlan.h:41
Packet_
Definition:
decode.h:473
DecodeVLANRegisterTests
void DecodeVLANRegisterTests(void)
Definition:
decode-vlan.c:257
VLANHdr_
Definition:
decode-vlan.h:40
DecodeVLANGetId
uint16_t DecodeVLANGetId(const struct Packet_ *, uint8_t layer)
src
decode-vlan.h
Generated on Sun Dec 1 2024 23:30:26 for suricata by
1.8.18