diff --git a/drivers/wifi/simplelink/simplelink_log.h b/drivers/wifi/simplelink/simplelink_log.h index b069d26ca597b..53c5ff34d43e0 100644 --- a/drivers/wifi/simplelink/simplelink_log.h +++ b/drivers/wifi/simplelink/simplelink_log.h @@ -7,17 +7,9 @@ #ifndef ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_LOG_H_ #define ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_LOG_H_ -#ifdef __cplusplus -extern "C" { -#endif - #define LOG_MODULE_NAME wifi_simplelink #define LOG_LEVEL CONFIG_WIFI_LOG_LEVEL #include -#ifdef __cplusplus -} -#endif - #endif /* ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_LOG_H_ */ diff --git a/drivers/wifi/simplelink/simplelink_support.h b/drivers/wifi/simplelink/simplelink_support.h index 1697ff9bc6327..0f93c4430cca6 100644 --- a/drivers/wifi/simplelink/simplelink_support.h +++ b/drivers/wifi/simplelink/simplelink_support.h @@ -8,12 +8,12 @@ #ifndef ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_SUPPORT_H_ #define ZEPHYR_DRIVERS_WIFI_SIMPLELINK_SIMPLELINK_SUPPORT_H_ +#include + #ifdef __cplusplus extern "C" { #endif -#include - #define SSID_LEN_MAX (32) #define BSSID_LEN_MAX (6) diff --git a/include/net/dhcpv4.h b/include/net/dhcpv4.h index 9758dd6710968..5c62a471f8e95 100644 --- a/include/net/dhcpv4.h +++ b/include/net/dhcpv4.h @@ -11,6 +11,9 @@ #ifndef ZEPHYR_INCLUDE_NET_DHCPV4_H_ #define ZEPHYR_INCLUDE_NET_DHCPV4_H_ +#include +#include + #ifdef __cplusplus extern "C" { #endif @@ -22,9 +25,6 @@ extern "C" { * @{ */ -#include -#include - /** @cond INTERNAL_HIDDEN */ /** Current state of DHCPv4 client address negotiation. diff --git a/include/net/http_parser.h b/include/net/http_parser.h index ae80a398afe31..973174fea160f 100644 --- a/include/net/http_parser.h +++ b/include/net/http_parser.h @@ -20,9 +20,6 @@ */ #ifndef ZEPHYR_INCLUDE_NET_HTTP_PARSER_H_ #define ZEPHYR_INCLUDE_NET_HTTP_PARSER_H_ -#ifdef __cplusplus -extern "C" { -#endif /* Also update SONAME in the Makefile whenever you change these. */ #define HTTP_PARSER_VERSION_MAJOR 2 @@ -49,6 +46,10 @@ typedef unsigned __int64 u64_t; #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* Maximium header size allowed. If the macro is not defined * before including this header then the default is used. To * change the maximum header size, define the macro in the build diff --git a/include/net/http_parser_url.h b/include/net/http_parser_url.h index 9afc59a24af31..5e3eedb87f7b4 100644 --- a/include/net/http_parser_url.h +++ b/include/net/http_parser_url.h @@ -20,15 +20,16 @@ */ #ifndef ZEPHYR_INCLUDE_NET_HTTP_PARSER_URL_H_ #define ZEPHYR_INCLUDE_NET_HTTP_PARSER_URL_H_ -#ifdef __cplusplus -extern "C" { -#endif #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + enum http_parser_url_fields { UF_SCHEMA = 0 , UF_HOST = 1 diff --git a/include/net/net_core.h b/include/net/net_core.h index dae57714831d9..377bc6fee31b5 100644 --- a/include/net/net_core.h +++ b/include/net/net_core.h @@ -13,12 +13,12 @@ #ifndef ZEPHYR_INCLUDE_NET_NET_CORE_H_ #define ZEPHYR_INCLUDE_NET_NET_CORE_H_ +#include + #ifdef __cplusplus extern "C" { #endif -#include - /** * @brief Networking * @defgroup networking Networking diff --git a/include/net/net_event.h b/include/net/net_event.h index c2433c068d536..46ae0b08b79ec 100644 --- a/include/net/net_event.h +++ b/include/net/net_event.h @@ -12,12 +12,12 @@ #ifndef ZEPHYR_INCLUDE_NET_NET_EVENT_H_ #define ZEPHYR_INCLUDE_NET_NET_EVENT_H_ +#include + #ifdef __cplusplus extern "C" { #endif -#include - /** * @addtogroup net_mgmt * @{ diff --git a/include/net/net_mgmt.h b/include/net/net_mgmt.h index c29fed733f159..9b5c43ed3494a 100644 --- a/include/net/net_mgmt.h +++ b/include/net/net_mgmt.h @@ -12,6 +12,9 @@ #ifndef ZEPHYR_INCLUDE_NET_NET_MGMT_H_ #define ZEPHYR_INCLUDE_NET_NET_MGMT_H_ +#include +#include + #ifdef __cplusplus extern "C" { #endif @@ -23,9 +26,6 @@ extern "C" { * @{ */ -#include -#include - struct net_if; /** @cond INTERNAL_HIDDEN */ diff --git a/include/net/socket_can.h b/include/net/socket_can.h index ba1f3e4dcd95d..0a8a08f878c6c 100644 --- a/include/net/socket_can.h +++ b/include/net/socket_can.h @@ -13,15 +13,15 @@ #ifndef ZEPHYR_INCLUDE_NET_SOCKET_CAN_H_ #define ZEPHYR_INCLUDE_NET_SOCKET_CAN_H_ -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Socket CAN library * @defgroup socket_can Network Core Library diff --git a/include/net/socket_net_mgmt.h b/include/net/socket_net_mgmt.h index b5d462d75b21c..5a9faae8faac3 100644 --- a/include/net/socket_net_mgmt.h +++ b/include/net/socket_net_mgmt.h @@ -13,15 +13,15 @@ #ifndef ZEPHYR_INCLUDE_NET_SOCKET_NET_MGMT_H_ #define ZEPHYR_INCLUDE_NET_SOCKET_NET_MGMT_H_ -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Socket NET_MGMT library * @defgroup socket_net_mgmt Network Core Library diff --git a/include/net/socket_offload.h b/include/net/socket_offload.h index 3961d8e8c0457..18f6359f07b5a 100644 --- a/include/net/socket_offload.h +++ b/include/net/socket_offload.h @@ -12,12 +12,12 @@ #ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_ #define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_ +#include + #ifdef __cplusplus extern "C" { #endif -#include - extern const struct socket_offload *socket_ops; static inline int socket(int family, int type, int proto) diff --git a/include/net/socket_offload_ops.h b/include/net/socket_offload_ops.h index c6bd5e3d182c9..aff12c9a1d17e 100644 --- a/include/net/socket_offload_ops.h +++ b/include/net/socket_offload_ops.h @@ -12,6 +12,14 @@ #ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_ #define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_ +#include +#include +#include /* needed for struct pollfd */ + +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Socket Offload Redirect API * @defgroup socket_offload Socket offloading interface @@ -19,14 +27,6 @@ * @{ */ -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include /* needed for struct pollfd */ - /** * @brief An offloaded Socket API interface * @@ -68,12 +68,12 @@ struct socket_offload { */ extern void socket_offload_register(const struct socket_offload *ops); -#ifdef __cplusplus -} -#endif - /** * @} */ +#ifdef __cplusplus +} +#endif + #endif /* ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_ */ diff --git a/subsys/net/l2/ethernet/arp.h b/subsys/net/l2/ethernet/arp.h index cfcc9746265e1..cf0aa070d92d4 100644 --- a/subsys/net/l2/ethernet/arp.h +++ b/subsys/net/l2/ethernet/arp.h @@ -7,15 +7,15 @@ #ifndef __ARP_H #define __ARP_H -#ifdef __cplusplus -extern "C" { -#endif - #if defined(CONFIG_NET_ARP) #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Address resolution (ARP) library * @defgroup arp ARP Library @@ -71,6 +71,10 @@ void net_arp_init(void); * @} */ +#ifdef __cplusplus +} +#endif + #else /* CONFIG_NET_ARP */ #define net_arp_prepare(_kt, _u1, _u2) _kt #define net_arp_input(...) NET_OK @@ -79,8 +83,4 @@ void net_arp_init(void); #endif /* CONFIG_NET_ARP */ -#ifdef __cplusplus -} -#endif - #endif /* __ARP_H */ diff --git a/subsys/net/l2/ethernet/gptp/gptp_data_set.h b/subsys/net/l2/ethernet/gptp/gptp_data_set.h index 4b55a64c125b5..8634d98edafb0 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_data_set.h +++ b/subsys/net/l2/ethernet/gptp/gptp_data_set.h @@ -14,15 +14,15 @@ #ifndef __GPTP_DS_H #define __GPTP_DS_H -#ifdef __cplusplus -extern "C" { -#endif - #if defined(CONFIG_NET_GPTP) #include #include "gptp_state.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Parameters for PTP data sets. */ #define GPTP_ALLOWED_LOST_RESP 3 @@ -592,10 +592,10 @@ int gptp_get_port_data(struct gptp_domain *domain, int port, struct gptp_port_bmca_data **port_bmca_data, struct net_if **iface); -#endif /* CONFIG_NET_GPTP */ - #ifdef __cplusplus } #endif +#endif /* CONFIG_NET_GPTP */ + #endif /* __GPTP_DS_H */ diff --git a/subsys/net/l2/ethernet/gptp/gptp_md.h b/subsys/net/l2/ethernet/gptp/gptp_md.h index 22e31e3875f7d..5cc3e5e20bcba 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_md.h +++ b/subsys/net/l2/ethernet/gptp/gptp_md.h @@ -14,12 +14,12 @@ #ifndef __GPTP_MD_H #define __GPTP_MD_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /** * @brief Media Dependent Sync Information. * diff --git a/subsys/net/l2/ethernet/gptp/gptp_messages.h b/subsys/net/l2/ethernet/gptp/gptp_messages.h index 7a8e7fc9bb1cd..7b698e08c996b 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_messages.h +++ b/subsys/net/l2/ethernet/gptp/gptp_messages.h @@ -14,14 +14,14 @@ #ifndef __GPTP_MESSAGES_H #define __GPTP_MESSAGES_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* Helpers to access gPTP messages. */ #define GPTP_HDR(pkt) gptp_get_hdr(pkt) #define GPTP_ANNOUNCE(pkt) ((struct gptp_announce *)gptp_data(pkt)) diff --git a/subsys/net/l2/ethernet/gptp/gptp_mi.h b/subsys/net/l2/ethernet/gptp/gptp_mi.h index 1226e47413b17..2422787580cf4 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_mi.h +++ b/subsys/net/l2/ethernet/gptp/gptp_mi.h @@ -14,12 +14,12 @@ #ifndef __GPTP_MI_H #define __GPTP_MI_H +#include "gptp_md.h" + #ifdef __cplusplus extern "C" { #endif -#include "gptp_md.h" - /** * @brief Media Independent Sync Information. * diff --git a/subsys/net/l2/ethernet/gptp/gptp_private.h b/subsys/net/l2/ethernet/gptp/gptp_private.h index 6ea5a2320f3b2..b4720a7619037 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_private.h +++ b/subsys/net/l2/ethernet/gptp/gptp_private.h @@ -14,12 +14,12 @@ #ifndef __GPTP_PRIVATE_H #define __GPTP_PRIVATE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /* Common defines for the gPTP stack. */ #define GPTP_THREAD_WAIT_TIMEOUT_MS 1 #define GPTP_MULTIPLE_PDELAY_RESP_WAIT K_MINUTES(5) diff --git a/subsys/net/l2/ethernet/gptp/gptp_state.h b/subsys/net/l2/ethernet/gptp/gptp_state.h index bded60861cfdc..e200d3754e68f 100644 --- a/subsys/net/l2/ethernet/gptp/gptp_state.h +++ b/subsys/net/l2/ethernet/gptp/gptp_state.h @@ -13,12 +13,12 @@ #ifndef __GPTP_STATE_H #define __GPTP_STATE_H +#include "gptp_mi.h" + #ifdef __cplusplus extern "C" { #endif -#include "gptp_mi.h" - /* PDelayRequest states. */ enum gptp_pdelay_req_states { GPTP_PDELAY_REQ_NOT_ENABLED,