suricata
decode-ipv4.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IPV4Opt_
 
struct  IPV4Hdr_
 
struct  IPV4Vars_
 

Macros

#define IPV4_HEADER_LEN   20
 
#define IPV4_OPTMAX   40
 
#define IPV4_MAXPACKET_LEN   65535
 
#define IPV4_OPT_EOL   0x00
 
#define IPV4_OPT_NOP   0x01
 
#define IPV4_OPT_RR   0x07
 
#define IPV4_OPT_QS   0x19
 
#define IPV4_OPT_TS   0x44
 
#define IPV4_OPT_SEC   0x82
 
#define IPV4_OPT_LSRR   0x83
 
#define IPV4_OPT_ESEC   0x85
 
#define IPV4_OPT_CIPSO   0x86
 
#define IPV4_OPT_SID   0x88
 
#define IPV4_OPT_SSRR   0x89
 
#define IPV4_OPT_RTRALT   0x94
 
#define IPV4_OPT_SID_LEN   4
 
#define IPV4_OPT_RTRALT_LEN   4
 
#define IPV4_OPT_SEC_MIN   3
 
#define IPV4_OPT_ROUTE_MIN   3
 
#define IPV4_OPT_QS_MIN   8
 
#define IPV4_OPT_TS_MIN   5
 
#define IPV4_OPT_CIPSO_MIN   10
 
#define IPV4_OPTS   ip4vars.ip_opts
 
#define IPV4_OPTS_CNT   ip4vars.ip_opt_cnt
 
#define s_ip_src   ip4_hdrun1.ip4_un1.ip_src
 
#define s_ip_dst   ip4_hdrun1.ip4_un1.ip_dst
 
#define s_ip_addrs   ip4_hdrun1.ip_addrs
 
#define IPV4_GET_RAW_VER(ip4h)   (((ip4h)->ip_verhl & 0xf0) >> 4)
 
#define IPV4_GET_RAW_HLEN(ip4h)   (uint8_t)(((ip4h)->ip_verhl & (uint8_t)0x0f) << (uint8_t)2)
 
#define IPV4_GET_RAW_IPTOS(ip4h)   ((ip4h)->ip_tos)
 
#define IPV4_GET_RAW_IPLEN(ip4h)   (SCNtohs((ip4h)->ip_len))
 
#define IPV4_GET_RAW_IPID(ip4h)   (SCNtohs((ip4h)->ip_id))
 
#define IPV4_GET_RAW_IPOFFSET(ip4h)   SCNtohs((ip4h)->ip_off)
 
#define IPV4_GET_RAW_FRAGOFFSET(ip4h)   (IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x1fff)
 
#define IPV4_GET_RAW_IPTTL(ip4h)   ((ip4h)->ip_ttl)
 
#define IPV4_GET_RAW_IPPROTO(ip4h)   ((ip4h)->ip_proto)
 
#define IPV4_GET_RAW_IPSRC(ip4h)   ((ip4h)->s_ip_src)
 
#define IPV4_GET_RAW_IPDST(ip4h)   ((ip4h)->s_ip_dst)
 
#define IPV4_GET_RAW_IPSRC_U32(ip4h)   (uint32_t)((ip4h)->s_ip_src.s_addr)
 
#define IPV4_GET_RAW_IPDST_U32(ip4h)   (uint32_t)((ip4h)->s_ip_dst.s_addr)
 
#define IPV4_GET_RAW_FLAG_MF(ip4h)   ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x2000) != 0)
 
#define IPV4_GET_RAW_FLAG_DF(ip4h)   ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x4000) != 0)
 
#define IPV4_GET_RAW_FLAG_RF(ip4h)   ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x8000) != 0)
 
#define IPV4_OPT_FLAG_EOL   BIT_U16(1)
 
#define IPV4_OPT_FLAG_NOP   BIT_U16(2)
 
#define IPV4_OPT_FLAG_RR   BIT_U16(3)
 
#define IPV4_OPT_FLAG_TS   BIT_U16(4)
 
#define IPV4_OPT_FLAG_QS   BIT_U16(5)
 
#define IPV4_OPT_FLAG_LSRR   BIT_U16(6)
 
#define IPV4_OPT_FLAG_SSRR   BIT_U16(7)
 
#define IPV4_OPT_FLAG_SID   BIT_U16(8)
 
#define IPV4_OPT_FLAG_SEC   BIT_U16(9)
 
#define IPV4_OPT_FLAG_CIPSO   BIT_U16(10)
 
#define IPV4_OPT_FLAG_RTRALT   BIT_U16(11)
 
#define IPV4_OPT_FLAG_ESEC   BIT_U16(12)
 

Typedefs

typedef struct IPV4Opt_ IPV4Opt
 
typedef struct IPV4Hdr_ IPV4Hdr
 
typedef struct IPV4Vars_ IPV4Vars
 

Functions

void DecodeIPV4RegisterTests (void)
 

