diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index b513ece6..7bbe99d5 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -266,6 +266,7 @@ extern char *getlogin __P((void)); #define setlogmask(x) #endif +#if 0 /* * PPP Data Link Layer "protocol" table. * One entry per supported protocol. @@ -300,7 +301,7 @@ struct protent *protocols[] = { #endif /* EAP_SUPPORT */ NULL }; - +#endif #if 0 /* diff --git a/src/netif/ppp/pppd.h b/src/netif/ppp/pppd.h index 05a1a851..3409d6c3 100644 --- a/src/netif/ppp/pppd.h +++ b/src/netif/ppp/pppd.h @@ -412,6 +412,7 @@ extern int option_priority; /* priority of current options */ #define PHASE_HOLDOFF 11 #define PHASE_MASTER 12 +#if 0 /* * The following struct gives the addresses of procedures to call * for a particular protocol. @@ -463,6 +464,7 @@ struct protent { /* Table of pointers to supported protocols */ extern struct protent *protocols[]; +#endif /* * This struct contains pointers to a set of procedures for diff --git a/src/netif/ppp/pppmy.c b/src/netif/ppp/pppmy.c index af89e824..34ef073c 100644 --- a/src/netif/ppp/pppmy.c +++ b/src/netif/ppp/pppmy.c @@ -11,17 +11,33 @@ #include "lwip/stats.h" #include "lwip/sys.h" +#if PPPOE_SUPPORT +#include "netif/ppp_oe.h" +#endif /* PPPOE_SUPPORT */ + #include "pppd.h" +#include "pppdebug.h" +#include "pppmy.h" + #include "fsm.h" #include "lcp.h" #include "ipcp.h" -#include "pppdebug.h" -#include "pppmy.h" - -#if PPPOE_SUPPORT -#include "netif/ppp_oe.h" -#endif /* PPPOE_SUPPORT */ +#if PAP_SUPPORT +#include "upap.h" +#endif /* PAP_SUPPORT */ +#if CHAP_SUPPORT +#include "chap-new.h" +#endif /* CHAP_SUPPORT */ +#if EAP_SUPPORT +#include "eap.h" +#endif /* EAP_SUPPORT */ +#if CCP_SUPPORT +#include "ccp.h" +#endif /* EAP_SUPPORT */ +#if ECP_SUPPORT +#include "ecp.h" +#endif /* EAP_SUPPORT */ /* FIXME: add a phase per PPP session */ int phase; /* where the link is at */ @@ -35,6 +51,41 @@ unsigned link_connect_time; int link_stats_valid; #endif /* PPP_STATS_SUPPORT */ +/* + * PPP Data Link Layer "protocol" table. + * One entry per supported protocol. + * The last entry must be NULL. + */ +struct protent *protocols[] = { + &lcp_protent, +#if PAP_SUPPORT + &pap_protent, +#endif /* PAP_SUPPORT */ +#if CHAP_SUPPORT + &chap_protent, +#endif /* CHAP_SUPPORT */ +#if CBCP_SUPPORT + &cbcp_protent, +#endif + &ipcp_protent, +#ifdef INET6 + &ipv6cp_protent, +#endif +#if CCP_SUPPORT + &ccp_protent, +#endif /* CCP_SUPPORT */ +#if ECP_SUPPORT + &ecp_protent, +#endif /* ECP_SUPPORT */ +#ifdef AT_CHANGE + &atcp_protent, +#endif +#if EAP_SUPPORT + &eap_protent, +#endif /* EAP_SUPPORT */ + NULL +}; + /* PPP packet parser states. Current state indicates operation yet to be * completed. */ typedef enum { diff --git a/src/netif/ppp/pppmy.h b/src/netif/ppp/pppmy.h index d88c6e45..e53c0e14 100644 --- a/src/netif/ppp/pppmy.h +++ b/src/netif/ppp/pppmy.h @@ -21,6 +21,57 @@ typedef unsigned char bool; #endif +/* + * The following struct gives the addresses of procedures to call + * for a particular protocol. + */ +struct protent { + u_short protocol; /* PPP protocol number */ + /* Initialization procedure */ + void (*init) __P((int unit)); + /* Process a received packet */ + void (*input) __P((int unit, u_char *pkt, int len)); + /* Process a received protocol-reject */ + void (*protrej) __P((int unit)); + /* Lower layer has come up */ + void (*lowerup) __P((int unit)); + /* Lower layer has gone down */ + void (*lowerdown) __P((int unit)); + /* Open the protocol */ + void (*open) __P((int unit)); + /* Close the protocol */ + void (*close) __P((int unit, char *reason)); +#if PRINTPKT_SUPPORT + /* Print a packet in readable form */ + int (*printpkt) __P((u_char *pkt, int len, + void (*printer) __P((void *, char *, ...)), + void *arg)); +#endif /* PRINTPKT_SUPPORT */ + /* FIXME: data input is only used by CCP, which is not supported at this time, + * should we remove this entry and save some flash ? + */ + /* Process a received data packet */ + void (*datainput) __P((int unit, u_char *pkt, int len)); + bool enabled_flag; /* 0 iff protocol is disabled */ +#if PRINTPKT_SUPPORT + char *name; /* Text name of protocol */ + char *data_name; /* Text name of corresponding data protocol */ +#endif /* PRINTPKT_SUPPORT */ +#if PPP_OPTIONS + option_t *options; /* List of command-line options */ + /* Check requested options, assign defaults */ + void (*check_options) __P((void)); +#endif /* PPP_OPTIONS */ +#if DEMAND_SUPPORT + /* Configure interface for demand-dial */ + int (*demand_conf) __P((int unit)); + /* Say whether to bring up link for this pkt */ + int (*active_pkt) __P((u_char *pkt, int len)); +#endif /* DEMAND_SUPPORT */ +}; + +/* Table of pointers to supported protocols */ +extern struct protent *protocols[]; /*************************