zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/cp/ps/modem/net/inc/dhcp_api.h b/cp/ps/modem/net/inc/dhcp_api.h
new file mode 100644
index 0000000..d655051
--- /dev/null
+++ b/cp/ps/modem/net/inc/dhcp_api.h
@@ -0,0 +1,115 @@
+/**************************************************************************
+*
+* Copyright (c) 2012 ZTE Corporation.
+*
+***************************************************************************
+* Ä£ ¿é Ãû : P98D_DHCP
+* ÎÄ ¼þ Ãû : dhcp_api.h
+* Ïà¹ØÎļþ :
+* ʵÏÖ¹¦ÄÜ : dhcpÄ£¿é½Ó¿Ú·â×°
+* ×÷ Õß : LiuZhengXuan
+* °æ ±¾ : V1.0
+* Íê³ÉÈÕÆÚ : 2012-08-14
+* ÆäËü˵Ã÷ :
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ļǼ
+**************************************************************************/
+#ifndef _DHCP_API_H
+#define _DHCP_API_H
+
+/**************************************************************************
+* #includeÇø
+**************************************************************************/
+#include "oss_api.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**************************************************************************
+* ³£Á¿¶¨ÒåÇø
+**************************************************************************/
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+typedef struct
+{
+ UINT32 addr;
+}T_zDhcp_IPv4Addr;
+
+typedef struct
+{
+ UINT32 addr[4];
+}T_zDhcp_IPv6Addr;
+
+typedef union
+{
+ T_zDhcp_IPv4Addr v4Addr;
+ T_zDhcp_IPv6Addr v6Addr;
+}T_zDhcp_IPAddr;
+typedef struct
+{
+ UINT8 pdpType; /* IPv4-0x21 IPv6-0x57 IPv4v6-0x8d */
+ T_zDhcp_IPv4Addr ipv4Addr; /* Íø²àÉϱ¨µÄipv4µØÖ· */
+ T_zDhcp_IPv4Addr routerIp; /* Íø¹ØipµØÖ· */
+ T_zDhcp_IPv4Addr snMask; /* ×ÓÍøÑÚÂë */
+ T_zDhcp_IPv4Addr v4Dns1; /* IPv4 DNS server addresses 1 */
+ T_zDhcp_IPv4Addr v4Dns2; /* IPv4 DNS server addresses 2 */
+ T_zDhcp_IPv6Addr ipv6Addr; /* Íø²àÉϱ¨µÄipv6µØÖ·,µ±Ç°Ö»Éϱ¨ÁË8×Ö½ÚµÄID */
+ T_zDhcp_IPv6Addr v6Dns1; /* IPv6 DNS server addresses 1 */
+ T_zDhcp_IPv6Addr v6Dns2; /* IPv6 DNS server addresses 2 */
+}T_zDhcp_PdpCfgInf; /* PDP¼¤»î»ñÈ¡µÄÉÏÏÂÎÄÐÅÏ¢½á¹¹ */
+
+typedef enum
+{
+ DHCP_FRAMETYPE_IP_V4_TRANS = 0, /* IPv4ÏòÍâÍø´«ÊäÊý¾Ý */
+ DHCP_FRAMETYPE_IP_V6_TRANS, /* IPv6ÏòÍâÍø´«ÊäÊý¾Ý */
+ DHCP_FRAMETYPE_IP_V4_DHCP_RSP, /* IPv4µÄDHCPÓ¦´ðÊý¾Ý */
+ DHCP_FRAMETYPE_IP_V6_DHCP_RSP, /* IPv6µÄDHCPÓ¦´ðÊý¾Ý */
+ DHCP_FRAMETYPE_ARP_RSP, /* ARPÓ¦´ðÊý¾Ý */
+ DHCP_FRAMETYPE_NDP_RSP, /* NDPÓ¦´ðÊý¾Ý */
+ DHCP_FRAMETYPE_INVALID /* ÎÞЧÊý¾Ý */
+}T_zDhcp_FrameType; /* ¶ÁÈ¡Çý¶¯Êý¾ÝÖ¡ÀàÐÍ */
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+VOID zDhcp_Init(VOID);
+UINT32 zDhcp_OpenSvr(const T_zDhcp_PdpCfgInf *pPdpCfgInf);
+T_zDhcp_FrameType zDhcp_ParseEtherFrame(UINT32 handle, const UINT8 *pEtherFrame, UINT16 etherFrameSize, BOOL *pIsRecvRs);
+UINT16 zDhcp_GetRspEtherFrame(UINT32 handle,
+ UINT8 *pReqEtherFrame,
+ UINT16 reqEtherFrameSize,
+ UINT8 *pRspEtherFrameBuf,
+ UINT16 rspEtherFrameBufSize,
+ BOOL *pIsDhcpOver);
+UINT16 zDhcp_GetRspArpFrame(UINT32 handle, UINT8 *pReqEtherFrame, UINT16 reqSize, UINT8 *pRspEtherFrame, UINT16 rspSize, UINT32 addr);
+UINT32 zDhcp_GetCfgInfV4addr(UINT32 handle);
+BOOL zDhcp_FillEtherFrame(UINT32 handle, UINT8 *pEtherFrame, UINT16 etherFrameSize, BOOL *pIsRecvRa);
+VOID zDhcp_CloseSvr(UINT32 handle);
+VOID zDhcp_UnInit(VOID);
+
+BOOL zDhcp_StartUfi(VOID);
+BOOL zDhcp_RecycleUfiIp(T_zDhcp_IPv4Addr *pIpv4AddrRemoved, T_zDhcp_IPv6Addr *pIpv6AddrRemoved, BOOL isIpv4Addr);
+BOOL zDhcp_StaticSetUfiIpv4(UINT8 *pMacAddr, T_zDhcp_IPv4Addr *pSetIpv4Addr);
+VOID zDhcp_StopUfi(VOID);
+
+UINT32 zDhcp_GetSrcIpPortType(UINT8 *pPacket, T_zDhcp_IPAddr *pIpAddr, UINT16 *pPort, UINT16 *pPdpType);
+UINT32 zDhcp_GetDestIpPortType(UINT8 *pPacket, T_zDhcp_IPAddr *pIpAddr, UINT16 *pPort, UINT16 *pPdpType);
+UINT32 zDhcp_UpdatePacketSrcIpv4(UINT8 *pPacket, T_zDhcp_IPv4Addr *pIpAddr);
+UINT32 zDhcp_UpdatePacketDestIpv4(UINT8 *pPacket, T_zDhcp_IPv4Addr *pIpAddr);
+BOOL zDhcp_IsDnsPacket(UINT8 *pPacket);
+/**************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷Çø
+**************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DHCP_API_H */
+
diff --git a/cp/ps/modem/net/inc/net_api.h b/cp/ps/modem/net/inc/net_api.h
new file mode 100644
index 0000000..a1d883e
--- /dev/null
+++ b/cp/ps/modem/net/inc/net_api.h
@@ -0,0 +1,54 @@
+/**************************************************************************
+*
+* Copyright (c) 2012 ZTE Corporation.
+*
+***************************************************************************
+* Ä£ ¿é Ãû : P98C_NET
+* ÎÄ ¼þ Ãû : net_api.h
+* Ïà¹ØÎļþ :
+* ʵÏÖ¹¦ÄÜ : netÄ£¿é¶ÔÍâÍ·Îļþ
+* ×÷ Õß :
+* °æ ±¾ : V1.0
+* Íê³ÉÈÕÆÚ : 2012-08-10
+* ÆäËü˵Ã÷ : net_XXX.h »ù±¾ÀàÐÍ¡¢Ä£¿éºÅ¡¢´íÎóºÅ¡¢Ê¼þºÅ¶¨Òå
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ļǼ
+**************************************************************************/
+#ifndef _NET_API_H
+#define _NET_API_H
+
+/**************************************************************************
+* #includeÇø
+**************************************************************************/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**************************************************************************
+* ³£Á¿¶¨ÒåÇø
+**************************************************************************/
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+VOID zPPP_GetMd5Hash(CHAR id, CHAR* secret, UINT8 secretLen, CHAR* challenge, UINT8 challengeLen, CHAR* hashOut);
+
+/**************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷Çø
+**************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NET_API_H */
+
diff --git a/cp/ps/modem/net/inc/oss_ppp.h b/cp/ps/modem/net/inc/oss_ppp.h
new file mode 100644
index 0000000..ccd6ea3
--- /dev/null
+++ b/cp/ps/modem/net/inc/oss_ppp.h
@@ -0,0 +1,102 @@
+/**************************************************************************
+*
+* Copyright (c) 2012 ZTE Corporation.
+*
+***************************************************************************
+* Ä£ ¿é Ãû : P98C_OSS
+* ÎÄ ¼þ Ãû : oss_ppp.h
+* Ïà¹ØÎļþ :
+* ʵÏÖ¹¦ÄÜ : pppÄ£¿é¶ÔÍâÍ·Îļþ
+* ×÷ Õß : zhangpeirong
+* °æ ±¾ : V1.0
+* Íê³ÉÈÕÆÚ : 2012-08-06
+* ÆäËü˵Ã÷ :
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ļǼ
+**************************************************************************/
+/**************************************************************************
+* Ð޸ıàºÅ : 0001
+* ÐÞ ¸Ä ÈË : zpr
+* ÐÞ¸ÄÈÕÆÚ : 2012-06-20
+* ÐÞ¸ÄÄÚÈÝ : EC:617001563315,PSBUFλÖøüÐÂ
+**************************************************************************/
+#ifndef _OSS_PPP_H
+#define _OSS_PPP_H
+
+/**************************************************************************
+* #includeÇø
+**************************************************************************/
+#include "ppp_api.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**************************************************************************
+* ³£Á¿¶¨ÒåÇø
+**************************************************************************/
+#define PPPIOCTL_PDP_TYPE ZPPP_CTRL_GET_PDP_TYPE
+#define PPPIOCTL_SET_PDPTYPE ZPPP_CTRL_SET_PDP_TYPE
+#define PPPIOCTL_MTU ZPPP_CTRL_GET_MRU
+#define PPPIOCTL_SET_MTU ZPPP_CTRL_SET_MRU
+#define PPPIOCTL_SET_PPPOE_INPUTPACKET_CB ZPPP_CTRL_SET_PPPOE_INPUTPACKET_CB
+#define PPPIOCTL_SET_ATI2_IPADDRS_CB ZPPP_CTRL_SET_ATI_IPADDRS_CB
+#define PPPIOCTL_SET_ATI2_NOTREADY ZPPP_CTRL_SET_ATI_NOTREADY
+
+#define PPPERR_NONE ZPPP_ERR_NONE
+#define PPPERR_PARAM ZPPP_ERR_PARAM
+#define PPPERR_OPEN ZPPP_ERR_OPEN
+#define PPPERR_DEVICE ZPPP_ERR_DEVICE
+#define PPPERR_ALLOC ZPPP_ERR_ALLOC
+#define PPPERR_USER ZPPP_ERR_USER
+#define PPPERR_CONNECT ZPPP_ERR_CONNECT
+#define PPPERR_AUTHFAIL ZPPP_ERR_AUTHFAIL
+#define PPPERR_PROTOCOL ZPPP_ERR_PROTOCOL
+#define PPPERR_RECVATEND ZPPP_ERR_RECVATEND
+#define PPPERR_EXITPPP ZPPP_ERR_EXITPPP
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+typedef enum
+{
+ PPP_PPPOE_DOING, /* ÐÉÌ̬ */
+ PPP_PPPOE_SUCCESS, /* ÐÉÌÍê³É */
+ PPP_PPPOE_FAIL, /* ÐÉÌʧ°Ü */
+ PPP_PPPOE_IPPACKET, /* IP°ü»Ø´« */
+ PPP_PPPOE_UNKNOWPACKET_ERROR /* ²»Ê¶±ðµÄ°ü */
+}E_ZOss_PppoeStatusNotify;
+
+typedef T_zPpp_Sio T_ZOss_PppSio;
+
+typedef T_zPpp_IpAddrs T_ZOss_PppIpAddrs;
+
+typedef T_zPpp_LinkCtrl T_ZOss_PppLinkCtl;
+
+/* ¶¨Òå֪ͨ¹¤¾ß·µ»ØIP°ü»Øµ÷µÄº¯ÊýÀàÐÍ */
+typedef BOOL (*OutputPacket_CB)(UINT32 pppNum, VOID *packet, UINT32 packetLen, UINT8 flag);
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+#define zOss_PppOpen zPpp_Open
+#define zOss_PppClose zPpp_Close
+#define zOss_PppStart zPpp_Start
+#define zOss_PppWriteIp zPpp_WriteIp
+#define zOss_InputDataFromPppoe zPpp_InputDataFromPppoe
+#define zOss_PppIOCtl zPpp_Ctrl
+#define zOss_PppRegOutputPppPacketCb zPpp_RegOutputPppPacketCb
+
+/**************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷Çø
+**************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSS_PPP_H */
+
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 */
+
diff --git a/cp/ps/modem/net/inc/pppoe_fnc.h b/cp/ps/modem/net/inc/pppoe_fnc.h
new file mode 100644
index 0000000..e50b2b9
--- /dev/null
+++ b/cp/ps/modem/net/inc/pppoe_fnc.h
@@ -0,0 +1,264 @@
+/**************************************************************************
+*
+* Copyright (c) 2012 ZTE Corporation.
+*
+***************************************************************************
+* Ä£ ¿é Ãû : P98D_PPPOE
+* ÎÄ ¼þ Ãû : pppoe_fnc.h
+* Ïà¹ØÎļþ :
+* ʵÏÖ¹¦ÄÜ : PPPoEÄ£¿é½Ó¿Ú·â×°
+* ×÷ Õß : liuzhengxuan
+* °æ ±¾ : V1.0
+* Íê³ÉÈÕÆÚ : 2012-08-03
+* ÆäËü˵Ã÷ :
+**************************************************************************/
+
+/**************************************************************************
+* Ð޸ļǼ
+**************************************************************************/
+/**************************************************************************
+* Ð޸ıàºÅ : 0001
+* ÐÞ ¸Ä ÈË : liuzhengxuan
+* ÐÞ¸ÄÈÕÆÚ : 2012-06-18
+* ÐÞ¸ÄÄÚÈÝ : EC
+* 1)617001563315 »º´æµÄ¹ÜÀí´Óoss_api.hÎļþÄÚÒÆ³ö£¬·ÅÈëpsbuf.h
+* ÎļþÄÚ
+*
+**************************************************************************/
+#ifndef _PPPOE_FNC_H
+#define _PPPOE_FNC_H
+
+/**************************************************************************
+* #includeÇø
+**************************************************************************/
+#include "oss_api.h"
+#include "oss_ppp.h"
+#include "drvs_serial_device.h"
+#include "zpsi_api.h"
+/* P98D-LZX-0001 2012/06/18 EC:617001563315 »º´æµÄ¹ÜÀí´Óoss_api.hÎļþÄÚÒÆ³ö£¬·ÅÈëpsbuf.hÎļþÄÚ BEGIN */
+#include "psbuf.h"
+/* P98D-LZX-0001 2012/06/18 EC:617001563315 »º´æµÄ¹ÜÀí´Óoss_api.hÎļþÄÚÒÆ³ö£¬·ÅÈëpsbuf.hÎļþÄÚ END */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**************************************************************************
+* ³£Á¿¶¨ÒåÇø
+**************************************************************************/
+/* PPPoEÖ¡½á¹¹Ì峤¶È */
+#define ZOSS_PPPOE_MAC_SIZE 6
+#define ZOSS_PPPOE_ETHER_FRAMETYPE_SIZE 2
+#define ZOSS_PPPOE_ETHER_FRAMEHEAD_SIZE (ZOSS_PPPOE_MAC_SIZE * 2 + ZOSS_PPPOE_ETHER_FRAMETYPE_SIZE)
+#define ZOSS_PPPOE_ETHER_FRAMEVERIFY_SIZE 0
+
+#define ZOSS_PPPOE_HEAD_SIZE 6 /* ¸ù¾ÝÐÒé: 4λ°æ±¾ + 4λÀàÐÍ + 8λ´úÂë + 16λ»á»°ID + 16볤¶È */
+#define ZOSS_PPPOE_SESSIONID_SIZE 2
+#define ZOSS_PPPOE_PURELOAD_LEN_SIZE 2
+
+#define ZOSS_PPPOE_TAG_TYPE_SIZE 2
+#define ZOSS_PPPOE_TAG_LEN_SIZE 2
+
+#define ZOSS_PPPOE_PPP_PROTOCOL_LEN 2
+#define ZOSS_PPPOE_PPP_VERIFY_LEN 2
+
+/* ·ÃÎʼ¯ÖÐÆ÷µÄÃû×Ö */
+#define ZOSS_PPPOE_ACNAME "ZTE-P98D-LTE"
+
+/* ÒÔϸù¾Ýʵ¼ÊÇé¿ö¶¨Òå */
+#define ZOSS_PPPOE_MAX_BYTE_VALUE 255
+#define ZOSS_PPPOE_MAX_IPDATA_LEN 65535
+#define ZOSS_PPPOE_MAX_PPPOEDATA_LEN (65535 - 6) /* PPPoEÊý¾Ý×î´ó³¤¶ÈµÈÓÚPPP×î´ó³¤¶È¼õÈ¥PPPoEµÄÍ·³¤¶È */
+#define ZOSS_PPPOE_MAX_ACNAME_LEN 20
+#define ZOSS_PPPOE_MAX_SERVICENAME_LEN 20
+#define ZOSS_PPPOE_MAX_RUNTIME_PROPERTY 20
+#define ZOSS_PPPOE_MAX_COMMON_TAG_LEN 250
+#define ZOSS_PPPOE_MAX_TAG_INC_LEN 50
+
+/* PPPoEµÄÖ¡ÀàÐÍ */
+#define PPPOE_ETHER_DISCOVER 0x8863
+#define PPPOE_ETHER_SESSION 0x8864
+
+/**************************************************************************
+* Êý¾Ý½á¹¹¶¨ÒåÇø
+**************************************************************************/
+typedef enum
+{
+ PPPOE_STATE_NULL,
+ PPPOE_STATE_DISCOVERY,
+ PPPOE_STATE_SESSION
+}T_zOss_PPPoEState;
+
+typedef enum
+{
+ PPPOE_PPP_FRAMETYPE_INVLID = 0,
+ PPPOE_PPP_FRAMETYPE_IP = 0x0021,
+ PPPOE_PPP_FRAMETYPE_IPV6 = 0x0057,
+ PPPOE_PPP_FRAMETYPE_LCP = 0xC021,
+ PPPOE_PPP_FRAMETYPE_NCP = 0x8021
+}T_zOss_PPPoEPPPFrameType;
+
+typedef enum
+{
+ PPPOE_TAGTYPE_END_OF_LIST = 0x0000,
+ PPPOE_TAGTYPE_SERVICE_NAME = 0x0101,
+ PPPOE_TAGTYPE_AC_NAME = 0x0102,
+ PPPOE_TAGTYPE_HOST_UNIQ = 0x0103,
+ PPPOE_TAGTYPE_AC_COOKIE = 0x0104,
+ PPPOE_TAGTYPE_VERDOR_SPECOFIC = 0x0105,
+ PPPOE_TAGTYPE_RELAY_SESSION_ID = 0x0110,
+ PPPOE_TAGTYPE_SERVICE_NAME_ERROR = 0x0201,
+ PPPOE_TAGTYPE_AC_SYSTEM_ERROR = 0x0202,
+ PPPOE_TAGTYPE_GENERIC_ERROR = 0x0203
+}T_zOss_PPPoETagType;
+
+typedef enum
+{
+ PPPOE_CODETYPE_PADI = 0x09,
+ PPPOE_CODETYPE_PADO = 0x07,
+ PPPOE_CODETYPE_PADR = 0x19,
+ PPPOE_CODETYPE_PADS = 0x65,
+ PPPOE_CODETYPE_SESSION = 0x00,
+ PPPOE_CODETYPE_PADT = 0xa7,
+ PPPOE_CODETYPE_INVALID = 0xff
+}T_zOss_PPPoEFrameType;
+
+typedef struct
+{
+ UINT8 tagType[ZOSS_PPPOE_TAG_TYPE_SIZE];
+ UINT8 tapLen[ZOSS_PPPOE_TAG_LEN_SIZE];
+}T_zOss_PPPoETagHead;
+
+typedef struct
+{
+ T_zOss_PPPoETagType tagType;
+ UINT16 tagLen;
+ UINT8 *pTagContent;
+}T_zOss_PPPoETag;
+
+typedef enum
+{
+ PPPOE_RST_EXTRMOD_ERR = -3,
+ PPPOE_RST_PARAM_ERR,
+ PPPOE_RST_RUN_ERR,
+ PPPOE_RST_SUCESS,
+ PPPOE_RST_OVER,
+ PPPOP_RST_EXIT,
+ PPPOP_RST_NOTSUPT,
+ PPPOE_RST_TURN
+}T_zOss_PPPoERst;
+
+typedef struct
+{
+ UINT8 atiCh;
+ UINT32 sioFd;
+ BOOL (*GetPdpIpAddr)(VOID *pPppIpAddrs, UINT8 iChnelId);
+ VOID (*upData)(UINT32 pppOprId, T_z_UpLink_Sdu *ipPacket, SINT32 len, UINT8 chID);
+ SINT32 (*sioRead)(UINT32 uiFd, T_ZDrv_BufNode *pBuf);
+ SINT32 (*sioWrite)(UINT32 uiFd, T_ZDrv_BufNode *pBuf);
+ SINT32 (*sio_free_read_buffer)(UINT32 uiFd);
+ SINT32 (*sio_get_write_buffer)(UINT32 uiFd, T_ZDrv_BufNode *pBuf);
+ VOID (*sioReadUnblock)(UINT32 fd);
+ VOID (*sioReadBlock)(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);
+ VOID (*free_upLinkSdu)(T_z_DownLink_Sdu *pSdu);
+ VOID (*get_downLinkSdu)(VOID);
+ VOID (*PPPoEStateCB)(UINT32 PPPoE_ID, UINT8 chID, T_zOss_PPPoEState serState, VOID *inputArg);
+}T_ZOss_PPPoESerEnvir;
+
+typedef struct
+{
+ UINT8 clientMAC[ZOSS_PPPOE_MAC_SIZE];
+ T_zOss_PPPoEFrameType lastFrameType;
+ T_zOss_PPPoETag runTimeTag[ZOSS_PPPOE_MAX_RUNTIME_PROPERTY];
+}T_zOss_PPPoERunTime;
+
+typedef struct
+{
+ T_zOss_PPPoEState serState;
+ UINT8 pppId;
+ UINT16 sessonid;
+ T_zOss_PPPoERunTime runTime;
+ T_ZOss_PPPoESerEnvir serEnvir;
+}T_zOss_PPPoEContext;
+
+typedef struct
+{
+ UINT8 acName[ZOSS_PPPOE_MAX_ACNAME_LEN + 1];
+ UINT8 maxPPPoECount;
+ T_zOss_PPPoEContext *pPPPoEContext;
+}T_zOss_PPPoEModContext;
+
+typedef struct
+{
+ UINT8 destMAC[ZOSS_PPPOE_MAC_SIZE];
+ UINT8 srcMAC[ZOSS_PPPOE_MAC_SIZE];
+ UINT16 frameType;
+}T_zOss_PPPoEEtherFrameHead;
+
+typedef struct
+{
+ UINT8 version : 4;
+ UINT8 type : 4;
+ UINT8 code;
+ UINT16 sessionID;
+ UINT16 pureLoadLen;
+}T_zOss_PPPoEFrameHead;
+
+typedef struct
+{
+ UINT8 protocol[ZOSS_PPPOE_PPP_PROTOCOL_LEN];
+ UINT8 *pData;
+ UINT32 dataSize;
+ UINT8 verify[ZOSS_PPPOE_PPP_VERIFY_LEN];
+}T_zOss_PPPoEPPPdata;
+
+typedef struct
+{
+ UINT8 *data;
+ UINT32 dataSize;
+}T_zOss_DataHook;
+
+typedef T_zOss_PPPoERst (*T_zOssPPPoEReceiveTag)(const T_zOss_PPPoETag *pTag, T_zOss_PPPoEContext *pPPPoECtontext);
+
+typedef struct
+{
+ T_zOss_PPPoETagType tagType;
+ T_zOssPPPoEReceiveTag tagHanle;
+}T_zOss_PPPoEReceiveTagMap;
+
+typedef T_zOss_PPPoERst (*T_zOssPPPoERespondTag)(const T_zOss_PPPoETag *pTag,
+ T_zOss_PPPoEContext *pPPPoECtontext,
+ T_zOss_PPPoETag *pResTag);
+
+typedef struct
+{
+ T_zOss_PPPoETagType tagType;
+ T_zOssPPPoERespondTag tagHanle;
+}T_zOss_PPPoERespondTagMap;
+
+/**************************************************************************
+* º¯ÊýÉùÃ÷Çø
+**************************************************************************/
+BOOL zOss_InitPPPoE(UINT8 maxPPPoECount);
+UINT32 zOss_PPPoEInitPPP(VOID);
+UINT32 zOss_OpenPPPoE(T_ZOss_PPPoESerEnvir *PPPoESio);
+T_zOss_PPPoERst zOss_RunPPPoE(UINT32 PPPoE_ID);
+BOOL zOss_WriteDataToPPPoE(UINT32 PPPoE_ID, UINT8 *buff, UINT32 buffSize);
+SINT32 zOss_ClosePPPoE(UINT32 PPPoE_ID);
+T_zOss_PPPoERst zOss_CancelPPPoE(UINT32 PPPoE_ID);
+
+/**************************************************************************
+* È«¾Ö±äÁ¿ÉùÃ÷Çø
+**************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PPPOE_FNC_H */
+