]>
Commit | Line | Data |
---|---|---|
7ac48069 | 1 | /* $Id$ |
6d409214 | 2 | * |
7ac48069 | 3 | * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology |
6d409214 | 4 | * |
6d409214 | 5 | */ |
6 | ||
b3c011db | 7 | #ifndef _moira_h_ |
8 | #define _moira_h_ | |
ebf77ded | 9 | |
533bacb3 | 10 | #ifdef _WIN32 |
11 | #include <windows.h> | |
12 | #ifndef strcasecmp | |
13 | #define strcasecmp stricmp | |
14 | #endif | |
1a6e5286 | 15 | #ifndef snprintf |
16 | #define snprintf _snprintf | |
17 | #endif | |
533bacb3 | 18 | #endif /*_WIN32 */ |
ac3530a2 | 19 | |
533bacb3 | 20 | /* return values from queries (and error codes) */ |
0e87a287 | 21 | #include <sys/types.h> |
7ac48069 | 22 | #include <com_err.h> |
8defc06b | 23 | #include "mr_et.h" |
7ac48069 | 24 | #include "krb_et.h" |
7ac48069 | 25 | #include "ureg_err.h" |
533bacb3 | 26 | |
b3c011db | 27 | #define MR_SUCCESS 0 /* Query was successful */ |
0fa91a0a | 28 | |
b3c011db | 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 */ | |
0fa91a0a | 31 | |
8defc06b | 32 | /* return values for Moira server calls, used by clients */ |
ebf77ded | 33 | |
b3c011db | 34 | #define MR_CONT 0 /* Everything okay, continue sending values. */ |
35 | #define MR_ABORT -1 /* Something went wrong don't send anymore | |
ebf77ded | 36 | values. */ |
37 | ||
311f6975 | 38 | #define MOIRA_SNAME "moira" /* Kerberos service key to use */ |
39 | ||
ac3530a2 | 40 | /* Protocol operations */ |
b3c011db | 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 | |
e586854a | 48 | #define MR_PROXY 7 |
7332134b | 49 | #define MR_SETVERSION 8 |
50 | #define MR_MAX_PROC 8 | |
1a1fe0bc | 51 | |
ac3530a2 | 52 | /* values used in NFS physical flags */ |
b3c011db | 53 | #define MR_FS_STUDENT 0x0001 |
54 | #define MR_FS_FACULTY 0x0002 | |
55 | #define MR_FS_STAFF 0x0004 | |
56 | #define MR_FS_MISC 0x0008 | |
936af1a7 | 57 | #define MR_FS_GROUPQUOTA 0x0010 |
f4a12540 | 58 | |
ac3530a2 | 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 | ||
ea7f8538 | 64 | /* Structure used by Save Queue routines (for temporary storage of data) */ |
65 | struct save_queue | |
66 | { | |
7ac48069 | 67 | struct save_queue *q_next; |
68 | struct save_queue *q_prev; | |
69 | struct save_queue *q_lastget; | |
70 | void *q_data; | |
ea7f8538 | 71 | }; |
72 | ||
73 | /* Hash table declarations */ | |
74 | struct bucket { | |
7ac48069 | 75 | struct bucket *next; |
76 | int key; | |
77 | void *data; | |
ea7f8538 | 78 | }; |
79 | struct hash { | |
7ac48069 | 80 | int size; |
81 | struct bucket **data; | |
ea7f8538 | 82 | }; |
ac3530a2 | 83 | |
7ac48069 | 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); | |
cbd64bea | 101 | void RemoveHyphens(char *str); |
7ac48069 | 102 | |
7ac48069 | 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 | ||
7ac48069 | 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); | |
444b050f | 130 | void sq_remove_last_data(struct save_queue *sq); |
7ac48069 | 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); | |
533bacb3 | 138 | |
0e87a287 | 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 | |
7ac48069 | 145 | |
146 | /* mr_ functions */ | |
147 | int mr_access(char *handle, int argc, char **argv); | |
148 | int mr_auth(char *prog); | |
b3c011db | 149 | int mr_connect(char *server); |
7ac48069 | 150 | int mr_disconnect(void); |
151 | int mr_do_update(void); | |
b3c011db | 152 | int mr_host(char *host, int size); |
843d19d8 | 153 | int mr_motd(char **motd); |
7ac48069 | 154 | int mr_noop(void); |
7332134b | 155 | int mr_proxy(char *principal, char *orig_authtype); |
b3c011db | 156 | int mr_query(char *handle, int argc, char **argv, |
7ac48069 | 157 | int (*callback)(int, char **, void *), void *callarg); |
7332134b | 158 | int mr_version(int version); |
ebf77ded | 159 | |
2043da3e | 160 | /* error-name backward compatibility */ |
161 | #define MR_INGRES_ERR MR_DBMS_ERR | |
162 | #define MR_INGRES_SOFTFAIL MR_DBMS_SOFTFAIL | |
163 | ||
7ac48069 | 164 | |
ea0caf4a | 165 | #ifdef __GNUC__ |
166 | #if __GNUC_MINOR__ < 7 | |
167 | #define __attribute__(x) | |
168 | #endif | |
169 | #else /* ! __GNUC __ */ | |
7ac48069 | 170 | #define __attribute__(x) |
171 | #endif | |
172 | ||
173 | #define RCSID(id) static char *rcsid __attribute__ ((__unused__)) = id | |
174 | ||
3fcd2703 | 175 | #endif /* _moira_h_ */ /* Do Not Add Anything after this line. */ |