Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
IrDA Oject Exchange Protocol (OBEX)

IrDA Oject Exchange Protocol (OBEX) More...

Data Structures

struct  bt_obex_server_ops
 OBEX server operations structure. More...
 
struct  bt_obex_client_ops
 OBEX client operations structure. More...
 
struct  bt_obex_transport_ops
 OBEX transport operations structure. More...
 
struct  bt_obex
 OBEX structure. More...
 
struct  bt_obex_tlv
 Bluetooth OBEX TLV triplet. More...
 
struct  bt_obex_hdr
 OBEX Header structure. More...
 

Macros

#define BT_OBEX_SEND_BUF_RESERVE   7
 
#define BT_OBEX_CHALLENGE_TAG_NONCE   0x00
 OBEX digest-challenge tag: Nonce String of bytes representing the nonce.
 
#define BT_OBEX_CHALLENGE_TAG_OPTIONS   0x01
 OBEX digest-challenge tag: Options Optional Challenge Information.
 
#define BT_OBEX_CHALLENGE_TAG_OPTION_REQ_USER_ID   BIT(0)
 Option BIT0: When set, the User Id must be sent in the authenticate response.
 
#define BT_OBEX_CHALLENGE_TAG_OPTION_ACCESS_MODE   BIT(1)
 Option BIT1: Access mode: Read Only when set, otherwise Full access is permitted.
 
#define BT_OBEX_CHALLENGE_TAG_REALM   0x02
 OBEX digest-challenge tag: Realm A displayable string indicating which userid and/or password to use.
 
#define BT_OBEX_RESPONSE_TAG_REQ_DIGEST   0x00
 OBEX digest-Response tag: Request-digest String of bytes representing the request digest.
 
#define BT_OBEX_RESPONSE_TAG_USER_ID   0x01
 OBEX digest-Response tag: User Id User ID string of length n.
 
#define BT_OBEX_RESPONSE_TAG_NONCE   0x02
 OBEX digest-Response tag: Nonce The nonce sent in the digest challenge string.
 

Enumerations

enum  bt_obex_rsp_code {
  BT_OBEX_RSP_CODE_CONTINUE = 0x90 , BT_OBEX_RSP_CODE_OK = 0xa0 , BT_OBEX_RSP_CODE_SUCCESS = 0xa0 , BT_OBEX_RSP_CODE_CREATED = 0xa1 ,
  BT_OBEX_RSP_CODE_ACCEPTED = 0xa2 , BT_OBEX_RSP_CODE_NON_AUTH_INFO = 0xa3 , BT_OBEX_RSP_CODE_NO_CONTENT = 0xa4 , BT_OBEX_RSP_CODE_RESET_CONTENT = 0xa5 ,
  BT_OBEX_RSP_CODE_PARTIAL_CONTENT = 0xa6 , BT_OBEX_RSP_CODE_MULTI_CHOICES = 0xb0 , BT_OBEX_RSP_CODE_MOVED_PERM = 0xb1 , BT_OBEX_RSP_CODE_MOVED_TEMP = 0xb2 ,
  BT_OBEX_RSP_CODE_SEE_OTHER = 0xb3 , BT_OBEX_RSP_CODE_NOT_MODIFIED = 0xb4 , BT_OBEX_RSP_CODE_USE_PROXY = 0xb5 , BT_OBEX_RSP_CODE_BAD_REQ = 0xc0 ,
  BT_OBEX_RSP_CODE_UNAUTH = 0xc1 , BT_OBEX_RSP_CODE_PAY_REQ = 0xc2 , BT_OBEX_RSP_CODE_FORBIDDEN = 0xc3 , BT_OBEX_RSP_CODE_NOT_FOUND = 0xc4 ,
  BT_OBEX_RSP_CODE_NOT_ALLOW = 0xc5 , BT_OBEX_RSP_CODE_NOT_ACCEPT = 0xc6 , BT_OBEX_RSP_CODE_PROXY_AUTH_REQ = 0xc7 , BT_OBEX_RSP_CODE_REQ_TIMEOUT = 0xc8 ,
  BT_OBEX_RSP_CODE_CONFLICT = 0xc9 , BT_OBEX_RSP_CODE_GONE = 0xca , BT_OBEX_RSP_CODE_LEN_REQ = 0xcb , BT_OBEX_RSP_CODE_PRECON_FAIL = 0xcc ,
  BT_OBEX_RSP_CODE_ENTITY_TOO_LARGE = 0xcd , BT_OBEX_RSP_CODE_URL_TOO_LARGE = 0xce , BT_OBEX_RSP_CODE_UNSUPP_MEDIA_TYPE = 0xcf , BT_OBEX_RSP_CODE_INTER_ERROR = 0xd0 ,
  BT_OBEX_RSP_CODE_NOT_IMPL = 0xd1 , BT_OBEX_RSP_CODE_BAD_GATEWAY = 0xd2 , BT_OBEX_RSP_CODE_UNAVAIL = 0xd3 , BT_OBEX_RSP_CODE_GATEWAY_TIMEOUT = 0xd4 ,
  BT_OBEX_RSP_CODE_VER_UNSUPP = 0xd5 , BT_OBEX_RSP_CODE_DB_FULL = 0xe0 , BT_OBEX_RSP_CODE_DB_LOCK = 0xe1
}
 OBEX Response Code. More...
 
