1 /*
2  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	_KRB5_RC_COM_H
7 #define	_KRB5_RC_COM_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*
14  * mech_krb5/krb5/rcache/rc_common.h
15  *
16  * This file of the Kerberos V5 software is derived from public-domain code
17  * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>.
18  */
19 
20 #include "rc_base.h"
21 #include "rc_io.h"
22 #include <k5-int.h>
23 
24 /*
25  * Declarations shared for the file and memory replay cache implementation.
26  */
27 
28 #ifndef HASHSIZE
29 #define	HASHSIZE 997 /* a convenient prime */
30 #endif
31 
32 #define	CMP_MALLOC -3
33 #define	CMP_EXPIRED -2
34 #define	CMP_REPLAY -1
35 #define	CMP_HOHUM 0
36 
37 /*
38  * Solaris: made cmp a macro and removed unused t arg to help perf
39  */
40 #define	cmp(old, new) \
41 	(((old)->cusec == (new)->cusec) && \
42 	((old)->ctime == (new)->ctime) && \
43 	(strcmp((old)->client, (new)->client) == 0) && \
44 	(strcmp((old)->server, (new)->server) == 0) ? CMP_REPLAY : CMP_HOHUM)
45 
46 /*
47  * Solaris: made alive a macro and time a arg instead of calling
48  * krb5_timeofday() for better perf.
49  */
50 #define	alive(context, new, t, time) \
51 	(((new)->ctime + (t)) < (time) ? CMP_EXPIRED : CMP_HOHUM)
52 
53 struct authlist {
54 	krb5_donot_replay rep;
55 	struct authlist *na;
56 	struct authlist *nh;
57 };
58 
59 int hash(krb5_donot_replay *rep, int hsize);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif /* !_KRB5_RC_COM_H */
66