Просмотр исходного кода

provisioning framework : 'extern C' directives added for C++ support

Anurag Kar 7 лет назад
Родитель
Сommit
776c23da4a

+ 8 - 0
components/protocomm/include/common/protocomm.h

@@ -17,6 +17,10 @@
 #include <protocomm_security.h>
 #include <esp_err.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief Function prototype for protocomm endpoint handler
  */
@@ -224,3 +228,7 @@ esp_err_t protocomm_set_version(protocomm_t *pc, const char *ep_name,
  *  - ESP_ERR_INVALID_ARG : Null instance/name arguments
  */
 esp_err_t protocomm_unset_version(protocomm_t *pc, const char *ep_name);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
components/protocomm/include/security/protocomm_security.h

@@ -16,6 +16,10 @@
 
 #include <esp_err.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Proof Of Possession for authenticating a secure session
  */
@@ -91,3 +95,7 @@ typedef struct protocomm_security {
                          const uint8_t *inbuf, ssize_t inlen,
                          uint8_t *outbuf, ssize_t *outlen);
 } protocomm_security_t;
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
components/protocomm/include/security/protocomm_security0.h

@@ -16,6 +16,10 @@
 
 #include <protocomm_security.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Protocomm security version 0 implementation
  *
@@ -23,3 +27,7 @@
  * security is required for the protocomm instance
  */
 extern const protocomm_security_t protocomm_security0;
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
components/protocomm/include/security/protocomm_security1.h

@@ -16,6 +16,10 @@
 
 #include <protocomm_security.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   Protocomm security version 1 implementation
  *
@@ -23,3 +27,7 @@
  * Curve25519 key exchange and AES-256-CTR encryption
  */
 extern const protocomm_security_t protocomm_security1;
+
+#ifdef __cplusplus
+}
+#endif

+ 9 - 1
components/protocomm/include/transports/protocomm_ble.h

@@ -16,6 +16,10 @@
 
 #include <protocomm.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * BLE device name cannot be larger than this value
  */
@@ -30,7 +34,7 @@ typedef struct name_uuid {
     /**
      * Name of the handler, which is passed to protocomm layer
      */
-    char   *name;
+    const char *name;
 
     /**
      * UUID to be assigned to the BLE characteristic which is
@@ -90,3 +94,7 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
  *  - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance
  */
 esp_err_t protocomm_ble_stop(protocomm_t *pc);
+
+#ifdef __cplusplus
+}
+#endif

+ 8 - 0
components/protocomm/include/transports/protocomm_console.h

@@ -16,6 +16,10 @@
 
 #include <protocomm.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define PROTOCOMM_CONSOLE_DEFAULT_CONFIG() { \
     .stack_size     = 4096,                  \
     .task_priority  = tskIDLE_PRIORITY + 3,  \
@@ -57,3 +61,7 @@ esp_err_t protocomm_console_start(protocomm_t *pc, const protocomm_console_confi
  *  - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance pointer
  */
 esp_err_t protocomm_console_stop(protocomm_t *pc);
+
+#ifdef __cplusplus
+}
+#endif

+ 10 - 2
components/protocomm/include/transports/protocomm_httpd.h

@@ -22,9 +22,13 @@
     .task_priority  = tskIDLE_PRIORITY + 5,  \
 }
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-
-/** Protocomm HTTP Server Configuration */
+/**
+ * @brief   Config parameters for protocomm HTTP server
+ */
 typedef struct {
 
     uint16_t port;          /*!< Port on which the http server will listen */
@@ -93,3 +97,7 @@ esp_err_t protocomm_httpd_start(protocomm_t *pc, const protocomm_httpd_config_t
  *  - ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance pointer
  */
 esp_err_t protocomm_httpd_stop(protocomm_t *pc);
+
+#ifdef __cplusplus
+}
+#endif

+ 1 - 1
components/protocomm/src/transports/protocomm_ble.c

@@ -372,7 +372,7 @@ static void protocomm_ble_cleanup(void)
         if (protoble_internal->g_nu_lookup) {
             for (unsigned i = 0; i < protoble_internal->g_nu_lookup_count; i++) {
                 if (protoble_internal->g_nu_lookup[i].name) {
-                    free(protoble_internal->g_nu_lookup[i].name);
+                    free((void *)protoble_internal->g_nu_lookup[i].name);
                 }
             }
             free(protoble_internal->g_nu_lookup);

+ 8 - 0
components/wifi_provisioning/include/wifi_provisioning/wifi_config.h

@@ -17,6 +17,10 @@
 
 #include <lwip/inet.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief   WiFi STA status for conveying back to the provisioning master
  */
@@ -117,4 +121,8 @@ typedef struct wifi_prov_config_handlers {
 esp_err_t wifi_prov_config_data_handler(uint32_t session_id, const uint8_t *inbuf, ssize_t inlen,
                                         uint8_t **outbuf, ssize_t *outlen, void *priv_data);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif