From 5e1cbfff30ae20901e23cbbac1ae155c1910e0a6 Mon Sep 17 00:00:00 2001 From: Gerard Wagener Date: Tue, 27 Nov 2018 15:00:43 +0100 Subject: [PATCH] Datastructure for holding configuration values --- client/d4.c | 5 +++++ client/d4.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/d4.c b/client/d4.c index 59ef6ce..a467b73 100644 --- a/client/d4.c +++ b/client/d4.c @@ -27,10 +27,15 @@ void usage(void) d4_t* d4_init(char* confdir) { d4_t* out; + int i; out = calloc(1,sizeof(d4_t)); if (out) { strncpy(out->confdir, confdir, FILENAME_MAX); } + + for (i=0; i< ND4PARAMS; i++) { + bzero(out->conf[i],SZCONFVALUE); + } // Do other inititalization stuff here return out; } diff --git a/client/d4.h b/client/d4.h index f223e44..358922a 100644 --- a/client/d4.h +++ b/client/d4.h @@ -1,6 +1,9 @@ #ifndef D4_H #define D4_H +#define ND4PARAMS 5 +#define SZCONFVALUE 1024 + typedef struct d4_header_s { uint8_t version; uint8_t type; @@ -29,6 +32,7 @@ typedef struct d4_s { int caplen; int d4_error; int errno_copy; + char conf[ND4PARAMS][SZCONFVALUE]; } d4_t; @@ -41,7 +45,6 @@ typedef struct d4_s { */ const char* d4params[] = {"uuid", "snaplen", "caplen", "timestamp", "collector"}; -#define ND4PARAMS 5 #define UUID 0 #define SNAPLEN 1