summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h8
-rw-r--r--nDPId.c4
-rw-r--r--nDPIsrvd.c8
3 files changed, 16 insertions, 4 deletions
diff --git a/config.h b/config.h
new file mode 100644
index 000000000..2d50aa1c6
--- /dev/null
+++ b/config.h
@@ -0,0 +1,8 @@
+#ifndef CONFIG_H
+#define CONFIG_H 1
+
+#define COLLECTOR_UNIX_SOCKET "/tmp/ndpid-collector.sock"
+#define DISTRIBUTOR_HOST "127.0.0.1"
+#define DISTRIBUTOR_PORT 7000
+
+#endif
diff --git a/nDPId.c b/nDPId.c
index be69b55e8..9c69c793b 100644
--- a/nDPId.c
+++ b/nDPId.c
@@ -16,6 +16,8 @@
#include <syslog.h>
#include <unistd.h>
+#include "config.h"
+
#if (NDPI_MAJOR == 3 && NDPI_MINOR < 3) || NDPI_MAJOR < 3
#error "nDPI >= 3.3.0 requiired"
#endif
@@ -206,7 +208,7 @@ static uint32_t global_flow_id = 0;
static char * pcap_file_or_interface = NULL;
static int log_to_stderr = 0;
-static char json_sockpath[UNIX_PATH_MAX] = "/tmp/ndpid-collector.sock";
+static char json_sockpath[UNIX_PATH_MAX] = COLLECTOR_UNIX_SOCKET;
static void free_workflow(struct nDPId_workflow ** const workflow);
static void serialize_and_send(struct nDPId_reader_thread * const reader_thread);
diff --git a/nDPIsrvd.c b/nDPIsrvd.c
index fcd15a2f9..06fe08574 100644
--- a/nDPIsrvd.c
+++ b/nDPIsrvd.c
@@ -13,6 +13,8 @@
#include <sys/types.h>
#include <unistd.h>
+#include "config.h"
+
enum ev_type { JSON_SOCK, SERV_SOCK };
struct remote_desc {
@@ -36,9 +38,9 @@ static struct remotes {
size_t desc_used;
} remotes = {NULL, 0, 0};
-static char json_sockpath[UNIX_PATH_MAX] = "/tmp/ndpid-collector.sock";
-static char serv_listen_addr[INET6_ADDRSTRLEN] = "127.0.0.1";
-static uint16_t serv_listen_port = 7000;
+static char json_sockpath[UNIX_PATH_MAX] = COLLECTOR_UNIX_SOCKET;
+static char serv_listen_addr[INET6_ADDRSTRLEN] = DISTRIBUTOR_HOST;
+static uint16_t serv_listen_port = DISTRIBUTOR_PORT;
static int json_sockfd;
static int serv_sockfd;