suricata
decode-esp.h
Go to the documentation of this file.
1 /* Copyright (C) 2020 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 
22 #ifndef SURICATA_DECODE_ESP_H
23 #define SURICATA_DECODE_ESP_H
24 
25 /** \brief size of the ESP header */
26 #define ESP_HEADER_LEN 8
27 
28 #define ESP_GET_RAW_SPI(esph) SCNtohl((esph)->spi)
29 #define ESP_GET_RAW_SEQUENCE(esph) SCNtohl((esph)->sequence)
30 
31 /** \brief Get the spi field off a packet */
32 #define ESP_GET_SPI(p) ESP_GET_RAW_SPI(p->esph)
33 
34 /** \brief Get the sequence field off a packet */
35 #define ESP_GET_SEQUENCE(p) ESP_GET_RAW_SEQUENCE(p->esph)
36 
37 /** \brief ESP Header */
38 typedef struct ESPHdr_ {
39  uint32_t spi; /** < ESP Security Parameters Index */
40  uint32_t sequence; /** < ESP sequence number */
41 } __attribute__((__packed__)) ESPHdr;
42 
43 #define CLEAR_ESP_PACKET(p) \
44  { \
45  (p)->esph = NULL; \
46  } \
47  while (0)
48 
49 void DecodeESPRegisterTests(void);
50 
51 #endif /* SURICATA_DECODE_ESP_H */
__attribute__
struct ESPHdr_ __attribute__((__packed__)) ESPHdr
ESP Header.
Definition: decode-vlan.c:103
ESPHdr_::sequence
uint32_t sequence
Definition: decode-esp.h:40
ESPHdr_::spi
uint32_t spi
Definition: decode-esp.h:39
ESPHdr_
ESP Header.
Definition: decode-esp.h:38
DecodeESPRegisterTests
void DecodeESPRegisterTests(void)
Definition: decode-esp.c:195