Detailed Description

Macro Definition Documentation

◆ IPV4_GET_RAW_FLAG_DF

#define IPV4_GET_RAW_FLAG_DF (   ip4h)    ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x4000) != 0)

Definition at line 114 of file decode-ipv4.h.

◆ IPV4_GET_RAW_FLAG_MF

#define IPV4_GET_RAW_FLAG_MF (   ip4h)    ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x2000) != 0)

Definition at line 113 of file decode-ipv4.h.

◆ IPV4_GET_RAW_FLAG_RF

#define IPV4_GET_RAW_FLAG_RF (   ip4h)    ((IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x8000) != 0)

Definition at line 115 of file decode-ipv4.h.

◆ IPV4_GET_RAW_FRAGOFFSET

#define IPV4_GET_RAW_FRAGOFFSET (   ip4h)    (IPV4_GET_RAW_IPOFFSET((ip4h)) & 0x1fff)

Definition at line 102 of file decode-ipv4.h.

◆ IPV4_GET_RAW_HLEN

#define IPV4_GET_RAW_HLEN (   ip4h)    (uint8_t)(((ip4h)->ip_verhl & (uint8_t)0x0f) << (uint8_t)2)

Definition at line 97 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPDST

#define IPV4_GET_RAW_IPDST (   ip4h)    ((ip4h)->s_ip_dst)

Definition at line 106 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPDST_U32

#define IPV4_GET_RAW_IPDST_U32 (   ip4h)    (uint32_t)((ip4h)->s_ip_dst.s_addr)

return the raw (directly from the header) dst ip as uint32_t

Definition at line 111 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPID

#define IPV4_GET_RAW_IPID (   ip4h)    (SCNtohs((ip4h)->ip_id))

Definition at line 100 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPLEN

#define IPV4_GET_RAW_IPLEN (   ip4h)    (SCNtohs((ip4h)->ip_len))

Definition at line 99 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPOFFSET

#define IPV4_GET_RAW_IPOFFSET (   ip4h)    SCNtohs((ip4h)->ip_off)

Definition at line 101 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPPROTO

#define IPV4_GET_RAW_IPPROTO (   ip4h)    ((ip4h)->ip_proto)

Definition at line 104 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPSRC

#define IPV4_GET_RAW_IPSRC (   ip4h)    ((ip4h)->s_ip_src)

Definition at line 105 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPSRC_U32

#define IPV4_GET_RAW_IPSRC_U32 (   ip4h)    (uint32_t)((ip4h)->s_ip_src.s_addr)

return the raw (directly from the header) src ip as uint32_t

Definition at line 109 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPTOS

#define IPV4_GET_RAW_IPTOS (   ip4h)    ((ip4h)->ip_tos)

Definition at line 98 of file decode-ipv4.h.

◆ IPV4_GET_RAW_IPTTL

#define IPV4_GET_RAW_IPTTL (   ip4h)    ((ip4h)->ip_ttl)

Definition at line 103 of file decode-ipv4.h.

◆ IPV4_GET_RAW_VER

#define IPV4_GET_RAW_VER (   ip4h)    (((ip4h)->ip_verhl & 0xf0) >> 4)

Definition at line 96 of file decode-ipv4.h.

◆ IPV4_HEADER_LEN

#define IPV4_HEADER_LEN   20

Header length

Definition at line 29 of file decode-ipv4.h.

◆ IPV4_MAXPACKET_LEN

#define IPV4_MAXPACKET_LEN   65535

Maximum packet size

Definition at line 31 of file decode-ipv4.h.

◆ IPV4_OPT_CIPSO

#define IPV4_OPT_CIPSO   0x86

Option: Commercial IP Security

Definition at line 42 of file decode-ipv4.h.

◆ IPV4_OPT_CIPSO_MIN

#define IPV4_OPT_CIPSO_MIN   10

CIPSO Option Min Length

Definition at line 56 of file decode-ipv4.h.

◆ IPV4_OPT_EOL

#define IPV4_OPT_EOL   0x00

IP Option Types Option: End of List

Definition at line 34 of file decode-ipv4.h.

◆ IPV4_OPT_ESEC

#define IPV4_OPT_ESEC   0x85

Option: Extended Security

Definition at line 41 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_CIPSO

#define IPV4_OPT_FLAG_CIPSO   BIT_U16(10)

Definition at line 126 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_EOL

#define IPV4_OPT_FLAG_EOL   BIT_U16(1)

Definition at line 117 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_ESEC

#define IPV4_OPT_FLAG_ESEC   BIT_U16(12)

Definition at line 128 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_LSRR

#define IPV4_OPT_FLAG_LSRR   BIT_U16(6)

Definition at line 122 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_NOP

#define IPV4_OPT_FLAG_NOP   BIT_U16(2)

Definition at line 118 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_QS

#define IPV4_OPT_FLAG_QS   BIT_U16(5)

Definition at line 121 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_RR

