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