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