mrp_unet.h
8.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#ifndef __MMI_DSM_UNET_H__
#define __MMI_DSM_UNET_H__
/******************************************************************
DATE:20090609
AUTHOR:SKY
FILE: UNINET INTERFACE
统一gprs、socket管理,为多联网应用提供统一便捷接口服务
********************************************************************/
#include "mrporting.h"
/**--------------------------------------------------------------------------*
** CONST & STRUCTS *
**--------------------------------------------------------------------------*/
#define UNET_INVALID_HANDLE (0)
#define UNET_SPEC_WIFI_HANDLE (0xEFEF)//wifi标志handle
typedef int32 (*t_unet_act_cb)(int32 result);
typedef int32 (*t_unet_dsn_cb)(int32 result);
typedef int32 t_unet_handle; //a app mod handle
/*sim select*/
typedef enum
{
UNET_SIM_MASTER,
UNET_SIM_SLAVE,
UNET_SIM_THIRD,
UNET_SIM_FOURTH,
UNET_SIM_MAX
}e_unet_sim_type;
/*apn other context s*/
typedef struct
{
char *userName;
char *passWord;
unsigned char dns[4];
unsigned char authentication_type;
}t_unet_apn_account;
/**--------------------------------------------------------------------------*
** PUBLIC FUNCTIONS DECLARE *
**--------------------------------------------------------------------------*/
/****************************************************************************
函数名:void unet_ApnAL_Init(uint8 csdAccount, uint8 gprsAccount)
描 述:unet 初始化,仅开机时调用
参 数:uint8 csdAccount - 平台上CSD帐号位总数
uint8 gprsAccount - 平台上GPRS帐号为总数
返 回:void
****************************************************************************/
void unet_ApnAL_Init(uint8 csdAccount, uint8 gprsAccount);
/****************************************************************************
函数名: int32 unet_ApnAL_ActiveCntx(char *apn, t_unet_apn_account *accountInfo, t_unet_act_cb cb, e_unet_sim_type simId, int32 *appHandle)
描 述:建立apn context
参 数:const char *apn, - apn
t_unet_apn_account *accountInfo - 其他帐号属性,可以是NULL即无需特殊指定
t_unet_act_cb cb, - 异步结果回调
e_unet_sim_type simId, - 双卡双待使用,单卡请填UNET_SIM_MASTER
int32 *appHandle - appHandle address
返 回:MR_SUCCESS 操作成功
:MR_FAILED 操作失败
:MR_WAITING 此操作是个异步过程,需要通过cb 进行异步通知
****************************************************************************/
int32 unet_ApnAL_ActiveCntx(char *apn, t_unet_apn_account *accountInfo, t_unet_act_cb cb, e_unet_sim_type simId, int32 *appHandle);
/****************************************************************************
函数名:int32 unet_ApnAL_CloseCntx(int32 *appHandle)
描 述:注销apn 连接
参 数:int32 *appHandle - appHandle address
返 回:MR_SUCCESS 操作成功
:MR_FAILED 操作失败
****************************************************************************/
int32 unet_ApnAL_CloseCntx(int32 *appHandle);
/****************************************************************************
函数名:int32 unet_ApnAl_activeCntx_Cust(t_unet_act_cb cb, e_unet_sim_type simId, int32 *appHandle)
描 述: 功能同unet_ApnAL_ActiveCntx(), 目的是将platex的apn account设置统一到unet流程中-见dsm调用实例
参 数: t_unet_act_cb cb, - 异步结果回调
e_unet_sim_type simId, - 双卡双待使用,单卡请填UNET_SIM_MASTER
int32 *appHandle - appHandle address
返 回:MR_SUCCESS 操作成功
:MR_FAILED 操作失败
:MR_WAITING 此操作是个异步过程,需要通过cb 进行异步通知
****************************************************************************/
int32 unet_ApnAl_ActiveCntx_Cust(t_unet_act_cb cb, e_unet_sim_type simId, int32 *appHandle);
/****************************************************************************
函数名: int32 unet_Soc_GetHostByName(const char *name, t_unet_dsn_cb cb, int32 appHandle)
描 述: 请求进行域名解析
参 数: const char *name, - host name
t_unet_dsn_cb cb, - 异步结果回调
int32 appHandle - apphandle
返 回:MR_SUCCESS 操作成功
:MR_FAILED 操作失败
:MR_WAITING 此操作是个异步过程,需要通过cb 进行异步通知
****************************************************************************/
int32 unet_Soc_GetHostByName(const char *name, t_unet_dsn_cb cb, int32 appHandle);
/****************************************************************************
函数名: int32 unet_Soc_State(int32 s)
描 述: 查询socket(连接)状态
参 数: int32 s
返 回:MR_SUCCESS 已连接
:MR_FAILED 连接失败
:MR_WAITING 建立连接中
****************************************************************************/
int32 unet_Soc_State(int32 s);
/****************************************************************************
函数名: void unet_Soc_Break(int32 appHandle)
描 述: 某app的socket被外界强行破坏-比如sim卡切换时
参 数: int32 appHandle - apphandle
返 回:void
****************************************************************************/
void unet_Soc_Break(int32 appHandle);
/****************************************************************************
函数名:int32 unet_soc_create(int32 type, int32 protocol, int32 appHandle)
描 述: 创建一个socket
参 数: int32 type, - MR_SOCK_STREAM or SOCK_DGRAM
int32 protocol, - invalid
int32 appHandle - apphandle
返 回: 创建成功的socket的句柄
****************************************************************************/
int32 unet_Soc_Create(int32 type, int32 protocol, int32 appHandle);
/****************************************************************************
函数名: int32 unet_Soc_Connect(int32 s, int32 ip, uint16 port, int32 type)
描 述: 建立连接
参 数: int32 s, - socket id
int32 ip, - 主机ip
uint16 port, - 端口
int32 type - MR_SOCKET_BLOCK, //阻塞方式(同步方式)
MR_SOCKET_NONBLOCK //非阻塞方式(异步方式)
返 回:MR_SUCCESS 已连接
:MR_FAILED 连接失败
:MR_WAITING 建立连接中
****************************************************************************/
int32 unet_Soc_Connect(int32 s, int32 ip, uint16 port, int32 type);
/****************************************************************************
函数名: int32 unet_Soc_Close(int32 s)
描 述: 关闭连接
参 数: int32 s - socket id
返 回:MR_SUCCESS 操作成功
:MR_FAILED 操作失败
****************************************************************************/
int32 unet_Soc_Close(int32 s);
/****************************************************************************
函数名: int32 unet_Soc_Recv(int32 s, const char *buf, int len)
描 述: recv data
参 数: int32 s, char *buf, int len
返 回: >=0, get data len
-1, fatol err
****************************************************************************/
int32 unet_Soc_Recv(int32 s, const char *buf, int len);
/****************************************************************************
函数名: int32 unet_Soc_Send(int32 s, const char *buf, int len)
描 述: send data
参 数: int32 s, char *buf, int len
返 回: >=0, send data len
-1, fatol err
****************************************************************************/
int32 unet_Soc_Send(int32 s, const char *buf, int len);
/****************************************************************************
函数名:int32 unet_Soc_Sendto(int32 s, const char *buf, int len, int32 ip, uint16 port)
描 述:UDP 发送 接口
参 数:
返 回:
****************************************************************************/
int32 unet_Soc_Sendto(int32 s, const char *buf, int len, int32 ip, uint16 port);
/****************************************************************************
函数名:int32 unet_Soc_Recvfrom(int32 s, char *buf, int len, int32 *ip, uint16 *port)
描 述:UDP 接收 接口
参 数:
返 回:
****************************************************************************/
int32 unet_Soc_Recvfrom(int32 s, char *buf, int len, int32 *ip, uint16 *port);
/****************************************************************************
函数名: int32 unet_Soc_Bind(mr_bind_st *d_bind)
描 述: bind
参 数:
返 回:
****************************************************************************/
int32 unet_Soc_Bind(mr_bind_st *d_bind);
/****************************************************************************
函数名: void unet_Soc_Notifyvoid
描 述:异步socket消息处理
参 数:
返 回:
****************************************************************************/
MMI_BOOL unet_Soc_Notify(void* inMsg);
/****************************************************************************
函数名: void mr_soc_app_soc_get_host_by_name_ind(void* inMsg)
描 述: 域名解析消息处理
参 数:
返 回:void
****************************************************************************/
MMI_BOOL unet_Soc_GetHBN_Notify(void* inMsg);
/**
* \brief
*/
void mr_net_set_protocol_event_handler(U16 eventID, PsIntFuncPtr funcPtr, MMI_BOOL isMultiHandler);
/**
* \brief
*/
void mr_net_clear_protocol_event_handler(U16 eventID, PsIntFuncPtr funcPtr);
#endif//__MMI_DSM_UNET_H__
/*#auto end#*/