1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef __TUP_API_H
- #define __TUP_API_H
- #include "stdbool.h"
- typedef unsigned char T_BYTE; ///< �ֽ�
- typedef char T_INT8; ///< 8���
- typedef unsigned char T_UINT8; ///< 8�������
- typedef short T_INT16; ///< 16���
- typedef unsigned short T_UINT16; ///< 16�������
- typedef int T_INT32; ///< 32���
- typedef unsigned int T_UINT32; ///< 32�������
- typedef bool T_BOOL;
- typedef enum{
- TUP_TCP=0x30,
- TUP_UDP=0x31
- }TUP_ENUM;
-
- //#include "datatype.h"
- //#include "platform.h"
- #include "lsapi_event.h"
- #define USER_EVENT_EXIT (LS_API_EV_BASE+12)
- #define USER_EVENT_TIMEOUT (LS_API_EV_BASE+13)
- #define USER_EVENT_LSB (LS_API_EV_BASE+14)
- #define USER_EVENT_UART (LS_API_EV_BASE+15)
- #define USER_EVENT_TONE (LS_API_EV_BASE+16)
- #define USER_ENENT_AGPS (LS_API_EV_BASE+17)
- #define USER_EVENT_PA (LS_API_EV_BASE+18)
- #include "lsapi_sock.h"
- #include "lsapi_os.h"
- typedef enum{
- TUP_STATUS_TRUE,
- TUP_STATUS_FALSE,
- TUP_STATUS_WAIT,
- TUP_STATUS_ONLINE
- }TUP_CONNECT_ENUM;
-
- typedef enum{
- CNNT_READY,
- CNNT_BUSY,
- CNNT_OK,
- CNNT_ERROR,
- CNNT_CLOSED,
- CNNT_TOUT
- }CNNT_ENUM;
- typedef struct{
- T_INT32 fd;
- T_UINT16 port;
- T_INT8 *saddr; //连接服务器地址
- T_UINT8 tupType;//连接类型 TUP_TCP TUP_UDP
- LSAPI_SOCK_Callback *tupRecvCallBack; //连接回调
- T_UINT8 errno; //SOCK连接错误代码
- T_UINT16 stacksize;//连接时创建线程的栈分配大小
- LSAPI_SOCK_TcpipSocketAddr_t sockAddr;//UDP时使用
- CNNT_ENUM tupStatus; //连接状态或结果 0正在连接 1 连接成功,2连接失败 3连接断开
- T_UINT8 index; //做成模块,开给对外用户sock接口模块时使用
- LSAPI_OSI_Timer_t *ptimer_t;//链接超时判断定时器
- T_UINT8 *defPara;//备用
- }TUPSEND_DEF;
- void trySendTup(T_UINT8 *data, T_UINT16 len, TUP_ENUM tup, TUPSEND_DEF *para);
- TUP_CONNECT_ENUM tryConnectTup(T_INT8 *seraddr, TUP_ENUM tup,TUPSEND_DEF *para);
- void tupParaSet(TUPSEND_DEF *para, T_UINT16 port, LSAPI_SOCK_Callback *callback,T_UINT16 stacksize);
- void showTupEventInfo(const char *name, T_UINT32 id,TUPSEND_DEF *para,char );
- void userCloseSocket(T_INT32 *fd);
- //void ApplocationCallBack(void *param);
- #endif
|