zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/cp/ps/modem/net/inc/ppp_api.h b/cp/ps/modem/net/inc/ppp_api.h
new file mode 100644
index 0000000..5db65b6
--- /dev/null
+++ b/cp/ps/modem/net/inc/ppp_api.h
@@ -0,0 +1,184 @@
+/**************************************************************************
+*
+* Copyright (c) 2012 ZTE Corporation.
+*
+***************************************************************************
+* Ä£ ¿é Ãû : P98C_PPP
+* ÎÄ ¼þ Ãû : ppp_api.h
+* Ïà¹ØÎļþ :
+* ʵÏÖ¹¦ÄÜ : pppÄ£¿é¶ÔÍâÍ·Îļþ
+* ×÷ Õß : zhangpeirong
+* °æ ±¾ : V1.0
+* Íê³ÉÈÕÆÚ : 2012-08-06
+* ÆäËü˵Ã÷ :
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ļǼ
+**************************************************************************/
+/**************************************************************************
+* Ð޸ıàºÅ : 0001
+* ÐÞ ¸Ä ÈË : zpr
+* ÐÞ¸ÄÈÕÆÚ : 2012-06-20
+* ÐÞ¸ÄÄÚÈÝ : EC:617001563315,PSBUFλÖøüÐÂ
+**************************************************************************/
+#ifndef _PPP_API_H
+#define _PPP_API_H
+
+/**************************************************************************
+* #includeÇø
+**************************************************************************/
+#include "oss_api.h"
+#include "psbuf.h"
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**************************************************************************
+* ³£Á¿¶¨ÒåÇø
+**************************************************************************/
+/* zPpp_Ctrl commands */
+#define ZPPP_CTRL_GET_PDP_TYPE 100 /* »ñÈ¡PPPÁ´Â·ÏÖÔÚÖ§³ÖPDP ÀàÐÍ */
+#define ZPPP_CTRL_SET_PDP_TYPE 101 /* ÉèÖÃPPPÁ´Â·ÏÖÔÚÖ§³ÖPDP ÀàÐÍ */
+#define ZPPP_CTRL_GET_MRU 102 /* »ñÈ¡pppÁ´Â·×î´óµÄ½ÓÊÕµ¥Ôª */
+#define ZPPP_CTRL_SET_MRU 103 /* ÉèÖÃpppÁ´Â·×î´óµÄ½ÓÊÕµ¥Ôª */
+#define ZPPP_CTRL_SET_PPPOE_INPUTPACKET_CB 104 /* ÉèÖÃPPPOE»Øµ÷ */
+#define ZPPP_CTRL_SET_ATI_IPADDRS_CB 105 /* ÉèÖõȴýATI·µ»ØIP µØÖ·¼°DNS»Øµ÷ */
+#define ZPPP_CTRL_SET_ATI_NOTREADY 106 /* ÉèÖÃÉèÖÃATI NOTREADY */
+#define ZPPP_CTRL_GET_AUTH_TYPE 107 /* »ñÈ¡PPPÁ´Â·ÏÖÔÚÐè½øÐеÄÈÏÖ¤ÀàÐÍ */
+#define ZPPP_CTRL_SET_AUTH_TYPE 108 /* ÉèÖÃPPPÁ´Â·ÏÖÔÚÐè½øÐеÄÈÏÖ¤ÀàÐÍ */
+
+/* Error codes */
+#define ZPPP_OPEN_SUCC 1 /* MBBÐèÇó£¬ppp ÐÉÌokºóµ½open̬֪ͨ */
+#define ZPPP_ERR_NONE 0 /* No error. */
+#define ZPPP_ERR_PARAM -1 /* Invalid parameter. */
+#define ZPPP_ERR_OPEN -2 /* Unable to open PPP session. */
+#define ZPPP_ERR_DEVICE -3 /* Invalid I/O device for PPP. */
+#define ZPPP_ERR_ALLOC -4 /* Unable to allocate resources. */
+#define ZPPP_ERR_USER -5 /* User interrupt. ´Ëʱ¿Í»§¶ËÏß³ÌÒ²»áÍ˳ö */
+#define ZPPP_ERR_CONNECT -6 /* Connection lost. */
+#define ZPPP_ERR_AUTHFAIL -7 /* Failed authentication challenge. */
+#define ZPPP_ERR_PROTOCOL -8 /* Failed to meet protocol. */
+#define ZPPP_ERR_RECVATEND -9 /* set errocode when receive ATH or +++. */
+#define ZPPP_ERR_EXITPPP -10 /* exit from ppp mode */
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+typedef struct
+{
+ SSIZE_T addr;
+}T_ZOss_IpAddr;
+
+typedef struct
+{
+ UINT32 addr[4];
+}T_ZOss_IPv6Addr;
+
+typedef enum
+{
+ TCPIP_ADDR_IPV4 = 0,
+ TCPIP_ADDR_IPV6
+}T_ZOss_IPType;
+
+typedef enum
+{
+ ZPPP_PPPOE_DOING, /* ÐÉÌ̬ */
+ ZPPP_PPPOE_SUCCESS, /* ÐÉÌÍê³É */
+ ZPPP_PPPOE_FAIL, /* ÐÉÌʧ°Ü */
+ ZPPP_PPPOE_IPPACKET, /* IP°ü»Ø´« */
+ ZPPP_PPPOE_UNKNOWPACKET_ERROR /* ²»Ê¶±ðµÄ°ü */
+}T_zPpp_PppoeStatus;
+
+typedef enum
+{
+ ZPPP_AUTH_NEED_NULL, /* ²»ÐèÒªÈÏÖ¤ */
+ ZPPP_AUTH_NEED_PAP, /* ÐèÒªPAPÈÏÖ¤ */
+ ZPPP_AUTH_NEED_CHAP /* ÐèÒªCHAPÈÏÖ¤ */
+}T_zPpp_AuthNeed;
+
+typedef enum
+{
+ ZPPP_PDP_ALL_SUPPORT, /* Ö§³ÖIPV4V6 */
+ ZPPP_PDP_IPV4_ONLY, /* ½öÖ§³ÖIPV4 */
+ ZPPP_PDP_IPV6_ONLY /* ½öÖ§³ÖIPV6 */
+}T_zPpp_PdpTypeSupport;
+
+/* PPP´®¿ÚÅäÖÃÏà¹Ø½á¹¹Ìå */
+typedef struct
+{
+ UINT32 sioFd; /* ´®¿Úfd */
+ SINT32 (*sioRead)(UINT32 fd, UINT8 *pBuf, UINT32 length); /* ´®¿Ú¶Áº¯Êý */
+ SINT32 (*sioWrite)(UINT32 fd, UINT8 *pBuf, UINT32 length); /* ´®¿Úдº¯Êý */
+ VOID (*sioReadUnblock)(UINT32 fd); /* ʹ´®¿Ú´Ó×èÈû̬ת»»³É·Ç×èÈû̬ */
+ VOID (*sioReadBlock)(UINT32 fd);
+ VOID (*sioPPPDisconnect)(UINT32 fd);
+ VOID (*sioPPPConnect)(UINT32 fd);
+ T_z_UpLink_Sdu* (*getUpLinkSdu)(VOID);
+ VOID (*freeUpLinkSdu)(T_z_UpLink_Sdu *pSdu);
+ T_z_DownLink_Sdu* (*getDownLinkSdu)(VOID);
+ VOID (*freeDownLinkSdu)(T_z_DownLink_Sdu *pSdu);
+}T_zPpp_Sio;
+
+/* PPP IPCPÐÉÌPCOÏà¹Ø½á¹¹Ìå */
+typedef struct
+{
+ UINT8 pdpType; /* 0x01-PPP * 0x21-IPv4 * 0x57-IPv6 */
+ T_ZOss_IpAddr ourIpAddr;
+ T_ZOss_IpAddr hisIpAddr;
+ T_ZOss_IpAddr snmask; /* ×ÓÍøÑÚÂë */
+ T_ZOss_IpAddr dns1;
+ T_ZOss_IpAddr dns2;
+ T_ZOss_IPv6Addr ipv6Addr; /* ½Ó¿ÚID64λ */
+ T_ZOss_IPv6Addr v6dns1; /* IPv6 DNS server addresses 1 */
+ T_ZOss_IPv6Addr v6dns2; /* IPv6 DNS server addresses 2 */
+}T_zPpp_IpAddrs;
+
+/* PPPÁ´Â·¿ØÖÆÏà¹Ø½á¹¹Ìå */
+typedef struct
+{
+ VOID (*PppLinkCtrl_CB)(UINT32 pppNum, VOID *linkStatusCtx, SINT32 error_code, VOID *arg);
+ VOID (*InputUpLinkData_CB)(UINT32 pppNum, T_z_UpLink_Sdu *ip_packet, SINT32 length, UINT8 channelId);
+ VOID (*InputUpLinkDataV6_CB)(UINT32 pppNum, T_z_UpLink_Sdu *ip_packet, SINT32 length, UINT8 channelId);
+ T_zPpp_IpAddrs *pIpAddrs;
+ UINT8 channelId;
+}T_zPpp_LinkCtrl;
+
+/* ¶¨Òå֪ͨ¹¤¾ß·µ»ØIP°ü»Øµ÷µÄº¯ÊýÀàÐÍ */
+typedef BOOL (*T_zPpp_OutputPacket_CB)(UINT32 pppNum, VOID *pPacket, UINT32 packetSize, UINT8 flag);
+
+/* ¶¨Òå֪ͨATI2¼¤»îpdp»á»° ²¢ÌîдIP DNS»Øµ÷µÄº¯ÊýÀàÐÍ */
+//typedef BOOL (*T_zPpp_GetIpAddrsFromAti2_CB)(UINT32 pppNum, VOID *addr, SINT32 length);
+
+//typedef BOOL (*T_zPpp_GetIpAddrsFromAti_CB)(UINT8 iChnelId, T_ZAti_SmIpDnsInfo *pAddr);
+
+/* ¶¨Òå֪ͨPPPOE·µ»ØLCPºÍNCPÐÉÌÏìÓ¦»Øµ÷µÄº¯ÊýÀàÐÍ */
+typedef SINT32 (*T_zPpp_InputPacketToPppoe_CB)(UINT32 pppNum, VOID *packet, SINT32 packetLen, T_zPpp_PppoeStatus status);
+
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+UINT32 zPpp_Init(VOID);
+UINT32 zPpp_Open(T_zPpp_Sio *pPppSio, T_zPpp_LinkCtrl *pPppCtrl, BOOL isPppoe);
+SINT32 zPpp_PcoAuth_AtRecv(UINT32 dev_fd, const UINT8 *data, UINT16 dataLen, UINT32 extData);
+UINT32 zPpp_Close(UINT32 pppNum);
+UINT32 zPpp_Start(UINT32 pppNum);
+UINT32 zPpp_WriteIp(UINT32 pppNum, const UINT8 *pIpPacket, SINT32 length);
+UINT32 zPpp_InputDataFromPppoe(UINT32 pppNum, T_z_UpLink_Sdu *pDestSduBuffer);
+UINT32 zPpp_Ctrl(UINT32 pppNum, SINT32 cmd, VOID *pArg);
+UINT32 zPpp_RegOutputPppPacketCb(T_zPpp_OutputPacket_CB recvFunc);
+
+/**************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷Çø
+**************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PPP_API_H */
+