00001 #ifndef _FLOW_CACHE_H
00002 #define _FLOW_CACHE_H
00003
00004 #include "flow.h"
00005 #include "sfxhash.h"
00006
00007 #ifndef UINT64
00008 #define UINT64 unsigned long long
00009 #endif
00010
00011 typedef struct _FCSTAT
00012 {
00013 UINT64 find_ops;
00014 UINT64 reversed_ops;
00015 UINT64 find_success;
00016 UINT64 find_fail;
00017 UINT64 new_flows;
00018 UINT64 released_flows;
00019 } FCSTAT;
00020
00021 typedef struct _FLOWCACHE
00022 {
00023 SFXHASH *ipv4_table;
00024
00025 FCSTAT total;
00026 FCSTAT per_proto[256];
00027 unsigned int max_flowbits_bytes;
00028 } FLOWCACHE;
00029
00030
00031 int flowcache_init(FLOWCACHE *flowcachep, unsigned int rows, int memcap,
00032 int datasize, FLOWHASHID hashid);
00033 int flowcache_destroy(FLOWCACHE *flowcachep);
00034 int flowcache_releaseflow(FLOWCACHE *flowcachep, FLOW **flowpp);
00035 int flowcache_newflow(FLOWCACHE *flowcachep, FLOWKEY *keyp, FLOW **flowpp);
00036 int flowcache_find(FLOWCACHE *flowcachep, FLOWKEY *keyp,
00037 FLOW **flowpp, int *direction);
00038
00039 void flowcache_stats(FILE *stream, FLOWCACHE *flowcachep);
00040
00041 int flowcache_overhead_bytes(FLOWCACHE *fcp);
00042
00043 int flowcache_memcap(FLOWCACHE *fcp);
00044 int flowcache_row_count(FLOWCACHE *fcp);
00045
00046
00047 const char *flowcache_pname(FLOW_POSITION position);
00048
00049 #endif