1dfdcada3SDoug Rabson /* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ 2dfdcada3SDoug Rabson 32e322d37SHiroki Sato /*- 4*51369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 5*51369649SPedro F. Giffuni * 62e322d37SHiroki Sato * Copyright (c) 2009, Sun Microsystems, Inc. 72e322d37SHiroki Sato * All rights reserved. 8dfdcada3SDoug Rabson * 92e322d37SHiroki Sato * Redistribution and use in source and binary forms, with or without 102e322d37SHiroki Sato * modification, are permitted provided that the following conditions are met: 112e322d37SHiroki Sato * - Redistributions of source code must retain the above copyright notice, 122e322d37SHiroki Sato * this list of conditions and the following disclaimer. 132e322d37SHiroki Sato * - Redistributions in binary form must reproduce the above copyright notice, 142e322d37SHiroki Sato * this list of conditions and the following disclaimer in the documentation 152e322d37SHiroki Sato * and/or other materials provided with the distribution. 162e322d37SHiroki Sato * - Neither the name of Sun Microsystems, Inc. nor the names of its 172e322d37SHiroki Sato * contributors may be used to endorse or promote products derived 182e322d37SHiroki Sato * from this software without specific prior written permission. 19dfdcada3SDoug Rabson * 202e322d37SHiroki Sato * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 212e322d37SHiroki Sato * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 222e322d37SHiroki Sato * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 232e322d37SHiroki Sato * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 242e322d37SHiroki Sato * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 252e322d37SHiroki Sato * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 262e322d37SHiroki Sato * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 272e322d37SHiroki Sato * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 282e322d37SHiroki Sato * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 292e322d37SHiroki Sato * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 302e322d37SHiroki Sato * POSSIBILITY OF SUCH DAMAGE. 31dfdcada3SDoug Rabson */ 32dfdcada3SDoug Rabson /* 33dfdcada3SDoug Rabson * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34dfdcada3SDoug Rabson */ 35dfdcada3SDoug Rabson 36dfdcada3SDoug Rabson /* 37dfdcada3SDoug Rabson * rpc_com.h, Common definitions for both the server and client side. 38dfdcada3SDoug Rabson * All for the topmost layer of rpc 39dfdcada3SDoug Rabson * 40dfdcada3SDoug Rabson * In Sun's tirpc distribution, this was installed as <rpc/rpc_com.h>, 41dfdcada3SDoug Rabson * but as it contains only non-exported interfaces, it was moved here. 42dfdcada3SDoug Rabson */ 43dfdcada3SDoug Rabson 44dfdcada3SDoug Rabson #ifndef _RPC_RPCCOM_H 45dfdcada3SDoug Rabson #define _RPC_RPCCOM_H 46dfdcada3SDoug Rabson 47dfdcada3SDoug Rabson #include <sys/cdefs.h> 48dfdcada3SDoug Rabson 49dfdcada3SDoug Rabson /* 50dfdcada3SDoug Rabson * The max size of the transport, if the size cannot be determined 51dfdcada3SDoug Rabson * by other means. 52dfdcada3SDoug Rabson */ 53dfdcada3SDoug Rabson #define RPC_MAXDATASIZE 9000 54dfdcada3SDoug Rabson #define RPC_MAXADDRSIZE 1024 55dfdcada3SDoug Rabson 56dfdcada3SDoug Rabson #ifdef _KERNEL 57dfdcada3SDoug Rabson 58dfdcada3SDoug Rabson #define __RPC_GETXID(now) ((uint32_t)curproc->p_pid ^ (uint32_t)(now)->tv_sec ^ \ 59dfdcada3SDoug Rabson (uint32_t)(now)->tv_usec) 60dfdcada3SDoug Rabson 61dfdcada3SDoug Rabson #else 62dfdcada3SDoug Rabson 63dfdcada3SDoug Rabson #define __RPC_GETXID(now) ((uint32_t)getpid() ^ (uint32_t)(now)->tv_sec ^ \ 64dfdcada3SDoug Rabson (uint32_t)(now)->tv_usec) 65dfdcada3SDoug Rabson 66dfdcada3SDoug Rabson #endif 67dfdcada3SDoug Rabson 68dfdcada3SDoug Rabson __BEGIN_DECLS 69dfdcada3SDoug Rabson #ifndef _KERNEL 70dfdcada3SDoug Rabson extern u_int __rpc_get_a_size(int); 71dfdcada3SDoug Rabson extern struct netconfig * __rpcgettp(int); 72dfdcada3SDoug Rabson extern int __rpc_get_default_domain(char **); 73dfdcada3SDoug Rabson 74dfdcada3SDoug Rabson char *__rpc_taddr2uaddr_af(int, const struct netbuf *); 75dfdcada3SDoug Rabson struct netbuf *__rpc_uaddr2taddr_af(int, const char *); 76dfdcada3SDoug Rabson int __rpc_fixup_addr(struct netbuf *, const struct netbuf *); 77dfdcada3SDoug Rabson int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **); 78dfdcada3SDoug Rabson int __rpc_seman2socktype(int); 79dfdcada3SDoug Rabson int __rpc_socktype2seman(int); 80dfdcada3SDoug Rabson void *rpc_nullproc(CLIENT *); 81dfdcada3SDoug Rabson int __rpc_sockisbound(int); 82dfdcada3SDoug Rabson 83dfdcada3SDoug Rabson struct netbuf *__rpcb_findaddr_timed(rpcprog_t, rpcvers_t, 84dfdcada3SDoug Rabson const struct netconfig *, const char *host, CLIENT **clpp, 85dfdcada3SDoug Rabson struct timeval *tp); 86dfdcada3SDoug Rabson 87dfdcada3SDoug Rabson bool_t __rpc_control(int,void *); 88dfdcada3SDoug Rabson 89dfdcada3SDoug Rabson char *_get_next_token(char *, int); 90dfdcada3SDoug Rabson 91dfdcada3SDoug Rabson bool_t __svc_clean_idle(fd_set *, int, bool_t); 92dfdcada3SDoug Rabson bool_t __xdrrec_setnonblock(XDR *, int); 93dfdcada3SDoug Rabson bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t); 94dfdcada3SDoug Rabson void __xprt_unregister_unlocked(SVCXPRT *); 95dfdcada3SDoug Rabson 96dfdcada3SDoug Rabson SVCXPRT **__svc_xports; 97dfdcada3SDoug Rabson int __svc_maxrec; 98dfdcada3SDoug Rabson 99dfdcada3SDoug Rabson #else 100dfdcada3SDoug Rabson 101dfdcada3SDoug Rabson #define SUN_LEN(su) \ 102dfdcada3SDoug Rabson (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) 103dfdcada3SDoug Rabson 104dfdcada3SDoug Rabson extern u_int __rpc_get_a_size(int); 105dfdcada3SDoug Rabson extern char *__rpc_taddr2uaddr_af(int, const struct netbuf *); 106dfdcada3SDoug Rabson extern struct netbuf *__rpc_uaddr2taddr_af(int, const char *); 107dfdcada3SDoug Rabson extern int __rpc_seman2socktype(int); 108dfdcada3SDoug Rabson extern int __rpc_socktype2seman(int); 109dfdcada3SDoug Rabson extern int __rpc_sockisbound(struct socket*); 110a9148abdSDoug Rabson extern int bindresvport(struct socket *so, struct sockaddr *sa); 111dfdcada3SDoug Rabson 112dfdcada3SDoug Rabson struct xucred; 113370c6ad8SPedro F. Giffuni struct XDR; 114370c6ad8SPedro F. Giffuni bool_t xdr_authunix_parms(struct XDR *xdrs, uint32_t *time, struct xucred *cred); 115dfdcada3SDoug Rabson #endif 116dfdcada3SDoug Rabson 117dfdcada3SDoug Rabson __END_DECLS 118dfdcada3SDoug Rabson 119dfdcada3SDoug Rabson #endif /* _RPC_RPCCOM_H */ 120