Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
obex.h
Go to the documentation of this file.
1/* obex.h - IrDA Object Exchange Protocol handling */
2
3/*
4 * Copyright 2024-2026 NXP
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef ZEPHYR_INCLUDE_BLUETOOTH_OBEX_H_
10#define ZEPHYR_INCLUDE_BLUETOOTH_OBEX_H_
11
18
19#include <zephyr/kernel.h>
20#include <string.h>
21#include <errno.h>
22#include <stdbool.h>
23
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define BT_OBEX_MIN_MTU 255
31
33enum __packed bt_obex_rsp_code {
112};
113
122#if defined(CONFIG_BT_OEBX_RSP_CODE_TO_STR)
123const char *bt_obex_rsp_code_to_str(enum bt_obex_rsp_code rsp_code);
124#else
125static inline const char *bt_obex_rsp_code_to_str(enum bt_obex_rsp_code rsp_code)
126{
127 ARG_UNUSED(rsp_code);
128
129 return "";
130}
131#endif /* CONFIG_BT_OEBX_RSP_CODE_TO_STR */
132
213
215#define BT_OBEX_HDR_LEN 3
216
218#define BT_OBEX_PDU_LEN(mopl) ((mopl) - BT_OBEX_HDR_LEN)
219
221#define BT_OBEX_HDR_LEN_OF_HEADER_BODY 3
222
239#define BT_OBEX_DATA_LEN_OF_HEADER_BODY(len) ((len) - BT_OBEX_HDR_LEN_OF_HEADER_BODY)
240
241#define BT_OBEX_SEND_BUF_RESERVE 7
242
243struct bt_obex;
244struct bt_obex_server;
245struct bt_obex_client;
246
262 void (*connect)(struct bt_obex_server *server, uint8_t version, uint16_t mopl,
263 struct net_buf *buf);
264
273 void (*disconnect)(struct bt_obex_server *server, struct net_buf *buf);
274
284 void (*put)(struct bt_obex_server *server, bool final, struct net_buf *buf);
285
295 void (*get)(struct bt_obex_server *server, bool final, struct net_buf *buf);
296
305 void (*abort)(struct bt_obex_server *server, struct net_buf *buf);
306
316 void (*setpath)(struct bt_obex_server *server, uint8_t flags, struct net_buf *buf);
317
327 void (*action)(struct bt_obex_server *server, bool final, struct net_buf *buf);
328};
329
346 void (*connect)(struct bt_obex_client *client, uint8_t rsp_code, uint8_t version,
347 uint16_t mopl, struct net_buf *buf);
348
358 void (*disconnect)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
359
369 void (*put)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
370
380 void (*get)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
381
391 void (*abort)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
392
402 void (*setpath)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
403
413 void (*action)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf);
414};
415
431 struct net_buf *(*alloc_buf)(struct bt_obex *obex, struct net_buf_pool *pool);
432
443 int (*send)(struct bt_obex *obex, struct net_buf *buf);
444
453 int (*disconnect)(struct bt_obex *obex);
454};
455
483
490
494 struct bt_obex *obex;
495
497 const struct bt_uuid_128 *uuid;
498
504 const struct bt_obex_server_ops *ops;
505
507 struct {
510 } rx;
511
513 struct {
516 } tx;
517
519 atomic_t _state;
520
522 atomic_t _opcode;
523
525 atomic_t _flags;
526
528 union bt_obex_uuid _target;
529
531 uint32_t _conn_id;
532
534 sys_snode_t _node;
535};
536
540 struct bt_obex *obex;
541
547 const struct bt_obex_client_ops *ops;
548
550 struct {
553 } rx;
554
556 struct {
559 } tx;
560
562 atomic_t _state;
563
565 atomic_t _opcode;
566
568 atomic_t _pre_opcode;
569
571 atomic_t _flags;
572
574 union bt_obex_uuid _target;
575
577 uint32_t _conn_id;
578
580 sys_snode_t _node;
581};
582
584struct bt_obex {
586 struct {
589 } rx;
590
592 struct {
595 } tx;
596
598 const struct bt_obex_transport_ops *_transport_ops;
599
601 atomic_ptr_t _active_client;
602
604 atomic_ptr_t _last_client;
605
607 atomic_ptr_t _active_server;
608
610 sys_slist_t _clients;
611
613 sys_slist_t _servers;
614};
615
632int bt_obex_server_register(struct bt_obex_server *server, const struct bt_uuid_128 *uuid);
633
645
668int bt_obex_connect(struct bt_obex_client *client, uint16_t mopl, struct net_buf *buf);
669
692int bt_obex_connect_rsp(struct bt_obex_server *server, uint8_t rsp_code, uint16_t mopl,
693 struct net_buf *buf);
694
713int bt_obex_disconnect(struct bt_obex_client *client, struct net_buf *buf);
714
736int bt_obex_disconnect_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
737
762int bt_obex_put(struct bt_obex_client *client, bool final, struct net_buf *buf);
763
785int bt_obex_put_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
786
808int bt_obex_get(struct bt_obex_client *client, bool final, struct net_buf *buf);
809
844int bt_obex_get_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
845
865int bt_obex_abort(struct bt_obex_client *client, struct net_buf *buf);
866
888int bt_obex_abort_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
889
897
929int bt_obex_setpath(struct bt_obex_client *client, uint8_t flags, struct net_buf *buf);
930
955int bt_obex_setpath_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
956
966
1006int bt_obex_action(struct bt_obex_client *client, bool final, struct net_buf *buf);
1007
1061int bt_obex_action_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
1062
1071
1080int bt_obex_add_header_name(struct net_buf *buf, uint16_t len, const uint8_t *name);
1081
1090int bt_obex_add_header_type(struct net_buf *buf, uint16_t len, const uint8_t *type);
1091
1100
1110
1119
1128int bt_obex_add_header_description(struct net_buf *buf, uint16_t len, const uint8_t *dec);
1129
1138int bt_obex_add_header_target(struct net_buf *buf, uint16_t len, const uint8_t *target);
1139
1148int bt_obex_add_header_http(struct net_buf *buf, uint16_t len, const uint8_t *http);
1149
1158int bt_obex_add_header_body(struct net_buf *buf, uint16_t len, const uint8_t *body);
1159
1168int bt_obex_add_header_end_body(struct net_buf *buf, uint16_t len, const uint8_t *body);
1169
1185static inline int bt_obex_add_header_body_or_end_body(struct net_buf *buf, uint16_t mopl,
1186 uint16_t len, const uint8_t *body,
1187 uint16_t *added_len)
1188{
1189 uint16_t tx_len;
1190 int err;
1191
1192 /*
1193 * OBEX Version 1.5, section 2.2.9 Body, End-of-Body
1194 * The `body` could be a NULL, so the `len` of the name could 0.
1195 * In some cases, the object body data is generated on the fly and the end cannot
1196 * be anticipated, so it is legal to send a zero length End-of-Body header.
1197 */
1198 if ((buf == NULL) || ((len != 0) && (body == NULL)) || (added_len == NULL) ||
1199 (mopl < BT_OBEX_MIN_MTU)) {
1200 return -EINVAL;
1201 }
1202
1203 tx_len = BT_OBEX_PDU_LEN(mopl);
1204 if (tx_len <= buf->len) {
1205 return -ENOMEM;
1206 }
1207
1208 *added_len = 0;
1209
1210 tx_len = MIN((tx_len - buf->len), net_buf_tailroom(buf));
1211 if (tx_len <= BT_OBEX_HDR_LEN_OF_HEADER_BODY) {
1212 return 0;
1213 }
1214
1215 tx_len = BT_OBEX_DATA_LEN_OF_HEADER_BODY(tx_len);
1216 if (tx_len >= len) {
1217 *added_len = len;
1218 err = bt_obex_add_header_end_body(buf, len, body);
1219 } else {
1220 *added_len = tx_len;
1221 err = bt_obex_add_header_body(buf, tx_len, body);
1222 }
1223
1224 return err;
1225}
1226
1235int bt_obex_add_header_who(struct net_buf *buf, uint16_t len, const uint8_t *who);
1236
1245
1259
1268int bt_obex_add_header_app_param(struct net_buf *buf, size_t count,
1269 const struct bt_obex_tlv data[]);
1270
1275#define BT_OBEX_CHALLENGE_TAG_NONCE 0x00
1277#define BT_OBEX_CHALLENGE_TAG_NONCE_LEN 16
1278
1283#define BT_OBEX_CHALLENGE_TAG_OPTIONS 0x01
1285#define BT_OBEX_CHALLENGE_TAG_OPTIONS_LEN 1
1286
1288#define BT_OBEX_CHALLENGE_TAG_OPTION_REQ_USER_ID BIT(0)
1290#define BT_OBEX_CHALLENGE_TAG_OPTION_ACCESS_MODE BIT(1)
1291
1298#define BT_OBEX_CHALLENGE_TAG_REALM 0x02
1299
1308int bt_obex_add_header_auth_challenge(struct net_buf *buf, size_t count,
1309 const struct bt_obex_tlv data[]);
1310
1315#define BT_OBEX_RESPONSE_TAG_REQ_DIGEST 0x00
1317#define BT_OBEX_RESPONSE_TAG_REQ_DIGEST_LEN 16
1318
1323#define BT_OBEX_RESPONSE_TAG_USER_ID 0x01
1324
1329#define BT_OBEX_RESPONSE_TAG_NONCE 0x02
1331#define BT_OBEX_RESPONSE_TAG_NONCE_LEN 16
1332
1341int bt_obex_add_header_auth_rsp(struct net_buf *buf, size_t count, const struct bt_obex_tlv data[]);
1342
1351
1361
1370int bt_obex_add_header_obj_class(struct net_buf *buf, uint16_t len, const uint8_t *obj_class);
1371
1381 const uint8_t *session_param);
1382
1390int bt_obex_add_header_session_seq_number(struct net_buf *buf, uint32_t session_seq_number);
1391
1400
1409int bt_obex_add_header_dest_name(struct net_buf *buf, uint16_t len, const uint8_t *dest_name);
1410
1419
1428
1437
1447
1464 bool (*func)(struct bt_obex_hdr *hdr, void *user_data), void *user_data);
1465
1474
1483int bt_obex_get_header_name(struct net_buf *buf, uint16_t *len, const uint8_t **name);
1484
1493int bt_obex_get_header_type(struct net_buf *buf, uint16_t *len, const uint8_t **type);
1494
1503
1513
1522
1531int bt_obex_get_header_description(struct net_buf *buf, uint16_t *len, const uint8_t **dec);
1532
1541int bt_obex_get_header_target(struct net_buf *buf, uint16_t *len, const uint8_t **target);
1542
1551int bt_obex_get_header_http(struct net_buf *buf, uint16_t *len, const uint8_t **http);
1552
1561int bt_obex_get_header_body(struct net_buf *buf, uint16_t *len, const uint8_t **body);
1562
1571int bt_obex_get_header_end_body(struct net_buf *buf, uint16_t *len, const uint8_t **body);
1572
1581int bt_obex_get_header_who(struct net_buf *buf, uint16_t *len, const uint8_t **who);
1582
1591
1612 bool (*func)(struct bt_obex_tlv *tlv, void *user_data), void *user_data);
1613
1624int bt_obex_get_header_app_param(struct net_buf *buf, uint16_t *len, const uint8_t **app_param);
1625
1636int bt_obex_get_header_auth_challenge(struct net_buf *buf, uint16_t *len, const uint8_t **auth);
1637
1648int bt_obex_get_header_auth_rsp(struct net_buf *buf, uint16_t *len, const uint8_t **auth);
1649
1657int bt_obex_get_header_creator_id(struct net_buf *buf, uint32_t *creator_id);
1658
1668
1677int bt_obex_get_header_obj_class(struct net_buf *buf, uint16_t *len, const uint8_t **obj_class);
1678
1688 const uint8_t **session_param);
1689
1697int bt_obex_get_header_session_seq_number(struct net_buf *buf, uint32_t *session_seq_number);
1698
1706int bt_obex_get_header_action_id(struct net_buf *buf, uint8_t *action_id);
1707
1716int bt_obex_get_header_dest_name(struct net_buf *buf, uint16_t *len, const uint8_t **dest_name);
1717
1726
1735
1743int bt_obex_get_header_srm_param(struct net_buf *buf, uint8_t *srm_param);
1744
1754
1764
1772bool bt_obex_has_header(struct net_buf *buf, uint8_t id);
1773
1782
1783#ifdef __cplusplus
1784}
1785#endif
1786
1790
1791#endif /* ZEPHYR_INCLUDE_BLUETOOTH_OBEX_H_ */
Bluetooth UUID handling.
System error numbers.
long atomic_t
Atomic integer variable.
Definition atomic_types.h:31
void * atomic_ptr_t
Atomic pointer variable.
Definition atomic_types.h:46
int bt_obex_add_header_len(struct net_buf *buf, uint32_t len)
Add Header: the length of the object in bytes.
int bt_obex_disconnect(struct bt_obex_client *client, struct net_buf *buf)
OBEX disconnect request.
int bt_obex_add_header_wan_uuid(struct net_buf *buf, uint16_t len, const uint8_t *uuid)
Add Header: uniquely identifies the network client (OBEX server).
bt_obex_action_id
OBEX Actions.
Definition obex.h:958
int bt_obex_setpath_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX setpath response.
int bt_obex_add_header_creator_id(struct net_buf *buf, uint32_t creator_id)
Add Header: indicates the creator of an object.
int bt_obex_add_header_count(struct net_buf *buf, uint32_t count)
Add Header: number of objects (used by Connect).
bool bt_obex_string_is_valid(uint8_t id, uint16_t len, const uint8_t *str)
Check if the string is valid.
int bt_obex_get_header_len(struct net_buf *buf, uint32_t *len)
Get header value: the length of the object in bytes.
int bt_obex_put(struct bt_obex_client *client, bool final, struct net_buf *buf)
OBEX put request.
int bt_obex_server_register(struct bt_obex_server *server, const struct bt_uuid_128 *uuid)
OBEX server register.
int bt_obex_get_header_count(struct net_buf *buf, uint32_t *count)
Get header value: number of objects (used by Connect).
int bt_obex_connect(struct bt_obex_client *client, uint16_t mopl, struct net_buf *buf)
OBEX connect request.
int bt_obex_get_header_conn_id(struct net_buf *buf, uint32_t *conn_id)
Get header value: an identifier used for OBEX connection multiplexing.
int bt_obex_add_header_srm(struct net_buf *buf, uint8_t srm)
Add Header: 1-byte value to setup Single Response Mode (SRM).
int bt_obex_add_header_time(struct net_buf *buf, uint32_t t)
Add Header: date/time stamp – 4 byte version (for compatibility only).
bool bt_obex_has_header(struct net_buf *buf, uint8_t id)
Check whether the buf has the specified header.
int bt_obex_get_header_time(struct net_buf *buf, uint32_t *t)
Get header value: date/time stamp – 4 byte version (for compatibility only).
bt_obex_header_id
OBEX Header ID.
Definition obex.h:134
int bt_obex_get_header_description(struct net_buf *buf, uint16_t *len, const uint8_t **dec)
Get header value: text description of the object.
int bt_obex_get_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX get response.
int bt_obex_add_header_dest_name(struct net_buf *buf, uint16_t len, const uint8_t *dest_name)
Add Header: the destination object name (used in certain ACTION operations).
int bt_obex_get_header_target(struct net_buf *buf, uint16_t *len, const uint8_t **target)
Get header value: name of service that operation is targeted to.
int bt_obex_get_header_obj_class(struct net_buf *buf, uint16_t *len, const uint8_t **obj_class)
Get header value: oBEX Object class of object.
int bt_obex_add_header_perm(struct net_buf *buf, uint32_t perm)
Add Header: 4-byte bit mask for setting permissions.
#define BT_OBEX_PDU_LEN(mopl)
The max PDU data length of OBEX pachet.
Definition obex.h:218
int bt_obex_add_header_auth_rsp(struct net_buf *buf, size_t count, const struct bt_obex_tlv data[])
Add Header: authentication digest-response.
#define BT_OBEX_HDR_LEN_OF_HEADER_BODY
The header length of the OBEX header body/end body.
Definition obex.h:221
int bt_obex_get_header_session_param(struct net_buf *buf, uint16_t *len, const uint8_t **session_param)
Get header value: parameters used in session commands/responses.
int bt_obex_add_header_who(struct net_buf *buf, uint16_t len, const uint8_t *who)
Add Header: identifies the OBEX application, used to tell if talking to a peer.
int bt_obex_add_header_action_id(struct net_buf *buf, uint8_t action_id)
Add Header: specifies the action to be performed (used in ACTION operation).
int bt_obex_get_header_http(struct net_buf *buf, uint16_t *len, const uint8_t **http)
Get header value: an HTTP 1.x header.
bool bt_obex_has_app_param(struct net_buf *buf, uint8_t id)
Check whether the buf has the specified application parameter.
int bt_obex_header_parse(struct net_buf *buf, bool(*func)(struct bt_obex_hdr *hdr, void *user_data), void *user_data)
Helper for parsing OBEX header.
#define BT_OBEX_MIN_MTU
Definition obex.h:30
bt_obex_state
Life-span states of OBEX.
Definition obex.h:473
int bt_obex_add_header_http(struct net_buf *buf, uint16_t len, const uint8_t *http)
Add Header: an HTTP 1.x header.
int bt_obex_server_unregister(struct bt_obex_server *server)
OBEX server unregister.
int bt_obex_setpath(struct bt_obex_client *client, uint8_t flags, struct net_buf *buf)
OBEX setpath request.
int bt_obex_get_header_auth_challenge(struct net_buf *buf, uint16_t *len, const uint8_t **auth)
Get header value: authentication digest-challenge.
int bt_obex_abort_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX abort response.
int bt_obex_add_header_obj_class(struct net_buf *buf, uint16_t len, const uint8_t *obj_class)
Add Header: OBEX Object class of object.
int bt_obex_get_header_srm_param(struct net_buf *buf, uint8_t *srm_param)
Get header value: Single Response Mode (SRM) Parameter.
static const char * bt_obex_rsp_code_to_str(enum bt_obex_rsp_code rsp_code)
Converts a OBEX response code to string.
Definition obex.h:125
int bt_obex_add_header_end_body(struct net_buf *buf, uint16_t len, const uint8_t *body)
Add Header: the final chunk of the object body.
bt_obex_rsp_code
OBEX Response Code.
Definition obex.h:33
int bt_obex_add_header_time_iso_8601(struct net_buf *buf, uint16_t len, const uint8_t *t)
Add Header: date/time stamp – ISO 8601 version - preferred.
int bt_obex_get_header_dest_name(struct net_buf *buf, uint16_t *len, const uint8_t **dest_name)
Get header value: the destination object name (used in certain ACTION operations).
int bt_obex_get_header_app_param(struct net_buf *buf, uint16_t *len, const uint8_t **app_param)
Get header value: extended application request & response information.
int bt_obex_add_header_name(struct net_buf *buf, uint16_t len, const uint8_t *name)
Add Header: name of the object (often a file name).
int bt_obex_get_header_creator_id(struct net_buf *buf, uint32_t *creator_id)
Get header value: indicates the creator of an object.
int bt_obex_get_header_session_seq_number(struct net_buf *buf, uint32_t *session_seq_number)
Get header value: sequence number used in each OBEX packet for reliability.
int bt_obex_add_header_srm_param(struct net_buf *buf, uint8_t srm_param)
Add Header: Single Response Mode (SRM) Parameter.
int bt_obex_get_header_perm(struct net_buf *buf, uint32_t *perm)
Get header value: 4-byte bit mask for setting permissions.
#define BT_OBEX_DATA_LEN_OF_HEADER_BODY(len)
The max remaining length of the buffer if the adding header is body/end body.
Definition obex.h:239
int bt_obex_action(struct bt_obex_client *client, bool final, struct net_buf *buf)
OBEX action request.
int bt_obex_get_header_who(struct net_buf *buf, uint16_t *len, const uint8_t **who)
Get header value: identifies the OBEX application, used to tell if talking to a peer.
int bt_obex_put_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX put response.
bt_obex_setpath_flags
OBEX SetPath operation flags.
Definition obex.h:891
int bt_obex_get_header_body(struct net_buf *buf, uint16_t *len, const uint8_t **body)
Get header value: a chunk of the object body.
int bt_obex_get_header_type(struct net_buf *buf, uint16_t *len, const uint8_t **type)
Get header value: type of object - e.g.
int bt_obex_get(struct bt_obex_client *client, bool final, struct net_buf *buf)
OBEX get request.
int bt_obex_get_header_name(struct net_buf *buf, uint16_t *len, const uint8_t **name)
Get header value: name of the object (often a file name).
int bt_obex_add_header_session_param(struct net_buf *buf, uint16_t len, const uint8_t *session_param)
Add Header: parameters used in session commands/responses.
int bt_obex_disconnect_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX disconnect response.
int bt_obex_add_header_target(struct net_buf *buf, uint16_t len, const uint8_t *target)
Add Header: name of service that operation is targeted to.
int bt_obex_get_header_action_id(struct net_buf *buf, uint8_t *action_id)
Get header value: specifies the action to be performed (used in ACTION operation).
int bt_obex_tlv_parse(uint16_t len, const uint8_t *data, bool(*func)(struct bt_obex_tlv *tlv, void *user_data), void *user_data)
Helper for parsing OBEX TLV triplet.
int bt_obex_get_header_time_iso_8601(struct net_buf *buf, uint16_t *len, const uint8_t **t)
Get header value: date/time stamp – ISO 8601 version - preferred.
int bt_obex_add_header_auth_challenge(struct net_buf *buf, size_t count, const struct bt_obex_tlv data[])
Add Header: authentication digest-challenge.
int bt_obex_add_header_body(struct net_buf *buf, uint16_t len, const uint8_t *body)
Add Header: a chunk of the object body.
int bt_obex_add_header_session_seq_number(struct net_buf *buf, uint32_t session_seq_number)
Add Header: sequence number used in each OBEX packet for reliability.
int bt_obex_connect_rsp(struct bt_obex_server *server, uint8_t rsp_code, uint16_t mopl, struct net_buf *buf)
OBEX connect response.
int bt_obex_get_header_auth_rsp(struct net_buf *buf, uint16_t *len, const uint8_t **auth)
Get header value: authentication digest-response.
int bt_obex_add_header_conn_id(struct net_buf *buf, uint32_t conn_id)
Add Header: an identifier used for OBEX connection multiplexing.
int bt_obex_add_header_type(struct net_buf *buf, uint16_t len, const uint8_t *type)
Add Header: type of object - e.g.
static int bt_obex_add_header_body_or_end_body(struct net_buf *buf, uint16_t mopl, uint16_t len, const uint8_t *body, uint16_t *added_len)
Add Header: a chunk (may be a final chunk) of the object body.
Definition obex.h:1185
int bt_obex_get_header_srm(struct net_buf *buf, uint8_t *srm)
Get header value: 1-byte value to setup Single Response Mode (SRM).
int bt_obex_action_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf)
OBEX action response.
int bt_obex_add_header_app_param(struct net_buf *buf, size_t count, const struct bt_obex_tlv data[])
Add Header: extended application request & response information.
int bt_obex_add_header_description(struct net_buf *buf, uint16_t len, const uint8_t *dec)
Add Header: text description of the object.
int bt_obex_get_header_end_body(struct net_buf *buf, uint16_t *len, const uint8_t **body)
Get header value: the final chunk of the object body.
int bt_obex_get_header_wan_uuid(struct net_buf *buf, uint16_t *len, const uint8_t **uuid)
Get header value: uniquely identifies the network client (OBEX server).
int bt_obex_abort(struct bt_obex_client *client, struct net_buf *buf)
OBEX abort request.
int bt_obex_make_uuid(union bt_obex_uuid *uuid, const uint8_t *data, uint16_t len)
Make the UUID with specific data and len.
@ BT_OBEX_ACTION_SET_PERM
Set Object Permissions Action.
Definition obex.h:964
@ BT_OBEX_ACTION_MOVE_RENAME
Move/Rename Object Action.
Definition obex.h:962
@ BT_OBEX_ACTION_COPY
Copy Object Action.
Definition obex.h:960
@ BT_OBEX_HEADER_ID_ACTION_ID
Specifies the action to be performed (used in ACTION operation).
Definition obex.h:199
@ BT_OBEX_HEADER_ID_DES
Text description of the object.
Definition obex.h:154
@ BT_OBEX_HEADER_ID_CREATE_ID
Indicates the creator of an object.
Definition obex.h:184
@ BT_OBEX_HEADER_ID_BODY
A chunk of the object body.
Definition obex.h:163
@ BT_OBEX_HEADER_ID_CONN_ID
An identifier used for OBEX connection multiplexing.
Definition obex.h:172
@ BT_OBEX_HEADER_ID_SESSION_SEQ_NUM
Sequence number used in each OBEX packet for reliability.
Definition obex.h:196
@ BT_OBEX_HEADER_ID_HTTP
An HTTP 1.x header.
Definition obex.h:160
@ BT_OBEX_HEADER_ID_TIME
Date/time stamp – 4 byte version (for compatibility only).
Definition obex.h:151
@ BT_OBEX_HEADER_ID_TARGET
Name of service that operation is targeted to.
Definition obex.h:157
@ BT_OBEX_HEADER_ID_OBJECT_CLASS
OBEX Object class of object.
Definition obex.h:190
@ BT_OBEX_HEADER_ID_COUNT
Number of objects (used by Connect).
Definition obex.h:136
@ BT_OBEX_HEADER_ID_WAN_UUID
Uniquely identifies the network client (OBEX server).
Definition obex.h:187
@ BT_OBEX_HEADER_ID_PERM
4-byte bit mask for setting permissions.
Definition obex.h:205
@ BT_OBEX_HEADER_ID_APP_PARAM
Extended application request & response information.
Definition obex.h:175
@ BT_OBEX_HEADER_ID_TYPE
Type of object - e.g.
Definition obex.h:142
@ BT_OBEX_HEADER_ID_AUTH_RSP
Authentication digest-response.
Definition obex.h:181
@ BT_OBEX_HEADER_ID_AUTH_CHALLENGE
Authentication digest-challenge.
Definition obex.h:178
@ BT_OBEX_HEADER_ID_SRM
1-byte value to setup Single Response Mode (SRM).
Definition obex.h:208
@ BT_OBEX_HEADER_ID_END_BODY
The final chunk of the object body.
Definition obex.h:166
@ BT_OBEX_HEADER_ID_WHO
Identifies the OBEX application, used to tell if talking to a peer.
Definition obex.h:169
@ BT_OBEX_HEADER_ID_TIME_ISO_8601
Date/time stamp – ISO 8601 version - preferred.
Definition obex.h:148
@ BT_OBEX_HEADER_ID_SRM_PARAM
1-byte value for setting parameters used during Single Response Mode (SRM).
Definition obex.h:211
@ BT_OBEX_HEADER_ID_NAME
Name of the object (often a file name).
Definition obex.h:139
@ BT_OBEX_HEADER_ID_LEN
The length of the object in bytes.
Definition obex.h:145
@ BT_OBEX_HEADER_ID_DEST_NAME
The destination object name (used in certain ACTION operations).
Definition obex.h:202
@ BT_OBEX_HEADER_ID_SESSION_PARAM
Parameters used in session commands/responses.
Definition obex.h:193
@ BT_OBEX_CONNECTED
OBEX ready for upper layer traffic on it.
Definition obex.h:479
@ BT_OBEX_CONNECTING
OBEX in connecting state.
Definition obex.h:477
@ BT_OBEX_DISCONNECTED
OBEX disconnected.
Definition obex.h:475
@ BT_OBEX_DISCONNECTING
OBEX in disconnecting state.
Definition obex.h:481
@ BT_OBEX_RSP_CODE_ENTITY_TOO_LARGE
Requested Entity Too Large.
Definition obex.h:91
@ BT_OBEX_RSP_CODE_NOT_FOUND
Not Found.
Definition obex.h:73
@ BT_OBEX_RSP_CODE_BAD_REQ
Bad Request - server couldn’t understand request.
Definition obex.h:65
@ BT_OBEX_RSP_CODE_NON_AUTH_INFO
Non-Authoritative Information.
Definition obex.h:45
@ BT_OBEX_RSP_CODE_NO_CONTENT
No Content.
Definition obex.h:47
@ BT_OBEX_RSP_CODE_MULTI_CHOICES
Multiple Choices.
Definition obex.h:53
@ BT_OBEX_RSP_CODE_NOT_ALLOW
Method Not Allowed.
Definition obex.h:75
@ BT_OBEX_RSP_CODE_REQ_TIMEOUT
Request Time Out.
Definition obex.h:81
@ BT_OBEX_RSP_CODE_NOT_ACCEPT
Not Acceptable.
Definition obex.h:77
@ BT_OBEX_RSP_CODE_FORBIDDEN
Forbidden - operation is understood but refused.
Definition obex.h:71
@ BT_OBEX_RSP_CODE_RESET_CONTENT
Reset Content.
Definition obex.h:49
@ BT_OBEX_RSP_CODE_DB_LOCK
Database Locked.
Definition obex.h:111
@ BT_OBEX_RSP_CODE_PAY_REQ
Payment Required.
Definition obex.h:69
@ BT_OBEX_RSP_CODE_UNAVAIL
Service Unavailable.
Definition obex.h:103
@ BT_OBEX_RSP_CODE_UNSUPP_MEDIA_TYPE
Unsupported media type.
Definition obex.h:95
@ BT_OBEX_RSP_CODE_CONTINUE
Continue.
Definition obex.h:35
@ BT_OBEX_RSP_CODE_GATEWAY_TIMEOUT
Gateway Timeout.
Definition obex.h:105
@ BT_OBEX_RSP_CODE_OK
OK.
Definition obex.h:37
@ BT_OBEX_RSP_CODE_CREATED
Created.
Definition obex.h:41
@ BT_OBEX_RSP_CODE_GONE
Gone.
Definition obex.h:85
@ BT_OBEX_RSP_CODE_MOVED_PERM
Moved Permanently.
Definition obex.h:55
@ BT_OBEX_RSP_CODE_PRECON_FAIL
Precondition Failed.
Definition obex.h:89
@ BT_OBEX_RSP_CODE_NOT_MODIFIED
Not modified.
Definition obex.h:61
@ BT_OBEX_RSP_CODE_VER_UNSUPP
HTTP Version not supported.
Definition obex.h:107
@ BT_OBEX_RSP_CODE_ACCEPTED
Accepted.
Definition obex.h:43
@ BT_OBEX_RSP_CODE_NOT_IMPL
Not Implemented.
Definition obex.h:99
@ BT_OBEX_RSP_CODE_MOVED_TEMP
Moved temporarily.
Definition obex.h:57
@ BT_OBEX_RSP_CODE_LEN_REQ
Length Required.
Definition obex.h:87
@ BT_OBEX_RSP_CODE_USE_PROXY
Use Proxy.
Definition obex.h:63
@ BT_OBEX_RSP_CODE_SEE_OTHER
See Other.
Definition obex.h:59
@ BT_OBEX_RSP_CODE_BAD_GATEWAY
Bad Gateway.
Definition obex.h:101
@ BT_OBEX_RSP_CODE_UNAUTH
Unauthorized.
Definition obex.h:67
@ BT_OBEX_RSP_CODE_DB_FULL
Database Full.
Definition obex.h:109
@ BT_OBEX_RSP_CODE_URL_TOO_LARGE
Requested URL Too Large.
Definition obex.h:93
@ BT_OBEX_RSP_CODE_INTER_ERROR
Internal serve Error.
Definition obex.h:97
@ BT_OBEX_RSP_CODE_PROXY_AUTH_REQ
Proxy Authentication Required.
Definition obex.h:79
@ BT_OBEX_RSP_CODE_CONFLICT
Conflict.
Definition obex.h:83
@ BT_OBEX_RSP_CODE_SUCCESS
Success.
Definition obex.h:39
@ BT_OBEX_RSP_CODE_PARTIAL_CONTENT
Partial Content.
Definition obex.h:51
@ BT_OBEX_SETPATH_FLAG_BACKUP
Backup a level before applying name (equivalent to ../ on many systems).
Definition obex.h:893
@ BT_OBEX_SETPATH_FLAG_NO_CREATE
Don't create folder if it does not exist, return an error instead.
Definition obex.h:895
static size_t net_buf_tailroom(const struct net_buf *buf)
Check buffer tailroom.
Definition net_buf.h:2637
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:52
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:42
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define MIN(a, b)
Obtain the minimum of two values.
Definition util.h:406
#define EINVAL
Invalid argument.
Definition errno.h:60
#define ENOMEM
Not enough core.
Definition errno.h:50
#define NULL
Definition iar_missing_defs.h:20
Public kernel APIs.
flags
Definition parser.h:97
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
OBEX client operations structure.
Definition obex.h:334
void(* action)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX action response callback.
Definition obex.h:413
void(* disconnect)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX disconnect response callback.
Definition obex.h:358
void(* setpath)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX SetPath response callback.
Definition obex.h:402
void(* abort)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX abort response callback.
Definition obex.h:391
void(* put)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX put response callback.
Definition obex.h:369
void(* connect)(struct bt_obex_client *client, uint8_t rsp_code, uint8_t version, uint16_t mopl, struct net_buf *buf)
OBEX connect response callback.
Definition obex.h:346
void(* get)(struct bt_obex_client *client, uint8_t rsp_code, struct net_buf *buf)
OBEX get response callback.
Definition obex.h:380
OBEX client structure.
Definition obex.h:538
struct bt_obex * obex
OBEX Object.
Definition obex.h:540
const struct bt_obex_client_ops * ops
OBEX Client operations.
Definition obex.h:547
struct bt_obex_client::@343351001106127105073241252173301044304012133315 tx
Transmission configurations.
struct bt_obex_client::@301120317377370175146166151326154033122152240070 rx
Receiving configurations.
uint16_t mopl
The Maximum OBEX Packet Length (MOPL).
Definition obex.h:552
OBEX Header structure.
Definition obex.h:1439
uint16_t len
The length of header value.
Definition obex.h:1443
uint8_t id
Header ID bt_obex_header_id.
Definition obex.h:1441
const uint8_t * data
Header value.
Definition obex.h:1445
OBEX server operations structure.
Definition obex.h:251
void(* connect)(struct bt_obex_server *server, uint8_t version, uint16_t mopl, struct net_buf *buf)
OBEX connect request callback.
Definition obex.h:262
void(* abort)(struct bt_obex_server *server, struct net_buf *buf)
OBEX abort request callback.
Definition obex.h:305
void(* get)(struct bt_obex_server *server, bool final, struct net_buf *buf)
OBEX get request callback.
Definition obex.h:295
void(* setpath)(struct bt_obex_server *server, uint8_t flags, struct net_buf *buf)
OBEX SetPath request callback.
Definition obex.h:316
void(* action)(struct bt_obex_server *server, bool final, struct net_buf *buf)
OBEX action request callback.
Definition obex.h:327
void(* disconnect)(struct bt_obex_server *server, struct net_buf *buf)
OBEX disconnect request callback.
Definition obex.h:273
void(* put)(struct bt_obex_server *server, bool final, struct net_buf *buf)
OBEX put request callback.
Definition obex.h:284
OBEX server structure.
Definition obex.h:492
uint16_t mopl
The Maximum OBEX Packet Length (MOPL).
Definition obex.h:509
const struct bt_uuid_128 * uuid
UUID of the service.
Definition obex.h:497
struct bt_obex_server::@353071365273316330271345221260051074250330242337 tx
Transmission configurations.
struct bt_obex * obex
OBEX Object.
Definition obex.h:494
struct bt_obex_server::@154354370255041202216061267231120254202257344372 rx
Receiving configurations.
const struct bt_obex_server_ops * ops
OBEX Server operations.
Definition obex.h:504
Bluetooth OBEX TLV triplet.
Definition obex.h:1254
const uint8_t * data
Definition obex.h:1257
uint8_t type
Definition obex.h:1255
uint8_t data_len
Definition obex.h:1256
OBEX transport operations structure.
Definition obex.h:420
int(* send)(struct bt_obex *obex, struct net_buf *buf)
Send OBEX data via transport.
Definition obex.h:443
int(* disconnect)(struct bt_obex *obex)
Disconnect from transport.
Definition obex.h:453
OBEX structure.
Definition obex.h:584
struct bt_obex::@227117327362022001260370161065072003166371230152 rx
Receiving configurations.
uint16_t mtu
MTU of OBEX transport.
Definition obex.h:588
struct bt_obex::@175014213266300333105371144046322164044356207351 tx
Transmission configurations.
Definition uuid.h:68
Definition uuid.h:54
Definition uuid.h:61
This is a 'tentative' type and should be used as a pointer only.
Definition uuid.h:50
Network buffer pool representation.
Definition net_buf.h:1151
Network buffer representation.
Definition net_buf.h:1015
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1107
Binary representation of a UUID.
Definition uuid.h:48
Definition obex.h:484
struct bt_uuid uuid
Definition obex.h:485
struct bt_uuid_16 u16
Definition obex.h:486
struct bt_uuid_32 u32
Definition obex.h:487
struct bt_uuid_128 u128
Definition obex.h:488