Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
obex.h File Reference
#include <zephyr/kernel.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>

Go to the source code of this file.

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.