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