]>
Commit | Line | Data |
---|---|---|
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> |
e448f08d | 17 | #include "malloc.h" |
5dbd09a0 | 18 | |
c27b3454 | 19 | typedef struct returned_tuples { |
20 | struct returned_tuples *next; | |
21 | OPERATION op; | |
d548a4e7 | 22 | mr_params *retval; |
c27b3454 | 23 | } returned_tuples; |
5dbd09a0 | 24 | |
0311b667 | 25 | /* |
26 | * This should be in the kerberos header file. | |
27 | */ | |
28 | ||
29 | struct krbname { | |
30 | char name[ANAME_SZ]; | |
31 | char inst[INST_SZ]; | |
32 | char realm[REALM_SZ]; | |
33 | }; | |
34 | ||
35 | /* | |
36 | * This structure holds all per-client information; one of these is | |
37 | * allocated for each active client. | |
38 | */ | |
5d354f89 | 39 | |
0fa91a0a | 40 | typedef struct _client { |
0311b667 | 41 | OPERATION pending_op; /* Primary pending operation */ |
42 | CONNECTION con; /* Connection to the client */ | |
0311b667 | 43 | int action; /* what action is pending? */ |
d548a4e7 | 44 | mr_params *args, reply; |
eab30d01 | 45 | int id; /* Unique id of client */ |
0311b667 | 46 | struct sockaddr_in haddr; /* IP address of client */ |
5d354f89 | 47 | char clname[MAX_K_NAME_SZ];/* Name client authenticated to */ |
0311b667 | 48 | struct krbname kname; /* Parsed version of the above */ |
d548a4e7 | 49 | int users_id; /* MR internal ID of authenticated user */ |
50 | int client_id; /* MR internal ID of client for modby field */ | |
c27b3454 | 51 | returned_tuples *first, *last; |
50f51267 | 52 | time_t last_time_used; /* Last time connection used */ |
5d354f89 | 53 | char entity[9]; /* entity on other end of the connection */ |
0fa91a0a | 54 | } client; |
55 | ||
56 | /* | |
57 | * States | |
58 | */ | |
59 | ||
60 | #define CL_DEAD 0 | |
61 | #define CL_STARTING 1 | |
62 | ||
63 | /* | |
64 | * Actions. | |
65 | */ | |
66 | ||
67 | #define CL_ACCEPT 0 | |
68 | #define CL_RECEIVE 1 | |
69 | #define CL_SEND 2 | |
70 | ||
0311b667 | 71 | extern char *krb_realm; |
16904979 | 72 | |
73 | /* | |
74 | * Debugging options. | |
75 | */ | |
76 | ||
77 | extern int log_flags; | |
78 | ||
79 | #define LOG_CONNECT 0x0001 | |
80 | #define LOG_REQUESTS 0x0002 | |
81 | #define LOG_ARGS 0x0004 | |
82 | #define LOG_RESP 0x0008 | |
83 | #define LOG_RES 0x0010 | |
15516f43 | 84 | #define LOG_VALID 0x0020 |
5264ec89 | 85 | #define LOG_SQL 0x0040 |
86 | #define LOG_GDSS 0x0080 | |
16904979 | 87 | |
90052a6f | 88 | |
89 | /* max length of query argument allowed */ | |
9608e722 | 90 | #define ARGLEN 257 |
58e1747c | 91 | /* Used to setup static argv, maximum argc */ |
bf78bafe | 92 | #define QMAXARGS 22 |
7a2ebcdf | 93 | |
94 | /* statistics on number of queries by version number */ | |
95 | extern int newqueries, oldqueries; | |
96 | ||
fcd67f6a | 97 | /* Maximum and minimum values that will ever be chosen for IDs */ |
3c8eca90 | 98 | #define MAX_ID_VALUE 31999 |
fcd67f6a | 99 | #define MIN_ID_VALUE 100 |
87f17989 | 100 | |
101 | /* Sleepy states for the server! */ | |
102 | #define AWAKE 0 | |
103 | #define SLEEPY 1 | |
104 | #define ASLEEP 2 | |
105 | #define GROGGY 3 | |
106 | extern int dormant; | |
107 | ||
13f6b8bb | 108 | /* state for the incremental update system */ |
109 | extern int inc_running, inc_pid; | |
110 | extern time_t inc_started, now; | |
111 | #define INC_TIMEOUT (3 * 60) /* 3 minutes */ |