protocomm : typos fixed and descriptions corrected

This commit is contained in:
Anurag Kar 2019-02-08 15:21:33 +05:30 committed by bot
parent b51f109dd7
commit 6a328992d7
13 changed files with 47 additions and 42 deletions

View file

@ -46,7 +46,7 @@ typedef struct protocomm protocomm_t;
* @brief Create a new protocomm instance
*
* This API will return a new dynamically allocated protocomm instance
* with all elements of the protocomm_t structure initialised to NULL.
* with all elements of the protocomm_t structure initialized to NULL.
*
* @return
* - protocomm_t* : On success
@ -75,7 +75,8 @@ void protocomm_delete(protocomm_t *pc);
* - An endpoint must be bound to a valid protocomm instance,
* created using `protocomm_new()`.
* - This function internally calls the registered `add_endpoint()`
* function which is a member of the protocomm_t instance structure.
* function of the selected transport which is a member of the
* protocomm_t instance structure.
*
* @param[in] pc Pointer to the protocomm instance
* @param[in] ep_name Endpoint identifier(name) string
@ -85,7 +86,7 @@ void protocomm_delete(protocomm_t *pc);
* Pass NULL if not needed.
*
* @return
* - ESP_OK : Added new endpoint succesfully
* - ESP_OK : Success
* - ESP_FAIL : Error adding endpoint / Endpoint with this name already exists
* - ESP_ERR_NO_MEM : Error allocating endpoint resource
* - ESP_ERR_INVALID_ARG : Null instance/name/handler arguments
@ -107,7 +108,7 @@ esp_err_t protocomm_add_endpoint(protocomm_t *pc, const char *ep_name,
* @param[in] ep_name Endpoint identifier(name) string
*
* @return
* - ESP_OK : Added new endpoint succesfully
* - ESP_OK : Success
* - ESP_ERR_NOT_FOUND : Endpoint with specified name doesn't exist
* - ESP_ERR_INVALID_ARG : Null instance/name arguments
*/
@ -115,12 +116,12 @@ esp_err_t protocomm_remove_endpoint(protocomm_t *pc, const char *ep_name);
/**
* @brief Calls the registered handler of an endpoint session
* for processing incoming data and giving the output
* 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 user.
* - Resulting output buffer must be deallocated by the caller.
*
* @param[in] pc Pointer to the protocomm instance
* @param[in] ep_name Endpoint identifier(name) string
@ -134,7 +135,7 @@ esp_err_t protocomm_remove_endpoint(protocomm_t *pc, const char *ep_name);
* @param[out] outlen Buffer length of the allocated output buffer
*
* @return
* - ESP_OK : Request handled succesfully
* - 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
@ -163,7 +164,7 @@ esp_err_t protocomm_req_handle(protocomm_t *pc, const char *ep_name, uint32_t se
* @param[in] pop Pointer to proof of possession for authenticating a client
*
* @return
* - ESP_OK : Added new security endpoint succesfully
* - 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
@ -183,7 +184,7 @@ esp_err_t protocomm_set_security(protocomm_t *pc, const char *ep_name,
* @param[in] ep_name Endpoint identifier(name) string
*
* @return
* - ESP_OK : Added new endpoint succesfully
* - ESP_OK : Success
* - ESP_ERR_NOT_FOUND : Endpoint with specified name doesn't exist
* - ESP_ERR_INVALID_ARG : Null instance/name arguments
*/
@ -193,7 +194,7 @@ esp_err_t protocomm_unset_security(protocomm_t *pc, const char *ep_name);
* @brief Set endpoint for version verification
*
* This API can be used for setting an application specific protocol
* version which can be verfied by clients through the endpoint.
* version which can be verified by clients through the endpoint.
*
* @note
* - An endpoint must be bound to a valid protocomm instance,
@ -204,7 +205,7 @@ esp_err_t protocomm_unset_security(protocomm_t *pc, const char *ep_name);
* @param[in] version Version identifier(name) string
*
* @return
* - ESP_OK : Added new security endpoint succesfully
* - ESP_OK : Success
* - ESP_FAIL : Error adding endpoint / Endpoint with this name already exists
* - ESP_ERR_INVALID_STATE : Version endpoint already set
* - ESP_ERR_NO_MEM : Error allocating endpoint resource
@ -223,7 +224,7 @@ esp_err_t protocomm_set_version(protocomm_t *pc, const char *ep_name,
* @param[in] ep_name Endpoint identifier(name) string
*
* @return
* - ESP_OK : Added new endpoint succesfully
* - ESP_OK : Success
* - ESP_ERR_NOT_FOUND : Endpoint with specified name doesn't exist
* - ESP_ERR_INVALID_ARG : Null instance/name arguments
*/

View file

@ -46,12 +46,12 @@ typedef struct protocomm_security_pop {
*/
typedef struct protocomm_security {
/**
* Unique version number of security implmentation
* Unique version number of security implementation
*/
int ver;
/**
* Function for initialising/allocating security
* Function for initializing/allocating security
* infrastructure
*/
esp_err_t (*init)();

View file

@ -23,7 +23,7 @@ extern "C" {
/**
* @brief Protocomm security version 1 implementation
*
* This is a full fledged security implmentation using
* This is a full fledged security implementation using
* Curve25519 key exchange and AES-256-CTR encryption
*/
extern const protocomm_security_t protocomm_security1;

View file

@ -67,10 +67,10 @@ typedef struct {
* the initialization for characteristics/service for BLE.
*
* @param[in] pc Protocomm instance pointer obtained from protocomm_new()
* @param[in] config Pointer to config structure for initialising BLE
* @param[in] config Pointer to config structure for initializing BLE
*
* @return
* - ESP_OK : if successful
* - ESP_OK : Success
* - ESP_FAIL : Simple BLE start error
* - ESP_ERR_NO_MEM : Error allocating memory for internal resources
* - ESP_ERR_INVALID_STATE : Error in ble config
@ -89,7 +89,7 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
* @param[in] pc Same protocomm instance that was passed to protocomm_ble_start()
*
* @return
* - ESP_OK : For success or appropriate error code
* - ESP_OK : Success
* - ESP_FAIL : Simple BLE stop error
* - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance
*/

View file

@ -29,7 +29,7 @@ extern "C" {
* @brief Config parameters for protocomm console
*/
typedef struct {
size_t stack_size; /*!< Stack size of console taks */
size_t stack_size; /*!< Stack size of console task */
unsigned task_priority; /*!< Priority of console task */
} protocomm_console_config_t;
@ -43,7 +43,7 @@ typedef struct {
* @param[in] config Config param structure for protocomm console
*
* @return
* - ESP_OK : Server started succefully
* - ESP_OK : Success
* - ESP_ERR_INVALID_ARG : Null arguments
* - ESP_ERR_NOT_SUPPORTED : Transport layer bound to another protocomm instance
* - ESP_ERR_INVALID_STATE : Transport layer already bound to this protocomm instance
@ -57,7 +57,7 @@ esp_err_t protocomm_console_start(protocomm_t *pc, const protocomm_console_confi
* @param[in] pc Same protocomm instance that was passed to protocomm_console_start()
*
* @return
* - ESP_OK : Server stopped succefully
* - ESP_OK : Success
* - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance pointer
*/
esp_err_t protocomm_console_stop(protocomm_t *pc);

View file

@ -31,7 +31,7 @@ extern "C" {
*/
typedef struct {
uint16_t port; /*!< Port on which the http server will listen */
uint16_t port; /*!< Port on which the HTTP server will listen */
/**
* Stack size of server task, adjusted depending
@ -41,11 +41,15 @@ typedef struct {
unsigned task_priority; /*!< Priority of server task */
} protocomm_http_server_config_t; /*!< HTTP Server Configuration, if HTTP Server has not been started already */
/** Protocomm HTTPD Configuration Data */
/** Protocomm HTTPD Configuration Data
*/
typedef union {
/** HTTP Server Handle, if ext_handle_provided is set to true */
/** HTTP Server Handle, if ext_handle_provided is set to true
*/
void *handle;
/** HTTP Server Configuration, if a server is not already active */
/** HTTP Server Configuration, if a server is not already active
*/
protocomm_http_server_config_t config;
} protocomm_httpd_config_data_t;
@ -72,10 +76,10 @@ typedef struct {
* one instance can be bound to an HTTP transport layer.
*
* @param[in] pc Protocomm instance pointer obtained from protocomm_new()
* @param[in] config Pointer to config structure for initialising HTTP server
* @param[in] config Pointer to config structure for initializing HTTP server
*
* @return
* - ESP_OK : Server started succefully
* - ESP_OK : Success
* - ESP_ERR_INVALID_ARG : Null arguments
* - ESP_ERR_NOT_SUPPORTED : Transport layer bound to another protocomm instance
* - ESP_ERR_INVALID_STATE : Transport layer already bound to this protocomm instance
@ -93,7 +97,7 @@ esp_err_t protocomm_httpd_start(protocomm_t *pc, const protocomm_httpd_config_t
* @param[in] pc Same protocomm instance that was passed to protocomm_httpd_start()
*
* @return
* - ESP_OK : Server stopped succefully
* - ESP_OK : Success
* - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance pointer
*/
esp_err_t protocomm_httpd_stop(protocomm_t *pc);

View file

@ -285,7 +285,7 @@ esp_err_t protocomm_set_security(protocomm_t *pc, const char *ep_name,
if (sec->init) {
ret = sec->init();
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Error initialising security");
ESP_LOGE(TAG, "Error initializing security");
protocomm_remove_endpoint(pc, ep_name);
return ret;
}

View file

@ -62,7 +62,7 @@ struct protocomm {
int (*remove_endpoint)(const char *ep_name);
/* Pointer to security layer instance to be used internally for
* establising secure sessions */
* establishing secure sessions */
const protocomm_security_t *sec;
/* Pointer to proof of possession object */

View file

@ -103,7 +103,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
g_ble_cfg_p->exec_write_fn(event, gatts_if, param);
break;
case ESP_GATTS_MTU_EVT:
ESP_LOGV(TAG, "ESP_GATTS_MTU_EVT, MTU %d", param->mtu.mtu);
ESP_LOGD(TAG, "ESP_GATTS_MTU_EVT, MTU %d", param->mtu.mtu);
if (g_ble_cfg_p->set_mtu_fn) {
g_ble_cfg_p->set_mtu_fn(event, gatts_if, param);
}

View file

@ -55,7 +55,7 @@ typedef struct {
} simple_ble_cfg_t;
/** Initialise a simple ble connection
/** Initialize a simple ble connection
*
* This function allocates memory and returns a pointer to the
* configuration structure.

View file

@ -276,7 +276,7 @@ static void transport_simple_ble_exec_write(esp_gatts_cb_event_t event, esp_gatt
static void transport_simple_ble_disconnect(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
{
esp_err_t ret;
ESP_LOGV(TAG, "Inside disconnect w/ session - %d", param->disconnect.conn_id);
ESP_LOGD(TAG, "Inside disconnect w/ session - %d", param->disconnect.conn_id);
if (protoble_internal->pc_ble->sec &&
protoble_internal->pc_ble->sec->close_transport_session) {
ret = protoble_internal->pc_ble->sec->close_transport_session(param->disconnect.conn_id);
@ -290,7 +290,7 @@ static void transport_simple_ble_disconnect(esp_gatts_cb_event_t event, esp_gatt
static void transport_simple_ble_connect(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
{
esp_err_t ret;
ESP_LOGV(TAG, "Inside BLE connect w/ conn_id - %d", param->connect.conn_id);
ESP_LOGD(TAG, "Inside BLE connect w/ conn_id - %d", param->connect.conn_id);
if (protoble_internal->pc_ble->sec &&
protoble_internal->pc_ble->sec->new_transport_session) {
ret = protoble_internal->pc_ble->sec->new_transport_session(param->connect.conn_id);
@ -488,7 +488,7 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
}
prepare_write_env.prepare_buf = NULL;
ESP_LOGV(TAG, "Waiting for client to connect ......");
ESP_LOGD(TAG, "Waiting for client to connect ......");
return ESP_OK;
}

View file

@ -76,7 +76,7 @@ static void protocomm_console_task(void *arg)
QueueHandle_t uart_queue;
uart_event_t event;
ESP_LOGV(TAG, "Initialising UART on port %d", uart_num);
ESP_LOGD(TAG, "Initializing UART on port %d", uart_num);
uart_driver_install(uart_num, 256, 0, 8, &uart_queue, 0);
/* Initialize the console */
esp_console_config_t console_config = {

View file

@ -26,7 +26,7 @@
static const char *TAG = "protocomm_httpd";
static protocomm_t *pc_httpd; /* The global protocomm instance for HTTPD */
static bool pc_ext_httpd_handle_provided;
static bool pc_ext_httpd_handle_provided = false;
static uint32_t session_id = PROTOCOMM_NO_SESSION_ID;
#define MAX_REQ_BODY_LEN 4096
@ -42,9 +42,9 @@ static esp_err_t common_post_handler(httpd_req_t *req)
int cur_session_id = httpd_req_to_sockfd(req);
if (cur_session_id != session_id) {
/* Initialise new security session */
/* Initialize new security session */
if (session_id != PROTOCOMM_NO_SESSION_ID) {
ESP_LOGV(TAG, "Closing session with ID: %d", session_id);
ESP_LOGD(TAG, "Closing session with ID: %d", session_id);
/* Presently HTTP server doesn't support callback on socket closure so
* previous session can only be closed when new session is requested */
if (pc_httpd->sec && pc_httpd->sec->close_transport_session) {
@ -66,7 +66,7 @@ static esp_err_t common_post_handler(httpd_req_t *req)
}
}
session_id = cur_session_id;
ESP_LOGV(TAG, "New session with ID: %d", cur_session_id);
ESP_LOGD(TAG, "New session with ID: %d", cur_session_id);
}
if (req->content_len <= 0) {
@ -133,7 +133,7 @@ static esp_err_t protocomm_httpd_add_endpoint(const char *ep_name,
return ESP_ERR_INVALID_STATE;
}
ESP_LOGV(TAG, "Adding endpoint : %s", ep_name);
ESP_LOGD(TAG, "Adding endpoint : %s", ep_name);
/* Construct URI name by prepending '/' to ep_name */
char* ep_uri = calloc(1, strlen(ep_name) + 2);
@ -170,7 +170,7 @@ static esp_err_t protocomm_httpd_remove_endpoint(const char *ep_name)
return ESP_ERR_INVALID_STATE;
}
ESP_LOGV(TAG, "Removing endpoint : %s", ep_name);
ESP_LOGD(TAG, "Removing endpoint : %s", ep_name);
/* Construct URI name by prepending '/' to ep_name */
char* ep_uri = calloc(1, strlen(ep_name) + 2);