From: EunBong Song Date: Wed, 9 Aug 2017 01:03:32 +0000 (-0700) Subject: netutils: cosmetic change of header files for c++ reference X-Git-Tag: 1.1_Public_Release~318^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32d90b88ae3bc5ce4d5720945cfbdf30b209817d;p=rtos%2Ftinyara.git netutils: cosmetic change of header files for c++ reference This patch changes all header files for cplusplus reference. Change-Id: I40a16b13291a3bb8c4c3e03a4c33cacf56168765 Signed-off-by: EunBong Song --- diff --git a/apps/include/netutils/base64.h b/apps/include/netutils/base64.h index 9f4fac1..c35916c 100644 --- a/apps/include/netutils/base64.h +++ b/apps/include/netutils/base64.h @@ -76,10 +76,10 @@ #include #ifdef __cplusplus -// *INDENT-OFF* -extern "C" -{ -// *INDENT-ON* +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern #endif /**************************************************************************** @@ -93,9 +93,9 @@ unsigned char *base64w_encode(const unsigned char *src, size_t len, unsigned cha unsigned char *base64w_decode(const unsigned char *src, size_t len, unsigned char *dst, size_t * out_len); #endif /* CONFIG_CODECS_BASE64 */ +#undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif + #endif /* __APPS_INCLUDE_NETUTILS_BASE64_H */ diff --git a/apps/include/netutils/cJSON.h b/apps/include/netutils/cJSON.h index be28081..bf82783 100644 --- a/apps/include/netutils/cJSON.h +++ b/apps/include/netutils/cJSON.h @@ -51,10 +51,10 @@ #define __APPS_INCLUDE_NETUTILS_JSON_H #ifdef __cplusplus -// *INDENT-OFF* -extern "C" -{ -// *INDENT-ON* +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern #endif /**************************************************************************** @@ -236,9 +236,8 @@ cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int void cJSON_Minify(char *json); +#undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_JSON_H */ diff --git a/apps/include/netutils/commandline.h b/apps/include/netutils/commandline.h index 3a8851d..17ecd4e 100644 --- a/apps/include/netutils/commandline.h +++ b/apps/include/netutils/commandline.h @@ -34,6 +34,15 @@ #include + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + #define COMMAND_END_LIST {NULL, NULL, NULL, NULL, NULL} typedef void (*command_handler_t)(char *args, void *user_data); @@ -56,3 +65,8 @@ void output_tlv(FILE *stream, uint8_t *buffer, size_t buffer_len, int indent); void dump_tlv(FILE *stream, int size, lwm2m_data_t *dataP, int indent); void output_data(FILE *stream, lwm2m_media_type_t format, uint8_t *buffer, int length, int indent); void print_status(FILE *stream, uint8_t status); + +#undef EXTERN +#ifdef __cplusplus +} +#endif diff --git a/apps/include/netutils/connection.h b/apps/include/netutils/connection.h index e5c9f43..391597d 100644 --- a/apps/include/netutils/connection.h +++ b/apps/include/netutils/connection.h @@ -43,6 +43,13 @@ #include #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + #define LWM2M_STANDARD_PORT_STR "5683" #define LWM2M_STANDARD_PORT 5683 @@ -63,4 +70,9 @@ void connection_free(connection_t *connList); int connection_send(connection_t *connP, uint8_t *buffer, size_t length); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif diff --git a/apps/include/netutils/dhcpc.h b/apps/include/netutils/dhcpc.h index 3ff1168..8e0ceb2 100644 --- a/apps/include/netutils/dhcpc.h +++ b/apps/include/netutils/dhcpc.h @@ -95,12 +95,10 @@ struct dhcpc_state { ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /** @@ -135,9 +133,7 @@ void dhcpc_close(void *handle); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_DHCPC_H */ diff --git a/apps/include/netutils/dhcpd.h b/apps/include/netutils/dhcpd.h index 841ba4c..fb2531f 100644 --- a/apps/include/netutils/dhcpd.h +++ b/apps/include/netutils/dhcpd.h @@ -82,12 +82,10 @@ ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /** @@ -108,9 +106,7 @@ int dhcpd_start(char *intf); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_DHCPD_H */ diff --git a/apps/include/netutils/discover.h b/apps/include/netutils/discover.h index 00c3d95..1f4df2d 100644 --- a/apps/include/netutils/discover.h +++ b/apps/include/netutils/discover.h @@ -55,6 +55,14 @@ #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -83,4 +91,9 @@ struct discover_info_s { int discover_start(struct discover_info_s *info); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /* __APPS_INCLUDE_NETUTILS_DISCOVER_H */ diff --git a/apps/include/netutils/ftpd.h b/apps/include/netutils/ftpd.h index 69bddac..b6e106c 100644 --- a/apps/include/netutils/ftpd.h +++ b/apps/include/netutils/ftpd.h @@ -133,12 +133,10 @@ typedef FAR void *FTPD_SESSION; ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /**************************************************************************** @@ -229,8 +227,6 @@ EXTERN void ftpd_close(FTPD_SESSION handle); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_FTPD_H */ diff --git a/apps/include/netutils/httpd.h b/apps/include/netutils/httpd.h new file mode 100644 index 0000000..874ed32 --- /dev/null +++ b/apps/include/netutils/httpd.h @@ -0,0 +1,218 @@ +/**************************************************************************** + * + * Copyright 2016 Samsung Electronics All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + * + ****************************************************************************/ +/**************************************************************************** + * apps/include/netutils/httpd.h + * + * Copyright (C) 2007, 2009, 2011-2012, 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Based on uIP which also has a BSD style license: + * + * Author: Adam Dunkels + * Copyright (c) 2001-2005, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_INCLUDE_NETUTILS_HTTPD_H +#define __APPS_INCLUDE_NETUTILS_HTTPD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* As threads are created to handle each request, a stack must be allocated + * for the thread. Use a default if the user provided no stacksize. + */ + +#ifndef CONFIG_NETUTILS_HTTPDSTACKSIZE +#define CONFIG_NETUTILS_HTTPDSTACKSIZE 4096 +#endif + +#ifndef CONFIG_NETUTILS_HTTPDFSSTATS +#define CONFIG_NETUTILS_HTTPDFSSTATS +#endif + +#ifndef CONFIG_NETUTILS_HTTPDFILESTATS +#define CONFIG_NETUTILS_HTTPDFILESTATS +#endif + +#undef CONFIG_NETUTILS_HTTPDNETSTATS + +/* For efficiency reasons, the size of the IO buffer should be a multiple + * of the TCP MSS value. Also, the current design requires that the IO + * buffer be sufficiently large to contain the entire GET request. + * + * In the case where there are multiple network devices with different + * link layer protocols (CONFIG_NET_MULTILINK), each network device + * may support a different TCP MSS value. Here we arbitrarily select + * the minimum MSS for that case. + */ + +#define HTTPD_IOBUFFER_SIZE (3*MIN_TCP_MSS) + +/* This is the maximum size of a file path */ + +#ifndef CONFIG_NETUTILS_HTTPD_MAXPATH +#define CONFIG_NETUTILS_HTTPD_MAXPATH PATH_MAX +#endif + +#define HTTPD_MAX_FILENAME CONFIG_NETUTILS_HTTPD_MAXPATH + +/* Other tunable values. If you need to change these values, please create + * new configurations in apps/netutils/webserver/Kconfig + */ + +#define HTTPD_MAX_CONTENTLEN 32 +#define HTTPD_MAX_HEADERLEN 180 + +/**************************************************************************** + * Public types + ****************************************************************************/ + + +struct httpd_fs_file { + char *data; + int len; +#if defined(CONFIG_NETUTILS_HTTPD_MMAP) || defined(CONFIG_NETUTILS_HTTPD_SENDFILE) + int fd; +#endif +}; + +struct httpd_state { + char ht_buffer[HTTPD_IOBUFFER_SIZE]; /* recv() buffer */ + char ht_filename[HTTPD_MAX_FILENAME]; /* filename from GET command */ +#ifndef CONFIG_NETUTILS_HTTPD_KEEPALIVE_DISABLE + bool ht_keepalive; /* Connection: keep-alive */ +#endif + struct httpd_fs_file ht_file; /* Fake file data to send */ + int ht_sockfd; /* The socket descriptor from accept() */ + char *ht_scriptptr; + uint16_t ht_scriptlen; + uint16_t ht_sndlen; +}; + +struct httpd_fsdata_file { + const struct httpd_fsdata_file *next; + FAR const uint8_t *name; + FAR const uint8_t *data; + int len; +#ifdef CONFIG_NETUTILS_HTTPDFSSTATS + uint16_t count; +#endif +}; + +struct httpd_fsdata_file_noconst { + FAR struct httpd_fsdata_file *next; + FAR char *name; + FAR char *data; + int len; +#ifdef CONFIG_NETUTILS_HTTPDFSSTATS + uint16_t count; +#endif +}; + +typedef void (*httpd_cgifunction)(struct httpd_state *, char *); + +struct httpd_cgi_call { + struct httpd_cgi_call *next; + const char *name; + httpd_cgifunction function; +}; + +/* HTTPD CGI function declaration + * + * Description: + * This macro is used for declaring a HTTPD CGI function. This function is + * then added to the list of HTTPD CGI functions with the httpd_cgi_register() + * function. + + * Input Parameters: + * + * name The C variable name of the function + * str The string name of the function, used in the script file + * function A pointer to the function that implements it + */ + +#define HTTPD_CGI_CALL(name, str, function) \ +static void function(struct httpd_state *, char *); \ +static struct httpd_cgi_call name = {NULL, str, function} + +/**************************************************************************** + * Public Data + ****************************************************************************/ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +void httpd_init(void); +int httpd_listen(void); +void httpd_cgi_register(struct httpd_cgi_call *cgi_call); +uint16_t httpd_fs_count(char *name); + +const struct httpd_fsdata_file g_httpdfs_root[]; +const int g_httpd_numfiles; + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __APPS_INCLUDE_NETUTILS_HTTPD_H */ diff --git a/apps/include/netutils/ipmsfilter.h b/apps/include/netutils/ipmsfilter.h index 28d73d2..326300f 100644 --- a/apps/include/netutils/ipmsfilter.h +++ b/apps/include/netutils/ipmsfilter.h @@ -75,8 +75,7 @@ * Public Data ****************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) +#ifdef __cplusplus #define EXTERN extern "C" extern "C" { #else @@ -108,7 +107,7 @@ extern "C" { EXTERN int ipmsfilter(FAR const char *ifname, FAR const struct in_addr *multiaddr, uint32_t fmode); #undef EXTERN -#if defined(__cplusplus) +#ifdef __cplusplus } #endif diff --git a/apps/include/netutils/liblwm2m.h b/apps/include/netutils/liblwm2m.h index 70a42c2..91d161a 100644 --- a/apps/include/netutils/liblwm2m.h +++ b/apps/include/netutils/liblwm2m.h @@ -71,9 +71,10 @@ #define _LWM2M_CLIENT_H_ #ifdef __cplusplus -// *INDENT-OFF* +#define EXTERN extern "C" extern "C" { -// *INDENT-ON* +#else +#define EXTERN extern #endif #include @@ -651,9 +652,9 @@ int lwm2m_bootstrap_finish(lwm2m_context_t *contextP, void *sessionH); #endif +#undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif + #endif diff --git a/apps/include/netutils/md5.h b/apps/include/netutils/md5.h index b800d7e..f09947f 100644 --- a/apps/include/netutils/md5.h +++ b/apps/include/netutils/md5.h @@ -83,10 +83,10 @@ #ifdef CONFIG_CODECS_HASH_MD5 #ifdef __cplusplus -// *INDENT-OFF* -extern "C" -{ -// *INDENT-ON* +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern #endif /**************************************************************************** @@ -113,10 +113,9 @@ void MD5Transform(uint32_t buf[4], uint32_t const in[16]); void md5_sum(const uint8_t *addr, const size_t len, uint8_t *mac); char *md5_hash(const uint8_t *addr, const size_t len); +#undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* CONFIG_CODECS_HASH_MD5 */ #endif /* __APPS_INCLUDE_NETUTILS_MD5_H */ diff --git a/apps/include/netutils/mdnsd.h b/apps/include/netutils/mdnsd.h index 08eddfc..f5eb827 100644 --- a/apps/include/netutils/mdnsd.h +++ b/apps/include/netutils/mdnsd.h @@ -79,6 +79,14 @@ struct mdns_service_info { unsigned int port; }; +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + #if defined(CONFIG_NETUTILS_MDNS_RESPONDER_SUPPORT) /** @@ -147,6 +155,12 @@ int mdnsd_resolve_hostname(char *hostname, int *ipaddr); */ int mdnsd_discover_service(char *service_type, int discover_time_msec, struct mdns_service_info **service_list, int *num_of_services); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /*!__MDNSD_H__ */ /** @} */// end of MDNS group diff --git a/apps/include/netutils/mqtt_api.h b/apps/include/netutils/mqtt_api.h index 6caa82f..d2ee090 100644 --- a/apps/include/netutils/mqtt_api.h +++ b/apps/include/netutils/mqtt_api.h @@ -33,6 +33,13 @@ ****************************************************************************/ #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -209,6 +216,11 @@ int mqtt_subscribe(mqtt_client_t *handle, char *topic, uint8_t qos); */ int mqtt_unsubscribe(mqtt_client_t *handle, char *topic); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /* __MQTT_API_H__ */ /** @} */// end of MQTT group diff --git a/apps/include/netutils/ntpclient.h b/apps/include/netutils/ntpclient.h index 3f9113f..c36520e 100644 --- a/apps/include/netutils/ntpclient.h +++ b/apps/include/netutils/ntpclient.h @@ -124,12 +124,10 @@ struct ntpc_server_s { ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /**************************************************************************** @@ -186,9 +184,7 @@ int ntpc_get_link_status(void); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_NTPCLIENT_H */ diff --git a/apps/include/netutils/smtp.h b/apps/include/netutils/smtp.h index facb581..dc5563b 100644 --- a/apps/include/netutils/smtp.h +++ b/apps/include/netutils/smtp.h @@ -72,12 +72,10 @@ ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /**************************************************************************** @@ -91,9 +89,7 @@ void smtp_close(FAR void *handle); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_SMTP_H */ diff --git a/apps/include/netutils/telnetd.h b/apps/include/netutils/telnetd.h index e0d2f76..7bc67a2 100644 --- a/apps/include/netutils/telnetd.h +++ b/apps/include/netutils/telnetd.h @@ -109,12 +109,10 @@ struct telnetd_config_s { ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif /**************************************************************************** @@ -140,8 +138,6 @@ EXTERN int telnetd_start(FAR struct telnetd_config_s *config); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_TELNETD_H */ diff --git a/apps/include/netutils/tftp.h b/apps/include/netutils/tftp.h index de128c0..ef821b0 100644 --- a/apps/include/netutils/tftp.h +++ b/apps/include/netutils/tftp.h @@ -73,12 +73,10 @@ ****************************************************************************/ #ifdef __cplusplus -// *INDENT-OFF* #define EXTERN extern "C" extern "C" { #else #define EXTERN extern -// *INDENT-ON* #endif int tftpget(const char *remote, const char *local, in_addr_t addr, bool binary); @@ -86,9 +84,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary); #undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif #endif /* __APPS_INCLUDE_NETUTILS_TFTP_H */ diff --git a/apps/include/netutils/thttpd.h b/apps/include/netutils/thttpd.h index 4d85809..1575e26 100644 --- a/apps/include/netutils/thttpd.h +++ b/apps/include/netutils/thttpd.h @@ -63,8 +63,7 @@ * Public Data ****************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) +#ifdef __cplusplus #define EXTERN extern "C" extern "C" { #else @@ -109,7 +108,7 @@ EXTERN int g_thttpdnsymbols; EXTERN int thttpd_main(int argc, char **argv); #undef EXTERN -#if defined(__cplusplus) +#ifdef __cplusplus } #endif diff --git a/apps/include/netutils/urldecode.h b/apps/include/netutils/urldecode.h index b4c4251..3587eaf 100644 --- a/apps/include/netutils/urldecode.h +++ b/apps/include/netutils/urldecode.h @@ -60,10 +60,10 @@ #include #ifdef __cplusplus -// *INDENT-OFF* -extern "C" -{ -// *INDENT-ON* +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern #endif /**************************************************************************** @@ -87,9 +87,9 @@ void urlrawdecode(char *urlbuf); void urlrawencode(char *str, char *urlbuf); #endif /* CONFIG_CODECS_AVR_URLCODE */ +#undef EXTERN #ifdef __cplusplus -// *INDENT-OFF* } -// *INDENT-ON* #endif + #endif /* __APPS_INCLUDE_NETUTILS_URLDECODE_H */ diff --git a/apps/include/netutils/webserver/http_keyvalue_list.h b/apps/include/netutils/webserver/http_keyvalue_list.h index 08532f9..7595f1a 100644 --- a/apps/include/netutils/webserver/http_keyvalue_list.h +++ b/apps/include/netutils/webserver/http_keyvalue_list.h @@ -35,6 +35,13 @@ #include #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + /***************************************************************************** * Public Types ****************************************************************************/ @@ -116,5 +123,10 @@ int http_keyvalue_list_delete_tail(struct http_keyvalue_list_t *list); */ char *http_keyvalue_list_find(struct http_keyvalue_list_t *list, const char *key); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /** @} */ diff --git a/apps/include/netutils/webserver/http_server.h b/apps/include/netutils/webserver/http_server.h index 14d1e82..56beb95 100644 --- a/apps/include/netutils/webserver/http_server.h +++ b/apps/include/netutils/webserver/http_server.h @@ -111,6 +111,13 @@ #define HTTP_ERROR_404 "Not Found" #define HTTP_ERROR_500 "Internal Server Error" +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -298,5 +305,11 @@ int http_send_response(struct http_client_t *client, int status, const char *bod int http_tls_init(struct http_server_t *server, struct ssl_config_t *ssl_config); #endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /** @} */ diff --git a/apps/include/netutils/websocket.h b/apps/include/netutils/websocket.h index b92cb3c..f0daf52 100644 --- a/apps/include/netutils/websocket.h +++ b/apps/include/netutils/websocket.h @@ -553,7 +553,6 @@ websocket_return_t websocket_update_state(websocket_t *websocket, int state); websocket_return_t websocket_set_error(websocket_t *websocket, int val); #undef EXTERN -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/apps/include/netutils/wifi/slsi_wifi_api.h b/apps/include/netutils/wifi/slsi_wifi_api.h index 788df5e..ce3fc02 100644 --- a/apps/include/netutils/wifi/slsi_wifi_api.h +++ b/apps/include/netutils/wifi/slsi_wifi_api.h @@ -31,8 +31,12 @@ #ifndef SLSI_WIFI_API_H_ #define SLSI_WIFI_API_H_ -#ifdef __cplusplus -extern "C" { +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern #endif /* interface name to use */ @@ -411,6 +415,7 @@ int8_t WiFiSetCountryCode(const char *country_code); */ int8_t WiFiSaveConfig(void); +#undef EXTERN #ifdef __cplusplus } #endif diff --git a/apps/include/netutils/wifi/slsi_wifi_nvmap.h b/apps/include/netutils/wifi/slsi_wifi_nvmap.h index 9d72cab..4ee6165 100644 --- a/apps/include/netutils/wifi/slsi_wifi_nvmap.h +++ b/apps/include/netutils/wifi/slsi_wifi_nvmap.h @@ -18,11 +18,16 @@ #ifndef SLSI_WIFI_NVMAP_H_ #define SLSI_WIFI_NVMAP_H_ -#ifdef __cplusplus -extern "C" { -#endif #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + /* struct containing all the values that needs to be read/written * from/to the non-volatile memory. * New values needs to be added to the end of the structure and needs to be @@ -50,6 +55,7 @@ typedef struct slsi_wifi_nv_data { #define SLSI_WIFI_NV_DATA_SIZE (sizeof(slsi_wifi_nv_data_t)) +#undef EXTERN #ifdef __cplusplus } #endif diff --git a/apps/include/netutils/wifi/slsi_wifi_utils.h b/apps/include/netutils/wifi/slsi_wifi_utils.h index e818eb1..6dca039 100644 --- a/apps/include/netutils/wifi/slsi_wifi_utils.h +++ b/apps/include/netutils/wifi/slsi_wifi_utils.h @@ -37,8 +37,13 @@ #include "slsi_wifi_api.h" #ifdef __cplusplus -extern "C" { +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern #endif + /* Supported security modes as string */ #define SLSI_WIFI_SECURITY_OPEN "open" #define SLSI_WIFI_SECURITY_WEP_OPEN "wep" @@ -62,8 +67,10 @@ slsi_security_config_t *getSecurityConfig(char *sec_type, char *psk, WiFi_InterF void printScanResult(slsi_scan_info_t *list); +#undef EXTERN #ifdef __cplusplus } #endif + #endif /* __SLSI_WIFI_UTILS_H */ diff --git a/apps/include/netutils/wslay/wslay.h b/apps/include/netutils/wslay/wslay.h index ea8f24b..c0dafba 100644 --- a/apps/include/netutils/wslay/wslay.h +++ b/apps/include/netutils/wslay/wslay.h @@ -46,6 +46,13 @@ #include #include +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + enum wslay_error { WSLAY_ERR_WANT_READ = -100, WSLAY_ERR_WANT_WRITE = -101, @@ -732,4 +739,9 @@ size_t wslay_event_get_queued_msg_count(wslay_event_context_ptr ctx); */ size_t wslay_event_get_queued_msg_length(wslay_event_context_ptr ctx); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /* WSLAY_H */ diff --git a/apps/include/netutils/xmlrpc.h b/apps/include/netutils/xmlrpc.h index a3b76a5..23f0fc0 100644 --- a/apps/include/netutils/xmlrpc.h +++ b/apps/include/netutils/xmlrpc.h @@ -121,6 +121,13 @@ struct xmlrpc_entry_s { char *name; }; +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ @@ -133,4 +140,9 @@ int xmlrpc_getdouble(struct xmlrpc_s *xmlcall, double *arg); int xmlrpc_getstring(struct xmlrpc_s *xmlcall, char *arg); int xmlrpc_buildresponse(struct xmlrpc_s *, char *, ...); +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /* __APPS_INCLUDE_NETUTILS_XMLRPC_H */