63 #ifndef PPP_REMOTENAME 
   64 #define PPP_REMOTENAME      0 
   67 #ifndef PPP_IDLETIMELIMIT 
   68 #define PPP_IDLETIMELIMIT   0 
   71 #ifndef PPP_LCP_ADAPTIVE 
   72 #define PPP_LCP_ADAPTIVE    0 
   75 #ifndef PPP_MAXCONNECT 
   76 #define PPP_MAXCONNECT      0 
   79 #ifndef PPP_ALLOWED_ADDRS 
   80 #define PPP_ALLOWED_ADDRS   0 
   83 #ifndef PPP_PROTOCOLNAME 
   84 #define PPP_PROTOCOLNAME    0 
   87 #ifndef PPP_STATS_SUPPORT 
   88 #define PPP_STATS_SUPPORT   0 
   91 #ifndef DEFLATE_SUPPORT 
   92 #define DEFLATE_SUPPORT     0 
   95 #ifndef BSDCOMPRESS_SUPPORT 
   96 #define BSDCOMPRESS_SUPPORT 0 
   99 #ifndef PREDICTOR_SUPPORT 
  100 #define PREDICTOR_SUPPORT   0 
  116 #define PPP_PHASE_DEAD          0 
  117 #define PPP_PHASE_MASTER        1 
  118 #define PPP_PHASE_HOLDOFF       2 
  119 #define PPP_PHASE_INITIALIZE    3 
  120 #define PPP_PHASE_SERIALCONN    4 
  121 #define PPP_PHASE_DORMANT       5 
  122 #define PPP_PHASE_ESTABLISH     6 
  123 #define PPP_PHASE_AUTHENTICATE  7 
  124 #define PPP_PHASE_CALLBACK      8 
  125 #define PPP_PHASE_NETWORK       9 
  126 #define PPP_PHASE_RUNNING       10 
  127 #define PPP_PHASE_TERMINATE     11 
  128 #define PPP_PHASE_DISCONNECT    12 
  131 #define PPPERR_NONE         0   
  132 #define PPPERR_PARAM        1   
  133 #define PPPERR_OPEN         2   
  134 #define PPPERR_DEVICE       3   
  135 #define PPPERR_ALLOC        4   
  136 #define PPPERR_USER         5   
  137 #define PPPERR_CONNECT      6   
  138 #define PPPERR_AUTHFAIL     7   
  139 #define PPPERR_PROTOCOL     8   
  140 #define PPPERR_PEERDEAD     9   
  141 #define PPPERR_IDLETIMEOUT  10  
  142 #define PPPERR_CONNECTTIME  11  
  143 #define PPPERR_LOOPBACK     12  
  146 #define PPP_AUTH_SUPPORT (PAP_SUPPORT || CHAP_SUPPORT || EAP_SUPPORT) 
  158 typedef struct ppp_pcb_s ppp_pcb;
 
  161 #ifndef __u_char_defined 
  162 typedef unsigned long  u_long;
 
  163 typedef unsigned int   u_int;
 
  164 typedef unsigned short u_short;
 
  165 typedef unsigned char  u_char;
 
  196 typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb, 
