From 5822f817aa802c2c5a83e9d99a8ae78cb822799b Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 7 Oct 2017 17:40:34 +0200 Subject: [PATCH] Update all header guards. Don't start with underscores, as those are reserved for system libraries. Make sure all start with TINC_, and that they appear at the top of the file. --- src/autoconnect.h | 6 +++--- src/buffer.h | 4 ++-- src/cipher.h | 6 +++--- src/conf.h | 8 ++++---- src/connection.h | 8 ++++---- src/control.h | 6 +++--- src/control_common.h | 6 +++--- src/crypto.h | 6 +++--- src/device.h | 8 ++++---- src/digest.h | 6 +++--- src/dropin.h | 8 ++++---- src/ecdh.h | 8 ++++---- src/ecdsa.h | 8 ++++---- src/ecdsagen.h | 6 +++--- src/ed25519/ecdh.c | 2 +- src/ed25519/ecdsa.c | 2 +- src/ed25519/ecdsagen.c | 2 +- src/ed25519/fixedint.h | 6 +++--- src/edge.h | 8 ++++---- src/ethernet.h | 8 ++++---- src/event.h | 6 +++--- src/fsck.h | 7 +++---- src/gcrypt/cipher.h | 6 +++--- src/gcrypt/crypto.h | 6 +++--- src/gcrypt/digest.h | 6 +++--- src/gcrypt/rsa.h | 6 +++--- src/gcrypt/rsagen.h | 6 +++--- src/getopt.h | 5 ++++- src/graph.h | 8 ++++---- src/hash.h | 8 ++++---- src/have.h | 8 ++++---- src/ifconfig.h | 6 +++--- src/info.h | 7 +++---- src/invitation.h | 6 +++--- src/ipv4.h | 8 ++++---- src/ipv6.h | 8 ++++---- src/list.h | 8 ++++---- src/logger.h | 8 ++++---- src/meta.h | 8 ++++---- src/mingw/common.h | 5 +++++ src/names.h | 8 ++++---- src/net.h | 8 ++++---- src/netutl.h | 8 ++++---- src/node.h | 8 ++++---- src/openssl/digest.h | 6 +++--- src/openssl/rsa.c | 2 +- src/openssl/rsagen.c | 2 +- src/prf.h | 6 +++--- src/process.h | 8 ++++---- src/protocol.h | 8 ++++---- src/route.h | 8 ++++---- src/rsa.h | 8 ++++---- src/rsagen.h | 6 +++--- src/script.h | 8 ++++---- src/splay_tree.h | 7 +++---- src/sptps.h | 6 +++--- src/subnet.h | 8 ++++---- src/system.h | 8 ++++---- src/tincctl.h | 7 +++---- src/top.h | 7 +++---- src/upnp.h | 6 +++--- src/utils.h | 8 ++++---- src/version.h | 8 ++++---- src/xalloc.h | 9 +++++---- 64 files changed, 215 insertions(+), 211 deletions(-) diff --git a/src/autoconnect.h b/src/autoconnect.h index dc3ee1cf..82a5043b 100644 --- a/src/autoconnect.h +++ b/src/autoconnect.h @@ -1,3 +1,6 @@ +#ifndef TINC_AUTOCONNECT_H +#define TINC_AUTOCONNECT_H + /* autoconnect.h -- header for autoconnect.c Copyright (C) 2017 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_AUTOCONNECT_H__ -#define __TINC_AUTOCONNECT_H__ - extern void do_autoconnect(void); #endif diff --git a/src/buffer.h b/src/buffer.h index a96c15aa..53522b69 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,5 +1,5 @@ -#ifndef __TINC_BUFFER_H__ -#define __TINC_BUFFER_H__ +#ifndef TINC_BUFFER_H +#define TINC_BUFFER_H typedef struct buffer_t { char *data; diff --git a/src/cipher.h b/src/cipher.h index 44db40f8..05012230 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -1,3 +1,6 @@ +#ifndef TINC_CIPHER_H +#define TINC_CIPHER_H + /* cipher.h -- header file cipher.c Copyright (C) 2007-2016 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CIPHER_H__ -#define __TINC_CIPHER_H__ - #define CIPHER_MAX_BLOCK_SIZE 32 #define CIPHER_MAX_IV_SIZE 16 #define CIPHER_MAX_KEY_SIZE 32 diff --git a/src/conf.h b/src/conf.h index 2478c585..9fcc3013 100644 --- a/src/conf.h +++ b/src/conf.h @@ -1,3 +1,6 @@ +#ifndef TINC_CONF_H +#define TINC_CONF_H + /* conf.h -- header for conf.c Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CONF_H__ -#define __TINC_CONF_H__ - #include "list.h" #include "splay_tree.h" #include "subnet.h" @@ -61,4 +61,4 @@ extern bool read_server_config(void); extern bool read_host_config(splay_tree_t *, const char *); extern bool append_config_file(const char *, const char *, const char *); -#endif /* __TINC_CONF_H__ */ +#endif diff --git a/src/connection.h b/src/connection.h index acd77bc2..b6f81056 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,3 +1,6 @@ +#ifndef TINC_CONNECTION_H +#define TINC_CONNECTION_H + /* connection.h -- header for connection.c Copyright (C) 2000-2013 Guus Sliepen , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CONNECTION_H__ -#define __TINC_CONNECTION_H__ - #include "buffer.h" #include "cipher.h" #include "digest.h" @@ -118,4 +118,4 @@ extern void connection_add(connection_t *); extern void connection_del(connection_t *); extern bool dump_connections(struct connection_t *); -#endif /* __TINC_CONNECTION_H__ */ +#endif diff --git a/src/control.h b/src/control.h index ce8145a3..04fe3041 100644 --- a/src/control.h +++ b/src/control.h @@ -1,3 +1,6 @@ +#ifndef TINC_CONTROL_H +#define TINC_CONTROL_H + /* control.h -- header for control.c. Copyright (C) 2007 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CONTROL_H__ -#define __TINC_CONTROL_H__ - extern bool init_control(); extern void exit_control(); extern char controlcookie[]; diff --git a/src/control_common.h b/src/control_common.h index cd54889a..2be4abd5 100644 --- a/src/control_common.h +++ b/src/control_common.h @@ -1,3 +1,6 @@ +#ifndef TINC_CONTROL_COMMON_H +#define TINC_CONTROL_COMMON_H + /* control_protocol.h -- control socket protocol. Copyright (C) 2007 Scott Lamb @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CONTROL_PROTOCOL_H__ -#define __TINC_CONTROL_PROTOCOL_H__ - #include "protocol.h" enum request_type { diff --git a/src/crypto.h b/src/crypto.h index cd3654fe..c9abddd5 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -1,3 +1,6 @@ +#ifndef TINC_CRYPTO_H +#define TINC_CRYPTO_H + /* crypto.h -- header for crypto.c Copyright (C) 2007-2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CRYPTO_H__ -#define __TINC_CRYPTO_H__ - extern void crypto_init(); extern void crypto_exit(); extern void randomize(void *, size_t); diff --git a/src/device.h b/src/device.h index fa27df3d..c85671b3 100644 --- a/src/device.h +++ b/src/device.h @@ -1,3 +1,6 @@ +#ifndef TINC_DEVICE_H +#define TINC_DEVICE_H + /* device.h -- generic header for device.c Copyright (C) 2001-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_DEVICE_H__ -#define __TINC_DEVICE_H__ - #include "net.h" extern int device_fd; @@ -45,4 +45,4 @@ extern const devops_t uml_devops; extern const devops_t vde_devops; extern devops_t devops; -#endif /* __TINC_DEVICE_H__ */ +#endif diff --git a/src/digest.h b/src/digest.h index a3691bf0..33415311 100644 --- a/src/digest.h +++ b/src/digest.h @@ -1,3 +1,6 @@ +#ifndef TINC_DIGEST_H +#define TINC_DIGEST_H + /* digest.h -- header file digest.c Copyright (C) 2007-2016 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_DIGEST_H__ -#define __TINC_DIGEST_H__ - #define DIGEST_MAX_SIZE 64 #ifndef DISABLE_LEGACY diff --git a/src/dropin.h b/src/dropin.h index 938f30dc..81d1d03a 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -1,3 +1,6 @@ +#ifndef TINC_DROPIN_H +#define TINC_DROPIN_H + /* dropin.h -- header file for dropin.c Copyright (C) 2000-2005 Ivo Timmermans, @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __DROPIN_H__ -#define __DROPIN_H__ - #ifndef HAVE_DAEMON extern int daemon(int, int); #endif @@ -67,4 +67,4 @@ extern int nanosleep(const struct timespec *req, struct timespec *rem); #define EAI_SYSTEM 0 #endif -#endif /* __DROPIN_H__ */ +#endif diff --git a/src/ecdh.h b/src/ecdh.h index c5ea3efb..5a88244d 100644 --- a/src/ecdh.h +++ b/src/ecdh.h @@ -1,3 +1,6 @@ +#ifndef TINC_ECDH_H +#define TINC_ECDH_H + /* ecdh.h -- header file for ecdh.c Copyright (C) 2011-2013 Guus Sliepen @@ -17,13 +20,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_ECDH_H__ -#define __TINC_ECDH_H__ - #define ECDH_SIZE 32 #define ECDH_SHARED_SIZE 32 -#ifndef __TINC_ECDH_INTERNAL__ +#ifndef TINC_ECDH_INTERNAL typedef struct ecdh ecdh_t; #endif diff --git a/src/ecdsa.h b/src/ecdsa.h index d03a58ed..be138f9a 100644 --- a/src/ecdsa.h +++ b/src/ecdsa.h @@ -1,3 +1,6 @@ +#ifndef TINC_ECDSA_H +#define TINC_ECDSA_H + /* ecdsa.h -- ECDSA key handling Copyright (C) 2011-2013 Guus Sliepen @@ -17,10 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_ECDSA_H__ -#define __TINC_ECDSA_H__ - -#ifndef __TINC_ECDSA_INTERNAL__ +#ifndef TINC_ECDSA_INTERNAL typedef struct ecdsa ecdsa_t; #endif diff --git a/src/ecdsagen.h b/src/ecdsagen.h index 12e5c003..95ec7417 100644 --- a/src/ecdsagen.h +++ b/src/ecdsagen.h @@ -1,3 +1,6 @@ +#ifndef TINC_ECDSAGEN_H +#define TINC_ECDSAGEN_H + /* ecdsagen.h -- ECDSA key generation and export Copyright (C) 2011-2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_ECDSAGEN_H__ -#define __TINC_ECDSAGEN_H__ - #include "ecdsa.h" extern ecdsa_t *ecdsa_generate(void) __attribute__ ((__malloc__)); diff --git a/src/ed25519/ecdh.c b/src/ed25519/ecdh.c index d0cd7e0a..9adf19fe 100644 --- a/src/ed25519/ecdh.c +++ b/src/ed25519/ecdh.c @@ -21,7 +21,7 @@ #include "ed25519.h" -#define __TINC_ECDH_INTERNAL__ +#define TINC_ECDH_INTERNAL typedef struct ecdh_t { uint8_t private[64]; } ecdh_t; diff --git a/src/ed25519/ecdsa.c b/src/ed25519/ecdsa.c index f8aafe46..05b85501 100644 --- a/src/ed25519/ecdsa.c +++ b/src/ed25519/ecdsa.c @@ -21,7 +21,7 @@ #include "ed25519.h" -#define __TINC_ECDSA_INTERNAL__ +#define TINC_ECDSA_INTERNAL typedef struct { uint8_t private[64]; uint8_t public[32]; diff --git a/src/ed25519/ecdsagen.c b/src/ed25519/ecdsagen.c index d2a14890..23ef6e97 100644 --- a/src/ed25519/ecdsagen.c +++ b/src/ed25519/ecdsagen.c @@ -21,7 +21,7 @@ #include "ed25519.h" -#define __TINC_ECDSA_INTERNAL__ +#define TINC_ECDSA_INTERNAL typedef struct { uint8_t private[64]; uint8_t public[32]; diff --git a/src/ed25519/fixedint.h b/src/ed25519/fixedint.h index 8abced09..e9f973c8 100644 --- a/src/ed25519/fixedint.h +++ b/src/ed25519/fixedint.h @@ -1,12 +1,12 @@ +#ifndef TINC_FIXEDINT_H +#define TINC_FIXEDINT_H + /* Portable header to provide the 32 and 64 bits type. Not a compatible replacement for , do not blindly use it as such. */ -#ifndef __TINC_FIXEDINT_H__ -#define __TINC_FIXEDINT_H__ - #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED) #include #define FIXEDINT_H_INCLUDED diff --git a/src/edge.h b/src/edge.h index ed46b8a4..274e5d92 100644 --- a/src/edge.h +++ b/src/edge.h @@ -1,3 +1,6 @@ +#ifndef TINC_EDGE_H +#define TINC_EDGE_H + /* edge.h -- header for edge.c Copyright (C) 2001-2012 Guus Sliepen , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_EDGE_H__ -#define __TINC_EDGE_H__ - #include "splay_tree.h" #include "connection.h" #include "net.h" @@ -52,4 +52,4 @@ extern void edge_del(edge_t *); extern edge_t *lookup_edge(struct node_t *, struct node_t *); extern bool dump_edges(struct connection_t *); -#endif /* __TINC_EDGE_H__ */ +#endif diff --git a/src/ethernet.h b/src/ethernet.h index 0b4a1db0..6ee2d389 100644 --- a/src/ethernet.h +++ b/src/ethernet.h @@ -1,3 +1,6 @@ +#ifndef TINC_ETHERNET_H +#define TINC_ETHERNET_H + /* ethernet.h -- missing Ethernet related definitions Copyright (C) 2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_ETHERNET_H__ -#define __TINC_ETHERNET_H__ - #ifndef ETH_ALEN #define ETH_ALEN 6 #endif @@ -99,4 +99,4 @@ struct ether_arp { #define arp_op ea_hdr.ar_op #endif -#endif /* __TINC_ETHERNET_H__ */ +#endif diff --git a/src/event.h b/src/event.h index 0ff8e01c..e7def913 100644 --- a/src/event.h +++ b/src/event.h @@ -1,3 +1,6 @@ +#ifndef TINC_EVENT_H +#define TINC_EVENT_H + /* event.h -- I/O, timeout and signal event handling Copyright (C) 2012-2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_EVENT_H__ -#define __TINC_EVENT_H__ - #include "splay_tree.h" #define IO_READ 1 diff --git a/src/fsck.h b/src/fsck.h index 51e4f554..3e0b4ca1 100644 --- a/src/fsck.h +++ b/src/fsck.h @@ -1,3 +1,6 @@ +#ifndef TINC_FSCK_H +#define TINC_FSCK_H + /* fsck.h -- header for fsck.c. Copyright (C) 2012 Guus Sliepen @@ -17,10 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_FSCK_H__ -#define __TINC_FSCK_H__ - extern int fsck(const char *argv0); #endif - diff --git a/src/gcrypt/cipher.h b/src/gcrypt/cipher.h index 389bb115..64cb42dd 100644 --- a/src/gcrypt/cipher.h +++ b/src/gcrypt/cipher.h @@ -1,3 +1,6 @@ +#ifndef TINC_GCRYPT_CIPHER_H +#define TINC_GCRYPT_CIPHER_H + /* cipher.h -- header file cipher.c Copyright (C) 2007-2009 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CIPHER_H__ -#define __TINC_CIPHER_H__ - #include #define CIPHER_MAX_BLOCK_SIZE 32 diff --git a/src/gcrypt/crypto.h b/src/gcrypt/crypto.h index 71df50c0..c77d4f46 100644 --- a/src/gcrypt/crypto.h +++ b/src/gcrypt/crypto.h @@ -1,3 +1,6 @@ +#ifndef TINC_GCRYPT_CRYPTO_H +#define TINC_GCRYPT_CRYPTO_H + /* crypto.h -- header for crypto.c Copyright (C) 2007-2009 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CRYPTO_H__ -#define __TINC_CRYPTO_H__ - extern void crypto_init(); extern void crypto_exit(); extern void randomize(void *, size_t); diff --git a/src/gcrypt/digest.h b/src/gcrypt/digest.h index 9f0d7d85..42404fcd 100644 --- a/src/gcrypt/digest.h +++ b/src/gcrypt/digest.h @@ -1,3 +1,6 @@ +#ifndef TINC_GCRYPT_DIGEST_H +#define TINC_GCRYPT_DIGEST_H + /* digest.h -- header file digest.c Copyright (C) 2007-2009 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_DIGEST_H__ -#define __TINC_DIGEST_H__ - #include #define DIGEST_MAX_SIZE 64 diff --git a/src/gcrypt/rsa.h b/src/gcrypt/rsa.h index 143f0153..2ea5e650 100644 --- a/src/gcrypt/rsa.h +++ b/src/gcrypt/rsa.h @@ -1,3 +1,6 @@ +#ifndef TINC_GCRYPT_RSA_H +#define TINC_GCRYPT_RSA_H + /* rsa.h -- RSA key handling Copyright (C) 2007 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_RSA_H__ -#define __TINC_RSA_H__ - #include typedef struct rsa { diff --git a/src/gcrypt/rsagen.h b/src/gcrypt/rsagen.h index 422d1560..4b491173 100644 --- a/src/gcrypt/rsagen.h +++ b/src/gcrypt/rsagen.h @@ -1,3 +1,6 @@ +#ifndef TINC_GCRYPT_RSAGEN_H +#define TINC_GCRYPT_RSAGEN_H + /* rsagen.h -- RSA key generation and export Copyright (C) 2008 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_RSAGEN_H__ -#define __TINC_RSAGEN_H__ - #include "rsa.h" extern bool rsa_generate(rsa_t *rsa, size_t bits, unsigned long exponent); diff --git a/src/getopt.h b/src/getopt.h index ddf6fdda..7cac1bd5 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -1,3 +1,6 @@ +#ifndef TINC_GETOPT_H +#define TINC_GETOPT_H + /* Declarations for getopt. Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. @@ -130,4 +133,4 @@ extern int _getopt_internal (); } #endif -#endif /* _GETOPT_H */ +#endif diff --git a/src/graph.h b/src/graph.h index fa521f53..fafffcb0 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1,3 +1,6 @@ +#ifndef TINC_GRAPH_H +#define TINC_GRAPH_H + /* graph.h -- header for graph.c Copyright (C) 2001-2012 Guus Sliepen , @@ -18,10 +21,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_GRAPH_H__ -#define __TINC_GRAPH_H__ - extern void graph(void); extern void dump_graph(void); -#endif /* __TINC_GRAPH_H__ */ +#endif diff --git a/src/hash.h b/src/hash.h index 30a15fb2..a5ae2e9d 100644 --- a/src/hash.h +++ b/src/hash.h @@ -1,3 +1,6 @@ +#ifndef TINC_HASH_H +#define TINC_HASH_H + /* hash.h -- header file for hash.c Copyright (C) 2012 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_HASH_H__ -#define __TINC_HASH_H__ - typedef struct hash_t { size_t n; size_t size; @@ -39,4 +39,4 @@ extern void *hash_search_or_insert(hash_t *, const void *key, const void *value) extern void hash_clear(hash_t *); extern void hash_resize(hash_t *, size_t n); -#endif /* __TINC_HASH_H__ */ +#endif diff --git a/src/have.h b/src/have.h index faa4c9e0..402f8028 100644 --- a/src/have.h +++ b/src/have.h @@ -1,3 +1,6 @@ +#ifndef TINC_HAVE_H +#define TINC_HAVE_H + /* have.h -- include headers which are known to exist Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_HAVE_H__ -#define __TINC_HAVE_H__ - #ifdef HAVE_MINGW #define WINVER WindowsXP #define WIN32_LEAN_AND_MEAN @@ -213,4 +213,4 @@ #define SLASH "/" #endif -#endif /* __TINC_SYSTEM_H__ */ +#endif diff --git a/src/ifconfig.h b/src/ifconfig.h index 3dbf9f68..854780b7 100644 --- a/src/ifconfig.h +++ b/src/ifconfig.h @@ -1,3 +1,6 @@ +#ifndef TINC_IFCONFIG_H +#define TINC_IFCONFIG_H + /* ifconfig.h -- header for ifconfig.c. Copyright (C) 2016 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_IFCONFIG_H__ -#define __TINC_IFCONFIG_H__ - extern void ifconfig_dhcp(FILE *out); extern void ifconfig_dhcp6(FILE *out); extern void ifconfig_slaac(FILE *out); diff --git a/src/info.h b/src/info.h index a3f387ff..1b323e01 100644 --- a/src/info.h +++ b/src/info.h @@ -1,3 +1,6 @@ +#ifndef TINC_INFO_H +#define TINC_INFO_H + /* info.h -- header for info.c. Copyright (C) 2012 Guus Sliepen @@ -17,11 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_INFO_H__ -#define __TINC_INFO_H__ - extern int info(int fd, const char *item); extern char *strip_weight(char *); #endif - diff --git a/src/invitation.h b/src/invitation.h index 3d017e92..621baab9 100644 --- a/src/invitation.h +++ b/src/invitation.h @@ -1,3 +1,6 @@ +#ifndef TINC_INVITATION_H +#define TINC_INVITATION_H + /* invitation.h -- header for invitation.c. Copyright (C) 2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_INVITATION_H__ -#define __TINC_INVITATION_H__ - bool recvdata(int fd, char *data, size_t len); int cmd_invite(int argc, char *argv[]); int cmd_join(int argc, char *argv[]); diff --git a/src/ipv4.h b/src/ipv4.h index 997b88d8..7ad7e01b 100644 --- a/src/ipv4.h +++ b/src/ipv4.h @@ -1,3 +1,6 @@ +#ifndef TINC_IPV4_H +#define TINC_IPV4_H + /* ipv4.h -- missing IPv4 related definitions Copyright (C) 2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_IPV4_H__ -#define __TINC_IPV4_H__ - #ifndef AF_INET #define AF_INET 2 #endif @@ -146,4 +146,4 @@ struct icmp { } __attribute__ ((__gcc_struct__, __packed__)); #endif -#endif /* __TINC_IPV4_H__ */ +#endif diff --git a/src/ipv6.h b/src/ipv6.h index cc2c5b6d..b57ba74b 100644 --- a/src/ipv6.h +++ b/src/ipv6.h @@ -1,3 +1,6 @@ +#ifndef TINC_IPV6_H +#define TINC_IPV6_H + /* ipv6.h -- missing IPv6 related definitions Copyright (C) 2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_IPV6_H__ -#define __TINC_IPV6_H__ - #ifndef AF_INET6 #define AF_INET6 10 #endif @@ -104,4 +104,4 @@ struct nd_opt_hdr { } __attribute__ ((__gcc_struct__, __packed__)); #endif -#endif /* __TINC_IPV6_H__ */ +#endif diff --git a/src/list.h b/src/list.h index b0e7a845..489c8d10 100644 --- a/src/list.h +++ b/src/list.h @@ -1,3 +1,6 @@ +#ifndef TINC_LIST_H +#define TINC_LIST_H + /* list.h -- header file for list.c Copyright (C) 2000-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_LIST_H__ -#define __TINC_LIST_H__ - typedef struct list_node_t { struct list_node_t *prev; struct list_node_t *next; @@ -87,4 +87,4 @@ extern void list_foreach_node(list_t *, list_action_node_t); */ #define list_each(type, item, list) (type *item = (type *)1; item; item = NULL) for(list_node_t *node = (list)->head, *next; item = node ? node->data : NULL, next = node ? node->next : NULL, node; node = next) -#endif /* __TINC_LIST_H__ */ +#endif diff --git a/src/logger.h b/src/logger.h index f4f46f9d..a14b909f 100644 --- a/src/logger.h +++ b/src/logger.h @@ -1,3 +1,6 @@ +#ifndef TINC_LOGGER_H +#define TINC_LOGGER_H + /* logger.h -- header file for logger.c Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_LOGGER_H__ -#define __TINC_LOGGER_H__ - typedef enum debug_t { DEBUG_NOTHING = 0, /* Quiet mode, only show starting/stopping of the daemon */ DEBUG_ALWAYS = 0, @@ -75,4 +75,4 @@ extern void reopenlogger(void); extern void logger(int, int, const char *, ...) __attribute__ ((__format__(printf, 3, 4))); extern void closelogger(void); -#endif /* __TINC_LOGGER_H__ */ +#endif diff --git a/src/meta.h b/src/meta.h index 8b00a5ab..52da7530 100644 --- a/src/meta.h +++ b/src/meta.h @@ -1,3 +1,6 @@ +#ifndef TINC_META_H +#define TINC_META_H + /* meta.h -- header for meta.c Copyright (C) 2000-2014 Guus Sliepen , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_META_H__ -#define __TINC_META_H__ - #include "connection.h" extern bool send_meta(struct connection_t *, const char *, int); @@ -30,4 +30,4 @@ extern bool receive_meta_sptps(void *, uint8_t, const void *, uint16_t); extern void broadcast_meta(struct connection_t *, const char *, int); extern bool receive_meta(struct connection_t *); -#endif /* __TINC_META_H__ */ +#endif diff --git a/src/mingw/common.h b/src/mingw/common.h index 6e5e75ce..f16744b1 100644 --- a/src/mingw/common.h +++ b/src/mingw/common.h @@ -1,3 +1,6 @@ +#ifndef TINC_MINGW_COMMON_H +#define TINC_MINGW_COMMON_H + /* * TAP-Win32 -- A kernel driver to provide virtual tap device functionality * on Windows. Originally derived from the CIPE-Win32 @@ -73,3 +76,5 @@ //========================================================= #define TAP_COMPONENT_ID "tap0801" + +#endif diff --git a/src/names.h b/src/names.h index e6b99c56..f1096866 100644 --- a/src/names.h +++ b/src/names.h @@ -1,3 +1,6 @@ +#ifndef TINC_NAMES_H +#define TINC_NAMES_H + /* names.h -- header for names.c Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_NAMES_H__ -#define __TINC_NAMES_H__ - extern char *confdir; extern char *confbase; extern bool confbase_given; @@ -35,4 +35,4 @@ extern char *program_name; extern void make_names(bool daemon); extern void free_names(void); -#endif /* __TINC_NAMES_H__ */ +#endif diff --git a/src/net.h b/src/net.h index 69ca4887..6d4dfc89 100644 --- a/src/net.h +++ b/src/net.h @@ -1,3 +1,6 @@ +#ifndef TINC_NET_H +#define TINC_NET_H + /* net.h -- header for net.c Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_NET_H__ -#define __TINC_NET_H__ - #include "ipv6.h" #include "cipher.h" #include "digest.h" @@ -225,4 +225,4 @@ extern void try_tx(struct node_t *n, bool); #define closesocket(s) close(s) #endif -#endif /* __TINC_NET_H__ */ +#endif diff --git a/src/netutl.h b/src/netutl.h index 2e2f2936..90aa54da 100644 --- a/src/netutl.h +++ b/src/netutl.h @@ -1,3 +1,6 @@ +#ifndef TINC_NETUTL_H +#define TINC_NETUTL_H + /* netutl.h -- header file for netutl.c Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_NETUTL_H__ -#define __TINC_NETUTL_H__ - #include "net.h" extern bool hostnames; @@ -36,4 +36,4 @@ extern void sockaddrfree(sockaddr_t *); extern void sockaddrcpy(sockaddr_t *, const sockaddr_t *); extern void sockaddr_setport(sockaddr_t *, const char *); -#endif /* __TINC_NETUTL_H__ */ +#endif diff --git a/src/node.h b/src/node.h index b48fe88f..ad8b728f 100644 --- a/src/node.h +++ b/src/node.h @@ -1,3 +1,6 @@ +#ifndef TINC_NODE_H +#define TINC_NODE_H + /* node.h -- header for node.c Copyright (C) 2001-2013 Guus Sliepen , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_NODE_H__ -#define __TINC_NODE_H__ - #include "splay_tree.h" #include "cipher.h" #include "connection.h" @@ -128,4 +128,4 @@ extern bool dump_nodes(struct connection_t *); extern bool dump_traffic(struct connection_t *); extern void update_node_udp(node_t *, const sockaddr_t *); -#endif /* __TINC_NODE_H__ */ +#endif diff --git a/src/openssl/digest.h b/src/openssl/digest.h index 0a32707e..1b1389d1 100644 --- a/src/openssl/digest.h +++ b/src/openssl/digest.h @@ -1,3 +1,6 @@ +#ifndef TINC_OPENSSL_DIGEST_H +#define TINC_OPENSSL_DIGEST_H + /* digest.h -- header file digest.c Copyright (C) 2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_OPENSSL_DIGEST_H__ -#define __TINC_OPENSSL_DIGEST_H__ - #include struct digest { diff --git a/src/openssl/rsa.c b/src/openssl/rsa.c index 3033bcd7..3543df30 100644 --- a/src/openssl/rsa.c +++ b/src/openssl/rsa.c @@ -22,7 +22,7 @@ #include #include -#define __TINC_RSA_INTERNAL__ +#define TINC_RSA_INTERNAL typedef RSA rsa_t; #include "../logger.h" diff --git a/src/openssl/rsagen.c b/src/openssl/rsagen.c index b7eb6299..78a22d92 100644 --- a/src/openssl/rsagen.c +++ b/src/openssl/rsagen.c @@ -22,7 +22,7 @@ #include #include -#define __TINC_RSA_INTERNAL__ +#define TINC_RSA_INTERNAL typedef RSA rsa_t; #include "../logger.h" diff --git a/src/prf.h b/src/prf.h index ef4b99bb..6f5448bb 100644 --- a/src/prf.h +++ b/src/prf.h @@ -1,3 +1,6 @@ +#ifndef TINC_PRF_H +#define TINC_PRF_H + /* prf.h -- header file for prf.c Copyright (C) 2011-2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_PRF_H__ -#define __TINC_PRF_H__ - extern bool prf(const char *secret, size_t secretlen, char *seed, size_t seedlen, char *out, size_t outlen) __attribute__ ((__warn_unused_result__)); #endif diff --git a/src/process.h b/src/process.h index ce2daed5..93ef5e9c 100644 --- a/src/process.h +++ b/src/process.h @@ -1,3 +1,6 @@ +#ifndef TINC_PROCESS_H +#define TINC_PROCESS_H + /* process.h -- header file for process.c Copyright (C) 1999-2005 Ivo Timmermans, @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_PROCESS_H__ -#define __TINC_PROCESS_H__ - extern bool do_detach; extern bool sigalrm; @@ -33,4 +33,4 @@ extern io_t stop_io; extern bool init_service(void); #endif -#endif /* __TINC_PROCESS_H__ */ +#endif diff --git a/src/protocol.h b/src/protocol.h index 8ce4e0d3..c0e6f4fa 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -1,3 +1,6 @@ +#ifndef TINC_PROTOCOL_H +#define TINC_PROTOCOL_H + /* protocol.h -- header for protocol.c Copyright (C) 1999-2005 Ivo Timmermans, @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_PROTOCOL_H__ -#define __TINC_PROTOCOL_H__ - #include "ecdsa.h" /* Protocol version. Different major versions are incompatible. */ @@ -138,4 +138,4 @@ extern bool control_h(struct connection_t *, const char *); extern bool udp_info_h(struct connection_t *, const char *); extern bool mtu_info_h(struct connection_t *, const char *); -#endif /* __TINC_PROTOCOL_H__ */ +#endif diff --git a/src/route.h b/src/route.h index a0121d7d..bb4f7686 100644 --- a/src/route.h +++ b/src/route.h @@ -1,3 +1,6 @@ +#ifndef TINC_ROUTE_H +#define TINC_ROUTE_H + /* route.h -- header file for route.c Copyright (C) 2000-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_ROUTE_H__ -#define __TINC_ROUTE_H__ - #include "net.h" #include "node.h" @@ -56,4 +56,4 @@ extern mac_t mymac; extern void route(struct node_t *, struct vpn_packet_t *); -#endif /* __TINC_ROUTE_H__ */ +#endif diff --git a/src/rsa.h b/src/rsa.h index f4290d44..dc849aee 100644 --- a/src/rsa.h +++ b/src/rsa.h @@ -1,3 +1,6 @@ +#ifndef TINC_RSA_H +#define TINC_RSA_H + /* rsa.h -- RSA key handling Copyright (C) 2007-2013 Guus Sliepen @@ -17,10 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_RSA_H__ -#define __TINC_RSA_H__ - -#ifndef __TINC_RSA_INTERNAL__ +#ifndef TINC_RSA_INTERNAL typedef struct rsa rsa_t; #endif diff --git a/src/rsagen.h b/src/rsagen.h index 58ce29f0..83349f91 100644 --- a/src/rsagen.h +++ b/src/rsagen.h @@ -1,3 +1,6 @@ +#ifndef TINC_RSAGEN_H +#define TINC_RSAGEN_H + /* rsagen.h -- RSA key generation and export Copyright (C) 2008-2013 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_RSAGEN_H__ -#define __TINC_RSAGEN_H__ - #include "rsa.h" extern rsa_t *rsa_generate(size_t bits, unsigned long exponent) __attribute__ ((__malloc__)); diff --git a/src/script.h b/src/script.h index 2e26418d..51720349 100644 --- a/src/script.h +++ b/src/script.h @@ -1,3 +1,6 @@ +#ifndef TINC_SCRIPT_H +#define TINC_SCRIPT_H + /* script.h -- header file for script.c Copyright (C) 1999-2005 Ivo Timmermans, @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_SCRIPT_H__ -#define __TINC_SCRIPT_H__ - typedef struct environment { int n; int size; @@ -35,4 +35,4 @@ extern void environment_exit(environment_t *env); extern bool execute_script(const char *name, environment_t *env); -#endif /* __TINC_SCRIPT_H__ */ +#endif diff --git a/src/splay_tree.h b/src/splay_tree.h index 3ddf2172..d360fc3c 100644 --- a/src/splay_tree.h +++ b/src/splay_tree.h @@ -1,3 +1,6 @@ +#ifndef TINC_SPLAY_TREE_H +#define TINC_SPLAY_TREE_H + /* splay_tree.h -- header file for splay_tree.c Copyright (C) 2004-2013 Guus Sliepen @@ -17,10 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -#ifndef __SPLAY_TREE_H__ -#define __SPLAY_TREE_H__ - typedef struct splay_node_t { /* Linked list part */ diff --git a/src/sptps.h b/src/sptps.h index 75a95651..f5686f4e 100644 --- a/src/sptps.h +++ b/src/sptps.h @@ -1,3 +1,6 @@ +#ifndef TINC_SPTPS_H +#define TINC_SPTPS_H + /* sptps.h -- Simple Peer-to-Peer Security Copyright (C) 2011-2014 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __SPTPS_H__ -#define __SPTPS_H__ - #include "system.h" #include "chacha-poly1305/chacha-poly1305.h" diff --git a/src/subnet.h b/src/subnet.h index 6184e6b7..5bd5ff00 100644 --- a/src/subnet.h +++ b/src/subnet.h @@ -1,3 +1,6 @@ +#ifndef TINC_SUBNET_H +#define TINC_SUBNET_H + /* subnet.h -- header for subnet.c Copyright (C) 2000-2012 Guus Sliepen , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_SUBNET_H__ -#define __TINC_SUBNET_H__ - #include "net.h" #include "node.h" @@ -88,4 +88,4 @@ extern subnet_t *lookup_subnet_ipv6(const ipv6_t *); extern bool dump_subnets(struct connection_t *); extern void subnet_cache_flush(void); -#endif /* __TINC_SUBNET_H__ */ +#endif diff --git a/src/system.h b/src/system.h index 2201ff31..f9675f95 100644 --- a/src/system.h +++ b/src/system.h @@ -1,3 +1,6 @@ +#ifndef TINC_SYSTEM_H +#define TINC_SYSTEM_H + /* system.h -- system headers Copyright (C) 1998-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_SYSTEM_H__ -#define __TINC_SYSTEM_H__ - #include "../config.h" #include "have.h" @@ -33,4 +33,4 @@ #include "dropin.h" -#endif /* __TINC_SYSTEM_H__ */ +#endif diff --git a/src/tincctl.h b/src/tincctl.h index 6628f2bb..db7f45a3 100644 --- a/src/tincctl.h +++ b/src/tincctl.h @@ -1,3 +1,6 @@ +#ifndef TINC_TINCCTL_H +#define TINC_TINCCTL_H + /* tincctl.h -- header for tincctl.c. Copyright (C) 2011-2016 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_TINCCTL_H__ -#define __TINC_TINCCTL_H__ - extern bool tty; extern bool force; extern char line[4096]; @@ -53,4 +53,3 @@ extern FILE *fopenmask(const char *filename, const char *mode, mode_t perms); extern ecdsa_t *get_pubkey(FILE *f); #endif - diff --git a/src/top.h b/src/top.h index b3a264da..612d0d8d 100644 --- a/src/top.h +++ b/src/top.h @@ -1,3 +1,6 @@ +#ifndef TINC_TOP_H +#define TINC_TOP_H + /* top.h -- header for top.c. Copyright (C) 2011 Guus Sliepen @@ -17,10 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_TOP_H__ -#define __TINC_TOP_H__ - extern void top(int fd); #endif - diff --git a/src/upnp.h b/src/upnp.h index dd0531bb..48573422 100644 --- a/src/upnp.h +++ b/src/upnp.h @@ -1,3 +1,6 @@ +#ifndef TINC_UPNP_H +#define TINC_UPNP_H + /* upnp.h -- UPnP-IGD client Copyright (C) 2015 Guus Sliepen @@ -17,9 +20,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __UPNP_H__ -#define __UPNP_H__ - #include "system.h" extern void upnp_init(bool, bool); diff --git a/src/utils.h b/src/utils.h index 5c387bdb..7b16bc61 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,3 +1,6 @@ +#ifndef TINC_UTILS_H +#define TINC_UTILS_H + /* utils.h -- header file for utils.c Copyright (C) 1999-2005 Ivo Timmermans @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_UTILS_H__ -#define __TINC_UTILS_H__ - extern int hex2bin(const char *src, void *dst, int length); extern int bin2hex(const void *src, char *dst, int length); @@ -54,4 +54,4 @@ extern bool check_id(const char *); extern bool check_netname(const char *, bool strict); char *replace_name(const char *name); -#endif /* __TINC_UTILS_H__ */ +#endif diff --git a/src/version.h b/src/version.h index 9cbecb6e..f34373e5 100644 --- a/src/version.h +++ b/src/version.h @@ -1,3 +1,6 @@ +#ifndef TINC_VERSION_H +#define TINC_VERSION_H + /* version.h -- header for version.c Copyright (C) 2014 Etienne Dechamps @@ -17,11 +20,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_VERSION_H__ -#define __TINC_VERSION_H__ - extern const char* const BUILD_DATE; extern const char* const BUILD_TIME; extern const char* const BUILD_VERSION; -#endif /* __TINC_VERSION_H__ */ +#endif diff --git a/src/xalloc.h b/src/xalloc.h index 28960fbd..34dac3cc 100644 --- a/src/xalloc.h +++ b/src/xalloc.h @@ -1,3 +1,6 @@ +#ifndef TINC_XALLOC_H +#define TINC_XALLOC_H + /* xalloc.h -- malloc and related fuctions with out of memory checking Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. @@ -15,10 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -#ifndef __TINC_XALLOC_H__ -#define __TINC_XALLOC_H__ + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ static inline void *xmalloc(size_t n) __attribute__ ((__malloc__)); static inline void *xmalloc(size_t n) { -- 2.20.1