Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Data Structures

struct  bt_ftp_client_cb
 FTP client callback structure. More...
struct  bt_ftp_client
 FTP client structure. More...

Functions

int bt_ftp_client_rfcomm_connect (struct bt_conn *conn, struct bt_ftp_client *client, const struct bt_ftp_client_cb *cb, uint8_t channel)
 Connect FTP client over RFCOMM (GOEP v1.1).
int bt_ftp_client_rfcomm_disconnect (struct bt_ftp_client *client)
 Disconnect FTP client RFCOMM transport.
int bt_ftp_client_l2cap_connect (struct bt_conn *conn, struct bt_ftp_client *client, const struct bt_ftp_client_cb *cb, uint16_t psm)
 Connect FTP client over L2CAP (GOEP v2).
int bt_ftp_client_l2cap_disconnect (struct bt_ftp_client *client)
 Disconnect FTP client L2CAP transport.
int bt_ftp_client_connect (struct bt_ftp_client *client, struct net_buf *buf)
 Send an OBEX CONNECT request to the FTP server.
int bt_ftp_client_disconnect (struct bt_ftp_client *client, struct net_buf *buf)
 Send an OBEX DISCONNECT request to the FTP server.
int bt_ftp_client_abort (struct bt_ftp_client *client, struct net_buf *buf)
 Send an OBEX ABORT request to the FTP server.
int bt_ftp_client_set_folder (struct bt_ftp_client *client, uint8_t flags, struct net_buf *buf)
 Send a SetPath (set folder) request to the FTP server.
int bt_ftp_client_pull_folder_listing (struct bt_ftp_client *client, bool final, struct net_buf *buf)
 Send a GET folder listing request to the FTP server.
int bt_ftp_client_push_file (struct bt_ftp_client *client, bool final, struct net_buf *buf)
 Send a PUT request to push a file to the FTP server.
int bt_ftp_client_pull_file (struct bt_ftp_client *client, bool final, struct net_buf *buf)
 Send a GET request to pull a file from the FTP server.
int bt_ftp_client_remove (struct bt_ftp_client *client, struct net_buf *buf)
 Send a remove request to the FTP server.
int bt_ftp_client_rename (struct bt_ftp_client *client, struct net_buf *buf)
 Send a RENAME/MOVE action request to the FTP server.
int bt_ftp_client_copy (struct bt_ftp_client *client, struct net_buf *buf)
 Send a COPY action request to the FTP server.
int bt_ftp_client_set_permission (struct bt_ftp_client *client, struct net_buf *buf)
 Send a SET PERMISSIONS action request to the FTP server.
struct net_buf * bt_ftp_client_create_pdu (struct bt_ftp_client *client, struct net_buf_pool *pool)
 Allocate a PDU buffer for an FTP client operation.

Detailed Description

Function Documentation

◆ bt_ftp_client_abort()

int bt_ftp_client_abort ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send an OBEX ABORT request to the FTP server.

Aborts the currently ongoing operation. Once OBEX abort response received, the abort callback bt_ftp_client_cb::abort will be called.

Parameters
clientFTP client object, FTP Client.
bufBuffer containing abort headers, or NULL. If buf is NULL or empty, a CONN_ID header is added. Otherwise the CONN_ID header is optional (IrOBEX 1.5, section 2.2.11); if buf has one, it must be the first header. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL or the CONN_ID header in buf does not match the session's connection ID.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID header in buf is present but malformed.
-ENOBUFSBuffer allocation failed when buf is NULL.
-ENOMEMbuf has insufficient tailroom for the CONN_ID header.

◆ bt_ftp_client_connect()

int bt_ftp_client_connect ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send an OBEX CONNECT request to the FTP server.

Initiates OBEX session establishment with the FTP server. Must be called after transport connection is established. Once OBEX connect response received, the connect callback bt_ftp_client_cb::connect will be called.

Parameters
clientFTP client object, FTP Client.
bufBuffer containing connect headers, or NULL. If buf is NULL or empty, a TARGET header with the FTP service UUID is added. Otherwise buf must contain a TARGET header with the FTP service UUID, as its first header (IrOBEX 1.5, section 2.2.7). If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, the transport is not connected, the client is not in the disconnected OBEX state, or the TARGET header in buf is malformed or does not match the FTP service UUID.
-ENODATAbuf is not empty and has no TARGET header, or its TARGET header is empty.
-ENOBUFSBuffer allocation failed when buf is NULL.
-ENOMEMbuf has insufficient tailroom for the TARGET header.

