-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathl2tp_event.h
105 lines (86 loc) · 2.75 KB
/
l2tp_event.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*****************************************************************************
* Copyright (C) 2008 Katalix Systems Ltd
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
/*
* L2TP application event interface definition.
* Applications tell openl2tp of events using this interface. The interface
* is separated from the main configuration interface because event-generating
* clients don't need the configuration interface.
*
* Events are used as follows:-
* PPP_UPDOWN_IND - tells OpenL2TP of PPP session state changes.
* PPP_ACCM_IND - tells OpenL2TP of PPP ACCM negotiated options
*
* Non-GPL applications are permitted to use this API.
*/
#ifndef L2TP_EVENT_H
#define L2TP_EVENT_H
#include <stdint.h>
/*****************************************************************************
* API definition
*****************************************************************************/
#define OPENL2TP_EVENT_SOCKET_NAME "/tmp/openl2tp-event.sock"
#define OPENL2TP_MSG_TYPE_NULL 0
#define OPENL2TP_MSG_TYPE_PPP_UPDOWN_IND 1
#define OPENL2TP_MSG_TYPE_PPP_ACCM_IND 2
#define OPENL2TP_MSG_TYPE_MAX 3
enum {
OPENL2TP_TLV_TYPE_TUNNEL_ID,
OPENL2TP_TLV_TYPE_SESSION_ID,
OPENL2TP_TLV_TYPE_PPP_ACCM,
OPENL2TP_TLV_TYPE_PPP_UNIT,
OPENL2TP_TLV_TYPE_PPP_IFNAME,
OPENL2TP_TLV_TYPE_PPP_USER_NAME,
OPENL2TP_TLV_TYPE_PPP_STATE
};
#define OPENL2TP_TLV_TYPE_MAX (OPENL2TP_TLV_TYPE_PPP_STATE + 1)
#define OPENL2TP_MSG_MAX_LEN 512
#define OPENL2TP_MSG_SIGNATURE 0x6b6c7831
#define ALIGN32(n) (((n) + 3) & ~3)
/* Each data field in a message is defined by a Type-Length-Value
* (TLV) tuplet.
*/
struct openl2tp_event_tlv {
uint16_t tlv_type;
uint16_t tlv_len;
uint8_t tlv_value[0];
};
/* Messages contain a small header followed by a list of TLVs. Each
* TLV starts on a 4-byte boundary.
*/
struct openl2tp_event_msg {
uint32_t msg_signature; /* OPENL2TP_MSG_SIGNATURE */
uint16_t msg_type; /* OPENL2TP_MSG_TYPE_* */
uint16_t msg_len; /* length of data that follows */
uint8_t msg_data[0]; /* list of TLVs, each always longword aligned */
};
/* These structs define the data field layout of each TLV.
*/
struct openl2tp_tlv_tunnel_id {
uint16_t tunnel_id;
};
struct openl2tp_tlv_session_id {
uint16_t session_id;
};
struct openl2tp_tlv_ppp_accm {
uint32_t send_accm;
uint32_t recv_accm;
};
struct openl2tp_tlv_ppp_unit {
uint32_t unit;
};
struct openl2tp_tlv_ppp_state {
uint8_t up; /* 0=down, 1=up */
};
struct openl2tp_tlv_ppp_ifname {
char ifname[0];
};
struct openl2tp_tlv_ppp_user_name {
char user_name[0];
};
#endif /* L2TP_EVENT_H */