]>
Commit | Line | Data |
---|---|---|
1 | /* $Id$ | |
2 | * | |
3 | * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology | |
4 | * | |
5 | */ | |
6 | ||
7 | #ifndef _moira_h_ | |
8 | #define _moira_h_ | |
9 | ||
10 | #ifdef _WIN32 | |
11 | #include <windows.h> | |
12 | #ifndef strcasecmp | |
13 | #define strcasecmp stricmp | |
14 | #endif | |
15 | #ifndef snprintf | |
16 | #define snprintf _snprintf | |
17 | #endif | |
18 | #endif /*_WIN32 */ | |
19 | ||
20 | /* return values from queries (and error codes) */ | |
21 | #include <sys/types.h> | |
22 | #include <com_err.h> | |
23 | #include "mr_et.h" | |
24 | #include "krb_et.h" | |
25 | #include "ureg_err.h" | |
26 | ||
27 | #define MR_SUCCESS 0 /* Query was successful */ | |
28 | ||
29 | #define MR_VERSION_1 1 /* Version in use from 7/87 to 4/88 */ | |
30 | #define MR_VERSION_2 2 /* After 4/88, new query lib */ | |
31 | ||
32 | /* return values for Moira server calls, used by clients */ | |
33 | ||
34 | #define MR_CONT 0 /* Everything okay, continue sending values. */ | |
35 | #define MR_ABORT -1 /* Something went wrong don't send anymore | |
36 | values. */ | |
37 | ||
38 | #define MOIRA_SNAME "moira" /* Kerberos service key to use */ | |
39 | ||
40 | /* Protocol operations */ | |
41 | #define MR_NOOP 0 | |
42 | #define MR_AUTH 1 | |
43 | #define MR_SHUTDOWN 2 | |
44 | #define MR_QUERY 3 | |
45 | #define MR_ACCESS 4 | |
46 | #define MR_DO_UPDATE 5 | |
47 | #define MR_MOTD 6 | |
48 | #define MR_PROXY 7 | |
49 | #define MR_SETVERSION 8 | |
50 | #define MR_MAX_PROC 8 | |
51 | ||
52 | /* values used in NFS physical flags */ | |
53 | #define MR_FS_STUDENT 0x0001 | |
54 | #define MR_FS_FACULTY 0x0002 | |
55 | #define MR_FS_STAFF 0x0004 | |
56 | #define MR_FS_MISC 0x0008 | |
57 | #define MR_FS_GROUPQUOTA 0x0010 | |
58 | ||
59 | /* magic values to pass for list and user queries */ | |
60 | #define UNIQUE_GID "create unique GID" | |
61 | #define UNIQUE_UID "create unique UID" | |
62 | #define UNIQUE_LOGIN "create unique login ID" | |
63 | ||
64 | /* Structure used by Save Queue routines (for temporary storage of data) */ | |
65 | struct save_queue | |
66 | { | |
67 | struct save_queue *q_next; | |
68 | struct save_queue *q_prev; | |
69 | struct save_queue *q_lastget; | |
70 | void *q_data; | |
71 | }; | |
72 | ||
73 | /* Hash table declarations */ | |
74 | struct bucket { | |
75 | struct bucket *next; | |
76 | int key; | |
77 | void *data; | |
78 | }; | |
79 | struct hash { | |
80 | int size; | |
81 | struct bucket **data; | |
82 | }; | |
83 | ||
84 | /* prototypes from critical.c */ | |
85 | void critical_alert(char *instance, char *msg, ...); | |
86 | void send_zgram(char *inst, char *msg); | |
87 | ||
88 | /* prototypes from fixhost.c */ | |
89 | char *canonicalize_hostname(char *s); | |
90 | ||
91 | /* prototypes from fixname.c */ | |
92 | void FixName(char *ilnm, char *ifnm, char *last, char *first, char *middle); | |
93 | void FixCase(char *p); | |
94 | void LookForJrAndIII(char *nm, int *pends_jr, int *pends_sr, | |
95 | int *pends_ii, int *pends_iii, | |
96 | int *pends_iv, int *pends_v); | |
97 | void LookForSt(char *nm); | |
98 | void LookForO(char *nm); | |
99 | void TrimTrailingSpace(char *ip); | |
100 | void GetMidInit(char *nm, char *mi); | |
101 | void RemoveHyphens(char *str); | |
102 | ||
103 | /* prototypes from hash.c */ | |
104 | struct hash *create_hash(int size); | |
105 | void *hash_lookup(struct hash *h, int key); | |
106 | int hash_update(struct hash *h, int key, void *value); | |
107 | int hash_store(struct hash *h, int key, void *value); | |
108 | void hash_search(struct hash *h, void *value, void (*callback)(int)); | |
109 | void hash_step(struct hash *h, void (*callback)(int, void *, void *), | |
110 | void *hint); | |
111 | void hash_destroy(struct hash *h); | |
112 | ||
113 | /* prototypes from kname_unparse.c */ | |
114 | char *kname_unparse(char *p, char *i, char *r); | |
115 | ||
116 | /* prototypes from nfsparttype.c */ | |
117 | char *parse_filesys_type(char *fs_type_name); | |
118 | char *format_filesys_type(char *fs_status); | |
119 | ||
120 | /* prototypes from sq.c */ | |
121 | struct save_queue *sq_create(void); | |
122 | int sq_save_data(struct save_queue *sq, void *data); | |
123 | int sq_save_args(int argc, char *argv[], struct save_queue *sq); | |
124 | int sq_save_unique_data(struct save_queue *sq, void *data); | |
125 | int sq_save_unique_string(struct save_queue *sq, char *data); | |
126 | /* in sq_get_data and sq_remove_data, the `data' arg should be a | |
127 | pointer to a pointer */ | |
128 | int sq_get_data(struct save_queue *sq, void *data); | |
129 | int sq_remove_data(struct save_queue *sq, void *data); | |
130 | void sq_remove_last_data(struct save_queue *sq); | |
131 | int sq_empty(struct save_queue *sq); | |
132 | void sq_destroy(struct save_queue *sq); | |
133 | ||
134 | /* prototypes from strs.c */ | |
135 | char *strtrim(char *s); | |
136 | char *uppercase(char *s); | |
137 | char *lowercase(char *s); | |
138 | ||
139 | #ifndef HAVE_STRLCPY | |
140 | size_t strlcpy(char *dst, const char *src, size_t size); | |
141 | #endif | |
142 | #ifndef HAVE_STRLCAT | |
143 | size_t strlcat(char *dst, const char *src, size_t size); | |
144 | #endif | |
145 | ||
146 | /* mr_ functions */ | |
147 | int mr_access(char *handle, int argc, char **argv); | |
148 | int mr_auth(char *prog); | |
149 | int mr_connect(char *server); | |
150 | int mr_disconnect(void); | |
151 | int mr_do_update(void); | |
152 | int mr_host(char *host, int size); | |
153 | int mr_motd(char **motd); | |
154 | int mr_noop(void); | |
155 | int mr_proxy(char *principal, char *orig_authtype); | |
156 | int mr_query(char *handle, int argc, char **argv, | |
157 | int (*callback)(int, char **, void *), void *callarg); | |
158 | int mr_version(int version); | |
159 | ||
160 | /* error-name backward compatibility */ | |
161 | #define MR_INGRES_ERR MR_DBMS_ERR | |
162 | #define MR_INGRES_SOFTFAIL MR_DBMS_SOFTFAIL | |
163 | ||
164 | ||
165 | #ifdef __GNUC__ | |
166 | #if __GNUC_MINOR__ < 7 | |
167 | #define __attribute__(x) | |
168 | #endif | |
169 | #else /* ! __GNUC __ */ | |
170 | #define __attribute__(x) | |
171 | #endif | |
172 | ||
173 | #define RCSID(id) static char *rcsid __attribute__ ((__unused__)) = id | |
174 | ||
175 | #endif /* _moira_h_ */ /* Do Not Add Anything after this line. */ |