enum  bt_obex_header_id {
  BT_OBEX_HEADER_ID_COUNT = 0xC0 , BT_OBEX_HEADER_ID_NAME = 0x01 , BT_OBEX_HEADER_ID_TYPE = 0x42 , BT_OBEX_HEADER_ID_LEN = 0xC3 ,
  BT_OBEX_HEADER_ID_TIME_ISO_8601 = 0x44 , BT_OBEX_HEADER_ID_TIME = 0xC4 , BT_OBEX_HEADER_ID_DES = 0x05 , BT_OBEX_HEADER_ID_TARGET = 0x46 ,
  BT_OBEX_HEADER_ID_HTTP = 0x47 , BT_OBEX_HEADER_ID_BODY = 0x48 , BT_OBEX_HEADER_ID_END_BODY = 0x49 , BT_OBEX_HEADER_ID_WHO = 0x4A ,
  BT_OBEX_HEADER_ID_CONN_ID = 0xCB , BT_OBEX_HEADER_ID_APP_PARAM = 0x4C , BT_OBEX_HEADER_ID_AUTH_CHALLENGE = 0x4D , BT_OBEX_HEADER_ID_AUTH_RSP = 0x4E ,
  BT_OBEX_HEADER_ID_CREATE_ID = 0xCF , BT_OBEX_HEADER_ID_WAN_UUID = 0x50 , BT_OBEX_HEADER_ID_OBJECT_CLASS = 0x51 , BT_OBEX_HEADER_ID_SESSION_PARAM = 0x52 ,
  BT_OBEX_HEADER_ID_SESSION_SEQ_NUM = 0x93 , BT_OBEX_HEADER_ID_ACTION_ID = 0x94 , BT_OBEX_HEADER_ID_DEST_NAME = 0x15 , BT_OBEX_HEADER_ID_PERM = 0xD6 ,
  BT_OBEX_HEADER_ID_SRM = 0x97 , BT_OBEX_HEADER_ID_SRM_PARAM = 0x98
}
 OBEX Header ID. More...
 
enum  bt_obex_state { BT_OBEX_DISCONNECTED , BT_OBEX_CONNECTING , BT_OBEX_CONNECTED , BT_OBEX_DISCONNECTING }
 Life-span states of OBEX. More...
 
enum  bt_obex_action_id { BT_OBEX_ACTION_COPY = 0x00 , BT_OBEX_ACTION_MOVE_RENAME = 0x01 , BT_OBEX_ACTION_SET_PERM = 0x02 }
 OBEX Actions. More...
 

Functions

static const char * bt_obex_rsp_code_to_str (enum bt_obex_rsp_code rsp_code)
 Converts a OBEX response code to string.
 
int bt_obex_connect (struct bt_obex *obex, uint16_t mopl, struct net_buf *buf)
 OBEX connect request.
 
int bt_obex_connect_rsp (struct bt_obex *obex, uint8_t rsp_code, uint16_t mopl, struct net_buf *buf)
 OBEX connect response.
 
int bt_obex_disconnect (struct bt_obex *obex, struct net_buf *buf)
 OBEX disconnect request.
 
int bt_obex_disconnect_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX disconnect response.
 
int bt_obex_put (struct bt_obex *obex, bool final, struct net_buf *buf)
 OBEX put request.
 
int bt_obex_put_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX put response.
 
int bt_obex_get (struct bt_obex *obex, bool final, struct net_buf *buf)
 OBEX get request.
 
int bt_obex_get_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX get response.
 
int bt_obex_abort (struct bt_obex *obex, struct net_buf *buf)
 OBEX abort request.
 
int bt_obex_abort_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX abort response.
 
int bt_obex_setpath (struct bt_obex *obex, uint8_t flags, struct net_buf *buf)
 OBEX setpath request.
 
int bt_obex_setpath_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX setpath response.
 
int bt_obex_action (struct bt_obex *obex, bool final, struct net_buf *buf)
 OBEX action request.
 
int bt_obex_action_rsp (struct bt_obex *obex, uint8_t rsp_code, struct net_buf *buf)
 OBEX action response.
 
int bt_obex_add_header_count (struct net_buf *buf, uint32_t count)
 Add Header: number of objects (used by Connect)
 
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_add_header_type (struct net_buf *buf, uint16_t len, const uint8_t *type)
 Add Header: type of object - e.g.
 
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_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_add_header_time (struct net_buf *buf, uint32_t t)
 Add Header: date/time stamp – 4 byte version (for compatibility only)
 
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_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_add_header_http (struct net_buf *buf, uint16_t len, const uint8_t *http)
 Add Header: an HTTP 1.x header.
 
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_end_body (struct net_buf *buf, uint16_t len, const uint8_t *body)
 Add Header: the final chunk of the object body.
 
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_conn_id (struct net_buf *buf, uint32_t conn_id)
 Add Header: an identifier used for OBEX connection multiplexing.
 
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_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_auth_rsp (struct net_buf *buf, size_t count, const struct bt_obex_tlv data[])
 Add Header: authentication digest-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_wan_uuid (struct net_buf *buf, uint16_t len, const uint8_t *uuid)
 Add Header: uniquely identifies the network client (OBEX server).
 
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_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_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_add_header_action_id (struct net_buf *buf, uint32_t action_id)
 Add Header: specifies the action to be performed (used in ACTION operation).
 
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_add_header_perm (struct net_buf *buf, uint32_t perm)
 Add Header: 4-byte bit mask for setting permissions.
 
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_srm_param (struct net_buf *buf, uint8_t srm_param)
 Add Header: Single Response Mode (SRM) 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.
 
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_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_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_header_len (struct net_buf *buf, uint32_t *len)
 Get header value: the length of the object in bytes.
 
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_get_header_time (struct net_buf *buf, uint32_t *t)
 Get header value: date/time stamp – 4 byte version (for compatibility only)
 
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_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_http (struct net_buf *buf, uint16_t *len, const uint8_t **http)
 Get header value: an HTTP 1.x header.
 
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_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_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_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_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_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_get_header_auth_challenge (struct net_buf *buf, uint16_t *len, const uint8_t **auth)
 Get header value: authentication digest-challenge.
 
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_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_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_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_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_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_get_header_action_id (struct net_buf *buf, uint32_t *action_id)
 Get header value: specifies the action to be performed (used in ACTION operation).
 
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_perm (struct net_buf *buf, uint32_t *perm)
 Get header value: 4-byte bit mask for setting permissions.
 
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_get_header_srm_param (struct net_buf *buf, uint8_t *srm_param)
 Get header value: Single Response Mode (SRM) Parameter.
 

Detailed Description

IrDA Oject Exchange Protocol (OBEX)

Macro Definition Documentation

◆ BT_OBEX_CHALLENGE_TAG_NONCE

