]> andersk Git - moira.git/blob - include/moira.h
prototype strlcpy/strlcat (if needed)
[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_MAX_PROC 7
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 gdss_convert.c */
94 int gdss2et(int code);
95
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 *),
103                void *hint);
104 void hash_destroy(struct hash *h);
105
106 /* prototypes from kname_unparse.c */
107 char *kname_unparse(char *p, char *i, char *r);
108
109 /* prototypes from nfsparttype.c */
110 char *parse_filesys_type(char *fs_type_name);
111 char *format_filesys_type(char *fs_status);
112
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);
126
127 /* prototypes from strs.c */
128 char *strtrim(char *s);
129 char *uppercase(char *s);
130 char *lowercase(char *s);
131 #ifndef HAVE_STRLCPY
132 size_t strlcpy(char *dst, const char *src, size_t size);
133 #endif
134 #ifndef HAVE_STRLCAT
135 size_t strlcat(char *dst, const char *src, size_t size);
136 #endif
137
138 /* mr_ functions */
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);
147 int mr_noop(void);
148 int mr_query(char *handle, int argc, char **argv,
149              int (*callback)(int, char **, void *), void *callarg);
150
151 /* error-name backward compatibility */
152 #define MR_INGRES_ERR           MR_DBMS_ERR
153 #define MR_INGRES_SOFTFAIL      MR_DBMS_SOFTFAIL
154
155
156 #ifdef __GNUC__
157 #if __GNUC_MINOR__ < 7
158 #define __attribute__(x)
159 #endif
160 #else /* ! __GNUC __ */
161 #define __attribute__(x)
162 #endif
163
164 #define RCSID(id) static char *rcsid __attribute__ ((__unused__)) = id
165
166 #endif /* _moira_h_ */          /* Do Not Add Anything after this line. */
This page took 0.052701 seconds and 5 git commands to generate.