From f3a6c63920cdb4a1cb3c3959267f427221399b92 Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Fri, 8 Feb 2019 15:21:33 +0530 Subject: [PATCH] protocomm : typos fixed and descriptions corrected --- .../protocomm/include/common/protocomm.h | 25 ++++++++++--------- .../include/security/protocomm_security.h | 4 +-- .../include/security/protocomm_security1.h | 2 +- .../include/transports/protocomm_ble.h | 6 ++--- .../include/transports/protocomm_console.h | 6 ++--- .../include/transports/protocomm_httpd.h | 18 +++++++------ components/protocomm/src/common/protocomm.c | 2 +- .../protocomm/src/common/protocomm_priv.h | 2 +- .../protocomm/src/simple_ble/simple_ble.c | 2 +- .../protocomm/src/simple_ble/simple_ble.h | 2 +- .../protocomm/src/transports/protocomm_ble.c | 6 ++--- .../src/transports/protocomm_console.c | 2 +- .../src/transports/protocomm_httpd.c | 12 ++++----- 13 files changed, 47 insertions(+), 42 deletions(-) diff --git a/components/protocomm/include/common/protocomm.h b/components/protocomm/include/common/protocomm.h index 4ca65edf5..239d71390 100644 --- a/components/protocomm/include/common/protocomm.h +++ b/components/protocomm/include/common/protocomm.h @@ -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 */ diff --git a/components/protocomm/include/security/protocomm_security.h b/components/protocomm/include/security/protocomm_security.h index a97fb9ac8..28f43a657 100644 --- a/components/protocomm/include/security/protocomm_security.h +++ b/components/protocomm/include/security/protocomm_security.h @@ -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)(); diff --git a/components/protocomm/include/security/protocomm_security1.h b/components/protocomm/include/security/protocomm_security1.h index 4d96f2cde..12a05c322 100644 --- a/components/protocomm/include/security/protocomm_security1.h +++ b/components/protocomm/include/security/protocomm_security1.h @@ -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; diff --git a/components/protocomm/include/transports/protocomm_ble.h b/components/protocomm/include/transports/protocomm_ble.h index a6f4e64b4..562ea608c 100644 --- a/components/protocomm/include/transports/protocomm_ble.h +++ b/components/protocomm/include/transports/protocomm_ble.h @@ -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 */ diff --git a/components/protocomm/include/transports/protocomm_console.h b/components/protocomm/include/transports/protocomm_console.h index ffff72f65..767bcd7ca 100644 --- a/components/protocomm/include/transports/protocomm_console.h +++ b/components/protocomm/include/transports/protocomm_console.h @@ -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); diff --git a/components/protocomm/include/transports/protocomm_httpd.h b/components/protocomm/include/transports/protocomm_httpd.h index cb7e88821..2baf75455 100644 --- a/components/protocomm/include/transports/protocomm_httpd.h +++ b/components/protocomm/include/transports/protocomm_httpd.h @@ -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); diff --git a/components/protocomm/src/common/protocomm.c b/components/protocomm/src/common/protocomm.c index b785d8e99..687efdbab 100644 --- a/components/protocomm/src/common/protocomm.c +++ b/components/protocomm/src/common/protocomm.c @@ -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; } diff --git a/components/protocomm/src/common/protocomm_priv.h b/components/protocomm/src/common/protocomm_priv.h index e956c3fd0..895d11015 100644 --- a/components/protocomm/src/common/protocomm_priv.h +++ b/components/protocomm/src/common/protocomm_priv.h @@ -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 */ diff --git a/components/protocomm/src/simple_ble/simple_ble.c b/components/protocomm/src/simple_ble/simple_ble.c index e52be0053..f29f1a348 100644 --- a/components/protocomm/src/simple_ble/simple_ble.c +++ b/components/protocomm/src/simple_ble/simple_ble.c @@ -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); } diff --git a/components/protocomm/src/simple_ble/simple_ble.h b/components/protocomm/src/simple_ble/simple_ble.h index 892cd4d55..4402429f6 100644 --- a/components/protocomm/src/simple_ble/simple_ble.h +++ b/components/protocomm/src/simple_ble/simple_ble.h @@ -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. diff --git a/components/protocomm/src/transports/protocomm_ble.c b/components/protocomm/src/transports/protocomm_ble.c index 037f61d29..b374f055e 100644 --- a/components/protocomm/src/transports/protocomm_ble.c +++ b/components/protocomm/src/transports/protocomm_ble.c @@ -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; } diff --git a/components/protocomm/src/transports/protocomm_console.c b/components/protocomm/src/transports/protocomm_console.c index 5c268bc49..e1e10a772 100644 --- a/components/protocomm/src/transports/protocomm_console.c +++ b/components/protocomm/src/transports/protocomm_console.c @@ -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 = { diff --git a/components/protocomm/src/transports/protocomm_httpd.c b/components/protocomm/src/transports/protocomm_httpd.c index e81bf7fb9..b4653b9a5 100644 --- a/components/protocomm/src/transports/protocomm_httpd.c +++ b/components/protocomm/src/transports/protocomm_httpd.c @@ -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);