◆ bt_ftp_client_copy()

int bt_ftp_client_copy ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send a COPY action request to the FTP server.

Copies the object identified by the Name header to the path given in the DestName header. Once copy response received, the copy callback bt_ftp_client_cb::copy will be called.

Note
The ACTION operation is only allowed over the L2CAP transport (GOEP v2).
Parameters
clientFTP client object, FTP Client.
bufBuffer containing the Name (source) and DestName (destination) headers. The connection ID header must be the first header and the Action-ID header the second (IrOBEX 1.5, section 2.2.20). If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, the Name or DestName header is missing, the Action-ID header is not BT_OBEX_ACTION_COPY, or no copy callback is registered.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID or Action-ID header is missing from buf.
-EBUSYAnother operation is still in progress.
-ENOTSUPThe transport is RFCOMM.

◆ bt_ftp_client_create_pdu()

struct net_buf * bt_ftp_client_create_pdu ( struct bt_ftp_client * client,
struct net_buf_pool * pool )

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

Allocate a PDU buffer for an FTP client operation.

Allocates a buffer for building FTP request packets. Only headroom for the OBEX and transport headers is reserved; the data size is that of the buffers of pool.

Depending on the calling thread, the allocation may wait until a buffer is free. Must not be called from an ISR.

Parameters
clientFTP client object, FTP Client.
poolBuffer pool to allocate from, or NULL for the default pool.
Returns
Allocated buffer, or NULL on allocation failure.

◆ bt_ftp_client_disconnect()

int bt_ftp_client_disconnect ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send an OBEX DISCONNECT request to the FTP server.

Initiates OBEX session termination. Once OBEX disconnect response received, the disconnect callback bt_ftp_client_cb::disconnect will be called.

Parameters
clientFTP client object, FTP Client.
bufBuffer containing disconnect headers, or NULL. If buf is NULL or empty, a CONN_ID header is added. Otherwise buf must contain the CONN_ID header, as its first header (IrOBEX 1.5, section 2.2.11). If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL or the CONN_ID header in buf does not match the session's connection ID.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAbuf is not empty and has no valid CONN_ID header.
-ENOBUFSBuffer allocation failed when buf is NULL.
-ENOMEMbuf has insufficient tailroom for the CONN_ID header.

◆ bt_ftp_client_l2cap_connect()

int bt_ftp_client_l2cap_connect ( struct bt_conn * conn,
struct bt_ftp_client * client,
const struct bt_ftp_client_cb * cb,
uint16_t psm )

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

Connect FTP client over L2CAP (GOEP v2).

Initiates L2CAP transport connection to a remote FTP server. On success, the l2cap_connected callback bt_ftp_client_cb::l2cap_connected will be called. The caller must then issue an OBEX CONNECT via bt_ftp_client_connect.

Note
cb must provide the l2cap_connected, l2cap_disconnected, connect, disconnect, abort, set_folder and pull_folder_listing callbacks, and at least one of push_file and pull_file; this is checked with an assertion.
Parameters
connBluetooth connection object.
clientFTP client object, FTP Client.
cbCallback table, bt_ftp_client_cb.
psmL2CAP PSM (from SDP discovery).
Returns
0 on success, a negative error code from the underlying GOEP L2CAP transport layer, or one of the following error codes.
Return values
-EINVALconn, client, or cb is NULL, or psm is 0.
-EINPROGRESSThe client's transport is already connecting, connected, or disconnecting.

◆ bt_ftp_client_l2cap_disconnect()

int bt_ftp_client_l2cap_disconnect ( struct bt_ftp_client * client)

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

Disconnect FTP client L2CAP transport.

Closes the L2CAP transport connection. On success, the l2cap_disconnected callback bt_ftp_client_cb::l2cap_disconnected will be called.

Parameters
clientFTP client object, FTP Client.
Returns
0 on success, a negative error code from the underlying GOEP L2CAP transport layer, or one of the following error codes.
Return values
-EINVALclient is NULL.
-EINPROGRESSThe client's transport is not currently connected.

◆ bt_ftp_client_pull_file()

