|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
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. | |
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."
| 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.
| server | FTP server object. |
| buf | Buffer containing request headers. |
| 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.
| server | FTP server object. |
| version | OBEX version proposed by the client. |
| mopl | Maximum OBEX packet length proposed by the client. |
| buf | Buffer containing request headers. |
| 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.
| server | FTP server object. |
| buf | Buffer containing the Name and DestName headers. |
| 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.
| server | FTP server object. |
| buf | Buffer containing request headers. |
| 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.
| conn | Bluetooth connection object. |
| server | FTP server object. |
| 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.
| server | FTP server object. |
| 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.
| server | FTP server object. |
| final | True if this is the final GET packet from the client. |
| buf | Buffer containing the Name header. |
| 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.
| server | FTP server object. |
| final | True if this is the final GET packet from the client. |
| buf | Buffer containing the request headers. |
| 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.
| server | FTP server object. |
| final | True if this is the last PUT packet from the client. |
| buf | Buffer containing the Name and Body headers. |
| 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.
| server | FTP server object. |
| buf | Buffer containing the Name header. |
| 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.
| server | FTP server object. |
| buf | Buffer containing the Name and DestName headers. |
| 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.
| conn | Bluetooth connection object. |
| server | FTP server object. |
| 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.
| server | FTP server object. |
| 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:
| server | FTP server object. |
| flags | Navigation flags, bt_ftp_set_folder_flags. |
| buf | Buffer containing request headers (e.g. Name). |
| 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.
| server | FTP server object. |
| buf | Buffer containing the Name and Permissions headers. |