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