Zephyr Project API 4.2.99
A Scalable Open Source RTOS
|
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. | |
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. | |
IrDA Oject Exchange Protocol (OBEX)
#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.
#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.
#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.
#define BT_OBEX_CHALLENGE_TAG_OPTIONS 0x01 |
#include <include/zephyr/bluetooth/classic/obex.h>
OBEX digest-challenge tag: Options Optional Challenge Information.
#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.
#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.
#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.
#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.
#define BT_OBEX_SEND_BUF_RESERVE 7 |
#include <include/zephyr/bluetooth/classic/obex.h>
enum 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. |
enum bt_obex_header_id |
#include <include/zephyr/bluetooth/classic/obex.h>
OBEX Header ID.
enum bt_obex_rsp_code |
#include <include/zephyr/bluetooth/classic/obex.h>
OBEX Response Code.
enum 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.
#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.
obex | OBEX object. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
final | The final bit of opcode. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: specifies the action to be performed (used in ACTION operation).
buf | Buffer needs to be sent. |
action_id | Action Id bt_obex_action_id. |
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.
buf | Buffer needs to be sent. |
count | Number of bt_obex_tlv structures in data . |
data | Array of bt_obex_tlv structures. |
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.
buf | Buffer needs to be sent. |
count | Number of bt_obex_tlv structures in data . |
data | Array of bt_obex_tlv structures. |
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.
buf | Buffer needs to be sent. |
count | Number of bt_obex_tlv structures in data . |
data | Array of bt_obex_tlv structures. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: a chunk of the object body.
buf | Buffer needs to be sent. |
len | Length of body. |
body | Object Body. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: an identifier used for OBEX connection multiplexing.
buf | Buffer needs to be sent. |
conn_id | Connection Id. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: number of objects (used by Connect)
buf | Buffer needs to be sent. |
count | Number of objects. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: indicates the creator of an object.
buf | Buffer needs to be sent. |
creator_id | Creator Id. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: text description of the object.
buf | Buffer needs to be sent. |
len | Length of description. |
dec | Description of the object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: the destination object name (used in certain ACTION operations).
buf | Buffer needs to be sent. |
len | Length of destination name. |
dest_name | Destination name. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: the final chunk of the object body.
buf | Buffer needs to be sent. |
len | Length of body. |
body | Object Body. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: an HTTP 1.x header.
buf | Buffer needs to be sent. |
len | Length of http 1.x header. |
http | Http 1.x header. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: the length of the object in bytes.
buf | Buffer needs to be sent. |
len | The length of the object in bytes. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: name of the object (often a file name)
buf | Buffer needs to be sent. |
len | Length of name. |
name | Name of the object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: OBEX Object class of object.
buf | Buffer needs to be sent. |
len | Length of object class. |
obj_class | Class of object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: 4-byte bit mask for setting permissions.
buf | Buffer needs to be sent. |
perm | Permissions. |
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.
buf | Buffer needs to be sent. |
len | Length of session parameter. |
session_param | Session parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: sequence number used in each OBEX packet for reliability.
buf | Buffer needs to be sent. |
session_seq_number | Session sequence parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: 1-byte value to setup Single Response Mode (SRM).
buf | Buffer needs to be sent. |
srm | SRM. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: Single Response Mode (SRM) Parameter.
buf | Buffer needs to be sent. |
srm_param | SRM parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: name of service that operation is targeted to.
buf | Buffer needs to be sent. |
len | Length of target name. |
target | Target name. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: date/time stamp – 4 byte version (for compatibility only)
buf | Buffer needs to be sent. |
t | Data/time stamp. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: date/time stamp – ISO 8601 version - preferred.
buf | Buffer needs to be sent. |
len | Length of data/time stamp. |
t | Data/time stamp. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: type of object - e.g.
text, html, binary, manufacturer specific
buf | Buffer needs to be sent. |
len | Length of type. |
type | Type of the object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: uniquely identifies the network client (OBEX server).
buf | Buffer needs to be sent. |
len | Length of UUID. |
uuid | UUID. |
#include <include/zephyr/bluetooth/classic/obex.h>
Add Header: identifies the OBEX application, used to tell if talking to a peer.
buf | Buffer needs to be sent. |
len | Length of who. |
who | Who. |
#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.
obex | OBEX object. |
mopl | Maximum OBEX packet length. |
buf | Sequence of headers to be sent out. |
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.
obex | OBEX object. |
rsp_code | Response code. |
mopl | Maximum OBEX packet length. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
buf | Sequence of headers to be sent out. |
#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_*.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
final | The final bit of opcode. |
buf | Sequence of headers to be sent out. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: specifies the action to be performed (used in ACTION operation).
buf | Buffer needs to be sent. |
action_id | Action Id bt_obex_action_id. |
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.
buf | Buffer needs to be sent. |
len | Length of app_param. |
app_param | Application parameter. |
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.
buf | Buffer needs to be sent. |
len | Length of auth_challenge. |
auth | Authentication challenge. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: authentication digest-response.
The options can be parsed by calling bt_obex_tlv_parse.
buf | Buffer needs to be sent. |
len | Length of authentication response. |
auth | Authentication response. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: a chunk of the object body.
buf | Buffer needs to be sent. |
len | Length of body. |
body | Object Body. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: an identifier used for OBEX connection multiplexing.
buf | Buffer needs to be sent. |
conn_id | Connection Id. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: number of objects (used by Connect)
buf | Buffer needs to be sent. |
count | Number of objects. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: indicates the creator of an object.
buf | Buffer needs to be sent. |
creator_id | Creator Id. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: text description of the object.
buf | Buffer needs to be sent. |
len | Length of description. |
dec | Description of the object. |
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).
buf | Buffer needs to be sent. |
len | Length of destination name. |
dest_name | Destination name. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: the final chunk of the object body.
buf | Buffer needs to be sent. |
len | Length of body. |
body | Object Body. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: an HTTP 1.x header.
buf | Buffer needs to be sent. |
len | Length of http 1.x header. |
http | Http 1.x header. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: the length of the object in bytes.
buf | Buffer needs to be sent. |
len | The length of the object in bytes. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: name of the object (often a file name)
buf | Buffer needs to be sent. |
len | Length of name. |
name | Name of the object. |
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.
buf | Buffer needs to be sent. |
len | Length of oject class. |
obj_class | Class of object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: 4-byte bit mask for setting permissions.
buf | Buffer needs to be sent. |
perm | Permissions. |
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.
buf | Buffer needs to be sent. |
len | Length of session parameter. |
session_param | Session parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: sequence number used in each OBEX packet for reliability.
buf | Buffer needs to be sent. |
session_seq_number | Session sequence parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: 1-byte value to setup Single Response Mode (SRM).
buf | Buffer needs to be sent. |
srm | SRM. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: Single Response Mode (SRM) Parameter.
buf | Buffer needs to be sent. |
srm_param | SRM parameter. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: name of service that operation is targeted to.
buf | Buffer needs to be sent. |
len | Length of target name. |
target | Target name. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: date/time stamp – 4 byte version (for compatibility only)
buf | Buffer needs to be sent. |
t | Data/time stamp. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: date/time stamp – ISO 8601 version - preferred.
buf | Buffer needs to be sent. |
len | Length of data/time stamp. |
t | Data/time stamp. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: type of object - e.g.
text, html, binary, manufacturer specific
buf | Buffer needs to be sent. |
len | Length of type. |
type | Type of the object. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: uniquely identifies the network client (OBEX server).
buf | Buffer needs to be sent. |
len | Length of UUID. |
uuid | UUID. |
#include <include/zephyr/bluetooth/classic/obex.h>
Get header value: identifies the OBEX application, used to tell if talking to a peer.
buf | Buffer needs to be sent. |
len | Length of who. |
who | Who. |
#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.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
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.
buf
when parsing. The user should make a copy if the original data is to be used afterwards.buf | OBEX packet as given to the callback of OBEX server and client. |
func | Callback 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_data | User data to be passed to the callback. |
#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.
obex | OBEX object. |
final | The final bit of opcode. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
|
inlinestatic |
#include <include/zephyr/bluetooth/classic/obex.h>
Converts a OBEX response code to string.
rsp_code | Response code. |
CONFIG_BT_OEBX_RSP_CODE_TO_STRis not enabled, this just returns the empty string.
#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.
flags
is set), equivalent to "cd .." on some systems.obex | OBEX object. |
flags | Flags for setpath request. |
buf | Sequence of headers to be sent out. |
#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.
obex | OBEX object. |
rsp_code | Response code. |
buf | Sequence of headers to be sent out. |
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.
len | The length of the data . |
data | The data as given to the callback of OBEX server and client. |
func | Callback 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_data | User data to be passed to the callback. |