Libinfo-173.tar.gz
[apple/libinfo.git] / lookup.subproj / _lu_types.x
1 /*
2  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  * 
6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
7  * 
8  * This file contains Original Code and/or Modifications of Original Code
9  * as defined in and that are subject to the Apple Public Source License
10  * Version 2.0 (the 'License'). You may not use this file except in
11  * compliance with the License. Please obtain a copy of the License at
12  * http://www.opensource.apple.com/apsl/ and read it before using this
13  * file.
14  * 
15  * The Original Code and all software distributed under the License are
16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20  * Please see the License for the specific language governing rights and
21  * limitations under the License.
22  * 
23  * @APPLE_LICENSE_HEADER_END@
24  */
25 /*
26  * Lookup server protocol - Internal to NeXT
27  * Copyright (C) 1989 by NeXT, Inc.
28  * 
29  * This server uses a protocol based upon XDR layered on top of 
30  * a mach rpc call. There are three procedures defined in the "lookup.defs"
31  * file. A "lookup_link" operation takes a procedure string name and returns a
32  * number to be used in the other two calls. "lookup_all" takes a procedure
33  * number and XDR'd arguments and returns XDR'd results. It returns the
34  * entire list of entries. "lookup_one" has a similar calling convention,
35  * but returns only a single entry.
36  *
37  * The syntax of calls described here in comments looks like this:
38  *
39  *              result_type procedure_name(arg_type1 arg1, arg_type2 arg2, ...)
40  *
41  *      The arguments are assumed to be XDR'd in sequence and a single XDR'd
42  *      result is returned.
43  */
44 const _LU_MAXLUSTRLEN = 256;
45
46 const _LU_MAXGRP = 1024;
47 const _LU_MAXHNAMES = 32;
48 const _LU_MAXADDRS = 32;
49 const _LU_MAXNNAMES = 32;
50 const _LU_MAXPNAMES = 32;
51 const _LU_MAXSNAMES = 32;
52 const _LU_MAXRNAMES = 32;
53 const _LU_MAXPRNAMES = 32;
54 const _LU_MAXPRPROPS = 1024;
55 const _LU_MAX_BOOTPARAMS_KV = 32;
56 const _LU_MAXALIASMEMBERS = 4096;
57
58
59 typedef string _lu_string<_LU_MAXLUSTRLEN>;
60
61
62 /*
63  * Calls available:
64  *      int putpwpasswd(_lu_string long, _lu_string old, _lu_string new)
65  *      _lu_passwd * getpwuid(int uid)
66  *      _lu_passwd * getpwnam(_lu_string name)
67  *      _lu_passwd<> getpwent(void)
68  */
69 struct _lu_passwd {
70         _lu_string pw_name;
71         _lu_string pw_passwd;
72         int pw_uid;
73         int pw_gid;
74         int pw_change;
75         _lu_string pw_class;
76         _lu_string pw_gecos;
77         _lu_string pw_dir;
78         _lu_string pw_shell;
79         int pw_expire;
80 };
81 typedef _lu_passwd *_lu_passwd_ptr;
82
83
84 /*
85  * Calls available:
86  *      _lu_group * getgrgid(int gid)
87  *      _lu_group * getgrnam(_lu_string name)
88  *      _lu_group<> getgrent(void)
89  */
90 struct _lu_group {
91         _lu_string gr_name;
92         _lu_string gr_passwd;
93         int gr_gid;
94         _lu_string gr_mem<_LU_MAXGRP>;
95 };
96 typedef _lu_group *_lu_group_ptr;
97
98 /*
99  * Calls available:
100  *      _lu_hostent * gethostbyaddr(unsigned long addr) -- IP only
101  *      _lu_hostent * gethostbyname(_lu_string name)
102  *      _lu_hostent<> gethostent(void)
103  */
104 struct _lu_hostent {
105         _lu_string h_names<_LU_MAXHNAMES>;
106         unsigned long h_addrs<_LU_MAXADDRS>; /* IP only */
107 };
108 typedef _lu_hostent *_lu_hostent_ptr;
109
110 /*
111  * Calls available:
112  *      _lu_netent * getnetbyaddr(unsigned long addr) --IP only
113  *      _lu_netent * getnetbyname(_lu_string name)
114  *      _lu_netent<> getnetent(void)
115  */
116 struct _lu_netent {
117         _lu_string n_names<_LU_MAXNNAMES>;
118         unsigned long n_net;    /* IP only */
119 };
120 typedef _lu_netent *_lu_netent_ptr;
121
122
123 /*
124  * Calls available:
125  *      _lu_servent * getservbyport(int port, _lu_string proto)
126  *      _lu_servent * getservbyname(_lu_string name, _lu_string proto)
127  *      _lu_servent<> getservent(void)
128  */
129 struct _lu_servent {
130         _lu_string s_names<_LU_MAXSNAMES>;
131         int s_port;
132         _lu_string s_proto;
133 };
134 typedef _lu_servent *_lu_servent_ptr;
135
136 /*
137  * Calls available:
138  *      _lu_protoent * getprotobynumber(int number)
139  *      _lu_protoent * getprotobyname(_lu_string name)
140  *      _lu_protoent<> getprotoent(void)
141  */
142 struct _lu_protoent {
143         _lu_string p_names<_LU_MAXPNAMES>;
144         int p_proto;
145 };
146 typedef _lu_protoent *_lu_protoent_ptr;
147
148
149 /*
150  * Calls available:
151  *      _lu_rpcent * getrpcbynumber(int number)
152  *      _lu_rpcent * getrpcbyname(_lu_string name)
153  *      _lu_rpcent<> getrpcent(void)
154  */
155 struct _lu_rpcent {
156         _lu_string r_names<_LU_MAXRNAMES>;
157         int r_number;
158 };
159 typedef _lu_rpcent *_lu_rpcent_ptr;
160
161 /* 
162  * Calls available:
163  *      _lu_fsent<> getfsent(void)
164  *      _lu_fsent * getfsbyname(_lu_string name)
165  */
166 struct _lu_fsent {
167         _lu_string fs_spec;
168         _lu_string fs_file;
169         _lu_string fs_vfstype;
170         _lu_string fs_mntops;
171         _lu_string fs_type;
172         int fs_freq;
173         int fs_passno;
174 };
175 typedef _lu_fsent *_lu_fsent_ptr;
176
177 /* 
178  * Calls available:
179  *      _lu_prdb_ent * prdb_getbyname
180  *      _lu_prdb_ent<> prdb_get(void)
181  */
182 struct _lu_prdb_property {
183         _lu_string pp_key;
184         _lu_string pp_value;
185 };
186
187 struct _lu_prdb_ent {
188         _lu_string pe_names<_LU_MAXPRNAMES>;
189         _lu_prdb_property pe_props<_LU_MAXPRPROPS>;
190 };
191 typedef _lu_prdb_ent *_lu_prdb_ent_ptr;
192
193
194 /* 
195  * Calls available:
196  *      _lu_bootp_ent * bootp_getbyip(unsigned long addr)
197  *      _lu_bootp_ent * bootp_getbyether(opaque bootp_enaddr[6])
198  */
199 struct _lu_bootp_ent {
200         _lu_string bootp_name;
201         _lu_string bootp_bootfile;
202         unsigned long bootp_ipaddr;
203         opaque bootp_enaddr[6];
204 };
205 typedef _lu_bootp_ent *_lu_bootp_ent_ptr;
206
207 /*
208  * Calls available:
209  *      _lu_bootparams_ent * bootparams_getbyname(_lu_string name)
210  *      _lu_bootparams_ent<> bootparams_getent(void)
211  */
212 struct _lu_bootparams_ent {
213         _lu_string bootparams_name;
214         _lu_string bootparams_keyvalues<_LU_MAX_BOOTPARAMS_KV>;
215 };
216 typedef _lu_bootparams_ent *_lu_bootparams_ent_ptr;
217
218
219 /*
220  * Calls available:
221  *      _lu_aliasent * alias_getbyname(_lu_string name)
222  *      _lu_aliasent<> alias_getent(void)
223  */
224 struct _lu_aliasent {
225         _lu_string alias_name;
226         _lu_string alias_members<_LU_MAXALIASMEMBERS>;
227         int alias_local;
228 };
229 typedef _lu_aliasent *_lu_aliasent_ptr;
230
231 /*
232  * Calls available:
233  *      int innetgr(_lu_innetgr_args args)
234  *      _lu_netgrent<> getnetgrent(_lu_string group)
235  */
236 struct _lu_innetgr_args {
237         _lu_string group;
238         _lu_string *host;
239         _lu_string *user;
240         _lu_string *domain;
241 };
242
243 struct _lu_netgrent{
244         _lu_string ng_host;
245         _lu_string ng_user;
246         _lu_string ng_domain;
247 };
248