• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2003-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef OBX_API_H
19 #define OBX_API_H
20 #include "bt_target.h"
21 #include "bt_types.h"
22 #include "l2c_api.h"
23 
24 /* 18 is 7/OBX_CONN_HDRS_OFFSET + 5/conn id, 2/ssn, 2/srm 2/srm_param */
25 #define OBX_HDR_OFFSET              (18 + L2CAP_MIN_OFFSET)
26 #define OBX_MAX_TRIPLET             3
27 
28 #define OBX_MIN_MTU                 255 /* per IrOBEX spec */
29 #define OBX_MAX_MTU                 (OBX_LRG_DATA_POOL_SIZE - BT_HDR_SIZE - OBX_HDR_OFFSET)
30 
31 #define OBX_CONN_ID_SIZE            4
32 #define OBX_PKT_LEN_SIZE            2
33 
34 #define OBX_CONN_HDRS_OFFSET        7
35 #define OBX_SESS_HDRS_OFFSET        3
36 #define OBX_DISCON_HDRS_OFFSET      3
37 #define OBX_PUT_HDRS_OFFSET         3
38 #define OBX_GET_HDRS_OFFSET         3
39 #define OBX_SETPATH_REQ_HDRS_OFFSET 5
40 #define OBX_ABORT_HDRS_OFFSET       3
41 #define OBX_ACTION_HDRS_OFFSET      3
42 #define OBX_RESPONSE_HDRS_OFFSET    3
43 
44 /* this is not needed if OBX_HDR_OFFSET is 18+ */
45 #define OBX_MAX_CONN_HDR_EXTRA      8 /* 5/conn id, 2/ssn, 2/srm 2/srm_param - (5/setpath + 5/conn_id - 7/conn) */
46 
47 /* offset for header functions to access fields */
48 #define OBX_CONNECT_MTU_OFFSET      5
49 #define OBX_SETPATH_FLAG_OFFSET     3
50 
51 #define OBX_MAX_NUM_AUTH_TRIPLET    3
52 #define OBX_UNICODE_SIZE            2 /* sizeof(UINT16) */
53 
54 #define OBX_INVALID_HDR_LEN         0xFFFF
55 
56 #define OBX_MIN_NONCE_SIZE          4   /* fixed size per IrOBEX spec */
57 #define OBX_NONCE_SIZE              16  /* fixed size per IrOBEX spec */
58 #define OBX_DIGEST_SIZE             16  /* fixed size per IrOBEX spec */
59 #define OBX_MAX_AUTH_KEY_SIZE       16
60 #define OBX_MAX_AUTH_USER_SIZE      20
61 #define OBX_SESSION_ID_SIZE         16  /* fixed size per IrOBEX spec */
62 #define OBX_SESSION_INFO_SIZE       32  /* OBX_SESSION_ID_SIZE + 4(local nonce) + 4 (connection id) + 4 (timeout) + 2(mtu) + 1(state) + 1(srm)  */
63 #define OBX_SESSION_INFO_NONCE_IDX  16  /* The index to the (local nonce) in session info */
64 #define OBX_SESSION_INFO_ID_IDX     20  /* The index to the (connection id) in session info */
65 #define OBX_SESSION_INFO_TO_IDX     24  /* The index to the (timeout) in session info */
66 #define OBX_SESSION_INFO_MTU_IDX    28  /* The index to peer MTU in session info */
67 #define OBX_SESSION_INFO_ST_IDX     30  /* The index to sr/cl state in session info */
68 #define OBX_SESSION_INFO_SRM_IDX    31  /* The index to srm in session info */
69 #define OBX_TIMEOUT_SIZE            4
70 
71 /* handle related definitions */
72 #define OBX_SESS_SHIFT              8
73 #define OBX_ENC_SESS_HANDLE(oh, os) (((os)<<OBX_SESS_SHIFT)|(oh))
74 #define OBX_HANDLE_MASK             0xFF
75 #define OBX_SESS_MASK               0x7F00
76 #define OBX_DEC_HANDLE(os)          ((os) & OBX_HANDLE_MASK)
77 #define OBX_DEC_SESS_IND(os)        ((os & OBX_SESS_MASK)>>OBX_SESS_SHIFT)
78 
79 /* Return values for API functions */
80 enum
81 {
82     OBX_SUCCESS,        /* Status is successful. */
83     OBX_BAD_PARAMS,     /* Bad parameter(s). */
84     OBX_NO_RESOURCES,   /* No resources (GKI buffers, control block) */
85     OBX_BAD_HANDLE      /* The OBEX handle is not valid. */
86 };
87 typedef UINT8 tOBX_STATUS;
88 
89 
90 typedef UINT16 tOBX_HANDLE;
91 
92 #define OBX_HANDLE_NULL             0
93 
94 enum
95 {
96     OBX_PT_PUT,     /* Regular Put request */
97     OBX_PT_DELETE,  /* Delete request - a Put request with NO Body or End-of-Body header. */
98     OBX_PT_CREATE   /* Create-Empty request - a Put request with an empty End-of-Body header. */
99 };
100 typedef UINT8   tOBX_PUT_TYPE;
101 
102 /* SetPath Request Flags - the following definitions can be ORed if both flags are wanted */
103 #define OBX_SPF_BACKUP      0x01    /* Backup a level before applying name(equivalent to ../) */
104 #define OBX_SPF_NO_CREATE   0x02    /* Don't create directory if it does not exist, return an error instead. */
105 typedef UINT8   tOBX_SETPATH_FLAG;
106 
107 /* Authentication Challenge Options */
108 #define OBX_AO_NONE         0x00    /* If this is used in OBX_StartServer and the authenticate
109                                      * flag is TRUE, the optional Challenge Information (tag 0x01)
110                                      * will not be sent. */
111 #define OBX_AO_USR_ID       0x01    /* Set this bit to make the client respond with the user ID. */
112 typedef UINT8 tOBX_AUTH_OPT;
113 
114 /* CHARSET definition for Authentication Challenge Realm */
115 #define OBX_RCS_ASCII       0x00    /* ASCII */
116 #define OBX_RCS_8859_1      0x01    /* ISO-8859-1 */
117 #define OBX_RCS_8859_2      0x02    /* ISO-8859-2 */
118 #define OBX_RCS_8859_3      0x03    /* ISO-8859-3 */
119 #define OBX_RCS_8859_4      0x04    /* ISO-8859-4 */
120 #define OBX_RCS_8859_5      0x05    /* ISO-8859-5 */
121 #define OBX_RCS_8859_6      0x06    /* ISO-8859-6 */
122 #define OBX_RCS_8859_7      0x07    /* ISO-8859-7 */
123 #define OBX_RCS_8859_8      0x08    /* ISO-8859-8 */
124 #define OBX_RCS_8859_9      0x09    /* ISO-8859-9 */
125 #define OBX_RCS_UNICODE     0xFF    /* Unicode */
126 typedef UINT8 tOBX_CHARSET;
127 
128 typedef struct
129 {
130     UINT8               ssn;        /* session sequence number */
131     BOOLEAN             final;      /* TRUE, if this is the final packet of this PUT transaction. */
132     tOBX_PUT_TYPE       type;       /* The type of PUT request. */
133 } tOBX_PUT_EVT;
134 
135 typedef struct
136 {
137     UINT8               ssn;        /* session sequence number */
138     BOOLEAN             final;      /* TRUE, if this is the final packet of this GET transaction. */
139 } tOBX_GET_EVT;
140 
141 typedef struct
142 {
143     UINT8               ssn;        /* session sequence number */
144     BD_ADDR             peer_addr;  /* The peer Bluetooth Address. */
145     UINT16              mtu;        /* The peer MTU. This element is associated with OBX_CONNECT_REQ_EVT and OBX_CONNECT_RSP_EVT. */
146     tOBX_HANDLE         handle;     /* the OBX handle returned by OBX_StartServer(), OBX_CreateSession() and OBX_ConnectReq() */
147     BOOLEAN             no_rsp;     /* TRUE, when the event is generated as a part of RESUME SESSION */
148 } tOBX_CONN_EVT;
149 
150 /* Session Opcode Definitions: */
151 #define OBX_SESS_OP_CREATE              0x00 /* Create Session */
152 #define OBX_SESS_OP_CLOSE               0x01 /* Close Session */
153 #define OBX_SESS_OP_SUSPEND             0x02 /* Suspend Session */
154 #define OBX_SESS_OP_RESUME              0x03 /* Resume Session */
155 #define OBX_SESS_OP_SET_TIME            0x04 /* Set Timeout */
156 #define OBX_SESS_OP_TRANSPORT           0xFF /* transport dropped */
157 typedef UINT8   tOBX_SESS_OP;
158 
159 /* Session States Definitions for external use: */
160 enum
161 {
162     OBX_SESS_NONE,       /* 0x00    session is not engaged/closed */
163     OBX_SESS_ACTIVE,     /* 0x01    session is active. */
164     OBX_SESS_SUSPENDED,  /* 0x02    session is suspended. */
165     OBX_SESS_EXT_MAX
166 };
167 typedef UINT8 tOBX_SESS_ST;
168 
169 
170 typedef struct
171 {
172     UINT8               ssn;            /* session sequence number */
173     tOBX_SESS_OP        sess_op;        /* the session op code */
174     tOBX_SESS_ST        sess_st;        /* the session state */
175     BD_ADDR             peer_addr;      /* The peer Bluetooth Address. */
176     UINT8               *p_sess_info;   /* The session ID and the local nonce for a reliable session, a reference to the location in OBEX control block or NULL */
177     UINT32              timeout;        /* The number of seconds remaining in suspend. 0xffff if infinite. */
178     UINT32              obj_offset;     /* The object offset for resume session. */
179     UINT8               nssn;           /* tne next session sequence number the server expects */
180 } tOBX_SESS_EVT;
181 
182 #define OBX_ACT_COPY        0x00    /* Copy object */
183 #define OBX_ACT_MOVE        0x01    /* Move/rename object */
184 #define OBX_ACT_PERMISSION  0x02    /* Set object permission */
185 typedef UINT8 tOBX_ACTION;
186 
187 typedef struct
188 {
189     UINT8               ssn;        /* session sequence number */
190     tOBX_ACTION         action;     /* The action opcode. */
191 } tOBX_ACT_EVT;
192 
193 typedef struct
194 {
195     UINT8               ssn;        /* session sequence number */
196     tOBX_SETPATH_FLAG   flag;       /* The set path flags. */
197 } tOBX_SETPATH_EVT;
198 
199 /* permission flags */
200 #define OBX_PERMISSION_READ         0x01
201 #define OBX_PERMISSION_WRITE        0x02
202 #define OBX_PERMISSION_DELETE       0x04
203 #define OBX_PERMISSION_MODIFY       0x80
204 
205 typedef union
206 {
207     UINT8               ssn;        /* session sequence number */
208     tOBX_CONN_EVT       conn;       /* This element is associated with OBX_CONNECT_REQ_EVT and OBX_CONNECT_RSP_EVT. */
209     tOBX_SESS_EVT       sess;       /* This element is associated with OBX_SESSION_RSP_EVT and OBX_SESSION_REQ_EVT. */
210     tOBX_PUT_EVT        put;        /* This element is associated with OBX_PUT_REQ_EVT. */
211     tOBX_SETPATH_EVT    sp;         /* This element is associated with OBX_SETPATH_REQ_EVT. */
212     tOBX_ACT_EVT        action;     /* This element is associated with OBX_ACTION_REQ_EVT */
213     tOBX_GET_EVT        get;        /* This element is associated with OBX_GET_REQ_EVT. TRUE, if this is the final packet that contains the OBEX headers for this GET request. */
214 } tOBX_EVT_PARAM;
215 
216 
217 enum
218 {
219     OBX_NULL_EVT,
220     /* server events */
221     OBX_CONNECT_REQ_EVT,    /* param = packet MTU */
222     OBX_SESSION_REQ_EVT,    /* A Crease Session or Resume Session request is received by the server. Call OBX_SessionRsp(). */
223     OBX_DISCONNECT_REQ_EVT,
224     OBX_PUT_REQ_EVT,        /* could have param indicate delete or create? */
225     OBX_GET_REQ_EVT,
226     OBX_SETPATH_REQ_EVT,    /* param = flags */
227     OBX_ABORT_REQ_EVT,
228     OBX_ACTION_REQ_EVT,     /* An Action request is received by the server. Call OBX_ActionRsp(). */
229 
230     /* client events */
231     OBX_CONNECT_RSP_EVT,    /* param = packet MTU */
232     OBX_SESSION_RSP_EVT,    /* A response for Create Session or Resume Session is received by the client. The client needs to remember the session id. The session id is to be used in calling OBX_ResumeSession, if the current session is terminated prematurely. */
233     OBX_DISCONNECT_RSP_EVT,
234     OBX_PUT_RSP_EVT,
235     OBX_GET_RSP_EVT,
236     OBX_SETPATH_RSP_EVT,
237     OBX_ABORT_RSP_EVT,
238     OBX_ACTION_RSP_EVT,     /* An Action response is received by the client. */
239 
240     /* common events */
241     OBX_SESSION_INFO_EVT,   /* the session information event to resume the session. */
242     OBX_CLOSE_IND_EVT,      /* when transport goes down; p_pkt = NULL; no response needed */
243     OBX_TIMEOUT_EVT,        /* param = tOBX_EVENT */
244     OBX_PASSWORD_EVT
245 };
246 typedef UINT8 tOBX_EVENT;
247 
248 /* this is used by the protocol display function only*/
249 enum
250 {
251     OBX_NULL_DISP,
252     /* server events */
253     OBX_CONNECT_REQ_DISP,
254     OBX_SESSION_REQ_DISP,
255     OBX_DISCONNECT_REQ_DISP,
256     OBX_PUT_REQ_DISP,
257     OBX_GET_REQ_DISP,
258     OBX_SETPATH_REQ_DISP,
259     OBX_ABORT_REQ_DISP,
260     OBX_ACTION_REQ_DISP,
261     /* client events */
262     OBX_CONNECT_RSP_DISP,
263     OBX_SESSION_RSP_DISP,
264     OBX_DISCONNECT_RSP_DISP,
265     OBX_PUT_RSP_DISP,
266     OBX_GET_RSP_DISP,
267     OBX_SETPATH_RSP_DISP,
268     OBX_ABORT_RSP_DISP,
269     OBX_ACTION_RSP_DISP,
270     /* common events */
271     OBX_CLOSE_IND_DISP,
272     OBX_TIMEOUT_DISP,
273     OBX_PASSWORD_DISP
274 };
275 #define OBX_DISP_IS_RECV    0x80
276 #define OBX_DISP_TYPE_MASK  0x7F
277 
278 #define OBX_MAX_EVT         OBX_PASSWORD_EVT
279 #define OBX_MAX_OFFSET_IND  OBX_ABORT_RSP_EVT /* This is used to access obx_hdr_start_offset */
280 
281 /*
282 ** Define Miscellaneous Constants
283 */
284 #define OBX_VERSION                     0x10    /* Version 1.0 */
285 #define OBX_CONN_FLAGS                  0       /* Connect flags per IrOBEX spec */
286 #define OBX_SETPATH_CONST               0       /* SetPath Request constants per IrOBEX spec */
287 #define OBX_INVALID_CONN_ID             0xFFFFFFFF  /* invalid connection ID per IrOBEX spec */
288 #define OBX_INFINITE_TIMEOUT            0xFFFFFFFF
289 
290 /* Header Identifier Data Type Constants */
291 #define OBX_HI_TYPE_MASK                0xC0    /* This mask get the encoding (data type) of the header ID. */
292 #define OBX_HI_ID_MASK                  0x3F    /* This mask gets the meaning of the header ID. */
293 #define OBX_HI_TYPE_UNIC                0x00    /* Null terminated Unicode text */
294 #define OBX_HI_TYPE_ARRAY               0x40    /* Unstructured octet array (byte sequence) */
295 #define OBX_HI_TYPE_BYTE                0x80    /* 8-bit integer */
296 #define OBX_HI_TYPE_INT                 0xC0    /* 32-bit integer */
297 
298 /*
299 ** Define OBEX Header Identifiers
300 */
301 #define OBX_HI_NULL                     0
302 #define OBX_HI_COUNT                    0xC0
303 #define OBX_HI_NAME                     0x01
304 #define OBX_HI_TYPE                     0x42
305 #define OBX_HI_LENGTH                   0xC3
306 #define OBX_HI_TIME                     0x44
307 #define OBX_HI_DESCRIPTION              0x05
308 #define OBX_HI_TARGET                   0x46
309 #define OBX_HI_HTTP                     0x47
310 #define OBX_HI_BODY                     0x48
311 #define OBX_HI_BODY_END                 0x49
312 #define OBX_HI_WHO                      0x4A
313 #define OBX_HI_CONN_ID                  0xCB
314 #define OBX_HI_APP_PARMS                0x4C
315 #define OBX_HI_CHALLENGE                0x4D
316 #define OBX_HI_AUTH_RSP                 0x4E
317 #define OBX_HI_CREATOR_ID               0xCF
318 #define OBX_HI_WAN_UUID                 0x50
319 #define OBX_HI_OBJ_CLASS                0x51
320 #define OBX_HI_SESSION_PARAM            0x52
321 #define OBX_HI_SESSION_SN               0x93
322 #define OBX_HI_ACTION_ID                0x94
323 #define OBX_HI_DEST_NAME                0x15
324 #define OBX_HI_PERMISSION               0xD6
325 #define OBX_HI_SRM                      0x97
326 #define OBX_HI_SRM_PARAM                0x98
327 #define OBX_HI_LO_USER                  0x30
328 #define OBX_HI_HI_USER                  0x3F
329 
330 /* Obex Header Values for the SRM header */
331 #define OBX_HV_SRM_DISABLE  0x00    /* SRM header value - disable */
332 #define OBX_HV_SRM_ENABLE   0x01    /* SRM header value - enable */
333 #define OBX_HV_SRM_IND      0x02    /* SRM header value - indicate support */
334 
335 /* Obex Header Values for the SRM Parameter header */
336 #define OBX_HV_SRM_PARAM_MORE   0x00    /* SRM Param header value - request additional packet */
337 #define OBX_HV_SRM_PARAM_WAIT   0x01    /* SRM Param header value - wait for next req/rsp */
338 #define OBX_HV_SRM_PARAM_COMBO  0x02    /* SRM Param header value - next and wait */
339 
340 #define OBX_TAG_SESS_PARAM_ADDR         0x00
341 #define OBX_TAG_SESS_PARAM_NONCE        0x01
342 #define OBX_TAG_SESS_PARAM_SESS_ID      0x02
343 #define OBX_TAG_SESS_PARAM_NSEQNUM      0x03
344 #define OBX_TAG_SESS_PARAM_TOUT         0x04
345 #define OBX_TAG_SESS_PARAM_SESS_OP      0x05
346 #define OBX_TAG_SESS_PARAM_OBJ_OFF      0x06
347 #define OBX_MAX_SESS_PARAM_TRIP         7   /* max number of TLV for session operations */
348 
349 #define OBX_LEN_SESS_PARAM_SESS_OP      1
350 #define OBX_LEN_SESS_PARAM_OBJ_OFF      4   /* this value varies, so it needs to be verified on the receiving side */
351 
352 /*
353 ** Define OBEX Request Codes
354 */
355 #define OBX_REQ_CONNECT                         0x00    /* need to set final bit */
356 #define OBX_REQ_DISCONNECT                      0x01    /* need to set final bit */
357 #define OBX_REQ_PUT                             0x02
358 #define OBX_REQ_GET                             0x03
359 #define OBX_REQ_SETPATH                         0x05    /* need to set final bit */
360 #define OBX_REQ_ACTION                          0x06
361 #define OBX_REQ_SESSION                         0x07    /* need to set final bit */
362 #define OBX_REQ_ABORT                           0x7F    /* need to set final bit */
363 #define OBX_FINAL                               0x80
364 
365 /* OBEX response code as defined in IrOBEX spec. version 1.2 */
366 #define OBX_RSP_DEFAULT                         0x00
367 #define OBX_RSP_FAILED                          0x08    /* OBEX failed - not from spec */
368 #define OBX_RSP_CONTINUE                        0x10    /* Continue */
369 #define OBX_RSP_OK                              0x20    /* OK, Success */
370 #define OBX_RSP_CREATED                         0x21    /* Created */
371 #define OBX_RSP_ACCEPTED                        0x22    /* Accepted */
372 #define OBX_RSP_NON_AUTH_INFO                   0x23    /* Non-Authoritative Information */
373 #define OBX_RSP_NO_CONTENT                      0x24    /* No Content */
374 #define OBX_RSP_RESET_CONTENT                   0x25    /* Reset Content */
375 #define OBX_RSP_PART_CONTENT                    0x26    /* Partial Content */
376 #define OBX_RSP_MULTI_CHOICES                   0x30    /* Multiple Choices */
377 #define OBX_RSP_MVD_PERM                        0x31    /* Moved Permanently */
378 #define OBX_RSP_MVD_TEMP                        0x32    /* Moved temporarily */
379 #define OBX_RSP_SEE_OTHER                       0x33    /* See Other */
380 #define OBX_RSP_NOT_MODIFIED                    0x34    /* Not modified */
381 #define OBX_RSP_USE_PROXY                       0x35    /* Use Proxy */
382 #define OBX_RSP_BAD_REQUEST                     0x40    /* Bad Request - server couldn't understand request */
383 #define OBX_RSP_UNAUTHORIZED                    0x41    /* Unauthorized */
384 #define OBX_RSP_PAYMENT_REQD                    0x42    /* Payment required */
385 #define OBX_RSP_FORBIDDEN                       0x43    /* Forbidden - operation is understood but refused */
386 #define OBX_RSP_NOT_FOUND                       0x44    /* Not Found */
387 #define OBX_RSP_NOT_ALLOWED                     0x45    /* Method not allowed */
388 #define OBX_RSP_NOT_ACCEPTABLE                  0x46    /* Not Acceptable */
389 #define OBX_RSP_PROXY_AUTH_REQD                 0x47    /* Proxy Authentication required */
390 #define OBX_RSP_REQUEST_TIMEOUT                 0x48    /* Request Time Out */
391 #define OBX_RSP_CONFLICT                        0x49    /* Conflict */
392 #define OBX_RSP_GONE                            0x4A    /* Gone */
393 #define OBX_RSP_LENGTH_REQD                     0x4B    /* Length Required */
394 #define OBX_RSP_PRECONDTN_FAILED                0x4C    /* Precondition failed */
395 #define OBX_RSP_REQ_ENT_2_LARGE                 0x4D    /* Requested entity too large */
396 #define OBX_RSP_REQ_URL_2_LARGE                 0x4E    /* Request URL too large */
397 #define OBX_RSP_UNSUPTD_TYPE                    0x4F    /* Unsupported media type */
398 #define OBX_RSP_INTRNL_SRVR_ERR                 0x50    /* Internal Server Error */
399 #define OBX_RSP_NOT_IMPLEMENTED                 0x51    /* Not Implemented */
400 #define OBX_RSP_BAD_GATEWAY                     0x52    /* Bad Gateway */
401 #define OBX_RSP_SERVICE_UNAVL                   0x53    /* Service Unavailable */
402 #define OBX_RSP_GATEWAY_TIMEOUT                 0x54    /* Gateway Timeout */
403 #define OBX_RSP_HTTP_VER_NOT_SUPTD              0x55    /* HTTP version not supported */
404 #define OBX_RSP_DATABASE_FULL                   0x60    /* Database Full */
405 #define OBX_RSP_DATABASE_LOCKED                 0x61    /* Database Locked */
406 
407 #define OBX_MAX_OK_RSP      OBX_RSP_PART_CONTENT
408 
409 typedef UINT8   tOBX_RSP_CODE;
410 
411 /* tags for authentication triplet */
412 #define OBX_NONCE_CHLNG_TAG         0
413 #define OBX_OPTIONS_CHLNG_TAG       1
414 #define OBX_REALM_CHLNG_TAG         2
415 
416 #define OBX_DIGEST_RSP_TAG          0
417 #define OBX_USERID_RSP_TAG          1
418 #define OBX_NONCE_RSP_TAG           2
419 
420 typedef struct
421 {
422     UINT8   tag;
423     UINT8   len;
424     UINT8   *p_array;
425 } tOBX_TRIPLET;
426 
427 /* Server Callback type: */
428 typedef void (tOBX_SR_CBACK) (tOBX_HANDLE shandle, tOBX_EVENT event, tOBX_EVT_PARAM param, BT_HDR *p_pkt);
429 /* Client Callback type: */
430 typedef void (tOBX_CL_CBACK) (tOBX_HANDLE handle, tOBX_EVENT event, UINT8 rsp_code, tOBX_EVT_PARAM param, BT_HDR *p_pkt);
431 
432 
433 typedef struct
434 {
435     UINT16  len;                        /* Length of target header. */
436     UINT8   target[OBX_MAX_TARGET_LEN]; /* The byte sequence that describes the target header. */
437 } tOBX_TARGET;
438 
439 
440 typedef struct
441 {
442     tOBX_TARGET     *p_target;
443     tOBX_SR_CBACK   *p_cback;
444     UINT16          mtu;
445     UINT8           scn;            /* The RFCOMM SCN number that this server listens for incoming requests. 0, if do not wish to listen to connection from RFCOMM. */
446     BOOLEAN         authenticate;
447     UINT8           auth_option;
448     UINT8           realm_charset;
449     UINT8           *p_realm;
450     UINT8           realm_len;
451     UINT8           max_sessions;
452     BOOLEAN         get_nonf;       /* report GET non-final request event. If FALSE, GET response is sent automatically */
453     UINT16          psm;            /* The L2CAP PSM number that this server listens for incoming requests. 0, if do not wish to listen to connection from L2CAP. */
454     UINT32          nonce;          /* This is converted to UINT8[16] internally before adding to the OBEX header. This value is copied to the server control block and is increased after each use. 0, if only legacy OBEX (unreliable) session is desired. */
455     BOOLEAN         srm;            /* TRUE, to support single response mode. */
456     UINT8           max_suspend;    /* Max number of suspended session. must be less than OBX_MAX_SUSPEND_SESSIONS. ignored, if nonce is 0 */
457 } tOBX_StartParams;
458 
459 
460 
461 
462 
463 /*****************************************************************************
464 **  External Function Declarations
465 *****************************************************************************/
466 #ifdef __cplusplus
467 extern "C"
468 {
469 #endif
470 
471 /*******************************************************************************
472 **
473 ** Function     OBX_Init
474 **
475 ** Description  This function is called to initialize the control block for this
476 **              layer. It must be called before accessing any other of its API
477 **              functions.  It is typically called once during the start up of
478 **              the stack.
479 **
480 ** Returns      void.
481 **
482 *******************************************************************************/
483 OBX_API extern void OBX_Init(void);
484 
485 /*******************************************************************************
486 **
487 ** Function         OBX_SetTraceLevel
488 **
489 ** Description      This function sets the debug trace level for OBX.
490 **                  If 0xff is passed, the current trace level is returned.
491 **
492 **                  Input Parameters:
493 **                      level:  The level to set the OBX tracing to:
494 **                      0xff-returns the current setting.
495 **                      0-turns off tracing.
496 **                      >= 1-Errors.
497 **                      >= 2-Warnings.
498 **                      >= 3-APIs.
499 **                      >= 4-Events.
500 **                      >= 5-Debug.
501 **
502 ** Returns          The new trace level or current trace level if
503 **                  the input parameter is 0xff.
504 **
505 *******************************************************************************/
506 OBX_API extern UINT8 OBX_SetTraceLevel (UINT8 level);
507 
508 /*******************************************************************************
509 ** Function     OBX_HandleToMtu
510 **
511 ** Description  Given an OBEX handle, return the associated peer MTU.
512 **
513 ** Returns      MTU.
514 **
515 *******************************************************************************/
516 OBX_API extern UINT16 OBX_HandleToMtu(tOBX_HANDLE handle);
517 
518 /* Server API's: */
519 /*******************************************************************************
520 **
521 ** Function     OBX_StartServer
522 **
523 ** Description  This function is to register a server entity to OBEX.
524 **
525 ** Returns      OBX_SUCCESS, if successful.
526 **              OBX_NO_RESOURCES, if OBX does not have resources.
527 **
528 *******************************************************************************/
529 OBX_API extern tOBX_STATUS OBX_StartServer(tOBX_StartParams *p_params, tOBX_HANDLE *p_handle);
530 
531 /*******************************************************************************
532 **
533 ** Function     OBX_StopServer
534 **
535 ** Description  This function is to stop this OBEX server from receiving any
536 **              more incoming requests.
537 **
538 ** Returns      OBX_SUCCESS, if successful.
539 **              OBX_BAD_HANDLE, if the handle is not valid.
540 **
541 *******************************************************************************/
542 OBX_API extern tOBX_STATUS OBX_StopServer(tOBX_HANDLE handle);
543 
544 /*******************************************************************************
545 **
546 ** Function     OBX_AddSuspendedSession
547 **
548 ** Description  This function is to add the session information for a previously
549 **				suspended reliable session to the server control block
550 **
551 ** Returns      OBX_SUCCESS, if successful.
552 **              OBX_BAD_HANDLE, if the handle is not valid.
553 **
554 *******************************************************************************/
555 OBX_API extern tOBX_STATUS OBX_AddSuspendedSession(tOBX_HANDLE shandle, BD_ADDR peer_addr, UINT8 *p_sess_info,
556                                                    UINT32 timeout, UINT8 ssn, UINT32 offset);
557 
558 /*******************************************************************************
559 **
560 ** Function     OBX_ConnectRsp
561 **
562 ** Description  This function is called to send the response to a Connect
563 **              Request from an OBEX client.
564 **
565 ** Returns      OBX_SUCCESS, if successful.
566 **              OBX_BAD_HANDLE, if the handle is not valid.
567 **
568 *******************************************************************************/
569 OBX_API extern tOBX_STATUS OBX_ConnectRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
570 
571 /*******************************************************************************
572 **
573 ** Function     OBX_SessionRsp
574 **
575 ** Description  This function is called to respond to a request to create a reliable session.
576 **
577 **
578 ** Returns      OBX_SUCCESS, if successful.
579 **              OBX_BAD_HANDLE, if the handle is not valid.
580 **
581 *******************************************************************************/
582 OBX_API extern tOBX_STATUS OBX_SessionRsp(tOBX_HANDLE shandle, UINT8 rsp_code,
583                                           UINT8 ssn, UINT32 offset, BT_HDR *p_pkt);
584 
585 /*******************************************************************************
586 **
587 ** Function     OBX_SetPathRsp
588 **
589 ** Description  This function is called to send the response to a Set Path
590 **              Request from an OBEX client.
591 **
592 ** Returns      OBX_SUCCESS, if successful.
593 **              OBX_BAD_HANDLE, if the handle is not valid.
594 **
595 *******************************************************************************/
596 OBX_API extern tOBX_STATUS OBX_SetPathRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
597 
598 /*******************************************************************************
599 **
600 ** Function     OBX_PutRsp
601 **
602 ** Description  This function is called to send the response to a Put
603 **              Request from an OBEX client.
604 **
605 ** Returns      OBX_SUCCESS, if successful.
606 **              OBX_BAD_HANDLE, if the handle is not valid.
607 **
608 *******************************************************************************/
609 OBX_API extern tOBX_STATUS OBX_PutRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
610 
611 /*******************************************************************************
612 **
613 ** Function     OBX_GetRsp
614 **
615 ** Description  This function is called to send the response to a Get
616 **              Request from an OBEX client.
617 **
618 ** Returns      OBX_SUCCESS, if successful.
619 **              OBX_BAD_HANDLE, if the handle is not valid.
620 **
621 *******************************************************************************/
622 OBX_API extern tOBX_STATUS OBX_GetRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
623 
624 /*******************************************************************************
625 **
626 ** Function     OBX_AbortRsp
627 **
628 ** Description  This function is called to send the response to an Abort
629 **              Request from an OBEX client.
630 **
631 ** Returns      OBX_SUCCESS, if successful.
632 **              OBX_BAD_HANDLE, if the handle is not valid.
633 **
634 *******************************************************************************/
635 OBX_API extern tOBX_STATUS OBX_AbortRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
636 
637 /*******************************************************************************
638 **
639 ** Function     OBX_ActionRsp
640 **
641 ** Description  This function is called to respond to an Action command Request
642 **              from an OBEX client.
643 **
644 ** Returns      OBX_SUCCESS, if successful.
645 **              OBX_BAD_HANDLE, if the handle is not valid.
646 **
647 *******************************************************************************/
648 OBX_API extern tOBX_STATUS OBX_ActionRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
649 
650 /*******************************************************************************
651 **
652 ** Function     OBX_DisconnectRsp
653 **
654 ** Description  This function is called to send the response to a Disconnect
655 **              Request from an OBEX client.
656 **              This function can also be used to force close the transport
657 **              to a connected client.
658 **
659 ** Returns      OBX_SUCCESS, if successful.
660 **              OBX_BAD_HANDLE, if the handle is not valid.
661 **
662 *******************************************************************************/
663 OBX_API extern tOBX_STATUS OBX_DisconnectRsp(tOBX_HANDLE shandle, UINT8 rsp_code, BT_HDR *p_pkt);
664 
665 /*******************************************************************************
666 **
667 ** Function     OBX_Password
668 **
669 ** Description  This function is called to respond to an OBX_PASSWORD_EVT event.
670 **
671 ** Returns      OBX_SUCCESS, if successful.
672 **              OBX_NO_RESOURCES, if OBX does not resources
673 **
674 *******************************************************************************/
675 OBX_API extern tOBX_STATUS OBX_Password(tOBX_HANDLE shandle, UINT8 *p_password, UINT8 password_len,
676                                         UINT8 *p_userid, UINT8 userid_len);
677 
678 /*******************************************************************************
679 **
680 ** Function     OBX_GetPeerAddr
681 **
682 ** Description  This function is called to learn the Bluetooth address of the
683 **              connected device.
684 **
685 ** Returns      L2CAP channel ID.
686 **
687 *******************************************************************************/
688 OBX_API extern UINT16 OBX_GetPeerAddr(tOBX_HANDLE shandle, BD_ADDR bd_addr);
689 
690 /*******************************************************************************
691 **
692 ** Function     OBX_GetPortHandle
693 **
694 ** Description  This function is called to get the RFCOMM port handle for the obex connection.
695 **
696 **
697 ** Returns      OBX_SUCCESS, if successful.
698 **              OBX_NO_RESOURCES, if no existing connection.
699 **              OBX_BAD_HANDLE, if the handle is not valid.
700 **
701 *******************************************************************************/
702 OBX_API extern tOBX_STATUS OBX_GetPortHandle(tOBX_HANDLE handle, UINT16 *port_handle);
703 
704 /* Client API's: */
705 /*******************************************************************************
706 **
707 ** Function     OBX_ConnectReq
708 **
709 ** Description  This function registers a client entity to OBEX and sends a
710 **              CONNECT request to the server specified by the API parameters.
711 **
712 ** Returns      OBX_SUCCESS, if successful.
713 **              OBX_NO_RESOURCES, if OBX does not resources
714 **
715 *******************************************************************************/
716 OBX_API extern tOBX_STATUS OBX_ConnectReq(BD_ADDR bd_addr, UINT8 scn, UINT16 mtu,
717                                           tOBX_CL_CBACK *p_cback, tOBX_HANDLE *p_handle, BT_HDR *p_pkt);
718 
719 /*******************************************************************************
720 **
721 ** Function     OBX_AllocSession
722 **
723 ** Description  This function registers a client entity to OBEX.
724 **              If p_session_id is not NULL, it tries to find an suspended session
725 **                  with matching session_id.
726 **              If scn is not 0, it allocates a control block for this new session.
727 **              Otherwise, it allocates a control block for the given PSM.
728 **              The associated virtual PSM assigned by L2CAP is returned in p_psm
729 **              The allocated OBEX handle is returned in p_handle.
730 **
731 ** Returns      OBX_SUCCESS, if successful.
732 **              OBX_NO_RESOURCES, if OBX does not resources
733 **
734 *******************************************************************************/
735 OBX_API extern tOBX_STATUS OBX_AllocSession (UINT8 *p_session_info, UINT8 scn, UINT16 *p_psm,
736                               tOBX_CL_CBACK *p_cback, tOBX_HANDLE *p_handle);
737 
738 /*******************************************************************************
739 **
740 ** Function     OBX_CreateSession
741 **
742 ** Description  This function registers a client entity to OBEX.
743 **              It may send a CreateSession request and wait for CreateSession response.
744 **              It sends a CONNECT request to the server specified by the API parameters.
745 **
746 ** Returns      OBX_SUCCESS, if successful.
747 **              OBX_NO_RESOURCES, if OBX does not resources
748 **
749 *******************************************************************************/
750 OBX_API extern tOBX_STATUS OBX_CreateSession (BD_ADDR bd_addr, UINT16 mtu, BOOLEAN srm, UINT32 nonce,
751                                               tOBX_HANDLE handle, BT_HDR *p_pkt);
752 
753 /*******************************************************************************
754 **
755 ** Function     OBX_ResumeSession
756 **
757 ** Description  This function registers a client entity to OBEX and resumes
758 **              a previously interrupted reliable session.
759 **
760 ** Returns      OBX_SUCCESS, if successful.
761 **              OBX_NO_RESOURCES, if OBX does not resources
762 **
763 *******************************************************************************/
764 OBX_API extern tOBX_STATUS OBX_ResumeSession (BD_ADDR bd_addr, UINT8 ssn, UINT32 offset, tOBX_HANDLE handle);
765 
766 /*******************************************************************************
767 **
768 ** Function     OBX_SessionReq
769 **
770 ** Description  This function is used to Suspend, Resume, or Close a session.
771 **              For Resume: this function registers a client entity to OBEX and resumes
772 **              a previously interrupted reliable session.
773 **
774 ** Returns      OBX_SUCCESS, if successful.
775 **              OBX_NO_RESOURCES, if OBX does not resources
776 **
777 *******************************************************************************/
778 OBX_API extern tOBX_STATUS OBX_SessionReq (tOBX_HANDLE handle, tOBX_SESS_OP opcode, UINT32 timeout);
779 
780 /*******************************************************************************
781 **
782 ** Function     OBX_SetPathReq
783 **
784 ** Description  This function sends a Set Path request to the connected server.
785 **
786 ** Returns      OBX_SUCCESS, if successful.
787 **              OBX_BAD_HANDLE, if the handle is not valid.
788 **
789 *******************************************************************************/
790 OBX_API extern tOBX_STATUS OBX_SetPathReq(tOBX_HANDLE handle, UINT8 flags, BT_HDR *p_pkt);
791 
792 /*******************************************************************************
793 **
794 ** Function     OBX_PutReq
795 **
796 ** Description  This function sends a Put request to the connected server.
797 **
798 ** Returns      OBX_SUCCESS, if successful.
799 **              OBX_BAD_HANDLE, if the handle is not valid.
800 **
801 *******************************************************************************/
802 OBX_API extern tOBX_STATUS OBX_PutReq(tOBX_HANDLE handle, BOOLEAN final, BT_HDR *p_pkt);
803 
804 /*******************************************************************************
805 **
806 ** Function     OBX_GetReq
807 **
808 ** Description  This function sends a Get request to the connected server.
809 **
810 ** Returns      OBX_SUCCESS, if successful.
811 **              OBX_BAD_HANDLE, if the handle is not valid.
812 **
813 *******************************************************************************/
814 OBX_API extern tOBX_STATUS OBX_GetReq(tOBX_HANDLE handle, BOOLEAN final, BT_HDR *p_pkt);
815 
816 /*******************************************************************************
817 **
818 ** Function     OBX_AbortReq
819 **
820 ** Description  This function sends an Abort request to the connected server.
821 **
822 ** Returns      OBX_SUCCESS, if successful.
823 **              OBX_BAD_HANDLE, if the handle is not valid.
824 **
825 *******************************************************************************/
826 OBX_API extern tOBX_STATUS OBX_AbortReq(tOBX_HANDLE handle, BT_HDR *p_pkt);
827 
828 /*******************************************************************************
829 **
830 ** Function     OBX_DisconnectReq
831 **
832 ** Description  This function sends a Disconnect request to the connected server.
833 **
834 ** Returns      OBX_SUCCESS, if successful.
835 **              OBX_BAD_HANDLE, if the handle is not valid.
836 **
837 *******************************************************************************/
838 OBX_API extern tOBX_STATUS OBX_DisconnectReq(tOBX_HANDLE handle, BT_HDR *p_pkt);
839 
840 /*******************************************************************************
841 **
842 ** Function     OBX_ActionReq
843 **
844 ** Description  This function sends a Action request to the connected server.
845 **              The Name Header and DestName Header must be in p_pkt for
846 **                  the Copy and Move Object action.
847 **              The Name header and Permission Header must be in p_pkt for
848 **                  the Set Object Permission action.
849 **
850 ** Returns      OBX_SUCCESS, if successful.
851 **              OBX_BAD_HANDLE, if the handle is not valid.
852 **
853 *******************************************************************************/
854 OBX_API extern tOBX_STATUS OBX_ActionReq(tOBX_HANDLE handle, tOBX_ACTION action_id, BT_HDR *p_pkt);
855 
856 /*******************************************************************************
857 **
858 ** Function     OBX_AuthResponse
859 **
860 ** Description  This function is called to respond to an OBX_PASSWORD_EVT event.
861 **
862 ** Returns      OBX_SUCCESS, if successful.
863 **              OBX_NO_RESOURCES, if OBX does not resources
864 **
865 *******************************************************************************/
866 OBX_API extern tOBX_STATUS OBX_AuthResponse(tOBX_HANDLE handle,
867                                             UINT8 *p_password, UINT8 password_len,
868                                             UINT8 *p_userid, UINT8 userid_len,
869                                             BOOLEAN authenticate);
870 
871 
872 /*******************************************************************************
873 **
874 ** Function     OBX_HdrInit
875 **
876 ** Description  This function is called to initialize an OBEX packet. This
877 **              function takes a GKI buffer and sets the offset in BT_HDR as
878 **              OBEX_HDR_OFFSET, the len as 0. The layer_specific is set to the
879 **              length still available. This function compares the given
880 **              (pkt_size - sizeof(BT_HDR)) with the peer MTU to get the lesser
881 **              of the two and set the layer_specific to
882 **              (lesser_size - OBEX_HDR_OFFSET).
883 **              If composing a header for the CONNECT request (there is no
884 **              client handle yet), use OBX_HANDLE_NULL as the handle.
885 **
886 ** Returns      BT_HDR *.
887 **
888 *******************************************************************************/
889 OBX_API extern BT_HDR * OBX_HdrInit(tOBX_HANDLE handle, UINT16 pkt_size);
890 
891 /*******************************************************************************
892 **
893 ** Function     OBX_AddNameHdr
894 **
895 ** Description  This function is called to add an OBEX Name header
896 **              to an OBEX packet.
897 **
898 ** Returns      TRUE, if the header is added successfully.
899 **              FALSE, if the operation failed. p_pkt is not altered.
900 **
901 *******************************************************************************/
902 OBX_API extern BOOLEAN OBX_AddNameHdr(BT_HDR *p_pkt, UINT16 *p_name, UINT16 len);
903 
904 /*******************************************************************************
905 **
906 ** Function     OBX_CharToWchar
907 **
908 ** Description  This function is called to convert ASCII to Unicode (UINT16).
909 **
910 ** Returns      the length.
911 **
912 *******************************************************************************/
913 OBX_API extern UINT16 OBX_CharToWchar (UINT16 *w_str, char* a_str, UINT16 w_size);
914 
915 /*******************************************************************************
916 **
917 ** Function     OBX_AddAsciiNameHdr
918 **
919 ** Description  This function is called to add an OBEX Name header
920 **              to an OBEX packet.
921 **
922 ** Returns      TRUE, if the header is added successfully.
923 **              FALSE, if the operation failed. p_pkt is not altered.
924 **
925 *******************************************************************************/
926 OBX_API extern BOOLEAN OBX_AddAsciiNameHdr(BT_HDR *p_pkt, char *p_name);
927 
928 /*******************************************************************************
929 **
930 ** Function     OBX_AddTypeHdr
931 **
932 ** Description  This function is called to add an OBEX Type header
933 **              to an OBEX packet.
934 **
935 ** Returns      TRUE, if the header is added successfully.
936 **              FALSE, if the operation failed. p_pkt is not altered.
937 **
938 *******************************************************************************/
939 OBX_API extern BOOLEAN OBX_AddTypeHdr(BT_HDR *p_pkt, char *p_type);
940 
941 /*******************************************************************************
942 **
943 ** Function     OBX_AddLengthHdr
944 **
945 ** Description  This function is called to add an OBEX Length header to an OBEX
946 **              packet. The Length header describes the total length in bytes of
947 **              the object.
948 **
949 ** Returns      TRUE, if the header is added successfully.
950 **              FALSE, if the operation failed. p_pkt is not altered.
951 **
952 *******************************************************************************/
953 OBX_API extern BOOLEAN OBX_AddLengthHdr(BT_HDR *p_pkt, UINT32 len);
954 
955 /*******************************************************************************
956 **
957 ** Function     OBX_AddTimeHdr
958 **
959 ** Description  This function is called to add an OBEX Time header
960 **              to an OBEX packet.
961 **
962 ** Returns      TRUE, if the header is added successfully.
963 **              FALSE, if the operation failed. p_pkt is not altered.
964 **
965 *******************************************************************************/
966 OBX_API extern BOOLEAN OBX_AddTimeHdr(BT_HDR *p_pkt, char *p_time);
967 
968 /*******************************************************************************
969 **
970 ** Function     OBX_AddDescrHdr
971 **
972 ** Description  This function is called to add an OBEX Description header
973 **              to an OBEX packet.
974 **
975 ** Returns      TRUE, if the header is added successfully.
976 **              FALSE, if the operation failed. p_pkt is not altered.
977 **
978 *******************************************************************************/
979 OBX_API extern BOOLEAN OBX_AddDescrHdr(BT_HDR *p_pkt, UINT16 *p_descr, UINT16 len);
980 
981 /*******************************************************************************
982 **
983 ** Function     OBX_AddAsciiDescrHdr
984 **
985 ** Description  This function is called to add an OBEX Description header
986 **              to an OBEX packet.
987 **
988 ** Returns      TRUE, if the header is added successfully.
989 **              FALSE, if the operation failed. p_pkt is not altered.
990 **
991 *******************************************************************************/
992 OBX_API extern BOOLEAN OBX_AddAsciiDescrHdr(BT_HDR *p_pkt, char *p_descr);
993 
994 /*******************************************************************************
995 **
996 ** Function     OBX_AddTargetHdr
997 **
998 ** Description  This function is called to add an OBEX Target header to an OBEX
999 **              packet. This header is most commonly used in Connect packets.
1000 **
1001 **              NOTE: The target header must be the first header in an OBEX message.
1002 **
1003 ** Returns      TRUE, if the header is added successfully.
1004 **              FALSE, if the operation failed. p_pkt is not altered.
1005 **
1006 *******************************************************************************/
1007 OBX_API extern BOOLEAN OBX_AddTargetHdr(BT_HDR *p_pkt, UINT8 *p_target, UINT16 len);
1008 
1009 /*******************************************************************************
1010 **
1011 ** Function     OBX_AddHttpHdr
1012 **
1013 ** Description  This function is called to add an OBEX HTTP header
1014 **              to an OBEX packet.
1015 **
1016 ** Returns      TRUE, if the header is added successfully.
1017 **              FALSE, if the operation failed. p_pkt is not altered.
1018 **
1019 *******************************************************************************/
1020 OBX_API extern BOOLEAN OBX_AddHttpHdr(BT_HDR *p_pkt, UINT8 *p_http, UINT16 len);
1021 
1022 /*******************************************************************************
1023 **
1024 ** Function     OBX_AddBodyHdr
1025 **
1026 ** Description  This function is called to add an OBEX body header
1027 **              to an OBEX packet.
1028 **
1029 **              NOTE: The body header must be the last header in an OBEX message.
1030 **
1031 ** Returns      TRUE, if the header is added successfully.
1032 **              FALSE, if the operation failed. p_pkt is not altered.
1033 **
1034 *******************************************************************************/
1035 OBX_API extern BOOLEAN OBX_AddBodyHdr(BT_HDR *p_pkt, UINT8 *p_body, UINT16 len, BOOLEAN end);
1036 
1037 /* Alternate Body header functions: for non-blocking scenario */
1038 /*******************************************************************************
1039 **
1040 ** Function     OBX_AddBodyStart
1041 **
1042 ** Description  This function is called to get the address to the beginning of
1043 **              the byte sequence for an OBEX body header in an OBEX packet.
1044 **
1045 ** Returns      The address to add body content.
1046 **
1047 *******************************************************************************/
1048 OBX_API extern UINT8 *OBX_AddBodyStart(BT_HDR *p_pkt, UINT16 *p_len);
1049 
1050 /*******************************************************************************
1051 **
1052 ** Function     OBX_AddBodyEnd
1053 **
1054 ** Description  This function is called to add the HI and the length of HV of an
1055 **              OBEX body header to an OBEX packet. If end is TRUE, HI is
1056 **              OBX_HI_BODY_END. If FALSE, HI is OBX_HI_BODY. It is assumed that
1057 **              the actual value of the body has been copied into the OBEX packet.
1058 **
1059 ** Returns      void
1060 **
1061 *******************************************************************************/
1062 OBX_API extern void OBX_AddBodyEnd(BT_HDR *p_pkt, UINT8 *p, UINT16 len, BOOLEAN end);
1063 
1064 /*******************************************************************************
1065 **
1066 ** Function     OBX_AddWhoHdr
1067 **
1068 ** Description  This function is called to add an OBEX Who header to an OBEX
1069 **              packet.
1070 **
1071 ** Note:        Who header is typically used in an OBEX CONNECT response packet
1072 **              to indicate the UUID of the service that has accepted the
1073 **              directed connection. If the server calls OBX_StartServer() with
1074 **              specified target header, this OBEX implementation automatically
1075 **              adds this WHO header to the CONNECT response packet. If
1076 **              OBX_StartServer() is called with target header length as 0, the
1077 **              OBEX API user is responsible to add the WHO header.
1078 **
1079 ** Returns      TRUE, if the header is added successfully.
1080 **              FALSE, if the operation failed. p_pkt is not altered.
1081 **
1082 *******************************************************************************/
1083 OBX_API extern BOOLEAN OBX_AddWhoHdr(BT_HDR *p_pkt, UINT8 *p_who, UINT16 len);
1084 
1085 /*******************************************************************************
1086 **
1087 ** Function     OBX_AddAppParamHdr
1088 **
1089 ** Description  This function is called to add an OBEX Application Parameter
1090 **              header to an OBEX packet. This header is used by the application
1091 **              layer above OBEX to convey application specific information.
1092 **
1093 ** Returns      TRUE, if the header is added successfully.
1094 **              FALSE, if the operation failed. p_pkt is not altered.
1095 **
1096 *******************************************************************************/
1097 OBX_API extern BOOLEAN OBX_AddAppParamHdr(BT_HDR *p_pkt, tOBX_TRIPLET *p_triplet, UINT8 num);
1098 
1099 /*******************************************************************************
1100 **
1101 ** Function     OBX_AddDestNameHdr
1102 **
1103 ** Description  This function is called to add an OBEX DestName header
1104 **              to an OBEX packet.
1105 **
1106 ** Returns      TRUE, if the header is added successfully.
1107 **              FALSE, if the operation failed. p_pkt is not altered.
1108 **
1109 *******************************************************************************/
1110 OBX_API extern BOOLEAN OBX_AddDestNameHdr(BT_HDR *p_pkt, UINT16 *p_dest, UINT16 len);
1111 
1112 /*******************************************************************************
1113 **
1114 ** Function     OBX_AddAsciiDestNameHdr
1115 **
1116 ** Description  This function is called to add an OBEX DestName header
1117 **              to an OBEX packet.
1118 **
1119 ** Returns      TRUE, if the header is added successfully.
1120 **              FALSE, if the operation failed. p_pkt is not altered.
1121 **
1122 *******************************************************************************/
1123 OBX_API extern BOOLEAN OBX_AddAsciiDestNameHdr(BT_HDR *p_pkt, char *p_descr);
1124 
1125 /*******************************************************************************
1126 **
1127 ** Function     OBX_AddPermissionHdr
1128 **
1129 ** Description  This function is called to add an OBEX Permission header to an OBEX
1130 **              packet.
1131 **              bit 0 is set for read permission
1132 **              bit 1 is set for write permission
1133 **              bit 2 is set for delete permission
1134 **              bit 7 is set for modify permission
1135 **
1136 ** Returns      TRUE, if the header is added successfully.
1137 **              FALSE, if the operation failed. p_pkt is not altered.
1138 **
1139 *******************************************************************************/
1140 OBX_API extern BOOLEAN OBX_AddPermissionHdr(BT_HDR *p_pkt, UINT8 user, UINT8 group, UINT8 other);
1141 
1142 /*******************************************************************************
1143 **
1144 ** Function     OBX_Add1ByteHdr
1145 **
1146 ** Description  This function is called to add a header with type as UINT8
1147 **              to an OBEX packet.
1148 **
1149 ** Returns      TRUE, if the header is added successfully.
1150 **              FALSE, if the operation failed. p_pkt is not altered.
1151 **
1152 *******************************************************************************/
1153 OBX_API extern BOOLEAN OBX_Add1ByteHdr(BT_HDR *p_pkt, UINT8 id, UINT8 data);
1154 
1155 /*******************************************************************************
1156 **
1157 ** Function     OBX_Add4ByteHdr
1158 **
1159 ** Description  This function is called to add a header with type as UINT32
1160 **              to an OBEX packet.
1161 **
1162 ** Returns      TRUE, if the header is added successfully.
1163 **              FALSE, if the operation failed. p_pkt is not altered.
1164 **
1165 *******************************************************************************/
1166 OBX_API extern BOOLEAN OBX_Add4ByteHdr(BT_HDR *p_pkt, UINT8 id, UINT32 data);
1167 
1168 /*******************************************************************************
1169 **
1170 ** Function     OBX_AddByteStrStart
1171 **
1172 ** Description  This function is called to get the address to the beginning of
1173 **              the byte sequence for an OBEX header in an OBEX packet.
1174 **
1175 ** Returns      The address to add the byte sequence.
1176 **
1177 *******************************************************************************/
1178 OBX_API extern UINT8 *OBX_AddByteStrStart(BT_HDR *p_pkt, UINT16 *p_len);
1179 
1180 /*******************************************************************************
1181 **
1182 ** Function     OBX_AddByteStrHdr
1183 **
1184 ** Description  This function is called to add a header with type as byte sequence
1185 **              to an OBEX packet.
1186 **
1187 ** Returns      TRUE, if the header is added successfully.
1188 **              FALSE, if the operation failed. p_pkt is not altered.
1189 **
1190 *******************************************************************************/
1191 OBX_API extern BOOLEAN OBX_AddByteStrHdr(BT_HDR *p_pkt, UINT8 id, UINT8 *p_data, UINT16 len);
1192 
1193 /*******************************************************************************
1194 **
1195 ** Function     OBX_AddUnicodeHdr
1196 **
1197 ** Description  This function is called to add a header with type as Unicode string
1198 **              to an OBEX packet.
1199 **
1200 ** Returns      TRUE, if the header is added successfully.
1201 **              FALSE, if the operation failed. p_pkt is not altered.
1202 **
1203 *******************************************************************************/
1204 OBX_API extern BOOLEAN OBX_AddUnicodeHdr(BT_HDR *p_pkt, UINT8 id, UINT16 *p_data, UINT16 len);
1205 
1206 /*******************************************************************************
1207 **
1208 ** Function     OBX_AddTriplet
1209 **
1210 ** Description  This function is called to add a header with type as byte sequence
1211 **              to an OBEX packet.
1212 **
1213 ** Note:        The byte sequence uses a Tag-Length-Value encoding scheme
1214 **              These headers include: Application Parameters header
1215 **                                     Authenticate Challenge header
1216 **                                     Authenticate Response header
1217 **
1218 ** Returns      TRUE, if the header is added successfully.
1219 **              FALSE, if the operation failed. p_pkt is not altered.
1220 **
1221 *******************************************************************************/
1222 OBX_API extern BOOLEAN OBX_AddTriplet(BT_HDR *p_pkt, UINT8 id, tOBX_TRIPLET *p_triplet, UINT8 num);
1223 
1224 /*******************************************************************************
1225 **
1226 ** Function     OBX_CheckHdr
1227 **
1228 ** Description  This function is called to check if the given OBEX packet
1229 **              contains the specified header.
1230 **
1231 ** Returns      NULL, if the header is not in the OBEX packet.
1232 **              The pointer to the specified header beginning from HI.
1233 **
1234 *******************************************************************************/
1235 OBX_API extern UINT8 * OBX_CheckHdr(BT_HDR *p_pkt, UINT8 id);
1236 
1237 /*******************************************************************************
1238 **
1239 ** Function     OBX_ReadNumHdrs
1240 **
1241 ** Description  This function is called to check the number of headers in the
1242 **              given OBEX packet
1243 **
1244 ** Returns      number of headers.
1245 **
1246 *******************************************************************************/
1247 OBX_API extern UINT8 OBX_ReadNumHdrs(BT_HDR *p_pkt, UINT8 *p_num_body);
1248 
1249 /*******************************************************************************
1250 **
1251 ** Function     OBX_ReadHdrLen
1252 **
1253 ** Description  This function is called to check the length of the specified
1254 **              header in the given OBEX packet.
1255 **
1256 ** Returns      OBX_INVALID_HDR_LEN, if the header is not in the OBEX packet.
1257 **              Otherwise the actual length of the header.
1258 **
1259 *******************************************************************************/
1260 OBX_API extern UINT16 OBX_ReadHdrLen(BT_HDR *p_pkt, UINT8 id);
1261 
1262 /*******************************************************************************
1263 **
1264 ** Function     OBX_ReadNameHdr
1265 **
1266 ** Description  This function is called to get the Name Header in the given
1267 **              OBEX packet.
1268 **
1269 ** Returns      TRUE, if the header is in the OBEX packet.
1270 **              FALSE, otherwise.
1271 **
1272 *******************************************************************************/
1273 OBX_API extern BOOLEAN OBX_ReadNameHdr(BT_HDR *p_pkt, UINT16 *p_name, UINT16 *p_len);
1274 
1275 /*******************************************************************************
1276 **
1277 ** Function     OBX_WcharToChar
1278 **
1279 ** Description  This function is called to convert Unicode (UINT16) to ASCII.
1280 **
1281 ** Returns      void.
1282 **
1283 *******************************************************************************/
1284 OBX_API extern void OBX_WcharToChar (char *a_str, UINT16* w_str, UINT16 a_size) ;
1285 
1286 /*******************************************************************************
1287 **
1288 ** Function     OBX_ReadAsciiNameHdr
1289 **
1290 ** Description  This function is called to get the Name Header in the given
1291 **              OBEX packet. If Name header exists in the given OBEX packet,
1292 **              it is converted to ASCII format and copied into p_name.
1293 **
1294 ** Returns      TRUE, if the header is in the OBEX packet.
1295 **              FALSE, otherwise.
1296 **
1297 *******************************************************************************/
1298 OBX_API extern BOOLEAN OBX_ReadAsciiNameHdr(BT_HDR *p_pkt, char *p_name, UINT16 max_len);
1299 
1300 /*******************************************************************************
1301 **
1302 ** Function     OBX_ReadTypeHdr
1303 **
1304 ** Description  This function is called to get the Type Header in the given
1305 **              OBEX packet.
1306 **
1307 ** Returns      TRUE, if the header is in the OBEX packet.
1308 **              FALSE, otherwise.
1309 **
1310 *******************************************************************************/
1311 OBX_API extern BOOLEAN OBX_ReadTypeHdr(BT_HDR *p_pkt, UINT8 **p_type, UINT16 *p_len);
1312 
1313 /*******************************************************************************
1314 **
1315 ** Function     OBX_ReadLengthHdr
1316 **
1317 ** Description  This function is called to get the Length Header in the given
1318 **              OBEX packet.
1319 **
1320 ** Returns      TRUE, if the header is in the OBEX packet.
1321 **              FALSE, otherwise.
1322 **
1323 *******************************************************************************/
1324 OBX_API extern BOOLEAN OBX_ReadLengthHdr(BT_HDR *p_pkt, UINT32 *p_len);
1325 
1326 /*******************************************************************************
1327 **
1328 ** Function     OBX_ReadTimeHdr
1329 **
1330 ** Description  This function is called to get the Time Header in the given
1331 **              OBEX packet.
1332 **
1333 ** Returns      TRUE, if the header is in the OBEX packet.
1334 **              FALSE, otherwise.
1335 **
1336 *******************************************************************************/
1337 OBX_API extern BOOLEAN OBX_ReadTimeHdr(BT_HDR *p_pkt, UINT8 **p_time, UINT16 *p_len);
1338 
1339 /*******************************************************************************
1340 **
1341 ** Function     OBX_ReadDescrHdr
1342 **
1343 ** Description  This function is called to get the Description Header in the
1344 **              given OBEX packet.
1345 **
1346 ** Returns      TRUE, if the header is in the OBEX packet.
1347 **              FALSE, otherwise.
1348 **
1349 *******************************************************************************/
1350 OBX_API extern BOOLEAN OBX_ReadDescrHdr(BT_HDR *p_pkt, UINT16 *p_descr, UINT16 *p_len);
1351 
1352 /*******************************************************************************
1353 **
1354 ** Function     OBX_ReadDestNameHdr
1355 **
1356 ** Description  This function is called to get the DestName Header in the
1357 **              given OBEX packet.
1358 **
1359 ** Returns      TRUE, if the header is in the OBEX packet.
1360 **              FALSE, otherwise.
1361 **
1362 *******************************************************************************/
1363 OBX_API extern BOOLEAN OBX_ReadDestNameHdr(BT_HDR *p_pkt, UINT16 *p_dest, UINT16 *p_len);
1364 
1365 /*******************************************************************************
1366 **
1367 ** Function     OBX_ReadAsciiDescrHdr
1368 **
1369 ** Description  This function is called to get the Description Header in the
1370 **              given OBEX packet. If Description header exists in the given
1371 **              OBEX packet, it is converted to ASCII format and copied into
1372 **              p_descr.
1373 **
1374 ** Returns      TRUE, if the header is in the OBEX packet.
1375 **              FALSE, otherwise.
1376 **
1377 *******************************************************************************/
1378 OBX_API extern BOOLEAN OBX_ReadAsciiDescrHdr(BT_HDR *p_pkt, char *p_descr, UINT16 max_len);
1379 
1380 /*******************************************************************************
1381 **
1382 ** Function     OBX_ReadAsciiDestNameHdr
1383 **
1384 ** Description  This function is called to get the DestName Header in the
1385 **              given OBEX packet. If DestName header exists in the given
1386 **              OBEX packet, it is converted to ASCII format and copied into
1387 **              p_descr.
1388 **
1389 ** Returns      TRUE, if the header is in the OBEX packet.
1390 **              FALSE, otherwise.
1391 **
1392 *******************************************************************************/
1393 OBX_API extern BOOLEAN OBX_ReadAsciiDestNameHdr(BT_HDR *p_pkt, char *p_dest, UINT16 max_len);
1394 
1395 /*******************************************************************************
1396 **
1397 ** Function     OBX_ReadTargetHdr
1398 **
1399 ** Description  This function is called to get the Target Header in the
1400 **              given OBEX packet.
1401 **
1402 ** Returns      TRUE, if the header is in the OBEX packet.
1403 **              FALSE, otherwise.
1404 **
1405 *******************************************************************************/
1406 OBX_API extern BOOLEAN OBX_ReadTargetHdr(BT_HDR *p_pkt, UINT8 **p_target, UINT16 *p_len, UINT8 next);
1407 
1408 /*******************************************************************************
1409 **
1410 ** Function     OBX_ReadHttpHdr
1411 **
1412 ** Description  This function is called to get the HTTP Header in the
1413 **              given OBEX packet.
1414 **
1415 ** Returns      TRUE, if the header is in the OBEX packet.
1416 **              FALSE, otherwise.
1417 **
1418 *******************************************************************************/
1419 OBX_API extern BOOLEAN OBX_ReadHttpHdr(BT_HDR *p_pkt, UINT8 **p_http, UINT16 *p_len, UINT8 next);
1420 
1421 /*******************************************************************************
1422 **
1423 ** Function     OBX_ReadBodyHdr
1424 **
1425 ** Description  This function is called to get the Body Header in the
1426 **              given OBEX packet.
1427 **
1428 ** Returns      1, if a single header is in the OBEX packet.
1429 **              2, if a end of body header is in the OBEX packet.
1430 **              0, (FALSE) otherwise.
1431 **
1432 *******************************************************************************/
1433 OBX_API extern UINT8 OBX_ReadBodyHdr(BT_HDR *p_pkt, UINT8 **p_body, UINT16 *p_len, BOOLEAN *p_end);
1434 
1435 /*******************************************************************************
1436 **
1437 ** Function     OBX_ReadWhoHdr
1438 **
1439 ** Description  This function is called to get the Who Header in the
1440 **              given OBEX packet.
1441 **
1442 ** Returns      TRUE, if the header is in the OBEX packet.
1443 **              FALSE, otherwise.
1444 **
1445 *******************************************************************************/
1446 OBX_API extern BOOLEAN OBX_ReadWhoHdr(BT_HDR *p_pkt, UINT8 **p_who, UINT16 *p_len);
1447 
1448 /*******************************************************************************
1449 **
1450 ** Function     OBX_ReadAppParamHdr
1451 **
1452 ** Description  This function is called to get the Application Parameter Header
1453 **              in the given OBEX packet.
1454 **
1455 ** Returns      TRUE, if the header is in the OBEX packet.
1456 **              FALSE, otherwise.
1457 **
1458 *******************************************************************************/
1459 OBX_API extern BOOLEAN OBX_ReadAppParamHdr(BT_HDR *p_pkt, UINT8 *p_tag, UINT8 **p_app_param, UINT8 *p_len, UINT8 next);
1460 
1461 /*******************************************************************************
1462 **
1463 ** Function     OBX_ReadPermissionHdr
1464 **
1465 ** Description  This function is called to get the Application Parameter Header
1466 **              in the given OBEX packet.
1467 **
1468 ** Returns      TRUE, if the header is in the OBEX packet.
1469 **              FALSE, otherwise.
1470 **
1471 *******************************************************************************/
1472 OBX_API extern BOOLEAN OBX_ReadPermissionHdr(BT_HDR *p_pkt, UINT8 *p_user, UINT8 *p_group, UINT8 *p_other);
1473 
1474 /*******************************************************************************
1475 **
1476 ** Function     OBX_Read1ByteHdr
1477 **
1478 ** Description  This function is called to get the UINT8 HV of the given HI
1479 **              in the given OBEX packet.
1480 **
1481 ** Returns      TRUE, if the header is in the OBEX packet.
1482 **              FALSE, otherwise.
1483 **
1484 *******************************************************************************/
1485 OBX_API extern BOOLEAN OBX_Read1ByteHdr(BT_HDR *p_pkt, UINT8 id, UINT8 *p_data);
1486 
1487 /*******************************************************************************
1488 **
1489 ** Function     OBX_Read4ByteHdr
1490 **
1491 ** Description  This function is called to get the UINT32 HV of the given HI
1492 **              in the given OBEX packet.
1493 **
1494 ** Returns      TRUE, if the header is in the OBEX packet.
1495 **              FALSE, otherwise.
1496 **
1497 *******************************************************************************/
1498 OBX_API extern BOOLEAN OBX_Read4ByteHdr(BT_HDR *p_pkt, UINT8 id, UINT32 *p_data);
1499 
1500 /*******************************************************************************
1501 **
1502 ** Function     OBX_ReadByteStrHdr
1503 **
1504 ** Description  This function is called to get the byte sequence HV of the given
1505 **              HI in the given OBEX packet.
1506 **
1507 ** Returns      TRUE, if the header is in the OBEX packet.
1508 **              FALSE, otherwise.
1509 **
1510 *******************************************************************************/
1511 OBX_API extern BOOLEAN OBX_ReadByteStrHdr(BT_HDR *p_pkt, UINT8 id, UINT8 **p_data, UINT16 *p_len, UINT8 next);
1512 
1513 /*******************************************************************************
1514 **
1515 ** Function     OBX_ReadUnicodeHdr
1516 **
1517 ** Description  This function is called to get the Unicode HV of the given
1518 **              HI in the given OBEX packet.
1519 **
1520 ** Returns      TRUE, if the header is in the OBEX packet.
1521 **              FALSE, otherwise.
1522 **
1523 *******************************************************************************/
1524 OBX_API extern BOOLEAN OBX_ReadUnicodeHdr(BT_HDR *p_pkt, UINT8 id, UINT16 *p_data, UINT16 *p_len);
1525 
1526 /*******************************************************************************
1527 **
1528 ** Function     OBX_ReadTriplet
1529 **
1530 ** Description  This function is called to get the Triplet HV of the given
1531 **              HI in the given OBEX packet.
1532 **
1533 ** Returns      TRUE, if the header is in the OBEX packet.
1534 **              FALSE, otherwise.
1535 **
1536 *******************************************************************************/
1537 OBX_API extern BOOLEAN OBX_ReadTriplet(BT_HDR *p_pkt, UINT8 id, tOBX_TRIPLET *p_triplet, UINT8 *p_num);
1538 
1539 /*******************************************************************************
1540 **
1541 ** Function     OBX_ReadActionIdHdr
1542 **
1543 ** Description  This function is called to get the HV of the Action ID header
1544 **              in the given OBEX packet.
1545 **
1546 ** Returns      TRUE, if the header is in the OBEX packet.
1547 **              FALSE, otherwise.
1548 **
1549 *******************************************************************************/
1550 OBX_API extern BOOLEAN OBX_ReadActionIdHdr(BT_HDR *p_pkt, UINT8 *p_data);
1551 
1552 /*******************************************************************************
1553 **
1554 ** Function     OBX_ReadChallenge
1555 **
1556 ** Description  This function is called to read the Realm and options of the
1557 **              Authentication Challenge Header in the given OBEX packet.
1558 **
1559 ** Returns      TRUE, if the header is in the OBEX packet.
1560 **              FALSE, otherwise.
1561 **
1562 *******************************************************************************/
1563 OBX_API extern BOOLEAN OBX_ReadChallenge(BT_HDR *p_pkt, tOBX_CHARSET *p_charset,
1564                                          UINT8 **p_realm, UINT8 *p_len,
1565                                          tOBX_AUTH_OPT *p_option);
1566 
1567 /*******************************************************************************
1568 **
1569 ** Function     OBX_ReadAuthParams
1570 **
1571 ** Description  This function is called to read the User ID of the
1572 **              Authentication Response Header in the given OBEX packet.
1573 **
1574 ** Returns      TRUE, if the header is in the OBEX packet.
1575 **              FALSE, otherwise.
1576 **
1577 *******************************************************************************/
1578 OBX_API extern BOOLEAN OBX_ReadAuthParams(BT_HDR *p_pkt, UINT8 **p_userid, UINT8 *p_len,
1579                                           BOOLEAN *is_challenged, tOBX_AUTH_OPT *p_option);
1580 
1581 
1582 /*******************************************************************************
1583 **
1584 ** Function         utfc_16_to_8
1585 **
1586 ** Description      Convert a UTF-16 array to a null-terminated UTF-8 string.
1587 **                  Illegal characters are skipped.
1588 **
1589 ** Returns          Length of UTF-8 string in bytes.
1590 **
1591 *******************************************************************************/
1592 OBX_API extern UINT16 utfc_16_to_8(UINT8 *p_utf8, UINT16 utf8_len, UINT16 *p_utf16, UINT16 utf16_len);
1593 
1594 /*******************************************************************************
1595 **
1596 ** Function         utfc_8_to_16
1597 **
1598 ** Description      Convert a null-terminated UTF-8 string to a UTF-16 array.
1599 **                  Illegal characters are skipped.
1600 **
1601 ** Returns          Length of UTF-16 array.
1602 **
1603 *******************************************************************************/
1604 OBX_API extern UINT16 utfc_8_to_16(UINT16 *p_utf16, UINT16 utf16_len, UINT8 *p_utf8);
1605 
1606 /*******************************************************************************
1607 **
1608 ** Function     OBX_AddUtf8NameHdr
1609 **
1610 ** Description  This function is called to add an OBEX Name header
1611 **              to an OBEX packet.
1612 **
1613 ** Returns      TRUE, if the header is added successfully.
1614 **              FALSE, if the operation failed. p_pkt is not altered.
1615 **
1616 *******************************************************************************/
1617 OBX_API extern BOOLEAN OBX_AddUtf8NameHdr(BT_HDR *p_pkt, UINT8 *p_name);
1618 
1619 /*******************************************************************************
1620 **
1621 ** Function     OBX_AddUtf8DescrHdr
1622 **
1623 ** Description  This function is called to add an OBEX Description header
1624 **              to an OBEX packet.
1625 **
1626 ** Returns      TRUE, if the header is added successfully.
1627 **              FALSE, if the operation failed. p_pkt is not altered.
1628 **
1629 *******************************************************************************/
1630 OBX_API extern BOOLEAN OBX_AddUtf8DescrHdr(BT_HDR *p_pkt, UINT8 *p_descr);
1631 
1632 /*******************************************************************************
1633 **
1634 ** Function     OBX_AddUtf8DestNameHdr
1635 **
1636 ** Description  This function is called to add an OBEX DestName header
1637 **              to an OBEX packet.
1638 **
1639 ** Returns      TRUE, if the header is added successfully.
1640 **              FALSE, if the operation failed. p_pkt is not altered.
1641 **
1642 *******************************************************************************/
1643 OBX_API extern BOOLEAN OBX_AddUtf8DestNameHdr(BT_HDR *p_pkt, UINT8 *p_dest);
1644 
1645 /*******************************************************************************
1646 **
1647 ** Function     OBX_ReadUtf8NameHdr
1648 **
1649 ** Description  This function is called to get the Name Header in the given
1650 **              OBEX packet. If Name header exists in the given OBEX packet,
1651 **              it is converted to UTF8 format and copied into p_name.
1652 **
1653 ** Returns      TRUE, if the header is in the OBEX packet.
1654 **              FALSE, otherwise.
1655 **
1656 *******************************************************************************/
1657 OBX_API extern BOOLEAN OBX_ReadUtf8NameHdr(BT_HDR *p_pkt, UINT8 *p_name, UINT16 max_len);
1658 
1659 /*******************************************************************************
1660 **
1661 ** Function     OBX_ReadUtf8DescrHdr
1662 **
1663 ** Description  This function is called to get the Description Header in the
1664 **              given OBEX packet. If Description header exists in the given
1665 **              OBEX packet, it is converted to UTF8 format and copied into
1666 **              p_descr.
1667 **
1668 ** Returns      TRUE, if the header is in the OBEX packet.
1669 **              FALSE, otherwise.
1670 **
1671 *******************************************************************************/
1672 OBX_API extern BOOLEAN OBX_ReadUtf8DescrHdr(BT_HDR *p_pkt, UINT8 *p_descr, UINT16 max_len);
1673 
1674 /*******************************************************************************
1675 **
1676 ** Function     OBX_ReadUtf8DestNameHdr
1677 **
1678 ** Description  This function is called to get the DestName Header in the
1679 **              given OBEX packet.
1680 **
1681 ** Returns      TRUE, if the header is in the OBEX packet.
1682 **              FALSE, otherwise.
1683 **
1684 *******************************************************************************/
1685 OBX_API extern BOOLEAN OBX_ReadUtf8DestNameHdr(BT_HDR *p_pkt, UINT8 *p_dest, UINT16 max_len);
1686 
1687 /*******************************************************************************
1688 **
1689 ** Function     OBX_VerifyResponse
1690 **
1691 ** Description  This function is called by the client to verify the challenge
1692 **              response.
1693 **
1694 ** Returns      TRUE, if successful.
1695 **              FALSE, if authentication failed
1696 **
1697 *******************************************************************************/
1698 OBX_API extern BOOLEAN OBX_VerifyResponse(UINT32 nonce_u32, UINT8 *p_password, UINT8 password_len, UINT8 *p_response);
1699 
1700 #ifdef __cplusplus
1701 }
1702 #endif
1703 
1704 #endif /* OBX_API_H */
1705