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

FTP server callback structure. More...

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

Data Fields

void(* rfcomm_connected )(struct bt_conn *conn, struct bt_ftp_server *server)
 RFCOMM transport connected callback.
void(* rfcomm_disconnected )(struct bt_ftp_server *server)
 RFCOMM transport disconnected callback.
void(* l2cap_connected )(struct bt_conn *conn, struct bt_ftp_server *server)
 L2CAP transport connected callback.
void(* l2cap_disconnected )(struct bt_ftp_server *server)
 L2CAP transport disconnected callback.
void(* connect )(struct bt_ftp_server *server, uint8_t version, uint16_t mopl, struct net_buf *buf)
 OBEX CONNECT request callback.
void(* disconnect )(struct bt_ftp_server *server, struct net_buf *buf)
 OBEX DISCONNECT request callback.
void(* abort )(struct bt_ftp_server *server, struct net_buf *buf)
 OBEX ABORT request callback.
void(* set_folder )(struct bt_ftp_server *server, uint8_t flags, struct net_buf *buf)
 Set folder request callback.
void(* pull_folder_listing )(struct bt_ftp_server *server, bool final, struct net_buf *buf)
 Pull folder listing request callback.
void(* push_file )(struct bt_ftp_server *server, bool final, struct net_buf *buf)
 Push file request callback.
void(* pull_file )(struct bt_ftp_server *server, bool final, struct net_buf *buf)
 Pull file request callback.
void(* remove )(struct bt_ftp_server *server, struct net_buf *buf)
 Remove request callback.
void(* rename )(struct bt_ftp_server *server, struct net_buf *buf)
 Rename/Move action request callback.
void(* copy )(struct bt_ftp_server *server, struct net_buf *buf)
 Copy action request callback.
void(* set_permission )(struct bt_ftp_server *server, struct net_buf *buf)
 Set permission action request callback.

Detailed Description

FTP server callback structure.

The structure must remain valid and constant for the entire lifetime of the FTP server object.

The SETPATH flags and the headers passed to the request callbacks come from the remote device. The FTP server checks the Connection Id header of SETPATH, PUT, GET and ACTION requests and uses the Type and Action Id headers to select the callback. Of the other headers, it only checks that the ones an operation requires are present, not their values. The application must validate the names, paths, permissions and flags itself, and reject any request it does not accept with an error response. FTP v1.3.1, section 2.3: "For security reasons, Servers should reject attempts by a Client to browse files and folders above or outside the root folder by returning an appropriate error response."

Field Documentation

◆ abort

void(* bt_ftp_server_cb::abort) (struct bt_ftp_server *server, struct net_buf *buf)

OBEX ABORT request callback.

Called when the client sends an OBEX ABORT request to cancel the current multi-packet operation. The server must reply via bt_ftp_server_abort.

Parameters
serverFTP server object.
bufBuffer containing request headers.

◆ connect

void(* bt_ftp_server_cb::connect) (struct bt_ftp_server *server, uint8_t version, uint16_t mopl, struct net_buf *buf)

OBEX CONNECT request callback.

Called when the client sends an OBEX CONNECT request. The server must reply via bt_ftp_server_connect.

Parameters
serverFTP server object.
versionOBEX version proposed by the client.
moplMaximum OBEX packet length proposed by the client.
bufBuffer containing request headers.

◆ copy

void(* bt_ftp_server_cb::copy) (struct bt_ftp_server *server, struct net_buf *buf)

Copy action request callback.

Called when the client sends a copy ACTION request. The server must reply via bt_ftp_server_copy.

Note
Only called on the L2CAP transport. An ACTION request received over RFCOMM is rejected with BT_FTP_RSP_CODE_NOT_IMPL.
Parameters
serverFTP server object.
bufBuffer containing the Name and DestName headers.

◆ disconnect

void(* bt_ftp_server_cb::disconnect) (struct bt_ftp_server *server, struct net_buf *buf)

OBEX DISCONNECT request callback.

Called when the client sends an OBEX DISCONNECT request. The server must reply via bt_ftp_server_disconnect.

Parameters
serverFTP server object.
bufBuffer containing request headers.

◆ l2cap_connected

void(* bt_ftp_server_cb::l2cap_connected) (struct bt_conn *conn, struct bt_ftp_server *server)

L2CAP transport connected callback.

Called when the underlying transport (L2CAP) connection is established. OBEX connection has not yet been negotiated at this point.

Parameters
connBluetooth connection object.
serverFTP server object.

