18360efbdSAlfred Perlstein /* $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $ */ 28360efbdSAlfred Perlstein 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. 8dba7a33eSGarrett Wollman * 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. 19dba7a33eSGarrett Wollman * 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. 31dba7a33eSGarrett Wollman */ 32dba7a33eSGarrett Wollman 33dba7a33eSGarrett Wollman /* 34dba7a33eSGarrett Wollman * Rpc additions to <sys/types.h> 35dba7a33eSGarrett Wollman */ 3686b9a9ccSGarrett Wollman #ifndef _RPC_TYPES_H 3786b9a9ccSGarrett Wollman #define _RPC_TYPES_H 38dba7a33eSGarrett Wollman 398360efbdSAlfred Perlstein #include <sys/types.h> 4012eb46c8SMarcel Moolenaar #include <sys/_null.h> 418360efbdSAlfred Perlstein 428360efbdSAlfred Perlstein typedef int32_t bool_t; 438360efbdSAlfred Perlstein typedef int32_t enum_t; 448360efbdSAlfred Perlstein 45dfdcada3SDoug Rabson typedef uint32_t rpcprog_t; 46dfdcada3SDoug Rabson typedef uint32_t rpcvers_t; 47dfdcada3SDoug Rabson typedef uint32_t rpcproc_t; 48dfdcada3SDoug Rabson typedef uint32_t rpcprot_t; 49dfdcada3SDoug Rabson typedef uint32_t rpcport_t; 508360efbdSAlfred Perlstein typedef int32_t rpc_inline_t; 518360efbdSAlfred Perlstein 52dba7a33eSGarrett Wollman #define __dontcare__ -1 5386b9a9ccSGarrett Wollman 5486b9a9ccSGarrett Wollman #ifndef FALSE 5586b9a9ccSGarrett Wollman # define FALSE (0) 5686b9a9ccSGarrett Wollman #endif 5786b9a9ccSGarrett Wollman #ifndef TRUE 5886b9a9ccSGarrett Wollman # define TRUE (1) 5986b9a9ccSGarrett Wollman #endif 60dba7a33eSGarrett Wollman 61dfdcada3SDoug Rabson #ifdef _KERNEL 62dfdcada3SDoug Rabson #ifdef _SYS_MALLOC_H_ 63dfdcada3SDoug Rabson MALLOC_DECLARE(M_RPC); 64dfdcada3SDoug Rabson #endif 65dfdcada3SDoug Rabson #define mem_alloc(bsize) malloc(bsize, M_RPC, M_WAITOK|M_ZERO) 66dfdcada3SDoug Rabson #define mem_free(ptr, bsize) free(ptr, M_RPC) 67dfdcada3SDoug Rabson #else 688360efbdSAlfred Perlstein #define mem_alloc(bsize) calloc(1, bsize) 69dba7a33eSGarrett Wollman #define mem_free(ptr, bsize) free(ptr) 70dfdcada3SDoug Rabson #endif 71dba7a33eSGarrett Wollman 72dba7a33eSGarrett Wollman #include <sys/time.h> 73dfdcada3SDoug Rabson #ifdef _KERNEL 74dfdcada3SDoug Rabson #include <rpc/netconfig.h> 75dfdcada3SDoug Rabson #else 768360efbdSAlfred Perlstein #include <netconfig.h> 777f64b05fSPawel Jakub Dawidek #endif 788360efbdSAlfred Perlstein 798360efbdSAlfred Perlstein /* 808360efbdSAlfred Perlstein * The netbuf structure is defined here, because FreeBSD / NetBSD only use 818360efbdSAlfred Perlstein * it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing 828360efbdSAlfred Perlstein * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI. 838360efbdSAlfred Perlstein */ 848360efbdSAlfred Perlstein 858360efbdSAlfred Perlstein /* 868360efbdSAlfred Perlstein * The netbuf structure is used for transport-independent address storage. 878360efbdSAlfred Perlstein */ 888360efbdSAlfred Perlstein struct netbuf { 898360efbdSAlfred Perlstein unsigned int maxlen; 908360efbdSAlfred Perlstein unsigned int len; 918360efbdSAlfred Perlstein void *buf; 928360efbdSAlfred Perlstein }; 938360efbdSAlfred Perlstein 948360efbdSAlfred Perlstein /* 956244c6e7SPedro F. Giffuni * The format of the address and options arguments of the XTI t_bind call. 968360efbdSAlfred Perlstein * Only provided for compatibility, it should not be used. 978360efbdSAlfred Perlstein */ 988360efbdSAlfred Perlstein 998360efbdSAlfred Perlstein struct t_bind { 1008360efbdSAlfred Perlstein struct netbuf addr; 1018360efbdSAlfred Perlstein unsigned int qlen; 1028360efbdSAlfred Perlstein }; 1038360efbdSAlfred Perlstein 1048360efbdSAlfred Perlstein /* 1058360efbdSAlfred Perlstein * Internal library and rpcbind use. This is not an exported interface, do 1068360efbdSAlfred Perlstein * not use. 1078360efbdSAlfred Perlstein */ 1088360efbdSAlfred Perlstein struct __rpc_sockinfo { 1098360efbdSAlfred Perlstein int si_af; 1108360efbdSAlfred Perlstein int si_proto; 1118360efbdSAlfred Perlstein int si_socktype; 1128360efbdSAlfred Perlstein int si_alen; 1138360efbdSAlfred Perlstein }; 114dba7a33eSGarrett Wollman 11586b9a9ccSGarrett Wollman #endif /* !_RPC_TYPES_H */ 116