⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mppp.h

📁 在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LEA_4S的驱动,位置速寻算法,语音芯片ISD4004的录放音驱动,LED页面管理等等.从启动代码到操作系统的移植以及到业
💻 H
📖 第 1 页 / 共 2 页
字号:
/* mppp.h
 *
 * definitions for PPP core code.
 *
 * ipport.h and ppp_port.h should be included in the source
 * BEFORE this file
 */


#ifndef _MPPP_H_
#define  _MPPP_H_ 1

#ifndef _PPP_PORT_H
#error Source must include ppp_port.h first
#endif

/* Select of this PPP build will support character IO, packet
 * IO, or both. Force sensible defaults based on ipport.h and
 * ppp_port.h. These are designed so that porting engineers
 * can enable them too.
 */

#if defined( USE_PPPOE) || defined(LB_XOVER)
#define  PPP_PACKETS 1
#endif

#if defined(USE_MODEM) || defined(USE_COMPORT)
#define  PPP_CHARIO  1
#endif


#define  PPP_LBCHAR  1

#if !defined(PPP_CHARIO) && !defined(PPP_PACKETS)
#error - PPP must use packets, chars, or both....
#endif

#ifndef SIGNAL_PPP_DEMUX
#define SignalPPPDemux()   /* define away to nothing */
#endif
 
#include "q.h"
#include "netbuf.h"
#include "net.h"
#include "comline.h"



extern struct queue  ppp_rcvdq;

#define  PPP_HDRLEN      4  /* LCP, IPCP headers */


/* PPP FSM Packet types */

#define  CONFREQ     1  /* Configuration Request */
#define  CONFACK     2  /* Configuration Ack */
#define  CONFNAK     3  /* Configuration Nak */
#define  CONFREJ     4  /* Configuration Reject */
#define  TERMREQ     5  /* Termination Request */
#define  TERMACK     6  /* Termination Ack */
#define  CODEREJ     7  /* Code Reject */
#define  PROTREJ     8  /* Protocol Reject */
#define  PECHOREQ    9  /* Echo Request */
#define  PECHOREP   10  /* Echo Reply */
#define  DISCREQ    11  /* Discard Request */
#define  IDENTITY   12  /* RFC-1570 - (was Keepalive) */


/* PPP FSM states */

#define	ST_INITIAL     0
#define  ST_STARTING    1
#define  ST_CLOSED      2
#define  ST_STOPPED     3
#define  ST_CLOSING     4
#define  ST_STOPPING    5
#define  ST_REQSENT     6
#define  ST_ACKRCVD     7
#define  ST_ACKSENT     8
#define  ST_OPENED      9


/* PPP FSM Events  */

#define  EV_UP     0    /* lower layer is Up    */
#define  EV_DOWN   1    /* lower layer is Down  */
#define  EV_OPEN   2    /* administrative Open  */
#define  EV_CLOSE  3    /* administrative Close */
#define  EV_TOP    4    /* Timeout with counter > 0 */
#define  EV_TOX    5    /* Timeout with counter expired  */
#define  EV_RCROK  6    /* Receive-Configure-Request (Good) */
#define  EV_RCRBAD 7    /* Receive-Configure-Request (Bad) */
#define  EV_RCA    8    /* Receive-Configure-Ack */
#define  EV_RCN    9    /* Receive-Configure-Nak/Rej */
#define  EV_RTR   10    /* Receive-Terminate-Request */
#define  EV_RTA   11    /* Receive-Terminate-Ack */
#define  EV_RUC   12    /* Receive-Unknown-Code */
#define  EV_RXJP  13    /* Receive-Reject-Permitted */
#define  EV_RXJC  14    /* Receive-Reject-Catastrophic  */
#define  EV_RXR   15    /* Receive-Echo-Request */

#define  NUM_PPPEVENTS  16

#define  EV_NOEVENT     99    /* For receiving malformed NAKs, etc. */


/* PPP FSM Actions */

#define AC_TLU     1    /* This-Layer-Up */
#define AC_TLD     2    /* This-Layer-Down */
#define AC_TLS     3    /* This-Layer-Started */
#define AC_TLF     4    /* This-Layer-Finished */
#define AC_IRC     5    /* Initialize-Restart-Count */
#define AC_ZRC     6    /* Zero-Restart-Count */
#define AC_SCR     7    /* Send-Configure-Request */
#define AC_SCA     8    /* Send-Configure-Ack */
#define AC_SCN     9    /* Send-Configure-Nak/Rej */
#define AC_STR    10    /* Send-Terminate-Request */
#define AC_STA    11    /* Send-Terminate-Ack */
#define AC_SCJ    12    /* Send-Code-Reject */
#define AC_SER    13    /* Send-Echo-Reply */

extern   unshort  fsm_table[160];

/* number of protocols supported, currently LCP and IPCP. Auth protocols
 * are handled as a special case between the two.
 */
#define  MAX_PPP_PROTS  2

#define  MAX_CILEN   128   /* max length of our confreq packets */

/* number retrys. First try is one second, it backs by doubling. */
#define  PPP_FSMTRYS 6;    /* default number of retrys */


#ifdef PPP_IDENTIFY        /* RFC1570 Identity option support */
#ifndef PPP_MAX_IDENTITY         /* Allow override from ppp_port.h */
#define PPP_MAX_IDENTITY   64    /* Max length of saved ID string */
#endif /* PPP_MAX_IDENTITY */
#endif /* PPP_IDENTIFY */

/* include the PPP protocol files we need */

struct m_ppp_link;   /* predeclare for include files */

typedef struct m_ppp_link * M_PPP;

#include "lcp.h"

#include "ipcp.h"

