Function esp_idf_svc::sys::protocomm_set_security
source ยท pub unsafe extern "C" fn protocomm_set_security(
pc: *mut protocomm,
ep_name: *const i8,
sec: *const protocomm_security,
sec_params: *const c_void,
) -> i32
Expand description
@brief 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. Choicesprotocomm_security0
andprotocomm_security1
andprotocomm_security2
are readily available.
@param[in] pc Pointer to the protocomm instance @param[in] ep_name Endpoint identifier(name) string @param[in] sec Pointer to endpoint security instance @param[in] sec_params Pointer to security params (NULL if not needed) The pointer should contain the security params struct of appropriate security version. For protocomm security version 1 and 2 sec_params should contain pointer to struct of type protocomm_security1_params_t and protocmm_security2_params_t respectively. The contents of this pointer must be valid till the security session has been running and is not closed. @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