3 * Structures and constants used in the query dispatch table
5 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
11 enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
14 enum tables {NO_TABLE, USERS_TABLE, KRBMAP_TABLE, MACHINE_TABLE,
15 HOSTALIAS_TABLE, SUBNET_TABLE, CLUSTER_TABLE, MCMAP_TABLE,
16 SVC_TABLE, LIST_TABLE, IMEMBERS_TABLE, SERVERS_TABLE,
17 SERVERHOSTS_TABLE, FILESYS_TABLE, FSGROUP_TABLE, NFSPHYS_TABLE,
18 QUOTA_TABLE, ZEPHYR_TABLE, HOSTACCESS_TABLE, STRINGS_TABLE,
19 SERVICES_TABLE, PRINTCAP_TABLE, PALLADIUM_TABLE, CAPACLS_TABLE,
20 ALIAS_TABLE, NUMVALUES_TABLE, TBLSTATS_TABLE, INCREMENTAL_TABLE};
22 /* Query Definition Structure */
25 char *name; /* query name */
26 char *shortname; /* abbreviated query name (must be 4 chars) */
27 enum query_type type; /* query type */
28 char *rvar; /* range variable */
29 enum tables rtable; /* range table */
30 char *tlist; /* target list */
31 char **fields; /* input and output variable names (for help) */
32 int vcnt; /* variable count */
33 char *qual; /* format string for "where" clause */
34 int argc; /* number of args for qualifier */
35 struct validate *validate; /* validation support */
36 int acl; /* hint as to query ACL for this query */
37 int everybody; /* is the default user on this ACL? */
40 /* Query Validation Structure */
43 /* object validation (e.g., user, filesys, type) */
44 struct valobj *valobj; /* array of object validation descriptors */
45 int objcnt; /* size of array */
46 /* row validation - retrieve (exists = any(rvar.field where qual)) */
47 char *field; /* field to check for */
48 char *qual; /* format string for "where" clause */
49 int argc; /* number of args used in qual */
50 /* values field containing current max object id */
52 /* routine to verify access permission on objects */
53 int (*acs_rtn)(struct query *q, char *Argv[], client *cl);
54 /* pre-processing routine (var setup only) */
55 int (*pre_rtn)(struct query *q, char *Argv[], client *cl);
56 /* post-processing routine */
60 /* Validated Object Types */
61 enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA,
62 V_SORT, V_RENAME, V_CHAR, V_LOCK, V_WILD, V_UPWILD,
65 /* Validated Object Definition */
69 int index; /* index of object to validate */
70 enum tables table; /* table containing object */
71 char *namefield; /* table's fieldname for object */
72 char *idfield; /* table's corresponding id field (if any) */
77 /* prototypes from cache.dc */
78 void flush_cache(void);
79 int name_to_id(char *name, enum tables type, int *id);
80 int id_to_name(int id, enum tables type, char **name);
81 int cache_entry(char *name, enum tables type, int id);
82 void flush_name(char *name, enum tables type);
83 void cache_commit(void);
84 void cache_abort(void);
86 /* prototypes from increment.dc */
87 void incremental_before(enum tables table, char *qualx, char **argv);
88 void incremental_clear_before(void);
89 void incremental_after(enum tables table, char *qualx, char **argv);
90 void incremental_clear_after(void);
92 /* prototypes from qrtn.dc */
93 int check_query_access(struct query *q, char *argv[], client *cl);
94 int set_next_object_id(char *objectx, enum tables table, int limit);
96 /* prototypes from qsubs.c */
97 void list_queries(int (*action)(int, char *[], void *),
99 void help_query(struct query *q, int (*action)(int, char *[], void *),
101 struct query *get_query_by_name(char *name);