2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #ifndef OPENAFS_ADMIN_INTERNAL_H
11 #define OPENAFS_ADMIN_INTERNAL_H
13 #include <afs/param.h>
15 #include <afs/cellconfig.h>
20 #define BEGIN_MAGIC 0xb0b0b0b0
21 #define END_MAGIC 0xc0c0c0c0
23 typedef struct afs_token_handle {
30 char cell[MAXCELLCHARS];
31 struct ktc_token afs_token;
32 struct ktc_token kas_token;
33 struct rx_securityClass *afs_sc[3];
34 struct rx_securityClass *afs_encrypt_sc[3];
35 struct rx_securityClass *kas_sc[3];
36 struct ktc_principal client;
38 } afs_token_handle_t, *afs_token_handle_p;
40 typedef struct afs_cell_handle {
44 afs_token_handle_p tokens;
45 char working_cell[MAXCELLCHARS];
46 struct ubik_client *kas;
47 struct ubik_client *pts;
48 struct ubik_client *vos;
54 } afs_cell_handle_t, *afs_cell_handle_p;
56 #define CACHED_ITEMS 5
58 typedef int (*validate_specific_data_func) (void *rpc_specific,
61 typedef int (*destroy_specific_data_func) (void *rpc_specific,
64 typedef int (*get_cached_data_func) (void *rpc_specific, int slot, void *dest,
67 typedef int (*make_rpc_func) (void *rpc_specific, int slot, int *last_item,
68 int *last_item_contains_data, afs_status_p st);
72 * the afs_admin_iterator_t structure contains one mutex (named
73 * mutex) that should be held while manipulating any of the other
74 * elements in the structure. The only exception to this rule is
75 * that it is legale to make rpc's without the mutex being held.
78 typedef struct afs_admin_iterator {
81 pthread_mutex_t mutex; /* hold to manipulate this structure */
82 pthread_cond_t add_item; /* wait for data to be added to the cache */
83 pthread_cond_t remove_item; /* wait for data to be removed from the cache */
84 pthread_t bg_worker; /* thread id of background worker */
85 int cache_slots_used; /* number of items in the cache */
86 int done_iterating; /* finished iterating over the database */
87 int request_terminated; /* Done has been called on this iterator */
88 afs_status_t st; /* the status of the last rpc */
89 int cache_queue_head; /* index into principal that's the head of the q */
90 int cache_queue_tail; /* index into principal that's the tail of the q */
92 make_rpc_func make_rpc;
93 get_cached_data_func get_cached_data;
94 validate_specific_data_func validate_specific;
95 destroy_specific_data_func destroy_specific;
97 } afs_admin_iterator_t, *afs_admin_iterator_p;
99 int IteratorNext(afs_admin_iterator_p iter, void *dest, afs_status_p st);
101 int IteratorDone(afs_admin_iterator_p iter, afs_status_p st);
103 int IteratorInit(afs_admin_iterator_p iter, void *rpc_specific,
104 make_rpc_func make_rpc, get_cached_data_func get_cached_data,
105 validate_specific_data_func validate_specific_data,
106 destroy_specific_data_func destroy_specific_data,
108 #endif /* OPENAFS_ADMIN_INTERNAL_H */