]> andersk Git - moira.git/blame - server/query.h
Allow hostname to start with a digit in hostname_check, but disallow it
[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
13/* Query Definition Structure */
14struct query
15{
5eaef520 16 char *name; /* query name */
17 char *shortname; /* abbreviated query name (must be 4 chars) */
18 enum query_type type; /* query type */
19 char *rvar; /* range variable */
20 enum tables rtable; /* range table */
21 char *tlist; /* target list */
22 char **fields; /* input and output variable names (for help) */
23 int vcnt; /* variable count */
24 char *qual; /* format string for "where" clause */
25 int argc; /* number of args for qualifier */
29028043 26 char *sort; /* fields to sort on */
5eaef520 27 struct validate *validate; /* validation support */
28 int acl; /* hint as to query ACL for this query */
29 int everybody; /* is the default user on this ACL? */
0236bb42 30};
31
32/* Query Validation Structure */
33struct validate
34{
5eaef520 35 /* object validation (e.g., user, filesys, type) */
36 struct valobj *valobj; /* array of object validation descriptors */
37 int objcnt; /* size of array */
38 /* row validation - retrieve (exists = any(rvar.field where qual)) */
39 char *field; /* field to check for */
40 char *qual; /* format string for "where" clause */
41 int argc; /* number of args used in qual */
42 /* values field containing current max object id */
43 char *object_id;
44 /* routine to verify access permission on objects */
7ac48069 45 int (*acs_rtn)(struct query *q, char *Argv[], client *cl);
5eaef520 46 /* pre-processing routine (var setup only) */
7ac48069 47 int (*pre_rtn)(struct query *q, char *Argv[], client *cl);
5eaef520 48 /* post-processing routine */
49 int (*post_rtn)();
0236bb42 50};
5eaef520 51
0236bb42 52/* Validated Object Types */
d1b3a4bf 53enum vo_type {V_NAME, V_ID, V_TYPE, V_TYPEDATA, V_RENAME, V_CHAR,
263a36d4 54 V_LEN, V_NUM};
0236bb42 55
56/* Validated Object Definition */
57struct valobj
58{
5eaef520 59 enum vo_type type;
60 int index; /* index of object to validate */
61 enum tables table; /* table containing object */
62 char *namefield; /* table's fieldname for object */
63 char *idfield; /* table's corresponding id field (if any) */
64 int error;
0236bb42 65};
03c05291 66
67
68/* prototypes from cache.dc */
69void flush_cache(void);
70int name_to_id(char *name, enum tables type, int *id);
71int id_to_name(int id, enum tables type, char **name);
72int cache_entry(char *name, enum tables type, int id);
73void flush_name(char *name, enum tables type);
74void cache_commit(void);
75void cache_abort(void);
76
77/* prototypes from increment.dc */
78void incremental_before(enum tables table, char *qualx, char **argv);
79void incremental_clear_before(void);
80void incremental_after(enum tables table, char *qualx, char **argv);
81void incremental_clear_after(void);
82
03c05291 83/* prototypes from qrtn.dc */
84int check_query_access(struct query *q, char *argv[], client *cl);
85int set_next_object_id(char *objectx, enum tables table, int limit);
86
87/* prototypes from qsubs.c */
85330553 88void list_queries(int (*action)(int, char *[], void *),
7ac48069 89 void *actarg);
90void help_query(struct query *q, int (*action)(int, char *[], void *),
91 void *actarg);
85330553 92struct query *get_query_by_name(char *name);
This page took 0.075656 seconds and 5 git commands to generate.