◆ l2cap_disconnected

void(* bt_ftp_server_cb::l2cap_disconnected) (struct bt_ftp_server *server)

L2CAP transport disconnected callback.

Called when the underlying transport (L2CAP) connection is closed. All pending operations are cancelled.

Parameters
serverFTP server object.

◆ pull_file

void(* bt_ftp_server_cb::pull_file) (struct bt_ftp_server *server, bool final, struct net_buf *buf)

Pull file request callback.

Called when the client sends a GET file request. May be called multiple times if the client sends multiple GET packets. The server must reply via bt_ftp_server_pull_file.

Parameters
serverFTP server object.
finalTrue if this is the final GET packet from the client.
bufBuffer containing the Name header.

◆ pull_folder_listing

void(* bt_ftp_server_cb::pull_folder_listing) (struct bt_ftp_server *server, bool final, struct net_buf *buf)

Pull folder listing request callback.

Called when the client sends a GET folder-listing request. May be called multiple times if the client sends multiple GET packets. The server must reply via bt_ftp_server_pull_folder_listing.

Parameters
serverFTP server object.
finalTrue if this is the final GET packet from the client.
bufBuffer containing the request headers.

◆ push_file

void(* bt_ftp_server_cb::push_file) (struct bt_ftp_server *server, bool final, struct net_buf *buf)

Push file request callback.

Called when the client sends a PUT request to upload a file. May be called multiple times for a fragmented file upload; non-final packets may carry headers only, with the body following in later packets. The server must reply via bt_ftp_server_push_file.

Parameters
serverFTP server object.
finalTrue if this is the last PUT packet from the client.
bufBuffer containing the Name and Body headers.

◆ remove

void(* bt_ftp_server_cb::remove) (struct bt_ftp_server *server, struct net_buf *buf)

Remove request callback.

Called when the client sends a DELETE request (a final PUT with a Name header and without a Body/End-of-Body header). Remove is used to delete a file or folder. The server must reply via bt_ftp_server_remove.

Parameters
serverFTP server object.
bufBuffer containing the Name header.

◆ rename

void(* bt_ftp_server_cb::rename) (struct bt_ftp_server *server, struct net_buf *buf)

Rename/Move action request callback.

Called when the client sends a rename ACTION request. The server must reply via bt_ftp_server_rename.

Note
Only called on the L2CAP transport. An ACTION request received over RFCOMM is rejected with BT_FTP_RSP_CODE_NOT_IMPL.
Parameters
serverFTP server object.
bufBuffer containing the Name and DestName headers.

◆ rfcomm_connected

void(* bt_ftp_server_cb::rfcomm_connected) (struct bt_conn *conn, struct bt_ftp_server *server)

RFCOMM transport connected callback.

Called when the underlying transport (RFCOMM) connection is established. OBEX connection has not yet been negotiated at this point.

Parameters
connBluetooth connection object.
serverFTP server object.

◆ rfcomm_disconnected

void(* bt_ftp_server_cb::rfcomm_disconnected) (struct bt_ftp_server *server)

RFCOMM transport disconnected callback.

Called when the underlying transport (RFCOMM) connection is closed. All pending operations are cancelled.

Parameters
serverFTP server object.

◆ set_folder

void(* bt_ftp_server_cb::set_folder) (struct bt_ftp_server *server, uint8_t flags, struct net_buf *buf)

Set folder request callback.

Called when the client sends a SetPath request. The server must reply via bt_ftp_server_set_folder.

The requested folder is determined by flags together with the Name header in buf:

Note
BT_FTP_SET_FOLDER_FLAGS_ROOT and BT_FTP_SET_FOLDER_FLAGS_DOWN have the same value, so the length of the Name header is what distinguishes them.
Parameters
serverFTP server object.
flagsNavigation flags, bt_ftp_set_folder_flags.
bufBuffer containing request headers (e.g. Name).

◆ set_permission

void(* bt_ftp_server_cb::set_permission) (struct bt_ftp_server *server, struct net_buf *buf)

Set permission action request callback.

Called when the client sends a set-permissions ACTION request. The server must reply via bt_ftp_server_set_permission.

Note
Only called on the L2CAP transport. An ACTION request received over RFCOMM is rejected with BT_FTP_RSP_CODE_NOT_IMPL.
Parameters
serverFTP server object.
bufBuffer containing the Name and Permissions headers.

The documentation for this struct was generated from the following file:
  • zephyr/bluetooth/classic/ftp.h