📄 pppapi.h
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2001/12/14 11:51:35 $* $Source: M:/psisrc/ppp/incl/rcs/pppapi.h $* $Revision: 1.23 $*************************************************************************** File Description: PPP function prototypes etc. for applications* interfacing with Fusion PPP. Functions to* bringup and configure PPP etc.* ***************************************************************************/#ifndef _PPP_API_#define _PPP_API_#include "pppconst.h"extern int ppp_lcp_set_mru(char *devname, u16 mru );extern int ppp_lcp_set_options(char *devname, u16 flags );extern int ppp_lcp_get_options(char *devname, u16 *flags );extern int ppp_lcp_is_closed(char *devname);extern int ppp_ipcp_is_open(char *devname);extern int ppp_ipcp_set_options(char *devname, u16 flags );extern int ppp_ipcp_get_options(char *devname, u16 *flags );extern int ppp_set_max_restarts( char *devname, u8 maxconfigure, u8 maxfailure, u8 maxterminate );extern int ppp_set_restart_interval( char *devname, u8 interval_secs );extern int ppp_auth_infoset (char *devname, char *papname, char *password, char *chapid, char *secret);extern int ppp_ipcp_get_addresses( char *devname, u32 *myaddr, u32 *mymask, u32 *peeraddr, u32 *peermask );extern int ppp_ipcp_get_nameservers( char *devname, u32 *pridns, u32 *secdns, u32 *prinbns, u32 *secnbns );extern int ppp_set_server_mode(char *devname, int bServer );extern int ppp_ipcp_set_peer_addr( char *devname, u32 peeraddr );extern int ppp_ipcp_set_nameservers( char *devname, u32 pridns, u32 secdns, u32 prinbns, u32 secnbns );extern int ppp_lcp_set_async_map(char *devname, u32 map );extern int ppp_auth_del_user( const char *name );extern int ppp_auth_add_user( const char *name, const char *passwd, const char *ipaddr );extern int ppp_auth_init_address_pool( const char *baseipaddr );extern int ppp_chap_set_rechall_int(char *devname, u16 seconds );/* * PPP can inform an application of the events (state machine) transitions which * occur for various PPP layers and the overall PPP phase diagram. */typedef void (*ppp_event_callback_function)( char *devname, u8 event );extern void ppp_set_event_callback(ppp_event_callback_function callback);/* * For authentication with RADIUS etc. Call ppp_auth_register_agent with * the function which PPP should call with the username and secret received * from the PPP peer in order to obtain authentication of the peer. The * function can block if required (for example to send a RADIUS request * and wait for a response). When the response is received (or timeout * occurs) call one of either ppp_auth_success() or ppp_auth_fail(). These * must be called with the cookie supplied to the function registered by * ppp_auth_register_agent(cookie, username, password). The cookie identifies * the PPP session to Fusion PPP. * */typedef struct { char password[MAX_PPP_PSWD];}ppp_pap_auth_info;typedef struct { char resp_value[MAX_MD5_HASH]; /* CHAP response hash value - only MD5 supported at present. */ char chall_value[CHAP_CHALL_MAX_VAL_LEN]; /* CHAP challenge value */}ppp_chap_auth_info;typedef struct { u8 code; /* Reason callback is being invoked. See below */ void *cookie; void *session; u8 auth_type; /* PPP_AUTH_CHAP or PPP_AUTH_PAP */ u8 id; /* ID in the PAP auth request or CHAP auth response */ u16 session_id; /* ID of the PPP call to which this ppp_auth_info structure corresponds. Makes sure we can easily detect stale authentication responses from an external agent. */ char username[MAX_PPP_USER]; /* CHAP response username */ union { ppp_pap_auth_info pap_info; ppp_chap_auth_info chap_info; }info; u32 peer_ipaddr; /* Set to zero if using the IP address optionally set via ppp_ipcp_set_peer_addr. Otherwise, the IP address provided here (when ppp_auth_success is called) will be provided to the peer via IPCP unless of course IPCP_ACCEPT_REMOTE is enabled for the session. */ char *msg; /* String returned to peer in auth ack/nak */}ppp_auth_info, *ppp_auth_info_ptr;/* Values for the ppp_auth_info code field */#define PPP_AUTH_REQUEST 0x10 /* Indicates Fusion wants to authenticate the peer */#define PPP_AUTH_LOGOUT 0x11 /* Indicates a PPP session for an externally authenticated peer has terminated. */typedef void (*ppp_auth_callback)( ppp_auth_info_ptr );extern int ppp_auth_register_callback(ppp_auth_callback agent);extern int ppp_auth_success(ppp_auth_info_ptr p_auth_info);extern int ppp_auth_fail(ppp_auth_info_ptr p_auth_info);#define PPP_EVENT_DEAD_PHASE 1 /* Link has gone down - no more traffic */#define PPP_EVENT_ESTABLISH_PHASE 2 /* LCP is establishing link - negotiations in progress. */#define PPP_EVENT_AUTHENTICATE_PHASE 3 /* Link established, authentication is required and will begin. */#define PPP_EVENT_AUTHENTICATION_SUCCESS 4#define PPP_EVENT_AUTHENTICATION_FAIL 5#define PPP_EVENT_NETWORK_PHASE 6 /* Link established, authentication completed successfully (or no auth required). Link open for network layer traffic. */#define PPP_EVENT_TERMINATE_PHASE 7 /* Link is being closed. */#define PPP_EVENT_IPCP_LAYER_UP 8 /* IPCP layer is up */#define PPP_EVENT_IPCP_LAYER_DOWN 9 /* IPCP layer is down *//* Flags for the layer configuration API functions*//* LCP */#define LCP_REFUSE_PAP 0x0001 /* Refuse to authenticate myself with PAP */#define LCP_REFUSE_CHAP 0x0002 /* Refuse to authenticate myself with CHAP */#define LCP_REQUIRE_PAP 0x0004 /* Require peer to authenticate itself with PAP */#define LCP_REQUIRE_CHAP 0x0008 /* Require peer "" with CHAP */#define LCP_SILENT 0x0010 /* Do not transmit configure-request until we receive one from the peer. */#define LCP_NO_MAGIC 0x0020 /* Do not ask for and reject from peer the magic number option. */#define LCP_NO_PROT_COMP 0x0040 /* Disable protocol field compression in both direction. */#define LCP_NO_ACC_COMP 0x0080 /* Disable address/control field compression negotiation in both directions. */#define LCP_PERSIST 0x0100 /* When the ppp_linkdown event is signalled immediately try to reopen PPP, i.e., issue and OPEN event to LCP and also try to bring the modem back up. Most appropriate for dedicated lines and PPP servers. */#define LCP_REQUIRE_AUTH 0x0200 /* The peer must authenticate itself and we'll ask first for CHAP but if he naks with PAP we'll accept PAP. This is as opposed to LCP_REQUIRE_CHAP which insists on CHAP or LCP_REQUIRE_PAP which insists on PAP. Note that we will automagically set LCP_REQUIRE_AUTH if either REQUIRE_PAP or REQUIRE_CHAP is set. *//* IPCP */#define IPCP_ACCEPT_LOCAL 0x0001 /* Accept peer's idea of our IP address */#define IPCP_USE_PEER_DNS 0x0002 /* Ask for and accept peer's idea of our DNS and NBNS servers */#define IPCP_MS_DNS 0x0004 /* Supply the peer with DNS server addresses if asked */#define IPCP_MS_WINS 0x0008 /* Supply the peer with NBNS server addresses if asked */#define IPCP_ACCEPT_REMOTE 0x0010 /* Accept peer's idea of his IP address */#define IPCP_ACCEPT_DEF_GATEWAY 0x0020 /* Not only accept peer's idea of his IP address, but use it as a default gateway. */#define IPCP_NOVJ 0x0040 /* Disable VJ compression in both directions */#define IPCP_NOVJCCOMP 0x0080 /* Disable the connection-ID compression option for VJ compression. */typedef void* FNS_PPP_DEVICE; /* For eventual use with dynamically created interfaces. will be mapped to FNS_DEVICE or such. */extern int fns_ppp_register_driver ( char *device_name, void (*p_serial_init) (netdev * ndp), int (*p_serial_updown) (netdev * ndp, u16 flags, char * opt), void (*p_serial_write) (char *p_buffer, int length, netdev * ndp));#endif /* _PPP_API_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -