249514e244af2f6c68ccd2024b43630866311b11
[krb5.git] / src / include / krb5 / rcache.h
1 /*
2  * include/krb5/rcache.h
3  *
4  * Copyright 1990,1991 by the Massachusetts Institute of Technology.
5  * All Rights Reserved.
6  *
7  * Export of this software from the United States of America may
8  *   require a specific license from the United States Government.
9  *   It is the responsibility of any person or organization contemplating
10  *   export to obtain such a license before exporting.
11  * 
12  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13  * distribute this software and its documentation for any purpose and
14  * without fee is hereby granted, provided that the above copyright
15  * notice appear in all copies and that both that copyright notice and
16  * this permission notice appear in supporting documentation, and that
17  * the name of M.I.T. not be used in advertising or publicity pertaining
18  * to distribution of the software without specific, written prior
19  * permission.  M.I.T. makes no representations about the suitability of
20  * this software for any purpose.  It is provided "as is" without express
21  * or implied warranty.
22  * 
23  *
24  * Replay detection cache definitions.
25  */
26
27
28 #ifndef KRB5_RCACHE__
29 #define KRB5_RCACHE__
30
31 typedef struct krb5_rc_st {
32     krb5_magic magic;
33     struct _krb5_rc_ops *ops;
34     krb5_pointer data;
35 } *krb5_rcache;
36
37 typedef struct _krb5_donot_replay {
38     krb5_magic magic;
39     char *server;                       /* null-terminated */
40     char *client;                       /* null-terminated */
41     krb5_int32 cusec;
42     krb5_timestamp ctime;
43 } krb5_donot_replay;
44
45 typedef struct _krb5_rc_ops {
46     krb5_magic magic;
47     char *type;
48     krb5_error_code (INTERFACE *init)NPROTOTYPE((krb5_context, krb5_rcache,krb5_deltat)); /* create */
49     krb5_error_code (INTERFACE *recover)NPROTOTYPE((krb5_context, krb5_rcache)); /* open */
50     krb5_error_code (INTERFACE *destroy)NPROTOTYPE((krb5_context, krb5_rcache));
51     krb5_error_code (INTERFACE *close)NPROTOTYPE((krb5_context, krb5_rcache));
52     krb5_error_code (INTERFACE *store)NPROTOTYPE((krb5_context, krb5_rcache,krb5_donot_replay *));
53     krb5_error_code (INTERFACE *expunge)NPROTOTYPE((krb5_context, krb5_rcache));
54     krb5_error_code (INTERFACE *get_span)NPROTOTYPE((krb5_context, krb5_rcache,krb5_deltat *));
55     char *(INTERFACE *get_name)NPROTOTYPE((krb5_context, krb5_rcache));
56     krb5_error_code (INTERFACE *resolve)NPROTOTYPE((krb5_context, krb5_rcache, char *));
57 } krb5_rc_ops;
58
59 krb5_error_code INTERFACE krb5_rc_default 
60         PROTOTYPE((krb5_context,
61                    krb5_rcache *));
62 krb5_error_code INTERFACE krb5_rc_register_type 
63         PROTOTYPE((krb5_context,
64                    krb5_rc_ops *));
65 krb5_error_code INTERFACE krb5_rc_resolve_type 
66         PROTOTYPE((krb5_context,
67                    krb5_rcache *,char *));
68 krb5_error_code INTERFACE krb5_rc_resolve_full 
69         PROTOTYPE((krb5_context,
70                    krb5_rcache *,char *));
71 char * INTERFACE krb5_rc_get_type 
72         PROTOTYPE((krb5_context,
73                    krb5_rcache));
74 char * INTERFACE krb5_rc_default_type 
75         PROTOTYPE((krb5_context));
76 char * INTERFACE krb5_rc_default_name 
77         PROTOTYPE((krb5_context));
78 krb5_error_code INTERFACE krb5_auth_to_rep 
79         PROTOTYPE((krb5_context,
80                    krb5_tkt_authent *,
81                    krb5_donot_replay *));
82
83 #define krb5_rc_initialize(context, id, span) (*(id)->ops->init)(context, id, span)
84 #define krb5_rc_recover(context, id) (*(id)->ops->recover)(context, id)
85 #define krb5_rc_destroy(context, id) (*(id)->ops->destroy)(context, id)
86 #define krb5_rc_close(context, id) (*(id)->ops->close)(context, id)
87 #define krb5_rc_store(context, id, dontreplay) (*(id)->ops->store)(context, id, dontreplay)
88 #define krb5_rc_expunge(context, id) (*(id)->ops->expunge)(context, id)
89 #define krb5_rc_get_lifespan(context, id, spanp) (*(id)->ops->get_span)(context, id, spanp)
90 #define krb5_rc_get_name(context, id) (*(id)->ops->get_name)(context, id)
91 #define krb5_rc_resolve(context, id, name) (*(id)->ops->resolve)(context, id, name)
92
93 extern krb5_rc_ops krb5_rc_dfl_ops;
94
95 #endif /* KRB5_RCACHE__ */