suricata
decode-pppoe.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 James Riden <jamesr@europe.com>
22  */
23 
24 #ifndef SURICATA_DECODE_PPPOE_H
25 #define SURICATA_DECODE_PPPOE_H
26 
27 // Session header length minus the protocol field
28 #define PPPOE_SESSION_HEADER_MIN_LEN 7
29 #define PPPOE_DISCOVERY_HEADER_MIN_LEN 6
30 #define PPPOE_SESSION_GET_VERSION(hdr) ((hdr)->pppoe_version_type & 0xF0) >> 4
31 #define PPPOE_SESSION_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
32 #define PPPOE_DISCOVERY_GET_VERSION(hdr) ((hdr)->pppoe_version_type & 0xF0) >> 4
33 #define PPPOE_DISCOVERY_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
34 
35 typedef struct PPPOESessionHdr_
36 {
38  uint8_t pppoe_code;
39  uint16_t session_id;
40  uint16_t pppoe_length;
41  uint16_t protocol;
43 
44 typedef struct PPPOEDiscoveryTag_
45 {
46  uint16_t pppoe_tag_type;
47  uint16_t pppoe_tag_length;
48 } __attribute__((__packed__)) PPPOEDiscoveryTag;
49 
50 typedef struct PPPOEDiscoveryHdr_
51 {
53  uint8_t pppoe_code;
54  uint16_t discovery_id;
55  uint16_t pppoe_length;
56 } __attribute__((__packed__)) PPPOEDiscoveryHdr;
57 
58 /* see RFC 2516 - discovery codes */
59 #define PPPOE_CODE_PADI 0x09
60 #define PPPOE_CODE_PADO 0x07
61 #define PPPOE_CODE_PADR 0x19
62 #define PPPOE_CODE_PADS 0x65
63 #define PPPOE_CODE_PADT 0xa7
64 
65 /* see RFC 2516 Appendix A */
66 #define PPPOE_TAG_END_OF_LIST 0x0000 /* End-Of-List */
67 #define PPPOE_TAG_SERVICE_NAME 0x0101 /* Service-Name */
68 #define PPPOE_TAG_AC_NAME 0x0102 /* AC-Name */
69 #define PPPOE_TAG_HOST_UNIQ 0x0103 /* Host-Uniq */
70 #define PPPOE_TAG_AC_COOKIE 0x0104 /* AC-Cookie */
71 #define PPPOE_TAG_VENDOR_SPECIFIC 0x0105 /* Vendor-Specific */
72 #define PPPOE_TAG_RELAY_SESSION_ID 0x0110 /* Relay-Session-Id */
73 #define PPPOE_TAG_SERVICE_NAME_ERROR 0x0201 /* Service-Name-Error */
74 #define PPPOE_TAG_AC_SYS_ERROR 0x0202 /* AC-System Error */
75 #define PPPOE_TAG_GEN_ERROR 0x0203 /* Generic-Error */
76 
77 void DecodePPPOERegisterTests(void);
78 
79 #endif /* SURICATA_DECODE_PPPOE_H */
PPPOEDiscoveryTag_
Definition: decode-pppoe.h:45
PPPOESessionHdr_
Definition: decode-pppoe.h:36
PPPOESessionHdr_::protocol
uint16_t protocol
Definition: decode-pppoe.h:41
PPPOEDiscoveryTag_::pppoe_tag_length
uint16_t pppoe_tag_length
Definition: decode-pppoe.h:47
PPPOESessionHdr_::session_id
uint16_t session_id
Definition: decode-pppoe.h:39
PPPOEDiscoveryHdr_::discovery_id
uint16_t discovery_id
Definition: decode-pppoe.h:54
PPPOEDiscoveryHdr_::pppoe_code
uint8_t pppoe_code
Definition: decode-pppoe.h:53
__attribute__
struct PPPOEDiscoveryTag_ __attribute__((__packed__)) PPPOEDiscoveryTag
DNP3 link header.
Definition: decode-vlan.c:103
PPPOEDiscoveryHdr_
Definition: decode-pppoe.h:51
DecodePPPOERegisterTests
void DecodePPPOERegisterTests(void)
Registers PPPOE unit tests.
Definition: decode-pppoe.c:540
PPPOEDiscoveryTag_::pppoe_tag_type
uint16_t pppoe_tag_type
Definition: decode-pppoe.h:46
PPPOESessionHdr_::pppoe_code
uint8_t pppoe_code
Definition: decode-pppoe.h:38
PPPOEDiscoveryHdr_::pppoe_version_type
uint8_t pppoe_version_type
Definition: decode-pppoe.h:52
PPPOESessionHdr
struct PPPOESessionHdr_ PPPOESessionHdr
PPPOEDiscoveryHdr_::pppoe_length
uint16_t pppoe_length
Definition: decode-pppoe.h:55
PPPOESessionHdr_::pppoe_length
uint16_t pppoe_length
Definition: decode-pppoe.h:40
PPPOESessionHdr_::pppoe_version_type
uint8_t pppoe_version_type
Definition: decode-pppoe.h:37