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