]> andersk Git - moira.git/blame - server/query.h
punt mrgdb
[moira.git] / server / query.h
CommitLineData
7ac48069 1/* $Id$
0236bb42 2 *
3 * Structures and constants used in the query dispatch table
7ac48069 4 *
5 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
7 * <mit-copyright.h>.
0236bb42 8 */
9
10/* Query Types */
11enum query_type {RETRIEVE, UPDATE, APPEND, DELETE, SPECIAL};
12
03c05291 13/* Tables */
14enum 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};
21
0236bb42 22/* Query Definition Structure */
23struct query
24{
5eaef520 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? */
0236bb42 38};
39
40/* Query Validation Structure */
41struct validate
42{
5eaef520 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 */
51 char *object_id;
52 /* routine to verify access permission on objects */
7ac48069 53 int (*acs_rtn)(struct query *q, char *Argv[], client *cl);
5eaef520 54 /* pre-processing routine (var setup only) */
7ac48069 55 int (*pre_rtn)(struct query *q, char *Argv[], client *cl);
5eaef520 56 /* post-processing routine */
57 int (*post_rtn)();
0236bb42 58};
5eaef520 59
0236bb42 60/* Validated Object Types */
7ac48069 61enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA,
03c05291 62 V_SORT, V_RENAME, V_CHAR, V_LOCK, V_WILD, V_UPWILD,
63 V_RLOCK, V_LEN};
0236bb42 64
65/* Validated Object Definition */
66struct valobj
67{
5eaef520 68 enum vo_type type;
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) */
73 int error;
0236bb42 74};
03c05291 75
76
77/* prototypes from cache.dc */
78void flush_cache(void);
79int name_to_id(char *name, enum tables type, int *id);
80int id_to_name(int id, enum tables type, char **name);
81int cache_entry(char *name, enum tables type, int id);
82void flush_name(char *name, enum tables type);
83void cache_commit(void);
84void cache_abort(void);
85
86/* prototypes from increment.dc */
87void incremental_before(enum tables table, char *qualx, char **argv);
88void incremental_clear_before(void);
89void incremental_after(enum tables table, char *qualx, char **argv);
90void incremental_clear_after(void);
91
03c05291 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 */
85330553 97void list_queries(int (*action)(int, char *[], void *),
7ac48069 98 void *actarg);
99void help_query(struct query *q, int (*action)(int, char *[], void *),
100 void *actarg);
85330553 101struct query *get_query_by_name(char *name);
This page took 0.074039 seconds and 5 git commands to generate.