suricata
decode-vntag.h
Go to the documentation of this file.
1/* Copyright (C) 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 Jeff Lucovsky <jeff@lucovsky.org>
22 */
23
24#ifndef SURICATA_DECODE_VNTAG_H
25#define SURICATA_DECODE_VNTAG_H
26
27/* https://www.ieee802.org/1/files/public/docs2009/new-pelissier-vntag-seminar-0508.pdf */
28/** VNTag macros to access VNTag direction, dst vif_id, dest, looped, version, src vif_id **/
29#define GET_VNTAG_DIR(vntagh) ((SCNtohl((vntagh)->tag) & 0x80000000) >> 31)
30#define GET_VNTAG_PTR(vntagh) ((SCNtohl((vntagh)->tag) & 0x40000000) >> 30)
31#define GET_VNTAG_DEST(vntagh) ((SCNtohl((vntagh)->tag) & 0x3FFF0000) >> 16)
32#define GET_VNTAG_LOOPED(vntagh) ((SCNtohl((vntagh)->tag) & 0x00008000) >> 15)
33#define GET_VNTAG_VERSION(vntagh) ((SCNtohl((vntagh)->tag) & 0x00003000) >> 12)
34#define GET_VNTAG_SRC(vntagh) ((SCNtohl((vntagh)->tag) & 0x00000FFF))
35#define GET_VNTAG_PROTO(vntagh) ((SCNtohs((vntagh)->protocol)))
36
37/** VNTag header struct */
38typedef struct VNTagHdr_ {
39 uint32_t tag;
40 uint16_t protocol; /**< protocol field */
41} __attribute__((__packed__)) VNTagHdr;
42
43/** VNTag header length */
44#define VNTAG_HEADER_LEN 6
45
47
48#endif /* SURICATA_DECODE_VNTAG_H */
void DecodeVNTagRegisterTests(void)
struct PrefilterEngineFlowbits __attribute__
DNP3 application header.
uint32_t tag
uint16_t protocol