#define BT_OBEX_CHALLENGE_TAG_NONCE   0x00

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-challenge tag: Nonce String of bytes representing the nonce.

◆ BT_OBEX_CHALLENGE_TAG_OPTION_ACCESS_MODE

#define BT_OBEX_CHALLENGE_TAG_OPTION_ACCESS_MODE   BIT(1)

#include <include/zephyr/bluetooth/classic/obex.h>

Option BIT1: Access mode: Read Only when set, otherwise Full access is permitted.

◆ BT_OBEX_CHALLENGE_TAG_OPTION_REQ_USER_ID

#define BT_OBEX_CHALLENGE_TAG_OPTION_REQ_USER_ID   BIT(0)

#include <include/zephyr/bluetooth/classic/obex.h>

Option BIT0: When set, the User Id must be sent in the authenticate response.

◆ BT_OBEX_CHALLENGE_TAG_OPTIONS

#define BT_OBEX_CHALLENGE_TAG_OPTIONS   0x01

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-challenge tag: Options Optional Challenge Information.

◆ BT_OBEX_CHALLENGE_TAG_REALM

#define BT_OBEX_CHALLENGE_TAG_REALM   0x02

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-challenge tag: Realm A displayable string indicating which userid and/or password to use.

The first byte of the string is the character set to use. The character set uses the same values as those defined in IrLMP for the nickname.

◆ BT_OBEX_RESPONSE_TAG_NONCE

#define BT_OBEX_RESPONSE_TAG_NONCE   0x02

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-Response tag: Nonce The nonce sent in the digest challenge string.

◆ BT_OBEX_RESPONSE_TAG_REQ_DIGEST

#define BT_OBEX_RESPONSE_TAG_REQ_DIGEST   0x00

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-Response tag: Request-digest String of bytes representing the request digest.

◆ BT_OBEX_RESPONSE_TAG_USER_ID

#define BT_OBEX_RESPONSE_TAG_USER_ID   0x01

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX digest-Response tag: User Id User ID string of length n.

Max size is 20 bytes.

◆ BT_OBEX_SEND_BUF_RESERVE

#define BT_OBEX_SEND_BUF_RESERVE   7

Enumeration Type Documentation

◆ bt_obex_action_id

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX Actions.

Enumerator
BT_OBEX_ACTION_COPY 

Copy Object Action.

BT_OBEX_ACTION_MOVE_RENAME 

Move/Rename Object Action.

BT_OBEX_ACTION_SET_PERM 

Set Object Permissions Action.

◆ bt_obex_header_id

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX Header ID.

Enumerator
BT_OBEX_HEADER_ID_COUNT 

Number of objects (used by Connect)

BT_OBEX_HEADER_ID_NAME 

Name of the object (often a file name)

BT_OBEX_HEADER_ID_TYPE 

Type of object - e.g.

text, html, binary, manufacturer specific

BT_OBEX_HEADER_ID_LEN 

The length of the object in bytes.

BT_OBEX_HEADER_ID_TIME_ISO_8601 

Date/time stamp – ISO 8601 version - preferred.

BT_OBEX_HEADER_ID_TIME 

Date/time stamp – 4 byte version (for compatibility only)

BT_OBEX_HEADER_ID_DES 

Text description of the object.

BT_OBEX_HEADER_ID_TARGET 

Name of service that operation is targeted to.

BT_OBEX_HEADER_ID_HTTP 

An HTTP 1.x header.

BT_OBEX_HEADER_ID_BODY 

A chunk of the object body.

BT_OBEX_HEADER_ID_END_BODY 

The final chunk of the object body.

BT_OBEX_HEADER_ID_WHO 

Identifies the OBEX application, used to tell if talking to a peer.

BT_OBEX_HEADER_ID_CONN_ID 

An identifier used for OBEX connection multiplexing.

BT_OBEX_HEADER_ID_APP_PARAM 

Extended application request & response information.

BT_OBEX_HEADER_ID_AUTH_CHALLENGE 

Authentication digest-challenge.

BT_OBEX_HEADER_ID_AUTH_RSP 

Authentication digest-response.

BT_OBEX_HEADER_ID_CREATE_ID 

Indicates the creator of an object.

BT_OBEX_HEADER_ID_WAN_UUID 

Uniquely identifies the network client (OBEX server).

BT_OBEX_HEADER_ID_OBJECT_CLASS 

OBEX Object class of object.

BT_OBEX_HEADER_ID_SESSION_PARAM 

Parameters used in session commands/responses.

BT_OBEX_HEADER_ID_SESSION_SEQ_NUM 

Sequence number used in each OBEX packet for reliability.

BT_OBEX_HEADER_ID_ACTION_ID 

Specifies the action to be performed (used in ACTION operation).

BT_OBEX_HEADER_ID_DEST_NAME 

The destination object name (used in certain ACTION operations).

BT_OBEX_HEADER_ID_PERM 

4-byte bit mask for setting permissions.

BT_OBEX_HEADER_ID_SRM 

1-byte value to setup Single Response Mode (SRM).

BT_OBEX_HEADER_ID_SRM_PARAM 

1-byte value for setting parameters used during Single Response Mode (SRM).

◆ bt_obex_rsp_code

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX Response Code.

Enumerator
BT_OBEX_RSP_CODE_CONTINUE 

Continue.

BT_OBEX_RSP_CODE_OK 

OK.

BT_OBEX_RSP_CODE_SUCCESS 

Success.

BT_OBEX_RSP_CODE_CREATED 

Created.

BT_OBEX_RSP_CODE_ACCEPTED 

Accepted.

BT_OBEX_RSP_CODE_NON_AUTH_INFO 

Non-Authoritative Information

BT_OBEX_RSP_CODE_NO_CONTENT 

No Content.

BT_OBEX_RSP_CODE_RESET_CONTENT 

Reset Content.

BT_OBEX_RSP_CODE_PARTIAL_CONTENT 

Partial Content.

BT_OBEX_RSP_CODE_MULTI_CHOICES 

Multiple Choices.

BT_OBEX_RSP_CODE_MOVED_PERM 

