53 #include "netif/ppp/ppp_opts.h" 54 #if PPP_SUPPORT && PPPOL2TP_SUPPORT 62 #define PPPOL2TP_CONTROL_TIMEOUT (5*1000) 63 #define PPPOL2TP_SLOW_RETRY (60*1000) 65 #define PPPOL2TP_MAXSCCRQ 4 66 #define PPPOL2TP_MAXICRQ 4 67 #define PPPOL2TP_MAXICCN 4 70 #define PPPOL2TP_HEADERFLAG_CONTROL 0x8000 71 #define PPPOL2TP_HEADERFLAG_LENGTH 0x4000 72 #define PPPOL2TP_HEADERFLAG_SEQUENCE 0x0800 73 #define PPPOL2TP_HEADERFLAG_OFFSET 0x0200 74 #define PPPOL2TP_HEADERFLAG_PRIORITY 0x0100 75 #define PPPOL2TP_HEADERFLAG_VERSION 0x0002 78 #define PPPOL2TP_HEADERFLAG_CONTROL_MANDATORY (PPPOL2TP_HEADERFLAG_CONTROL|PPPOL2TP_HEADERFLAG_LENGTH|PPPOL2TP_HEADERFLAG_SEQUENCE|PPPOL2TP_HEADERFLAG_VERSION) 80 #define PPPOL2TP_HEADERFLAG_CONTROL_FORBIDDEN (PPPOL2TP_HEADERFLAG_OFFSET|PPPOL2TP_HEADERFLAG_PRIORITY) 83 #define PPPOL2TP_HEADERFLAG_DATA_MANDATORY (PPPOL2TP_HEADERFLAG_VERSION) 86 #define PPPOL2TP_AVPHEADERFLAG_MANDATORY 0x8000 87 #define PPPOL2TP_AVPHEADERFLAG_HIDDEN 0x4000 88 #define PPPOL2TP_AVPHEADERFLAG_LENGTHMASK 0x03ff 91 #define PPPOL2TP_AVPTYPE_MESSAGE 0 94 #define PPPOL2TP_MESSAGETYPE_SCCRQ 1 95 #define PPPOL2TP_MESSAGETYPE_SCCRP 2 96 #define PPPOL2TP_MESSAGETYPE_SCCCN 3 97 #define PPPOL2TP_MESSAGETYPE_STOPCCN 4 98 #define PPPOL2TP_MESSAGETYPE_HELLO 6 100 #define PPPOL2TP_MESSAGETYPE_OCRQ 7 101 #define PPPOL2TP_MESSAGETYPE_OCRP 8 102 #define PPPOL2TP_MESSAGETYPE_OCCN 9 103 #define PPPOL2TP_MESSAGETYPE_ICRQ 10 104 #define PPPOL2TP_MESSAGETYPE_ICRP 11 105 #define PPPOL2TP_MESSAGETYPE_ICCN 12 106 #define PPPOL2TP_MESSAGETYPE_CDN 14 108 #define PPPOL2TP_MESSAGETYPE_WEN 15 110 #define PPPOL2TP_MESSAGETYPE_SLI 16 113 #define PPPOL2TP_AVPTYPE_RESULTCODE 1 114 #define PPPOL2TP_RESULTCODE 1 117 #define PPPOL2TP_AVPTYPE_VERSION 2 118 #define PPPOL2TP_VERSION 0x0100 121 #define PPPOL2TP_AVPTYPE_FRAMINGCAPABILITIES 3 122 #define PPPOL2TP_FRAMINGCAPABILITIES 0x00000003 125 #define PPPOL2TP_AVPTYPE_BEARERCAPABILITIES 4 126 #define PPPOL2TP_BEARERCAPABILITIES 0x00000003 129 #define PPPOL2TP_AVPTYPE_TIEBREAKER 5 132 #define PPPOL2TP_AVPTYPE_HOSTNAME 7 133 #define PPPOL2TP_HOSTNAME "lwIP" 136 #define PPPOL2TP_AVPTYPE_VENDORNAME 8 137 #define PPPOL2TP_VENDORNAME "lwIP" 140 #define PPPOL2TP_AVPTYPE_TUNNELID 9 143 #define PPPOL2TP_AVPTYPE_RECEIVEWINDOWSIZE 10 144 #define PPPOL2TP_RECEIVEWINDOWSIZE 8 147 #define PPPOL2TP_AVPTYPE_CHALLENGE 11 150 #define PPPOL2TP_AVPTYPE_CAUSECODE 12 153 #define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE 13 154 #define PPPOL2TP_AVPTYPE_CHALLENGERESPONSE_SIZE 16 157 #define PPPOL2TP_AVPTYPE_SESSIONID 14 160 #define PPPOL2TP_AVPTYPE_CALLSERIALNUMBER 15 163 #define PPPOL2TP_AVPTYPE_FRAMINGTYPE 19 164 #define PPPOL2TP_FRAMINGTYPE 0x00000001 167 #define PPPOL2TP_AVPTYPE_TXCONNECTSPEED 24 168 #define PPPOL2TP_TXCONNECTSPEED 100000000 171 #define PPPOL2TP_STATE_INITIAL 0 172 #define PPPOL2TP_STATE_SCCRQ_SENT 1 173 #define PPPOL2TP_STATE_ICRQ_SENT 2 174 #define PPPOL2TP_STATE_ICCN_SENT 3 175 #define PPPOL2TP_STATE_DATA 4 177 #define PPPOL2TP_OUTPUT_DATA_HEADER_LEN 6 182 typedef struct pppol2tp_pcb_s pppol2tp_pcb;
183 struct pppol2tp_pcb_s {
190 #if PPPOL2TP_AUTH_SUPPORT 194 u8_t challenge_hash[16];
202 u16_t source_tunnel_id;
203 u16_t remote_tunnel_id;
204 u16_t source_session_id;
205 u16_t remote_session_id;
214 ppp_pcb *pppol2tp_create(
struct netif *pppif,
215 struct netif *
netif,
const ip_addr_t *ipaddr, u16_t port,
216 const u8_t *secret, u8_t secret_len,
217 ppp_link_status_cb_fn link_status_cb,
void *ctx_cb);