windows-netidmgr-plugin-20061016
[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 /* the subitem indexes for each data field */
60 enum afs_ncwnd_subitems {
61     NCAFS_IDX_CELL=0,
62     NCAFS_IDX_REALM,
63     NCAFS_IDX_METHOD
64 };
65
66 #define DLG_TOOLTIP_TIMER_ID 1
67 #define DLG_TOOLTIP_TIMEOUT  5000
68
69 typedef struct tag_afs_cred_list {
70     afs_cred_row * rows;
71     int n_rows;
72     int nc_rows;
73 } afs_cred_list;
74
75 typedef struct tag_afs_dlg_data {
76     khui_new_creds * nc;
77
78     afs_cred_list creds;
79
80     khm_int32 afs_enabled;
81
82     BOOL tooltip_visible;
83     BOOL dirty;
84     HWND tooltip;
85
86     /* list view state image indices */
87     int idx_new_token;
88     int idx_existing_token;
89     int idx_bad_token;
90
91     CRITICAL_SECTION cs;
92
93     /* used with configuration dialogs */
94     khm_boolean config_dlg;
95     khui_config_init_data cfg;
96     khm_handle ident;
97 } afs_dlg_data;
98
99 #define AFS_DLG_ROW_ALLOC 4
100
101 INT_PTR CALLBACK 
102 afs_dlg_proc(HWND hwnd,
103              UINT uMsg,
104              WPARAM wParam,
105              LPARAM lParam);
106
107 void 
108 afs_dlg_update_rows(HWND hwnd, afs_dlg_data * d);
109
110 void 
111 afs_cred_flush_rows(afs_cred_list * l);
112
113 void 
114 afs_cred_free_rows(afs_cred_list * l);
115
116 void 
117 afs_cred_assert_rows(afs_cred_list * l, int n);
118
119 void 
120 afs_cred_delete_row(afs_cred_list * l, int i);
121
122 afs_cred_row * 
123 afs_cred_get_new_row(afs_cred_list * l);
124
125 khm_int32 KHMAPI
126 afs_cred_add_cred_proc(khm_handle cred, void * rock);
127
128 void
129 afs_cred_get_context_creds(afs_cred_list *l,
130                            khui_action_context * ctx);
131
132 void 
133 afs_cred_get_identity_creds(afs_cred_list * l, 
134                             khm_handle ident,
135                             khm_boolean * enabled);
136
137 void
138 afs_cred_write_ident_data(afs_dlg_data * d);
139
140 khm_int32
141 afs_msg_newcred(khm_int32 msg_subtype, 
142                 khm_ui_4 uparam, 
143                 void * vparam);
144
145 #endif