1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*
6  * lib/krb5/rcache/rc_file.h
7  *
8  * This file of the Kerberos V5 software is derived from public-domain code
9  * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
10  */
11 
12 /*
13  * Declarations for the file replay cache implementation.
14  */
15 
16 #ifndef _KRB5_RC_FILE_H
17 #define	_KRB5_RC_FILE_H
18 
19 #pragma ident	"%Z%%M%	%I%	%E% SMI"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include "rc_common.h"
26 #include "rc_io.h"
27 #include "rc-int.h"
28 
29 #ifndef EXCESSREPS
30 #define	EXCESSREPS 30
31 #endif
32 /*
33  * The rcache will be automatically expunged when the number of expired
34  * krb5_donot_replays encountered incidentally in searching exceeds the number
35  * of live krb5_donot_replays by EXCESSREPS. With the defaults here, a typical
36  * cache might build up some 10K of expired krb5_donot_replays before an
37  * automatic expunge, with the waste basically independent of the number of
38  * stores per minute.
39 
40  * The rcache will also automatically be expunged when it encounters more
41  * than EXCESSREPS expired entries when recovering a cache in
42  * file_recover.
43  */
44 
45 struct file_data {
46 	char *name;
47 	krb5_deltat lifespan;
48 	int hsize;
49 	int numhits;
50 	int nummisses;
51 	struct authlist **h;
52 	struct authlist *a;
53 	krb5_rc_iostuff d;
54 	char recovering;
55 };
56 
57 extern krb5_rc_ops krb5_rc_file_ops;
58 
59 krb5_error_code KRB5_CALLCONV krb5_rc_file_init
60     	(krb5_context,
61 		   krb5_rcache,
62 		   krb5_deltat);
63 krb5_error_code KRB5_CALLCONV krb5_rc_file_recover
64 	(krb5_context,
65 		   krb5_rcache);
66 krb5_error_code KRB5_CALLCONV krb5_rc_file_recover_or_init
67     	(krb5_context,
68 		   krb5_rcache,
69 		   krb5_deltat);
70 krb5_error_code KRB5_CALLCONV krb5_rc_file_destroy
71 	(krb5_context,
72 		   krb5_rcache);
73 krb5_error_code KRB5_CALLCONV krb5_rc_file_close
74 	(krb5_context,
75 		   krb5_rcache);
76 krb5_error_code KRB5_CALLCONV krb5_rc_file_store
77 	(krb5_context,
78 		   krb5_rcache,
79 		   krb5_donot_replay *);
80 krb5_error_code KRB5_CALLCONV krb5_rc_file_expunge
81 	(krb5_context,
82 		   krb5_rcache);
83 krb5_error_code KRB5_CALLCONV krb5_rc_file_get_span
84 	(krb5_context,
85 		   krb5_rcache,
86 		   krb5_deltat *);
87 char * KRB5_CALLCONV krb5_rc_file_get_name
88 	(krb5_context,
89 		   krb5_rcache);
90 krb5_error_code KRB5_CALLCONV krb5_rc_file_resolve
91 	(krb5_context,
92 		   krb5_rcache,
93 		   char *);
94 krb5_error_code krb5_rc_file_close_no_free
95 	(krb5_context,
96 		   krb5_rcache);
97 void krb5_rc_free_entry
98 	(krb5_context,
99 		   krb5_donot_replay **);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* !_KRB5_RC_FILE_H */
106