| /************************************************************* |
| * |
| * This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc. |
| * |
| * Any unauthorized use inconsistent with the terms of such license is strictly prohibited. |
| * |
| * Copyright (c) 2002-2010 VIA Telecom, Inc. All rights reserved. |
| * |
| *************************************************************/ |
| /************************************************************************* |
| * |
| * File Name: pppapi.h |
| * Project: PPP |
| * |
| * Original Author: Steve Pye |
| * Creation Date: |
| * |
| * Description: Header File for the PPP Application Programming Interface |
| * Restrictions: |
| * Dependencies: |
| * |
| ************************************************************************* |
| * |
| * This Software is the property of ISOTEL Research Ltd. |
| * Unauthorized use is prohibited. |
| * |
| * ISOTEL Research Ltd. |
| * Suite 340, 525 - 28th Street S.E. |
| * Calgary, Alberta, Canada T2A 6W9 |
| * Tel: (403)275-0041 Fax: (403)274-3598 |
| * |
| * |
| ************************************************************************* |
| * |
| * RCS Log Information |
| * |
| * removed! |
| * |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * removed! |
| * |
| * removed! |
| * removed! |
| * |
| * |
| ************************************************************************/ |
| |
| #ifndef _PPPAPI_H_ |
| #define _PPPAPI_H_ 1 |
| |
| /* Standard type definitions */ |
| #include "7074CUST.H" |
| #include "IP_PROC.H" |
| |
| #ifdef SYS_OPTION_DATA_RAM_INUSE |
| #define PPP_NPORTS 4 |
| #else |
| #define PPP_NPORTS 1 |
| #endif |
| |
| |
| #ifdef SYS_OPTION_DATA_RAM_INUSE |
| #define PPP_DATASIZE 1500 |
| #else |
| #define PPP_DATASIZE 1 |
| #endif |
| |
| /* Macros to store a 16-bit integer LS byte first */ |
| #if ( HOST_ENDIAN == BIG_ENDIAN ) |
| #define LSBYTE_FIRST(i) (kal_uint16)( (((kal_uint16)(i) << 8) & 0xff00)| \ |
| (((kal_uint16)(i) >> 8) & 0x00ff) \ |
| ) |
| |
| #define LSBYTE_FIRST_32(i) (kal_uint32)( (((kal_uint32)(i) << 24) & 0xff000000)| \ |
| (((kal_uint32)(i) << 8) & 0x00ff0000)| \ |
| (((kal_uint32)(i) >> 8) & 0x0000ff00)| \ |
| (((kal_uint32)(i) >> 24) & 0x000000ff) \ |
| ) |
| #else /* HOST_ENDIAN = LITTLE_ENDIAN */ |
| #define LSBYTE_FIRST(i) (kal_uint16)(i) |
| #define LSBYTE_FIRST_32(i) (kal_uint32)(i) |
| #endif /* HOST_ENDIAN */ |
| |
| /* IE_xxx Status Codes -- others may be already defined elsewhere! */ |
| /* #define IE_SUCCESS 0 */ /* Let user_api.h define it. */ |
| |
| #define IE_NOMOREPORTS 100 |
| #define IE_OPENPORTFAIL 101 |
| #define IE_INVALIDPPPPORT 102 |
| #define IE_PORTNOTOPEN 103 |
| #define IE_INVALIDEVENT 104 |
| #define IE_INVALIDTIMER 105 |
| #define IE_INVALID_AUTHPROT 106 |
| |
| #define IE_RESTARTTIMER 110 |
| #define IE_MAXTERMINATE 111 |
| #define IE_MAXCONFIGURE 112 |
| #define IE_MAXFAILURE 113 |
| #define IE_BUFFERSIZE 114 |
| #define IE_NUMSLOTS 115 |
| #define IE_AUTHRETRYTIMER 116 |
| #define IE_AUTHMAXTRIES 117 |
| |
| #define IE_NORXBUFFER 120 |
| #define IE_RXBUFFERFULL 121 |
| #define IE_NORXDATA 122 |
| #define IE_SENDINPROGRESS 123 |
| |
| /* PPP/LCP Protocol Numbers */ |
| #define PRO_IP 0x0021 /* Internet Protocol */ |
| #define PRO_IPV6 0x0057 /* Internet Protocol Version 6 */ |
| #define PRO_TCPIP_VJ 0x002d /* Van Jacobson Compressed TCP/IP */ |
| #define PRO_TCPIP_UC 0x002f /* Uncompressed TCP/IP */ |
| |
| #define PRO_IPCP 0x8021 /* NCP: IP Control Protocol */ |
| #define PRO_IPV6CP 0x8057 /* NCP: IPV6 Control Protocol */ |
| #define PRO_CCP 0x80fd /* Compression Control Protocol */ |
| |
| #define PRO_LCP 0xc021 /* Link Control Protocol */ |
| #define PRO_PAP 0xc023 /* Password Authentication */ |
| #define PRO_LQR 0xc025 /* Link Quality Report */ |
| #define PRO_CHAP 0xc223 /* Challenge Handshake Authentication */ |
| #ifdef CBP7_EHRPD |
| #define PRO_EAP 0xc227 /* Extensible Authentication Protocol */ |
| #endif |
| |
| #define PRO_MNRP 0x4003 /* MNRP CDPD registration protocol */ |
| #define PRO_VSNCP 0x805b /* Vendor-Specific Net Ctrl Protocol */ |
| #define PRO_VSNP 0x005b /* Vendor-Specific Network Protocol */ |
| #define PRO_IPV6 0x0057 /* IPv6 over PPP */ |
| #define PRO_CDP 0x8207 /* Cisco Discovery Protocol Control */ |
| |
| |
| /* PPP Configuration Vector */ |
| typedef struct config |
| { |
| /* PPP-LCP Parameters */ |
| kal_uint16 restart; /* restart timer */ |
| kal_uint16 mconfigs; /* max LCP Configure-REQ */ |
| kal_uint16 mterms; /* max LCP Terminate-REQ */ |
| kal_uint16 mfails; /* max LCP Configure-NAK */ |
| kal_uint16 termRestart; /* termination timer */ |
| |
| /* PPP-NCP Parameters */ |
| kal_uint16 ncpRestart; /* restart timer */ |
| kal_uint16 ncpMconfigs; /* max NCP Configure-REQ */ |
| kal_uint16 ncpMterms; /* max NCP Terminate-REQ */ |
| kal_uint16 ncpMfails; /* max NCP Configure-NAK */ |
| kal_uint16 ncpTermRestart; /* termination timer */ |
| |
| /* LCP Options */ |
| kal_uint32 accm; /* Async Control-Character Map */ |
| kal_bool UseQual; /* Use Link Quality Reporting? */ |
| kal_bool UseMagic; /* Use Magic-Number? */ |
| kal_bool UsePcomp; /* Use Protocol Compression? */ |
| kal_bool UseAcomp; /* Use Address/Control Compression? */ |
| |
| /* Authentication Options */ |
| char* userName; /* User Name */ |
| char* password; /* PAP:password, CHAP:secret */ |
| kal_uint8 lenPassword; |
| kal_uint16 authRetryTimer; /* Auth-Rqst/Challenge retry timer */ |
| kal_uint16 authMaxTries; /* Auth-Rqst/Challenge max tries */ |
| |
| /* LQR Options */ |
| kal_uint16 LqrPeriod; /* LQR Reporting Period (sec) */ |
| |
| /* NCP (IPCP) Options */ |
| kal_uint32 LocIPAddr; /* IP Address: Local */ |
| kal_uint32 RmtIPAddr; /* IP Address: Remote (peer) */ |
| kal_uint32 PriDNSAddr; /* IP Address: Primary DNS Server */ |
| kal_uint32 SecDNSAddr; /* IP Address: Secondary DNS Server */ |
| kal_bool txUseVJC; /* Van Jacobson Compression (peer) */ |
| kal_bool rxUseVJC; /* Van Jacobson Compression */ |
| kal_uint8 NumSlots; /* Number of Slots */ |
| kal_bool UseScomp; /* Use Slot ID Compression? */ |
| kal_bool UseDNSPri; /* Use DNS Primary? */ |
| kal_bool UseDNSSec; /* Use DNS Secondary? */ |
| |
| /* Peer's options available to Network App */ |
| kal_uint16 PeerMRU; /* The peer's Maximum Receive Unit */ |
| } CONFIG; |
| |
| /* Defaults for Configuration Vector */ |
| #define DEFL_LOCAL_RM_IP 0x0a000001 |
| #define DEFL_REMOTE_RM_IP 0x0a000070 |
| |
| |
| #ifdef CBP7_EHRPD |
| #define DFLT_RESTART_EHRPD 2000 |
| #endif |
| |
| #define DFLT_RESTART 3000 |
| #define DFLT_MCONFIGS 10 |
| #define DFLT_MFAILS 10 |
| #define DFLT_MTERMS 2 |
| #define DFLT_TERM_TMO 3000 |
| #define DFLT_NCP_RESTART 3000 |
| #define DFLT_NCP_MCONFIGS 10 |
| #define DFLT_NCP_MFAILS 10 |
| #define DFLT_NCP_MTERMS 2 |
| #define DFLT_NCP_TERM_TMO 3000 |
| #define DFLT_MCONFIGS_SHORT 3 |
| |
| #define DFLT_ACCM 0xffffffffL |
| #define DFLT_USELQR KAL_FALSE |
| #define DFLT_LQRPERIOD 120 |
| #ifdef MTK_PLT_ON_PC_UT |
| #define DFLT_USEMAGIC KAL_FALSE |
| #else |
| #define DFLT_USEMAGIC KAL_TRUE /* for India */ |
| #endif |
| #define DFLT_PCOMP KAL_FALSE |
| #define DFLT_ACOMP KAL_FALSE |
| |
| #define DFLT_AUTH_TIMER 3000 |
| #define DFLT_AUTH_MAXTRIES 5 |
| |
| #define DFLT_IPADDRESS 0x00000000L |
| #define DFLT_NUMSLOTS 16 |
| #define DFLT_COMPSLOTID KAL_FALSE |
| #define DFLT_DNSPRI KAL_TRUE |
| #define DFLT_DNSSEC KAL_TRUE |
| |
| /* Maximum values for Configuration Vector */ |
| #define MAX_RESTART 10000 |
| #define MAX_MCONFIGS 20 |
| #define MAX_MTERMS 5 |
| #define MAX_MFAILS 20 |
| |
| /* Max/Min values for Configuration Vector */ |
| #define MAX_NUMSLOTS DFLT_NUMSLOTS |
| #define MIN_NUMSLOTS 2 |
| #if (MAX_NUMSLOTS < MIN_NUMSLOTS) |
| #error [pppapi.h] MAX_NUMSLOTS < MIN_NUMSLOTS |
| #endif |
| |
| /* Counter structure used for Link Quality Reporting (LQR) */ |
| typedef struct lqr_counts |
| { |
| kal_uint32 LastOutLQRs; |
| kal_uint32 LastOutPackets; |
| kal_uint32 LastOutOctets; |
| kal_uint32 PeerInLQRs; |
| kal_uint32 PeerInPackets; |
| kal_uint32 PeerInDiscards; |
| kal_uint32 PeerInErrors; |
| kal_uint32 PeerInOctets; |
| kal_uint32 PeerOutLQRs; |
| kal_uint32 PeerOutPackets; |
| kal_uint32 PeerOutOctets; |
| |
| } LQR_COUNTS; |
| |
| #define NUM_LQR_COUNTS ( sizeof(LQR_COUNTS) / sizeof(kal_uint32) ) |
| |
| /* LQR counters "logically appended" by PPP to a received LQR packet */ |
| typedef struct lqr_appends |
| { |
| kal_uint32 SaveInLQRs; |
| kal_uint32 SaveInPackets; |
| kal_uint32 SaveInDiscards; |
| kal_uint32 SaveInErrors; |
| kal_uint32 SaveInOctets; |
| |
| } LQR_APPENDS; |
| |
| #define NUM_LQR_APPENDS ( sizeof(LQR_APPENDS) / sizeof(kal_uint32) ) |
| |
| /* LQR Rx Packet data format (as delivered by PPP) */ |
| typedef struct lqr_rxdata |
| { |
| /* LQR fields received from the peer */ |
| LQR_COUNTS counts; |
| |
| /* LQR fields "logically appended" by PPP to received LQR data */ |
| LQR_APPENDS appends; |
| |
| } LQR_RXDATA; |
| |
| /* PPP Connection Communication Statistics */ |
| typedef struct ppp_stats |
| { |
| kal_uint32 packets_sent; |
| kal_uint32 bytes_sent; |
| kal_uint32 packets_rcvd; |
| kal_uint32 bytes_rcvd; |
| kal_uint32 packets_dropped; |
| kal_uint32 overrun_errors; |
| kal_uint32 recvfcs_errors; |
| kal_uint32 lqrpackets_sent; |
| |
| } PPP_STATS; |
| |
| /* LCP Statistics */ |
| typedef struct lcp_stats |
| { |
| kal_uint32 illegal_ups; |
| kal_uint32 illegal_downs; |
| |
| } LCP_STATS; |
| |
| /* PPP Event types -> NET */ |
| enum netEvents |
| { |
| PPE_ILLEGAL = 0, /* Illegal Event occurred */ |
| PPE_LOOPBACK, /* Connection is looped back to itself */ |
| |
| PPE_CONNECT_LCP, /* Connect -> Can carry traffic */ |
| PPE_CONNECT_IPCP, /* Connect -> Can carry IP traffic */ |
| PPE_DISCONNECT, /* Disconnect -> Link Dead */ |
| |
| PPE_RXDATA, /* Datagram Received */ |
| PPE_SENDCOMPLETE, /* Datagram Send Completed */ |
| |
| /* This one must always be last! */ |
| netNUMEVENTS |
| }; |
| |
| /* PPP Internal Event types -> Link Manager */ |
| enum pEvents |
| { |
| pNONE = 0, /* Switch-Kicker */ |
| |
| pUP, /* Up */ |
| pDOWN, /* Down */ |
| pOPEN, /* Open */ |
| pCLOSE, /* Close */ |
| pTIMEOUT, /* TO+, TO- */ |
| |
| pSENDDATA, /* Send Data */ |
| |
| /* COM Layer -> Link Manager */ |
| pCOMUP, /* COM Layer Up */ |
| pCOMDOWN, /* COM Layer Down */ |
| pRXPACKET, /* Received Raw HDLC Packet */ |
| pTXDONE, /* Transmit Complete */ |
| |
| /* LCP -> Link Manager */ |
| pTLU, /* This Layer Up */ |
| pTLD, /* This Layer Down */ |
| |
| /* SYS -> AUTH */ |
| pREMOTE_AUTH_TMO, /* Peer: PAP Auth-Request retry or |
| * CHAP Response-Retry timeout */ |
| pLOCAL_AUTH_TMO, /* Auth: CHAP Challenge retry timeout */ |
| |
| /* AUTH -> Link Manager */ |
| pAUTH_DONE, /* All Authentication complete */ |
| |
| /* SYS -> MNRP */ |
| pMNRP_TMO, /* MNRP timeout of configuration timer */ |
| pMNRP_DONE, /* MNRP finished registration */ |
| |
| #ifdef PPP_RECONNECT |
| pREOPEN, /* ppp Re-Open */ |
| #endif |
| |
| pDORMANT_RECONNECT, |
| /* This one must be last! */ |
| pNUMEVENTS |
| }; |
| |
| /* NET-to-PPP Function Prototypes */ |
| kal_uint16 PPP_Initialize(void); |
| kal_uint16 PPP_Open (kal_uint8 appType, kal_uint8 *buffer, kal_uint16 buflen, kal_uint16 *port, kal_uint16 authProt, kal_bool mnrp); |
| kal_uint16 PPP_GetConfig(kal_uint16 port, CONFIG *r); |
| kal_uint16 PPP_SetConfig(kal_uint16 port, CONFIG *r); |
| kal_uint16 PPP_Connect(kal_uint16 port); |
| kal_uint16 PPP_Send(kal_uint16 port, kal_uint16 prot, kal_uint8 *data, kal_uint16 len, kal_uint8 PdnId); |
| kal_uint16 PPP_Receive(kal_uint16 port, kal_uint16 *prot, kal_uint8 **data, kal_uint16 *len, |
| kal_bool copy); |
| kal_uint16 PPP_Disconnect(kal_uint16 port); |
| kal_uint16 PPP_Close(kal_uint16 port); |
| kal_uint16 PPP_Init(kal_uint16 port); |
| kal_uint16 PPP_GetStatus(kal_uint16 port, PPP_STATS *status); |
| |
| #ifdef PPP_RECONNECT |
| kal_uint16 PPP_ReConnect(kal_uint16 port); |
| #endif |
| |
| /* PPP-to-PPP Function Prototypes */ |
| void PPP_Timeout(hlp_timer_enum timer_id); |
| kal_uint16 PPP_PostEvent(kal_uint16 port, kal_uint8 type); |
| void PPP_SetState(kal_uint16 port, kal_uint8 state); |
| |
| /* PPP-to-NET Function Prototypes */ |
| void PPP_SendNetEvent(kal_uint16 port, kal_uint8 type); |
| |
| /* Interface between Browser and Async for supporting Browser_on_Async mode */ |
| void Browser_Close_Async(kal_bool graceful); |
| |
| #endif /* _PPPAPI_H_ */ |
| |