Datastructure for holding configuration values

pull/23/head
Gerard Wagener 2018-11-27 15:00:43 +01:00
parent baf500470e
commit 5e1cbfff30
2 changed files with 9 additions and 1 deletions

View File

@ -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;
}

View File

@ -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