]> andersk Git - moira.git/blame - server/mr_server.h
Use moira_schema.h
[moira.git] / server / mr_server.h
CommitLineData
7ac48069 1/* $Id$
eab30d01 2 *
7ac48069 3 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
4 * For copying and distribution information, please see the file
5 * <mit-copyright.h>.
eab30d01 6 */
7
7ac48069 8#include <moira.h>
85330553 9#include <mr_private.h>
d548a4e7 10#include <moira_site.h>
7ac48069 11
12#include <netinet/in.h>
13
98a7b0ee 14#include <stdarg.h>
5dbd09a0 15
7ac48069 16#include <krb.h>
17
85330553 18/* This should be in the kerberos header file. */
0311b667 19
20struct krbname {
5eaef520 21 char name[ANAME_SZ];
22 char inst[INST_SZ];
23 char realm[REALM_SZ];
0311b667 24};
25
26/*
27 * This structure holds all per-client information; one of these is
28 * allocated for each active client.
29 */
5d354f89 30
0fa91a0a 31typedef struct _client {
85330553 32 int con; /* Connection to the client */
5eaef520 33 int id; /* Unique id of client */
34 struct sockaddr_in haddr; /* IP address of client */
35 char clname[MAX_K_NAME_SZ]; /* Name client authenticated to */
36 struct krbname kname; /* Parsed version of the above */
85330553 37 char entity[9]; /* client program being used */
59ec8dae 38 int users_id; /* Moira-internal ID of authenticated user */
85330553 39 int client_id; /* Moira-internal ID of client */
5eaef520 40 time_t last_time_used; /* Last time connection used */
85330553 41 mr_params *tuples; /* Tuples waiting to send back to client */
42 int ntuples; /* Number of tuples waiting */
43 int tuplessize; /* Current size of tuple array */
44 int nexttuple; /* Next tuple to return */
45 int done; /* Close up next time through loop */
0fa91a0a 46} client;
47
85330553 48extern char krb_realm[REALM_SZ];
90052a6f 49
50/* max length of query argument allowed */
9608e722 51#define ARGLEN 257
58e1747c 52/* Used to setup static argv, maximum argc */
bf78bafe 53#define QMAXARGS 22
7a2ebcdf 54
55/* statistics on number of queries by version number */
85330553 56extern int newqueries;
7a2ebcdf 57
fcd67f6a 58/* Maximum and minimum values that will ever be chosen for IDs */
3c8eca90 59#define MAX_ID_VALUE 31999
fcd67f6a 60#define MIN_ID_VALUE 100
87f17989 61
62/* Sleepy states for the server! */
63#define AWAKE 0
64#define SLEEPY 1
65#define ASLEEP 2
66#define GROGGY 3
67extern int dormant;
68
13f6b8bb 69/* state for the incremental update system */
70extern int inc_running, inc_pid;
71extern time_t inc_started, now;
72#define INC_TIMEOUT (3 * 60) /* 3 minutes */
03c05291 73
74
75#define SQL_NO_MATCH 1403 /* oracle, not ingres (= 100) */
76
7ac48069 77/* types needed for prototypes */
78struct query;
79struct validate;
80struct valobj;
81
03c05291 82/* prototypes from increment.dc */
83void incremental_init(void);
84void next_incremental(void);
85void incremental_update(void);
86void incremental_flush(void);
87
88/* prototypes from qrtn.dc */
89void dbmserr(void);
90void dosql(char *buffers[]);
91int mr_open_database(void);
92void mr_close_database(void);
93int mr_process_query(client *cl, char *name, int argc, char *argv_ro[],
7ac48069 94 int (*action)(int, char *[], void *), void *actarg);
03c05291 95int mr_check_access(client *cl, char *name, int argc, char *argv_ro[]);
96void sanity_check_queries(void);
97int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
f3c08a60 98int find_member(char *list_type, int list_id, client *cl);
7ac48069 99int do_for_all_rows(char *query, int count,
100 int (*action)(int, char *[], void *), void *actarg);
101void build_qual(char *fmt, int argc, char *argv[], char *qual);
03c05291 102
103
104/* prototyoes from qsupport.dc */
105int set_pop_usage(int id, int cnt);
106
107/* prototypes from qvalidate.dc */
108void sanity_check_database(void);
109int add_string(char *name);
110int convert_wildcards(char *arg);
111
112/* prototypes from mr_main.c */
113void clist_delete(client *cp);
114
115/* prototypes from mr_sauth.c */
85330553 116void do_auth(client *cl, mr_params req);
03c05291 117
118/* prototypes from mr_scall.c */
85330553 119void do_client(client *cl);
120void client_reply(client *cl, long status);
121void client_return_tuple(client *cl, int argc, char **argv);
122void client_read(client *cl);
123void client_write(client *cl);
03c05291 124
125/* prototypes from mr_shutdown.c */
126void sigshut(int);
127void do_shutdown(client *cl);
128
129/* prototypes from mr_util.c */
130char *requote(char *buf, char *cp, int len);
131void log_args(char *tag, int version, int argc, char **argv);
98a7b0ee 132void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
03c05291 133int mr_trim_args(int argc, char **argv);
134char **mr_copy_args(char **argv, int argc);
85330553 135void *xmalloc(size_t);
136void *xrealloc(void *, size_t);
7ac48069 137
138/* prototypes from qaccess.pc */
139int access_user(struct query *q, char *argv[], client *cl);
140int access_login(struct query *q, char *argv[], client *cl);
141int access_list(struct query *q, char *argv[], client *cl);
142int access_visible_list(struct query *q, char *argv[], client *cl);
143int access_vis_list_by_name(struct query *q, char *argv[], client *cl);
144int access_member(struct query *q, char *argv[], client *cl);
145int access_qgli(struct query *q, char *argv[], client *cl);
146int access_service(struct query *q, char *argv[], client *cl);
147int access_filesys(struct query *q, char *argv[], client *cl);
148int access_host(struct query *q, char *argv[], client *cl);
149int access_ahal(struct query *q, char *argv[], client *cl);
150int access_snt(struct query *q, char *argv[], client *cl);
151
152/* prototypes from qfollow.pc */
153int followup_fix_modby(struct query *q, struct save_queue *sq,
154 struct validate *v, int (*action)(int, char **, void *),
155 void *actarg, client *cl);
156int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
157 int (*action)(int, char **, void *), void *actarg,
158 client *cl);
159int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
160 int (*action)(int, char **, void *), void *actarg,
161 client *cl);
162int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
163 int (*action)(int, char **, void *), void *actarg,
164 client *cl);
165int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
166 int (*action)(int, char **, void *), void *actarg,
167 client *cl);
168int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
169 int (*action)(int, char **, void *), void *actarg,
170 client *cl);
171int followup_gpce(struct query *q, struct save_queue *sq, struct validate *v,
172 int (*action)(int, char **, void *), void *actarg,
173 client *cl);
174int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
175 int (*action)(int, char **, void *), void *actarg,
176 client *cl);
177int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
178 int (*action)(int, char **, void *), void *actarg,
179 client *cl);
180int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
181 int (*action)(int, char **, void *), void *actarg,
182 client *cl);
183
184int followup_ausr(struct query *q, char *argv[], client *cl);
185int followup_aqot(struct query *q, char *argv[], client *cl);
186int followup_dqot(struct query *q, char *argv[], client *cl);
187int followup_uuac(struct query *q, char *argv[], client *cl);
188
189int set_modtime(struct query *q, char *argv[], client *cl);
190int set_modtime_by_id(struct query *q, char *argv[], client *cl);
191int set_finger_modtime(struct query *q, char *argv[], client *cl);
192int set_pobox_modtime(struct query *q, char *argv[], client *cl);
193int set_uppercase_modtime(struct query *q, char *argv[], client *cl);
194int set_mach_modtime_by_id(struct query *q, char *argv[], client *cl);
195int set_cluster_modtime_by_id(struct query *q, char *argv[], client *cl);
196int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
197int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
198int set_filesys_modtime(struct query *q, char *argv[], client *cl);
199int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
200int _sdl_followup(struct query *q, char *argv[], client *cl);
85330553 201int trigger_dcm(struct query *q, char *argv[], client *cl);
7ac48069 202
203/* prototypes from qsetup.pc */
204int prefetch_value(struct query *q, char *argv[], client *cl);
205int prefetch_filesys(struct query *q, char *argv[], client *cl);
206int setup_ausr(struct query *q, char *argv[], client *cl);
207int setup_dusr(struct query *q, char *argv[], client *cl);
208int setup_spop(struct query *q, char *argv[], client *cl);
209int setup_dpob(struct query *q, char *argv[], client *cl);
210int setup_dmac(struct query *q, char *argv[], client *cl);
211int setup_dclu(struct query *q, char *argv[], client *cl);
212int setup_alis(struct query *q, char *argv[], client *cl);
213int setup_dlis(struct query *q, char *argv[], client *cl);
214int setup_dsin(struct query *q, char *argv[], client *cl);
215int setup_dshi(struct query *q, char *argv[], client *cl);
216int setup_afil(struct query *q, char *argv[], client *cl);
217int setup_ufil(struct query *q, char *argv[], client *cl);
218int setup_dfil(struct query *q, char *argv[], client *cl);
219int setup_aftg(struct query *q, char *argv[], client *cl);
220int setup_dnfp(struct query *q, char *argv[], client *cl);
221int setup_dqot(struct query *q, char *argv[], client *cl);
222int setup_akum(struct query *q, char *argv[], client *cl);
223int setup_dsnt(struct query *q, char *argv[], client *cl);
224int setup_ahst(struct query *q, char *argv[], client *cl);
225int setup_ahal(struct query *q, char *argv[], client *cl);
226
227/* prototypes from qsupport.pc */
228int set_pobox(struct query *q, char *argv[], client *cl);
229int add_member_to_list(struct query *q, char *argv[], client *cl);
230int delete_member_from_list(struct query *q, char *argv[], client *cl);
231int register_user(struct query *q, char *argv[], client *cl);
232
233int get_list_info(struct query *q, char **argv, client *cl,
234 int (*action)(int, char *[], void *), void *actarg);
235int get_ace_use(struct query *q, char **argv, client *cl,
236 int (*action)(int, char *[], void *), void *actarg);
237int qualified_get_lists(struct query *q, char **argv, client *cl,
238 int (*action)(int, char *[], void *), void *actarg);
239int get_members_of_list(struct query *q, char **argv, client *cl,
240 int (*action)(int, char *[], void *), void *actarg);
241int get_end_members_of_list(struct query *q, char **argv, client *cl,
242 int (*action)(int, char *[], void *),
243 void *actarg);
244int qualified_get_server(struct query *q, char **argv, client *cl,
245 int (*action)(int, char *[], void *), void *actarg);
246int qualified_get_serverhost(struct query *q, char **argv, client *cl,
247 int (*action)(int, char *[], void *),
248 void *actarg);
249int count_members_of_list(struct query *q, char **argv, client *cl,
250 int (*action)(int, char *[], void *), void *actarg);
251int get_lists_of_member(struct query *q, char **argv, client *cl,
252 int (*action)(int, char *[], void *), void *actarg);
253
254/* prototypes from qvalidate.pc */
255/* from qvalidate.dc */
256int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);
257int validate_row(struct query *q, char *argv[], struct validate *v);
This page took 0.140021 seconds and 5 git commands to generate.