EasyManua.ls Logo

Espressif ESP32-S2 - Page 680

Espressif ESP32-S2
1695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
• [in] pc: Pointer to the protocomm instance
• [in] session_id: Unique ID for a communication session
esp_err_t protocomm_req_handle(protocomm_t *pc, const char *ep_name, uint32_t session_id,
const uint8_t *inbuf, ssize_t inlen, uint8_t **outbuf, ssize_t
*outlen)
Calls the registered handler of an endpoint session for processing incoming data and generating the response.
Note
• An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
• Resulting output buffer must be deallocated by the caller.
Return
• ESP_OK : Request handled successfully
• ESP_FAIL : Internal error in execution of registered handler
• ESP_ERR_NO_MEM : Error allocating internal resource
• ESP_ERR_NOT_FOUND : Endpoint with specified name doesn’t exist
• ESP_ERR_INVALID_ARG : Null instance/name arguments
Parameters
• [in] pc: Pointer to the protocomm instance
• [in] ep_name: Endpoint identifier(name) string
• [in] session_id: Unique ID for a communication session
• [in] inbuf: Input buffer contains input request data which is to be processed by the registered
handler
• [in] inlen: Length of the input buffer
• [out] outbuf: Pointer to internally allocated output buffer, where the resulting response data
output from the registered handler is to be stored
• [out] outlen: Buffer length of the allocated output buffer
esp_err_t protocomm_set_security(protocomm_t *pc, const char *ep_name, const pro-
tocomm_security_t *sec, const protocomm_security_pop_t
*pop)
Add endpoint security for a protocomm instance.
This API will bind a security session establisher to the specified endpoint name, along with any proof of
possession that may be required for authenticating a session client.
Note
• An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
• The choice of security can be any protocomm_security_t instance. Choices proto-
comm_security0 and protocomm_security1 are readily available.
Return
• ESP_OK : Success
• ESP_FAIL : Error adding endpoint / Endpoint with this name already exists
• ESP_ERR_INVALID_STATE : Security endpoint already set
• ESP_ERR_NO_MEM : Error allocating endpoint resource
• ESP_ERR_INVALID_ARG : Null instance/name/handler arguments
Parameters
• [in] pc: Pointer to the protocomm instance
• [in] ep_name: Endpoint identifier(name) string
• [in] sec: Pointer to endpoint security instance
• [in] pop: Pointer to proof of possession for authenticating a client
esp_err_t protocomm_unset_security(protocomm_t *pc, const char *ep_name)
Remove endpoint security for a protocomm instance.
This API will remove a registered security endpoint identified by an endpoint name.
Return
• ESP_OK : Success
• ESP_ERR_NOT_FOUND : Endpoint with specified name doesn’t exist
• ESP_ERR_INVALID_ARG : Null instance/name arguments
Parameters
Espressif Systems 669
Submit Document Feedback
Release v4.4

Table of Contents