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

📄 hdlc.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
*
*       HDLC.H                                                    2.4
*
*   COMPONENT
*
*       HDLC
*
*   DESCRIPTION
*
*       This file contains declarations and definitions used by HDLC.C.
*
*   DATA STRUCTURES
*
*       PPP_TEMP_BUFFER      - used to hold the serial packet size and ptr
*                              so the LISR can give it to the HISR.
*
*   DEPENDENCIES
*
*       None
*
****************************************************************************/

#ifndef HDLC_H
#define HDLC_H


#include "net/inc/nerrs.h"
#include "net/inc/net.h"
#include "net/inc/tcp_errs.h"
#include "ppp/urt_defs.h"
#include "ppp/urt_extr.h"
#include "ppp/inc/lcp_defs.h"


/* Define the sizes for the max TX/RX unit over the PPP link
   and the sizes of the headers and Fast Checksum Sequence (FCS). Note
   that this value strictly defines our max RX unit since it is used to
   declare the size of internal buffers. This value, though, can change
   during PPP negotiation for the max TX unit. So it is possible to have
   different RX and TX max values. NOTE: the minimum MTU is 1500. */
#define HDLC_MTU                        1500

#define PPP_MAX_PROTOCOL_SIZE           2
#define PPP_MAX_ADDR_CONTROL_SIZE       2
#define PPP_FCS_SIZE                    2
#define PPP_FCS_SIZE_BYTE2              2
#define PPP_FCS_SIZE_BYTE4              4  /* Not supported. Left for SNMP */

/* Sum the above up. This will be the size used to create the static
   arrays used by the PPP RX LISR to store the incoming bytes. */
#define PPP_RX_HEADER_SIZE              (PPP_FCS_SIZE_BYTE2 +       \
                                        PPP_MAX_PROTOCOL_SIZE +     \
                                        PPP_MAX_ADDR_CONTROL_SIZE)

#define PPP_MAX_RX_SIZE                 (HDLC_MTU + PPP_RX_HEADER_SIZE)

/* Size of the HISR Stack. */
#define PPP_HISR_STACK_SIZE             2000

/* PPP HDLC frame numbers */
#define PPP_HDLC_FRAME                  0x7e
#define PPP_HDLC_ADDRESS                0xff
#define PPP_HDLC_CONTROL                0x03
#define PPP_HDLC_CONTROL_ESCAPE         0x7d
#define PPP_HDLC_TRANSPARENCY           0x20
#define PPP_INIT_FCS16                  0xffff  /* Initial FCS value */
#define PPP_GOOD_FCS16                  0xf0b8  /* Good final FCS value */

#define PPP_MAX_ACCM                    32


/* Define the HDLC header */
typedef struct _hdlc_header
{
        UINT8   address;
        UINT8   control;
} HDLC_HEADER;


/* Structure used to hold the packet size and ptr so the LISR can give
   it to the HISR. */
typedef struct _ppp_temp_buffer
{
    struct _DV_DEVICE_ENTRY *device;
    UINT16                  size;
    UINT8                   buffer[PPP_MAX_RX_SIZE];
} PPP_TEMP_BUFFER;


STATUS          HDLC_Initialize(DV_DEVICE_ENTRY*);
STATUS          HDLC_TX_Packet (DV_DEVICE_ENTRY *, NET_BUFFER *);
STATUS          HDLC_RX_Packet (DV_DEVICE_ENTRY *);
VOID            HDLC_TX_HISR_Entry (VOID);
VOID            HDLC_RX_HISR_Entry (VOID);
UINT16          HDLC_Compute_TX_FCS (UINT16, NET_BUFFER *);
UINT16          HDLC_Compute_RX_FCS (UINT16, PPP_TEMP_BUFFER *);

extern STATUS   URT_Init_Port(DV_DEVICE_ENTRY*);

#endif







⌨️ 快捷键说明

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