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

📄 ppp_opts.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_OPTS.H                                          2.4
*
*   COMPONENT
*
*       PPP
*
*   DESCRIPTION
*
*       This file contains all configuration options used by PPP. These can
*       be modified in order to fit the specific needs of the applicaiton.
*       All constants that are prefixed HDLC_ affect only serial devices,
*       while constants prefixed with PPE_ affect only PPPoE devices. If
*       you do not have the optional Nucleus PPPoE library, you can ignore
*       all PPE_ constants.
*
*   DATA STRUCTURES
*
*       None
*
*   DEPENDENCIES
*
*       None
*
***************************************************************************/
#ifndef PPP_OPTS_H
#define PPP_OPTS_H

/* SECURITY WARNING: By default, the PPP-SEC-MIB (security mib) is not      */
/* included with PPP build. This is mainly due to the fact that RFC 1472    */
/* advices not to use this MIB in cases where you do not have SNMPv2        */
/* security support. Since our current snmp is v1, there is no additional   */
/* security and including this mib introduces a security risk to PPP        */
/* ATI recommends the customers not to use this MIB. Customers need to use  */
/* their own discretion on whether to use this mib or not.                  */
/* This Mib will be included only if INCLUDE_SNMP is defined to be NU_TRUE  */
#define INCLUDE_PPP_MIB NU_FALSE

#if (INCLUDE_PPP_MIB == NU_TRUE)
#define INCLUDE_PPP_SEC_MIB  NU_FALSE   /* Should be set to NU_TRUE to      */
#endif                                  /* include this PPP security MIB    */
                                        /* See security warning above       */

/* This defines the total length that a password and id can be */
#define PPP_MAX_ID_LENGTH               32
#define PPP_MAX_PW_LENGTH               32

/* Set the default timeout for link negotiation. If all phases of
   PPP link negotiation do not complete within this time the
   connection attempt will be aborted. */
#define PPP_DEFAULT_NEG_TIMEOUT         (45)    /* 45 secs */

/* Define this macro if polled transmission is desired. Otherwise
   interrupt driven transmission will be used. */
/* #define PPP_POLLED_TX */

/*********************** LCP Configuration *********************************/

/* These defines are for monitoring the modem link.

   LCP_MAX_ECHO
   is the number of times we will transmit an echo request without
   receiving a reply. After this value is reached the link will
   be considered to be closed.

   LCP_ECHO_VALUE
   is the time to wait between echo requests. This value is in clock
   ticks and is specific to the target hardware. A value that is too
   small will just conjest the network and slow the PPP link down. It also
   may not give enough time for the reply to come back, in which case the
   link will be considered to be closed even when it is not.
*/
#define LCP_MAX_ECHO                    2
#define LCP_ECHO_VALUE                  (TICKS_PER_SECOND * 60) /* 60 secs */

/* LCP default configuration values. */

/* This defines which ASCII characters, 0 through 32, will be affected
   by transparency. On some links there may be hardware devices that add
   characters or effect the control characters. This will ensure that the
   control characters are transparent to these devices and that if a device
   adds any characters they will be dropped. Each bit represents its
   coorosponding ASCII characters. By default all characters 0 - 32 are
   made transparent.
*/

/* This define is the default for the foreign end of the link. */
#define HDLC_FOREIGN_DEFAULT_ACCM        0xfffffffful

/* This define is for the local end of the link. */
#define HDLC_LOCAL_DEFAULT_ACCM          0xfffffffful

/* Will the above ACCM option be used?                 */
#define HDLC_USE_ACCM                    NU_TRUE

/* Will the max receive unit option be used? This options should
   only be used if the MRU is different from the default size of
   1500 bytes. */
#define HDLC_USE_MRU                     NU_FALSE
#define PPE_USE_MRU                      NU_TRUE

/* Will the magic number configuration option be used? */
#define HDLC_DEFAULT_MAGIC_NUMBER        NU_TRUE
#define PPE_DEFAULT_MAGIC_NUMBER         NU_TRUE

/* Will protocol field compression be used? */
#define HDLC_DEFAULT_PROTOCOL_COMPRESS   NU_FALSE

/* Will address and control field compression be used? */
#define HDLC_DEFAULT_ADDRESS_COMPRESS    NU_FALSE


/* This will be used when in SERVER mode. It will be the first
   authentication protocol that is tried with the CLIENT.

   0xc223 is for CHAP with MD5 encryption
   0xc023 is for PAP
*/
#define LCP_DEFAULT_AUTH_PROTOCOL       0xc023

