summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/l2tp/l2tp_prot.h
blob: 75cc87fa3f03e270000f4ed4103cf8442a2e7872 (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
#ifndef __L2TP_PROT_H
#define __L2TP_PROT_H

#include <stdint.h>

#define L2TP_PORT 1701

#define L2TP_FLAG_T   0x8000
#define L2TP_FLAG_L   0x4000
#define L2TP_FLAG_S   0x0800
#define L2TP_FLAG_O   0x0200
#define L2TP_FLAG_P   0x0100
#define L2TP_VER_MASK 0x000f

struct l2tp_hdr_t
{
	uint16_t flags;
	uint16_t length;
	union {
		struct {
			uint16_t tid;
			uint16_t sid;
		};
		uint32_t cid;
	};
	uint16_t Ns;
	uint16_t Nr;
} __attribute__((packed));

#define L2TP_AVP_FLAG_M   0x8000
#define L2TP_AVP_FLAG_H   0x4000
#define L2TP_AVP_LEN_MASK 0x03ff

struct l2tp_avp_t
{
	uint16_t flags;
	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;
	char error_msg[0];
} __attribute__((packed));

#endif