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