]> andersk Git - moira.git/blame - server/query.h
Code style cleanup. (No functional changes)
[moira.git] / server / query.h
CommitLineData
0236bb42 1/* $Header$
2 *
3 * Structures and constants used in the query dispatch table
4 */
5
6/* Query Types */
7enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
8
03c05291 9/* Tables */
10enum 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 */
19struct 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 */
37struct 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 57enum 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 */
62struct 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 */
74void flush_cache(void);
75int name_to_id(char *name, enum tables type, int *id);
76int id_to_name(int id, enum tables type, char **name);
77int cache_entry(char *name, enum tables type, int id);
78void flush_name(char *name, enum tables type);
79void cache_commit(void);
80void cache_abort(void);
81
82/* prototypes from increment.dc */
83void incremental_before(enum tables table, char *qualx, char **argv);
84void incremental_clear_before(void);
85void incremental_after(enum tables table, char *qualx, char **argv);
86void incremental_clear_after(void);
87
88/* prototypes from qfollow.dc */
89int set_pobox_modtime(struct query *q, char *argv[], client *cl);
90
91/* prototypes from qrtn.dc */
92int check_query_access(struct query *q, char *argv[], client *cl);
93int set_next_object_id(char *objectx, enum tables table, int limit);
94
95/* prototypes from qsubs.c */
960b073b 96void list_queries(int version, int (*action)(), char *actarg);
97void help_query(struct query *q, int (*action)(), char *actarg);
03c05291 98struct query *get_query_by_name(char *name, int version);
This page took 0.635085 seconds and 5 git commands to generate.