int err_code, 
void *ctx);
 
  201 typedef struct ppp_settings_s {
 
  203 #if PPP_SERVER && PPP_AUTH_SUPPORT 
  204   unsigned int  auth_required       :1;      
 
  205   unsigned int  null_login          :1;      
 
  208   unsigned int  explicit_remote     :1;      
 
  211   unsigned int  refuse_pap          :1;      
 
  214   unsigned int  refuse_chap         :1;      
 
  217   unsigned int  refuse_mschap       :1;      
 
  218   unsigned int  refuse_mschap_v2    :1;      
 
  221   unsigned int  refuse_eap          :1;      
 
  224   unsigned int  usepeerdns          :1;      
 
  226   unsigned int  persist             :1;      
 
  228   unsigned int  hide_password       :1;      
 
  230   unsigned int  noremoteip          :1;      
 
  231   unsigned int  lax_recv            :1;      
 
  232   unsigned int  noendpoint          :1;      
 
  234   unsigned int lcp_echo_adaptive    :1;      
 
  237   unsigned int require_mppe         :1;      
 
  238   unsigned int refuse_mppe_40       :1;      
 
  239   unsigned int refuse_mppe_128      :1;      
 
  240   unsigned int refuse_mppe_stateful :1;      
 
  245 #if PPP_IDLETIMELIMIT 
  246   u16_t  idle_time_limit;             
 
  257   char  remote_name[MAXNAMELEN   + 1]; 
 
  261   u8_t  pap_timeout_time;        
 
  262   u8_t  pap_max_transmits;       
 
  264   u8_t  pap_req_timeout;         
 
  269   u8_t  chap_timeout_time;       
 
  270   u8_t  chap_max_transmits;      
 
  272   u8_t  chap_rechallenge_time;   
 
  280   u8_t  eap_timeout_time;        
 
  281   u8_t  eap_max_transmits;       
 
  287   u8_t  fsm_timeout_time;            
 
  288   u8_t  fsm_max_conf_req_transmits;  
 
  289   u8_t  fsm_max_term_transmits;      
 
  290   u8_t  fsm_max_nak_loops;           
 
  292   u8_t  lcp_loopbackfail;     
 
  294   u8_t  lcp_echo_interval;    
 
  302   ip4_addr_t our_ipaddr, his_ipaddr, netmask;
 
  304   ip4_addr_t dns1, dns2;
 
  308   ip6_addr_t our6_ipaddr, his6_ipaddr;
 
  317   ppp_settings settings;
 
  318   const struct link_callbacks *link_cb;
 
  320   void (*link_status_cb)(ppp_pcb *pcb, 
int err_code, 
void *ctx);  
 
  322   void (*notify_phase_cb)(ppp_pcb *pcb, 
u8_t phase, 
void *ctx);   
 
  331   unsigned int ask_for_local           :1; 
 
  332   unsigned int ipcp_is_open            :1; 
 
  333   unsigned int ipcp_is_up              :1; 
 
  334   unsigned int if4_up                  :1; 
 
  336   unsigned int proxy_arp_set           :1; 
 
  340   unsigned int ipv6cp_is_up            :1; 
 
  341   unsigned int if6_up                  :1; 
 
  343   unsigned int lcp_echo_timer_running  :1; 
 
  345   unsigned int vj_enabled              :1; 
 
  348   unsigned int ccp_all_rejected        :1; 
 
  351   unsigned int mppe_keys_set           :1; 
 
  356 #if PPP_SERVER && defined(HAVE_MULTILINK) 
  357   char peer_authname[MAXNAMELEN + 1]; 
 
  367   chap_client_state chap_client;  
 
  369   chap_server_state chap_server;  
 
  379   lcp_options lcp_wantoptions;   
 
  380   lcp_options lcp_gotoptions;    
 
  381   lcp_options lcp_allowoptions;  
 
  382   lcp_options lcp_hisoptions;    
 
  384   u8_t lcp_echos_pending;        
 
  385   u8_t lcp_echo_number;          
 
  391   struct vjcompress vj_comp;     
 
  396   ccp_options ccp_wantoptions;   
 
  397   ccp_options ccp_gotoptions;    
 
  398   ccp_options ccp_allowoptions;  
 
  399   ccp_options ccp_hisoptions;    
 
  401   u8_t ccp_receive_method;       
 
  402   u8_t ccp_transmit_method;      
 
  404   ppp_mppe_state mppe_comp;      
 
  405   ppp_mppe_state mppe_decomp;    
 
  411   ipcp_options ipcp_wantoptions;  
 
  412   ipcp_options ipcp_gotoptions;   
 
  413   ipcp_options ipcp_allowoptions; 
 
  414   ipcp_options ipcp_hisoptions;   
 
  419   ipv6cp_options ipv6cp_wantoptions;  
 
  420   ipv6cp_options ipv6cp_gotoptions;   
 
  421   ipv6cp_options ipv6cp_allowoptions; 
 
  422   ipv6cp_options ipv6cp_hisoptions;   
 
  459 #define PPPAUTHTYPE_NONE      0x00 
  460 #define PPPAUTHTYPE_PAP       0x01 
  461 #define PPPAUTHTYPE_CHAP      0x02 
  462 #define PPPAUTHTYPE_MSCHAP    0x04 
  463 #define PPPAUTHTYPE_MSCHAP_V2 0x08 
  464 #define PPPAUTHTYPE_EAP       0x10 
  465 #define PPPAUTHTYPE_ANY       0xff 
  466 void ppp_set_auth(ppp_pcb *pcb, 
u8_t authtype, 
const char *user, 
const char *passwd);
 
  473 #define ppp_set_auth_required(ppp, boolval) (ppp->settings.auth_required = boolval) 
  483 #define ppp_set_ipcp_ouraddr(ppp, addr) do { ppp->ipcp_wantoptions.ouraddr = ip4_addr_get_u32(addr); \ 
  484                                              ppp->ask_for_local = ppp->ipcp_wantoptions.ouraddr != 0; } while(0) 
  485 #define ppp_set_ipcp_hisaddr(ppp, addr) (ppp->ipcp_wantoptions.hisaddr = ip4_addr_get_u32(addr)) 
  493 #define ppp_set_ipcp_dnsaddr(ppp, index, addr) (ppp->ipcp_allowoptions.dnsaddr[index] = ip4_addr_get_u32(addr)) 
  501 #define ppp_set_usepeerdns(ppp, boolval) (ppp->settings.usepeerdns = boolval) 
  507 #define PPP_MPPE_DISABLE           0x00 
  509 #define PPP_MPPE_ENABLE            0x01 
  511 #define PPP_MPPE_ALLOW_STATEFUL    0x02 
  513 #define PPP_MPPE_REFUSE_40         0x04 
  515 #define PPP_MPPE_REFUSE_128        0x08 
  521 void ppp_set_mppe(ppp_pcb *pcb, 
u8_t flags);
 
  531 #define ppp_set_listen_time(ppp, intval) (ppp->settings.listen_time = intval) 
  539 #define ppp_set_passive(ppp, boolval) (ppp->lcp_wantoptions.passive = boolval) 
  547 #define ppp_set_silent(ppp, boolval) (ppp->lcp_wantoptions.silent = boolval) 
  555 #define ppp_set_neg_pcomp(ppp, boolval) (ppp->lcp_wantoptions.neg_pcompression = \ 
  556                                          ppp->lcp_allowoptions.neg_pcompression = boolval) 
  564 #define ppp_set_neg_accomp(ppp, boolval) (ppp->lcp_wantoptions.neg_accompression = \ 
  565                                           ppp->lcp_allowoptions.neg_accompression = boolval) 
  573 #define ppp_set_neg_asyncmap(ppp, boolval) (ppp->lcp_wantoptions.neg_asyncmap = \ 
  574                                             ppp->lcp_allowoptions.neg_asyncmap = boolval) 
  587 #define ppp_set_asyncmap(ppp, intval) (ppp->lcp_wantoptions.asyncmap = intval) 
  593 #define ppp_set_default(ppp)         netif_set_default(ppp->netif) 
  602 typedef void (*ppp_notify_phase_cb_fn)(ppp_pcb *pcb, 
u8_t phase, 
void *ctx);
 
  603 void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
 
  617 err_t ppp_connect(ppp_pcb *pcb, 
u16_t holdoff);
 
  628 err_t ppp_listen(ppp_pcb *pcb);
 
  642 err_t ppp_close(ppp_pcb *pcb, 
u8_t nocarrier);
 
  654 err_t ppp_free(ppp_pcb *pcb);
 
  662 #define PPPCTLG_UPSTATUS 0 
  668 #define PPPCTLG_ERRCODE  1 
  679 err_t ppp_ioctl(ppp_pcb *pcb, 
u8_t cmd, 
void *arg);
 
  682 #define ppp_netif(ppp)               (ppp->netif) 
  685 #define ppp_set_netif_statuscallback(ppp, status_cb)       \ 
  686         netif_set_status_callback(ppp->netif, status_cb); 
  689 #define ppp_set_netif_linkcallback(ppp, link_cb)           \ 
  690         netif_set_link_callback(ppp->netif, link_cb); 
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96