Windows: fix checked UNICODE build of talocale
[openafs.git] / src / WINNT / netidmgr_plugin / afsnewcreds.h
1 /*
2  * Copyright (c) 2005,2006 Secure Endpoints Inc.
3  *
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:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
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.
23  */
24
25 /* $Id$ */
26
27 #ifndef __AFS_NEWCREDS_H
28 #define __AFS_NEWCREDS_H
29
30 typedef struct tag_afs_cred_row {
31     wchar_t * cell;
32     wchar_t * realm;
33     afs_tk_method method;
34     khm_int32 flags;
35 } afs_cred_row;
36
37 /* we checked whether this cell exists */
38 #define DLGROW_FLAG_CHECKED  0x00000001
39
40 /* cell was checked and was found to be valid */
41 #define DLGROW_FLAG_VALID    0x00000002
42
43 /* cell was deleted  */
44 #define DLGROW_FLAG_DELETED  0x00000004
45
46 /* tokens obtained for cell */
47 #define DLGROW_FLAG_DONE     0x00000008
48
49 /* tokens for this cell already exist */
50 #define DLGROW_FLAG_EXISTS   0x00000010
51
52 /* tokens for this cell exist and is listed under a different
53    identity */
54 #define DLGROW_FLAG_NOTOWNED 0x00000020
55
56 /* tokens for this cell exist and are expired */
57 #define DLGROW_FLAG_EXPIRED  0x00000040
58
59 /* this cell was added because it was listed in the identity
60    configuration */
61 #define DLGROW_FLAG_CONFIG   0x00000080
62
63 /* the subitem indexes for each data field */
64 enum afs_ncwnd_subitems {
65     NCAFS_IDX_CELL=0,
66     NCAFS_IDX_REALM,
67     NCAFS_IDX_METHOD
68 };
69
70 #define DLG_TOOLTIP_TIMER_ID 1
71 #define DLG_TOOLTIP_TIMEOUT  5000
72
73 typedef struct tag_afs_cred_list {
74     afs_cred_row * rows;
75     int n_rows;
76     int nc_rows;
77 } afs_cred_list;
78
79 typedef struct tag_afs_dlg_data {
80     khui_new_creds * nc;
81
82     afs_cred_list creds;
83
84     khm_int32 afs_enabled;
85
86     BOOL tooltip_visible;
87     BOOL dirty;
88     HWND tooltip;
89
90     /* list view state image indices */
91     int idx_new_token;
92     int idx_existing_token;
93     int idx_bad_token;
94
95     CRITICAL_SECTION cs;
96
97     /* used with configuration dialogs */
98     khm_boolean config_dlg;
99     khui_config_init_data cfg;
100     khm_handle ident;
101 } afs_dlg_data;
102
103 #define AFS_DLG_ROW_ALLOC 4
104
105 INT_PTR CALLBACK
106 afs_dlg_proc(HWND hwnd,
107              UINT uMsg,
108              WPARAM wParam,
109              LPARAM lParam);
110
111 void
112 afs_dlg_update_rows(HWND hwnd, afs_dlg_data * d);
113
114 void
115 afs_cred_flush_rows(afs_cred_list * l);
116
117 void
118 afs_cred_free_rows(afs_cred_list * l);
119
120 void
121 afs_cred_assert_rows(afs_cred_list * l, int n);
122
123 void
124 afs_cred_delete_row(afs_cred_list * l, int i);
125
126 afs_cred_row *
127 afs_cred_get_new_row(afs_cred_list * l);
128
129 khm_int32 KHMAPI
130 afs_cred_add_cred_proc(khm_handle cred, void * rock);
131
132 void
133 afs_cred_get_context_creds(afs_cred_list *l,
134                            khui_action_context * ctx);
135
136 void
137 afs_cred_get_identity_creds(afs_cred_list * l,
138                             khm_handle ident,
139                             khm_boolean * enabled);
140
141 void
142 afs_cred_write_ident_data(afs_dlg_data * d);
143
144 khm_int32
145 afs_msg_newcred(khm_int32 msg_subtype,
146                 khm_ui_4 uparam,
147                 void * vparam);
148
149 #endif