/* Authentication layer call tables */
typedef struct auth_callbacks
{
   void     (*auth_init)(M_PPP);
   void     (*auth_with_peer) (M_PPP);
   void     (*auth_peer) (M_PPP);
   void     (*auth_lowerup) (M_PPP);
   void     (*auth_lowerdown) (M_PPP);
   void     (*auth_input) (M_PPP, u_char *, int);
   void     (*auth_protocol_reject) (M_PPP);
} auth_funcs;

#ifdef PAP_SUPPORT
#include "upap.h"
#include "userpass.h"
#endif   /* PAP_SUPPORT */

#ifdef CHAP_SUPPORT
#include "chap.h"
#include "userpass.h"
#endif  /* CHAP_SUPPORT */

#ifdef PPP_VJC
#include "vjcomp.h"      /* for VJC control buffer */
#endif   /* PPP_VJC */

#ifdef PPP_MULTILINK
/* structure for managing ML fragment reassembly */
struct ml_reasm
{
   PACKET   pkt;        /* reassembly buffer for this fragment */
   u_long   lowseq;     /* lowest sequence number so far */
   u_long   highseq;    /* highest sequence number so far */
   u_long   tmo;        /* timeout */
   u_char   be_bits;    /* bits received so far */
};

#ifndef MAX_ML_FRAGS    /* allow override from ppp_port.h */
#define MAX_ML_FRAGS 3  /* simultaineous reassemblys per link */
#endif

/* ML Fragment header Begin/end bits */
#define MLF_BEGIN 0x80
#define MLF_END   0x40

#endif /* PPP_MULTILINK */


struct m_ppp_link
{
   struct m_ppp_link * next;        /* queue link */
   u_char   states[MAX_PPP_PROTS];  /* states of LCP, IPCP, etc */
   u_char   in_ids[MAX_PPP_PROTS];  /* last received Id of each prot */
   u_char   out_ids[MAX_PPP_PROTS]; /* last sent Id of each prot */
   queue    fastq;                  /* que for outgoing PPP packets */
   queue    dataq;                  /* que for outgoing data (IP) pkts */
   unshort  peer_mru;               /* Peer's negotiated mru */
   int      pppflags;               /* flags bitmask */
   int      retrys;                 /* retrys remaining */
   u_long   tmo_tick;               /* when to retry (ctick ) */
   void     (*tmo_func)(struct m_ppp_link *, long parm);
   long     tmo_parm;               /* parameter for timeout func */
   int      nakloops;               /* number of times we'll loop naking */
   int      tmr_sets;               /* number of timers set */
   int      tmr_replaced;           /* number of timers replaced */
   int      tmr_cleared;            /* number of timers canceled */
   int      tmr_fired;              /* number of timers execed */
   int      rxcode;                 /* last ctrl pkt op-code received */

   lcp_options    lcp_wantoptions;  /* bunch of options lists */
   lcp_options    lcp_gotoptions;
   lcp_options    lcp_hisoptions;
   ipcp_options   ipcp_wantoptions;
   ipcp_options   ipcp_gotoptions;
   ipcp_options   ipcp_hisoptions;

   /* statistics */
   int      cis_received[MAX_PPP_PROTS];  /* # Conf-Reqs received */
   int      naks_received[MAX_PPP_PROTS]; /* # Conf-NAKs received */
   int      rejs_received[MAX_PPP_PROTS]; /* # Conf-Rejects received */

   /* these next 4 dffer from the iface MIB in that they include
    * LCP, IPCP, authentication, etc.
    */
   long     bytes_in;
   long     bytes_out;
   long     pkts_in;
   long     pkts_out;

   int      bad_fcs;             /* bad received FCS (includes truncation) */
   int      io_errors;           /* send errors, nobufs, etc. */

   u_char   lastci[MAX_CILEN];   /* copy of last CONFREQ we sent */
   NET      ifp;                 /* back pointer to iface struct */
   char *   username;
   int      userlen;
   char *   password;
   int      pwlen;

   struct com_line   line;       /* line control for lower layer */

   u_long   his_asyncmap;        /* asyncmaps negotiated by LCP */
   u_long   my_asyncmap;
   int      sc_flags;
   auth_funcs * auth;            /* set when we Negotiate auth protocol */

#ifdef PPP_DHCP_CLIENT
   ip_addr  default_ip;          /* tmp DHCP storage for default IP address */
#endif   /* PPP_DHCP_CLIENT */

#ifdef PPP_IDENTIFY              /* RFC1570 Identity option support */
   char     identity[PPP_MAX_IDENTITY];   /* save his identity string */
#endif /* PPP_IDENTIFY */

#ifdef PPP_MULTILINK
   /* An mppp can function as a Multilink Bundle master (the sole IPCP
    * bundle member), one of many bundle LCP members,
    * or both. The mppp bundle linkages and options are below:
    */
   M_PPP    ml_ipcp;             /* pointer to bundle's IPCP link */
   M_PPP    ml_next;             /* (LCPs only) pointer to next bundle link */
   M_PPP    ml_links;            /* (IPCP only) pointer to links list */
   u_long   ml_txseq;            /* next send sequence number */
   unsigned ml_frag_size;        /* size at which we fragment pkts */
   unsigned ml_numlinks;         /* current number of links */
   struct multilink_bundle ml_conf; /*    bundle config info */
   struct ml_reasm reasms[MAX_ML_FRAGS]; /* fragment reassembly list */
   u_long   mf_rxfrags;          /* Total multilink fragments in */
   u_long   mf_txfrags;          /* Total multilink fragments sent */
   u_long   mf_errors;           /* multilink fragment errors */
   u_long   mf_drops;            /* multilink fragments dropped */
   u_long   mf_tmo;              /* reassemblys timed out */
#endif   /* PPP_MULTILINK */

#ifdef PPP_CHARIO

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -