Documentation

Documentation

Includes

netif/ppp/ppp_opts.h

#include "netif/ppp/ppp_opts.h"
#include "netif/ppp/ppp_opts.h"

ppp.h

#include "ppp.h"
#include "ppp.h"

Macros

Marco CHAP_H

#define CHAP_H


      

Marco CHAP_HDRLEN

#define CHAP_HDRLEN 4
/*
 * CHAP packets begin with a standard header with code, id, len (2 bytes).
 */

Marco CHAP_CHALLENGE

#define CHAP_CHALLENGE 1
/*
 * Values for the code field.
 */

Marco CHAP_RESPONSE

#define CHAP_RESPONSE 2


      

Marco CHAP_SUCCESS

#define CHAP_SUCCESS 3


      

Marco CHAP_FAILURE

#define CHAP_FAILURE 4


      

Marco CHAP_MD5

#define CHAP_MD5	5
/*
 * CHAP digest codes.
 */

Marco CHAP_MICROSOFT

#define CHAP_MICROSOFT	128


      

Marco CHAP_MICROSOFT_V2

#define CHAP_MICROSOFT_V2 129


      

Marco MAX_CHALLENGE_LEN

#define MAX_CHALLENGE_LEN 64
/*
 * Semi-arbitrary limits on challenge and response fields.
 */

Marco MAX_RESPONSE_LEN

#define MAX_RESPONSE_LEN 64


      

Marco CHAL_MAX_PKTLEN

#define CHAL_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_CHALLENGE_LEN + MAXNAMELEN)
/*
 * These limits apply to challenge and response packets we send.
 * The +4 is the +1 that we actually need rounded up.
 */

Marco RESP_MAX_PKTLEN

#define RESP_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_RESPONSE_LEN + MAXNAMELEN)


      

Marco MDTYPE_MICROSOFT_V2

#define MDTYPE_MICROSOFT_V2 1


      

Marco MDTYPE_MICROSOFT

#define MDTYPE_MICROSOFT 2


      

Marco MDTYPE_MD5

#define MDTYPE_MD5	4


      

Marco MDTYPE_NONE

#define MDTYPE_NONE	0


      

Marco CHAP_DIGEST(mdtype)

#define CHAP_DIGEST(mdtype) \
   ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
   ((mdtype) & MDTYPE_MICROSOFT_V2)? CHAP_MICROSOFT_V2: \
   ((mdtype) & MDTYPE_MICROSOFT)? CHAP_MICROSOFT: \
   0
/* Return the digest alg. ID for the most preferred digest type. */

Marco CHAP_DIGEST(mdtype)

#define CHAP_DIGEST(mdtype) \
   ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
   0


      

Marco CHAP_MDTYPE(mdtype)

#define CHAP_MDTYPE(mdtype) ((mdtype) ^ ((mdtype) - 1)) & (mdtype)
/* Return the bit flag (lsb set) for our most preferred digest type. */

Marco CHAP_MDTYPE_D(digest)

#define CHAP_MDTYPE_D(digest) \
   ((digest) == CHAP_MICROSOFT_V2)? MDTYPE_MICROSOFT_V2: \
   ((digest) == CHAP_MICROSOFT)? MDTYPE_MICROSOFT: \
   ((digest) == CHAP_MD5)? MDTYPE_MD5: \
   0


      

Marco CHAP_MDTYPE_D(digest)

#define CHAP_MDTYPE_D(digest) \
   ((digest) == CHAP_MD5)? MDTYPE_MD5: \
   0


      

Marco CHAP_CANDIGEST(mdtype, digest)

#define CHAP_CANDIGEST(mdtype, digest) \
   ((digest) == CHAP_MICROSOFT_V2)? (mdtype) & MDTYPE_MICROSOFT_V2: \
   ((digest) == CHAP_MICROSOFT)? (mdtype) & MDTYPE_MICROSOFT: \
   ((digest) == CHAP_MD5)? (mdtype) & MDTYPE_MD5: \
   0


      

Marco CHAP_CANDIGEST(mdtype, digest)

#define CHAP_CANDIGEST(mdtype, digest) \
   ((digest) == CHAP_MD5)? (mdtype) & MDTYPE_MD5: \
   0

      

Functions

Vars

Consts

Const

const struct chap_digest_type *digest,
		unsigned char *challenge, unsigned char *response,
		char *message, int message_space);

      

Types

Typedefs

Typedef chap_client_state;

typedef struct chap_client_state {
 u8_t flags;
 const char *name;
 const struct chap_digest_type *digest;
 unsigned char priv[64];	/* private area for digest's use */
} chap_client_state;


      

Typedef chap_server_state;

typedef struct chap_server_state {
 u8_t flags;
 u8_t id;
 const char *name;
 const struct chap_digest_type *digest;
 int challenge_xmits;
 int challenge_pktlen;
 unsigned char challenge[CHAL_MAX_PKTLEN];
} chap_server_state;