summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 16:57:11 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-02 16:57:11 +0100
commitcd47acaf3cc874f8d26acca56fa6cef6110d946d (patch)
tree868fc139d8110bc04906eff36f6a9e7aed1ced8d /src
parenta77ec603a763ae484c70a83a9c5c0b835622cd0b (diff)
downloadfastd-cd47acaf3cc874f8d26acca56fa6cef6110d946d.tar
fastd-cd47acaf3cc874f8d26acca56fa6cef6110d946d.zip
Move a few prototypes from fastd.h into a new config.h
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/config.c1
-rw-r--r--src/config.h55
-rw-r--r--src/config.y5
-rw-r--r--src/crypto/cipher/aes128_ctr/nacl/CMakeLists.txt2
-rw-r--r--src/crypto/cipher/ciphers.c.in3
-rw-r--r--src/crypto/mac/ghash/builtin/CMakeLists.txt2
-rw-r--r--src/crypto/mac/macs.c.in3
-rw-r--r--src/fastd.c1
-rw-r--r--src/fastd.h22
-rw-r--r--src/methods/generic_gcm/CMakeLists.txt2
-rw-r--r--src/methods/methods.c.in2
-rw-r--r--src/methods/null/CMakeLists.txt2
-rw-r--r--src/methods/xsalsa20_poly1305/CMakeLists.txt2
-rw-r--r--src/options.c1
-rw-r--r--src/protocols/ec25519_fhmqvc/CMakeLists.txt2
16 files changed, 73 insertions, 34 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c6545e8..dc5b8a1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,7 @@
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE)
set(FASTD_CFLAGS "-Wall -pthread ${UECC_CFLAGS_OTHER} ${NACL_CFLAGS_OTHER}")
-include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CAP_INCLUDE_DIR} ${NACL_INCLUDE_DIRS})
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src ${CAP_INCLUDE_DIR} ${NACL_INCLUDE_DIRS})
link_directories(${UECC_LIBRARY_DIRS} ${NACL_LIBRARY_DIRS})
diff --git a/src/config.c b/src/config.c
index f9d2ae1..f46bb68 100644
--- a/src/config.c
+++ b/src/config.c
@@ -25,6 +25,7 @@
#include "fastd.h"
+#include "config.h"
#include "lex.h"
#include "peer.h"
#include <config.yy.h>
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 0000000..a4777c7
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net>
+ 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.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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 _FASTD_CONFIG_H_
+#define _FASTD_CONFIG_H_
+
+#include "fastd.h"
+
+
+bool fastd_config_protocol(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
+bool fastd_config_method(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
+bool fastd_config_add_log_file(fastd_context_t *ctx, fastd_config_t *conf, const char *name, fastd_loglevel_t level);
+bool fastd_config_bind_address(fastd_context_t *ctx, fastd_config_t *conf, const fastd_peer_address_t *address, const char *bindtodev, bool default_v4, bool default_v6);
+void fastd_config_peer_group_push(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
+void fastd_config_peer_group_pop(fastd_context_t *ctx, fastd_config_t *conf);
+void fastd_config_release(fastd_context_t *ctx, fastd_config_t *conf);
+void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]);
+void fastd_config_load_peer_dirs(fastd_context_t *ctx, fastd_config_t *conf);
+void fastd_config_handle_options(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]);
+
+void fastd_add_peer_dir(fastd_context_t *ctx, fastd_config_t *conf, const char *dir);
+bool fastd_read_config(fastd_context_t *ctx, fastd_config_t *conf, const char *filename, bool peer_config, int depth);
+
+const fastd_cipher_t** fastd_cipher_config_alloc(void);
+void fastd_cipher_config_free(const fastd_cipher_t **cipher_conf);
+bool fastd_cipher_config(const fastd_cipher_t **cipher_conf, const char *name, const char *impl);
+
+const fastd_mac_t** fastd_mac_config_alloc(void);
+void fastd_mac_config_free(const fastd_mac_t **mac_conf);
+bool fastd_mac_config(const fastd_mac_t **mac_conf, const char *name, const char *impl);
+
+#endif /* _FASTD_CONFIG_H_ */
diff --git a/src/config.y b/src/config.y
index 4efbde5..a79e8e9 100644
--- a/src/config.y
+++ b/src/config.y
@@ -34,7 +34,7 @@
%parse-param {int depth}
%code requires {
- #include <fastd.h>
+ #include <src/fastd.h>
#include <arpa/inet.h>
}
@@ -125,7 +125,8 @@
%code {
- #include <peer.h>
+ #include <src/peer.h>
+ #include <src/config.h>
#include <limits.h>
diff --git a/src/crypto/cipher/aes128_ctr/nacl/CMakeLists.txt b/src/crypto/cipher/aes128_ctr/nacl/CMakeLists.txt
index ecbca70..60479ab 100644
--- a/src/crypto/cipher/aes128_ctr/nacl/CMakeLists.txt
+++ b/src/crypto/cipher/aes128_ctr/nacl/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src ${NACL_INCLUDE_DIRS})
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src ${NACL_INCLUDE_DIRS})
add_library(cipher_aes128_ctr_nacl OBJECT
cipher_aes128_ctr_nacl.c
diff --git a/src/crypto/cipher/ciphers.c.in b/src/crypto/cipher/ciphers.c.in
index 37de211..5bedc75 100644
--- a/src/crypto/cipher/ciphers.c.in
+++ b/src/crypto/cipher/ciphers.c.in
@@ -24,7 +24,8 @@
*/
-#include <fastd.h>
+#include <src/fastd.h>
+#include <src/config.h>
@CIPHER_DEFINITIONS@
diff --git a/src/crypto/mac/ghash/builtin/CMakeLists.txt b/src/crypto/mac/ghash/builtin/CMakeLists.txt
index 907c3dd..4e8208b 100644
--- a/src/crypto/mac/ghash/builtin/CMakeLists.txt
+++ b/src/crypto/mac/ghash/builtin/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src)
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src)
add_library(mac_ghash_builtin OBJECT
ghash_builtin.c
diff --git a/src/crypto/mac/macs.c.in b/src/crypto/mac/macs.c.in
index 5a4e1fb..7d8a5ff 100644
--- a/src/crypto/mac/macs.c.in
+++ b/src/crypto/mac/macs.c.in
@@ -24,7 +24,8 @@
*/
-#include <fastd.h>
+#include <src/fastd.h>
+#include <src/config.h>
@MAC_DEFINITIONS@
diff --git a/src/fastd.c b/src/fastd.c
index 175dc00..6c2b9e5 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -25,6 +25,7 @@
#include "fastd.h"
+#include "config.h"
#include "handshake.h"
#include "peer.h"
#include <fastd_version.h>
diff --git a/src/fastd.h b/src/fastd.h
index 573da1b..0f62445 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -361,40 +361,18 @@ void fastd_resolve_peer(fastd_context_t *ctx, fastd_peer_t *peer, fastd_remote_t
int fastd_vsnprintf(const fastd_context_t *ctx, char *buffer, size_t size, const char *format, va_list ap);
void fastd_logf(const fastd_context_t *ctx, fastd_loglevel_t level, const char *format, ...);
-void fastd_add_peer_dir(fastd_context_t *ctx, fastd_config_t *conf, const char *dir);
-bool fastd_read_config(fastd_context_t *ctx, fastd_config_t *conf, const char *filename, bool peer_config, int depth);
-
const fastd_method_t* fastd_method_get_by_name(const char *name);
-const fastd_cipher_t** fastd_cipher_config_alloc(void);
-void fastd_cipher_config_free(const fastd_cipher_t **cipher_conf);
-bool fastd_cipher_config(const fastd_cipher_t **cipher_conf, const char *name, const char *impl);
-
void fastd_cipher_init(fastd_context_t *ctx);
void fastd_cipher_free(fastd_context_t *ctx);
bool fastd_cipher_available(const char *name);
const fastd_cipher_t* fastd_cipher_get_by_name(fastd_context_t *ctx, const char *name, fastd_cipher_context_t **cctx);
-const fastd_mac_t** fastd_mac_config_alloc(void);
-void fastd_mac_config_free(const fastd_mac_t **mac_conf);
-bool fastd_mac_config(const fastd_mac_t **mac_conf, const char *name, const char *impl);
-
void fastd_mac_init(fastd_context_t *ctx);
void fastd_mac_free(fastd_context_t *ctx);
bool fastd_mac_available(const char *name);
const fastd_mac_t* fastd_mac_get_by_name(fastd_context_t *ctx, const char *name, fastd_mac_context_t **cctx);
-bool fastd_config_protocol(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
-bool fastd_config_method(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
-bool fastd_config_add_log_file(fastd_context_t *ctx, fastd_config_t *conf, const char *name, fastd_loglevel_t level);
-bool fastd_config_bind_address(fastd_context_t *ctx, fastd_config_t *conf, const fastd_peer_address_t *address, const char *bindtodev, bool default_v4, bool default_v6);
-void fastd_config_peer_group_push(fastd_context_t *ctx, fastd_config_t *conf, const char *name);
-void fastd_config_peer_group_pop(fastd_context_t *ctx, fastd_config_t *conf);
-void fastd_config_release(fastd_context_t *ctx, fastd_config_t *conf);
-void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]);
-void fastd_config_load_peer_dirs(fastd_context_t *ctx, fastd_config_t *conf);
-void fastd_config_handle_options(fastd_context_t *ctx, fastd_config_t *conf, int argc, char *const argv[]);
-
void fastd_tuntap_open(fastd_context_t *ctx);
fastd_buffer_t fastd_tuntap_read(fastd_context_t *ctx);
void fastd_tuntap_write(fastd_context_t *ctx, fastd_buffer_t buffer);
diff --git a/src/methods/generic_gcm/CMakeLists.txt b/src/methods/generic_gcm/CMakeLists.txt
index 732e7ed..8c22292 100644
--- a/src/methods/generic_gcm/CMakeLists.txt
+++ b/src/methods/generic_gcm/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src)
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src)
add_library(method_generic_gcm OBJECT
generic_gcm.c
diff --git a/src/methods/methods.c.in b/src/methods/methods.c.in
index 8a8958c..2a8d9fb 100644
--- a/src/methods/methods.c.in
+++ b/src/methods/methods.c.in
@@ -24,7 +24,7 @@
*/
-#include <fastd.h>
+#include <src/fastd.h>
@METHOD_DEFINITIONS@
diff --git a/src/methods/null/CMakeLists.txt b/src/methods/null/CMakeLists.txt
index 0e68fec..d65a342 100644
--- a/src/methods/null/CMakeLists.txt
+++ b/src/methods/null/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src)
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src)
add_library(method_null OBJECT
null.c
diff --git a/src/methods/xsalsa20_poly1305/CMakeLists.txt b/src/methods/xsalsa20_poly1305/CMakeLists.txt
index 3c9e2cf..66dcb7e 100644
--- a/src/methods/xsalsa20_poly1305/CMakeLists.txt
+++ b/src/methods/xsalsa20_poly1305/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src ${NACL_INCLUDE_DIRS})
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src ${NACL_INCLUDE_DIRS})
add_library(method_xsalsa20_poly1305 OBJECT
xsalsa20_poly1305.c
diff --git a/src/options.c b/src/options.c
index cf53991..f7dd88f 100644
--- a/src/options.c
+++ b/src/options.c
@@ -25,6 +25,7 @@
#include "fastd.h"
+#include "config.h"
#include "peer.h"
#include <fastd_version.h>
diff --git a/src/protocols/ec25519_fhmqvc/CMakeLists.txt b/src/protocols/ec25519_fhmqvc/CMakeLists.txt
index f39fba8..d637a25 100644
--- a/src/protocols/ec25519_fhmqvc/CMakeLists.txt
+++ b/src/protocols/ec25519_fhmqvc/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(${FASTD_SOURCE_DIR}/src ${FASTD_BINARY_DIR}/src ${UECC_INCLUDE_DIRS})
+include_directories(${FASTD_SOURCE_DIR} ${FASTD_BINARY_DIR}/src ${UECC_INCLUDE_DIRS})
add_library(protocol_ec25519_fhmqvc OBJECT
ec25519_fhmqvc.c