]> andersk Git - moira.git/blame - server/mr_server.h
Move UNIX->SQL wildcard conversion from the validation stage to the
[moira.git] / server / mr_server.h
CommitLineData
eab30d01 1/*
2 * $Source$
3 * $Author$
4 * $Header$
5 *
6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 *
eab30d01 8 */
9
5dbd09a0 10#include <sys/types.h>
11#include <sys/uio.h>
12#include <sys/socket.h>
13#include <netinet/in.h>
d548a4e7 14#include "mr_proto.h"
15#include <moira_site.h>
0311b667 16#include <krb.h>
03c05291 17#include <com_err.h>
18#include <stdlib.h>
98a7b0ee 19#include <stdarg.h>
5dbd09a0 20
c27b3454 21typedef struct returned_tuples {
22 struct returned_tuples *next;
23 OPERATION op;
d548a4e7 24 mr_params *retval;
c27b3454 25} returned_tuples;
5dbd09a0 26
0311b667 27/*
28 * This should be in the kerberos header file.
29 */
30
31struct krbname {
32 char name[ANAME_SZ];
33 char inst[INST_SZ];
34 char realm[REALM_SZ];
35};
36
37/*
38 * This structure holds all per-client information; one of these is
39 * allocated for each active client.
40 */
5d354f89 41
0fa91a0a 42typedef struct _client {
0311b667 43 OPERATION pending_op; /* Primary pending operation */
44 CONNECTION con; /* Connection to the client */
0311b667 45 int action; /* what action is pending? */
d548a4e7 46 mr_params *args, reply;
eab30d01 47 int id; /* Unique id of client */
0311b667 48 struct sockaddr_in haddr; /* IP address of client */
5d354f89 49 char clname[MAX_K_NAME_SZ];/* Name client authenticated to */
0311b667 50 struct krbname kname; /* Parsed version of the above */
d548a4e7 51 int users_id; /* MR internal ID of authenticated user */
52 int client_id; /* MR internal ID of client for modby field */
c27b3454 53 returned_tuples *first, *last;
50f51267 54 time_t last_time_used; /* Last time connection used */
5d354f89 55 char entity[9]; /* entity on other end of the connection */
0fa91a0a 56} client;
57
58/*
59 * States
60 */
61
62#define CL_DEAD 0
63#define CL_STARTING 1
64
65/*
66 * Actions.
67 */
68
69#define CL_ACCEPT 0
70#define CL_RECEIVE 1
71#define CL_SEND 2
72
0311b667 73extern char *krb_realm;
16904979 74
75/*
76 * Debugging options.
77 */
78
79extern int log_flags;
80
81#define LOG_CONNECT 0x0001
82#define LOG_REQUESTS 0x0002
83#define LOG_ARGS 0x0004
84#define LOG_RESP 0x0008
85#define LOG_RES 0x0010
15516f43 86#define LOG_VALID 0x0020
5264ec89 87#define LOG_SQL 0x0040
88#define LOG_GDSS 0x0080
16904979 89
90052a6f 90
91/* max length of query argument allowed */
9608e722 92#define ARGLEN 257
58e1747c 93/* Used to setup static argv, maximum argc */
bf78bafe 94#define QMAXARGS 22
7a2ebcdf 95
96/* statistics on number of queries by version number */
97extern int newqueries, oldqueries;
98
fcd67f6a 99/* Maximum and minimum values that will ever be chosen for IDs */
3c8eca90 100#define MAX_ID_VALUE 31999
fcd67f6a 101#define MIN_ID_VALUE 100
87f17989 102
103/* Sleepy states for the server! */
104#define AWAKE 0
105#define SLEEPY 1
106#define ASLEEP 2
107#define GROGGY 3
108extern int dormant;
109
13f6b8bb 110/* state for the incremental update system */
111extern int inc_running, inc_pid;
112extern time_t inc_started, now;
113#define INC_TIMEOUT (3 * 60) /* 3 minutes */
03c05291 114
115
116#define SQL_NO_MATCH 1403 /* oracle, not ingres (= 100) */
117
118/* prototypes from gdb */
119int gdb_init(void);
120int gdb_debug(int flag);
121void start_accepting_client(CONNECTION, OPERATION, CONNECTION *,
122 char *, int*, TUPLE *);
123int initialize_operation(OPERATION, int (*init_function)(), char *,
124 int (*cancel_function)());
125int reset_operation(OPERATION);
126int delete_operation(OPERATION);
127int start_replying_to_client(OPERATION, CONNECTION, int, char *, char *);
128int op_select(LIST_OF_OPERATIONS, int, fd_set *, fd_set *, fd_set *,
129 struct timeval *);
130
131/* prototypes from libmoira */
132struct save_queue *sq_create(void);
960b073b 133int sq_save_data(struct save_queue *sq, void *data);
134int sq_save_unique_data(struct save_queue *sq, void *data);
135int sq_save_args(int argc, void *argv[], struct save_queue *sq);
03c05291 136int sq_get_data(struct save_queue *sq, void *data);
137int sq_remove_data(struct save_queue *sq, void *data);
138int sq_empty(struct save_queue *sq);
139void sq_destroy(struct save_queue *sq);
140
141void send_zgram(char *instance, char *buf);
142void critical_alert(char *, char *, ...);
143void mr_destroy_reply(mr_params *reply);
144int gdss2et(int);
145
146/* prototypes from increment.dc */
147void incremental_init(void);
148void next_incremental(void);
149void incremental_update(void);
150void incremental_flush(void);
151
152/* prototypes from qrtn.dc */
153void dbmserr(void);
154void dosql(char *buffers[]);
155int mr_open_database(void);
156void mr_close_database(void);
157int mr_process_query(client *cl, char *name, int argc, char *argv_ro[],
158 int (*action)(), char *actarg);
159int mr_check_access(client *cl, char *name, int argc, char *argv_ro[]);
160void sanity_check_queries(void);
161int set_krb_mapping(char *name, char *login, int ok, int *kid, int *uid);
f3c08a60 162int find_member(char *list_type, int list_id, client *cl);
03c05291 163int do_for_all_rows(char *query, int count, int (*action)(), int actarg);
60140d51 164char *build_qual(char *fmt, int argc, char *argv[]);
03c05291 165
166
167/* prototyoes from qsupport.dc */
168int set_pop_usage(int id, int cnt);
169
170/* prototypes from qvalidate.dc */
171void sanity_check_database(void);
172int add_string(char *name);
03c05291 173
174/* prototypes from mr_main.c */
175void clist_delete(client *cp);
176
177/* prototypes from mr_sauth.c */
178void do_auth(client *cl);
179
180/* prototypes from mr_scall.c */
181void do_client(client *cp);
182int trigger_dcm(int dummy0, int dummy1, client *cl);
183
184/* prototypes from mr_shutdown.c */
185void sigshut(int);
186void do_shutdown(client *cl);
187
188/* prototypes from mr_util.c */
189char *requote(char *buf, char *cp, int len);
190void log_args(char *tag, int version, int argc, char **argv);
98a7b0ee 191void mr_com_err(const char *whoami, long code, const char *fmt, va_list pvar);
03c05291 192int mr_trim_args(int argc, char **argv);
193char **mr_copy_args(char **argv, int argc);
This page took 1.203491 seconds and 5 git commands to generate.