File: nws_cache.h

package info (click to toggle)
nws 2.11-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,700 kB
  • ctags: 2,820
  • sloc: ansic: 28,849; sh: 3,289; java: 1,205; makefile: 697; perl: 12
file content (67 lines) | stat: -rwxr-xr-x 1,204 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#if !defined(NWS_CACHE_H)
#define NWS_CACHE_H

#include "fbuff.h"

#define RC_HASH_SIZE (100)
#define RC_ENTRIES_DEFAULT (256)
#define RC_ENTRIES (RC_entries)
#define RC_FNAME_SIZE (1024)

extern int RC_entries;

struct record_cache
{
	char fname[RC_FNAME_SIZE];
	fbuff r_timestamp;
	fbuff r_seqno;
	fbuff r_timeout;
	fbuff v_timestamp;
	fbuff v_value;
	struct record_cache *hnext;
	struct record_cache *hprev;
	struct record_cache *fnext;
	struct record_cache *fprev;
};

typedef struct record_cache *RCache;

/*
 * finds one and fails if it doesn't exist
 */
RCache FindRCacheEntry(const char *fname);

/*
 * finds an existing one and none exists, makes a new one
 */
RCache GetRCacheEntry(const char *fname);

int
ReadStateCache(RCache r,
	       char *state,
	       int count,
	       int max_size,
	       double earliest_seq_no,
	       double *out_time_out,
	       double *out_seq_no,
	       int *out_count,
	       int *out_recordsize);

int
WriteStateCache(RCache r, 
		double time_out, 
		double seq_no, 
		const char *state, 
		int stateSize);

int
AppendStateCache(RCache r, 
		double time_out, 
		double seq_no, 
		const char *state, 
		int stateSize);

extern int RCMemorySize;

#endif