]> andersk Git - moira.git/blob - include/moira.h
kill GDSS
[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 "ureg_err.h"
17 #define MR_SUCCESS 0            /* Query was successful */
18
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 */
21
22 /* return values for Moira server calls, used by clients */
23
24 #define MR_CONT 0               /* Everything okay, continue sending values. */
25 #define MR_ABORT -1             /* Something went wrong don't send anymore
26                                    values. */
27
28 #define MOIRA_SNAME     "moira" /* Kerberos service key to use */
29
30 /* Protocol operations */
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
38 #define MR_PROXY 7
39 #define MR_SETVERSION 8
40 #define MR_MAX_PROC 8
41
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
48
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
54 /* Structure used by Save Queue routines (for temporary storage of data) */
55 struct save_queue
56 {
57   struct save_queue *q_next;
58   struct save_queue *q_prev;
59   struct save_queue *q_lastget;
60   void *q_data;
61 };
62
63 /* Hash table declarations */
64 struct bucket {
65   struct bucket *next;
66   int key;
67   void *data;
68 };
69 struct hash {
70   int size;
71   struct bucket **data;
72 };
73
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);
91 void RemoveHyphens(char *str);
92
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
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);
120 void sq_remove_last_data(struct save_queue *sq);
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);
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
134
135 /* mr_ functions */
136 int mr_access(char *handle, int argc, char **argv);
137 int mr_auth(char *prog);
138 int mr_connect(char *server);
139 int mr_disconnect(void);
140 int mr_do_update(void);
141 int mr_host(char *host, int size);
142 int mr_motd(char **motd);
143 int mr_noop(void);
144 int mr_proxy(char *principal, char *orig_authtype);
145 int mr_query(char *handle, int argc, char **argv,
146              int (*callback)(int, char **, void *), void *callarg);
147 int mr_version(int version);
148
149 /* error-name backward compatibility */
150 #define MR_INGRES_ERR           MR_DBMS_ERR
151 #define MR_INGRES_SOFTFAIL      MR_DBMS_SOFTFAIL
152
153
154 #ifdef __GNUC__
155 #if __GNUC_MINOR__ < 7
156 #define __attribute__(x)
157 #endif
158 #else /* ! __GNUC __ */
159 #define __attribute__(x)
160 #endif
161
162 #define RCSID(id) static char *rcsid __attribute__ ((__unused__)) = id
163
164 #endif /* _moira_h_ */          /* Do Not Add Anything after this line. */
This page took 0.080566 seconds and 5 git commands to generate.