3 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
10 /* return values from queries (and error codes) */
12 #include <sys/types.h>
18 #define MR_SUCCESS 0 /* Query was successful */
20 #define MR_VERSION_1 1 /* Version in use from 7/87 to 4/88 */
21 #define MR_VERSION_2 2 /* After 4/88, new query lib */
23 /* return values for Moira server calls, used by clients */
25 #define MR_CONT 0 /* Everything okay, continue sending values. */
26 #define MR_ABORT -1 /* Something went wrong don't send anymore
29 #define MOIRA_SNAME "moira" /* Kerberos service key to use */
31 /* Protocol operations */
37 #define MR_DO_UPDATE 5
42 /* values used in NFS physical flags */
43 #define MR_FS_STUDENT 0x0001
44 #define MR_FS_FACULTY 0x0002
45 #define MR_FS_STAFF 0x0004
46 #define MR_FS_MISC 0x0008
47 #define MR_FS_GROUPQUOTA 0x0010
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"
54 /* Structure used by Save Queue routines (for temporary storage of data) */
57 struct save_queue *q_next;
58 struct save_queue *q_prev;
59 struct save_queue *q_lastget;
63 /* Hash table declarations */
74 /* prototypes from critical.c */
75 void critical_alert(char *instance, char *msg, ...);
76 void send_zgram(char *inst, char *msg);
78 /* prototypes from fixhost.c */
79 char *canonicalize_hostname(char *s);
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);
91 void RemoveHyphens(char *str);
93 /* prototypes from gdss_convert.c */
94 int gdss2et(int code);
96 /* prototypes from hash.c */
97 struct hash *create_hash(int size);
98 void *hash_lookup(struct hash *h, int key);
99 int hash_update(struct hash *h, int key, void *value);
100 int hash_store(struct hash *h, int key, void *value);
101 void hash_search(struct hash *h, void *value, void (*callback)(int));
102 void hash_step(struct hash *h, void (*callback)(int, void *, void *),
104 void hash_destroy(struct hash *h);
106 /* prototypes from kname_unparse.c */
107 char *kname_unparse(char *p, char *i, char *r);
109 /* prototypes from nfsparttype.c */
110 char *parse_filesys_type(char *fs_type_name);
111 char *format_filesys_type(char *fs_status);
113 /* prototypes from sq.c */
114 struct save_queue *sq_create(void);
115 int sq_save_data(struct save_queue *sq, void *data);
116 int sq_save_args(int argc, char *argv[], struct save_queue *sq);
117 int sq_save_unique_data(struct save_queue *sq, void *data);
118 int sq_save_unique_string(struct save_queue *sq, char *data);
119 /* in sq_get_data and sq_remove_data, the `data' arg should be a
120 pointer to a pointer */
121 int sq_get_data(struct save_queue *sq, void *data);
122 int sq_remove_data(struct save_queue *sq, void *data);
123 void sq_remove_last_data(struct save_queue *sq);
124 int sq_empty(struct save_queue *sq);
125 void sq_destroy(struct save_queue *sq);
127 /* prototypes from strs.c */
128 char *strtrim(char *s);
129 char *uppercase(char *s);
130 char *lowercase(char *s);
132 size_t strlcpy(char *dst, const char *src, size_t size);
135 size_t strlcat(char *dst, const char *src, size_t size);
139 int mr_access(char *handle, int argc, char **argv);
140 int mr_auth(char *prog);
141 int mr_proxy(char *principal, char *orig_authtype);
142 int mr_connect(char *server);
143 int mr_disconnect(void);
144 int mr_do_update(void);
145 int mr_host(char *host, int size);
146 int mr_motd(char **motd);
148 int mr_query(char *handle, int argc, char **argv,
149 int (*callback)(int, char **, void *), void *callarg);
151 /* error-name backward compatibility */
152 #define MR_INGRES_ERR MR_DBMS_ERR
153 #define MR_INGRES_SOFTFAIL MR_DBMS_SOFTFAIL
157 #if __GNUC_MINOR__ < 7
158 #define __attribute__(x)
160 #else /* ! __GNUC __ */
161 #define __attribute__(x)
164 #define RCSID(id) static char *rcsid __attribute__ ((__unused__)) = id
166 #endif /* _moira_h_ */ /* Do Not Add Anything after this line. */