xref: /freebsd/sys/rpc/types.h (revision af6a5351a1fdb1130f18be6c782c4d48916eb971)
1 /*	$NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $	*/
2 
3 /*-
4  * Copyright (c) 2009, Sun Microsystems, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * - Redistributions of source code must retain the above copyright notice,
10  *   this list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  *   this list of conditions and the following disclaimer in the documentation
13  *   and/or other materials provided with the distribution.
14  * - Neither the name of Sun Microsystems, Inc. nor the names of its
15  *   contributors may be used to endorse or promote products derived
16  *   from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  *	from: @(#)types.h 1.18 87/07/24 SMI
31  *	from: @(#)types.h	2.3 88/08/15 4.0 RPCSRC
32  * $FreeBSD$
33  */
34 
35 /*
36  * Rpc additions to <sys/types.h>
37  */
38 #ifndef _RPC_TYPES_H
39 #define _RPC_TYPES_H
40 
41 #include <sys/types.h>
42 #include <sys/_null.h>
43 
44 typedef int32_t bool_t;
45 typedef int32_t enum_t;
46 
47 typedef uint32_t rpcprog_t;
48 typedef uint32_t rpcvers_t;
49 typedef uint32_t rpcproc_t;
50 typedef uint32_t rpcprot_t;
51 typedef uint32_t rpcport_t;
52 typedef  int32_t rpc_inline_t;
53 
54 #define __dontcare__	-1
55 
56 #ifndef FALSE
57 #	define FALSE	(0)
58 #endif
59 #ifndef TRUE
60 #	define TRUE	(1)
61 #endif
62 
63 #ifdef _KERNEL
64 #ifdef _SYS_MALLOC_H_
65 MALLOC_DECLARE(M_RPC);
66 #endif
67 #define mem_alloc(bsize)	malloc(bsize, M_RPC,  M_WAITOK|M_ZERO)
68 #define mem_free(ptr, bsize)	free(ptr, M_RPC)
69 #else
70 #define mem_alloc(bsize)	calloc(1, bsize)
71 #define mem_free(ptr, bsize)	free(ptr)
72 #endif
73 
74 #include <sys/time.h>
75 #ifdef _KERNEL
76 #include <rpc/netconfig.h>
77 #else
78 #include <netconfig.h>
79 #endif
80 
81 /*
82  * The netbuf structure is defined here, because FreeBSD / NetBSD only use
83  * it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing
84  * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI.
85  */
86 
87 /*
88  * The netbuf structure is used for transport-independent address storage.
89  */
90 struct netbuf {
91 	unsigned int maxlen;
92 	unsigned int len;
93 	void *buf;
94 };
95 
96 /*
97  * The format of the address and options arguments of the XTI t_bind call.
98  * Only provided for compatibility, it should not be used.
99  */
100 
101 struct t_bind {
102 	struct netbuf   addr;
103 	unsigned int    qlen;
104 };
105 
106 /*
107  * Internal library and rpcbind use. This is not an exported interface, do
108  * not use.
109  */
110 struct __rpc_sockinfo {
111 	int si_af;
112 	int si_proto;
113 	int si_socktype;
114 	int si_alen;
115 };
116 
117 #endif /* !_RPC_TYPES_H */
118