]> andersk Git - moira.git/blame - server/query.h
Add validation of numeric query arguments
[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{
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 */
03c05291 25 enum tables rtable; /* range table */
0236bb42 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 */
68b5b948 31 char *sort; /* fields to sort on */
0236bb42 32 struct validate *validate; /* validation support */
33 int acl; /* hint as to query ACL for this query */
34 int everybody; /* is the default user on this ACL? */
35};
36
37/* Query Validation Structure */
38struct validate
39{
40 /* object validation (e.g., user, filesys, type) */
41 struct valobj *valobj; /* array of object validation descriptors */
42 int objcnt; /* size of array */
43 /* row validation - retrieve (exists = any(rvar.field where qual)) */
44 char *field; /* field to check for */
45 char *qual; /* format string for "where" clause */
46 int argc; /* number of args used in qual */
47 /* values field containing current max object id */
48 char *object_id;
49 /* routine to verify access permission on objects */
50 int (*acs_rtn)();
51 /* pre-processing routine (var setup only) */
52 int (*pre_rtn)();
53 /* post-processing routine */
54 int (*post_rtn)();
55};
56
57/* Validated Object Types */
58enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_DATE,
68b5b948 59 V_RENAME, V_CHAR, V_LOCK, V_WILD, V_UPWILD,
f0e5d2fe 60 V_RLOCK, V_LEN, V_NUM};
0236bb42 61
62/* Validated Object Definition */
63struct valobj
64{
65 enum vo_type type;
66 int index; /* index of object to validate */
03c05291 67 enum tables table; /* table containing object */
0236bb42 68 char *namefield; /* table's fieldname for object */
69 char *idfield; /* table's corresponding id field (if any) */
70 int error;
71};
03c05291 72
73
74/* prototypes from cache.dc */
75void flush_cache(void);
76int name_to_id(char *name, enum tables type, int *id);
77int id_to_name(int id, enum tables type, char **name);
78int cache_entry(char *name, enum tables type, int id);
79void flush_name(char *name, enum tables type);
80void cache_commit(void);
81void cache_abort(void);
82
83/* prototypes from increment.dc */
84void incremental_before(enum tables table, char *qualx, char **argv);
85void incremental_clear_before(void);
86void incremental_after(enum tables table, char *qualx, char **argv);
87void incremental_clear_after(void);
88
89/* prototypes from qfollow.dc */
90int set_pobox_modtime(struct query *q, char *argv[], client *cl);
91
92/* prototypes from qrtn.dc */
93int check_query_access(struct query *q, char *argv[], client *cl);
94int set_next_object_id(char *objectx, enum tables table, int limit);
95
96/* prototypes from qsubs.c */
960b073b 97void list_queries(int version, int (*action)(), char *actarg);
98void help_query(struct query *q, int (*action)(), char *actarg);
03c05291 99struct query *get_query_by_name(char *name, int version);
This page took 0.107225 seconds and 5 git commands to generate.