1 /*****************************************************************************
2 * Copyright (C) 2008 Katalix Systems Ltd
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *****************************************************************************/
21 * OpenL2TP application event interface definition.
23 * This plugin is used by OpenL2TP to receive events from pppd.
25 * Events are used as follows:-
26 * PPP_UPDOWN_IND - tells OpenL2TP of PPP session state changes.
27 * PPP_ACCM_IND - tells OpenL2TP of PPP ACCM negotiated options
29 * Non-GPL applications are permitted to use this API, provided that
30 * any changes to this source file are made available under GPL terms.
38 /*****************************************************************************
40 *****************************************************************************/
42 #define OPENL2TP_EVENT_SOCKET_NAME "/tmp/openl2tp-event.sock"
44 #define OPENL2TP_MSG_TYPE_NULL 0
45 #define OPENL2TP_MSG_TYPE_PPP_UPDOWN_IND 1
46 #define OPENL2TP_MSG_TYPE_PPP_ACCM_IND 2
47 #define OPENL2TP_MSG_TYPE_MAX 3
50 OPENL2TP_TLV_TYPE_TUNNEL_ID,
51 OPENL2TP_TLV_TYPE_SESSION_ID,
52 OPENL2TP_TLV_TYPE_PPP_ACCM,
53 OPENL2TP_TLV_TYPE_PPP_UNIT,
54 OPENL2TP_TLV_TYPE_PPP_IFNAME,
55 OPENL2TP_TLV_TYPE_PPP_USER_NAME,
56 OPENL2TP_TLV_TYPE_PPP_STATE
58 #define OPENL2TP_TLV_TYPE_MAX (OPENL2TP_TLV_TYPE_PPP_STATE + 1)
60 #define OPENL2TP_MSG_MAX_LEN 512
61 #define OPENL2TP_MSG_SIGNATURE 0x6b6c7831
63 #define ALIGN32(n) (((n) + 3) & ~3)
65 /* Each data field in a message is defined by a Type-Length-Value
68 struct openl2tp_event_tlv {
74 /* Messages contain a small header followed by a list of TLVs. Each
75 * TLV starts on a 4-byte boundary.
77 struct openl2tp_event_msg {
78 uint32_t msg_signature; /* OPENL2TP_MSG_SIGNATURE */
79 uint16_t msg_type; /* OPENL2TP_MSG_TYPE_* */
80 uint16_t msg_len; /* length of data that follows */
81 uint8_t msg_data[0]; /* list of TLVs, each always longword aligned */
84 /* These structs define the data field layout of each TLV.
86 struct openl2tp_tlv_tunnel_id {
90 struct openl2tp_tlv_session_id {
94 struct openl2tp_tlv_ppp_accm {
99 struct openl2tp_tlv_ppp_unit {
103 struct openl2tp_tlv_ppp_state {
104 uint8_t up; /* 0=down, 1=up */
107 struct openl2tp_tlv_ppp_ifname {
111 struct openl2tp_tlv_ppp_user_name {
115 #endif /* L2TP_EVENT_H */