60 #ifndef PPP_REMOTENAME 61 #define PPP_REMOTENAME 0 64 #ifndef PPP_IDLETIMELIMIT 65 #define PPP_IDLETIMELIMIT 0 68 #ifndef PPP_LCP_ADAPTIVE 69 #define PPP_LCP_ADAPTIVE 0 72 #ifndef PPP_MAXCONNECT 73 #define PPP_MAXCONNECT 0 76 #ifndef PPP_ALLOWED_ADDRS 77 #define PPP_ALLOWED_ADDRS 0 80 #ifndef PPP_PROTOCOLNAME 81 #define PPP_PROTOCOLNAME 0 84 #ifndef PPP_STATS_SUPPORT 85 #define PPP_STATS_SUPPORT 0 88 #ifndef DEFLATE_SUPPORT 89 #define DEFLATE_SUPPORT 0 92 #ifndef BSDCOMPRESS_SUPPORT 93 #define BSDCOMPRESS_SUPPORT 0 96 #ifndef PREDICTOR_SUPPORT 97 #define PREDICTOR_SUPPORT 0 113 #define PPP_PHASE_DEAD 0 114 #define PPP_PHASE_INITIALIZE 1 115 #define PPP_PHASE_SERIALCONN 2 116 #define PPP_PHASE_DORMANT 3 117 #define PPP_PHASE_ESTABLISH 4 118 #define PPP_PHASE_AUTHENTICATE 5 119 #define PPP_PHASE_CALLBACK 6 120 #define PPP_PHASE_NETWORK 7 121 #define PPP_PHASE_RUNNING 8 122 #define PPP_PHASE_TERMINATE 9 123 #define PPP_PHASE_DISCONNECT 10 124 #define PPP_PHASE_HOLDOFF 11 125 #define PPP_PHASE_MASTER 12 128 #define PPPERR_NONE 0 129 #define PPPERR_PARAM 1 130 #define PPPERR_OPEN 2 131 #define PPPERR_DEVICE 3 132 #define PPPERR_ALLOC 4 133 #define PPPERR_USER 5 134 #define PPPERR_CONNECT 6 135 #define PPPERR_AUTHFAIL 7 136 #define PPPERR_PROTOCOL 8 137 #define PPPERR_PEERDEAD 9 138 #define PPPERR_IDLETIMEOUT 10 139 #define PPPERR_CONNECTTIME 11 140 #define PPPERR_LOOPBACK 12 143 #define PPP_AUTH_SUPPORT (PAP_SUPPORT || CHAP_SUPPORT || EAP_SUPPORT) 155 typedef struct ppp_pcb_s ppp_pcb;
158 #ifndef __u_char_defined 159 typedef unsigned long u_long;
160 typedef unsigned int u_int;
161 typedef unsigned short u_short;
162 typedef unsigned char u_char;
193 typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb,
int err_code,
void *ctx);
198 typedef struct ppp_settings_s {
200 #if PPP_SERVER && PPP_AUTH_SUPPORT 201 unsigned int auth_required :1;
202 unsigned int null_login :1;
205 unsigned int explicit_remote :1;
208 unsigned int refuse_pap :1;
211 unsigned int refuse_chap :1;
214 unsigned int refuse_mschap :1;
215 unsigned int refuse_mschap_v2 :1;
218 unsigned int refuse_eap :1;
221 unsigned int usepeerdns :1;
223 unsigned int persist :1;
225 unsigned int hide_password :1;
227 unsigned int noremoteip :1;
228 unsigned int lax_recv :1;
229 unsigned int noendpoint :1;
231 unsigned int lcp_echo_adaptive :1;
234 unsigned int require_mppe :1;
235 unsigned int refuse_mppe_40 :1;
236 unsigned int refuse_mppe_128 :1;
237 unsigned int refuse_mppe_stateful :1;
242 #if PPP_IDLETIMELIMIT 243 u16_t idle_time_limit;
254 char remote_name[MAXNAMELEN + 1];
258 u8_t pap_timeout_time;
259 u8_t pap_max_transmits;
261 u8_t pap_req_timeout;
266 u8_t chap_timeout_time;
267 u8_t chap_max_transmits;
269 u8_t chap_rechallenge_time;
277 u8_t eap_timeout_time;
278 u8_t eap_max_transmits;
284 u8_t fsm_timeout_time;
285 u8_t fsm_max_conf_req_transmits;
286 u8_t fsm_max_term_transmits;
287 u8_t fsm_max_nak_loops;
289 u8_t lcp_loopbackfail;
291 u8_t lcp_echo_interval;
299 ip4_addr_t our_ipaddr, his_ipaddr, netmask;
301 ip4_addr_t dns1, dns2;
305 ip6_addr_t our6_ipaddr, his6_ipaddr;
315 ppp_settings settings;
316 const struct link_callbacks *link_cb;
318 void (*link_status_cb)(ppp_pcb *pcb,
int err_code,
void *ctx);
320 void (*notify_phase_cb)(ppp_pcb *pcb,
u8_t phase,
void *ctx);
336 unsigned int ipcp_is_open :1;
337 unsigned int ipcp_is_up :1;
338 unsigned int if4_up :1;
340 unsigned int proxy_arp_set :1;
344 unsigned int ipv6cp_is_up :1;
345 unsigned int if6_up :1;
347 unsigned int lcp_echo_timer_running :1;
349 unsigned int vj_enabled :1;
352 unsigned int ccp_all_rejected :1;
355 unsigned int mppe_keys_set :1;
360 #if PPP_SERVER && defined(HAVE_MULTILINK) 361 char peer_authname[MAXNAMELEN + 1];
371 chap_client_state chap_client;
373 chap_server_state chap_server;
383 lcp_options lcp_wantoptions;
384 lcp_options lcp_gotoptions;
385 lcp_options lcp_allowoptions;
386 lcp_options lcp_hisoptions;
388 u8_t lcp_echos_pending;
389 u8_t lcp_echo_number;
395 struct vjcompress vj_comp;
400 ccp_options ccp_wantoptions;
401 ccp_options ccp_gotoptions;
402 ccp_options ccp_allowoptions;
403 ccp_options ccp_hisoptions;
405 u8_t ccp_receive_method;
406 u8_t ccp_transmit_method;
408 ppp_mppe_state mppe_comp;
409 ppp_mppe_state mppe_decomp;
415 ipcp_options ipcp_wantoptions;
416 ipcp_options ipcp_gotoptions;
417 ipcp_options ipcp_allowoptions;
418 ipcp_options ipcp_hisoptions;
423 ipv6cp_options ipv6cp_wantoptions;
424 ipv6cp_options ipv6cp_gotoptions;
425 ipv6cp_options ipv6cp_allowoptions;
426 ipv6cp_options ipv6cp_hisoptions;
456 #define PPPAUTHTYPE_NONE 0x00 457 #define PPPAUTHTYPE_PAP 0x01 458 #define PPPAUTHTYPE_CHAP 0x02 459 #define PPPAUTHTYPE_MSCHAP 0x04 460 #define PPPAUTHTYPE_MSCHAP_V2 0x08 461 #define PPPAUTHTYPE_EAP 0x10 462 #define PPPAUTHTYPE_ANY 0xff 463 void ppp_set_auth(ppp_pcb *pcb,
u8_t authtype,
const char *user,
const char *passwd);
469 #define ppp_set_default(ppp) netif_set_default(ppp->netif) 478 typedef void (*ppp_notify_phase_cb_fn)(ppp_pcb *pcb,
u8_t phase,
void *ctx);
479 void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
493 err_t ppp_connect(ppp_pcb *pcb,
u16_t holdoff);
507 err_t ppp_listen(ppp_pcb *pcb,
struct ppp_addrs *addrs);
521 err_t ppp_close(ppp_pcb *pcb,
u8_t nocarrier);
533 err_t ppp_free(ppp_pcb *pcb);
541 #define PPPCTLG_UPSTATUS 0 547 #define PPPCTLG_ERRCODE 1 558 err_t ppp_ioctl(ppp_pcb *pcb,
u8_t cmd,
void *arg);
561 #define ppp_netif(ppp) (ppp->netif) 564 #define ppp_set_netif_statuscallback(ppp, status_cb) \ 565 netif_set_status_callback(ppp->netif, status_cb); 568 #define ppp_set_netif_linkcallback(ppp, link_cb) \ 569 netif_set_link_callback(ppp->netif, link_cb);