3 * Structures and constants used in the query dispatch table
7 enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
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};
18 /* Query Definition Structure */
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? */
36 /* Query Validation Structure */
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 */
48 /* routine to verify access permission on objects */
50 /* pre-processing routine (var setup only) */
52 /* post-processing routine */
56 /* Validated Object Types */
57 enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_DATE,
58 V_SORT, V_RENAME, V_CHAR, V_LOCK, V_WILD, V_UPWILD,
61 /* Validated Object Definition */
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) */
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);
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);
88 /* prototypes from qfollow.dc */
89 int set_pobox_modtime(struct query *q, char *argv[], client *cl);
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);
95 /* prototypes from qsubs.c */
96 void list_queries(int version, int (*action)(), char *actarg);
97 void help_query(struct query *q, int (*action)(), char *actarg);
98 struct query *get_query_by_name(char *name, int version);