/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* netflow dump type
*
* Glenn Fowler
* AT&T Research
*/
#include "flowlib.h"
typedef struct State_s
{
} State_t;
/*
* identf
*/
static int
{
register char* s = buf;
register char* e = s + n;
register int d = 0;
while (s < e)
switch (*s++)
{
case '\n':
return d == 19;
case '|':
d++;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '.': case '-': case '+': case ':':
break;
default:
return 0;
}
return 0;
}
/*
* openf
*/
static int
{
if ((file->flags & DSS_FILE_READ) && !(file->data = (void*)vmnewof(file->dss->vm, 0, State_t, 1, 0)))
{
return -1;
}
return 0;
}
/*
* readf
*/
static int
{
char* a;
char* b;
char* s;
{
{
return -1;
}
return 0;
}
goto bad;
goto bad;
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '|')
goto bad;
if (*b++ != '|')
goto bad;
if (*a++ != '\n')
goto bad;
return 1;
bad:
{
if (a < b)
a = b;
(*disc->errorf)(NiL, disc, 2, "%s%-.*s<<<: invalid %s record field", cxlocation(file->dss->cx, record), a - s, s, file->format->name);
}
return -1;
}
/*
* writef
*/
static int
{
if (sfprintf(file->io, "%d.%d.%d.%d|%d.%d.%d.%d|%d.%d.%d.%d|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u|%u\n"
, rp->src_maskv4
, rp->dst_maskv4
, rp->flow_sequence
) < 0)
{
return -1;
}
return 0;
}
/*
* closef
*/
static int
{
return 0;
}
{
"flat",
"Cisco netflow flat format (2008-06-21) |-separated, \\n-terminated record of these fields: src_addr, dst_addr, hop, input, output, packets, bytes, first, last, src_port, dst_port, flags, tcp_flags, prot, tos, src_as, dst_as, src_mask, dst_mask, flow_sequence",
CXH,
0,
0,
0,
};