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