1 /* ccapi/server/ccs_list.c */
2 /*
3 * Copyright 2006, 2007 Massachusetts Institute of Technology.
4 * All Rights Reserved.
5 *
6 * Export of this software from the United States of America may
7 * require a specific license from the United States Government.
8 * It is the responsibility of any person or organization contemplating
9 * export to obtain such a license before exporting.
10 *
11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
12 * distribute this software and its documentation for any purpose and
13 * without fee is hereby granted, provided that the above copyright
14 * notice appear in all copies and that both that copyright notice and
15 * this permission notice appear in supporting documentation, and that
16 * the name of M.I.T. not be used in advertising or publicity pertaining
17 * to distribution of the software without specific, written prior
18 * permission. Furthermore if you modify this software you must label
19 * your software as modified software and not distribute it in such a
20 * fashion that it might be confused with the original M.I.T. software.
21 * M.I.T. makes no representations about the suitability of
22 * this software for any purpose. It is provided "as is" without express
23 * or implied warranty.
24 */
25
26 #include "ccs_common.h"
27 #include "ccs_list_internal.h"
28
29 /* ------------------------------------------------------------------------ */
30
ccs_cache_collection_list_object_release(ccs_list_object_t io_object)31 static cc_int32 ccs_cache_collection_list_object_release (ccs_list_object_t io_object)
32 {
33 return cci_check_error (ccs_cache_collection_release ((ccs_cache_collection_t) io_object));
34 }
35
36 /* ------------------------------------------------------------------------ */
37
ccs_cache_collection_list_object_compare_identifier(ccs_list_object_t in_cache_collection,cci_identifier_t in_identifier,cc_uint32 * out_equal)38 static cc_int32 ccs_cache_collection_list_object_compare_identifier (ccs_list_object_t in_cache_collection,
39 cci_identifier_t in_identifier,
40 cc_uint32 *out_equal)
41 {
42 return ccs_cache_collection_compare_identifier ((ccs_cache_collection_t) in_cache_collection,
43 in_identifier,
44 out_equal);
45 }
46
47 /* ------------------------------------------------------------------------ */
48
ccs_cache_collection_list_new(ccs_cache_collection_list_t * out_list)49 cc_int32 ccs_cache_collection_list_new (ccs_cache_collection_list_t *out_list)
50 {
51 return ccs_list_new (out_list,
52 ccErrInvalidContext,
53 ccErrInvalidContext,
54 ccs_cache_collection_list_object_compare_identifier,
55 ccs_cache_collection_list_object_release);
56 }
57
58 /* ------------------------------------------------------------------------ */
59
ccs_cache_collection_list_count(ccs_cache_collection_list_t in_list,cc_uint64 * out_count)60 cc_int32 ccs_cache_collection_list_count (ccs_cache_collection_list_t in_list,
61 cc_uint64 *out_count)
62 {
63 return ccs_list_count (in_list, out_count);
64 }
65
66 /* ------------------------------------------------------------------------ */
67
ccs_cache_collection_list_find(ccs_cache_collection_list_t in_list,cci_identifier_t in_identifier,ccs_cache_collection_t * out_cache_collection)68 cc_int32 ccs_cache_collection_list_find (ccs_cache_collection_list_t in_list,
69 cci_identifier_t in_identifier,
70 ccs_cache_collection_t *out_cache_collection)
71 {
72 return ccs_list_find (in_list, in_identifier, (ccs_list_object_t *) out_cache_collection);
73 }
74
75 /* ------------------------------------------------------------------------ */
76
ccs_cache_collection_list_add(ccs_cache_collection_list_t io_list,ccs_cache_collection_t in_cache_collection)77 cc_int32 ccs_cache_collection_list_add (ccs_cache_collection_list_t io_list,
78 ccs_cache_collection_t in_cache_collection)
79 {
80 return ccs_list_add (io_list, (ccs_list_object_t) in_cache_collection);
81 }
82
83 /* ------------------------------------------------------------------------ */
84
ccs_cache_collection_list_remove(ccs_cache_collection_list_t io_list,cci_identifier_t in_identifier)85 cc_int32 ccs_cache_collection_list_remove (ccs_cache_collection_list_t io_list,
86 cci_identifier_t in_identifier)
87 {
88 return ccs_list_remove (io_list, in_identifier);
89 }
90
91 /* ------------------------------------------------------------------------ */
92
ccs_cache_collection_list_release(ccs_cache_collection_list_t io_list)93 cc_int32 ccs_cache_collection_list_release (ccs_cache_collection_list_t io_list)
94 {
95 return ccs_list_release (io_list);
96 }
97
98 #ifdef TARGET_OS_MAC
99 #pragma mark -
100 #endif
101
102 /* ------------------------------------------------------------------------ */
103
ccs_ccache_list_object_release(ccs_list_object_t io_ccache)104 static cc_int32 ccs_ccache_list_object_release (ccs_list_object_t io_ccache)
105 {
106 return cci_check_error (ccs_ccache_release ((ccs_ccache_t) io_ccache));
107 }
108
109 /* ------------------------------------------------------------------------ */
110
ccs_ccache_list_object_compare_identifier(ccs_list_object_t in_ccache,cci_identifier_t in_identifier,cc_uint32 * out_equal)111 static cc_int32 ccs_ccache_list_object_compare_identifier (ccs_list_object_t in_ccache,
112 cci_identifier_t in_identifier,
113 cc_uint32 *out_equal)
114 {
115 return ccs_ccache_compare_identifier ((ccs_ccache_t) in_ccache,
116 in_identifier,
117 out_equal);
118 }
119
120 /* ------------------------------------------------------------------------ */
121
ccs_ccache_list_new(ccs_ccache_list_t * out_list)122 cc_int32 ccs_ccache_list_new (ccs_ccache_list_t *out_list)
123 {
124 return ccs_list_new (out_list,
125 ccErrInvalidCCache,
126 ccErrInvalidCCacheIterator,
127 ccs_ccache_list_object_compare_identifier,
128 ccs_ccache_list_object_release);
129 }
130
131 /* ------------------------------------------------------------------------ */
132
ccs_ccache_list_new_iterator(ccs_ccache_list_t in_list,ccs_pipe_t in_client_pipe,ccs_ccache_list_iterator_t * out_list_iterator)133 cc_int32 ccs_ccache_list_new_iterator (ccs_ccache_list_t in_list,
134 ccs_pipe_t in_client_pipe,
135 ccs_ccache_list_iterator_t *out_list_iterator)
136 {
137 return ccs_list_new_iterator (in_list, in_client_pipe, out_list_iterator);
138 }
139
140 /* ------------------------------------------------------------------------ */
141
ccs_ccache_list_count(ccs_ccache_list_t in_list,cc_uint64 * out_count)142 cc_int32 ccs_ccache_list_count (ccs_ccache_list_t in_list,
143 cc_uint64 *out_count)
144 {
145 return ccs_list_count (in_list, out_count);
146 }
147
148 /* ------------------------------------------------------------------------ */
149
ccs_ccache_list_find(ccs_ccache_list_t in_list,cci_identifier_t in_identifier,ccs_ccache_t * out_ccache)150 cc_int32 ccs_ccache_list_find (ccs_ccache_list_t in_list,
151 cci_identifier_t in_identifier,
152 ccs_ccache_t *out_ccache)
153 {
154 return ccs_list_find (in_list, in_identifier, (ccs_list_object_t *) out_ccache);
155 }
156
157 /* ------------------------------------------------------------------------ */
158
ccs_ccache_list_find_iterator(ccs_ccache_list_t in_list,cci_identifier_t in_identifier,ccs_ccache_list_iterator_t * out_list_iterator)159 cc_int32 ccs_ccache_list_find_iterator (ccs_ccache_list_t in_list,
160 cci_identifier_t in_identifier,
161 ccs_ccache_list_iterator_t *out_list_iterator)
162 {
163 return ccs_list_find_iterator (in_list, in_identifier,
164 (ccs_list_iterator_t *) out_list_iterator);
165 }
166
167 /* ------------------------------------------------------------------------ */
168
ccs_ccache_list_add(ccs_ccache_list_t io_list,ccs_ccache_t in_ccache)169 cc_int32 ccs_ccache_list_add (ccs_ccache_list_t io_list,
170 ccs_ccache_t in_ccache)
171 {
172 return ccs_list_add (io_list, (ccs_list_object_t) in_ccache);
173 }
174
175 /* ------------------------------------------------------------------------ */
176
ccs_ccache_list_remove(ccs_ccache_list_t io_list,cci_identifier_t in_identifier)177 cc_int32 ccs_ccache_list_remove (ccs_ccache_list_t io_list,
178 cci_identifier_t in_identifier)
179 {
180 return ccs_list_remove (io_list, in_identifier);
181 }
182
183 /* ------------------------------------------------------------------------ */
184
ccs_ccache_list_push_front(ccs_ccache_list_t io_list,cci_identifier_t in_identifier)185 cc_int32 ccs_ccache_list_push_front (ccs_ccache_list_t io_list,
186 cci_identifier_t in_identifier)
187 {
188 return ccs_list_push_front (io_list, in_identifier);
189 }
190
191 /* ------------------------------------------------------------------------ */
192
ccs_ccache_list_release(ccs_ccache_list_t io_list)193 cc_int32 ccs_ccache_list_release (ccs_ccache_list_t io_list)
194 {
195 return ccs_list_release (io_list);
196 }
197
198 /* ------------------------------------------------------------------------ */
199
ccs_ccache_list_iterator_write(ccs_ccache_list_iterator_t in_list_iterator,k5_ipc_stream in_stream)200 cc_int32 ccs_ccache_list_iterator_write (ccs_ccache_list_iterator_t in_list_iterator,
201 k5_ipc_stream in_stream)
202 {
203 return ccs_list_iterator_write (in_list_iterator, in_stream);
204 }
205
206 /* ------------------------------------------------------------------------ */
207
ccs_ccache_list_iterator_clone(ccs_ccache_list_iterator_t in_list_iterator,ccs_ccache_list_iterator_t * out_list_iterator)208 cc_int32 ccs_ccache_list_iterator_clone (ccs_ccache_list_iterator_t in_list_iterator,
209 ccs_ccache_list_iterator_t *out_list_iterator)
210 {
211 return ccs_list_iterator_clone (in_list_iterator, out_list_iterator);
212 }
213
214 /* ------------------------------------------------------------------------ */
215
ccs_ccache_list_iterator_next(ccs_ccache_list_iterator_t io_list_iterator,ccs_ccache_t * out_ccache)216 cc_int32 ccs_ccache_list_iterator_next (ccs_ccache_list_iterator_t io_list_iterator,
217 ccs_ccache_t *out_ccache)
218 {
219 return ccs_list_iterator_next (io_list_iterator, (ccs_list_object_t *) out_ccache);
220 }
221
222 /* ------------------------------------------------------------------------ */
223
ccs_ccache_list_iterator_release(ccs_ccache_list_iterator_t io_list_iterator)224 cc_int32 ccs_ccache_list_iterator_release (ccs_ccache_list_iterator_t io_list_iterator)
225 {
226 return ccs_list_iterator_release (io_list_iterator);
227 }
228
229 #ifdef TARGET_OS_MAC
230 #pragma mark-
231 #endif
232
233 /* ------------------------------------------------------------------------ */
234
ccs_credentials_list_object_release(ccs_list_object_t io_object)235 static cc_int32 ccs_credentials_list_object_release (ccs_list_object_t io_object)
236 {
237 return cci_check_error (ccs_credentials_release ((ccs_credentials_t) io_object));
238 }
239
240 /* ------------------------------------------------------------------------ */
241
ccs_credentials_list_object_compare_identifier(ccs_list_object_t in_credentials,cci_identifier_t in_identifier,cc_uint32 * out_equal)242 static cc_int32 ccs_credentials_list_object_compare_identifier (ccs_list_object_t in_credentials,
243 cci_identifier_t in_identifier,
244 cc_uint32 *out_equal)
245 {
246 return ccs_credentials_compare_identifier ((ccs_credentials_t) in_credentials,
247 in_identifier,
248 out_equal);
249 }
250
251 /* ------------------------------------------------------------------------ */
252
ccs_credentials_list_new(ccs_credentials_list_t * out_list)253 cc_int32 ccs_credentials_list_new (ccs_credentials_list_t *out_list)
254 {
255 return ccs_list_new (out_list,
256 ccErrInvalidCredentials,
257 ccErrInvalidCredentialsIterator,
258 ccs_credentials_list_object_compare_identifier,
259 ccs_credentials_list_object_release);
260 }
261
262 /* ------------------------------------------------------------------------ */
263
ccs_credentials_list_new_iterator(ccs_credentials_list_t in_list,ccs_pipe_t in_client_pipe,ccs_credentials_list_iterator_t * out_list_iterator)264 cc_int32 ccs_credentials_list_new_iterator (ccs_credentials_list_t in_list,
265 ccs_pipe_t in_client_pipe,
266 ccs_credentials_list_iterator_t *out_list_iterator)
267 {
268 return ccs_list_new_iterator (in_list, in_client_pipe, out_list_iterator);
269 }
270
271 /* ------------------------------------------------------------------------ */
272
ccs_credentials_list_count(ccs_credentials_list_t in_list,cc_uint64 * out_count)273 cc_int32 ccs_credentials_list_count (ccs_credentials_list_t in_list,
274 cc_uint64 *out_count)
275 {
276 return ccs_list_count (in_list, out_count);
277 }
278
279 /* ------------------------------------------------------------------------ */
280
ccs_credentials_list_find(ccs_credentials_list_t in_list,cci_identifier_t in_identifier,ccs_credentials_t * out_credentials)281 cc_int32 ccs_credentials_list_find (ccs_credentials_list_t in_list,
282 cci_identifier_t in_identifier,
283 ccs_credentials_t *out_credentials)
284 {
285 return ccs_list_find (in_list, in_identifier, (ccs_list_object_t *) out_credentials);
286 }
287
288 /* ------------------------------------------------------------------------ */
289
ccs_credentials_list_find_iterator(ccs_credentials_list_t in_list,cci_identifier_t in_identifier,ccs_credentials_list_iterator_t * out_list_iterator)290 cc_int32 ccs_credentials_list_find_iterator (ccs_credentials_list_t in_list,
291 cci_identifier_t in_identifier,
292 ccs_credentials_list_iterator_t *out_list_iterator)
293 {
294 return ccs_list_find_iterator (in_list, in_identifier,
295 (ccs_list_iterator_t *) out_list_iterator);
296 }
297
298 /* ------------------------------------------------------------------------ */
299
ccs_credentials_list_add(ccs_credentials_list_t io_list,ccs_credentials_t in_credential)300 cc_int32 ccs_credentials_list_add (ccs_credentials_list_t io_list,
301 ccs_credentials_t in_credential)
302 {
303 return ccs_list_add (io_list, (ccs_list_object_t) in_credential);
304 }
305
306 /* ------------------------------------------------------------------------ */
307
ccs_credentials_list_remove(ccs_credentials_list_t io_list,cci_identifier_t in_identifier)308 cc_int32 ccs_credentials_list_remove (ccs_credentials_list_t io_list,
309 cci_identifier_t in_identifier)
310 {
311 return ccs_list_remove (io_list, in_identifier);
312 }
313
314 /* ------------------------------------------------------------------------ */
315
ccs_credentials_list_release(ccs_credentials_list_t io_list)316 cc_int32 ccs_credentials_list_release (ccs_credentials_list_t io_list)
317 {
318 return ccs_list_release (io_list);
319 }
320
321 /* ------------------------------------------------------------------------ */
322
ccs_credentials_list_iterator_write(ccs_credentials_list_iterator_t in_list_iterator,k5_ipc_stream in_stream)323 cc_int32 ccs_credentials_list_iterator_write (ccs_credentials_list_iterator_t in_list_iterator,
324 k5_ipc_stream in_stream)
325 {
326 return ccs_list_iterator_write (in_list_iterator, in_stream);
327 }
328
329 /* ------------------------------------------------------------------------ */
330
ccs_credentials_list_iterator_clone(ccs_credentials_list_iterator_t in_list_iterator,ccs_credentials_list_iterator_t * out_list_iterator)331 cc_int32 ccs_credentials_list_iterator_clone (ccs_credentials_list_iterator_t in_list_iterator,
332 ccs_credentials_list_iterator_t *out_list_iterator)
333 {
334 return ccs_list_iterator_clone (in_list_iterator, out_list_iterator);
335 }
336
337 /* ------------------------------------------------------------------------ */
338
ccs_credentials_list_iterator_next(ccs_credentials_list_iterator_t io_list_iterator,ccs_credentials_t * out_credential)339 cc_int32 ccs_credentials_list_iterator_next (ccs_credentials_list_iterator_t io_list_iterator,
340 ccs_credentials_t *out_credential)
341 {
342 return ccs_list_iterator_next (io_list_iterator, (ccs_list_object_t *) out_credential);
343 }
344
345 /* ------------------------------------------------------------------------ */
346
ccs_credentials_list_iterator_release(ccs_credentials_list_iterator_t io_list_iterator)347 cc_int32 ccs_credentials_list_iterator_release (ccs_credentials_list_iterator_t io_list_iterator)
348 {
349 return ccs_list_iterator_release (io_list_iterator);
350 }
351
352 #ifdef TARGET_OS_MAC
353 #pragma mark-
354 #endif
355
356 /* ------------------------------------------------------------------------ */
357
ccs_generic_list_iterator_invalidate(ccs_generic_list_iterator_t io_list_iterator)358 cc_int32 ccs_generic_list_iterator_invalidate (ccs_generic_list_iterator_t io_list_iterator)
359 {
360 return ccs_list_iterator_invalidate (io_list_iterator);
361 }
362