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