summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/l2tp/l2tp_prot.h
blob: 1c1d9dae036d1d7c9ec4b5bd5195b111f7e1795c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __L2TP_PROT_H
#define __L2TP_PROT_H

#include <stdint.h>

#define L2TP_PORT 1701

struct l2tp_hdr_t
{
	uint8_t P:1;
	uint8_t O:1;
	uint8_t reserved2:1;
	uint8_t S:1;
	uint8_t reserved1:2;
	uint8_t L:1;
	uint8_t T:1;
	uint8_t ver:4;
	uint8_t reserved3:4;
	uint16_t length;
	union {
		struct {
			uint16_t tid;
			uint16_t sid;
		};
		uint32_t cid;
	};
	uint16_t Ns;
	uint16_t Nr;
} __attribute__((packed));

/*#define L2TP_T(hdr) (hdr->flags >> 15)
#define L2TP_L(hdr) ((hdr->flags >> 14) & 1)
#define L2TP_S(hdr) ((hdr->flags >> 10) & 1)
#define L2TP_O(hdr) ((hdr->flags >> 8) & 1)
#define L2TP_VER(hdr) (hdr->flags & 0xf)*/

struct l2tp_avp_t
{
	uint16_t length:10;
	uint16_t reserved:4;
	uint16_t H:1;
	uint16_t M:1;
	uint16_t vendor;
	uint16_t type;
	uint8_t val[0];
} __attribute__((packed));

struct l2tp_avp_result_code
{
	uint16_t result_code;
	uint16_t error_code;
} __attribute__((packed));

#endif