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