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

📄 pppoe.h

📁 代码在ti的c67系列单片机上实现了完整的TCPIP协议栈
💻 H
字号:
//--------------------------------------------------------------------------
// Ip Stack
//--------------------------------------------------------------------------
// PPPOE.H
//
// Basic PPPOE Definitions
//
// Author: Michael A. Denio
// Copyright 2000 by Texas Instruments Inc.
//-------------------------------------------------------------------------

//----------------
// Ethernet Header
typedef struct {
                UINT8   DstMac[6];
                UINT8   SrcMac[6];
                UINT16  Type;
               } ETHHDR;
#define SIZE_ETHHDR     14

//-----------------------------------------------
// PPPOE Protocol Header
typedef struct {
                UINT8   VerType;
                UINT8   Code;
#define PPPOE_CODE_INITIATION   0x9
#define PPPOE_CODE_OFFER        0x7
#define PPPOE_CODE_REQUEST      0x19
#define PPPOE_CODE_CONFIRM      0x65
#define PPPOE_CODE_TERMINATE    0xa7
                UINT16  SessionId;
                UINT16  Length;
                UINT8   Data[1];
#define PPPOE_TAG_EOL           0
#define PPPOE_TAG_SNAME         0x0101
#define PPPOE_TAG_ACNAME        0x0102
#define PPPOE_TAG_ACCOOKIE      0x0104
#define PPPOE_TAG_SNAMEERROR    0x0201
#define PPPOE_TAG_ACNAMEERROR   0x0202
#define PPPOE_TAG_ERROR         0x0203
               } PPPOEHDR;
#define SIZE_PPPOEHDR   6


//-----------------------------------------------
// Shared Functions
extern void pppoeSI( HANDLE hSI, uint Msg, UINT32 Aux, HANDLE hPkt );

//-----------------------------------------------
// PPPOE Object Structures
//-----------------------------------------------

//-----------------------------------------------
// Max count for service list and max name length
#define PPPOE_NAMESIZE          32

// Generic Instance
typedef struct _pppoe_instance {
    HANDLE       hParent;                       // Parent structure
    uint         Status;                        // Call status
    uint         iType;                         // Instance TYPE
#define PPPOE_INST_SERVER       1
#define PPPOE_INST_CLIENT       2
    HANDLE       hEther;                        // Host Ethernet
    HANDLE       hLLADirect;                    // Our MAC address
    UINT16       SessionId;                     // Session Index
    HANDLE       hPPP;                          // PPP Interface
    UINT8        PeerMac[6];                    // Client's MAC address
    } PPPOE_INST;

// Server
typedef struct _pppoe_server {
    uint         Type;                          // Set to HTYPE_PPPOE_SERVER
    HANDLE       hTimer;                        // Session Timer
    HANDLE       hEther;                        // Ether Interface
    HANDLE       hLLADirect;                    // Our MAC address
    uint         pppFlags;                      // PPP Flags
    uint         SessionMax;                    // Max active sessions
    IPN          IPClientBase;                  // New client base IP address
    IPN          IPServer;                      // Our IP address
    IPN          IPMask;                        // Our IP mask
    INT8         ServerName[PPPOE_NAMESIZE];    // Our Server's Name
    INT8         ServiceName[PPPOE_NAMESIZE];   // Name of service provided
    PPPOE_INST   ppi[1];                        // Array of instances
    } PPPOE_SERVER;

// Client
typedef struct _pppoe_client {
    uint         Type;                          // Set to HTYPE_PPPOE_SERVER
    HANDLE       hTimer;                        // Session Timer
    uint         pppFlags;                      // PPP Flags
    INT8         Username[PPPOE_NAMESIZE];      // Specified Username
    INT8         Password[PPPOE_NAMESIZE];      // Specifies Password
    PPPOE_INST   ppi;                           // Our instance
    int          State;                         // Current state
    int          Timeout;                       // Timeout for this state
    int          Retry;                         // Retry count for timeout
    INT8         ServerName[PPPOE_NAMESIZE];    // Obtained from server
    INT8         ServiceName[PPPOE_NAMESIZE];   // Obtained from server
    uint         CookieSize;                    // Obtained from server
    UINT8        Cookie[PPPOE_NAMESIZE];        // Obtained from server
    } PPPOE_CLIENT;

⌨️ 快捷键说明

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