/* The following defines are the number of times PPP will retransmit
   the packet.

   LCP_MAX_CONFIGURE    is for configure request packets, LCP and NCP.
   LCP_MAX_TERMINATE    is for terminate request packets.
   LCP_MAX_AUTHENTICATE is for authentication packets, PAP and CHAP.
*/
#define LCP_MAX_CONFIGURE               10
#define LCP_MAX_TERMINATE               3
#define LCP_MAX_AUTHENTICATE            3

/*  This timeout value is the time PPP will wait before retransmiting
    the above mentioned packet types. This value is in clock ticks
    an is specific to the target hardware.
*/
#define LCP_TIMEOUT_VALUE               (TICKS_PER_SECOND * 3) /* 3 secs */

/*************************** End LCP ***************************************/

/*********************** NCP Configuration *********************************/

/* When dialing into a PPP server it is possible to obtain DNS server
   addresses automatically. This macro defines the default setting for
   getting these addresses. Note that both primary and secondary addresses
   can be requested from the PPP server.
*/

/* Default for the primary addresss. */
#define NCP_DEFAULT_PRI_DNS            NU_TRUE

/* Default for the secondary address. */
#define NCP_DEFAULT_SEC_DNS            NU_TRUE

/* SNMP timer update the NCP state SNMP variable periodically */
#define IPCP_SNMP_TIMEOUT_VALUE         (TICKS_PER_SECOND * 3) /* 3 secs */

/*************************** End NCP ***************************************/

/*********************** PPP Configuration *********************************/

/* This defines the number of buffers in the LISR RX ring buffer. This
   ring buffer is used to hold packets that are being built or have been
   built and are waiting to be processed. This value should not be made
   too small or else packets may become overwritten within the buffer.
   Of course this value is highly dependant on the load placed on the CPU
   and the CPU's processing capabilities. Note that there are these many
   buffers for each UART being used.
*/
#define HDLC_MAX_HOLDING_PACKETS         3

/* This defines the number of pointers in a ring buffer used to pass
   completed packets from the RX LISR to the PPP HISR. These pointers
   point to the buffers mentioned above. The more UARTs that are being
   used the greater this value should be. Example: the above macro
   says that there will be 3 buffers for each UART. If two UARTs are being
   used then there will be 6 total RX buffers. There should be enough
   pointers to pass those buffers to the RX hisr.
*/
#define HDLC_MAX_HOLDING_PACKETS_PTR     6

/* After a packet has been completly transmitted the device that completed
   the tranmission is passed to the TX HISR. This is done so that the
   TX HISR can deallocated the buffers used by the packet and so it can
   send the next packet that is in queue, if there is one. This macro
   defines how many pointers are available to pass the device to the
   TX HISR.
*/
#define HDLC_MAX_TX_QUEUE_PTRS           6

/*************************** End PPP ***************************************/

/*********************** Modem Configuration *******************************/

/* The default number of rings before the phone is answered. To change this
   simply change the 2 to the number of rings that is required.

   The number of rings can also be changed during run time by the
   MDM_Rings_To_Answer() routine.
*/
#define     MDM_RINGS_TO_ANSWER_ON      2

/************************** End Modem **************************************/

/* These defines are used for debugging.

   NU_DEBUG_PPP    will turn on the printing of information about
                   link negotiation.

   _PRINT          will direct where to print the above information.

   DEBUG_PKT_TRACE will capture all packets sent and received. They
                   are stored in an array defined in PPP.C

   PKT_TRACE_SIZE  defines the size of the packets trace buffers. Note
                   that these are circular buffers.



#define NU_DEBUG_PPP

1)
You can direct the output to printf.


#define _PRINT printf

2)
Or you can use this method to send it to a memory buffer. You will
need to define the two variables below in your application or some
other source file for this to work. Also, this method will not work
for print statements that try to print varialbes. This is done in
two places in the PPP source code. You will need to comment out
those lines for this to compile. The files are MDM.C and NCP.C.
Search for _PRINT.

extern char  ppp_log[100][50];
extern char  pindex;

#define _PRINT(x)  sprintf(ppp_log[(pindex++ % 100)], x)


#define DEBUG_PKT_TRACE
#define PKT_TRACE_SIZE  10000

*/

#endif

⌨️ 快捷键说明

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