Moved Permanently.

BT_OBEX_RSP_CODE_MOVED_TEMP 

Moved temporarily.

BT_OBEX_RSP_CODE_SEE_OTHER 

See Other.

BT_OBEX_RSP_CODE_NOT_MODIFIED 

Not modified.

BT_OBEX_RSP_CODE_USE_PROXY 

Use Proxy.

BT_OBEX_RSP_CODE_BAD_REQ 

Bad Request - server couldn’t understand request.

BT_OBEX_RSP_CODE_UNAUTH 

Unauthorized.

BT_OBEX_RSP_CODE_PAY_REQ 

Payment Required.

BT_OBEX_RSP_CODE_FORBIDDEN 

Forbidden - operation is understood but refused.

BT_OBEX_RSP_CODE_NOT_FOUND 

Not Found.

BT_OBEX_RSP_CODE_NOT_ALLOW 

Method Not Allowed.

BT_OBEX_RSP_CODE_NOT_ACCEPT 

Not Acceptable.

BT_OBEX_RSP_CODE_PROXY_AUTH_REQ 

Proxy Authentication Required.

BT_OBEX_RSP_CODE_REQ_TIMEOUT 

Request Time Out.

BT_OBEX_RSP_CODE_CONFLICT 

Conflict.

BT_OBEX_RSP_CODE_GONE 

Gone.

BT_OBEX_RSP_CODE_LEN_REQ 

Length Required.

BT_OBEX_RSP_CODE_PRECON_FAIL 

Precondition Failed.

BT_OBEX_RSP_CODE_ENTITY_TOO_LARGE 

Requested Entity Too Large.

BT_OBEX_RSP_CODE_URL_TOO_LARGE 

Requested URL Too Large.

BT_OBEX_RSP_CODE_UNSUPP_MEDIA_TYPE 

Unsupported media type.

BT_OBEX_RSP_CODE_INTER_ERROR 

Internal serve Error.

BT_OBEX_RSP_CODE_NOT_IMPL 

Not Implemented.

BT_OBEX_RSP_CODE_BAD_GATEWAY 

Bad Gateway.

BT_OBEX_RSP_CODE_UNAVAIL 

Service Unavailable.

BT_OBEX_RSP_CODE_GATEWAY_TIMEOUT 

Gateway Timeout.

BT_OBEX_RSP_CODE_VER_UNSUPP 

HTTP Version not supported.

BT_OBEX_RSP_CODE_DB_FULL 

Database Full.

BT_OBEX_RSP_CODE_DB_LOCK 

Database Locked.

◆ bt_obex_state

#include <include/zephyr/bluetooth/classic/obex.h>

Life-span states of OBEX.

Used only by internal APIs dealing with setting OBEX to proper state depending on operational context.

OBEX enters the BT_OBEX_CONNECTING state upon bt_obex_connect, or upon returning from bt_obex_server_ops::connect.

When OBEX leaves the BT_OBEX_CONNECTING state and enters the BT_OBEX_CONNECTED, bt_obex_connect_rsp or bt_obex_client_ops::connect is called with the response code BT_OBEX_RSP_CODE_SUCCESS.

When OBEX enters the BT_OBEX_DISCONNECTED from other states, bt_obex_client_ops::disconnect or bt_obex_connect_rsp is called with the response code BT_OBEX_RSP_CODE_SUCCESS. Or OBEX transport enters the disconnected state from other OBEX transport states.

Enumerator
BT_OBEX_DISCONNECTED 

OBEX disconnected.

BT_OBEX_CONNECTING 

OBEX in connecting state.

BT_OBEX_CONNECTED 

OBEX ready for upper layer traffic on it.

BT_OBEX_DISCONNECTING 

OBEX in disconnecting state.

Function Documentation

◆ bt_obex_abort()

