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

📄 ppp_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
*
*       PPP_DEFS.H                                          2.4
*
*   COMPONENT
*
*       PPP
*
*   DESCRIPTION
*
*       This file contains constant definitions and structure definitions
*       to support the file ppp.c
*
*   DATA STRUCTURES
*
*       PPP_TEMP_BUFFER
*       PPP_OCTET_ACCESS
*       PPP_HEADER
*       PPP_LAYER
*
*   DEPENDENCIES
*
*       None
*
***************************************************************************/

#ifndef PPP_DEFS_H
#define PPP_DEFS_H
#include "ppp/inc/ppp.h"
#include "ppp/urt_defs.h"

/* PPP interface types */
#define PPP_ITYPE_UART          0x00000001
#define PPP_ITYPE_MODEM         0x00000002
#define PPP_ITYPE_NULL_MODEM    0x00000004
#define PPP_ITYPE_PPPOE         0x00000008
#define PPP_ITYPE_ATM           0x00000010
#define PPP_ITYPE_BUFFER        0x00000020
#define PPP_ITYPE_VIRTUAL       0x00000040

/* PPP protocol numbers */
#define PPP_IP_PROTOCOL                 0x0021
#define PPP_IP_COMPRESS_PROTOCOL        0x21
#define PPP_IP_CONTROL_PROTOCOL         0x8021
#define PPP_LINK_CONTROL_PROTOCOL       0xc021
#define PPP_CHAP_PROTOCOL               0xc223
#define PPP_PAP_PROTOCOL                0xc023

#define NU_PPP_CHAP_PROTOCOL            0xc223
#define NU_PPP_PAP_PROTOCOL             0xc023

#define PPP_BIT_MASK                    0x00ff

/* Various defines used for PPP */
#define PPP_PROTOCOL_START              4
#define PPP_WITH_BOTH_COMPRESS_START    1
#define PPP_WITH_ADDR_COMPRESS_START    2
#define PPP_WITH_PROT_COMPRESS_START    3
#define PPP_ONE                         1
#define PPP_TWO                         2
#define PPP_COMPRESS_HEADER             1
#define PPP_COMPRESS_PROTOCOL_HEADER    3
#define PPP_COMPRESS_ADDRESS_HEADER     2
#define PPP_TIMER_THREAD                42

#define PPP_PROTOCOL_HEADER_1BYTE       1
#define PPP_PROTOCOL_HEADER_2BYTES      2

#define PPP_MTU                         1500

/* Define service completion status constants.  */
#define PPP_TRUE                        NU_TRUE
#define PPP_FALSE                       NU_FALSE
#define PPP_SUCCESS                     NU_SUCCESS
#define PPP_INVALID_POINTER             NU_INVALID_POINTER

/* Service parameters */
#define PPP_FORCE                       85
#define PPP_NO_FORCE                    58
#define NU_FORCE                        PPP_FORCE
#define NU_NO_FORCE                     PPP_NO_FORCE
#define NU_PPP_DIALING                  100
#define NU_PPP_WAITING                  101
#define NU_PPP_LINK_NEGOTIATION         102
#define NU_PPP_AUTHENTICATION           103
#define NU_PPP_NETWORK_NEGOTIATION      104
#define NU_PPP_CONNECTED                105
#define NU_PPP_DISCONNECTED             106
#define NU_PPP_HANGING_UP               107
#define NU_PPP_WAITING_ABORTED          108


/* The PPP error return codes are within the rage of -501 to -599 */
#define NU_LCP_FAILED                   -501
#define NU_NCP_FAILED                   -502
#define NU_LOGIN_FAILED                 -503
#define NU_NETWORK_BUSY                 -504
#define NU_INVALID_LINK                 -505
#define NU_NO_CONNECT                   -506
#define NU_NO_CARRIER                   -507
#define NU_BUSY                         -508
#define NU_INVALID_MODE                 -509
#define NU_NO_MODEM                     -510
#define NU_PPP_ATTEMPT_ABORTED          -511
#define NU_PPP_INIT_FAILURE             -512
#define NU_NEGOTIATION_TIMEOUT          -513
#define NU_PPP_INVALID_PROTOCOL			-514

/* The following Error codes are specific to the PPPoE module. */
#define NU_PPE_ERROR                    -525
#define NU_PPE_INVALID_PADx             -526


/* Structure used to access individual bytes of a variable that is two
   bytes long. */
typedef struct _octet_access
{
        UINT8 byte1;
        UINT8 byte2;
} PPP_OCTET_ACCESS;


/* Define the PPP layer structure. This will hold all information about
   the PPP link. This structure will be pointed to by the device
   structure for a particular physical device. */
typedef struct _ppp_layer
{
    UINT32                  itype;
    STATUS                  connection_status;
    DV_DEVICE_ENTRY         *dev_ptr;
    STATUS					(*init)(DV_DEVICE_ENTRY*);
    STATUS					(*passive)(DV_DEVICE_ENTRY*);
    STATUS					(*connect)(CHAR *number, DV_DEVICE_ENTRY *);
    STATUS					(*disconnect)(struct _ppp_layer*, UINT8);
	VOID					*link;
    URT_LAYER               uart;
    LCP_LAYER               lcp;
    AUTHENTICATION_LAYER    authentication;
    IPCP_LAYER              ipcp;
    NU_EVENT_GROUP          negotiation_progression;
    UINT16                  negotiation_timeout;
    UINT32		            last_activity_time;
    PPP_TEMP_BUFFER         rx_ring[HDLC_MAX_HOLDING_PACKETS];
    UINT16                  silent_discards;
    UINT16                  received;
    UINT8                   esc_received;
    UINT8                   rx_ring_write;
} PPP_LAYER, LINK_LAYER;


/* PPP Services */
#define NU_Dial_PPP_Server                  PPP_Dial
#define NU_Wait_For_PPP_Client              PPP_Wait_For_Client
#define NU_Set_PPP_Login                    PPP_Set_Login
#define NU_PPP_Still_Connected              PPP_Still_Connected
#define NU_PPP_Hangup                       PPP_Hangup
#define NU_Set_PPP_Client_IP_Address        NCP_Set_Client_IP_Address
#define NU_Set_PPP_Link_Options             PPP_Set_Link_Options
#define NU_Obtain_PPP_Connection_Status     PPP_Obtain_Connection_Status
#define NU_Abort_Wait_For_PPP_Client        PPP_Abort_Wait_For_Client
#define NU_PPP_Last_Activity_Time           PPP_Last_Activity_Time
#define NU_PPP_Negotiation_Timeout          PPP_Negotiation_Timeout

/* Define a macro to map one of the fields in the device structure to
   a name for PPP to use. */
#define link_layer  dev_ppp_layer
#define ppp_layer   dev_ppp_layer


#endif

⌨️ 快捷键说明

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