Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / netidmgr_plugin / afscred.h
blobcaf036e8ea3077a466a1e4600d32bd8eaa90bcb4
1 /*
2 * Copyright (c) 2005-2008 Secure Endpoints Inc.
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
25 /* $Id$ */
27 #ifndef __KHIMAIRA_AFSCRED_H
28 #define __KHIMAIRA_AFSCRED_H
30 #ifndef _WIN64
31 #define _USE_32BIT_TIME_T 1
32 #endif
34 #include <afsconfig.h>
35 #include <afs/param.h>
37 #define _WINSOCKAPI_
38 #include<windows.h>
39 #include<time.h>
41 #define KHERR_FACILITY L"AfsCred"
42 #define KHERR_HMODULE hResModule
43 #include<netidmgr.h>
45 #include<langres.h>
47 #include <afs/stds.h>
48 #include <afs/cm_config.h>
49 #include <afs/auth.h>
50 #include <afs/ptserver.h>
51 #include <afs/ptuser.h>
53 #include<afspext.h>
55 #include<afsfuncs.h>
56 #include<afsnewcreds.h>
58 #ifndef NOSTRSAFE
59 #include<strsafe.h>
60 #endif
62 #define AFS_PLUGIN_NAME L"AfsCred"
63 #define AFS_CREDTYPE_NAME L"AfsCred"
65 #define AFS_PLUGIN_DEPS L"Krb5Cred\0"
67 #define KRB5_CREDTYPE_NAME L"Krb5Cred"
68 #define KRB4_CREDTYPE_NAME L"Krb4Cred"
70 #define AFS_TYPENAME_PRINCIPAL L"AFSPrincipal"
71 #define AFS_TYPENAME_METHOD L"AFSTokenMethod"
72 #define AFS_ATTRNAME_CLIENT_PRINC L"AFSClientPrinc"
73 #define AFS_ATTRNAME_SERVER_PRINC L"AFSServerPrinc"
74 #define AFS_ATTRNAME_CELL L"AFSCell"
75 #define AFS_ATTRNAME_METHOD L"AFSMethod"
76 #define AFS_ATTRNAME_REALM L"AFSRealm"
78 #define AFS_VALID_CELL_CHARS L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"
79 #define AFS_VALID_REALM_CHARS AFS_VALID_CELL_CHARS
81 #define AFS_CONFIG_NODE_IDS L"AfsIdentities"
82 #define AFS_CONFIG_NODE_ID L"AfsIdentity"
83 #define AFS_CONFIG_NODE_MAIN L"AfsOptions"
85 #define AFS_HELPFILE L"afsplhlp.chm"
87 /* token acquisition methods provided by extensions begin with this
88 ID */
89 #define AFS_TOKEN_USER 8
91 void init_afs();
92 void exit_afs();
93 KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module);
94 KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module);
96 /* globals */
97 extern kmm_module h_khModule;
98 extern HMODULE hResModule;
99 extern HINSTANCE hInstance;
101 extern khm_int32 afs_credtype_id;
102 extern khm_int32 krb5_credtype_id;
103 extern khm_int32 krb4_credtype_id;
104 extern khm_int32 afs_msg_type_id;
105 extern khm_handle afs_credset;
107 extern khm_int32 afs_type_principal;
108 extern khm_int32 afs_attr_client_princ;
109 extern khm_int32 afs_attr_server_princ;
110 extern khm_int32 afs_attr_cell;
111 extern khm_int32 afs_attr_method;
112 extern khm_int32 afs_attr_realm;
114 /* Configuration spaces */
115 #define CSNAME_PLUGINS L"Plugins"
116 #define CSNAME_AFSCRED L"AfsCred"
117 #define CSNAME_PARAMS L"Parameters"
119 extern khm_handle csp_plugins;
120 extern khm_handle csp_afscred;
121 extern khm_handle csp_params;
123 extern khm_handle afs_sub;
125 /* defined in afsconfig.c which is generated from afsconfig.csv */
126 extern kconf_schema schema_afsconfig[];
129 /* plugin callback procedure */
130 khm_int32 KHMAPI
131 afs_plugin_cb(khm_int32 msg_type,
132 khm_int32 msg_subtype,
133 khm_ui_4 uparam,
134 void * vparam);
136 INT_PTR CALLBACK
137 afs_cfg_ids_proc(HWND hwnd,
138 UINT uMsg,
139 WPARAM wParam,
140 LPARAM lParam);
142 INT_PTR CALLBACK
143 afs_cfg_id_proc(HWND hwnd,
144 UINT uMsg,
145 WPARAM wParam,
146 LPARAM lParam);
148 INT_PTR CALLBACK
149 afs_cfg_main_proc(HWND hwnd,
150 UINT uMsg,
151 WPARAM wParam,
152 LPARAM lParam);
154 HWND
155 afs_html_help(HWND caller,
156 wchar_t * postfix,
157 UINT cmd,
158 DWORD_PTR data);
160 /* extensions */
161 typedef afs_msg_announce afs_extension;
163 /* not thread safe. only call from the plugin thread */
164 afs_extension *
165 afs_find_extension(const wchar_t * name);
167 /* not thread safe. only call from the plugin thread */
168 afs_extension *
169 afs_get_extension(khm_size i);
171 /* not thread safe. only call from the plugin thread */
172 afs_extension *
173 afs_get_next_token_acq(afs_extension * f);
175 /* not thread safe. only call from the plugin thread */
176 khm_boolean
177 afs_is_valid_method_id(afs_tk_method method);
179 afs_tk_method
180 afs_get_next_method_id(afs_tk_method method);
182 afs_tk_method
183 afs_get_method_id(wchar_t * name);
185 khm_boolean
186 afs_get_method_name(afs_tk_method method, wchar_t * buf, khm_size cbbuf);
188 afs_extension *
189 afs_get_method_ext(afs_tk_method method);
191 khm_boolean
192 afs_method_describe(afs_tk_method method, khm_int32 flags,
193 wchar_t * wbuf, khm_size cbbuf);
195 khm_boolean
196 afs_ext_resolve_token(const wchar_t * cell,
197 const struct ktc_token * token,
198 const struct ktc_principal * serverp,
199 const struct ktc_principal * clientp,
200 khm_handle * pident,
201 afs_tk_method * pmethod);
203 khm_boolean
204 afs_ext_klog(afs_tk_method method,
205 khm_handle identity,
206 const char * service,
207 const char * cell,
208 const char * realm,
209 const afs_conf_cell * cell_config,
210 khm_int32 lifetime);
212 BOOL
213 afs_cfg_get_afscreds_shortcut(wchar_t * wpath);
215 /* Notificaiton icon functions */
217 enum notification_icon_state {
218 AFSICON_REPORT_TOKENS,
219 AFSICON_SERVICE_STOPPED,
220 AFSICON_SERVICE_ERROR
223 void
224 afs_icon_set_state(enum notification_icon_state state,
225 khm_handle credset_with_tokens);
227 void
228 afs_remove_icon(void);
231 /* Compatibility */
232 #if KH_VERSION_API < 7
234 #ifdef _WIN64
235 #define NIMDLLNAME L"nidmgr64.dll"
236 #define API_khui_action_lock "khui_action_lock"
237 #define API_khui_action_unlock "khui_action_unlock"
238 #define API_khui_refresh_actions "khui_refresh_actions"
239 #define API_khui_request_UI_callback "khui_request_UI_callback"
240 #else
241 #define NIMDLLNAME L"nidmgr32.dll"
242 #define API_khui_action_lock "_khui_action_lock@0"
243 #define API_khui_action_unlock "_khui_action_unlock@0"
244 #define API_khui_refresh_actions "_khui_refresh_actions@0"
245 #define API_khui_request_UI_callback "_khui_request_UI_callback@8"
246 #endif
248 extern void
249 (KHMAPI * pkhui_action_lock)(void);
251 extern void
252 (KHMAPI * pkhui_action_unlock)(void);
254 extern void
255 (KHMAPI * pkhui_refresh_actions)(void);
257 typedef khm_int32
258 (KHMAPI * khm_ui_callback)(HWND hwnd_main_wnd, void * rock);
260 extern khm_int32
261 (KHMAPI * pkhui_request_UI_callback)(khm_ui_callback cb,
262 void * rock);
264 #define khui_action_lock (*pkhui_action_lock)
265 #define khui_action_unlock (*pkhui_action_unlock)
266 #define khui_refresh_actions (*pkhui_refresh_actions)
267 #define khui_request_UI_callback (*pkhui_request_UI_callback)
269 #endif
271 #endif