68#define PPP_REMOTENAME 0
71#ifndef PPP_IDLETIMELIMIT
72#define PPP_IDLETIMELIMIT 0
75#ifndef PPP_LCP_ADAPTIVE
76#define PPP_LCP_ADAPTIVE 0
80#define PPP_MAXCONNECT 0
83#ifndef PPP_ALLOWED_ADDRS
84#define PPP_ALLOWED_ADDRS 0
87#ifndef PPP_PROTOCOLNAME
88#define PPP_PROTOCOLNAME 0
91#ifndef PPP_STATS_SUPPORT
92#define PPP_STATS_SUPPORT 0
95#ifndef DEFLATE_SUPPORT
96#define DEFLATE_SUPPORT 0
99#ifndef BSDCOMPRESS_SUPPORT
100#define BSDCOMPRESS_SUPPORT 0
103#ifndef PREDICTOR_SUPPORT
104#define PREDICTOR_SUPPORT 0
120#define PPP_PHASE_DEAD 0
121#define PPP_PHASE_MASTER 1
122#define PPP_PHASE_HOLDOFF 2
123#define PPP_PHASE_INITIALIZE 3
124#define PPP_PHASE_SERIALCONN 4
125#define PPP_PHASE_DORMANT 5
126#define PPP_PHASE_ESTABLISH 6
127#define PPP_PHASE_AUTHENTICATE 7
128#define PPP_PHASE_CALLBACK 8
129#define PPP_PHASE_NETWORK 9
130#define PPP_PHASE_RUNNING 10
131#define PPP_PHASE_TERMINATE 11
132#define PPP_PHASE_DISCONNECT 12
136#define PPPERR_PARAM 1
138#define PPPERR_DEVICE 3
139#define PPPERR_ALLOC 4
141#define PPPERR_CONNECT 6
142#define PPPERR_AUTHFAIL 7
143#define PPPERR_PROTOCOL 8
144#define PPPERR_PEERDEAD 9
145#define PPPERR_IDLETIMEOUT 10
146#define PPPERR_CONNECTTIME 11
147#define PPPERR_LOOPBACK 12
150#define PPP_AUTH_SUPPORT (PAP_SUPPORT || CHAP_SUPPORT || EAP_SUPPORT)
162typedef struct ppp_pcb_s ppp_pcb;
165#ifndef __u_char_defined
166typedef unsigned long u_long;
167typedef unsigned int u_int;
168typedef unsigned short u_short;
169typedef unsigned char u_char;
200typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb,
int err_code,
void *ctx);
205typedef struct ppp_settings_s {
207#if PPP_SERVER && PPP_AUTH_SUPPORT
208 unsigned int auth_required :1;
209 unsigned int null_login :1;
212 unsigned int explicit_remote :1;
215 unsigned int refuse_pap :1;
218 unsigned int refuse_chap :1;
221 unsigned int refuse_mschap :1;
222 unsigned int refuse_mschap_v2 :1;
225 unsigned int refuse_eap :1;
228 unsigned int usepeerdns :1;
230 unsigned int persist :1;
232 unsigned int hide_password :1;
234 unsigned int noremoteip :1;
235 unsigned int lax_recv :1;
236 unsigned int noendpoint :1;
238 unsigned int lcp_echo_adaptive :1;
241 unsigned int require_mppe :1;
242 unsigned int refuse_mppe_40 :1;
243 unsigned int refuse_mppe_128 :1;
244 unsigned int refuse_mppe_stateful :1;
250 u16_t idle_time_limit;
261 char remote_name[MAXNAMELEN + 1];
265 u8_t pap_timeout_time;
266 u8_t pap_max_transmits;
268 u8_t pap_req_timeout;
274 u8_t chap_timeout_time;
275 u8_t chap_max_transmits;
276 u8_t chap_rechallenge_time;
284 u8_t eap_timeout_time;
285 u8_t eap_max_transmits;
291 u8_t fsm_timeout_time;
292 u8_t fsm_max_conf_req_transmits;
293 u8_t fsm_max_term_transmits;
294 u8_t fsm_max_nak_loops;
296 u8_t lcp_loopbackfail;
298 u8_t lcp_echo_interval;
321 ppp_settings settings;
322 const struct link_callbacks *link_cb;
324 void (*link_status_cb)(ppp_pcb *pcb,
int err_code,
void *ctx);
326 void (*notify_phase_cb)(ppp_pcb *pcb, u8_t phase,
void *ctx);
335 unsigned int ask_for_local :1;
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;
463#define PPPAUTHTYPE_NONE 0x00
464#define PPPAUTHTYPE_PAP 0x01
465#define PPPAUTHTYPE_CHAP 0x02
466#define PPPAUTHTYPE_MSCHAP 0x04
467#define PPPAUTHTYPE_MSCHAP_V2 0x08
468#define PPPAUTHTYPE_EAP 0x10
469#define PPPAUTHTYPE_ANY 0xff
470void ppp_set_auth(ppp_pcb *pcb, u8_t authtype,
const char *user,
const char *passwd);
477#define ppp_set_auth_required(ppp, boolval) (ppp->settings.auth_required = boolval)
487#define ppp_set_ipcp_ouraddr(ppp, addr) do { ppp->ipcp_wantoptions.ouraddr = ip4_addr_get_u32(addr); \
488 ppp->ask_for_local = ppp->ipcp_wantoptions.ouraddr != 0; } while(0)
489#define ppp_set_ipcp_hisaddr(ppp, addr) (ppp->ipcp_wantoptions.hisaddr = ip4_addr_get_u32(addr))
497#define ppp_set_ipcp_dnsaddr(ppp, index, addr) (ppp->ipcp_allowoptions.dnsaddr[index] = ip4_addr_get_u32(addr))
505#define ppp_set_usepeerdns(ppp, boolval) (ppp->settings.usepeerdns = boolval)
511#define PPP_MPPE_DISABLE 0x00
513#define PPP_MPPE_ENABLE 0x01
515#define PPP_MPPE_ALLOW_STATEFUL 0x02
517#define PPP_MPPE_REFUSE_40 0x04
519#define PPP_MPPE_REFUSE_128 0x08
525void ppp_set_mppe(ppp_pcb *pcb, u8_t flags);
535#define ppp_set_listen_time(ppp, intval) (ppp->settings.listen_time = intval)
543#define ppp_set_passive(ppp, boolval) (ppp->lcp_wantoptions.passive = boolval)
551#define ppp_set_silent(ppp, boolval) (ppp->lcp_wantoptions.silent = boolval)
559#define ppp_set_neg_pcomp(ppp, boolval) (ppp->lcp_wantoptions.neg_pcompression = \
560 ppp->lcp_allowoptions.neg_pcompression = boolval)
568#define ppp_set_neg_accomp(ppp, boolval) (ppp->lcp_wantoptions.neg_accompression = \
569 ppp->lcp_allowoptions.neg_accompression = boolval)
577#define ppp_set_neg_asyncmap(ppp, boolval) (ppp->lcp_wantoptions.neg_asyncmap = \
578 ppp->lcp_allowoptions.neg_asyncmap = boolval)
591#define ppp_set_asyncmap(ppp, intval) (ppp->lcp_wantoptions.asyncmap = intval)
597#define ppp_set_default(ppp) netif_set_default(ppp->netif)
606typedef void (*ppp_notify_phase_cb_fn)(ppp_pcb *pcb, u8_t phase,
void *ctx);
607void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
621err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff);
632err_t ppp_listen(ppp_pcb *pcb);
646err_t ppp_close(ppp_pcb *pcb, u8_t nocarrier);
658err_t ppp_free(ppp_pcb *pcb);
666#define PPPCTLG_UPSTATUS 0
672#define PPPCTLG_ERRCODE 1
683err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd,
void *arg);
686#define ppp_netif(ppp) (ppp->netif)
689#define ppp_set_netif_statuscallback(ppp, status_cb) \
690 netif_set_status_callback(ppp->netif, status_cb);
693#define ppp_set_netif_linkcallback(ppp, link_cb) \
694 netif_set_link_callback(ppp->netif, link_cb);
struct ip6_addr ip6_addr_t
struct ip4_addr ip4_addr_t