|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Data Structures | |
| struct | bt_ftp_server_cb |
| FTP server callback structure. More... | |
| struct | bt_ftp_server |
| FTP server structure. More... | |
| struct | bt_ftp_server_rfcomm |
| FTP server RFCOMM registration structure. More... | |
| struct | bt_ftp_server_l2cap |
| FTP server L2CAP registration structure. More... | |
Functions | |
| int | bt_ftp_server_register (struct bt_ftp_server *server, const struct bt_ftp_server_cb *cb) |
| Register an FTP server instance with the OBEX layer. | |
| int | bt_ftp_server_rfcomm_register (struct bt_ftp_server_rfcomm *server) |
| Register an FTP RFCOMM server. | |
| int | bt_ftp_server_l2cap_register (struct bt_ftp_server_l2cap *server) |
| Register an FTP L2CAP server. | |
| int | bt_ftp_server_rfcomm_disconnect (struct bt_ftp_server *server) |
| Disconnect the FTP server RFCOMM transport. | |
| int | bt_ftp_server_l2cap_disconnect (struct bt_ftp_server *server) |
| Disconnect the FTP server L2CAP transport. | |
| int | bt_ftp_server_connect (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send an OBEX CONNECT response from the FTP server. | |
| int | bt_ftp_server_disconnect (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send an OBEX DISCONNECT response from the FTP server. | |
| int | bt_ftp_server_abort (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send an OBEX ABORT response from the FTP server. | |
| int | bt_ftp_server_set_folder (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a set folder response from the FTP server. | |
| int | bt_ftp_server_pull_folder_listing (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a pull folder listing response from the FTP server. | |
| int | bt_ftp_server_push_file (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a push file response from the FTP server. | |
| int | bt_ftp_server_pull_file (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a pull file response from the FTP server. | |
| int | bt_ftp_server_remove (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a remove response from the FTP server. | |
| int | bt_ftp_server_rename (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a rename/move response from the FTP server. | |
| int | bt_ftp_server_copy (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a copy response from the FTP server. | |
| int | bt_ftp_server_set_permission (struct bt_ftp_server *server, uint8_t rsp_code, struct net_buf *buf) |
| Send a set permission response from the FTP server. | |
| struct net_buf * | bt_ftp_server_create_pdu (struct bt_ftp_server *server, struct net_buf_pool *pool) |
| Allocate a PDU buffer for an FTP server response. | |
| int bt_ftp_server_abort | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send an OBEX ABORT response from the FTP server.
Responds to an OBEX ABORT request from the remote FTP client. Called from the abort callback bt_ftp_server_cb::abort.
| server | FTP server object. |
| rsp_code | Response code, typically BT_FTP_RSP_CODE_SUCCESS. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no ABORT request is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_connect | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send an OBEX CONNECT response from the FTP server.
Responds to an OBEX CONNECT request from the remote FTP client. Called from the connect callback bt_ftp_server_cb::connect.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL, the server is not in the connecting OBEX state, the CONN_ID header in buf does not match the session's connection ID, the WHO header in buf is malformed or does not match the FTP service UUID, or rsp_code is BT_FTP_RSP_CODE_CONTINUE. |
| -ENODATA | The CONN_ID or WHO header in buf is present but empty or malformed. |
| -ENOBUFS | Buffer allocation failed when buf is NULL. |
| -ENOMEM | buf has insufficient tailroom for the CONN_ID or WHO header. |
| int bt_ftp_server_copy | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a copy response from the FTP server.
Responds to a copy ACTION request from the remote FTP client. Called from the copy callback bt_ftp_server_cb::copy.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no copy operation is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| struct net_buf * bt_ftp_server_create_pdu | ( | struct bt_ftp_server * | server, |
| struct net_buf_pool * | pool ) |
#include <zephyr/bluetooth/classic/ftp.h>
Allocate a PDU buffer for an FTP server response.
Allocates a buffer for building FTP response 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.
| server | FTP server object, FTP Server. |
| pool | Buffer pool to allocate from, or NULL for the default pool. |
| int bt_ftp_server_disconnect | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send an OBEX DISCONNECT response from the FTP server.
Responds to an OBEX DISCONNECT request from the remote FTP client. Called from the disconnect callback bt_ftp_server_cb::disconnect.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL, the server is not in the disconnecting OBEX state, or rsp_code is BT_FTP_RSP_CODE_CONTINUE. |
| int bt_ftp_server_l2cap_disconnect | ( | struct bt_ftp_server * | server | ) |
#include <zephyr/bluetooth/classic/ftp.h>
Disconnect the FTP server L2CAP transport.
Closes the L2CAP transport connection. On success, the l2cap_disconnected callback bt_ftp_server_cb::l2cap_disconnected will be called.
| server | FTP server object, FTP Server. |
| -EINVAL | server is NULL. |
| -EINPROGRESS | The server's transport is not currently connected. |
| int bt_ftp_server_l2cap_register | ( | struct bt_ftp_server_l2cap * | server | ) |
#include <zephyr/bluetooth/classic/ftp.h>
Register an FTP L2CAP server.
Register the server to listen for incoming L2CAP connections. The allocated PSM is stored in bt_l2cap_server::psm of bt_ftp_server_l2cap::server and is advertised via SDP.
bt_ftp_server_rfcomm_register must also be called, before or after this function. The SDP record is registered once both the RFCOMM and the L2CAP servers have been registered.
-EALREADY.| server | L2CAP server registration structure, bt_ftp_server_l2cap. |
| -EINVAL | server or server->accept is NULL. |
| -EALREADY | An L2CAP server is already registered. |
| int bt_ftp_server_pull_file | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a pull file response from the FTP server.
Responds to a GET file request from the remote FTP client. Called from the pull_file callback bt_ftp_server_cb::pull_file. Set rsp_code to BT_FTP_RSP_CODE_CONTINUE when there are more fragments to send, or BT_FTP_RSP_CODE_SUCCESS for the final fragment.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer containing the file data and headers. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL, no pull_file operation is pending, or rsp_code is BT_FTP_RSP_CODE_SUCCESS before the final request packet has been received. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_pull_folder_listing | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a pull folder listing response from the FTP server.
Responds to a GET folder listing request from the remote FTP client. Called from the pull_folder_listing callback bt_ftp_server_cb::pull_folder_listing. Set rsp_code to BT_FTP_RSP_CODE_CONTINUE when there are more fragments to send, or BT_FTP_RSP_CODE_SUCCESS for the final fragment.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer containing the folder listing data and headers. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL, no pull_folder_listing operation is pending, or rsp_code is BT_FTP_RSP_CODE_SUCCESS before the final request packet has been received. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_push_file | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a push file response from the FTP server.
Responds to a PUT file request from the remote FTP client. Called from the push_file callback bt_ftp_server_cb::push_file. Set rsp_code to BT_FTP_RSP_CODE_CONTINUE to request more data from the client, or BT_FTP_RSP_CODE_SUCCESS when the file upload is complete.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL, no push_file operation is pending, or rsp_code is BT_FTP_RSP_CODE_SUCCESS before the final request packet has been received. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_register | ( | struct bt_ftp_server * | server, |
| const struct bt_ftp_server_cb * | cb ) |
#include <zephyr/bluetooth/classic/ftp.h>
Register an FTP server instance with the OBEX layer.
Associates a callback table with the server object and registers it with the underlying OBEX server.
server object must be zero-initialized by the caller before this call. Each server instance can only be registered once; if it is already registered, this function returns -EALREADY rather than overwriting its state.cb must provide the rfcomm_connected, rfcomm_disconnected, 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.| server | FTP server object, FTP Server. |
| cb | Callback table, bt_ftp_server_cb. |
| -EINVAL | server or cb is NULL. |
| -EALREADY | server is already registered. |
| int bt_ftp_server_remove | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a remove response from the FTP server.
Responds to a remove (DELETE) request from the remote FTP client. Called from the remove callback bt_ftp_server_cb::remove.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no remove operation is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_rename | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a rename/move response from the FTP server.
Responds to a rename/move ACTION request from the remote FTP client. Called from the rename callback bt_ftp_server_cb::rename.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no rename operation is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_rfcomm_disconnect | ( | struct bt_ftp_server * | server | ) |
#include <zephyr/bluetooth/classic/ftp.h>
Disconnect the FTP server RFCOMM transport.
Closes the RFCOMM transport connection. On success, the rfcomm_disconnected callback bt_ftp_server_cb::rfcomm_disconnected will be called.
| server | FTP server object, FTP Server. |
| -EINVAL | server is NULL. |
| -EINPROGRESS | The server's transport is not currently connected. |
| int bt_ftp_server_rfcomm_register | ( | struct bt_ftp_server_rfcomm * | server | ) |
#include <zephyr/bluetooth/classic/ftp.h>
Register an FTP RFCOMM server.
Register the server to listen for incoming RFCOMM connections. The allocated channel is stored in bt_rfcomm_server::channel of bt_ftp_server_rfcomm::server and is advertised via SDP.
bt_ftp_server_l2cap_register must also be called, before or after this function. The SDP record is registered once both the RFCOMM and the L2CAP servers have been registered.
-EALREADY.| server | RFCOMM server registration structure, bt_ftp_server_rfcomm. |
| -EINVAL | server or server->accept is NULL. |
| -EALREADY | An RFCOMM server is already registered. |
| int bt_ftp_server_set_folder | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a set folder response from the FTP server.
Responds to a SetPath request from the remote FTP client. Called from the set_folder callback bt_ftp_server_cb::set_folder.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no SetPath request is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |
| int bt_ftp_server_set_permission | ( | struct bt_ftp_server * | server, |
| uint8_t | rsp_code, | ||
| struct net_buf * | buf ) |
#include <zephyr/bluetooth/classic/ftp.h>
Send a set permission response from the FTP server.
Responds to a set-permissions ACTION request from the remote FTP client. Called from the set_permission callback bt_ftp_server_cb::set_permission.
| server | FTP server object. |
| rsp_code | Response code, bt_ftp_rsp_code. |
| buf | Buffer with response headers, or NULL. If success returned, the function has taken the ownership of buf. |
| -EINVAL | server is NULL or no set_permission operation is pending. |
| -ENOTCONN | The server is not in the connected OBEX state. |