initial checkin
[platform/upstream/libtirpc.git] / tirpc / rpc / types.h
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: src/include/rpc/types.h,v 1.10.6.1 2003/12/18 00:59:50 peter Exp $
33  */
34
35 /*
36  * Rpc additions to <sys/types.h>
37  */
38 #ifndef _TIRPC_TYPES_H
39 #define _TIRPC_TYPES_H
40
41 #include <sys/types.h>
42
43 typedef int32_t bool_t;
44 typedef int32_t enum_t;
45
46 typedef u_int32_t rpcprog_t;
47 typedef u_int32_t rpcvers_t;
48 typedef u_int32_t rpcproc_t;
49 typedef u_int32_t rpcprot_t;
50 typedef u_int32_t rpcport_t;
51 typedef   int32_t rpc_inline_t;
52
53 #ifndef NULL
54 #       define NULL     0
55 #endif
56 #define __dontcare__    -1
57
58 #ifndef FALSE
59 #       define FALSE    (0)
60 #endif
61 #ifndef TRUE
62 #       define TRUE     (1)
63 #endif
64
65 #define mem_alloc(bsize)        calloc(1, bsize)
66 #define mem_free(ptr, bsize)    free(ptr)
67
68 #include <sys/time.h>
69 #include <sys/param.h>
70 #include <stdlib.h>
71 #include <netconfig.h>
72
73 /*
74  * The netbuf structure is defined here, because FreeBSD / NetBSD only use
75  * it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing
76  * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI.
77  */
78
79 /*
80  * The netbuf structure is used for transport-independent address storage.
81  */
82 struct netbuf {
83   unsigned int maxlen;
84   unsigned int len;
85   void *buf;
86 };
87
88 /*
89  * The format of the addres and options arguments of the XTI t_bind call.
90  * Only provided for compatibility, it should not be used.
91  */
92
93 struct t_bind {
94   struct netbuf   addr;
95   unsigned int    qlen;
96 };
97
98 /*
99  * Internal library and rpcbind use. This is not an exported interface, do
100  * not use.
101  */
102 struct __rpc_sockinfo {
103         int si_af; 
104         int si_proto;
105         int si_socktype;
106         int si_alen;
107 };
108
109 #endif /* _TIRPC_TYPES_H */