Annotation of src/usr.bin/systat/cache.h, Revision 1.4
1.4 ! dlg 1: /* $Id: cache.h,v 1.3 2011/11/29 10:17:52 dlg Exp $ */
1.1 canacar 2: /*
3: * Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17:
18: #ifndef _CACHE_H_
19: #define _CACHE_H_
20:
21: #include <sys/queue.h>
22: #include <sys/tree.h>
1.2 canacar 23: #include <net/pfvar.h>
1.1 canacar 24:
25: struct sc_ent {
1.4 ! dlg 26: RB_ENTRY(sc_ent) tlink;
1.1 canacar 27: TAILQ_ENTRY(sc_ent) qlink;
1.3 dlg 28: u_int64_t id;
29: u_int32_t creatorid;
1.1 canacar 30: double peak;
31: double rate;
32: time_t t;
33: u_int32_t bytes;
34: };
35:
36: int cache_init(int);
37: void cache_endupdate(void);
1.2 canacar 38: struct sc_ent *cache_state(struct pfsync_state *);
1.1 canacar 39: extern int cache_max, cache_size;
1.2 canacar 40:
41: #define COUNTER(c) ((((u_int64_t) ntohl(c[0]))<<32) + ntohl(c[1]))
1.1 canacar 42:
43: #endif