1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * winccld.h -- the dynamic loaded version of the ccache DLL
4  */
5 
6 
7 #ifndef KRB5_WINCCLD_H_
8 #define KRB5_WINCCLD_H_
9 
10 #ifdef USE_CCAPI_V3
11 #include <CredentialsCache.h>
12 #else
13 
14 #ifndef CC_API_VER2
15 #define CC_API_VER2
16 #endif
17 
18 #include "cacheapi.h"
19 #endif
20 
21 #ifdef USE_CCAPI_V3
22 typedef CCACHE_API cc_int32 (*FP_cc_initialize) (
23     cc_context_t*           outContext,
24     cc_int32                inVersion,
25     cc_int32*               outSupportedVersion,
26     char const**            outVendor);
27 #else
28 typedef cc_int32 (*FP_cc_initialize)(apiCB**, const cc_int32,
29                                      cc_int32*, const char**);
30 typedef cc_int32 (*FP_cc_shutdown)(apiCB**);
31 typedef cc_int32 (*FP_cc_get_change_time)(apiCB*, cc_time_t*);
32 typedef cc_int32 (*FP_cc_create)(apiCB*, const char*, const char*,
33                                  const enum cc_cred_vers, const cc_int32, ccache_p**);
34 typedef cc_int32 (*FP_cc_open)(apiCB*, const char*, const enum cc_cred_vers,
35                                const cc_int32, ccache_p**);
36 typedef cc_int32 (*FP_cc_close)(apiCB*, ccache_p**);
37 typedef cc_int32 (*FP_cc_destroy)(apiCB*, ccache_p**);
38 typedef cc_int32 (*FP_cc_seq_fetch_NCs)(apiCB*, ccache_p**, ccache_cit**);
39 typedef cc_int32 (*FP_cc_seq_fetch_NCs_begin)(apiCB*, ccache_cit**);
40 typedef cc_int32 (*FP_cc_seq_fetch_NCs_next)(apiCB*, ccache_p**, ccache_cit*);
41 typedef cc_int32 (*FP_cc_seq_fetch_NCs_end)(apiCB*, ccache_cit**);
42 typedef cc_int32 (*FP_cc_get_NC_info)(apiCB*, struct _infoNC***);
43 typedef cc_int32 (*FP_cc_free_NC_info)(apiCB*, struct _infoNC***);
44 typedef cc_int32 (*FP_cc_get_name)(apiCB*, const ccache_p*, char**);
45 typedef cc_int32 (*FP_cc_set_principal)(apiCB*, const ccache_p*,
46                                         const enum cc_cred_vers, const char*);
47 typedef cc_int32 (*FP_cc_get_principal)(apiCB*, ccache_p*, char**);
48 typedef cc_int32 (*FP_cc_get_cred_version)(apiCB*, const ccache_p*,
49                                            enum cc_cred_vers*);
50 typedef cc_int32 (*FP_cc_lock_request)(apiCB*, const ccache_p*,
51                                        const cc_int32);
52 typedef cc_int32 (*FP_cc_store)(apiCB*, const ccache_p*, const cred_union);
53 typedef cc_int32 (*FP_cc_remove_cred)(apiCB*, const ccache_p*,
54                                       const cred_union);
55 typedef cc_int32 (*FP_cc_seq_fetch_creds)(apiCB*, const ccache_p*,
56                                           cred_union**, ccache_cit**);
57 typedef cc_int32 (*FP_cc_seq_fetch_creds_begin)(apiCB*, const ccache_p*,
58                                                 ccache_cit**);
59 typedef cc_int32 (*FP_cc_seq_fetch_creds_next)(apiCB*, cred_union**,
60                                                ccache_cit*);
61 typedef cc_int32 (*FP_cc_seq_fetch_creds_end)(apiCB*, ccache_cit**);
62 typedef cc_int32 (*FP_cc_free_principal)(apiCB*, char**);
63 typedef cc_int32 (*FP_cc_free_name)(apiCB*, char** name);
64 typedef cc_int32 (*FP_cc_free_creds)(apiCB*, cred_union** pCred);
65 #endif
66 
67 #ifdef KRB5_WINCCLD_C_
68 typedef struct _FUNC_INFO {
69     void** func_ptr_var;
70     char* func_name;
71 } FUNC_INFO;
72 
73 #define DECL_FUNC_PTR(x) FP_##x p##x
74 #define MAKE_FUNC_INFO(x) { (void**) &p##x, #x }
75 #define END_FUNC_INFO { 0, 0 }
76 #else
77 #define DECL_FUNC_PTR(x) extern FP_##x p##x
78 #endif
79 
80 DECL_FUNC_PTR(cc_initialize);
81 #ifndef USE_CCAPI_V3
82 DECL_FUNC_PTR(cc_shutdown);
83 DECL_FUNC_PTR(cc_get_change_time);
84 DECL_FUNC_PTR(cc_create);
85 DECL_FUNC_PTR(cc_open);
86 DECL_FUNC_PTR(cc_close);
87 DECL_FUNC_PTR(cc_destroy);
88 DECL_FUNC_PTR(cc_get_name);
89 DECL_FUNC_PTR(cc_set_principal);
90 DECL_FUNC_PTR(cc_get_principal);
91 DECL_FUNC_PTR(cc_get_cred_version);
92 DECL_FUNC_PTR(cc_store);
93 DECL_FUNC_PTR(cc_remove_cred);
94 #ifdef CC_API_VER2
95 DECL_FUNC_PTR(cc_seq_fetch_creds_begin);
96 DECL_FUNC_PTR(cc_seq_fetch_creds_next);
97 DECL_FUNC_PTR(cc_seq_fetch_creds_end);
98 #else
99 DECL_FUNC_PTR(cc_seq_fetch_creds);
100 #endif
101 DECL_FUNC_PTR(cc_free_principal);
102 DECL_FUNC_PTR(cc_free_name);
103 DECL_FUNC_PTR(cc_free_creds);
104 #endif
105 
106 #ifdef KRB5_WINCCLD_C_
107 FUNC_INFO krbcc_fi[] = {
108     MAKE_FUNC_INFO(cc_initialize),
109 #ifndef USE_CCAPI_V3
110     MAKE_FUNC_INFO(cc_shutdown),
111     MAKE_FUNC_INFO(cc_get_change_time),
112     MAKE_FUNC_INFO(cc_create),
113     MAKE_FUNC_INFO(cc_open),
114     MAKE_FUNC_INFO(cc_close),
115     MAKE_FUNC_INFO(cc_destroy),
116     MAKE_FUNC_INFO(cc_get_name),
117     MAKE_FUNC_INFO(cc_set_principal),
118     MAKE_FUNC_INFO(cc_get_principal),
119     MAKE_FUNC_INFO(cc_get_cred_version),
120     MAKE_FUNC_INFO(cc_store),
121     MAKE_FUNC_INFO(cc_remove_cred),
122 #ifdef CC_API_VER2
123     MAKE_FUNC_INFO(cc_seq_fetch_creds_begin),
124     MAKE_FUNC_INFO(cc_seq_fetch_creds_next),
125     MAKE_FUNC_INFO(cc_seq_fetch_creds_end),
126 #else
127     MAKE_FUNC_INFO(cc_seq_fetch_creds),
128 #endif
129     MAKE_FUNC_INFO(cc_free_principal),
130     MAKE_FUNC_INFO(cc_free_name),
131     MAKE_FUNC_INFO(cc_free_creds),
132 #endif
133     END_FUNC_INFO
134 };
135 #undef MAKE_FUNC_INFO
136 #undef END_FUNC_INFO
137 #else
138 
139 #define cc_initialize pcc_initialize
140 #ifndef USE_CCAPI_V3
141 #define cc_shutdown pcc_shutdown
142 #define cc_get_change_time pcc_get_change_time
143 #define cc_create pcc_create
144 #define cc_open pcc_open
145 #define cc_close pcc_close
146 #define cc_destroy pcc_destroy
147 #define cc_get_name pcc_get_name
148 #define cc_set_principal pcc_set_principal
149 #define cc_get_principal pcc_get_principal
150 #define cc_get_cred_version pcc_get_cred_version
151 #define cc_store pcc_store
152 #define cc_remove_cred pcc_remove_cred
153 #ifdef CC_API_VER2
154 #define cc_seq_fetch_creds_begin pcc_seq_fetch_creds_begin
155 #define cc_seq_fetch_creds_next pcc_seq_fetch_creds_next
156 #define cc_seq_fetch_creds_end pcc_seq_fetch_creds_end
157 #else
158 #define cc_seq_fetch_creds pcc_seq_fetch_creds
159 #endif
160 #define cc_free_principal pcc_free_principal
161 #define cc_free_name pcc_free_name
162 #define cc_free_creds pcc_free_creds
163 #endif
164 #endif
165 
166 #undef DECL_FUNC_PTR
167 
168 #endif /* KRB5_WINCCLD_H_ */
169