#define IPV4_OPT_FLAG_RR   BIT_U16(3)

Definition at line 119 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_RTRALT

#define IPV4_OPT_FLAG_RTRALT   BIT_U16(11)

Definition at line 127 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_SEC

#define IPV4_OPT_FLAG_SEC   BIT_U16(9)

Definition at line 125 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_SID

#define IPV4_OPT_FLAG_SID   BIT_U16(8)

Definition at line 124 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_SSRR

#define IPV4_OPT_FLAG_SSRR   BIT_U16(7)

Definition at line 123 of file decode-ipv4.h.

◆ IPV4_OPT_FLAG_TS

#define IPV4_OPT_FLAG_TS   BIT_U16(4)

Definition at line 120 of file decode-ipv4.h.

◆ IPV4_OPT_LSRR

#define IPV4_OPT_LSRR   0x83

Option: Loose Source Route

Definition at line 40 of file decode-ipv4.h.

◆ IPV4_OPT_NOP

#define IPV4_OPT_NOP   0x01

Option: No op

Definition at line 35 of file decode-ipv4.h.

◆ IPV4_OPT_QS

#define IPV4_OPT_QS   0x19

Option: Quick Start

Definition at line 37 of file decode-ipv4.h.

◆ IPV4_OPT_QS_MIN

#define IPV4_OPT_QS_MIN   8

QS Option Min Length

Definition at line 54 of file decode-ipv4.h.

◆ IPV4_OPT_ROUTE_MIN

#define IPV4_OPT_ROUTE_MIN   3

RR, SRR, LTRR Option Min Length

Definition at line 53 of file decode-ipv4.h.

◆ IPV4_OPT_RR

#define IPV4_OPT_RR   0x07

Option: Record Route

Definition at line 36 of file decode-ipv4.h.

◆ IPV4_OPT_RTRALT

#define IPV4_OPT_RTRALT   0x94

Option: Router Alert

Definition at line 45 of file decode-ipv4.h.

◆ IPV4_OPT_RTRALT_LEN

#define IPV4_OPT_RTRALT_LEN   4

RTRALT Option Fixed Length

Definition at line 49 of file decode-ipv4.h.

◆ IPV4_OPT_SEC

#define IPV4_OPT_SEC   0x82

Option: Security

Definition at line 39 of file decode-ipv4.h.

◆ IPV4_OPT_SEC_MIN

#define IPV4_OPT_SEC_MIN   3

IP Option Lengths (variable) SEC, ESEC Option Min Length

Definition at line 52 of file decode-ipv4.h.

◆ IPV4_OPT_SID

#define IPV4_OPT_SID   0x88

Option: Stream Identifier

Definition at line 43 of file decode-ipv4.h.

◆ IPV4_OPT_SID_LEN

#define IPV4_OPT_SID_LEN   4

IP Option Lengths (fixed) SID Option Fixed Length

Definition at line 48 of file decode-ipv4.h.

◆ IPV4_OPT_SSRR

#define IPV4_OPT_SSRR   0x89

Option: Strict Source Route

Definition at line 44 of file decode-ipv4.h.

◆ IPV4_OPT_TS

#define IPV4_OPT_TS   0x44

Option: Timestamp

Definition at line 38 of file decode-ipv4.h.

◆ IPV4_OPT_TS_MIN

#define IPV4_OPT_TS_MIN   5

TS Option Min Length

Definition at line 55 of file decode-ipv4.h.

◆ IPV4_OPTMAX

#define IPV4_OPTMAX   40

Max options length

Definition at line 30 of file decode-ipv4.h.

◆ IPV4_OPTS

#define IPV4_OPTS   ip4vars.ip_opts

IP Option fields

Definition at line 59 of file decode-ipv4.h.

◆ IPV4_OPTS_CNT

#define IPV4_OPTS_CNT   ip4vars.ip_opt_cnt

Definition at line 60 of file decode-ipv4.h.

◆ s_ip_addrs

#define s_ip_addrs   ip4_hdrun1.ip_addrs

Definition at line 94 of file decode-ipv4.h.

◆ s_ip_dst

#define s_ip_dst   ip4_hdrun1.ip4_un1.ip_dst

Definition at line 93 of file decode-ipv4.h.

◆ s_ip_src

#define s_ip_src   ip4_hdrun1.ip4_un1.ip_src

Definition at line 92 of file decode-ipv4.h.

Typedef Documentation

◆ IPV4Hdr

typedef struct IPV4Hdr_ IPV4Hdr

◆ IPV4Opt

typedef struct IPV4Opt_ IPV4Opt

◆ IPV4Vars

typedef struct IPV4Vars_ IPV4Vars

Function Documentation

◆ DecodeIPV4RegisterTests()

void DecodeIPV4RegisterTests ( void  )

Definition at line 1555 of file decode-ipv4.c.

References UtRegisterTest().

Here is the call graph for this function: