PPP, changed all the code enclosed between PPP_SERVER #if macro to our PPP PCB structure, making it easier to support PPP server in the future

This commit is contained in:
Sylvain Rochet
2012-09-27 23:53:20 +02:00
parent 7fb874ad28
commit e81f092520
9 changed files with 143 additions and 137 deletions

View File

@@ -64,6 +64,13 @@
#define MAX_CHALLENGE_LEN 64
#define MAX_RESPONSE_LEN 64
/*
* These limits apply to challenge and response packets we send.
* The +4 is the +1 that we actually need rounded up.
*/
#define CHAL_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_CHALLENGE_LEN + MAXNAMELEN)
#define RESP_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_RESPONSE_LEN + MAXNAMELEN)
/* bitmask of supported algorithms */
#if MSCHAP_SUPPORT
#define MDTYPE_MICROSOFT_V2 0x1
@@ -152,7 +159,7 @@ typedef struct chap_client_state {
} chap_client_state;
#if PPP_SERVER
static struct chap_server_state {
typedef struct chap_server_state {
u8_t flags;
int id;
char *name;

View File

@@ -158,8 +158,9 @@ typedef struct ppp_settings_s {
#if PPP_SERVER
unsigned int auth_required : 1; /* Peer is required to authenticate */
unsigned int null_login : 1; /* Username of "" and a password of "" are acceptable */
#else
unsigned int :1; /* 1 bit of padding */
unsigned int :2; /* 2 bits of padding */
#endif /* PPP_SERVER */
#if PPP_REMOTENAME
unsigned int explicit_remote : 1; /* remote_name specified with remotename opt */
@@ -202,7 +203,7 @@ typedef struct ppp_settings_s {
#else
unsigned int :1; /* 1 bit of padding */
#endif
unsigned int :2; /* 2 bits of padding to round out to 16 bits */
unsigned int :1; /* 1 bit of padding to round out to 16 bits */
u16_t listen_time; /* time to listen first (ms), waiting for peer to send LCP packet */

View File

@@ -104,7 +104,7 @@ typedef struct upap_state {
u8_t us_passwdlen; /* Password length */
u8_t us_clientstate; /* Client state */
#if PPP_SERVER
u8_t us_serverstate /* Server state */
u8_t us_serverstate; /* Server state */
#endif /* PPP_SERVER */
u8_t us_id; /* Current id */
u8_t us_timeouttime; /* Timeout (seconds) for auth-req retrans. */