]> andersk Git - moira.git/blame - server/mr_server.h
fix RCS Id strings
[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>
9#include <mr_proto.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
c27b3454 18typedef struct returned_tuples {
5eaef520 19 struct returned_tuples *next;
20 OPERATION op;
21 mr_params *retval;
c27b3454 22} returned_tuples;
5dbd09a0 23
0311b667 24/*
25 * This should be in the kerberos header file.
26 */
27
28struct krbname {
5eaef520 29 char name[ANAME_SZ];
30 char inst[INST_SZ];
31 char realm[REALM_SZ];
0311b667 32};
33
34/*
35 * This structure holds all per-client information; one of these is
36 * allocated for each active client.
37 */
5d354f89 38
0fa91a0a 39typedef struct _client {
5eaef520 40 OPERATION pending_op; /* Primary pending operation */
41 CONNECTION con; /* Connection to the client */
42 int action; /* what action is pending? */
43 mr_params *args, reply;
44 int id; /* Unique id of client */
45 struct sockaddr_in haddr; /* IP address of client */
46 char clname[MAX_K_NAME_SZ]; /* Name client authenticated to */
47 struct krbname kname; /* Parsed version of the above */
59ec8dae 48 int users_id; /* Moira-internal ID of authenticated user */
49 int client_id; /* Moira-internal ID of client for modby field */
5eaef520 50 returned_tuples *first, *last;
51 time_t last_time_used; /* Last time connection used */
52 char entity[9]; /* entity on other end of the connection */
0fa91a0a 53} client;
54
55/*
56 * States
57 */
58
59#define CL_DEAD 0
60#define CL_STARTING 1
61
62/*
63 * Actions.
64 */
65
66#define CL_ACCEPT 0
67#define CL_RECEIVE 1
68#define CL_SEND 2
69
0311b667 70extern char *krb_realm;
16904979 71
72/*
73 * Debugging options.
74 */
75
76extern int log_flags;
77
78#define LOG_CONNECT 0x0001
79#define LOG_REQUESTS 0x0002
80#define LOG_ARGS 0x0004
81#define LOG_RESP 0x0008
82#define LOG_RES 0x0010
15516f43 83#define LOG_VALID 0x0020
5264ec89 84#define LOG_SQL 0x0040
85#define LOG_GDSS 0x0080
16904979 86
90052a6f 87
88/* max length of query argument allowed */
9608e722 89#define ARGLEN 257
58e1747c 90/* Used to setup static argv, maximum argc */
bf78bafe 91#define QMAXARGS 22
7a2ebcdf 92
93/* statistics on number of queries by version number */
94extern int newqueries, oldqueries;
95
fcd67f6a 96/* Maximum and minimum values that will ever be chosen for IDs */
3c8eca90 97#define MAX_ID_VALUE 31999
fcd67f6a 98#define MIN_ID_VALUE 100
87f17989 99
100/* Sleepy states for the server! */
101#define AWAKE 0
102#define SLEEPY 1
103#define ASLEEP 2
104#define GROGGY 3
105extern int dormant;
106
13f6b8bb 107/* state for the incremental update system */
108extern int inc_running, inc_pid;
109extern time_t inc_started, now;
110#define INC_TIMEOUT (3 * 60) /* 3 minutes */
03c05291 111
112
113#define SQL_NO_MATCH 1403 /* oracle, not ingres (= 100) */
114
7ac48069 115/* types needed for prototypes */
116struct query;
117struct validate;
118struct valobj;
119
03c05291 120/* prototypes from gdb */
121int gdb_init(void);
122int gdb_debug(int flag);
123void start_accepting_client(CONNECTION, OPERATION, CONNECTION *,
5eaef520 124 char *, int *, TUPLE *);
7ac48069 125int initialize_operation(OPERATION, int (*init_function)(OPERATION, HALF_CONNECTION, void *),
126 char *, int (*cancel_function)(HALF_CONNECTION, void *));
03c05291 127int reset_operation(OPERATION);
128int delete_operation(OPERATION);
129int start_replying_to_client(OPERATION, CONNECTION, int, char *, char *);
130int op_select(LIST_OF_OPERATIONS, int, fd_set *, fd_set *, fd_set *,
131 struct timeval *);
132
03c05291 133/* prototypes from increment.dc */
134void incremental_init(void);
135void next_incremental(void);
136void incremental_update(void);
137void incremental_flush(void);
138
139/* prototypes from qrtn.dc */
140void dbmserr(void);
141void dosql(char *buffers[]);
142int mr_open_database(void);
143void mr_close_database(void);
144int mr_process_query(client *cl, char *name, int argc, char *argv_ro[],
7ac48069 145 int (*action)(int, char *[], void *), void *actarg);
03c05291 146int mr_check_access(client *cl, char *name, int argc, char *argv_ro[]);
147void sanity_check_queries(void);
148int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
f3c08a60 149int find_member(char *list_type, int list_id, client *cl);
7ac48069 150int do_for_all_rows(char *query, int count,
151 int (*action)(int, char *[], void *), void *actarg);
152void build_qual(char *fmt, int argc, char *argv[], char *qual);
03c05291 153
154
155/* prototyoes from qsupport.dc */
156int set_pop_usage(int id, int cnt);
157
158/* prototypes from qvalidate.dc */
159void sanity_check_database(void);
160int add_string(char *name);
161int convert_wildcards(char *arg);
162
163/* prototypes from mr_main.c */
164void clist_delete(client *cp);
165
166/* prototypes from mr_sauth.c */
167void do_auth(client *cl);
168
169/* prototypes from mr_scall.c */
170void do_client(client *cp);
7ac48069 171int trigger_dcm(struct query *q, char *argv[], client *cl);
03c05291 172
173/* prototypes from mr_shutdown.c */
174void sigshut(int);
175void do_shutdown(client *cl);
176
177/* prototypes from mr_util.c */
178char *requote(char *buf, char *cp, int len);
179void log_args(char *tag, int version, int argc, char **argv);
98a7b0ee 180void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
03c05291 181int mr_trim_args(int argc, char **argv);
182char **mr_copy_args(char **argv, int argc);
7ac48069 183
184/* prototypes from qaccess.pc */
185int access_user(struct query *q, char *argv[], client *cl);
186int access_login(struct query *q, char *argv[], client *cl);
187int access_list(struct query *q, char *argv[], client *cl);
188int access_visible_list(struct query *q, char *argv[], client *cl);
189int access_vis_list_by_name(struct query *q, char *argv[], client *cl);
190int access_member(struct query *q, char *argv[], client *cl);
191int access_qgli(struct query *q, char *argv[], client *cl);
192int access_service(struct query *q, char *argv[], client *cl);
193int access_filesys(struct query *q, char *argv[], client *cl);
194int access_host(struct query *q, char *argv[], client *cl);
195int access_ahal(struct query *q, char *argv[], client *cl);
196int access_snt(struct query *q, char *argv[], client *cl);
197
198/* prototypes from qfollow.pc */
199int followup_fix_modby(struct query *q, struct save_queue *sq,
200 struct validate *v, int (*action)(int, char **, void *),
201 void *actarg, client *cl);
202int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
203 int (*action)(int, char **, void *), void *actarg,
204 client *cl);
205int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
206 int (*action)(int, char **, void *), void *actarg,
207 client *cl);
208int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
209 int (*action)(int, char **, void *), void *actarg,
210 client *cl);
211int followup_gsha(struct query *q, struct save_queue *sq, struct validate *v,
212 int (*action)(int, char **, void *), void *actarg,
213 client *cl);
214int followup_gqot(struct query *q, struct save_queue *sq, struct validate *v,
215 int (*action)(int, char **, void *), void *actarg,
216 client *cl);
217int followup_gpce(struct query *q, struct save_queue *sq, struct validate *v,
218 int (*action)(int, char **, void *), void *actarg,
219 client *cl);
220int followup_guax(struct query *q, struct save_queue *sq, struct validate *v,
221 int (*action)(int, char **, void *), void *actarg,
222 client *cl);
223int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
224 int (*action)(int, char **, void *), void *actarg,
225 client *cl);
226int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
227 int (*action)(int, char **, void *), void *actarg,
228 client *cl);
229
230int followup_ausr(struct query *q, char *argv[], client *cl);
231int followup_aqot(struct query *q, char *argv[], client *cl);
232int followup_dqot(struct query *q, char *argv[], client *cl);
233int followup_uuac(struct query *q, char *argv[], client *cl);
234
235int set_modtime(struct query *q, char *argv[], client *cl);
236int set_modtime_by_id(struct query *q, char *argv[], client *cl);
237int set_finger_modtime(struct query *q, char *argv[], client *cl);
238int set_pobox_modtime(struct query *q, char *argv[], client *cl);
239int set_uppercase_modtime(struct query *q, char *argv[], client *cl);
240int set_mach_modtime_by_id(struct query *q, char *argv[], client *cl);
241int set_cluster_modtime_by_id(struct query *q, char *argv[], client *cl);
242int set_serverhost_modtime(struct query *q, char *argv[], client *cl);
243int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
244int set_filesys_modtime(struct query *q, char *argv[], client *cl);
245int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
246int _sdl_followup(struct query *q, char *argv[], client *cl);
247
248/* prototypes from qsetup.pc */
249int prefetch_value(struct query *q, char *argv[], client *cl);
250int prefetch_filesys(struct query *q, char *argv[], client *cl);
251int setup_ausr(struct query *q, char *argv[], client *cl);
252int setup_dusr(struct query *q, char *argv[], client *cl);
253int setup_spop(struct query *q, char *argv[], client *cl);
254int setup_dpob(struct query *q, char *argv[], client *cl);
255int setup_dmac(struct query *q, char *argv[], client *cl);
256int setup_dclu(struct query *q, char *argv[], client *cl);
257int setup_alis(struct query *q, char *argv[], client *cl);
258int setup_dlis(struct query *q, char *argv[], client *cl);
259int setup_dsin(struct query *q, char *argv[], client *cl);
260int setup_dshi(struct query *q, char *argv[], client *cl);
261int setup_afil(struct query *q, char *argv[], client *cl);
262int setup_ufil(struct query *q, char *argv[], client *cl);
263int setup_dfil(struct query *q, char *argv[], client *cl);
264int setup_aftg(struct query *q, char *argv[], client *cl);
265int setup_dnfp(struct query *q, char *argv[], client *cl);
266int setup_dqot(struct query *q, char *argv[], client *cl);
267int setup_akum(struct query *q, char *argv[], client *cl);
268int setup_dsnt(struct query *q, char *argv[], client *cl);
269int setup_ahst(struct query *q, char *argv[], client *cl);
270int setup_ahal(struct query *q, char *argv[], client *cl);
271
272/* prototypes from qsupport.pc */
273int set_pobox(struct query *q, char *argv[], client *cl);
274int add_member_to_list(struct query *q, char *argv[], client *cl);
275int delete_member_from_list(struct query *q, char *argv[], client *cl);
276int register_user(struct query *q, char *argv[], client *cl);
277
278int get_list_info(struct query *q, char **argv, client *cl,
279 int (*action)(int, char *[], void *), void *actarg);
280int get_ace_use(struct query *q, char **argv, client *cl,
281 int (*action)(int, char *[], void *), void *actarg);
282int qualified_get_lists(struct query *q, char **argv, client *cl,
283 int (*action)(int, char *[], void *), void *actarg);
284int get_members_of_list(struct query *q, char **argv, client *cl,
285 int (*action)(int, char *[], void *), void *actarg);
286int get_end_members_of_list(struct query *q, char **argv, client *cl,
287 int (*action)(int, char *[], void *),
288 void *actarg);
289int qualified_get_server(struct query *q, char **argv, client *cl,
290 int (*action)(int, char *[], void *), void *actarg);
291int qualified_get_serverhost(struct query *q, char **argv, client *cl,
292 int (*action)(int, char *[], void *),
293 void *actarg);
294int count_members_of_list(struct query *q, char **argv, client *cl,
295 int (*action)(int, char *[], void *), void *actarg);
296int get_lists_of_member(struct query *q, char **argv, client *cl,
297 int (*action)(int, char *[], void *), void *actarg);
298
299/* prototypes from qvalidate.pc */
300/* from qvalidate.dc */
301int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);
302int validate_row(struct query *q, char *argv[], struct validate *v);
This page took 0.141739 seconds and 5 git commands to generate.