xref: /titanic_51/usr/src/lib/libnsl/common/llib-lnsl (revision a1b5e537933659371285214eae1db2603e6364b4)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23/* LINTLIBRARY */
24/* PROTOLIB1 */
25
26/*
27 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
28 * Use is subject to license terms.
29 */
30
31#pragma ident	"%Z%%M%	%I%	%E% SMI"
32
33#include <sys/types.h>
34#include <thread.h>
35#include <synch.h>
36#include <fcntl.h>
37#include <sys/des.h>
38#include <des/softdes.h>
39#include <des/desdata.h>
40#include <rpc/rpc.h>
41#include <rpc/key_prot.h>
42#include <rpc/des_crypt.h>
43#include <rpc/pmap_prot.h>
44#include <sys/ioctl.h>
45#include <netdir.h>
46#include <nss_netdir.h>
47#include <nss_dbdefs.h>
48#include <sac.h>
49#include <netconfig.h>
50#include <ndbm.h>
51#include <rpcsvc/yp_prot.h>
52#include <rpcsvc/ypclnt.h>
53#include <rpcsvc/yppasswd.h>
54#include <rpcsvc/ypupd.h>
55#include <rpcsvc/nis.h>
56#include <rpcsvc/nis_callback.h>
57#include <rpcsvc/nislib.h>
58#include <rpcsvc/nispasswd.h>
59#include <sys/stream.h>
60#include <sys/stropts.h>
61#include <sys/tihdr.h>
62#include <sys/timod.h>
63#include <tiuser.h>
64
65
66/*
67 * Declare t_errno, even though this file is compiled '_REENTRANT'.  This
68 * way t_errno is defined in the lint library, which is used for programs
69 * compiled with _REENTRANT and those compiled without it.
70 */
71#ifdef t_errno
72#undef t_errno
73#endif
74extern int t_errno;
75
76/*
77 * usr/src/lib/libnsl/common routines
78 */
79
80/* common.c */
81
82/*
83 * usr/src/lib/libnsl/des routines
84 */
85
86/* des_crypt.c */
87int cbc_crypt(char *key, char *buf, size_t len, uint_t mode, char *ivec);
88int ecb_crypt(char *key, char *buf, size_t len, uint_t mode);
89
90/* des_soft.c */
91void des_setparity(char *p);
92int __des_crypt(char *buf, unsigned len, struct desparams *desp);
93
94/* intl_crypt.c */
95
96/* intl_soft.c */
97int _des_crypt(char *buf, unsigned len, struct desparams *desp);
98
99/*
100 * usr/src/lib/libnsl/dial routines
101 */
102
103/* callers.c */
104
105/* conn.c */
106
107/* dial.c */
108void undial(int fd);
109
110/* getargs.c */
111
112/* interface.c */
113
114/* line.c */
115
116/* stoa.c */
117
118/* strecpy.c */
119
120/* strsave.c */
121
122/* sysfiles.c */
123
124/* ulockf.c */
125
126/* uucpdefs.c */
127
128/*
129 * usr/src/lib/libnsl/key routines
130 */
131
132/* gen_dhkeys.c */
133void __gen_dhkeys(char *public, char *secret, char *pass);
134
135/* publickey.c */
136int getpublickey(const char *netname, char *pkey);
137int __getpublickey_cached(char *netname, char *pkey, int *from_cache);
138void __getpublickey_flush(const char *netname);
139int getsecretkey(const char *netname, char *skey, const char *passwd);
140
141/* xcrypt.c */
142int xencrypt(char *secret, char *passwd);
143int xdecrypt(char *secret, char *passwd);
144int passwd2des(char *pw, char *key);
145
146/*
147 * usr/src/lib/libnsl/netdir routines
148 */
149
150/* netdir.c */
151int *__nderror(void);
152int netdir_getbyname(struct netconfig *tp, struct nd_hostserv *serv,
153				struct nd_addrlist **addrs);
154int netdir_getbyaddr(struct netconfig *tp, struct nd_hostservlist **serv,
155				struct netbuf *addr);
156int __netdir_getbyaddr_nosrv(struct netconfig *tp,
157				struct nd_hostservlist **serv,
158				struct netbuf *addr);
159int netdir_options(struct netconfig *tp, int option, int fd, char *par);
160struct netbuf *uaddr2taddr(struct netconfig *tp, char *addr);
161char *taddr2uaddr(struct netconfig *tp, struct netbuf *addr);
162void netdir_free(void *ptr, int type);
163char *netdir_sperror(void);
164void netdir_perror(char *s);
165
166/*
167 * usr/src/lib/libnsl/netselect routines
168 */
169
170/* netselect.c */
171void *setnetconfig(void);
172int endnetconfig(void *vdata);
173struct netconfig *getnetconfig(void *vdata);
174struct netconfig *getnetconfigent(const char *netid);
175void freenetconfigent(struct netconfig *netp);
176void *setnetpath(void);
177int endnetpath(void *vdata);
178struct netconfig *getnetpath(void *vdata);
179char *nc_sperror(void);
180void nc_perror(const char *string);
181
182/*
183 * usr/src/lib/libnsl/nis/cache routines
184 */
185
186/* cache.cc */
187
188/* cache_api.cc */
189#ifdef notdef
190/* XXX lacking appropriate public header files */
191nis_error __nis_CacheInit(NisCache **cache);
192#endif
193nis_error __nis_CacheBind(char *dname, directory_obj *dobj);
194bool_t __nis_CacheRemoveEntry(directory_obj *dobj);
195nis_error __nis_CacheSearch(char *dname, directory_obj *dobj);
196void __nis_CacheRestart(void);
197void __nis_CachePrint(void);
198bool_t __nis_CacheAddEntry(fd_result *, directory_obj *);
199uint32_t __nis_CacheLocalLoadPref(void);
200nis_error __nis_CacheLocalInit(uint32_t *exp_time);
201nis_error __nis_CacheMgrInit(void);
202void __nis_CacheMgrCleanup(void);
203nis_error __nis_CacheMgrBindReplica(char *dname);
204nis_error __nis_CacheMgrBindMaster(char *dname);
205nis_error __nis_CacheMgrBindServer(nis_server *srv, int nsrv);
206int __nis_CacheMgrRefreshBinding(nis_bound_directory *binding);
207int __nis_CacheMgrRefreshAddress(nis_bound_endpoint *bep);
208int __nis_CacheMgrRefreshCallback(nis_bound_endpoint *bep);
209int __nis_CacheMgrUpdateUaddr(char *uaddr);
210void __nis_CacheMgrMarkUp(void);
211uint32_t __nis_CacheMgrTimers(void);
212uint32_t __nis_CacheMgrRefreshCache(void);
213uint32_t __nis_serverRefreshCache(void);
214
215/* client_cache.cc */
216
217/* cold_start.cc */
218bool_t writeColdStartFile(directory_obj *dobj);
219
220/* local_cache.cc */
221
222/* mapped_cache.cc */
223
224/* mgr_cache.cc */
225
226/* nis_cache_clnt.cc */
227
228/* nis_cache_xdr.cc */
229
230/*
231 * usr/src/lib/libnsl/nis/gen routines
232 */
233
234/* nis_callback.c */
235int __nis_destroy_callback(void);
236nis_server *__nis_init_callback(CLIENT *svc_clnt, int (*cbfunc)(),
237								void *userdata);
238int __nis_run_callback(netobj *srvid, rpcproc_t srvproc,
239				struct timeval *timeout, CLIENT *myserv);
240
241/* nis_cast.c */
242enum clnt_stat __nis_cast_proc(nis_bound_directory *binding, int base,
243				int nbep, rpcproc_t procnum,
244				xdrproc_t xdr_inproc, void *in,
245				xdrproc_t xdr_outproc, void *out,
246				int *fastest, int mytimeout);
247
248/* nis_cback_xdr.c */
249bool_t xdr_obj_p(XDR *xdrs, obj_p *objp);
250bool_t xdr_cback_data(XDR *xdrs, cback_data *objp);
251
252/* nis_clnt.c */
253
254/* nis_groups.c */
255typedef nis_result *(*nis_lookup_func)(nis_name, u_int);
256int __nis_group_cache_stats(int *grpcachecall, int *grpcachehits,
257					int *grpcachemisses);
258bool_t nis_ismember(nis_name princp, nis_name group);
259bool_t __do_ismember(nis_name princp, nis_object *obj, nis_lookup_func lookup);
260void nis_print_group_entry(nis_name group);
261void nis_flushgroups(void);
262void __nis_flush_group_exp_name(nis_name groupname);
263nis_name __nis_map_group_r(const nis_name name, char *buf, size_t bufsize);
264nis_error nis_addmember(nis_name princp, nis_name group);
265nis_error nis_removemember(nis_name princp, nis_name group);
266nis_error nis_verifygroup(nis_name group);
267nis_error __nis_creategroup_obj(nis_name name, uint_t flags, nis_object *obj);
268nis_error nis_creategroup(nis_name name, uint_t flags);
269nis_error nis_destroygroup(nis_name name);
270
271/* nis_hash.c */
272int nis_in_table(nis_name name, NIS_HASH_TABLE *table, int *key);
273int nis_insert_item(NIS_HASH_ITEM *item, NIS_HASH_TABLE *table);
274NIS_HASH_ITEM *nis_find_item(nis_name name, NIS_HASH_TABLE *table);
275NIS_HASH_ITEM *nis_pop_item(NIS_HASH_TABLE *table);
276NIS_HASH_ITEM *nis_remove_item(nis_name name, NIS_HASH_TABLE *table);
277void nis_insert_name(nis_name name, NIS_HASH_TABLE *table);
278void nis_remove_name(nis_name name, NIS_HASH_TABLE *table);
279
280/* nis_lookup.c */
281nis_result *__nis_remote_lookup(ib_request *req, u_int flags, int list_op,
282				void *cbdata, int (*cback)());
283nis_result *__nis_core_lookup(ib_request *req, u_int flags, int list_op,
284				void *cbdata, int (*cback)());
285fd_result *__nis_finddirectory_remote(nis_bound_directory **binding,
286				char *dname);
287fd_result *__nis_finddirectory(nis_bound_directory **binding, char *dname);
288fd_result *nis_finddirectory(directory_obj *dobj, nis_name name);
289
290/* nis_misc.c */
291void __nis_pingproc(nis_server *srv, nis_name name, uint32_t mtime);
292void nis_ping(nis_name name, uint32_t mtime, nis_object *obj);
293log_result *nis_dumplog(nis_server *host, nis_name name, uint32_t dtime);
294log_result *nis_dump(nis_server *host, nis_name name, int (*cback)());
295void nis_free_binding(nis_bound_directory *binding);
296void __nis_path_free(char **names, int len);
297nis_error __nis_path(char *from, char *to, int *path_length, char ***namesp);
298int __nis_host_is_server(nis_server *, int);
299void __nis_print_result(nis_result *);
300struct netconfig *__nis_get_netconfig(endpoint *);
301
302/* nis_misc_proc.c */
303void __nis_auth2princ(char *name, int flavor, caddr_t auth, bool_t refresh,
304			int verbose);
305bool_t __nis_ck_perms(u_int right, u_int mask, nis_object *obj,
306				nis_name pr, int level);
307bool_t __nis_ismaster(char *host, char *domain);
308bool_t __nis_isadmin(char *princ, char *table, char *domain);
309nis_server * __nis_host2nis_server(char *host, bool_t addpubkey, int *errcode);
310
311/* nis_names.c */
312int __nis_parse_path(char *path, nis_name *list, int max);
313nis_name *nis_getnames(nis_name name);
314void nis_freenames(nis_name *namelist);
315
316/* nis_perror.c */
317char *nis_sperrno(nis_error stat);
318void nis_perror(nis_error stat, char *str);
319char *nis_sperror_r(nis_error stat, char *str, char buf[], int len);
320char *nis_sperror(nis_error stat, char *str);
321void nis_lerror(nis_error stat, char *str);
322
323/* nis_rpc.c */
324typedef struct {
325	nis_server *srv;
326	int nsrv;
327	char *name;
328	int parent_first;
329	u_int flags;
330	struct timeval timeout;
331	nis_error niserror;
332	uint32_t aticks;
333	int state;
334	nis_bound_directory *binding;
335	int base;
336	int end;
337	int count;
338	int start;
339	int cur;
340	int bound_to;
341	int refresh_count;
342} nis_call_state;
343
344void __nis_reset_state(void);
345void __nis_bad_auth_server(CLIENT *c);
346void __nis_release_server(nis_call_state *state, CLIENT *c,
347					enum clnt_stat status);
348CLIENT *__nis_get_server(nis_call_state *state);
349
350/* nis_subr.c */
351int __start_clock(int clk);
352unsigned int __stop_clock(int clk);
353name_pos nis_dir_cmp(nis_name n1, nis_name n2);
354nis_name nis_local_group(void);
355nis_name nis_domain_of(char *s);
356nis_name nis_leaf_of_r(const nis_name  s, char *buf, size_t bufsize);
357nis_name nis_leaf_of(char *s);
358nis_name nis_name_of(char *s);
359nis_name nis_local_directory(void);
360int __nis_principal(char *principal_name, uid_t uid, char *directory);
361nis_name nis_local_principal(void);
362nis_name nis_local_host(void);
363void nis_destroy_object(nis_object *obj);
364nis_object *nis_clone_object(nis_object *obj, nis_object *dest);
365char **__break_name(nis_name name, int *levels);
366int __name_distance(char **targ, char **test);
367nis_result *nis_make_error(nis_error err, uint32_t aticks, uint32_t cticks,
368				uint32_t dticks, uint32_t zticks);
369nis_attr *__cvt2attr(int *na, char **attrs);
370void nis_free_request(ib_request *req);
371nis_error nis_get_request(nis_name name, nis_object *obj, netobj *cookie,
372				ib_request *reqreq);
373nis_object *nis_read_obj(char *f);
374int nis_write_obj(char *f, nis_object *o);
375CLIENT *nis_make_rpchandle(nis_server *srv, int cback, rpcprog_t prog,
376			rpcvers_t ver, u_int flags, int inbuf, int outbuf);
377void *nis_get_static_storage(struct nis_sdata *bs, u_int el, u_int nel);
378char *nis_old_data(char *s);
379char *nis_data(char *s);
380nis_name __nis_local_root(void);
381
382/* nis_tags.c */
383void nis_freeservlist(nis_server **servers);
384nis_server **nis_getservlist(nis_name name);
385nis_error nis_stats(nis_server *srv, nis_tag *tags, int ntags,
386							nis_tag **result);
387nis_error nis_servstate(nis_server *srv, nis_tag *tags, int ntags,
388							nis_tag **result);
389void nis_freetags(nis_tag *tags, int ntags);
390
391/* nis_xdr.c */
392bool_t xdr_nis_attr(XDR *xdrs, nis_attr *objp);
393bool_t xdr_nis_name(XDR *xdrs, nis_name *objp);
394bool_t xdr_endpoint(XDR *xdrs, endpoint *objp);
395bool_t xdr_nis_server(XDR *xdrs, nis_server *objp);
396bool_t xdr_directory_obj(XDR *xdrs, directory_obj *objp);
397bool_t xdr_entry_obj(XDR *xdrs, entry_obj *objp);
398bool_t xdr_table_obj(XDR *xdrs, table_obj *objp);
399bool_t xdr_objdata(XDR *xdrs, objdata *objp);
400bool_t xdr_nis_oid(XDR *xdrs, nis_oid *objp);
401bool_t xdr_nis_object(XDR *xdrs, nis_object *objp);
402bool_t xdr_nis_object(XDR *xdrs, nis_object *objp);
403bool_t xdr_nis_error(XDR *xdrs, nis_error *objp);
404bool_t xdr_nis_result(XDR *xdrs, nis_result *objp);
405bool_t xdr_ns_request(XDR *xdrs, ns_request *objp);
406bool_t xdr_ib_request(XDR *xdrs, ib_request *objp);
407bool_t xdr_ping_args(XDR *xdrs, ping_args *objp);
408bool_t xdr_log_entry_t(XDR *xdrs, log_entry_t *objp);
409bool_t xdr_log_entry(XDR *xdrs, log_entry *objp);
410bool_t xdr_log_result(XDR *xdrs, log_result *objp);
411bool_t xdr_cp_result(XDR *xdrs, cp_result *objp);
412bool_t xdr_nis_tag(XDR *xdrs, nis_tag *objp);
413bool_t xdr_nis_taglist(XDR *xdrs, nis_taglist *objp);
414bool_t xdr_dump_args(XDR *xdrs, dump_args *objp);
415bool_t xdr_fd_args(XDR *xdrs, fd_args *objp);
416bool_t xdr_fd_result(XDR *xdrs, fd_result *objp);
417bool_t xdr_nis_bound_endpoint(XDR *xdrs, nis_bound_endpoint *objp);
418bool_t xdr_nis_bound_directory(XDR *xdrs, nis_bound_directory *objp);
419bool_t xdr_nis_active_endpoint(XDR *xdrs, nis_active_endpoint *objp);
420
421/* nislib.c */
422void nis_freeresult(nis_result *res);
423void __nis_freelogresult(log_result *lres);
424nis_error nis_bind_dir(char *dname, int parent_first,
425				nis_bound_directory **binding, u_int flags);
426nis_result *nis_lookup(nis_name name, uint_t flags);
427nis_result *nis_list(nis_name name, uint_t flags, int (*cback)(),
428				void *cbdata);
429nis_result *nis_add(nis_name name, nis_object *obj);
430nis_result *nis_remove(nis_name name, nis_object *obj);
431nis_result *nis_modify(nis_name name, nis_object *obj);
432nis_result *nis_add_entry(nis_name name, nis_object *obj, uint_t flags);
433nis_result *nis_remove_entry(nis_name name, nis_object *obj, uint_t flags);
434nis_result *nis_modify_entry(nis_name name, nis_object *obj, uint_t flags);
435nis_result *nis_first_entry(nis_name table);
436nis_result *nis_next_entry(nis_name table, netobj *cookie);
437nis_result *nis_checkpoint(nis_name name);
438nis_error nis_mkdir(nis_name name, nis_server *srv);
439nis_error nis_rmdir(nis_name name, nis_server *srv);
440nis_error __nis_send_msg(nis_server *srv, int proc, xdrproc_t out, char *msg);
441nis_result *__nis_list_localcb(nis_name name, u_int flags,
442				int (*cback)(), void *cbdata);
443
444/* npd_lib.c */
445bool_t __npd_ecb_crypt(uint32_t *val1, uint32_t *val2, des_block *buf,
446			uint_t bufsize, uint_t mode, des_block *deskey);
447bool_t __npd_cbc_crypt(uint32_t *val, char *str, uint_t strsize,
448			npd_newpass *buf, uint_t bufsize, uint_t mode,
449			des_block *deskey);
450
451/* print_obj.c */
452void nis_print_rights(u_int r);
453void nis_print_directory(directory_obj *r);
454void nis_print_group(group_obj *g);
455void nis_print_table(table_obj *t);
456void nis_print_link(link_obj *l);
457void nis_print_entry(entry_obj *edata);
458void nis_print_object(nis_object *o);
459
460/* thr_misc.c */
461
462/*
463 * usr/src/lib/libnsl/nsl routines
464 */
465
466/* _conn_util.c */
467
468/* _data2.c */
469
470/* _errlst.c */
471int *__t_errno(void);
472
473/* _utility.c */
474
475/* t_accept.c */
476int t_accept(int, int, struct t_call *);
477
478/* t_alloc.c */
479char *t_alloc(int, int, int);
480
481/* t_bind.c */
482int t_bind(int, struct t_bind *, struct t_bind *);
483
484/* t_close.c */
485int t_close(int);
486
487/* t_connect.c */
488int t_connect(int, struct t_call *, struct t_call *);
489
490/* t_error.c */
491void t_error(const char *);
492
493/* t_free.c */
494int t_free(char *, int);
495
496/* t_getinfo.c */
497int t_getinfo(int, struct t_info *);
498
499/* t_getname.c */
500int t_getname(int, struct netbuf *, int);
501
502/* t_getstate.c */
503int t_getstate(int);
504
505/* t_listen.c */
506int t_listen(int, struct t_call *);
507
508/* t_look.c */
509int t_look(int);
510
511/* t_open.c */
512int t_open(const char *, int, struct t_info *);
513
514/* t_optmgmt.c */
515int t_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *);
516
517/* t_rcv.c */
518int t_rcv(int, char *, unsigned, int *);
519
520/* t_rcvconnect.c */
521int t_rcvconnect(int, struct t_call *);
522
523/* t_rcvdis.c */
524int t_rcvdis(int, struct t_discon *);
525
526/* t_rcvrel.c */
527int t_rcvrel(int);
528
529/* t_rcvudata.c */
530int t_rcvudata(int, struct t_unitdata *, int *);
531
532/* t_rcvuderr.c */
533int t_rcvuderr(int, struct t_uderr *);
534
535/* t_snd.c */
536int t_snd(int, char *, unsigned, int);
537
538/* t_snddis */
539int t_snddis(int, struct t_call *);
540
541/* t_sndrel.c */
542int t_sndrel(int);
543
544/* t_sndudata.c */
545int t_sndudata(int, struct t_unitdata *);
546
547/* t_strerror.c */
548char *_t_strerror(int);
549
550/* t_sync.c */
551int t_sync(int);
552
553/* t_unbind.c */
554int t_unbind(int);
555
556/*
557 * struct t_iovec is defined in <xti.h>. But <xti.h> cannot be included
558 * because inclusion of <xti.h> and <tiuser.h> are mututally exclusive
559 * and <tiuser.h> is exposed by the inclusion of <rpc/rpc.h>. Needs to
560 * be seen how to build llib-lnsl.ln from multiple source files to avoid
561 * this problem.
562 */
563struct t_iovec {
564	void	*iov_base;
565	size_t	iov_len;
566};
567
568/* t_sndv.c */
569int t_sndv(int, const struct t_iovec *,  unsigned int, int);
570
571/* t_sndvudata.c */
572int t_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);
573
574/* t_sndreldata.c */
575int t_sndreldata(int, struct t_discon *);
576
577/* t_rcvv.c */
578int t_rcvv(int, struct t_iovec *, unsigned int, int *);
579
580/* t_rcvvudata.c */
581int t_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
582        unsigned int, int *);
583
584/* t_rcvreldata.c */
585extern int t_rcvreldata(int, struct t_discon *);
586
587/* t_sysconf.c */
588int t_sysconf(int);
589
590/* xti_wrappers.c */
591int _xti_accept(int, int, struct t_call *);
592int _xti_xns5_accept(int, int, struct t_call *);
593char *_xti_alloc(int, int, int);
594int _xti_bind(int, struct t_bind *, struct t_bind *);
595int _xti_close(int);
596int _xti_connect(int, struct t_call *, struct t_call *);
597int _xti_error(char *);
598int _xti_free(char *, int);
599int _xti_getinfo(int, struct t_info *);
600int _xti_getprotaddr(int, struct t_bind *, struct t_bind *);
601int _xti_getstate(int);
602int _xti_listen(int, struct t_call *);
603int _xti_look(int);
604int _xti_open(char *, int, struct t_info *);
605int _xti_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *);
606int _xti_rcv(int, char *, unsigned int, int *);
607int _xti_rcvconnect(int, struct t_call *);
608int _xti_rcvdis(int, struct t_discon *);
609int _xti_rcvrel(int);
610int _xti_rcvreldata(int, struct t_discon *);
611int _xti_rcvudata(int, struct t_unitdata *, int *);
612int _xti_rcvuderr(int, struct t_uderr *);
613int _xti_rcvv(int, struct t_iovec *, unsigned int, int *);
614int _xti_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
615    unsigned int, int *);
616int _xti_snd(int, char *, unsigned int, int);
617int _xti_xns5_snd(int, char *, unsigned int, int);
618int _xti_snddis(int, struct t_call *);
619int _xti_sndrel(int);
620int _xti_sndreldata(int, struct t_discon *);
621int _xti_sndudata(int, struct t_unitdata *);
622int _xti_sndv(int, const struct t_iovec *, unsigned int, int);
623int _xti_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);
624char *_xti_strerror(int);
625int _xti_sync(int);
626int _xti_sysconf(int);
627int _xti_unbind(int);
628
629/*
630 * usr/src/lib/libnsl/nss routines
631 */
632
633/* gethostby_door.c */
634
635/* gethostbyname_r.c */
636struct hostent *_uncached_gethostbyname_r(const char *nam,
637				struct hostent *result,
638				char *buffer, int buflen, int *h_errnop);
639struct hostent *_uncached_gethostbyaddr_r(const char *addr, int length,
640				int type, struct hostent *result,
641				char *buffer, int buflen, int *h_errnop);
642struct hostent *gethostbyname_r(const char *nam, struct hostent *result,
643				char *buffer, int buflen, int *h_errnop);
644struct hostent *gethostbyaddr_r(const char *addr, int length, int type,
645				struct hostent *result,
646				char *buffer, int buflen, int *h_errnop);
647
648/* gethostent.c */
649struct hostent *gethostbyname(const char *nam);
650struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type);
651struct hostent *gethostent(void);
652
653/* gethostent_r.c */
654int sethostent(int stay);
655int endhostent(void);
656struct hostent *gethostent_r(struct hostent *result, char *buffer, int buflen,
657				int *h_errnop);
658
659/* getipnodeby.c */
660void freehostent(struct hostent *hent);
661struct hostent *getipnodebyaddr(const void *src, size_t len, int type,
662				int *error_num);
663struct hostent *getipnodebyname(const char *name, int af, int flags,
664				int *error_num);
665
666/* getrpcent.c */
667struct rpcent *getrpcbyname(const char *nam);
668struct rpcent *getrpcbynumber(const int num);
669struct rpcent *getrpcent(void);
670
671/* getrpcent_r.c */
672struct rpcent *getrpcbyname_r(const char *name, struct rpcent *result,
673				char *buffer, int buflen);
674struct rpcent *getrpcbynumber_r(const int number, struct rpcent *result,
675				char *buffer, int buflen);
676void setrpcent(const int stay);
677void endrpcent(void);
678struct rpcent *getrpcent_r(struct rpcent *result, char *buffer, int buflen);
679
680/* inet_ntop.c */
681const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
682
683/* inet_pton.c */
684int inet_pton(int af, const char *src, void *dst);
685
686/* netdir_inet.c */
687int _get_hostserv_inetnetdir_byname(struct netconfig *nconf,
688				struct nss_netdirbyname_in *args,
689				union nss_netdirbyname_out *res);
690int _get_hostserv_inetnetdir_byaddr(struct netconfig *nconf,
691				struct nss_netdirbyaddr_in *args,
692				union nss_netdirbyaddr_out *res);
693int __nss2herrno(nss_status_t nsstat);
694nss_status_t _herrno2nss(int h_errno);
695struct hostent *_switch_gethostbyname_r(const char *name,
696				struct hostent *result,
697				char *buffer, int buflen, int *h_errnop);
698struct hostent *_switch_gethostbyaddr_r(const char *addr, int len, int type,
699				struct hostent *result,
700				char *buffer, int buflen, int *h_errnop);
701int str2servent(const char *instr, int lenstr, void *ent,
702				char *buffer, int buflen);
703void *__inet_get_local_interfaces(void);
704void __inet_free_local_interfaces(void *p);
705int __inet_address_is_local(void *p, struct in_addr addr);
706int __inet_uaddr_is_local(void *p, struct netconfig *nc, char *uaddr);
707int __inet_address_count(void *p);
708ulong_t __inet_get_addr(void *p, int n);
709char *__inet_get_uaddr(void *p, struct netconfig *nc, int n);
710char *__inet_get_networka(void *p, int n);
711
712/* netdir_inet_sundry.c */
713
714/*
715 * usr/src/lib/libnsl/rpc routines
716 */
717
718/* auth_des.c */
719AUTH *authdes_seccreate(const char *servername, uint_t win,
720			const char *timehost, const des_block *ckey);
721
722/* auth_none.c */
723AUTH *authnone_create(void);
724
725/* auth_sys.c */
726AUTH *authsys_create(const char *machname, uid_t uid, gid_t gid, int len,
727			const gid_t *aup_gids);
728AUTH *authsys_create_default(void);
729
730/* auth_time.c */
731
732/* authdes_prot.c */
733bool_t xdr_authdes_cred(XDR *xdrs, struct authdes_cred *cred);
734bool_t xdr_authdes_verf(XDR *xdrs, struct authdes_verf *verf);
735
736/* authsys_prot.c */
737bool_t xdr_authsys_parms(XDR *xdrs, struct authsys_parms *p);
738bool_t xdr_uid_t(XDR *xdrs, uid_t *ip);
739bool_t xdr_gid_t(XDR *xdrs, gid_t *ip);
740
741/* clnt_bcast.c */
742enum clnt_stat rpc_broadcast_exp(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
743		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
744		caddr_t resultsp, resultproc_t eachresult, int inittime,
745		int waittime, const char *netclass);
746enum clnt_stat rpc_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
747		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
748		caddr_t resultsp, resultproc_t eachresult,
749		const char *netclass);
750
751/* clnt_dg.c */
752CLIENT *clnt_dg_create(int fd, struct netbuf *svcaddr, rpcprog_t program,
753		rpcvers_t version, uint_t sendsz, uint_t recvsz);
754
755/* clnt_door.c */
756CLIENT *clnt_door_create(rpcprog_t program, rpcvers_t version, uint_t sendsz);
757
758/* clnt_generic.c */
759CLIENT *clnt_create_vers(const char *hostname, rpcprog_t prog,
760		rpcvers_t *vers_out, rpcvers_t vers_low,
761		rpcvers_t vers_high, const char *nettype);
762CLIENT *clnt_create_vers_timed(const char *hostname, rpcprog_t prog,
763		rpcvers_t *vers_out, rpcvers_t vers_low,
764		rpcvers_t vers_high, const char *nettype,
765		const struct timeval *tp);
766CLIENT *clnt_create(const char *hostname, rpcprog_t prog, rpcvers_t vers,
767		const char *nettype);
768CLIENT *clnt_create_timed(const char *hostname, rpcprog_t prog, rpcvers_t vers,
769		const char *netclass, const struct timeval *tp);
770CLIENT *clnt_tp_create(const char *hostname, rpcprog_t prog, rpcvers_t vers,
771		const struct netconfig *nconf);
772CLIENT *clnt_tp_create_timed(const char *hostname, rpcprog_t prog,
773		rpcvers_t vers, const struct netconfig *nconf,
774		const struct timeval *tp);
775CLIENT *clnt_tli_create(int fd, const struct netconfig *nconf,
776		struct netbuf *svcaddr, rpcprog_t prog, rpcvers_t vers,
777		uint_t sendsz, uint_t recvsz);
778
779/* clnt_perror.c */
780char *clnt_sperror(const CLIENT *cl, const char *s);
781void clnt_perror(const CLIENT *cl, const char *s);
782void clnt_perrno(enum clnt_stat num);
783char *clnt_spcreateerror(const char *s);
784void clnt_pcreateerror(const char *s);
785const char *clnt_sperrno(const enum clnt_stat stat);
786
787/* clnt_raw.c */
788CLIENT *clnt_raw_create(rpcprog_t prog, rpcvers_t vers);
789
790/* clnt_simple.c */
791enum clnt_stat rpc_call(const char *host, rpcprog_t prognum, rpcvers_t versnum,
792		rpcproc_t procnum, xdrproc_t inproc, const char *in,
793		xdrproc_t outproc, char *out, const char *netclass);
794
795/* clnt_vc.c */
796CLIENT *clnt_vc_create(int fd, struct netbuf *svcaddr, rpcprog_t prog,
797		rpcvers_t vers, uint_t sendsz, uint_t recvsz);
798
799/* getdname.c */
800int getdomainname(char *name, int namelen);
801int setdomainname(char *domain, int len);
802
803/* gethostname.c */
804int gethostname(char *hname, int hlen);
805
806/* inet_ntoa.c */
807char *inet_ntoa_r(struct in_addr in, char b[]);
808char *inet_ntoa(struct in_addr in);
809in_addr_t inet_addr(const char *cp);
810in_addr_t inet_netof(struct in_addr in);
811
812/* key_call.c */
813int key_setsecret(const char *secretkey);
814int key_secretkey_is_set(void);
815int key_encryptsession_pk(const char *remotename, netobj *remotekey,
816				des_block *deskey);
817int key_decryptsession_pk(const char *remotename, netobj *remotekey,
818				des_block *deskey);
819
820int key_encryptsession(const char *remotename, des_block *deskey);
821int key_decryptsession(const char *remotename, des_block *deskey);
822int key_gendes(des_block *key);
823int key_setnet(struct key_netstarg *arg);
824int key_get_conv(char *pkey, des_block *deskey);
825int key_call(ulong_t proc, xdrproc_t xdr_arg, char *arg, xdrproc_t xdr_rslt,
826				char *rslt);
827
828/* key_prot.c */
829bool_t xdr_keystatus(XDR *xdrs, keystatus *objp);
830bool_t xdr_keybuf(XDR *xdrs, keybuf objp);
831bool_t xdr_netnamestr(XDR *xdrs, netnamestr *objp);
832bool_t xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp);
833bool_t xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp);
834bool_t xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp);
835bool_t xdr_unixcred(XDR *xdrs, unixcred *objp);
836bool_t xdr_getcredres(XDR *xdrs, getcredres *objp);
837bool_t xdr_key_netstarg(XDR *xdrs, key_netstarg *objp);
838bool_t xdr_key_netstres(XDR *xdrs, key_netstres *objp);
839
840/* mt_misc.c */
841#ifdef rpc_createerr
842#undef rpc_createerr
843#endif
844struct rpc_createerr *__rpc_createerr(void);
845
846/* netname.c */
847int getnetname(char *name);
848int __getnetnamebyuid(char *name, uid_t uid);
849int user2netname(char *netname, const uid_t uid, const char *domain);
850int host2netname(char *netname, const char *host, const char *domain);
851
852/* netnamer.c */
853int netname2user(const char *netname, uid_t *uidp, gid_t *gidp,
854					int *gidlenp, gid_t *gidlist);
855int netname2host(const char *netname, char *hostname, int hostlen);
856
857/* openchild.c */
858
859/* pmap_clnt.c */
860int pmap_set(rpcprog_t program, rpcvers_t version, rpcprot_t protocol, ushort_t port);
861bool_t pmap_unset(rpcprog_t program, rpcvers_t version);
862ushort_t pmap_getport(struct sockaddr_in *address, rpcprog_t program,
863			rpcvers_t version, rpcprot_t protocol);
864struct pmaplist *pmap_getmaps(struct sockaddr_in *address);
865enum clnt_stat pmap_rmtcall(struct sockaddr_in *addr, rpcprog_t prog,
866			rpcvers_t vers, rpcproc_t proc, xdrproc_t xdrargs,
867			caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
868			struct timeval tout, rpcport_t *port_ptr);
869
870/* pmap_prot.c */
871bool_t xdr_pmap(XDR *xdrs, struct pmap *objp);
872bool_t xdr_pmaplist_ptr(XDR *xdrs, pmaplist_ptr *rp);
873bool_t xdr_pmaplist(XDR *xdrs, PMAPLIST **rp);
874bool_t xdr_rmtcallargs(XDR *xdrs, struct p_rmtcallargs *cap);
875bool_t xdr_rmtcallres(XDR *xdrs, struct p_rmtcallres *crp);
876
877/* rpc_callmsg.c */
878bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg);
879
880/* rpc_comdata.c */
881
882/* rpc_generic.c */
883int __rpc_dtbsize(void);
884uint_t __rpc_get_t_size(t_scalar_t size, t_scalar_t bufsize);
885uint_t __rpc_get_a_size(t_scalar_t size);
886struct netconfig *__rpc_getconfip(char *nettype);
887void *__rpc_setconf(char *nettype);
888struct netconfig *__rpc_getconf(void *vhandle);
889void __rpc_endconf(void *vhandle);
890struct netconfig *__rpcfd_to_nconf(int fd, int servtype);
891int __rpc_matchserv(int servtype, unsigned int nc_semantics);
892
893/* rpc_prot.c */
894bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap);
895bool_t xdr_des_block(XDR *xdrs, des_block *blkp);
896bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar);
897bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr);
898bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg);
899bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg);
900void __seterr_reply(struct rpc_msg *msg, struct rpc_err *error);
901
902/* rpc_sel2poll.c */
903int __rpc_select_to_poll(int fdmax, fd_set *fdset, struct pollfd *p0);
904int __rpc_timeval_to_msec(struct timeval *t);
905
906/* rpc_soc.c */
907CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr, rpcprog_t prog,
908			rpcvers_t vers, struct timeval wait, int *sockp,
909			uint_t sendsz, uint_t recvsz);
910CLIENT *clntudp_create(struct sockaddr_in *raddr, rpcprog_t program,
911			rpcvers_t version, struct timeval wait, int *sockp);
912CLIENT *clnttcp_create(struct sockaddr_in *raddr, rpcprog_t prog,
913			rpcvers_t vers, int *sockp, uint_t sendsz,
914			uint_t recvsz);
915CLIENT *clntraw_create(rpcprog_t prog, rpcvers_t vers);
916SVCXPRT *svctcp_create(int fd, uint_t sendsize, uint_t recvsize);
917SVCXPRT *svcudp_bufcreate(int fd, uint_t sendsize, uint_t recvsize);
918SVCXPRT *svcfd_create(int fd, uint_t sendsize, uint_t recvsize);
919SVCXPRT *svcudp_create(int fd);
920SVCXPRT *svcraw_create(void);
921int __rpc_bindresvport(int fd, struct sockaddr_in *sin, int *portp, int qlen);
922void get_myaddress(struct sockaddr_in *addr);
923ushort_t getrpcport(char *host, rpcprog_t prognum, rpcvers_t versnum, rpcprot_t proto);
924int callrpc(char *host, rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
925		xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
926int registerrpc(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
927		char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc);
928enum clnt_stat clnt_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
929		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
930		caddr_t resultsp, resultproc_t eachresult);
931AUTH *authdes_create(char *servername, uint_t window,
932		struct sockaddr_in *syncaddr, des_block *ckey);
933
934/* rpc_td.c */
935
936/* rpcb_clnt.c */
937bool_t __rpc_control(int request, void *info);
938bool_t rpcb_set(rpcprog_t program, rpcvers_t version,
939		const struct netconfig *nconf, const struct netbuf *address);
940bool_t rpcb_unset(rpcprog_t program, rpcvers_t version,
941		const struct netconfig *nconf);
942int rpcb_getaddr(rpcprog_t program, rpcvers_t version,
943		const struct netconfig *nconf, struct netbuf *address,
944		const char *host);
945rpcblist *rpcb_getmaps(const struct netconfig *nconf, const char *host);
946enum clnt_stat rpcb_rmtcall(const struct netconfig *nconf, const char *host,
947		rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
948		xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres,
949		caddr_t resp, struct timeval tout,
950		struct netbuf *addr_ptr);
951bool_t rpcb_gettime(const char *host, time_t *timep);
952char *rpcb_taddr2uaddr(struct netconfig *nconf, struct netbuf *taddr);
953struct netbuf *rpcb_uaddr2taddr(struct netconfig *nconf, char *uaddr);
954
955/* rpcb_prot.c */
956bool_t xdr_rpcb(XDR *xdrs, RPCB *objp);
957bool_t xdr_rpcblist_ptr(XDR *xdrs, rpcblist_ptr *rp);
958bool_t xdr_rpcblist(XDR *xdrs, RPCBLIST **rp);
959bool_t xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp);
960bool_t xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp);
961bool_t xdr_rpcb_rmtcallargs(XDR *xdrs, struct r_rpcb_rmtcallargs *objp);
962bool_t xdr_rpcb_rmtcallres(XDR *xdrs, struct r_rpcb_rmtcallres *objp);
963bool_t xdr_netbuf(XDR *xdrs, struct netbuf *objp);
964
965/* rpcb_st_xdr.c */
966bool_t xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp);
967bool_t xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp);
968
969bool_t xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp);
970bool_t xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp);
971bool_t xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp);
972bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp);
973bool_t xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp);
974bool_t xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp);
975
976/* rpcdname.c */
977int __rpc_get_default_domain(char **domain);
978
979/* rpcsec_gss_if.c */
980AUTH *rpc_gss_seccreate(CLIENT *clnt, char *principal, char *mechanism,
981		rpc_gss_service_t service_type, char *qop,
982		rpc_gss_options_req_t *options_req,
983		rpc_gss_options_ret_t *options_ret);
984bool_t rpc_gss_set_defaults(AUTH *auth, rpc_gss_service_t service, char *qop);
985bool_t rpc_gss_get_principal_name(rpc_gss_principal_t *principal, char
986		*mechanism, char *user_name, char *node, char *secdomain);
987char **rpc_gss_get_mechanisms(void);
988char **rpc_gss_get_mech_info(char *mechanism, rpc_gss_service_t *service);
989bool_t rpc_gss_get_versions(u_int *vers_hi, u_int *vers_lo);
990bool_t rpc_gss_is_installed(char *mechanism);
991bool_t rpc_gss_set_svc_name(char *principal, char *mechanism, uint_t req_time,
992		uint_t program, uint_t version);
993bool_t rpc_gss_set_callback(rpc_gss_callback_t *cb);
994bool_t rpc_gss_getcred(struct svc_req *req, rpc_gss_rawcred_t **rcred,
995		rpc_gss_ucred_t **ucred, void **cookie);
996bool_t rpc_gss_mech_to_oid(char *mech, rpc_gss_OID *oid);
997bool_t rpc_gss_qop_to_num(char *qop, char *mech, u_int *num);
998int rpc_gss_max_data_length(AUTH *rpcgss_handle, int max_tp_unit_len);
999int rpc_gss_svc_max_data_length(struct svc_req *req, int max_tp_unit_len);
1000void rpc_gss_get_error(rpc_gss_error_t *error);
1001
1002/* rtime_tli.c */
1003int rtime_tli(char *host, struct timeval *timep, struct timeval *timeout);
1004
1005/* svc.c */
1006void xprt_register(const SVCXPRT *xprt);
1007void xprt_unregister(const SVCXPRT *xprt);
1008bool_t svc_reg(const SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
1009		void (*dispatch)(), const struct netconfig *nconf);
1010void svc_unreg(rpcprog_t prog, rpcvers_t vers);
1011bool_t svc_register(SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
1012		void (*dispatch)(), int protocol);
1013void svc_unregister(rpcprog_t prog, rpcvers_t vers);
1014bool_t svc_sendreply(const SVCXPRT *xprt, xdrproc_t xdr_results,
1015		caddr_t xdr_location);
1016void svcerr_noproc(const SVCXPRT *xprt);
1017void svcerr_decode(const SVCXPRT *xprt);
1018void svcerr_systemerr(const SVCXPRT *xprt);
1019void svcerr_auth(const SVCXPRT *xprt, enum auth_stat why);
1020void svcerr_weakauth(const SVCXPRT *xprt);
1021void svcerr_noprog(const SVCXPRT *xprt);
1022void svcerr_progvers(const SVCXPRT *xprt, rpcvers_t low_vers,
1023		rpcvers_t high_vers);
1024void svc_getreq(int rdfds);
1025void svc_getreqset(fd_set *readfds);
1026void svc_getreq_poll(struct pollfd *pfdp, int pollretval);
1027void svc_getreq_common(int fd);
1028SVCXPRT *svc_xprt_alloc(void);
1029void svc_xprt_free(SVCXPRT *xprt);
1030bool_t svc_get_local_cred(SVCXPRT *xprt, svc_local_cred_t *lcred);
1031SVCAUTH *__svc_get_svcauth(SVCXPRT *);
1032void *__svc_set_proc_cleanup_cb(void *cb);
1033
1034/* svc_auth.c */
1035enum auth_stat __authenticate(struct svc_req *rqst, struct rpc_msg *msg);
1036int svc_auth_reg(int cred_flavor, enum auth_stat (*handler)());
1037
1038/* svc_auth_sys.c */
1039
1040/* svc_dg.c */
1041SVCXPRT *svc_dg_create(int fd, uint_t sendsize, uint_t recvsize);
1042int svc_dg_enablecache(SVCXPRT *xprt, uint_t size);
1043
1044/* svc_door.c */
1045SVCXPRT *svc_door_create(void (*dispatch)(), rpcprog_t prognum,
1046			rpcvers_t versnum, uint_t sendsize);
1047
1048/* svc_generic.c */
1049int svc_create(void (*dispatch)(), rpcprog_t prognum, rpcvers_t versnum,
1050			const char *nettype);
1051SVCXPRT *svc_tp_create(void (*dispatch)(), rpcprog_t prognum, rpcvers_t versnum,
1052			const struct netconfig *nconf);
1053SVCXPRT *svc_tli_create(int fd, const struct netconfig *nconf,
1054			const struct t_bind *bindaddr, uint_t sendsz,
1055			uint_t recvsz);
1056
1057/* svc_raw.c */
1058SVCXPRT *svc_raw_create(void);
1059
1060/* svc_run.c */
1061void svc_run(void);
1062void svc_exit(void);
1063void svc_done(SVCXPRT *xprt);
1064bool_t rpc_control(int op, void *info);
1065
1066/* svc_simple.c */
1067int rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
1068		char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc,
1069		const char *nettype);
1070
1071/* svc_vc.c */
1072SVCXPRT *svc_vc_create(int fd, uint_t sendsize, uint_t recvsize);
1073SVCXPRT *svc_fd_create(int fd, uint_t sendsize, uint_t recvsize);
1074void __svc_nisplus_fdcleanup_hack(void);
1075void __svc_nisplus_enable_timestamps(void);
1076void __svc_nisplus_purge_since(long since);
1077bool_t __svc_vc_dupcache_init(SVCXPRT *xprt, void *condition, int basis);
1078int __svc_vc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz);
1079int __svc_vc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
1080				int status);
1081
1082/* svcauth_des.c */
1083int authdes_getucred(const struct authdes_cred *adc, uid_t *uid, gid_t *gid,
1084				short *grouplen, gid_t *groups);
1085enum auth_stat __svcauth_des(struct svc_req *rqst, struct rpc_msg *msg);
1086
1087/* ti_opts.c */
1088int __rpc_negotiate_uid(int fd);
1089int __rpc_get_local_uid(SVCXPRT *trans, uid_t *uid_out);
1090
1091/* xdr.c */
1092void xdr_free(xdrproc_t proc, char *objp);
1093bool_t xdr_void(void);
1094bool_t xdr_int(XDR *xdrs, int *ip);
1095bool_t xdr_u_int(XDR *xdrs, uint_t *up);
1096bool_t xdr_long(XDR *xdrs, long *lp);
1097bool_t xdr_u_long(XDR *xdrs, ulong_t *ulp);
1098bool_t xdr_short(XDR *xdrs, short *sp);
1099bool_t xdr_u_short(XDR *xdrs, ushort_t *sp);
1100bool_t xdr_char(XDR *xdrs, char *cp);
1101bool_t xdr_u_char(XDR *xdrs, uchar_t *cp);
1102bool_t xdr_bool(XDR *xdrs, bool_t *bp);
1103bool_t xdr_enum(XDR *xdrs, enum_t *ep);
1104bool_t xdr_opaque(XDR *xdrs, caddr_t cp, uint_t cnt);
1105bool_t xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, uint_t maxsize);
1106bool_t xdr_netobj(XDR *xdrs, struct netobj *np);
1107bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp,
1108			const struct xdr_discrim *choices, xdrproc_t dfault);
1109bool_t xdr_string(XDR *xdrs, char **cpp, uint_t maxsize);
1110bool_t xdr_hyper(XDR *xdrs, longlong_t *hp);
1111bool_t xdr_u_hyper(XDR *xdrs, u_longlong_t *hp);
1112bool_t xdr_longlong_t(XDR *xdrs, longlong_t *hp);
1113bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp);
1114bool_t xdr_ulonglong_t(XDR *xdrs, u_longlong_t *hp);
1115bool_t xdr_wrapstring(XDR *xdrs, char **cpp);
1116
1117/* xdr_array.c */
1118bool_t xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, uint_t maxsize,
1119				uint_t elsize, xdrproc_t elproc);
1120bool_t xdr_vector(XDR *xdrs, char *basep, uint_t nelem, uint_t elemsize,
1121				xdrproc_t xdr_elem);
1122
1123/* xdr_float.c */
1124bool_t xdr_float(XDR *xdrs, float *fp);
1125bool_t xdr_double(XDR *xdrs, double *dp);
1126bool_t xdr_quadruple(XDR *xdrs, long double *fp);
1127
1128/* xdr_mem.c */
1129void xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op);
1130
1131/* xdr_rec.c */
1132void xdrrec_create(XDR *xdrs, uint_t sendsize, uint_t recvsize,
1133			caddr_t tcp_handle, int (*readit)(), int (*writeit)());
1134
1135uint_t xdrrec_readbytes(XDR *xdrs, caddr_t addr, uint_t l);
1136bool_t xdrrec_skiprecord(XDR *xdrs);
1137bool_t xdrrec_eof(XDR *xdrs);
1138bool_t xdrrec_endofrecord(XDR *xdrs, bool_t sendnow);
1139
1140/* xdr_refer.c */
1141bool_t xdr_reference(XDR *xdrs, caddr_t *pp, uint_t size, xdrproc_t proc);
1142bool_t xdr_pointer(XDR *xdrs, char **objpp, uint_t obj_size, xdrproc_t xdr_obj);
1143
1144/* xdr_sizeof.c */
1145unsigned int xdr_sizeof(xdrproc_t func, void *data);
1146
1147/* xdr_stdio.c */
1148void xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op);
1149
1150/* svid_funcs.c */
1151#undef	auth_destroy
1152#undef	clnt_call
1153#undef	clnt_control
1154#undef	clnt_destroy
1155#undef	clnt_freeres
1156#undef	clnt_geterr
1157#undef	svc_destroy
1158#undef	svc_freeargs
1159#undef	svc_getargs
1160#undef	svc_getrpccaller
1161#undef	xdr_destroy
1162#undef	xdr_getpos
1163#undef	xdr_inline
1164#undef	xdr_setpos
1165void auth_destroy(AUTH *auth);
1166enum clnt_stat clnt_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs,
1167			caddr_t argsp, xdrproc_t xres, caddr_t resp,
1168			struct timeval timeout);
1169bool_t clnt_control(CLIENT *cl, uint_t rq, void *in);
1170void clnt_destroy(CLIENT *cl);
1171bool_t clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp);
1172void clnt_geterr(CLIENT *cl, struct rpc_err *errp);
1173bool_t svc_control(SVCXPRT *xprt, const uint_t rq, void *in);
1174bool_t svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp);
1175bool_t svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp);
1176struct netbuf *svc_getrpccaller(SVCXPRT *xprt);
1177long *xdr_inline(XDR *xdrs, int len);
1178void xdr_destroy(XDR *xdrs);
1179uint_t xdr_getpos(XDR *xdrs);
1180bool_t xdr_setpos(XDR *xdrs, uint_t pos);
1181
1182/*
1183 * usr/src/lib/libnsl/saf routines
1184 */
1185
1186/* checkver.c */
1187int check_version(int ver, char *fname);
1188
1189/* doconfig.c */
1190int doconfig(int fd, char *script, long rflag);
1191
1192/*
1193 * usr/src/lib/libnsl/yp routines
1194 */
1195
1196/* dbm.c */
1197int dbminit(char *file);
1198int dbmclose(void);
1199datum fetch(datum key);
1200int delete(datum key);
1201int store(datum key, datum dat);
1202datum firstkey(void);
1203datum nextkey(datum key);
1204datum firsthash(long hash);
1205datum makdatum(char *buf, int n);
1206long hashinc(long hash);
1207long calchash(datum item);
1208
1209/* yp_all.c */
1210int yp_all(char *domain, char *map, struct ypall_callback *callback);
1211int __yp_all_rsvdport(char *domain, char *map, struct ypall_callback *callback);
1212
1213/* yp_b_clnt.c */
1214enum ypbind_resptype {
1215	YPBIND_SUCC_VAL = 1,
1216	YPBIND_FAIL_VAL = 2
1217};
1218typedef enum ypbind_resptype ypbind_resptype;
1219struct ypbind_resp {
1220	ypbind_resptype ypbind_status;
1221	union {
1222		uint_t ypbind_error;
1223		struct ypbind_binding *ypbind_bindinfo;
1224	} ypbind_resp_u;
1225};
1226typedef struct ypbind_resp ypbind_resp;
1227struct ypbind_domain {
1228	char *ypbind_domainname;
1229	rpcvers_t ypbind_vers;
1230};
1231typedef struct ypbind_domain ypbind_domain;
1232struct ypbind_setdom {
1233	char *ypsetdom_domain;
1234	struct ypbind_binding *ypsetdom_bindinfo;
1235};
1236typedef struct ypbind_setdom ypbind_setdom;
1237ypbind_resp *ypbindproc_domain_3(ypbind_domain *argp, CLIENT *clnt);
1238
1239/* yp_b_xdr.c */
1240bool_t xdr_ypbind_domain(XDR *xdrs, ypbind_domain *objp);
1241bool_t xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp);
1242bool_t xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp);
1243bool_t xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp);
1244
1245/* yp_bind.c */
1246struct dom_binding {
1247	struct dom_binding *dom_pnext;
1248	char *dom_domain;
1249	struct ypbind_binding *dom_binding;
1250	CLIENT *dom_client;
1251	int cache_bad;
1252	int fd;
1253	dev_t rdev;
1254	int ref_count;
1255	int need_free;
1256	mutex_t server_name_lock;
1257};
1258int __yp_dobind(char *domain, struct dom_binding **binding);
1259int __yp_rel_binding(struct dom_binding *binding);
1260void yp_unbind(char *domain);
1261int __yp_add_binding(char *domain, char *addr);
1262int yp_bind(char *domain);
1263int yp_get_default_domain(char **domain);
1264int usingypmap(char **ddn, char *map);
1265CLIENT *__clnt_create_loopback(rpcprog_t prog, rpcvers_t vers, int err);
1266
1267/* yp_enum.c */
1268int yp_first(char *domain, char *map, char **key, int *keylen,
1269					char **val, int  *vallen);
1270int yp_next(char *domain, char *map, char *inkey, int inkeylen,
1271		char **outkey, int  *outkeylen, char **val, int *vallen);
1272
1273/* yp_master.c */
1274int yp_master(char *domain, char *map, char **master);
1275int __yp_master_rsvdport(char *domain, char *map, char **master);
1276
1277/* yp_match.c */
1278int yp_match(char *domain, char *map, char *key, int keylen,
1279						char **val, int  *vallen);
1280int yp_match_rsvdport(char *domain, char *map, char *key, int keylen,
1281						char **val, int  *vallen);
1282void __empty_yp_cache(void);
1283
1284/* yp_order.c */
1285int yp_order(char *domain, char *map, unsigned long *order);
1286
1287/* yp_rsvd.c */
1288CLIENT *__yp_clnt_create_rsvdport(const char *hostname,
1289			rpcprog_t prog, rpcvers_t vers,
1290			const char *nettype,
1291			const uint_t sendsz, const uint_t recvsz);
1292
1293/* yp_update.c */
1294int yp_update(char *domain, char *map, unsigned op,
1295			char *key, int keylen, char *data, int datalen);
1296
1297/* yp_xdr.c */
1298bool xdr_datum(XDR * xdrs, datum *pdatum);
1299bool xdr_ypdomain_wrap_string(XDR *xdrs, char **ppstring);
1300bool xdr_ypmap_wrap_string(XDR *xdrs, char **ppstring);
1301bool xdr_ypreq_key(XDR *xdrs, struct ypreq_key *ps);
1302bool xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *ps);
1303bool xdr_ypresp_val(XDR *xdrs, struct ypresp_val *ps);
1304bool xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *ps);
1305bool xdr_ypowner_wrap_string(XDR *xdrs, char **ppstring);
1306bool xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *ps);
1307bool xdr_ypresp_master(XDR *xdrs, struct ypresp_master *ps);
1308bool xdr_ypresp_order(XDR * xdrs, struct ypresp_order *ps);
1309bool xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *ps);
1310bool xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *ps);
1311bool xdr_ypreq_newxfr(XDR *xdrs, struct ypreq_newxfr *ps);
1312bool xdr_ypreq_xfr(XDR *xdrs, struct ypreq_xfr *ps);
1313bool xdr_ypall(XDR *xdrs, struct ypall_callback *callback);
1314
1315/* yperr_string.c */
1316char *yperr_string(int code);
1317
1318/* yppasswd_xdr.c */
1319bool_t xdr_yppasswd(XDR *xdrsp, struct yppasswd *pp);
1320
1321/* ypprot_err.c */
1322int ypprot_err(int yp_protocol_error);
1323
1324/* ypupd.c */
1325bool_t xdr_yp_buf(XDR *xdrs, yp_buf *objp);
1326bool_t xdr_ypupdate_args(XDR *xdrs, ypupdate_args *objp);
1327bool_t xdr_ypdelete_args(XDR *xdrs, ypdelete_args *objp);
1328
1329/* nis_sec_mechs.c */
1330char *__nis_keyalg2authtype(keylen_t keylen, algtype_t algtype,
1331	char *authtype, size_t authtype_len);
1332