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