int bt_ftp_client_pull_file ( struct bt_ftp_client * client,
bool final,
struct net_buf * buf )

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

Send a GET request to pull a file from the FTP server.

Downloads a file (or a fragment) from the server. Once get file response received, the pull_file callback bt_ftp_client_cb::pull_file will be called (possibly multiple times).

Note
On a given OBEX connection, once this function has been called to start retrieving data, the next request must not be sent until the previous invocation has returned.
Parameters
clientFTP client object, FTP Client.
finalTrue if this is the final packet, false if more data follows.
bufBuffer containing the Name header and optional headers. The initial request must start with the connection ID header and include the Name header. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, the Name header is missing, or no pull_file callback is registered.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID header is missing from the initial request.
-EBUSYAnother operation is still in progress.

◆ bt_ftp_client_pull_folder_listing()

int bt_ftp_client_pull_folder_listing ( struct bt_ftp_client * client,
bool final,
struct net_buf * buf )

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

Send a GET folder listing request to the FTP server.

Retrieves the XML folder listing of the current folder. Once get folder listing response received, the pull_folder_listing callback bt_ftp_client_cb::pull_folder_listing will be called (possibly multiple times).

Note
On a given OBEX connection, once this function has been called to start retrieving data, the next request must not be sent until the previous invocation has returned.
Parameters
clientFTP client object, FTP Client.
finalTrue if this is the final packet, false if more data follows.
bufBuffer containing filter parameters and headers. The initial request must start with the connection ID header and include the type header. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, or the TYPE header does not equal BT_FTP_FOLDER_LISTING_TYPE.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID or TYPE header is missing from the initial request.
-EBUSYAnother operation is still in progress.

◆ bt_ftp_client_push_file()

int bt_ftp_client_push_file ( struct bt_ftp_client * client,
bool final,
struct net_buf * buf )

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

Send a PUT request to push a file to the FTP server.

Uploads a file (or a fragment of a file) to the server. Once push file response received, the push_file callback bt_ftp_client_cb::push_file will be called (possibly multiple times).

Note
On a given OBEX connection, once this function has been called to start uploading data, the next request must not be sent until the previous invocation has returned.
Parameters
clientFTP client object, FTP Client.
finalTrue if this is the last packet, false if more data follows.
bufBuffer containing the Name and Body/End-Body headers and file data. The initial request must start with the connection ID header and include the Name header. A non-final packet may carry headers only, with the body following in later packets. Must include end-of-body header when final is true. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient or buf is NULL, the CONN_ID header does not match the session's connection ID, the Name header is missing, no push_file callback is registered, or the End-of-Body header is missing while final is true.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID header is missing from the initial request.
-EBUSYAnother operation is still in progress.

◆ bt_ftp_client_remove()

int bt_ftp_client_remove ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send a remove request to the FTP server.

Removes (deletes) the file or folder identified by the Name header. This is implemented as a PUT without any Body or End-of-Body header. Once remove response received, the remove callback bt_ftp_client_cb::remove will be called.

Parameters
clientFTP client object, FTP Client.
bufBuffer starting with the connection ID header and containing the Name header of the file or folder to remove. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, the Name header is missing, no remove callback is registered, or buf unexpectedly contains a Body/End-of-Body header.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID header is missing from buf.
-EBUSYAnother operation is still in progress.

◆ bt_ftp_client_rename()

int bt_ftp_client_rename ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send a RENAME/MOVE action request to the FTP server.

Renames or moves the object identified by the Name header to the path given in the DestName header. Once rename response received, the rename callback bt_ftp_client_cb::rename will be called.

Note
The ACTION operation is only allowed over the L2CAP transport (GOEP v2).
Parameters
clientFTP client object, FTP Client.
bufBuffer containing the Name (source) and DestName (destination) headers. The connection ID header must be the first header and the Action-ID header the second (IrOBEX 1.5, section 2.2.20). If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, the Name or DestName header is missing, the Action-ID header is not BT_OBEX_ACTION_MOVE_RENAME, or no rename callback is registered.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID or Action-ID header is missing from buf.
-EBUSYAnother operation is still in progress.
-ENOTSUPThe transport is RFCOMM.

◆ bt_ftp_client_rfcomm_connect()

