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

📄 lcp_defs.h

📁 PPP协议C语言源程序
💻 H
字号:
/***************************************************************************
*
*      Copyright (c) 1997 - 2001 by Accelerated Technology, Inc.
*
* PROPRIETARY RIGHTS of Accelerated Technology are involved in the subject
* matter of this material.  All manufacturing, reproduction, use and sales
* rights pertaining to this subject matter are governed by the license
* agreement.  The recipient of this software implicity accepts the terms
* of the license.
*
***************************************************************************/
/***************************************************************************
*
*   FILENAME                                                VERSION
*
*       LCP_DEFS.H                                          2.4
*
*   COMPONENT
*
*       LCP
*
*   DESCRIPTION
*
*       This file contains constant definitions and structure definitions
*       to support the file lcp.c
*
*   DATA STRUCTURES
*
*       lcp_opts_struct
*       lcp_packet_header_struct
*       lcp_layer
*
*   DEPENDENCIES
*
*       None
*
***************************************************************************/

#ifndef LCP_DEFS_H
#define LCP_DEFS_H

/* This macro defines the timeout used when waiting for LCP to conplete
   the close sequence and for the modem to hangup. */
#define LCP_LINK_CLOSE_TIMEOUT          (60 * SCK_Ticks_Per_Second)

#define LCP_MAX_DATA_SIZE               100
#define LCP_CLEAR_HIGH                  0x0000ffff
#define LCP_CONFIG_DONE                 12
#define LCP_CONFIG_SUCCESS              4
#define LCP_CONFIG_FAIL                 8
#define AUTHENTICATION_SUCCESS          16
#define AUTHENTICATION_DONE             24
#define NCP_CONFIG_DONE                 40
#define NCP_CONFIG_SUCCESS              32
#define PPP_NEG_TIMEOUT                 64

/* define basic packet lengths */
#define LCP_HEADER_LENGTH               4
#define LCP_MRU_LENGTH                  4
#define LCP_MAGIC_NUMBER_LENGTH         6
#define LCP_ACCM_LENGTH                 6
#define LCP_PROTOCOL_COMPRESS_LENGTH    2
#define LCP_ADDRESS_COMPRESS_LENGTH     2
#define LCP_CHAP_LENGTH                 5
#define LCP_PAP_LENGTH                  4

#define LCP_ACCM_VALUE_SIZE             4
#define LCP_MAGIC_NUMBER_VALUE_SIZE     4

/* Define offsets into the lcp pkt */
#define LCP_LENGTH_OFFSET               2
#define LCP_CODE_OFFSET                 0
#define LCP_ID_OFFSET                   1
#define LCP_DATA_OFFSET                 4
#define LCP_CONFIG_LENGTH_OFFSET        1
#define LCP_CONFIG_OPTS                 2

/* define the type of LCP packets */
#define LCP_CONFIGURE_REQUEST           1
#define LCP_CONFIGURE_ACK               2
#define LCP_CONFIGURE_NAK               3
#define LCP_CONFIGURE_REJECT            4
#define LCP_TERMINATE_REQUEST           5
#define LCP_TERMINATE_ACK               6
#define LCP_CODE_REJECT                 7
#define LCP_PROTOCOL_REJECT             8
#define LCP_ECHO_REQUEST                9
#define LCP_ECHO_REPLY                  10
#define LCP_DISCARD_REQUEST             11
#define LCP_CHAP_MD5                    5

/* LCP configuration option numbers */
#define LCP_MAX_RX_UNIT                 1
#define LCP_ASYNC_CONTROL_CHAR_MAP      2
#define LCP_AUTHENTICATION_PROTOCOL     3
#define LCP_QUALITY_PROTOCOL            4
#define LCP_MAGIC_NUMBER                5
#define LCP_PROTOCOL_FIELD_COMPRESS     7
#define LCP_ADDRESS_FIELD_COMPRESS      8

/* LCP options structure */
typedef struct _lcp_opts_struct
{
    UINT32  magic_number;
    UINT32  accm;                           /* async control char map */
    UINT16  max_rx_unit;                    /* max that we can rx     */
    UINT16  authentication_protocol;
    UINT8   protocol_field_compression;
    UINT8   address_field_compression;
    UINT8   use_accm;                       /* will the accm be used  */
    UINT8   use_max_rx_unit;                /* will the MRU be used   */
	UINT32  fcs_size;                       /* frame checksum size (2 or 4bytes)*/
	UINT16  Initial_max_rx_unit;            /* the value used when link starts*/
	UINT32  Initial_accm;                   /* the value used when link starts*/
	UINT32  Initial_magic_number;           /* set by snmp use/notuse magic  */
	UINT32  Initial_fcs_size;               /* frame checksum size (2 or 4bytes)*/
} LCP_OPTIONS;

/* define the lcp options to a Nucleus type for application use. */
typedef struct _lcp_opts_struct   NU_LCP_OPTIONS;

/* define the LCP packet structure */
typedef struct lcp_packet_header_struct
{
    UINT8   code;
    UINT8   identifier;
    UINT16  length;
    UINT8   data;
} LCP_HEADER;


/* define the possible LCP states */
#define INITIAL     0
#define STARTING    1
#define CLOSED      2
#define STOPPED     3
#define CLOSING     4
#define STOPPING    5
#define REQ_SENT    6
#define ACK_RCVD    7
#define ACK_SENT    8
#define OPENED      9

typedef struct _lcp_layer
{
    LCP_OPTIONS local_options;
    LCP_OPTIONS foreign_options;
    NET_BUFFER  *negotiation_pkt;
    NU_TIMER    restart_timer;
    NU_TIMER    echo_timer;
    UINT8       state;
    UINT8       identifier;
    INT8        num_transmissions;
    INT8        echo_counter;
} LCP_LAYER;


#endif

⌨️ 快捷键说明

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