]>
Commit | Line | Data |
---|---|---|
0236bb42 | 1 | /* $Header$ |
2 | * | |
3 | * Structures and constants used in the query dispatch table | |
4 | */ | |
5 | ||
6 | /* Query Types */ | |
7 | enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL}; | |
8 | ||
03c05291 | 9 | /* Tables */ |
10 | enum tables {NO_TABLE, USERS_TABLE, KRBMAP_TABLE, MACHINE_TABLE, | |
11 | HOSTALIAS_TABLE, SUBNET_TABLE, CLUSTER_TABLE, MCMAP_TABLE, | |
12 | SVC_TABLE, LIST_TABLE, IMEMBERS_TABLE, SERVERS_TABLE, | |
13 | SERVERHOSTS_TABLE, FILESYS_TABLE, FSGROUP_TABLE, NFSPHYS_TABLE, | |
14 | QUOTA_TABLE, ZEPHYR_TABLE, HOSTACCESS_TABLE, STRINGS_TABLE, | |
15 | SERVICES_TABLE, PRINTCAP_TABLE, PALLADIUM_TABLE, CAPACLS_TABLE, | |
16 | ALIAS_TABLE, NUMVALUES_TABLE, TBLSTATS_TABLE, INCREMENTAL_TABLE}; | |
17 | ||
0236bb42 | 18 | /* Query Definition Structure */ |
19 | struct query | |
20 | { | |
5eaef520 | 21 | char *name; /* query name */ |
22 | char *shortname; /* abbreviated query name (must be 4 chars) */ | |
23 | enum query_type type; /* query type */ | |
24 | char *rvar; /* range variable */ | |
25 | enum tables rtable; /* range table */ | |
26 | char *tlist; /* target list */ | |
27 | char **fields; /* input and output variable names (for help) */ | |
28 | int vcnt; /* variable count */ | |
29 | char *qual; /* format string for "where" clause */ | |
30 | int argc; /* number of args for qualifier */ | |
31 | struct validate *validate; /* validation support */ | |
32 | int acl; /* hint as to query ACL for this query */ | |
33 | int everybody; /* is the default user on this ACL? */ | |
0236bb42 | 34 | }; |
35 | ||
36 | /* Query Validation Structure */ | |
37 | struct validate | |
38 | { | |
5eaef520 | 39 | /* object validation (e.g., user, filesys, type) */ |
40 | struct valobj *valobj; /* array of object validation descriptors */ | |
41 | int objcnt; /* size of array */ | |
42 | /* row validation - retrieve (exists = any(rvar.field where qual)) */ | |
43 | char *field; /* field to check for */ | |
44 | char *qual; /* format string for "where" clause */ | |
45 | int argc; /* number of args used in qual */ | |
46 | /* values field containing current max object id */ | |
47 | char *object_id; | |
48 | /* routine to verify access permission on objects */ | |
49 | int (*acs_rtn)(); | |
50 | /* pre-processing routine (var setup only) */ | |
51 | int (*pre_rtn)(); | |
52 | /* post-processing routine */ | |
53 | int (*post_rtn)(); | |
0236bb42 | 54 | }; |
5eaef520 | 55 | |
0236bb42 | 56 | /* Validated Object Types */ |
5eaef520 | 57 | enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_DATE, |
03c05291 | 58 | V_SORT, V_RENAME, V_CHAR, V_LOCK, V_WILD, V_UPWILD, |
59 | V_RLOCK, V_LEN}; | |
0236bb42 | 60 | |
61 | /* Validated Object Definition */ | |
62 | struct valobj | |
63 | { | |
5eaef520 | 64 | enum vo_type type; |
65 | int index; /* index of object to validate */ | |
66 | enum tables table; /* table containing object */ | |
67 | char *namefield; /* table's fieldname for object */ | |
68 | char *idfield; /* table's corresponding id field (if any) */ | |
69 | int error; | |
0236bb42 | 70 | }; |
03c05291 | 71 | |
72 | ||
73 | /* prototypes from cache.dc */ | |
74 | void flush_cache(void); | |
75 | int name_to_id(char *name, enum tables type, int *id); | |
76 | int id_to_name(int id, enum tables type, char **name); | |
77 | int cache_entry(char *name, enum tables type, int id); | |
78 | void flush_name(char *name, enum tables type); | |
79 | void cache_commit(void); | |
80 | void cache_abort(void); | |
81 | ||
82 | /* prototypes from increment.dc */ | |
83 | void incremental_before(enum tables table, char *qualx, char **argv); | |
84 | void incremental_clear_before(void); | |
85 | void incremental_after(enum tables table, char *qualx, char **argv); | |
86 | void incremental_clear_after(void); | |
87 | ||
88 | /* prototypes from qfollow.dc */ | |
89 | int set_pobox_modtime(struct query *q, char *argv[], client *cl); | |
90 | ||
91 | /* prototypes from qrtn.dc */ | |
92 | int check_query_access(struct query *q, char *argv[], client *cl); | |
93 | int set_next_object_id(char *objectx, enum tables table, int limit); | |
94 | ||
95 | /* prototypes from qsubs.c */ | |
960b073b | 96 | void list_queries(int version, int (*action)(), char *actarg); |
97 | void help_query(struct query *q, int (*action)(), char *actarg); | |
03c05291 | 98 | struct query *get_query_by_name(char *name, int version); |