suricata
decode-vlan.h
Go to the documentation of this file.
1
/* Copyright (C) 2007-2010 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 __DECODE_VLAN_H__
25
#define __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
/* return vlan id in host byte order */
40
#define VLAN_GET_ID1(p) DecodeVLANGetId((p), 0)
41
#define VLAN_GET_ID2(p) DecodeVLANGetId((p), 1)
42
43
/** Vlan header struct */
44
typedef
struct
VLANHdr_
{
45
uint16_t
vlan_cfi
;
46
uint16_t
protocol
;
/**< protocol field */
47
}
__attribute__
((__packed__)) VLANHdr;
48
49
/** VLAN header length */
50
#define VLAN_HEADER_LEN 4
51
52
void
DecodeVLANRegisterTests
(
void
);
53
54
#endif
/* __DECODE_VLAN_H__ */
55
__attribute__
struct VLANHdr_ __attribute__((__packed__)) VLANHdr
DNP3 link header.
Definition:
decode-vlan.c:111
VLANHdr_::protocol
uint16_t protocol
Definition:
decode-vlan.h:46
VLANHdr_::vlan_cfi
uint16_t vlan_cfi
Definition:
decode-vlan.h:45
Packet_
Definition:
decode.h:428
DecodeVLANRegisterTests
void DecodeVLANRegisterTests(void)
Definition:
decode-vlan.c:265
VLANHdr_
Definition:
decode-vlan.h:44
DecodeVLANGetId
uint16_t DecodeVLANGetId(const struct Packet_ *, uint8_t layer)
src
decode-vlan.h
Generated on Mon Mar 20 2023 23:30:29 for suricata by
1.8.18