3f869f1759c20c790338656dc7242faf8ca3997a
2 * copyright (c) 2001-2011 Emil Mikulic.
4 * hosts_db.h: database of hosts, ports, protocols.
6 * You may use, modify and redistribute this file under the terms of the
7 * GNU General Public License version 2. (see COPYING.GPL)
9 #ifndef __DARKSTAT_HOSTS_DB_H
10 #define __DARKSTAT_HOSTS_DB_H
12 #include <sys/types.h> /* for uint64_t */
23 struct hashtable
*ports_tcp
, *ports_udp
, *ip_protos
;
41 uint64_t in
, out
, total
;
44 struct port_tcp port_tcp
;
45 struct port_udp port_udp
;
46 struct ip_proto ip_proto
;
50 enum sort_dir
{ IN
, OUT
, TOTAL
, LASTSEEN
};
52 extern int hosts_db_show_macs
;
54 void hosts_db_init(void);
55 void hosts_db_reduce(void);
56 void hosts_db_reset(void);
57 void hosts_db_free(void);
58 int hosts_db_import(const int fd
);
59 int hosts_db_export(const int fd
);
61 struct bucket
*host_find(const struct addr
*const a
); /* can return NULL */
62 struct bucket
*host_get(const struct addr
*const a
);
63 struct bucket
*host_get_port_tcp(struct bucket
*host
, const uint16_t port
);
64 struct bucket
*host_get_port_udp(struct bucket
*host
, const uint16_t port
);
65 struct bucket
*host_get_ip_proto(struct bucket
*host
, const uint8_t proto
);
68 struct str
*html_hosts(const char *uri
, const char *query
);
71 void qsort_buckets(const struct bucket
**a
, size_t n
,
72 size_t left
, size_t right
, const enum sort_dir d
);
74 #endif /* __DARKSTAT_HOSTS_DB_H */
75 /* vim:set ts=3 sw=3 tw=78 expandtab: */