mirror of https://github.com/D4-project/d4-core
Datastructure for holding configuration values
parent
baf500470e
commit
5e1cbfff30
|
@ -27,10 +27,15 @@ void usage(void)
|
||||||
d4_t* d4_init(char* confdir)
|
d4_t* d4_init(char* confdir)
|
||||||
{
|
{
|
||||||
d4_t* out;
|
d4_t* out;
|
||||||
|
int i;
|
||||||
out = calloc(1,sizeof(d4_t));
|
out = calloc(1,sizeof(d4_t));
|
||||||
if (out) {
|
if (out) {
|
||||||
strncpy(out->confdir, confdir, FILENAME_MAX);
|
strncpy(out->confdir, confdir, FILENAME_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i=0; i< ND4PARAMS; i++) {
|
||||||
|
bzero(out->conf[i],SZCONFVALUE);
|
||||||
|
}
|
||||||
// Do other inititalization stuff here
|
// Do other inititalization stuff here
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef D4_H
|
#ifndef D4_H
|
||||||
#define D4_H
|
#define D4_H
|
||||||
|
|
||||||
|
#define ND4PARAMS 5
|
||||||
|
#define SZCONFVALUE 1024
|
||||||
|
|
||||||
typedef struct d4_header_s {
|
typedef struct d4_header_s {
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
@ -29,6 +32,7 @@ typedef struct d4_s {
|
||||||
int caplen;
|
int caplen;
|
||||||
int d4_error;
|
int d4_error;
|
||||||
int errno_copy;
|
int errno_copy;
|
||||||
|
char conf[ND4PARAMS][SZCONFVALUE];
|
||||||
} d4_t;
|
} d4_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +45,6 @@ typedef struct d4_s {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char* d4params[] = {"uuid", "snaplen", "caplen", "timestamp", "collector"};
|
const char* d4params[] = {"uuid", "snaplen", "caplen", "timestamp", "collector"};
|
||||||
#define ND4PARAMS 5
|
|
||||||
|
|
||||||
#define UUID 0
|
#define UUID 0
|
||||||
#define SNAPLEN 1
|
#define SNAPLEN 1
|
||||||
|
|
Loading…
Reference in New Issue