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