Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
obex.h
Go to the documentation of this file.
1/* obex.h - IrDA Oject Exchange Protocol handling */
2
3/*
4 * Copyright 2024-2025 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
484/* bt_obex flags */
485enum {
486 BT_OBEX_HAS_TARGET, /* Has target_header */
487};
488
495
499 struct bt_obex *obex;
500
502 const struct bt_uuid_128 *uuid;
503
509 const struct bt_obex_server_ops *ops;
510
511 struct {
514 } rx;
515
516 struct {
519 } tx;
520
522 atomic_t _state;
523
525 atomic_t _opcode;
526
528 atomic_t _flags;
529
531 union bt_obex_uuid _target;
532
534 uint32_t _conn_id;
535
537 sys_snode_t _node;
538};
539
543 struct bt_obex *obex;
544
550 const struct bt_obex_client_ops *ops;
551
552 struct {
555 } rx;
556
557 struct {
560 } tx;
561
563 atomic_t _state;
564
566 atomic_t _opcode;
567
569 atomic_t _pre_opcode;
570
572 atomic_t _flags;
573
575 union bt_obex_uuid _target;
576
578 uint32_t _conn_id;
579
581 sys_snode_t _node;
582};
583
585struct bt_obex {
586 struct {
589 } rx;
590
591 struct {
594 } tx;
595
597 const struct bt_obex_transport_ops *_transport_ops;
598
600 atomic_ptr_t _active_client;
601
603 atomic_ptr_t _active_server;
604
606 sys_slist_t _clients;
607
609 sys_slist_t _servers;
610};
611
628int bt_obex_server_register(struct bt_obex_server *server, const struct bt_uuid_128 *uuid);
629
641
664int bt_obex_connect(struct bt_obex_client *client, uint16_t mopl, struct net_buf *buf);
665
688int bt_obex_connect_rsp(struct bt_obex_server *server, uint8_t rsp_code, uint16_t mopl,
689 struct net_buf *buf);
690
709int bt_obex_disconnect(struct bt_obex_client *client, struct net_buf *buf);
710
732int bt_obex_disconnect_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
733
758int bt_obex_put(struct bt_obex_client *client, bool final, struct net_buf *buf);
759
781int bt_obex_put_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
782
804int bt_obex_get(struct bt_obex_client *client, bool final, struct net_buf *buf);
805
840int bt_obex_get_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
841
861int bt_obex_abort(struct bt_obex_client *client, struct net_buf *buf);
862
884int bt_obex_abort_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
885
893
925int bt_obex_setpath(struct bt_obex_client *client, uint8_t flags, struct net_buf *buf);
926
951int bt_obex_setpath_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
952
962
1002int bt_obex_action(struct bt_obex_client *client, bool final, struct net_buf *buf);
1003
1057int bt_obex_action_rsp(struct bt_obex_server *server, uint8_t rsp_code, struct net_buf *buf);
1058
1067
1076int bt_obex_add_header_name(struct net_buf *buf, uint16_t len, const uint8_t *name);
1077
1086int bt_obex_add_header_type(struct net_buf *buf, uint16_t len, const uint8_t *type);
1087
1096
1106
1115
1124int bt_obex_add_header_description(struct net_buf *buf, uint16_t len, const uint8_t *dec);
1125
1134int bt_obex_add_header_target(struct net_buf *buf, uint16_t len, const uint8_t *target);
1135
1144int bt_obex_add_header_http(struct net_buf *buf, uint16_t len, const uint8_t *http);
1145
1154int bt_obex_add_header_body(struct net_buf *buf, uint16_t len, const uint8_t *body);
1155
1164int bt_obex_add_header_end_body(struct net_buf *buf, uint16_t len, const uint8_t *body);
1165
1181static inline int bt_obex_add_header_body_or_end_body(struct net_buf *buf, uint16_t mopl,
1182 uint16_t len, const uint8_t *body,
1183 uint16_t *added_len)
1184{
1185 uint16_t tx_len;
1186 int err;
1187
1188 /*
1189 * OBEX Version 1.5, section 2.2.9 Body, End-of-Body
1190 * The `body` could be a NULL, so the `len` of the name could 0.
1191 * In some cases, the object body data is generated on the fly and the end cannot
1192 * be anticipated, so it is legal to send a zero length End-of-Body header.
1193 */
1194 if ((buf == NULL) || ((len != 0) && (body == NULL)) || (added_len == NULL) ||
1195 (mopl < BT_OBEX_MIN_MTU)) {
1196 return -EINVAL;
1197 }
1198
1199 tx_len = BT_OBEX_PDU_LEN(mopl);
1200 if (tx_len <= buf->len) {
1201 return -ENOMEM;
1202 }
1203
1204 *added_len = 0;
1205
1206 tx_len = MIN((tx_len - buf->len), net_buf_tailroom(buf));
1207 if (tx_len <= BT_OBEX_HDR_LEN_OF_HEADER_BODY) {
1208 return 0;
1209 }
1210
1211 tx_len = BT_OBEX_DATA_LEN_OF_HEADER_BODY(tx_len);
1212 if (tx_len >= len) {
1213 *added_len = len;
1214 err = bt_obex_add_header_end_body(buf, len, body);
1215 } else {
1216 *added_len = tx_len;
1217 err = bt_obex_add_header_body(buf, tx_len, body);
1218 }
1219
1220 return err;
1221}
1222
1231int bt_obex_add_header_who(struct net_buf *buf, uint16_t len, const uint8_t *who);
1232
1241
1255
1264int bt_obex_add_header_app_param(struct net_buf *buf, size_t count,
1265 const struct bt_obex_tlv data[]);
1266
1271#define BT_OBEX_CHALLENGE_TAG_NONCE 0x00
1272
1277#define BT_OBEX_CHALLENGE_TAG_OPTIONS 0x01
1278
1280#define BT_OBEX_CHALLENGE_TAG_OPTION_REQ_USER_ID BIT(0)
1282#define BT_OBEX_CHALLENGE_TAG_OPTION_ACCESS_MODE BIT(1)
1283
1290#define BT_OBEX_CHALLENGE_TAG_REALM 0x02
1291
1300int bt_obex_add_header_auth_challenge(struct net_buf *buf, size_t count,
1301 const struct bt_obex_tlv data[]);
1302
1307#define BT_OBEX_RESPONSE_TAG_REQ_DIGEST 0x00
1308
1313#define BT_OBEX_RESPONSE_TAG_USER_ID 0x01
1314
1319#define BT_OBEX_RESPONSE_TAG_NONCE 0x02
1320
1329int bt_obex_add_header_auth_rsp(struct net_buf *buf, size_t count, const struct bt_obex_tlv data[]);
1330
1339
1349
1358int bt_obex_add_header_obj_class(struct net_buf *buf, uint16_t len, const uint8_t *obj_class);
1359
1369 const uint8_t *session_param);
1370
1378int bt_obex_add_header_session_seq_number(struct net_buf *buf, uint32_t session_seq_number);
1379
1388
1397int bt_obex_add_header_dest_name(struct net_buf *buf, uint16_t len, const uint8_t *dest_name);
1398
1407
1416
1425
1435
1452 bool (*func)(struct bt_obex_hdr *hdr, void *user_data), void *user_data);
1453
1462
1471int bt_obex_get_header_name(struct net_buf *buf, uint16_t *len, const uint8_t **name);
1472
1481int bt_obex_get_header_type(struct net_buf *buf, uint16_t *len, const uint8_t **type);
1482
1491
1501
1510
1519int bt_obex_get_header_description(struct net_buf *buf, uint16_t *len, const uint8_t **dec);
1520
1529int bt_obex_get_header_target(struct net_buf *buf, uint16_t *len, const uint8_t **target);
1530
1539int bt_obex_get_header_http(struct net_buf *buf, uint16_t *len, const uint8_t **http);
1540
1549int bt_obex_get_header_body(struct net_buf *buf, uint16_t *len, const uint8_t **body);
1550
1559int bt_obex_get_header_end_body(struct net_buf *buf, uint16_t *len, const uint8_t **body);
1560
1569int bt_obex_get_header_who(struct net_buf *buf, uint16_t *len, const uint8_t **who);
1570
1579
1600 bool (*func)(struct bt_obex_tlv *tlv, void *user_data), void *user_data);
1601
1612int bt_obex_get_header_app_param(struct net_buf *buf, uint16_t *len, const uint8_t **app_param);
1613
1624int bt_obex_get_header_auth_challenge(struct net_buf *buf, uint16_t *len, const uint8_t **auth);
1625
1636int bt_obex_get_header_auth_rsp(struct net_buf *buf, uint16_t *len, const uint8_t **auth);
1637
1645int bt_obex_get_header_creator_id(struct net_buf *buf, uint32_t *creator_id);
1646
1656
1665int bt_obex_get_header_obj_class(struct net_buf *buf, uint16_t *len, const uint8_t **obj_class);
1666
1676 const uint8_t **session_param);
1677
1685int bt_obex_get_header_session_seq_number(struct net_buf *buf, uint32_t *session_seq_number);
1686
1694int bt_obex_get_header_action_id(struct net_buf *buf, uint8_t *action_id);
1695
1704int bt_obex_get_header_dest_name(struct net_buf *buf, uint16_t *len, const uint8_t **dest_name);
1705
1714
1723
1731int bt_obex_get_header_srm_param(struct net_buf *buf, uint8_t *srm_param);
1732
1742
1752
1760bool bt_obex_has_header(struct net_buf *buf, uint8_t id);
1761
1770
1771#ifdef __cplusplus
1772}
1773#endif
1774
1778
1779#endif /* ZEPHYR_INCLUDE_BLUETOOTH_OBEX_H_ */
long atomic_t
Definition atomic_types.h:15
void * atomic_ptr_t
Definition atomic_types.h:17
Bluetooth UUID handling.
System error numbers.
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:954
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:887
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:1181
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:960
@ BT_OBEX_ACTION_MOVE_RENAME
Move/Rename Object Action.
Definition obex.h:958
@ BT_OBEX_ACTION_COPY
Copy Object Action.
Definition obex.h:956
@ 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_HAS_TARGET
Definition obex.h:486
@ BT_OBEX_SETPATH_FLAG_BACKUP
Backup a level before applying name (equivalent to ../ on many systems).
Definition obex.h:889
@ BT_OBEX_SETPATH_FLAG_NO_CREATE
Don't create folder if it does not exist, return an error instead.
Definition obex.h:891
static size_t net_buf_tailroom(const struct net_buf *buf)
Check buffer tailroom.
Definition net_buf.h:2532
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#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:448
#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:541
struct bt_obex * obex
OBEX Object.
Definition obex.h:543
const struct bt_obex_client_ops * ops
OBEX Client operations.
Definition obex.h:550
struct bt_obex_client::@326221357137065306217372072163052026141177300246 rx
uint16_t mopl
The Maximum OBEX Packet Length (MOPL).
Definition obex.h:554
struct bt_obex_client::@111003125364121074143276003267015036357375172226 tx
OBEX Header structure.
Definition obex.h:1427
uint16_t len
The length of header value.
Definition obex.h:1431
uint8_t id
Header ID bt_obex_header_id.
Definition obex.h:1429
const uint8_t * data
Header value.
Definition obex.h:1433
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:497
uint16_t mopl
The Maximum OBEX Packet Length (MOPL).
Definition obex.h:513
struct bt_obex_server::@102203250332061272314310073220313305327200242045 tx
const struct bt_uuid_128 * uuid
UUID of the service.
Definition obex.h:502
struct bt_obex * obex
OBEX Object.
Definition obex.h:499
struct bt_obex_server::@043331323127233377077337156045327123120304000306 rx
const struct bt_obex_server_ops * ops
OBEX Server operations.
Definition obex.h:509
Bluetooth OBEX TLV triplet.
Definition obex.h:1250
const uint8_t * data
Definition obex.h:1253
uint8_t type
Definition obex.h:1251
uint8_t data_len
Definition obex.h:1252
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:585
struct bt_obex::@334171124345215351360143107375313161364362160240 tx
uint16_t mtu
MTU of OBEX transport.
Definition obex.h:588
struct bt_obex::@243305210146247120322314160130214202327064015017 rx
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:1079
Network buffer representation.
Definition net_buf.h:1006
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1035
Binary representation of a UUID.
Definition uuid.h:48
Definition obex.h:489
struct bt_uuid uuid
Definition obex.h:490
struct bt_uuid_16 u16
Definition obex.h:491
struct bt_uuid_32 u32
Definition obex.h:492
struct bt_uuid_128 u128
Definition obex.h:493