]> andersk Git - moira.git/blame - man/moira.3
Diane Delgado's changes for a fixed table-locking order
[moira.git] / man / moira.3
CommitLineData
2ad0a777 1.TH MOIRA 3 "8 Jan 1989"
0a796925 2.FM mit
3.SH NAME
2ad0a777 4mr_connect, mr_host, mr_auth, mr_disconnect, mr_noop, mr_access,
5mr_query, mr_do_update, mr_motd, mr_set_alternate_input,
7ad50c73 6format_filesys_type, parse_filesys_type,
0a796925 7canonicalize_hostname, strsave, strtrim, sq_create, sq_destroy,
2ed13b51 8sq_get_data, sq_remove_data, sq_empty, sq_save_args, sq_save_data,
9sq_save_unique_data, sq_save_unique_string
0a796925 10.SH SYNOPSIS
11.nf
12.nj
13.TP
14Protocol functions
2ad0a777 15.B #include <moira.h>
0a796925 16
2ad0a777 17.B int mr_connect(server);
0a796925 18.B char *server;
19
2ad0a777 20.B int mr_host(host, size);
5498c996 21.B char *server;
22
2ad0a777 23.B int mr_motd(motd);
ca170892 24.B char **motd;
25
2ad0a777 26.B int mr_auth(prog);
0a796925 27.B char *prog;
28
2ad0a777 29.B int mr_disconnect();
0a796925 30
2ad0a777 31.B int mr_noop();
0a796925 32
2ad0a777 33.B int mr_access(name, argc, argv);
0a796925 34.B char *name;
35.B int argc;
36.B char **argv;
37
2ad0a777 38.B int mr_query(name, argc, argv, callproc, callarg);
0a796925 39.B char *name;
40.B int argc;
41.B char **argv;
42.B int (*callproc)(int, char **, char *);
43.B char *callarg;
44
2ad0a777 45.B int mr_do_update();
7ad50c73 46
2ad0a777 47.B int mr_set_alternate_input(fd, proc)
7ad50c73 48.B int fd;
49.B void (*proc)();
0a796925 50.TP
51Data manipulation
52.B char *format_filesys_type(fs_status);
53.B char *fs_status;
54
55.B char *parse_filesys_type(fs_type_name);
56.B char *fs_type_name;
57
58.B char *canonicalize_hostname(host);
59.B char *host;
60
61.B char *strsave(s);
62.B char *s;
63
64.B char *strtrim(s);
65.B char *s;
66.TP
67Simple Queues
68.B struct save_queue *sq_create();
69
70.B sq_destroy(sq);
71.B struct save_queue *sq;
72
73.B int sq_get_data(sq, data);
74.B char **data;
75
2ed13b51 76.B int sq_remove_data(sq, data);
77
78.B int sq_empty(sq);
79
0a796925 80.B sq_save_args(argc, argv, sq);
81
82.B sq_save_data(sq, data);
83
84.B sq_save_unique_data(sq, data);
85
86.B sq_save_unique_string(sq, data);
0a796925 87.fi
88.SH DESCRIPTION
89This library supports the Athena Service Management System protocol
90and related operations. The library contains many routines beyond
91those described in this man page, but they are not intended to be used
92directly. Instead, they are called by the routines that are described.
7726d871 93
94Be sure to link your application against these libraries:
2ad0a777 95-lmoira -lmrgdb -lcom_err -lkrb -ldes
0a796925 96.TP
97Protocol functions
a4a12338 98All protocol routines return 0 on success, or a value from
2ad0a777 99.I <mr_et.h>
ca170892 100on failure. An application should connect, check the motd in case the
101server is closed, authenticate, perform queries, then disconnect.
0a796925 102
2ad0a777 103.B mr_connect
104establishes a connection with the Moira server. The
0a796925 105.I server
2ed13b51 106specification is optional. If present, it is of the form
107hostname:portname, where the portname can be looked up in
0a796925 108.B /etc/services.
2ed13b51 109If NULL or an empty string is passed as
110.I server,
111then the server will be found from the MOIRASERVER environment
112variable, the "moira" sloc entry in hesiod, or the compiled in
113default, in that order.
0a796925 114
2ad0a777 115.B mr_host
5498c996 116initializes
117.I host
118with the name of the host that the client is currently connected to.
119
2ad0a777 120.B mr_motd
ca170892 121will check to see if the server is closed and if so, will retrieve an
122explanatory message (the so-called motd). This routine will always
123return 0 if no error occurs. *motd will be NULL if the server is
124functioning normally, or a pointer to a static string with the
125explanation if the server is down.
126
2ad0a777 127.B mr_auth
0a796925 128authenticates an established connection using Kerberos.
129.I prog
130is the name of the program making the connection. The program name
131and the kerberos principal name will be recorded with any changes made
132to the database through this connection.
133
2ad0a777 134.B mr_disconnect
135severs the connection with the Moira server.
0a796925 136
2ad0a777 137.B mr_noop
138pings the Moira server through a "no operation" request, verifying that
0a796925 139the connection is still working.
140
2ad0a777 141.B mr_access
0a796925 142Verifies that the authenticated user has the necessary access to
143perform the query specified by
144.I name, argc,
145and
146.I argv.
147
2ad0a777 148.B mr_query
0a796925 149performs a query. This query may be a retrieval, append, delete, or
150update of the database. Query
151.I name
152will be executed with the
153.I argc
154arguments specified in the string array
155.I argv.
156For each return tuple,
157.I callproc
158will be called with an
159.I argc, argv,
160and the value passed to
2ad0a777 161.B mr_query
0a796925 162as
163.I callarg.
164
2ad0a777 165.B mr_do_update
166triggers a DCM update immediately on the Moira server.
7ad50c73 167
2ad0a777 168.B mr_set_alternate_input
7ad50c73 169tells the Moira library that you want to allow some asynchronus
170actions while a query is being processed. During query processing, if
171any data is available to be read on the specified file descriptor,
172then the specified function will be called to handle it. For
2ad0a777 173instance, calling mr_set_alternate_input with the connection to the X
7ad50c73 174server and a routine which will dispatch X events will allow a toolkit
175application to handle mouse and expose events while a query is being
176processed.
0a796925 177.TP
178Data manipulation
179.B format_filesys_type
180returns a user-displayable representation of the status bits on an NFS
181physical partition.
182.I fs_status
183is the ascii representation of the integer value of that field.
184
185.B parse_filesys_type
186returns the numeric value of the filesystem type, given a string
187describing an NFS physical partition allocation type. The returned
188value is a pointer to a static buffer containing the ascii
189representation of the integer value.
190
191.B canonicalize_hostname
192attempts to update what is possibly the nickname for a host to its
193canonical form which is a fully specified, uppercase domain name.
194If the named host is in the namespace, it calls the nameserver to
195expand it and return the primary name of the host. Otherwise, it just
196returns the argument. It assumes that
197.I host
198was allocated using
199.I malloc(),
200and may be freed or realloc'ed before returning. The returned value
201will be a malloc'ed value, possibly the same buffer as the argument.
202
203.B strsave
204will malloc some memory and make a copy of
205.I s.
206
207.B strtrim
208will trim whitespace off of both ends of the string
209.I s.
210The returned value will be a pointer into the same buffer
211.I s
212pointed to.
213
0a796925 214.TP
215Simple Queues
2ed13b51 216.B sq_create
217will create an empty save_queue.
218
0a796925 219.B sq_destroy
220will free all of the memory contained in the queue structure
221.I sq.
222It will not attempt to free the elements.
223
224.B sq_get_data
225will fill in
226.I data
227with the next piece of data in the queue. If will return 0 if there
228is no more data in the queue.
229
2ed13b51 230.B sq_remove_data
231functions like sq_get_data except that any returned data is first
232removed from the queue.
233
234.B sq_empty
235tests the length of the queue, returning non-zero if it is empty or
236zero if the queue contains data.
237
0a796925 238.B sq_save_args
239will make a copy of
240.I argv,
241null terminate it so that
242.I argc
243is not necessary, and save this value on the end of the queue
244.I sq.
245
246.B sq_save_data
247saves
248.I data
249on the end of the queue
250.I sq.
251
252.B sq_save_unique_data
253will save
254.I data
255on the queue if it does not already appear in the queue. If it is
256already present, nothing is modified and no errors are returned.
257.B sq_save_unique_string
258is like
259.B sq_save_unique_data,
260except that it uses strcmp on the elements rather than comparing the
261addresses directly.
0a796925 262.SH FILES
cb33d6a5 263/usr/athena/include/moira.h
0a796925 264.br
cb33d6a5 265/usr/athena/include/mr_et.h
0a796925 266.br
267/tmp/tkt###
268.SH "SEE ALSO"
2ed13b51 269mrtest(8), The Moira section of the Athena Technical Plan
0a796925 270.SH DIAGNOSTICS
2ad0a777 271The error codes returned are those defined in <mr_et.h>, or
0a796925 272<krb_et.h>. They may be easily decoded using the com_err library.
273.SH RESTRICTIONS
7ad50c73 274COPYRIGHT 1987,1988,1989 Massachusetts Institute of Technology
This page took 0.303803 seconds and 5 git commands to generate.