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 FSM_H

#define FSM_H


      

Marco HEADERLEN

#define HEADERLEN 4
/*
 * Packet header = Code, id, length.
 */

Marco CONFREQ

#define CONFREQ	1 /* Configuration Request */
/*
 *  CP (LCP, IPCP, etc.) codes.
 */

Marco CONFACK

#define CONFACK	2 /* Configuration Ack */


      

Marco CONFNAK

#define CONFNAK	3 /* Configuration Nak */


      

Marco CONFREJ

#define CONFREJ	4 /* Configuration Reject */


      

Marco TERMREQ

#define TERMREQ	5 /* Termination Request */


      

Marco TERMACK

#define TERMACK	6 /* Termination Ack */


      

Marco CODEREJ

#define CODEREJ	7 /* Code Reject */


      

Marco PPP_FSM_INITIAL

#define PPP_FSM_INITIAL	0 /* Down, hasn't been opened */
/*
 * Link states.
 */

Marco PPP_FSM_STARTING

#define PPP_FSM_STARTING 1 /* Down, been opened */


      

Marco PPP_FSM_CLOSED

#define PPP_FSM_CLOSED	2 /* Up, hasn't been opened */


      

Marco PPP_FSM_STOPPED

#define PPP_FSM_STOPPED	3 /* Open, waiting for down event */


      

Marco PPP_FSM_CLOSING

#define PPP_FSM_CLOSING	4 /* Terminating the connection, not open */


      

Marco PPP_FSM_STOPPING

#define PPP_FSM_STOPPING 5 /* Terminating, but open */


      

Marco PPP_FSM_REQSENT

#define PPP_FSM_REQSENT	6 /* We've sent a Config Request */


      

Marco PPP_FSM_ACKRCVD

#define PPP_FSM_ACKRCVD	7 /* We've received a Config Ack */


      

Marco PPP_FSM_ACKSENT

#define PPP_FSM_ACKSENT	8 /* We've sent a Config Ack */


      

Marco PPP_FSM_OPENED

#define PPP_FSM_OPENED	9 /* Connection available */


      

Marco OPT_PASSIVE

#define OPT_PASSIVE 1 /* Don't die if we don't get a response */
/*
 * Flags - indicate options controlling FSM operation
 */

Marco OPT_RESTART

#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */


      

Marco OPT_SILENT

#define OPT_SILENT 4 /* Wait for peer to speak first */


      

Marco DEFTIMEOUT

#define DEFTIMEOUT 3 /* Timeout time in seconds */


      

Marco DEFMAXTERMREQS

#define DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */


      

Marco DEFMAXCONFREQS

#define DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */


      

Marco DEFMAXNAKLOOPS

#define DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */

      

Functions

Func fsm_init

void fsm_init(fsm *f);
/*
 * Prototypes
 */

Func fsm_lowerup

void fsm_lowerup(fsm *f);


      

Func fsm_lowerdown

void fsm_lowerdown(fsm *f);


      

Func fsm_open

void fsm_open(fsm *f);


      

Func fsm_close

void fsm_close(fsm *f, const char *reason);


      

Func fsm_input

void fsm_input(fsm *f, u_char *inpacket, int l);


      

Func fsm_protreject

void fsm_protreject(fsm *f);


      

Func fsm_sdata

void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen);

      

Vars

Consts

Types

Typedefs

Typedef fsm;

typedef struct fsm {
   ppp_pcb *pcb;	/* PPP Interface */
   const struct fsm_callbacks *callbacks; /* Callback routines */
   const char *term_reason; /* Reason for closing protocol */
   u8_t seen_ack;	/* Have received valid Ack/Nak/Rej to Req */
			  /* -- This is our only flag, we might use u_int :1 if we have more flags */
   u16_t protocol;	/* Data Link Layer Protocol field value */
   u8_t state;		/* State */
   u8_t flags;		/* Contains option bits */
   u8_t id;		/* Current id */
   u8_t reqid;		/* Current request id */
   u8_t retransmits;	/* Number of retransmissions left */
   u8_t nakloops;	/* Number of nak loops since last ack */
   u8_t rnakloops;	/* Number of naks received */
   u8_t maxnakloops;	/* Maximum number of nak loops tolerated
				   (necessary because IPCP require a custom large max nak loops value) */
   u8_t term_reason_len; /* Length of term_reason */
} fsm;
/*
 * Each FSM is described by an fsm structure and fsm callbacks.
 */

Typedef fsm_callbacks;

typedef struct fsm_callbacks {
   void (*resetci)	/* Reset our Configuration Information */
	(fsm *);
   int (*cilen)	/* Length of our Configuration Information */
	(fsm *);
   void (*addci)		/* Add our Configuration Information */
	(fsm *, u_char *, int *);
   int (*ackci)	/* ACK our Configuration Information */
	(fsm *, u_char *, int);
   int (*nakci)	/* NAK our Configuration Information */
	(fsm *, u_char *, int, int);
   int (*rejci)	/* Reject our Configuration Information */
	(fsm *, u_char *, int);
   int (*reqci)	/* Request peer's Configuration Information */
	(fsm *, u_char *, int *, int);
   void (*up)		/* Called when fsm reaches PPP_FSM_OPENED state */
	(fsm *);
   void (*down)	/* Called when fsm leaves PPP_FSM_OPENED state */
	(fsm *);
   void (*starting)	/* Called when we want the lower layer */
	(fsm *);
   void (*finished)	/* Called when we don't want the lower layer */
	(fsm *);
   void (*protreject)	/* Called when Protocol-Reject received */
	(int);
   void (*retransmit)	/* Retransmission is necessary */
	(fsm *);
   int (*extcode)	/* Called when unknown code received */
	(fsm *, int, int, u_char *, int);
   const char *proto_name; /* String name for protocol (for messages) */
} fsm_callbacks;