int bt_ftp_client_rfcomm_connect ( struct bt_conn * conn,
struct bt_ftp_client * client,
const struct bt_ftp_client_cb * cb,
uint8_t channel )

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

Connect FTP client over RFCOMM (GOEP v1.1).

Initiates RFCOMM transport connection to a remote FTP server. On success, the rfcomm_connected callback bt_ftp_client_cb::rfcomm_connected will be called. The caller must then issue an OBEX CONNECT via bt_ftp_client_connect.

Note
cb must provide the rfcomm_connected, rfcomm_disconnected, connect, disconnect, abort, set_folder and pull_folder_listing callbacks, and at least one of push_file and pull_file; this is checked with an assertion.
Parameters
connBluetooth connection object.
clientFTP client object, FTP Client.
cbCallback table, bt_ftp_client_cb.
channelRFCOMM server channel (from SDP discovery).
Returns
0 on success, a negative error code from the underlying GOEP RFCOMM transport layer, or one of the following error codes.
Return values
-EINVALconn, client, or cb is NULL, or channel is 0.
-EINPROGRESSThe client's transport is already connecting, connected, or disconnecting.

◆ bt_ftp_client_rfcomm_disconnect()

int bt_ftp_client_rfcomm_disconnect ( struct bt_ftp_client * client)

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

Disconnect FTP client RFCOMM transport.

Closes the RFCOMM transport connection. On success, the rfcomm_disconnected callback bt_ftp_client_cb::rfcomm_disconnected will be called.

Parameters
clientFTP client object, FTP Client.
Returns
0 on success, a negative error code from the underlying GOEP RFCOMM transport layer, or one of the following error codes.
Return values
-EINVALclient is NULL.
-EINPROGRESSThe client's transport is not currently connected.

◆ bt_ftp_client_set_folder()

int bt_ftp_client_set_folder ( struct bt_ftp_client * client,
uint8_t flags,
struct net_buf * buf )

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

Send a SetPath (set folder) request to the FTP server.

Navigates the folder hierarchy on the FTP server, or creates a new folder when flags is BT_FTP_SET_FOLDER_FLAGS_NEW. Once set_folder response received, the set_folder callback bt_ftp_client_cb::set_folder will be called.

Parameters
clientFTP client object, FTP Client.
flagsNavigation flags, bt_ftp_set_folder_flags.
bufBuffer containing the folder name and headers. A Name header is required for every flags value except BT_FTP_SET_FOLDER_FLAGS_UP. The connection ID header is required as the first header and is validated. If buf is NULL, a buffer with only the connection ID header is allocated. If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, flags is not a valid bt_ftp_set_folder_flags value, buf is missing the required Name header for flags, buf contains a Name header while flags is BT_FTP_SET_FOLDER_FLAGS_UP, the Name header is empty while flags is BT_FTP_SET_FOLDER_FLAGS_NEW, or the CONN_ID header in buf does not match the session's connection ID.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID header is missing from buf or malformed.
-ENOBUFSBuffer allocation failed when buf is NULL.
-ENOMEMThe buffer allocated when buf is NULL has insufficient tailroom for the CONN_ID header.

◆ bt_ftp_client_set_permission()

int bt_ftp_client_set_permission ( struct bt_ftp_client * client,
struct net_buf * buf )

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

Send a SET PERMISSIONS action request to the FTP server.

Changes the permissions of the object identified by the Name header. Once set_permission response received, the set_permission callback bt_ftp_client_cb::set_permission will be called.

Note
The ACTION operation is only allowed over the L2CAP transport (GOEP v2).
Parameters
clientFTP client object, FTP Client.
bufBuffer containing the Name header and the Permissions header. The connection ID header must be the first header and the Action-ID header the second (IrOBEX 1.5, section 2.2.20). If success returned, the function has taken the ownership of buf.
Returns
0 on success, a negative error code from the underlying OBEX layer, or one of the following error codes.
Return values
-EINVALclient is NULL, buf is NULL, the CONN_ID header does not match the session's connection ID, the Name or Permissions header is missing, the Action-ID header is not BT_OBEX_ACTION_SET_PERM, or no set_permission callback is registered.
-ENOTCONNThe client is not in the connected OBEX state.
-ENODATAThe CONN_ID or Action-ID header is missing from buf.
-EBUSYAnother operation is still in progress.
-ENOTSUPThe transport is RFCOMM.