-#ifndef __MESHLINK_BUFFER_H__
-#define __MESHLINK_BUFFER_H__
+#ifndef MESHLINK_BUFFER_H
+#define MESHLINK_BUFFER_H
+
+/*
+ conf.h -- header for conf.c
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
typedef struct buffer_t {
char *data;
+#ifndef MESHLINK_CONF_H
+#define MESHLINK_CONF_H
+
/*
conf.h -- header for conf.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_CONF_H__
-#define __MESHLINK_CONF_H__
-
#include "list.h"
#include "meshlink_internal.h"
#include "splay_tree.h"
extern bool modify_config_file(struct meshlink_handle *mesh, const char *, const char *, const char *, bool);
extern bool append_config_file(struct meshlink_handle *mesh, const char *, const char *, const char *);
-#endif /* __MESHLINK_CONF_H__ */
+#endif
+#ifndef MESHLINK_CONNECTION_H
+#define MESHLINK_CONNECTION_H
+
/*
connection.h -- header for connection.c
- Copyright (C) 2000-2013 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2000-2013, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_CONNECTION_H__
-#define __MESHLINK_CONNECTION_H__
-
#include "buffer.h"
#include "list.h"
#include "sptps.h"
extern void connection_add(struct meshlink_handle *mesh, connection_t *);
extern void connection_del(struct meshlink_handle *mesh, connection_t *);
-#endif /* __MESHLINK_CONNECTION_H__ */
+#endif
+#ifndef MESHLINK_CRYPTO_H
+#define MESHLINK_CRYPTO_H
+
/*
crypto.h -- header for crypto.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_CRYPTO_H__
-#define __MESHLINK_CRYPTO_H__
-
extern void crypto_init();
extern void crypto_exit();
extern void randomize(void *, size_t);
-#ifndef __MESHLINK_DEVTOOLS_H__
-#define __MESHLINK_DEVTOOLS_H__
+#ifndef MESHLINK_DEVTOOLS_H
+#define MESHLINK_DEVTOOLS_H
+
+/*
+ devtools.h -- header for devtools.h
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
extern bool devtool_export_json_all_edges_state(meshlink_handle_t *mesh, FILE* stream);
+#ifndef MESHLINK_DISCOVERY_H
+#define MESHLINK_DISCOVERY_H
-#ifndef __MESHLINK_DISCOVERY_H__
-#define __MESHLINK_DISCOVERY_H__
+/*
+ discovery.h -- header for dicovery.c
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
#include <stdbool.h>
+#ifndef MESHLINK_DROPIN_H
+#define MESHLINK_DROPIN_H
+
/*
dropin.h -- header file for dropin.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __DROPIN_H__
-#define __DROPIN_H__
-
#include "fake-getaddrinfo.h"
#include "fake-getnameinfo.h"
#endif
#endif
-#endif /* __DROPIN_H__ */
+#endif
+#ifndef MESHLINK_ECDH_H
+#define MESHLINK_ECDH_H
+
/*
ecdh.h -- header file for ecdh.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_ECDH_H__
-#define __MESHLINK_ECDH_H__
-
#define ECDH_SIZE 32
#define ECDH_SHARED_SIZE 32
+#ifndef MESHLINK_ECDSA_H
+#define MESHLINK_ECDSA_H
+
/*
ecdsa.h -- ECDSA key handling
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_ECDSA_H__
-#define __MESHLINK_ECDSA_H__
-
#ifndef __MESHLINK_ECDSA_INTERNAL__
typedef struct ecdsa ecdsa_t;
#endif
+#ifndef MESHLINK_ECDSAGEN_H
+#define MESHLINK_ECDSAGEN_H
+
/*
ecdsagen.h -- ECDSA key generation and export
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_ECDSAGEN_H__
-#define __MESHLINK_ECDSAGEN_H__
-
#include "ecdsa.h"
extern ecdsa_t *ecdsa_generate(void) __attribute__((__malloc__));
+#ifndef MESHLINK_EDGE_H
+#define MESHLINK_EDGE_H
+
/*
edge.h -- header for edge.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_EDGE_H__
-#define __MESHLINK_EDGE_H__
-
#include "splay_tree.h"
#include "connection.h"
#include "net.h"
extern void edge_del(struct meshlink_handle *mesh, edge_t *);
extern edge_t *lookup_edge(struct node_t *, struct node_t *);
-#endif /* __MESHLINK_EDGE_H__ */
+#endif
+#ifndef MESHLINK_EVENT_H
+#define MESHLINK_EVENT_H
+
/*
event.h -- I/O, timeout and signal event handling
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_EVENT_H__
-#define __MESHLINK_EVENT_H__
-
#include "splay_tree.h"
#include "system.h"
#include <pthread.h>
-/*
- * fake library for ssh
- *
- * This file is included in getaddrinfo.c and getnameinfo.c.
- * See getaddrinfo.c and getnameinfo.c.
- */
+#ifndef MESHLINK_FAKE_GAI_ERRNOS_H
+#define MESHLINK_FAKE_GAI_ERRNOS_H
-/* for old netdb.h */
#ifndef EAI_NODATA
#define EAI_NODATA 1
#endif
#ifndef EAI_SYSTEM
#define EAI_SYSTEM 4
#endif
+
+#endif
-#ifndef _FAKE_GETADDRINFO_H
-#define _FAKE_GETADDRINFO_H
+#ifndef MESHLINK_FAKE_GETADDRINFO_H
+#define MESHLINK_FAKE_GETADDRINFO_H
#include "fake-gai-errnos.h"
void freeaddrinfo(struct addrinfo *ai);
#endif /* !HAVE_FREEADDRINFO */
-#endif /* _FAKE_GETADDRINFO_H */
+#endif
-#ifndef _FAKE_GETNAMEINFO_H
-#define _FAKE_GETNAMEINFO_H
+#ifndef MESHLINK_FAKE_GETNAMEINFO_H
+#define MESHLINK_FAKE_GETNAMEINFO_H
#if !HAVE_DECL_GETNAMEINFO
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
# define NI_MAXHOST 1025
#endif /* !NI_MAXHOST */
-#endif /* _FAKE_GETNAMEINFO_H */
+#endif
+#ifndef MESHLINK_GRAPH_H
+#define MESHLINK_GRAPH_H
+
/*
graph.h -- header for graph.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_GRAPH_H__
-#define __MESHLINK_GRAPH_H__
-
extern void graph(struct meshlink_handle *mesh);
-#endif /* __MESHLINK_GRAPH_H__ */
+#endif
+#ifndef MESHLINK_HASH_H
+#define MESHLINK_HASH_H
+
/*
hash.h -- header file for hash.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_HASH_H__
-#define __MESHLINK_HASH_H__
-
typedef struct hash_t {
size_t n;
size_t size;
extern void hash_clear(hash_t *);
extern void hash_resize(hash_t *, size_t n);
-#endif /* __MESHLINK_HASH_H__ */
+#endif
+#ifndef MESHLINK_HAVE_H
+#define MESHLINK_HAVE_H
+
/*
have.h -- include headers which are known to exist
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_HAVE_H__
-#define __MESHLINK_HAVE_H__
-
#ifdef HAVE_MINGW
#ifdef WITH_WINDOWS2000
#define WINVER Windows2000
#define SLASH "/"
#endif
-#endif /* __MESHLINK_SYSTEM_H__ */
+#endif
+#ifndef MESHLINK_LIST_H
+#define MESHLINK_LIST_H
+
/*
list.h -- header file for list.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_LIST_H__
-#define __MESHLINK_LIST_H__
-
typedef struct list_node_t {
struct list_node_t *prev;
struct list_node_t *next;
#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 /* __MESHLINK_LIST_H__ */
+#endif
+#ifndef MESHLINK_LOGGER_H
+#define MESHLINK_LOGGER_H
+
/*
logger.h -- header file for logger.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_LOGGER_H__
-#define __MESHLINK_LOGGER_H__
-
#include "meshlink_internal.h"
extern void logger(meshlink_handle_t *mesh, meshlink_log_level_t level, const char *format, ...) __attribute__((__format__(printf, 3, 4)));
-#endif /* __MESHLINK_LOGGER_H__ */
+#endif
+#ifndef MESHLINKPP_H
+#define MESHLINKPP_H
+
/*
meshlink++.h -- MeshLink C++ API
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MESHLINKPP_H
-#define MESHLINKPP_H
-
#include <meshlink.h>
#include <new> // for 'placement new'
}
}
-#endif // MESHLINKPP_H
+#endif
+#ifndef MESHLINK_H
+#define MESHLINK_H
+
/*
meshlink.h -- MeshLink API
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MESHLINK_H
-#define MESHLINK_H
-
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
}
#endif
-#endif // MESHLINK_H
+#endif
+#ifndef MESHLINK_INTERNAL_H
+#define MESHLINK_INTERNAL_H
+
/*
meshlink_internal.h -- Internal parts of the public API.
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MESHLINK_INTERNAL_H
-#define MESHLINK_INTERNAL_H
-
#include "system.h"
#include "event.h"
extern dev_class_traits_t dev_class_traits[];
-#endif // MESHLINK_INTERNAL_H
+#endif
+#ifndef MESHLINK_QUEUE_H
+#define MESHLINK_QUEUE_H
+
/*
queue.h -- Thread-safe queue
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MESHLINK_QUEUE_H
-#define MESHLINK_QUEUE_H
-
#include <pthread.h>
#include <stdbool.h>
#include <stddef.h>
+#ifndef MESHLINK_META_H
+#define MESHLINK_META_H
+
/*
meta.h -- header for meta.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_META_H__
-#define __MESHLINK_META_H__
-
#include "connection.h"
extern bool send_meta(struct meshlink_handle *mesh, struct connection_t *, const char *, int);
extern void broadcast_meta(struct meshlink_handle *mesh, struct connection_t *, const char *, int);
extern bool receive_meta(struct meshlink_handle *mesh, struct connection_t *);
-#endif /* __MESHLINK_META_H__ */
+#endif
+#ifndef MESHLINK_NET_H
+#define MESHLINK_NET_H
+
/*
net.h -- header for net.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_NET_H__
-#define __MESHLINK_NET_H__
-
#include "event.h"
#include "sockaddr.h"
extern CRITICAL_SECTION mutex;
#endif
-#endif /* __MESHLINK_NET_H__ */
+#endif
+#ifndef MESHLINK_NETUTL_H
+#define MESHLINK_NETUTL_H
+
/*
netutl.h -- header file for netutl.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_NETUTL_H__
-#define __MESHLINK_NETUTL_H__
-
#include "net.h"
extern bool hostnames;
extern void sockaddrfree(sockaddr_t *);
extern void sockaddrcpy(sockaddr_t *, const sockaddr_t *);
-#endif /* __MESHLINK_NETUTL_H__ */
+#endif
+#ifndef MESHLINK_NODE_H
+#define MESHLINK_NODE_H
+
/*
node.h -- header for node.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_NODE_H__
-#define __MESHLINK_NODE_H__
-
#include "event.h"
#include "sockaddr.h"
#include "sptps.h"
extern node_t *lookup_node_udp(struct meshlink_handle *mesh, const sockaddr_t *);
extern void update_node_udp(struct meshlink_handle *mesh, node_t *, const sockaddr_t *);
-#endif /* __MESHLINK_NODE_H__ */
+#endif
+#ifndef MESHLINK_PRF_H
+#define MESHLINK_PRF_H
+
/*
prf.h -- header file for prf.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_PRF_H__
-#define __MESHLINK_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
+#ifndef MESHLINK_PROTOCOL_H
+#define MESHLINK_PROTOCOL_H
+
/*
protocol.h -- header for protocol.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_PROTOCOL_H__
-#define __MESHLINK_PROTOCOL_H__
-
#include "ecdsa.h"
/* Protocol version. Different major versions are incompatible. */
extern bool ans_key_h(struct meshlink_handle *mesh, struct connection_t *, const char *);
extern bool tcppacket_h(struct meshlink_handle *mesh, struct connection_t *, const char *);
-#endif /* __MESHLINK_PROTOCOL_H__ */
+#endif
+#ifndef MESHLINK_ROUTE_H
+#define MESHLINK_ROUTE_H
+
/*
route.h -- header file for route.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_ROUTE_H__
-#define __MESHLINK_ROUTE_H__
-
#include "net.h"
#include "node.h"
extern void route(struct meshlink_handle *mesh, struct node_t *, struct vpn_packet_t *);
-#endif /* __MESHLINK_ROUTE_H__ */
+#endif
-#ifndef SOCKADDR_H
-#define SOCKADDR_H
+#ifndef MESHLINK_SOCKADDR_H
+#define MESHLINK_SOCKADDR_H
#define AF_UNKNOWN 255
struct sockaddr_storage storage;
} sockaddr_t;
-#endif // SOCKADDR_H
+#endif
+#ifndef MESHLINK_SPLAY_TREE_H
+#define MESHLINK_SPLAY_TREE_H
+
/*
splay_tree.h -- header file for splay_tree.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
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 */
+#ifndef MESHLINK_SPTPS_H
+#define MESHLINK_SPTPS_H
+
/*
sptps.h -- Simple Peer-to-Peer Security
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
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"
+#ifndef MESHLINK_SYSTEM_H
+#define MESHLINK_SYSTEM_H
+
/*
system.h -- system headers
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_SYSTEM_H__
-#define __MESHLINK_SYSTEM_H__
-
#include "../config.h"
#include "have.h"
typedef int socklen_t;
#endif
-#endif /* __MESHLINK_SYSTEM_H__ */
+#endif
+#ifndef MESHLINK_UTILS_H
+#define MESHLINK_UTILS_H
+
/*
utils.h -- header file for utils.c
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_UTILS_H__
-#define __MESHLINK_UTILS_H__
-
extern int hex2bin(const char *src, void *dst, int length);
extern int bin2hex(const void *src, char *dst, int length);
extern unsigned int bitfield_to_int(const void *bitfield, size_t size);
-#endif /* __MESHLINK_UTILS_H__ */
+#endif
+#ifndef MESHLINK_XALLOC_H
+#define MESHLINK_XALLOC_H
+
/*
xalloc.h -- malloc and related fuctions with out of memory checking
- Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
+ Copyright (C) 2014, 2017 Guus Sliepen <guus@meshlink.io>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MESHLINK_XALLOC_H__
-#define __MESHLINK_XALLOC_H__
-
static inline void *xmalloc(size_t n) __attribute__((__malloc__));
static inline void *xmalloc(size_t n) {
void *p = malloc(n);