Protocomm : Added new APIs for opening and closing secure sessions

New APIs:
* protocomm_open_session()
* protocomm_close_session()

This allows external applications using protocomm to manually create and close sessions.

These internally call the new_transport_session() and close_transport_session() APIs implemented by the security scheme in use.

Updated unit tests with usage of new APIs
This commit is contained in:
Anurag Kar
2019-04-15 18:36:09 +05:30
parent cccf829366
commit 86e9acc2c9
3 changed files with 108 additions and 2 deletions
@@ -114,6 +114,39 @@ esp_err_t protocomm_add_endpoint(protocomm_t *pc, const char *ep_name,
*/
esp_err_t protocomm_remove_endpoint(protocomm_t *pc, const char *ep_name);
/**
* @brief Allocates internal resources for new transport session
*
* @note
* - An endpoint must be bound to a valid protocomm instance,
* created using `protocomm_new()`.
*
* @param[in] pc Pointer to the protocomm instance
* @param[in] session_id Unique ID for a communication session
*
* @return
* - ESP_OK : Request handled successfully
* - ESP_ERR_NO_MEM : Error allocating internal resource
* - ESP_ERR_INVALID_ARG : Null instance/name arguments
*/
esp_err_t protocomm_open_session(protocomm_t *pc, uint32_t session_id);
/**
* @brief Frees internal resources used by a transport session
*
* @note
* - An endpoint must be bound to a valid protocomm instance,
* created using `protocomm_new()`.
*
* @param[in] pc Pointer to the protocomm instance
* @param[in] session_id Unique ID for a communication session
*
* @return
* - ESP_OK : Request handled successfully
* - ESP_ERR_INVALID_ARG : Null instance/name arguments
*/
esp_err_t protocomm_close_session(protocomm_t *pc, uint32_t session_id);
/**
* @brief Calls the registered handler of an endpoint session
* for processing incoming data and generating the response