xref: /titanic_41/usr/src/lib/libnsl/common/llib-lnsl (revision db02be5754449d8a49e2d5a695ba0237d964b5dc)
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 2008 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);
449
450/* print_obj.c */
451void nis_print_rights(u_int r);
452void nis_print_directory(directory_obj *r);
453void nis_print_group(group_obj *g);
454void nis_print_table(table_obj *t);
455void nis_print_link(link_obj *l);
456void nis_print_entry(entry_obj *edata);
457void nis_print_object(nis_object *o);
458
459/* thr_misc.c */
460
461/*
462 * usr/src/lib/libnsl/nsl routines
463 */
464
465/* _conn_util.c */
466
467/* _data2.c */
468
469/* _errlst.c */
470int *__t_errno(void);
471
472/* _utility.c */
473
474/* t_accept.c */
475int t_accept(int, int, struct t_call *);
476
477/* t_alloc.c */
478char *t_alloc(int, int, int);
479
480/* t_bind.c */
481int t_bind(int, struct t_bind *, struct t_bind *);
482
483/* t_close.c */
484int t_close(int);
485
486/* t_connect.c */
487int t_connect(int, struct t_call *, struct t_call *);
488
489/* t_error.c */
490void t_error(const char *);
491
492/* t_free.c */
493int t_free(char *, int);
494
495/* t_getinfo.c */
496int t_getinfo(int, struct t_info *);
497
498/* t_getname.c */
499int t_getname(int, struct netbuf *, int);
500
501/* t_getstate.c */
502int t_getstate(int);
503
504/* t_listen.c */
505int t_listen(int, struct t_call *);
506
507/* t_look.c */
508int t_look(int);
509
510/* t_open.c */
511int t_open(const char *, int, struct t_info *);
512
513/* t_optmgmt.c */
514int t_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *);
515
516/* t_rcv.c */
517int t_rcv(int, char *, unsigned, int *);
518
519/* t_rcvconnect.c */
520int t_rcvconnect(int, struct t_call *);
521
522/* t_rcvdis.c */
523int t_rcvdis(int, struct t_discon *);
524
525/* t_rcvrel.c */
526int t_rcvrel(int);
527
528/* t_rcvudata.c */
529int t_rcvudata(int, struct t_unitdata *, int *);
530
531/* t_rcvuderr.c */
532int t_rcvuderr(int, struct t_uderr *);
533
534/* t_snd.c */
535int t_snd(int, char *, unsigned, int);
536
537/* t_snddis */
538int t_snddis(int, struct t_call *);
539
540/* t_sndrel.c */
541int t_sndrel(int);
542
543/* t_sndudata.c */
544int t_sndudata(int, struct t_unitdata *);
545
546/* t_strerror.c */
547char *t_strerror(int);
548
549/* t_sync.c */
550int t_sync(int);
551
552/* t_unbind.c */
553int t_unbind(int);
554
555/*
556 * struct t_iovec is defined in <xti.h>. But <xti.h> cannot be included
557 * because inclusion of <xti.h> and <tiuser.h> are mututally exclusive
558 * and <tiuser.h> is exposed by the inclusion of <rpc/rpc.h>. Needs to
559 * be seen how to build llib-lnsl.ln from multiple source files to avoid
560 * this problem.
561 */
562struct t_iovec {
563	void	*iov_base;
564	size_t	iov_len;
565};
566
567/* t_sndv.c */
568int t_sndv(int, const struct t_iovec *,  unsigned int, int);
569
570/* t_sndvudata.c */
571int t_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);
572
573/* t_sndreldata.c */
574int t_sndreldata(int, struct t_discon *);
575
576/* t_rcvv.c */
577int t_rcvv(int, struct t_iovec *, unsigned int, int *);
578
579/* t_rcvvudata.c */
580int t_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
581        unsigned int, int *);
582
583/* t_rcvreldata.c */
584extern int t_rcvreldata(int, struct t_discon *);
585
586/* t_sysconf.c */
587int t_sysconf(int);
588
589/* xti_wrappers.c */
590int _xti_accept(int, int, struct t_call *);
591int _xti_xns5_accept(int, int, struct t_call *);
592char *_xti_alloc(int, int, int);
593int _xti_bind(int, struct t_bind *, struct t_bind *);
594int _xti_close(int);
595int _xti_connect(int, struct t_call *, struct t_call *);
596int _xti_error(char *);
597int _xti_free(char *, int);
598int _xti_getinfo(int, struct t_info *);
599int _xti_getprotaddr(int, struct t_bind *, struct t_bind *);
600int _xti_getstate(int);
601int _xti_listen(int, struct t_call *);
602int _xti_look(int);
603int _xti_open(char *, int, struct t_info *);
604int _xti_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *);
605int _xti_rcv(int, char *, unsigned int, int *);
606int _xti_rcvconnect(int, struct t_call *);
607int _xti_rcvdis(int, struct t_discon *);
608int _xti_rcvrel(int);
609int _xti_rcvreldata(int, struct t_discon *);
610int _xti_rcvudata(int, struct t_unitdata *, int *);
611int _xti_rcvuderr(int, struct t_uderr *);
612int _xti_rcvv(int, struct t_iovec *, unsigned int, int *);
613int _xti_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
614    unsigned int, int *);
615int _xti_snd(int, char *, unsigned int, int);
616int _xti_xns5_snd(int, char *, unsigned int, int);
617int _xti_snddis(int, struct t_call *);
618int _xti_sndrel(int);
619int _xti_sndreldata(int, struct t_discon *);
620int _xti_sndudata(int, struct t_unitdata *);
621int _xti_sndv(int, const struct t_iovec *, unsigned int, int);
622int _xti_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);
623char *_xti_strerror(int);
624int _xti_sync(int);
625int _xti_sysconf(int);
626int _xti_unbind(int);
627
628/*
629 * usr/src/lib/libnsl/nss routines
630 */
631
632/* gethostby_door.c */
633
634/* gethostbyname_r.c */
635struct hostent *_uncached_gethostbyname_r(const char *nam,
636				struct hostent *result,
637				char *buffer, int buflen, int *h_errnop);
638struct hostent *_uncached_gethostbyaddr_r(const char *addr, int length,
639				int type, struct hostent *result,
640				char *buffer, int buflen, int *h_errnop);
641struct hostent *gethostbyname_r(const char *nam, struct hostent *result,
642				char *buffer, int buflen, int *h_errnop);
643struct hostent *gethostbyaddr_r(const char *addr, int length, int type,
644				struct hostent *result,
645				char *buffer, int buflen, int *h_errnop);
646
647/* gethostent.c */
648struct hostent *gethostbyname(const char *nam);
649struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type);
650struct hostent *gethostent(void);
651
652/* gethostent_r.c */
653int sethostent(int stay);
654int endhostent(void);
655struct hostent *gethostent_r(struct hostent *result, char *buffer, int buflen,
656				int *h_errnop);
657
658/* getipnodeby.c */
659void freehostent(struct hostent *hent);
660struct hostent *getipnodebyaddr(const void *src, size_t len, int type,
661				int *error_num);
662struct hostent *getipnodebyname(const char *name, int af, int flags,
663				int *error_num);
664
665/* getrpcent.c */
666struct rpcent *getrpcbyname(const char *nam);
667struct rpcent *getrpcbynumber(const int num);
668struct rpcent *getrpcent(void);
669
670/* getrpcent_r.c */
671struct rpcent *getrpcbyname_r(const char *name, struct rpcent *result,
672				char *buffer, int buflen);
673struct rpcent *getrpcbynumber_r(const int number, struct rpcent *result,
674				char *buffer, int buflen);
675void setrpcent(const int stay);
676void endrpcent(void);
677struct rpcent *getrpcent_r(struct rpcent *result, char *buffer, int buflen);
678
679/* inet_ntop.c */
680const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
681
682/* inet_pton.c */
683int inet_pton(int af, const char *src, void *dst);
684
685/* netdir_inet.c */
686int _get_hostserv_inetnetdir_byname(struct netconfig *nconf,
687				struct nss_netdirbyname_in *args,
688				union nss_netdirbyname_out *res);
689int _get_hostserv_inetnetdir_byaddr(struct netconfig *nconf,
690				struct nss_netdirbyaddr_in *args,
691				union nss_netdirbyaddr_out *res);
692int __nss2herrno(nss_status_t nsstat);
693nss_status_t _herrno2nss(int h_errno);
694struct hostent *_switch_gethostbyname_r(const char *name,
695				struct hostent *result,
696				char *buffer, int buflen, int *h_errnop);
697struct hostent *_switch_gethostbyaddr_r(const char *addr, int len, int type,
698				struct hostent *result,
699				char *buffer, int buflen, int *h_errnop);
700int str2servent(const char *instr, int lenstr, void *ent,
701				char *buffer, int buflen);
702void *__inet_get_local_interfaces(void);
703void __inet_free_local_interfaces(void *p);
704int __inet_address_is_local(void *p, struct in_addr addr);
705int __inet_uaddr_is_local(void *p, struct netconfig *nc, char *uaddr);
706int __inet_address_count(void *p);
707ulong_t __inet_get_addr(void *p, int n);
708char *__inet_get_uaddr(void *p, struct netconfig *nc, int n);
709char *__inet_get_networka(void *p, int n);
710
711/* netdir_inet_sundry.c */
712
713/*
714 * usr/src/lib/libnsl/rpc routines
715 */
716
717/* auth_des.c */
718AUTH *authdes_seccreate(const char *servername, uint_t win,
719			const char *timehost, const des_block *ckey);
720
721/* auth_none.c */
722AUTH *authnone_create(void);
723
724/* auth_sys.c */
725AUTH *authsys_create(const char *machname, uid_t uid, gid_t gid, int len,
726			const gid_t *aup_gids);
727AUTH *authsys_create_default(void);
728
729/* auth_time.c */
730
731/* authdes_prot.c */
732bool_t xdr_authdes_cred(XDR *xdrs, struct authdes_cred *cred);
733bool_t xdr_authdes_verf(XDR *xdrs, struct authdes_verf *verf);
734
735/* authsys_prot.c */
736bool_t xdr_authsys_parms(XDR *xdrs, struct authsys_parms *p);
737bool_t xdr_uid_t(XDR *xdrs, uid_t *ip);
738bool_t xdr_gid_t(XDR *xdrs, gid_t *ip);
739
740/* clnt_bcast.c */
741enum clnt_stat rpc_broadcast_exp(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
742		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
743		caddr_t resultsp, resultproc_t eachresult, int inittime,
744		int waittime, const char *netclass);
745enum clnt_stat rpc_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
746		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
747		caddr_t resultsp, resultproc_t eachresult,
748		const char *netclass);
749
750/* clnt_dg.c */
751CLIENT *clnt_dg_create(int fd, struct netbuf *svcaddr, rpcprog_t program,
752		rpcvers_t version, uint_t sendsz, uint_t recvsz);
753
754/* clnt_door.c */
755CLIENT *clnt_door_create(rpcprog_t program, rpcvers_t version, uint_t sendsz);
756
757/* clnt_generic.c */
758CLIENT *clnt_create_vers(const char *hostname, rpcprog_t prog,
759		rpcvers_t *vers_out, rpcvers_t vers_low,
760		rpcvers_t vers_high, const char *nettype);
761CLIENT *clnt_create_vers_timed(const char *hostname, rpcprog_t prog,
762		rpcvers_t *vers_out, rpcvers_t vers_low,
763		rpcvers_t vers_high, const char *nettype,
764		const struct timeval *tp);
765CLIENT *clnt_create(const char *hostname, rpcprog_t prog, rpcvers_t vers,
766		const char *nettype);
767CLIENT *clnt_create_timed(const char *hostname, rpcprog_t prog, rpcvers_t vers,
768		const char *netclass, const struct timeval *tp);
769CLIENT *clnt_tp_create(const char *hostname, rpcprog_t prog, rpcvers_t vers,
770		const struct netconfig *nconf);
771CLIENT *clnt_tp_create_timed(const char *hostname, rpcprog_t prog,
772		rpcvers_t vers, const struct netconfig *nconf,
773		const struct timeval *tp);
774CLIENT *clnt_tli_create(int fd, const struct netconfig *nconf,
775		struct netbuf *svcaddr, rpcprog_t prog, rpcvers_t vers,
776		uint_t sendsz, uint_t recvsz);
777
778/* clnt_perror.c */
779char *clnt_sperror(const CLIENT *cl, const char *s);
780void clnt_perror(const CLIENT *cl, const char *s);
781void clnt_perrno(enum clnt_stat num);
782char *clnt_spcreateerror(const char *s);
783void clnt_pcreateerror(const char *s);
784const char *clnt_sperrno(const enum clnt_stat stat);
785
786/* clnt_raw.c */
787CLIENT *clnt_raw_create(rpcprog_t prog, rpcvers_t vers);
788
789/* clnt_simple.c */
790enum clnt_stat rpc_call(const char *host, rpcprog_t prognum, rpcvers_t versnum,
791		rpcproc_t procnum, xdrproc_t inproc, const char *in,
792		xdrproc_t outproc, char *out, const char *netclass);
793
794/* clnt_vc.c */
795CLIENT *clnt_vc_create(int fd, struct netbuf *svcaddr, rpcprog_t prog,
796		rpcvers_t vers, uint_t sendsz, uint_t recvsz);
797
798/* getdname.c */
799int getdomainname(char *name, int namelen);
800int setdomainname(char *domain, int len);
801
802/* gethostname.c */
803int gethostname(char *hname, int hlen);
804
805/* inet_ntoa.c */
806char *inet_ntoa_r(struct in_addr in, char b[]);
807char *inet_ntoa(struct in_addr in);
808in_addr_t inet_addr(const char *cp);
809in_addr_t inet_netof(struct in_addr in);
810
811/* key_call.c */
812int key_setsecret(const char *secretkey);
813int key_secretkey_is_set(void);
814int key_encryptsession_pk(const char *remotename, netobj *remotekey,
815				des_block *deskey);
816int key_decryptsession_pk(const char *remotename, netobj *remotekey,
817				des_block *deskey);
818
819int key_encryptsession(const char *remotename, des_block *deskey);
820int key_decryptsession(const char *remotename, des_block *deskey);
821int key_gendes(des_block *key);
822int key_setnet(struct key_netstarg *arg);
823int key_get_conv(char *pkey, des_block *deskey);
824int key_call(ulong_t proc, xdrproc_t xdr_arg, char *arg, xdrproc_t xdr_rslt,
825				char *rslt);
826
827/* key_prot.c */
828bool_t xdr_keystatus(XDR *xdrs, keystatus *objp);
829bool_t xdr_keybuf(XDR *xdrs, keybuf objp);
830bool_t xdr_netnamestr(XDR *xdrs, netnamestr *objp);
831bool_t xdr_cryptkeyarg(XDR *xdrs, cryptkeyarg *objp);
832bool_t xdr_cryptkeyarg2(XDR *xdrs, cryptkeyarg2 *objp);
833bool_t xdr_cryptkeyres(XDR *xdrs, cryptkeyres *objp);
834bool_t xdr_unixcred(XDR *xdrs, unixcred *objp);
835bool_t xdr_getcredres(XDR *xdrs, getcredres *objp);
836bool_t xdr_key_netstarg(XDR *xdrs, key_netstarg *objp);
837bool_t xdr_key_netstres(XDR *xdrs, key_netstres *objp);
838
839/* mt_misc.c */
840#ifdef rpc_createerr
841#undef rpc_createerr
842#endif
843struct rpc_createerr *__rpc_createerr(void);
844
845/* netname.c */
846int getnetname(char *name);
847int __getnetnamebyuid(char *name, uid_t uid);
848int user2netname(char *netname, const uid_t uid, const char *domain);
849int host2netname(char *netname, const char *host, const char *domain);
850
851/* netnamer.c */
852int netname2user(const char *netname, uid_t *uidp, gid_t *gidp,
853					int *gidlenp, gid_t *gidlist);
854int netname2host(const char *netname, char *hostname, int hostlen);
855
856/* openchild.c */
857
858/* pmap_clnt.c */
859int pmap_set(rpcprog_t program, rpcvers_t version, rpcprot_t protocol, ushort_t port);
860bool_t pmap_unset(rpcprog_t program, rpcvers_t version);
861ushort_t pmap_getport(struct sockaddr_in *address, rpcprog_t program,
862			rpcvers_t version, rpcprot_t protocol);
863struct pmaplist *pmap_getmaps(struct sockaddr_in *address);
864enum clnt_stat pmap_rmtcall(struct sockaddr_in *addr, rpcprog_t prog,
865			rpcvers_t vers, rpcproc_t proc, xdrproc_t xdrargs,
866			caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
867			struct timeval tout, rpcport_t *port_ptr);
868
869/* pmap_prot.c */
870bool_t xdr_pmap(XDR *xdrs, struct pmap *objp);
871bool_t xdr_pmaplist_ptr(XDR *xdrs, pmaplist_ptr *rp);
872bool_t xdr_pmaplist(XDR *xdrs, PMAPLIST **rp);
873bool_t xdr_rmtcallargs(XDR *xdrs, struct p_rmtcallargs *cap);
874bool_t xdr_rmtcallres(XDR *xdrs, struct p_rmtcallres *crp);
875
876/* rpc_callmsg.c */
877bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg);
878
879/* rpc_comdata.c */
880
881/* rpc_generic.c */
882int __rpc_dtbsize(void);
883uint_t __rpc_get_t_size(t_scalar_t size, t_scalar_t bufsize);
884uint_t __rpc_get_a_size(t_scalar_t size);
885struct netconfig *__rpc_getconfip(char *nettype);
886void *__rpc_setconf(char *nettype);
887struct netconfig *__rpc_getconf(void *vhandle);
888void __rpc_endconf(void *vhandle);
889struct netconfig *__rpcfd_to_nconf(int fd, int servtype);
890int __rpc_matchserv(int servtype, unsigned int nc_semantics);
891
892/* rpc_prot.c */
893bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap);
894bool_t xdr_des_block(XDR *xdrs, des_block *blkp);
895bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar);
896bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr);
897bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg);
898bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg);
899void __seterr_reply(struct rpc_msg *msg, struct rpc_err *error);
900
901/* rpc_sel2poll.c */
902int __rpc_select_to_poll(int fdmax, fd_set *fdset, struct pollfd *p0);
903int __rpc_timeval_to_msec(struct timeval *t);
904
905/* rpc_soc.c */
906CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr, rpcprog_t prog,
907			rpcvers_t vers, struct timeval wait, int *sockp,
908			uint_t sendsz, uint_t recvsz);
909CLIENT *clntudp_create(struct sockaddr_in *raddr, rpcprog_t program,
910			rpcvers_t version, struct timeval wait, int *sockp);
911CLIENT *clnttcp_create(struct sockaddr_in *raddr, rpcprog_t prog,
912			rpcvers_t vers, int *sockp, uint_t sendsz,
913			uint_t recvsz);
914CLIENT *clntraw_create(rpcprog_t prog, rpcvers_t vers);
915SVCXPRT *svctcp_create(int fd, uint_t sendsize, uint_t recvsize);
916SVCXPRT *svcudp_bufcreate(int fd, uint_t sendsize, uint_t recvsize);
917SVCXPRT *svcfd_create(int fd, uint_t sendsize, uint_t recvsize);
918SVCXPRT *svcudp_create(int fd);
919SVCXPRT *svcraw_create(void);
920int __rpc_bindresvport(int fd, struct sockaddr_in *sin, int *portp, int qlen);
921void get_myaddress(struct sockaddr_in *addr);
922ushort_t getrpcport(char *host, rpcprog_t prognum, rpcvers_t versnum, rpcprot_t proto);
923int callrpc(char *host, rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
924		xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
925int registerrpc(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
926		char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc);
927enum clnt_stat clnt_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
928		xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults,
929		caddr_t resultsp, resultproc_t eachresult);
930AUTH *authdes_create(char *servername, uint_t window,
931		struct sockaddr_in *syncaddr, des_block *ckey);
932
933/* rpc_td.c */
934
935/* rpcb_clnt.c */
936bool_t __rpc_control(int request, void *info);
937bool_t rpcb_set(rpcprog_t program, rpcvers_t version,
938		const struct netconfig *nconf, const struct netbuf *address);
939bool_t rpcb_unset(rpcprog_t program, rpcvers_t version,
940		const struct netconfig *nconf);
941int rpcb_getaddr(rpcprog_t program, rpcvers_t version,
942		const struct netconfig *nconf, struct netbuf *address,
943		const char *host);
944rpcblist *rpcb_getmaps(const struct netconfig *nconf, const char *host);
945enum clnt_stat rpcb_rmtcall(const struct netconfig *nconf, const char *host,
946		rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
947		xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres,
948		caddr_t resp, struct timeval tout,
949		struct netbuf *addr_ptr);
950bool_t rpcb_gettime(const char *host, time_t *timep);
951char *rpcb_taddr2uaddr(struct netconfig *nconf, struct netbuf *taddr);
952struct netbuf *rpcb_uaddr2taddr(struct netconfig *nconf, char *uaddr);
953
954/* rpcb_prot.c */
955bool_t xdr_rpcb(XDR *xdrs, RPCB *objp);
956bool_t xdr_rpcblist_ptr(XDR *xdrs, rpcblist_ptr *rp);
957bool_t xdr_rpcblist(XDR *xdrs, RPCBLIST **rp);
958bool_t xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp);
959bool_t xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp);
960bool_t xdr_rpcb_rmtcallargs(XDR *xdrs, struct r_rpcb_rmtcallargs *objp);
961bool_t xdr_rpcb_rmtcallres(XDR *xdrs, struct r_rpcb_rmtcallres *objp);
962bool_t xdr_netbuf(XDR *xdrs, struct netbuf *objp);
963
964/* rpcb_st_xdr.c */
965bool_t xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp);
966bool_t xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp);
967
968bool_t xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp);
969bool_t xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp);
970bool_t xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp);
971bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp);
972bool_t xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp);
973bool_t xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp);
974
975/* rpcdname.c */
976int __rpc_get_default_domain(char **domain);
977
978/* rpcsec_gss_if.c */
979AUTH *rpc_gss_seccreate(CLIENT *clnt, char *principal, char *mechanism,
980		rpc_gss_service_t service_type, char *qop,
981		rpc_gss_options_req_t *options_req,
982		rpc_gss_options_ret_t *options_ret);
983bool_t rpc_gss_set_defaults(AUTH *auth, rpc_gss_service_t service, char *qop);
984bool_t rpc_gss_get_principal_name(rpc_gss_principal_t *principal, char
985		*mechanism, char *user_name, char *node, char *secdomain);
986char **rpc_gss_get_mechanisms(void);
987char **rpc_gss_get_mech_info(char *mechanism, rpc_gss_service_t *service);
988bool_t rpc_gss_get_versions(u_int *vers_hi, u_int *vers_lo);
989bool_t rpc_gss_is_installed(char *mechanism);
990bool_t rpc_gss_set_svc_name(char *principal, char *mechanism, uint_t req_time,
991		uint_t program, uint_t version);
992bool_t rpc_gss_set_callback(rpc_gss_callback_t *cb);
993bool_t rpc_gss_getcred(struct svc_req *req, rpc_gss_rawcred_t **rcred,
994		rpc_gss_ucred_t **ucred, void **cookie);
995bool_t rpc_gss_mech_to_oid(char *mech, rpc_gss_OID *oid);
996bool_t rpc_gss_qop_to_num(char *qop, char *mech, u_int *num);
997int rpc_gss_max_data_length(AUTH *rpcgss_handle, int max_tp_unit_len);
998int rpc_gss_svc_max_data_length(struct svc_req *req, int max_tp_unit_len);
999void rpc_gss_get_error(rpc_gss_error_t *error);
1000
1001/* rtime_tli.c */
1002int rtime_tli(char *host, struct timeval *timep, struct timeval *timeout);
1003
1004/* svc.c */
1005void xprt_register(const SVCXPRT *xprt);
1006void xprt_unregister(const SVCXPRT *xprt);
1007bool_t svc_reg(const SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
1008		void (*dispatch)(), const struct netconfig *nconf);
1009void svc_unreg(rpcprog_t prog, rpcvers_t vers);
1010bool_t svc_register(SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
1011		void (*dispatch)(), int protocol);
1012void svc_unregister(rpcprog_t prog, rpcvers_t vers);
1013bool_t svc_sendreply(const SVCXPRT *xprt, xdrproc_t xdr_results,
1014		caddr_t xdr_location);
1015void svcerr_noproc(const SVCXPRT *xprt);
1016void svcerr_decode(const SVCXPRT *xprt);
1017void svcerr_systemerr(const SVCXPRT *xprt);
1018void svcerr_auth(const SVCXPRT *xprt, enum auth_stat why);
1019void svcerr_weakauth(const SVCXPRT *xprt);
1020void svcerr_noprog(const SVCXPRT *xprt);
1021void svcerr_progvers(const SVCXPRT *xprt, rpcvers_t low_vers,
1022		rpcvers_t high_vers);
1023void svc_getreq(int rdfds);
1024void svc_getreqset(fd_set *readfds);
1025void svc_getreq_poll(struct pollfd *pfdp, int pollretval);
1026void svc_getreq_common(int fd);
1027SVCXPRT *svc_xprt_alloc(void);
1028void svc_xprt_free(SVCXPRT *xprt);
1029bool_t svc_get_local_cred(SVCXPRT *xprt, svc_local_cred_t *lcred);
1030SVCAUTH *__svc_get_svcauth(SVCXPRT *);
1031void *__svc_set_proc_cleanup_cb(void *cb);
1032
1033/* svc_auth.c */
1034enum auth_stat __authenticate(struct svc_req *rqst, struct rpc_msg *msg);
1035int svc_auth_reg(int cred_flavor, enum auth_stat (*handler)());
1036
1037/* svc_auth_sys.c */
1038
1039/* svc_dg.c */
1040SVCXPRT *svc_dg_create(int fd, uint_t sendsize, uint_t recvsize);
1041int svc_dg_enablecache(SVCXPRT *xprt, uint_t size);
1042
1043/* svc_door.c */
1044SVCXPRT *svc_door_create(void (*dispatch)(), rpcprog_t prognum,
1045			rpcvers_t versnum, uint_t sendsize);
1046
1047/* svc_generic.c */
1048int svc_create(void (*dispatch)(), rpcprog_t prognum, rpcvers_t versnum,
1049			const char *nettype);
1050SVCXPRT *svc_tp_create(void (*dispatch)(), rpcprog_t prognum, rpcvers_t versnum,
1051			const struct netconfig *nconf);
1052SVCXPRT *svc_tli_create(int fd, const struct netconfig *nconf,
1053			const struct t_bind *bindaddr, uint_t sendsz,
1054			uint_t recvsz);
1055
1056/* svc_raw.c */
1057SVCXPRT *svc_raw_create(void);
1058
1059/* svc_run.c */
1060void svc_run(void);
1061void svc_exit(void);
1062void svc_done(SVCXPRT *xprt);
1063bool_t rpc_control(int op, void *info);
1064
1065/* svc_simple.c */
1066int rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
1067		char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc,
1068		const char *nettype);
1069
1070/* svc_vc.c */
1071SVCXPRT *svc_vc_create(int fd, uint_t sendsize, uint_t recvsize);
1072SVCXPRT *svc_fd_create(int fd, uint_t sendsize, uint_t recvsize);
1073void __svc_nisplus_fdcleanup_hack(void);
1074void __svc_nisplus_enable_timestamps(void);
1075void __svc_nisplus_purge_since(long since);
1076bool_t __svc_vc_dupcache_init(SVCXPRT *xprt, void *condition, int basis);
1077int __svc_vc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz);
1078int __svc_vc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
1079				int status);
1080
1081/* svcauth_des.c */
1082int authdes_getucred(const struct authdes_cred *adc, uid_t *uid, gid_t *gid,
1083				short *grouplen, gid_t *groups);
1084enum auth_stat __svcauth_des(struct svc_req *rqst, struct rpc_msg *msg);
1085
1086/* ti_opts.c */
1087int __rpc_negotiate_uid(int fd);
1088int __rpc_get_local_uid(SVCXPRT *trans, uid_t *uid_out);
1089
1090/* xdr.c */
1091void xdr_free(xdrproc_t proc, char *objp);
1092bool_t xdr_void(void);
1093bool_t xdr_int(XDR *xdrs, int *ip);
1094bool_t xdr_u_int(XDR *xdrs, uint_t *up);
1095bool_t xdr_long(XDR *xdrs, long *lp);
1096bool_t xdr_u_long(XDR *xdrs, ulong_t *ulp);
1097bool_t xdr_short(XDR *xdrs, short *sp);
1098bool_t xdr_u_short(XDR *xdrs, ushort_t *sp);
1099bool_t xdr_char(XDR *xdrs, char *cp);
1100bool_t xdr_u_char(XDR *xdrs, uchar_t *cp);
1101bool_t xdr_bool(XDR *xdrs, bool_t *bp);
1102bool_t xdr_enum(XDR *xdrs, enum_t *ep);
1103bool_t xdr_opaque(XDR *xdrs, caddr_t cp, uint_t cnt);
1104bool_t xdr_bytes(XDR *xdrs, char **cpp, uint_t *sizep, uint_t maxsize);
1105bool_t xdr_netobj(XDR *xdrs, struct netobj *np);
1106bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp,
1107			const struct xdr_discrim *choices, xdrproc_t dfault);
1108bool_t xdr_string(XDR *xdrs, char **cpp, uint_t maxsize);
1109bool_t xdr_hyper(XDR *xdrs, longlong_t *hp);
1110bool_t xdr_u_hyper(XDR *xdrs, u_longlong_t *hp);
1111bool_t xdr_longlong_t(XDR *xdrs, longlong_t *hp);
1112bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp);
1113bool_t xdr_ulonglong_t(XDR *xdrs, u_longlong_t *hp);
1114bool_t xdr_wrapstring(XDR *xdrs, char **cpp);
1115
1116/* xdr_array.c */
1117bool_t xdr_array(XDR *xdrs, caddr_t *addrp, uint_t *sizep, uint_t maxsize,
1118				uint_t elsize, xdrproc_t elproc);
1119bool_t xdr_vector(XDR *xdrs, char *basep, uint_t nelem, uint_t elemsize,
1120				xdrproc_t xdr_elem);
1121
1122/* xdr_float.c */
1123bool_t xdr_float(XDR *xdrs, float *fp);
1124bool_t xdr_double(XDR *xdrs, double *dp);
1125bool_t xdr_quadruple(XDR *xdrs, long double *fp);
1126
1127/* xdr_mem.c */
1128void xdrmem_create(XDR *xdrs, caddr_t addr, uint_t size, enum xdr_op op);
1129
1130/* xdr_rec.c */
1131void xdrrec_create(XDR *xdrs, uint_t sendsize, uint_t recvsize,
1132			caddr_t tcp_handle, int (*readit)(), int (*writeit)());
1133
1134uint_t xdrrec_readbytes(XDR *xdrs, caddr_t addr, uint_t l);
1135bool_t xdrrec_skiprecord(XDR *xdrs);
1136bool_t xdrrec_eof(XDR *xdrs);
1137bool_t xdrrec_endofrecord(XDR *xdrs, bool_t sendnow);
1138
1139/* xdr_refer.c */
1140bool_t xdr_reference(XDR *xdrs, caddr_t *pp, uint_t size, xdrproc_t proc);
1141bool_t xdr_pointer(XDR *xdrs, char **objpp, uint_t obj_size, xdrproc_t xdr_obj);
1142
1143/* xdr_sizeof.c */
1144unsigned int xdr_sizeof(xdrproc_t func, void *data);
1145
1146/* xdr_stdio.c */
1147void xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op);
1148
1149/* svid_funcs.c */
1150#undef	auth_destroy
1151#undef	clnt_call
1152#undef	clnt_control
1153#undef	clnt_destroy
1154#undef	clnt_freeres
1155#undef	clnt_geterr
1156#undef	svc_destroy
1157#undef	svc_freeargs
1158#undef	svc_getargs
1159#undef	svc_getrpccaller
1160#undef	xdr_destroy
1161#undef	xdr_getpos
1162#undef	xdr_inline
1163#undef	xdr_setpos
1164void auth_destroy(AUTH *auth);
1165enum clnt_stat clnt_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs,
1166			caddr_t argsp, xdrproc_t xres, caddr_t resp,
1167			struct timeval timeout);
1168bool_t clnt_control(CLIENT *cl, uint_t rq, void *in);
1169void clnt_destroy(CLIENT *cl);
1170bool_t clnt_freeres(CLIENT *cl, xdrproc_t xres, caddr_t resp);
1171void clnt_geterr(CLIENT *cl, struct rpc_err *errp);
1172bool_t svc_control(SVCXPRT *xprt, const uint_t rq, void *in);
1173bool_t svc_freeargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp);
1174bool_t svc_getargs(SVCXPRT *xprt, xdrproc_t xargs, char *argsp);
1175struct netbuf *svc_getrpccaller(SVCXPRT *xprt);
1176long *xdr_inline(XDR *xdrs, int len);
1177void xdr_destroy(XDR *xdrs);
1178uint_t xdr_getpos(XDR *xdrs);
1179bool_t xdr_setpos(XDR *xdrs, uint_t pos);
1180
1181/*
1182 * usr/src/lib/libnsl/saf routines
1183 */
1184
1185/* checkver.c */
1186int check_version(int ver, char *fname);
1187
1188/* doconfig.c */
1189int doconfig(int fd, char *script, long rflag);
1190
1191/*
1192 * usr/src/lib/libnsl/yp routines
1193 */
1194
1195/* dbm.c */
1196int dbminit(char *file);
1197int dbmclose(void);
1198datum fetch(datum key);
1199int delete(datum key);
1200int store(datum key, datum dat);
1201datum firstkey(void);
1202datum nextkey(datum key);
1203datum firsthash(long hash);
1204datum makdatum(char *buf, int n);
1205long hashinc(long hash);
1206long calchash(datum item);
1207
1208/* yp_all.c */
1209int yp_all(char *domain, char *map, struct ypall_callback *callback);
1210int __yp_all_rsvdport(char *domain, char *map, struct ypall_callback *callback);
1211
1212/* yp_b_clnt.c */
1213enum ypbind_resptype {
1214	YPBIND_SUCC_VAL = 1,
1215	YPBIND_FAIL_VAL = 2
1216};
1217typedef enum ypbind_resptype ypbind_resptype;
1218struct ypbind_resp {
1219	ypbind_resptype ypbind_status;
1220	union {
1221		uint_t ypbind_error;
1222		struct ypbind_binding *ypbind_bindinfo;
1223	} ypbind_resp_u;
1224};
1225typedef struct ypbind_resp ypbind_resp;
1226struct ypbind_domain {
1227	char *ypbind_domainname;
1228	rpcvers_t ypbind_vers;
1229};
1230typedef struct ypbind_domain ypbind_domain;
1231struct ypbind_setdom {
1232	char *ypsetdom_domain;
1233	struct ypbind_binding *ypsetdom_bindinfo;
1234};
1235typedef struct ypbind_setdom ypbind_setdom;
1236ypbind_resp *ypbindproc_domain_3(ypbind_domain *argp, CLIENT *clnt);
1237
1238/* yp_b_xdr.c */
1239bool_t xdr_ypbind_domain(XDR *xdrs, ypbind_domain *objp);
1240bool_t xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp);
1241bool_t xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp);
1242bool_t xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp);
1243
1244/* yp_bind.c */
1245struct dom_binding {
1246	struct dom_binding *dom_pnext;
1247	char *dom_domain;
1248	struct ypbind_binding *dom_binding;
1249	CLIENT *dom_client;
1250	int cache_bad;
1251	int fd;
1252	dev_t rdev;
1253	int ref_count;
1254	int need_free;
1255	mutex_t server_name_lock;
1256};
1257int __yp_dobind(char *domain, struct dom_binding **binding);
1258int __yp_rel_binding(struct dom_binding *binding);
1259void yp_unbind(char *domain);
1260int __yp_add_binding(char *domain, char *addr);
1261int yp_bind(char *domain);
1262int yp_get_default_domain(char **domain);
1263int usingypmap(char **ddn, char *map);
1264CLIENT *__clnt_create_loopback(rpcprog_t prog, rpcvers_t vers, int err);
1265
1266/* yp_enum.c */
1267int yp_first(char *domain, char *map, char **key, int *keylen,
1268					char **val, int  *vallen);
1269int yp_next(char *domain, char *map, char *inkey, int inkeylen,
1270		char **outkey, int  *outkeylen, char **val, int *vallen);
1271
1272/* yp_master.c */
1273int yp_master(char *domain, char *map, char **master);
1274int __yp_master_rsvdport(char *domain, char *map, char **master);
1275
1276/* yp_match.c */
1277int yp_match(char *domain, char *map, char *key, int keylen,
1278						char **val, int  *vallen);
1279int yp_match_rsvdport(char *domain, char *map, char *key, int keylen,
1280						char **val, int  *vallen);
1281void __empty_yp_cache(void);
1282
1283/* yp_order.c */
1284int yp_order(char *domain, char *map, unsigned long *order);
1285
1286/* yp_rsvd.c */
1287CLIENT *__yp_clnt_create_rsvdport(const char *hostname,
1288			rpcprog_t prog, rpcvers_t vers,
1289			const char *nettype,
1290			const uint_t sendsz, const uint_t recvsz);
1291
1292/* yp_update.c */
1293int yp_update(char *domain, char *map, unsigned op,
1294			char *key, int keylen, char *data, int datalen);
1295
1296/* yp_xdr.c */
1297bool xdr_datum(XDR * xdrs, datum *pdatum);
1298bool xdr_ypdomain_wrap_string(XDR *xdrs, char **ppstring);
1299bool xdr_ypmap_wrap_string(XDR *xdrs, char **ppstring);
1300bool xdr_ypreq_key(XDR *xdrs, struct ypreq_key *ps);
1301bool xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *ps);
1302bool xdr_ypresp_val(XDR *xdrs, struct ypresp_val *ps);
1303bool xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *ps);
1304bool xdr_ypowner_wrap_string(XDR *xdrs, char **ppstring);
1305bool xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *ps);
1306bool xdr_ypresp_master(XDR *xdrs, struct ypresp_master *ps);
1307bool xdr_ypresp_order(XDR * xdrs, struct ypresp_order *ps);
1308bool xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *ps);
1309bool xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *ps);
1310bool xdr_ypreq_newxfr(XDR *xdrs, struct ypreq_newxfr *ps);
1311bool xdr_ypreq_xfr(XDR *xdrs, struct ypreq_xfr *ps);
1312bool xdr_ypall(XDR *xdrs, struct ypall_callback *callback);
1313
1314/* yperr_string.c */
1315char *yperr_string(int code);
1316
1317/* yppasswd_xdr.c */
1318bool_t xdr_yppasswd(XDR *xdrsp, struct yppasswd *pp);
1319
1320/* ypprot_err.c */
1321int ypprot_err(int yp_protocol_error);
1322
1323/* ypupd.c */
1324bool_t xdr_yp_buf(XDR *xdrs, yp_buf *objp);
1325bool_t xdr_ypupdate_args(XDR *xdrs, ypupdate_args *objp);
1326bool_t xdr_ypdelete_args(XDR *xdrs, ypdelete_args *objp);
1327
1328/* nis_sec_mechs.c */
1329char *__nis_keyalg2authtype(keylen_t keylen, algtype_t algtype,
1330	char *authtype, size_t authtype_len);
1331
1332/* usr/src/lib/libnsl/nss/parse.c */
1333char *_strtok_escape(char *string, char *sepset, char **lasts);
1334