int bt_obex_abort ( struct bt_obex obex,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX abort request.

The abort request is used when the client decides to terminate a multi-packet operation (such as put) before it would be normally end. The abort request always fits in one OBEX packet and have the Final bit set. The second parameter buf saves the packet data (sequence of headers) of the abort request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header description is packed by calling bt_obex_add_header_description. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_abort_rsp()

int bt_obex_abort_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX abort response.

The abort response is used to acknowledged abort request packet. It is sent from the server to client. The abort response always fits in one OBEX packet and have the Final bit set.

The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical value BT_OBEX_RSP_CODE_SUCCESS for success. The third parameter buf saves the packet data (sequence of headers) of the abort response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_action()

int bt_obex_action ( struct bt_obex obex,
bool  final,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX action request.

The action operation is defined to cover the needs of common actions. The Action Id header BT_OBEX_HEADER_ID_ACTION_ID is used in the action operation and contains an action identifier which defines what action is to be performed. All actions are optional and depends on the implementation of server.

There are three actions defined bt_obex_action_id,

BT_OBEX_ACTION_COPY is used to copy an object from one location to another. The header Name BT_OBEX_HEADER_ID_NAME specifies the source file name and the header Dest Name BT_OBEX_HEADER_ID_DEST_NAME specifies the destination file name. These two headers are mandatory for this action.

BT_OBEX_ACTION_MOVE_RENAME is used to move an object from one location to another. It can also be used to rename an object. The header Name BT_OBEX_HEADER_ID_NAME specifies the source file name and the header Dest Name BT_OBEX_HEADER_ID_DEST_NAME specifies the destination file name. These two headers are mandatory for this action.

BT_OBEX_ACTION_SET_PERM is used to set the access permissions of an object or folder. The header Name BT_OBEX_HEADER_ID_NAME specifies the source file name and the header Permissions BT_OBEX_HEADER_ID_PERM specifies the new permissions for this object. These two headers are mandatory for this action.

The action operation consists of one or more request packets, the last of which should have the second parameter final set. The third parameter buf saves the packet data (sequence of headers) of the action request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Name is packed by calling bt_obex_add_header_name.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
finalThe final bit of opcode.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_action_rsp()

int bt_obex_action_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX action response.

The action response is used to acknowledged action request packets. It is sent from the server to client. The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical value BT_OBEX_RSP_CODE_SUCCESS for success.

There are three actions defined bt_obex_action_id. For each action request, there are failure response codes corresponding to it.

For action BT_OBEX_ACTION_COPY, BT_OBEX_RSP_CODE_NOT_FOUND - Source object or destination folder does not exist. BT_OBEX_RSP_CODE_FORBIDDEN - Cannot modify the permissions of the destination object/folder, permission denied. BT_OBEX_RSP_CODE_DB_FULL - Cannot create object in destination folder, out of memory BT_OBEX_RSP_CODE_CONFLICT - Cannot modify the permissions, sharing violation, object or Set Object Permissions Action busy. BT_OBEX_RSP_CODE_NOT_IMPL - Set Object Permissions Action not supported. BT_OBEX_RSP_CODE_NOT_MODIFIED - Cannot create folder/file, destination folder/file already exits.

For action BT_OBEX_ACTION_MOVE_RENAME, BT_OBEX_RSP_CODE_NOT_FOUND - Source object or destination folder does not exist. BT_OBEX_RSP_CODE_FORBIDDEN - Cannot modify the permissions of the destination object/folder, permission denied. BT_OBEX_RSP_CODE_DB_FULL - Cannot create object in destination folder, out of memory BT_OBEX_RSP_CODE_CONFLICT - Cannot modify the permissions, sharing violation, object or Set Object Permissions Action busy. BT_OBEX_RSP_CODE_NOT_IMPL - Set Object Permissions Action not supported. BT_OBEX_RSP_CODE_NOT_MODIFIED - Cannot create folder/file, destination folder/file already exits.

For action BT_OBEX_ACTION_SET_PERM, BT_OBEX_RSP_CODE_NOT_FOUND - Source object or destination folder does not exist. BT_OBEX_RSP_CODE_FORBIDDEN - Cannot modify the permissions of the destination object/folder, permission denied. BT_OBEX_RSP_CODE_NOT_IMPL - Set Object Permissions Action not supported. BT_OBEX_RSP_CODE_CONFLICT - Cannot modify the permissions, sharing violation, object or Set Object Permissions Action busy.

The third parameter buf saves the packet data (sequence of headers) of the action response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_action_id()

int bt_obex_add_header_action_id ( struct net_buf buf,
uint32_t  action_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: specifies the action to be performed (used in ACTION operation).

Parameters
bufBuffer needs to be sent.
action_idAction Id bt_obex_action_id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_app_param()

int bt_obex_add_header_app_param ( struct net_buf buf,
size_t  count,
const struct bt_obex_tlv  data[] 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: extended application request & response information.

Parameters
bufBuffer needs to be sent.
countNumber of bt_obex_tlv structures in data.
dataArray of bt_obex_tlv structures.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_auth_challenge()

int bt_obex_add_header_auth_challenge ( struct net_buf buf,
size_t  count,
const struct bt_obex_tlv  data[] 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: authentication digest-challenge.

Parameters
bufBuffer needs to be sent.
countNumber of bt_obex_tlv structures in data.
dataArray of bt_obex_tlv structures.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_auth_rsp()

int bt_obex_add_header_auth_rsp ( struct net_buf buf,
size_t  count,
const struct bt_obex_tlv  data[] 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: authentication digest-response.

Parameters
bufBuffer needs to be sent.
countNumber of bt_obex_tlv structures in data.
dataArray of bt_obex_tlv structures.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_body()

int bt_obex_add_header_body ( struct net_buf buf,
uint16_t  len,
const uint8_t body 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: a chunk of the object body.

Parameters
bufBuffer needs to be sent.
lenLength of body.
bodyObject Body.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_conn_id()

int bt_obex_add_header_conn_id ( struct net_buf buf,
uint32_t  conn_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: an identifier used for OBEX connection multiplexing.

Parameters
bufBuffer needs to be sent.
conn_idConnection Id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_count()

int bt_obex_add_header_count ( struct net_buf buf,
uint32_t  count 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: number of objects (used by Connect)

Parameters
bufBuffer needs to be sent.
countNumber of objects.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_creator_id()

int bt_obex_add_header_creator_id ( struct net_buf buf,
uint32_t  creator_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: indicates the creator of an object.

Parameters
bufBuffer needs to be sent.
creator_idCreator Id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_description()

int bt_obex_add_header_description ( struct net_buf buf,
uint16_t  len,
const uint8_t dec 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: text description of the object.

Parameters
bufBuffer needs to be sent.
lenLength of description.
decDescription of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_dest_name()

int bt_obex_add_header_dest_name ( struct net_buf buf,
uint16_t  len,
const uint8_t dest_name 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: the destination object name (used in certain ACTION operations).

Parameters
bufBuffer needs to be sent.
lenLength of destination name.
dest_nameDestination name.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_end_body()

int bt_obex_add_header_end_body ( struct net_buf buf,
uint16_t  len,
const uint8_t body 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: the final chunk of the object body.

Parameters
bufBuffer needs to be sent.
lenLength of body.
bodyObject Body.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_http()

int bt_obex_add_header_http ( struct net_buf buf,
uint16_t  len,
const uint8_t http 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: an HTTP 1.x header.

Parameters
bufBuffer needs to be sent.
lenLength of http 1.x header.
httpHttp 1.x header.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_len()

int bt_obex_add_header_len ( struct net_buf buf,
uint32_t  len 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: the length of the object in bytes.

Parameters
bufBuffer needs to be sent.
lenThe length of the object in bytes.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_name()

int bt_obex_add_header_name ( struct net_buf buf,
uint16_t  len,
const uint8_t name 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: name of the object (often a file name)

Parameters
bufBuffer needs to be sent.
lenLength of name.
nameName of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_obj_class()

int bt_obex_add_header_obj_class ( struct net_buf buf,
uint16_t  len,
const uint8_t obj_class 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: OBEX Object class of object.

Parameters
bufBuffer needs to be sent.
lenLength of object class.
obj_classClass of object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_perm()

int bt_obex_add_header_perm ( struct net_buf buf,
uint32_t  perm 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: 4-byte bit mask for setting permissions.

Parameters
bufBuffer needs to be sent.
permPermissions.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_session_param()

int bt_obex_add_header_session_param ( struct net_buf buf,
uint16_t  len,
const uint8_t session_param 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: parameters used in session commands/responses.

Parameters
bufBuffer needs to be sent.
lenLength of session parameter.
session_paramSession parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_session_seq_number()

int bt_obex_add_header_session_seq_number ( struct net_buf buf,
uint32_t  session_seq_number 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: sequence number used in each OBEX packet for reliability.

Parameters
bufBuffer needs to be sent.
session_seq_numberSession sequence parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_srm()

int bt_obex_add_header_srm ( struct net_buf buf,
uint8_t  srm 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: 1-byte value to setup Single Response Mode (SRM).

Parameters
bufBuffer needs to be sent.
srmSRM.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_srm_param()

int bt_obex_add_header_srm_param ( struct net_buf buf,
uint8_t  srm_param 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: Single Response Mode (SRM) Parameter.

Parameters
bufBuffer needs to be sent.
srm_paramSRM parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_target()

int bt_obex_add_header_target ( struct net_buf buf,
uint16_t  len,
const uint8_t target 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: name of service that operation is targeted to.

Parameters
bufBuffer needs to be sent.
lenLength of target name.
targetTarget name.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_time()

int bt_obex_add_header_time ( struct net_buf buf,
uint32_t  t 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: date/time stamp – 4 byte version (for compatibility only)

Parameters
bufBuffer needs to be sent.
tData/time stamp.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_time_iso_8601()

int bt_obex_add_header_time_iso_8601 ( struct net_buf buf,
uint16_t  len,
const uint8_t t 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: date/time stamp – ISO 8601 version - preferred.

Parameters
bufBuffer needs to be sent.
lenLength of data/time stamp.
tData/time stamp.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_type()

int bt_obex_add_header_type ( struct net_buf buf,
uint16_t  len,
const uint8_t type 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: type of object - e.g.

text, html, binary, manufacturer specific

Parameters
bufBuffer needs to be sent.
lenLength of type.
typeType of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_wan_uuid()

int bt_obex_add_header_wan_uuid ( struct net_buf buf,
uint16_t  len,
const uint8_t uuid 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: uniquely identifies the network client (OBEX server).

Parameters
bufBuffer needs to be sent.
lenLength of UUID.
uuidUUID.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_add_header_who()

int bt_obex_add_header_who ( struct net_buf buf,
uint16_t  len,
const uint8_t who 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Add Header: identifies the OBEX application, used to tell if talking to a peer.

Parameters
bufBuffer needs to be sent.
lenLength of who.
whoWho.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_connect()

int bt_obex_connect ( struct bt_obex obex,
uint16_t  mopl,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX connect request.

The connect operation initiates the connection and sets up the basic expectations of each side of the link. The connect request must fit in a single packet. The third parameter buf saves the packet data (sequence of headers) of the connect request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Authenticate Challenge is packed by calling bt_obex_add_header_auth_challenge.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
moplMaximum OBEX packet length.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_connect_rsp()

int bt_obex_connect_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
uint16_t  mopl,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX connect response.

The connect response is used to acknowledged connect request packet. The connect response must fit in a single packet.

The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical values BT_OBEX_RSP_CODE_SUCCESS for success. The 4th parameter buf saves the packet data (sequence of headers) of the connect response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Authenticate Response is packed by calling bt_obex_add_header_auth_rsp.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
moplMaximum OBEX packet length.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_disconnect()

int bt_obex_disconnect ( struct bt_obex obex,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX disconnect request.

The disconnect operation signals the end of the OBEX connection from client side. The disconnect request must fit in a single packet.

The second parameter buf saves the packet data (sequence of headers) of the disconnect request is stored in second parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Connection Id is packed by calling bt_obex_add_header_conn_id.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_disconnect_rsp()

int bt_obex_disconnect_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX disconnect response.

The disconnect response is used to acknowledged disconnect request packet. The disconnect response must fit in a single packet.

The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical values, BT_OBEX_RSP_CODE_SUCCESS for success, BT_OBEX_RSP_CODE_UNAVAIL for service unavailable if the header Connection Id is invalid. The third parameter buf saves the packet data (sequence of headers) of the connect response is stored in third parameter buf. All headers are packed by calling function bt_obex_add_header_*.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get()

int bt_obex_get ( struct bt_obex obex,
bool  final,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX get request.

The get operation requests that the server return an object to the client. The get operation consists of one or more request packets, the last of which should have the second parameter final set, and the request phase of the get is complete. Once a get request is sent with the final bit, all subsequent get request packets must set the final bit until the operation is complete. The third parameter buf saves the packet data (sequence of headers) of the get request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Name is packed by calling bt_obex_add_header_name. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
finalThe final bit of opcode.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_action_id()

int bt_obex_get_header_action_id ( struct net_buf buf,
uint32_t action_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: specifies the action to be performed (used in ACTION operation).

Parameters
bufBuffer needs to be sent.
action_idAction Id bt_obex_action_id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_app_param()

int bt_obex_get_header_app_param ( struct net_buf buf,
uint16_t len,
const uint8_t **  app_param 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: extended application request & response information.

The parameter can be parsed by calling bt_obex_tlv_parse.

Parameters
bufBuffer needs to be sent.
lenLength of app_param.
app_paramApplication parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_auth_challenge()

int bt_obex_get_header_auth_challenge ( struct net_buf buf,
uint16_t len,
const uint8_t **  auth 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: authentication digest-challenge.

The options can be parsed by calling bt_obex_tlv_parse.

Parameters
bufBuffer needs to be sent.
lenLength of auth_challenge.
authAuthentication challenge.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_auth_rsp()

int bt_obex_get_header_auth_rsp ( struct net_buf buf,
uint16_t len,
const uint8_t **  auth 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: authentication digest-response.

The options can be parsed by calling bt_obex_tlv_parse.

Parameters
bufBuffer needs to be sent.
lenLength of authentication response.
authAuthentication response.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_body()

int bt_obex_get_header_body ( struct net_buf buf,
uint16_t len,
const uint8_t **  body 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: a chunk of the object body.

Parameters
bufBuffer needs to be sent.
lenLength of body.
bodyObject Body.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_conn_id()

int bt_obex_get_header_conn_id ( struct net_buf buf,
uint32_t conn_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: an identifier used for OBEX connection multiplexing.

Parameters
bufBuffer needs to be sent.
conn_idConnection Id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_count()

int bt_obex_get_header_count ( struct net_buf buf,
uint32_t count 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: number of objects (used by Connect)

Parameters
bufBuffer needs to be sent.
countNumber of objects.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_creator_id()

int bt_obex_get_header_creator_id ( struct net_buf buf,
uint32_t creator_id 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: indicates the creator of an object.

Parameters
bufBuffer needs to be sent.
creator_idCreator Id.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_description()

int bt_obex_get_header_description ( struct net_buf buf,
uint16_t len,
const uint8_t **  dec 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: text description of the object.

Parameters
bufBuffer needs to be sent.
lenLength of description.
decDescription of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_dest_name()

int bt_obex_get_header_dest_name ( struct net_buf buf,
uint16_t len,
const uint8_t **  dest_name 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: the destination object name (used in certain ACTION operations).

Parameters
bufBuffer needs to be sent.
lenLength of destination name.
dest_nameDestination name.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_end_body()

int bt_obex_get_header_end_body ( struct net_buf buf,
uint16_t len,
const uint8_t **  body 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: the final chunk of the object body.

Parameters
bufBuffer needs to be sent.
lenLength of body.
bodyObject Body.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_http()

int bt_obex_get_header_http ( struct net_buf buf,
uint16_t len,
const uint8_t **  http 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: an HTTP 1.x header.

Parameters
bufBuffer needs to be sent.
lenLength of http 1.x header.
httpHttp 1.x header.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_len()

int bt_obex_get_header_len ( struct net_buf buf,
uint32_t len 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: the length of the object in bytes.

Parameters
bufBuffer needs to be sent.
lenThe length of the object in bytes.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_name()

int bt_obex_get_header_name ( struct net_buf buf,
uint16_t len,
const uint8_t **  name 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: name of the object (often a file name)

Parameters
bufBuffer needs to be sent.
lenLength of name.
nameName of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_obj_class()

int bt_obex_get_header_obj_class ( struct net_buf buf,
uint16_t len,
const uint8_t **  obj_class 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: oBEX Object class of object.

Parameters
bufBuffer needs to be sent.
lenLength of oject class.
obj_classClass of object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_perm()

int bt_obex_get_header_perm ( struct net_buf buf,
uint32_t perm 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: 4-byte bit mask for setting permissions.

Parameters
bufBuffer needs to be sent.
permPermissions.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_session_param()

int bt_obex_get_header_session_param ( struct net_buf buf,
uint16_t len,
const uint8_t **  session_param 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: parameters used in session commands/responses.

Parameters
bufBuffer needs to be sent.
lenLength of session parameter.
session_paramSession parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_session_seq_number()

int bt_obex_get_header_session_seq_number ( struct net_buf buf,
uint32_t session_seq_number 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: sequence number used in each OBEX packet for reliability.

Parameters
bufBuffer needs to be sent.
session_seq_numberSession sequence parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_srm()

int bt_obex_get_header_srm ( struct net_buf buf,
uint8_t srm 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: 1-byte value to setup Single Response Mode (SRM).

Parameters
bufBuffer needs to be sent.
srmSRM.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_srm_param()

int bt_obex_get_header_srm_param ( struct net_buf buf,
uint8_t srm_param 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: Single Response Mode (SRM) Parameter.

Parameters
bufBuffer needs to be sent.
srm_paramSRM parameter.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_target()

int bt_obex_get_header_target ( struct net_buf buf,
uint16_t len,
const uint8_t **  target 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: name of service that operation is targeted to.

Parameters
bufBuffer needs to be sent.
lenLength of target name.
targetTarget name.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_time()

int bt_obex_get_header_time ( struct net_buf buf,
uint32_t t 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: date/time stamp – 4 byte version (for compatibility only)

Parameters
bufBuffer needs to be sent.
tData/time stamp.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_time_iso_8601()

int bt_obex_get_header_time_iso_8601 ( struct net_buf buf,
uint16_t len,
const uint8_t **  t 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: date/time stamp – ISO 8601 version - preferred.

Parameters
bufBuffer needs to be sent.
lenLength of data/time stamp.
tData/time stamp.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_type()

int bt_obex_get_header_type ( struct net_buf buf,
uint16_t len,
const uint8_t **  type 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: type of object - e.g.

text, html, binary, manufacturer specific

Parameters
bufBuffer needs to be sent.
lenLength of type.
typeType of the object.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_wan_uuid()

int bt_obex_get_header_wan_uuid ( struct net_buf buf,
uint16_t len,
const uint8_t **  uuid 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: uniquely identifies the network client (OBEX server).

Parameters
bufBuffer needs to be sent.
lenLength of UUID.
uuidUUID.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_header_who()

int bt_obex_get_header_who ( struct net_buf buf,
uint16_t len,
const uint8_t **  who 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Get header value: identifies the OBEX application, used to tell if talking to a peer.

Parameters
bufBuffer needs to be sent.
lenLength of who.
whoWho.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_get_rsp()

int bt_obex_get_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX get response.

The get response is used to acknowledged get request packets. It is sent from the server to client. If the server has more than one object that fits the request, the behavior is system dependent. But the server device must not begin sending the object body chunks until the request phase is complete.

The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical values, BT_OBEX_RSP_CODE_CONTINUE for continue, BT_OBEX_RSP_CODE_SUCCESS for success. A successful response for an object that fits entirely in one response packet is BT_OBEX_RSP_CODE_SUCCESS (Success, with Final bit set) in the response code, followed by the object body. If the response is large enough to require multiple GET responses, only the last response is BT_OBEX_RSP_CODE_SUCCESS, and the others are all BT_OBEX_RSP_CODE_CONTINUE (Continue). The object is returned as a sequence of headers just as with put operation. Any other response code bt_obex_rsp_code indicates failure. The typical failure response codes, BT_OBEX_RSP_CODE_BAD_REQ for Bad request - server couldn’t understand request, BT_OBEX_RSP_CODE_FORBIDDEN for Forbidden - operation is understood but refused. The third parameter buf saves the packet data (sequence of headers) of the get response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header srm is packed by calling bt_obex_add_header_srm. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_header_parse()

int bt_obex_header_parse ( struct net_buf buf,
bool(*)(struct bt_obex_hdr *hdr, void *user_data)  func,
void *  user_data 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Helper for parsing OBEX header.

A helper for parsing the header structure for OBEX packets. The most common scenario is to call this helper on the in the callback of OBEX server and client.

Warning
This helper function will consume buf when parsing. The user should make a copy if the original data is to be used afterwards.
Parameters
bufOBEX packet as given to the callback of OBEX server and client.
funcCallback function which will be called for each element that's found in the data The callback should return true to continue parsing, or false to stop parsing.
user_dataUser data to be passed to the callback.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_put()

int bt_obex_put ( struct bt_obex obex,
bool  final,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX put request.

The put operation sends one object from the client to the server. The put operation consists of one or more request packets, the last of which should have the second parameter final set. The third parameter buf saves the packet data (sequence of headers) of the put request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Name is packed by calling bt_obex_add_header_name.

Note
A put operation with NO Body or End-of-Body headers whatsoever should be treated as a delete request. Similarly, a put operation with an empty End-of-Body header requests the recipient to create an empty object. This definition may not make sense or apply to every implementation (in other words devices are not required to support delete operations or empty objects).
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
finalThe final bit of opcode.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_put_rsp()

int bt_obex_put_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX put response.

The put response is used to acknowledged each put request packet. It is sent from the server to client. The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical values, BT_OBEX_RSP_CODE_CONTINUE for continue, BT_OBEX_RSP_CODE_SUCCESS for success. The third parameter buf saves the packet data (sequence of headers) of the put response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header srm is packed by calling bt_obex_add_header_srm. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_rsp_code_to_str()

static const char * bt_obex_rsp_code_to_str ( enum bt_obex_rsp_code  rsp_code)
inlinestatic

#include <include/zephyr/bluetooth/classic/obex.h>

Converts a OBEX response code to string.

Parameters
rsp_codeResponse code.
Returns
The string representation of the response code. If
CONFIG_BT_OEBX_RSP_CODE_TO_STR 
is not enabled, this just returns the empty string.

◆ bt_obex_setpath()

int bt_obex_setpath ( struct bt_obex obex,
uint8_t  flags,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX setpath request.

The setpath request is used to set the "current folder" on the receiving side in order to enable transfers that need additional path information. The Path name is contained in a Name header. The setpath request always fits in one OBEX packet and have the Final bit set.

The second parameter flags is the setpath operation flag bit maps. Bit 0 means backup a level before applying name (equivalent to ../ on many systems). Bit 1 means Don’t create folder if it does not exist, return an error instead. Other bits must be set to zero by sender and ignored by receiver. The third parameter buf saves the packet data (sequence of headers) of the setpath request is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Such as header Name is packed by calling bt_obex_add_header_name. If the header Name is added, it means the client wants to go one level down relative to the current folder into the folder name. Or, the client wants to go back to the default folder when no bit of flags set.

Note
The Name header may be omitted when flags or constants indicate the entire operation being requested. For example, back up one level (bit 0 of flags is set), equivalent to "cd .." on some systems.
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
flagsFlags for setpath request.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_setpath_rsp()

int bt_obex_setpath_rsp ( struct bt_obex obex,
uint8_t  rsp_code,
struct net_buf buf 
)

#include <include/zephyr/bluetooth/classic/obex.h>

OBEX setpath response.

The setpath response is used to acknowledged setpath request packet. It is sent from the server to client. The setpath response always fits in one OBEX packet and have the Final bit set.

The second parameter rsp_code is used to pass the response code bt_obex_rsp_code. The typical value BT_OBEX_RSP_CODE_SUCCESS for success. Any other response code bt_obex_rsp_code indicates failure. The typical failure response codes, BT_OBEX_RSP_CODE_BAD_REQ for Bad request - server couldn’t understand request, BT_OBEX_RSP_CODE_FORBIDDEN for Forbidden - operation is understood but refused. The third parameter buf saves the packet data (sequence of headers) of the setpath response is stored in thrid parameter buf. All headers are packed by calling function bt_obex_add_header_*. Or, the buf could be NULL if there is not any data needs to be sent.

Note
Buffer ownership is transferred to the stack in case of success, in case of an error the caller retains the ownership of the buffer.
Parameters
obexOBEX object.
rsp_codeResponse code.
bufSequence of headers to be sent out.
Returns
0 in case of success or negative value in case of error.

◆ bt_obex_tlv_parse()

int bt_obex_tlv_parse ( uint16_t  len,
const uint8_t data,
bool(*)(struct bt_obex_tlv *tlv, void *user_data)  func,
void *  user_data 
)

#include <include/zephyr/bluetooth/classic/obex.h>

Helper for parsing OBEX TLV triplet.

A helper for parsing the TLV triplet structure for OBEX packets. The most common scenario is to call this helper on the in the callback of OBEX server and client. The data is encoded by using A Tag-Length-Value encoding scheme. Usually, it is the header value of the header Application Request-Response Parameters, Authenticate Challenge, and Authenticate Response. It means the data is the output of the bt_obex_get_header_app_param, bt_obex_get_header_auth_challenge, or bt_obex_get_header_auth_rsp.

Parameters
lenThe length of the data.
dataThe data as given to the callback of OBEX server and client.
funcCallback function which will be called for each TLV triplet that's found from the data. The callback should return true to continue parsing, or false to stop parsing.
user_dataUser data to be passed to the callback.
Returns
0 in case of success or negative value in case of error.