From de6c9e2cf05d7ecc4f11f33c5a2b5a9da33edf5a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 21 Aug 2017 18:43:31 +0200 Subject: [PATCH] mesh: Remove circular include protection guards --- mesh/agent.h | 13 ------------- mesh/config-model.h | 17 ----------------- mesh/crypto.h | 13 ------------- mesh/gatt.h | 14 -------------- mesh/keys.h | 4 ---- mesh/mesh-net.h | 16 +--------------- mesh/net.h | 14 -------------- mesh/node.h | 12 ------------ mesh/onoff-model.h | 17 ----------------- mesh/prov-db.h | 12 ------------ mesh/prov.h | 12 ------------ mesh/util.c | 1 + mesh/util.h | 18 +----------------- 13 files changed, 3 insertions(+), 160 deletions(-) diff --git a/mesh/agent.h b/mesh/agent.h index fe19353a0..9db4321fc 100644 --- a/mesh/agent.h +++ b/mesh/agent.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_AGENT_H -#define __MESH_AGENT_H - -#ifdef __cplusplus -extern "C" { -#endif - #define MAX_HEXADECIMAL_OOB_LEN 128 #define DECIMAL_OOB_LEN 4 #define MAX_ASCII_OOB_LEN 16 @@ -50,9 +43,3 @@ void agent_output_request_cancel(void); bool agent_completion(void); bool agent_input(const char *input); void agent_release(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_AGENT_H */ diff --git a/mesh/config-model.h b/mesh/config-model.h index 115491fe3..be7acabb9 100644 --- a/mesh/config-model.h +++ b/mesh/config-model.h @@ -21,17 +21,6 @@ * */ -#ifndef __MESH_CONFIG_MODEL_H -#define __MESH_CONFIG_MODEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - #define CONFIG_SERVER_MODEL_ID 0x0000 #define CONFIG_CLIENT_MODEL_ID 0x0001 @@ -111,9 +100,3 @@ bool config_server_init(void); bool config_client_init(void); void config_client_get_composition(uint32_t dst); void config_set_node(const char *args); - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_CONFIG_MODEL_H */ diff --git a/mesh/crypto.h b/mesh/crypto.h index 98bc06586..e8f16f35d 100644 --- a/mesh/crypto.h +++ b/mesh/crypto.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_CRYPTO_H -#define __MESH_CRYPTO_H - -#ifdef __cplusplus -extern "C" { -#endif - #include #include @@ -125,9 +118,3 @@ bool mesh_crypto_aes_cmac(const uint8_t key[16], const uint8_t *msg, size_t msg_len, uint8_t res[16]); bool mesh_get_random_bytes(void *buf, size_t num_bytes); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/mesh/gatt.h b/mesh/gatt.h index 2f7a3fc3a..a2aae2540 100644 --- a/mesh/gatt.h +++ b/mesh/gatt.h @@ -21,15 +21,7 @@ * */ -#ifndef __MESH_GATT_H -#define __MESH_GATT_H - -#ifdef __cplusplus -extern "C" { -#endif - #include "gdbus/gdbus.h" -#include "mesh/node.h" uint16_t mesh_gatt_sar(uint8_t **pkt, uint16_t size); bool mesh_gatt_is_child(GDBusProxy *proxy, GDBusProxy *parent, @@ -39,9 +31,3 @@ bool mesh_gatt_write(GDBusProxy *proxy, uint8_t *buf, uint16_t len, bool mesh_gatt_notify(GDBusProxy *proxy, bool enable, GDBusReturnFunction cb, void *user_data); void mesh_gatt_cleanup(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_GATT_H */ diff --git a/mesh/keys.h b/mesh/keys.h index 5b955b254..477ff1309 100644 --- a/mesh/keys.h +++ b/mesh/keys.h @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include -#endif - #define KR_PHASE_NONE 0x00 #define KR_PHASE_ONE 0x01 #define KR_PHASE_TWO 0x02 diff --git a/mesh/mesh-net.h b/mesh/mesh-net.h index cb6c6e47f..76a98224c 100644 --- a/mesh/mesh-net.h +++ b/mesh/mesh-net.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_NETORK_H -#define __MESH_NETORK_H - -#ifdef __cplusplus -extern "C" { -#endif - /* Proxy PDU Types */ #define PROXY_NETWORK_PDU 0x00 #define PROXY_MESH_BEACON 0x01 @@ -35,7 +28,7 @@ extern "C" { #define PROXY_PROVISIONING_PDU 0x03 #define CTL 0x80 -#define TTL_MASK 0x7f +#define TTL_MASK 0x7f #define SEQ_MASK 0xffffff #define CREDFLAG_MASK 0x1000 @@ -165,10 +158,3 @@ extern "C" { #define MESH_STATUS_CANNOT_SET 0x0f #define MESH_STATUS_UNSPECIFIED_ERROR 0x10 #define MESH_STATUS_INVALID_BINDING 0x11 - - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_NETORK_H */ diff --git a/mesh/net.h b/mesh/net.h index b357afa0d..b388d616c 100644 --- a/mesh/net.h +++ b/mesh/net.h @@ -21,15 +21,7 @@ * */ -#ifndef __MESH_NET_H -#define __MESH_NET_H - -#ifdef __cplusplus -extern "C" { -#endif - #include "gdbus/gdbus.h" -#include "mesh/node.h" typedef void (*net_mesh_session_open_callback)(int status); @@ -64,9 +56,3 @@ bool net_register_group(uint16_t group_addr); uint32_t net_register_virtual(uint8_t buf[16]); bool mesh_model_recv(uint16_t app_idx, uint16_t src, uint32_t dst, uint8_t *payload, uint16_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_NET_H */ diff --git a/mesh/node.h b/mesh/node.h index 40b964cda..68c60ebef 100644 --- a/mesh/node.h +++ b/mesh/node.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_NODE_H -#define __MESH_NODE_H - -#ifdef __cplusplus -extern "C" { -#endif - /* Largest Possible GATT Packet: Provisioning Public Key + type + sar */ #define MAX_GATT_SIZE (64 + 1 + 1) @@ -139,8 +132,3 @@ bool node_model_pub_set(struct mesh_node *node, uint8_t ele, uint32_t model_id, struct mesh_publication *pub); struct mesh_publication *node_model_pub_get(struct mesh_node *node, uint8_t ele, uint32_t model_id); -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_NODE_H */ diff --git a/mesh/onoff-model.h b/mesh/onoff-model.h index 57f3ecc93..31599056d 100644 --- a/mesh/onoff-model.h +++ b/mesh/onoff-model.h @@ -21,17 +21,6 @@ * */ -#ifndef __MESH_GENERIC_ONOFF_MODEL_H -#define __MESH_GENERIC_ONOFF_MODEL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - #define GENERIC_ONOFF_SERVER_MODEL_ID 0x1000 #define GENERIC_ONOFF_CLIENT_MODEL_ID 0x1001 @@ -42,9 +31,3 @@ extern "C" { void onoff_set_node(const char *args); bool onoff_client_init(uint8_t ele); - -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_GENERIC_ONOFF_MODEL_H */ diff --git a/mesh/prov-db.h b/mesh/prov-db.h index 6b95937a0..b1e4c629c 100644 --- a/mesh/prov-db.h +++ b/mesh/prov-db.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_PROV_DB_H -#define __MESH_PROV_DB_H - -#ifdef __cplusplus -extern "C" { -#endif - bool prov_db_show(const char *filename); bool prov_db_read(const char *filename); bool prov_db_read_local_node(const char *filename, bool provisioner); @@ -45,8 +38,3 @@ bool prov_db_node_set_model_pub(struct mesh_node *node, uint8_t ele_idx, uint32_t model_id, struct mesh_publication *pub); void prov_db_print_node_composition(struct mesh_node *node); -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_PROV_DB_H */ diff --git a/mesh/prov.h b/mesh/prov.h index c4e068a52..94ce7a1b5 100644 --- a/mesh/prov.h +++ b/mesh/prov.h @@ -21,13 +21,6 @@ * */ -#ifndef __MESH_PROV_H -#define __MESH_PROV_H - -#ifdef __cplusplus -extern "C" { -#endif - struct prov; typedef void (*provision_done_cb)(void *user_data, int status); @@ -36,8 +29,3 @@ bool prov_open(struct mesh_node *node, GDBusProxy *prov_in, uint16_t net_idx, provision_done_cb cb, void *user_data); bool prov_data_ready(struct mesh_node *node, uint8_t *buf, uint8_t len); bool prov_complete(struct mesh_node *node, uint8_t status); -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_PROV_H */ diff --git a/mesh/util.c b/mesh/util.c index b084c4532..fac4bab1b 100644 --- a/mesh/util.c +++ b/mesh/util.c @@ -34,6 +34,7 @@ #include "client/display.h" #include "src/shared/util.h" #include "mesh/mesh-net.h" +#include "mesh/node.h" #include "mesh/util.h" struct cmd_menu { diff --git a/mesh/util.h b/mesh/util.h index eaf485789..7f729ab62 100644 --- a/mesh/util.h +++ b/mesh/util.h @@ -21,20 +21,9 @@ * */ -#ifndef __MESH_UTIL_H -#define __MESH_UTIL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - #include -#include "mesh/node.h" +struct mesh_publication; #define OP_UNRELIABLE 0x0100 @@ -64,8 +53,3 @@ const char *mesh_status_str(uint8_t status); void print_model_pub(uint16_t ele_addr, uint32_t mod_id, struct mesh_publication *pub); void swap_u256_bytes(uint8_t *u256); -#ifdef __cplusplus -} -#endif - -#endif /* __MESH_UTIL_H */ -- 2.47.3