35 #if PPP_SUPPORT && PPPOL2TP_SUPPORT
43 #define PPPOL2TP_CONTROL_TIMEOUT (5*1000)
44 #define PPPOL2TP_SLOW_RETRY (60*1000)
46 #define PPPOL2TP_MAXSCCRQ 4
47 #define PPPOL2TP_MAXICRQ 4
48 #define PPPOL2TP_MAXICCN 4
51 #define PPPOL2TP_HEADERFLAG_CONTROL 0x8000
52 #define PPPOL2TP_HEADERFLAG_LENGTH 0x4000
53 #define PPPOL2TP_HEADERFLAG_SEQUENCE 0x0800
54 #define PPPOL2TP_HEADERFLAG_OFFSET 0x0200
55 #define PPPOL2TP_HEADERFLAG_PRIORITY 0x0100
56 #define PPPOL2TP_HEADERFLAG_VERSION 0x0002
59 #define PPPOL2TP_HEADERFLAG_CONTROL_MANDATORY (PPPOL2TP_HEADERFLAG_CONTROL|PPPOL2TP_HEADERFLAG_LENGTH|PPPOL2TP_HEADERFLAG_SEQUENCE|PPPOL2TP_HEADERFLAG_VERSION)
61 #define PPPOL2TP_HEADERFLAG_CONTROL_FORBIDDEN (PPPOL2TP_HEADERFLAG_OFFSET|PPPOL2TP_HEADERFLAG_PRIORITY)
64 #define PPPOL2TP_HEADERFLAG_DATA_MANDATORY (PPPOL2TP_HEADERFLAG_VERSION)
67 #define PPPOL2TP_AVPHEADERFLAG_MANDATORY 0x8000
68 #define PPPOL2TP_AVPHEADERFLAG_HIDDEN 0x4000
69 #define PPPOL2TP_AVPHEADERFLAG_LENGTHMASK 0x03ff
72 #define PPPOL2TP_AVPTYPE_MESSAGE 0
75 #define PPPOL2TP_MESSAGETYPE_SCCRQ 1
76 #define PPPOL2TP_MESSAGETYPE_SCCRP 2
77 #define PPPOL2TP_MESSAGETYPE_SCCCN 3
78 #define PPPOL2TP_MESSAGETYPE_STOPCCN 4
79 #define PPPOL2TP_MESSAGETYPE_HELLO 6
81 #define PPPOL2TP_MESSAGETYPE_OCRQ 7
82 #define PPPOL2TP_MESSAGETYPE_OCRP 8
83 #define PPPOL2TP_MESSAGETYPE_OCCN 9
84 #define PPPOL2TP_MESSAGETYPE_ICRQ 10
85 #define PPPOL2TP_MESSAGETYPE_ICRP 11
86 #define PPPOL2TP_MESSAGETYPE_ICCN 12
87 #define PPPOL2TP_MESSAGETYPE_CDN 14
89 #define PPPOL2TP_MESSAGETYPE_WEN 15
91 #define PPPOL2TP_MESSAGETYPE_SLI 16
94 #define PPPOL2TP_AVPTYPE_RESULTCODE 1
95 #define PPPOL2TP_RESULTCODE 1
98 #define PPPOL2TP_AVPTYPE_VERSION 2
99 #define PPPOL2TP_VERSION 0x0100
102 #define PPPOL2TP_AVPTYPE_FRAMINGCAPABILITIES 3
103 #define PPPOL2TP_FRAMINGCAPABILITIES 0x00000003
106 #define PPPOL2TP_AVPTYPE_BEARERCAPABILITIES 4
107 #define PPPOL2TP_BEARERCAPABILITIES 0x00000003
110 #define PPPOL2TP_AVPTYPE_TIEBREAKER 5
113 #define PPPOL2TP_AVPTYPE_HOSTNAME 7
114 #define PPPOL2TP_HOSTNAME "lwIP"
117 #define PPPOL2TP_AVPTYPE_VENDORNAME 8
118 #define PPPOL2TP_VENDORNAME "lwIP"
121 #define PPPOL2TP_AVPTYPE_TUNNELID 9
124 #define PPPOL2TP_AVPTYPE_RECEIVEWINDOWSIZE 10
125 #define PPPOL2TP_RECEIVEWINDOWSIZE 8
128 #define PPPOL2TP_AVPTYPE_CHALLENGE 11
131 #define PPPOL2TP_AVPTYPE_CAUSECODE 12
134 #define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE 13
135 #define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE_SIZE 16
138 #define PPPOL2TP_AVPTYPE_SESSIONID 14
141 #define PPPOL2TP_AVPTYPE_CALLSERIALNUMBER 15
144 #define PPPOL2TP_AVPTYPE_FRAMINGTYPE 19
145 #define PPPOL2TP_FRAMINGTYPE 0x00000001
148 #define PPPOL2TP_AVPTYPE_TXCONNECTSPEED 24
149 #define PPPOL2TP_TXCONNECTSPEED 100000000
152 #define PPPOL2TP_STATE_INITIAL 0
153 #define PPPOL2TP_STATE_SCCRQ_SENT 1
154 #define PPPOL2TP_STATE_ICRQ_SENT 2
155 #define PPPOL2TP_STATE_ICCN_SENT 3
156 #define PPPOL2TP_STATE_DATA 4
158 #define PPPOL2TP_OUTPUT_DATA_HEADER_LEN 6
163 typedef struct pppol2tp_pcb_s pppol2tp_pcb;
164 struct pppol2tp_pcb_s {
171 #if PPPOL2TP_AUTH_SUPPORT
175 u8_t challenge_hash[16];
183 u16_t source_tunnel_id;
184 u16_t remote_tunnel_id;
185 u16_t source_session_id;
186 u16_t remote_session_id;
195 ppp_pcb *pppol2tp_create(
struct netif *pppif,
197 const u8_t *secret,
u8_t secret_len,
198 ppp_link_status_cb_fn link_status_cb,
void *ctx_cb);