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