further progress

This commit is contained in:
Zakir Durumeric 2013-08-19 18:10:55 -04:00
parent 582d381b30
commit b4f8698cb0
2 changed files with 34 additions and 2 deletions

View File

@ -7,10 +7,24 @@
#include "../lib/logger.h"
int fs_split_string(int *len, char**results)
int fs_split_string(char* in, int *len, char**results)
{
char** fields = calloc(MAX_FIELDS, sizeof(char*));
memset(fields, 0, sizeof(fields));
int retvlen = 0;
char *currloc = in;
// parse csv into a set of strings
while (1) {
size_t len = strcspn(currloc, ", ");
char *new = malloc(len+1);
}
(void)len;
*results = fields;
*len = retvlen;
(void)results;
return 0;
}

View File

@ -67,6 +67,18 @@ char *make_ip_str(uint32_t ip)
return retv;
}
fielddef_t ip_fields[] = {
{.name="saddr", .type="string", .desc="source IP address of response"},
{.name="daddr", .type="string", .desc="destination IP address of response"},
{.name="ipid", .type="int", .desc="IP identification number of response"},
{.name="ttl", .type="int", .desc="time-to-live of response packet"}
}
fielddef_t sys_fields[] = {
{.name="repeat", .type="int", .desc="Is response a repeat response from host"},
{.name="timestamp-str", .type="string", .desc="timestamp of when response arrived in ISO8601 format."}
}
void fs_add_ip_fields(fieldset_t *fs, struct iphdr *ip)
{
fs_add_string(fs, "saddr", make_ip_str(ip->saddr), 1);
@ -75,3 +87,9 @@ void fs_add_ip_fields(fieldset_t *fs, struct iphdr *ip)
fs_add_uint64(fs, "ttl", ntohl(ip->ttl));
}
void fs_add_system_fields(fieldset_t *fs)
{
}