unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.diff -r1.18 -r1.19 src/include/rpc/auth.h
(dholland)
--- src/include/rpc/auth.h 2016/01/23 01:05:30 1.18
+++ src/include/rpc/auth.h 2016/01/23 02:34:09 1.19
@@ -1,193 +1,193 @@ | @@ -1,193 +1,193 @@ | |||
1 | /* $NetBSD: auth.h,v 1.18 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: auth.h,v 1.19 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)auth.h 1.17 88/02/08 SMI | 31 | * from: @(#)auth.h 1.17 88/02/08 SMI | |
32 | * @(#)auth.h 2.3 88/08/07 4.0 RPCSRC | 32 | * @(#)auth.h 2.3 88/08/07 4.0 RPCSRC | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * auth.h, Authentication interface. | 36 | * auth.h, Authentication interface. | |
37 | * | 37 | * | |
38 | * Copyright (C) 1984, Sun Microsystems, Inc. | 38 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
39 | * | 39 | * | |
40 | * The data structures are completely opaque to the client. The client | 40 | * The data structures are completely opaque to the client. The client | |
41 | * is required to pass a AUTH * to routines that create rpc | 41 | * is required to pass a AUTH * to routines that create rpc | |
42 | * "sessions". | 42 | * "sessions". | |
43 | */ | 43 | */ | |
44 | 44 | |||
45 | #ifndef _RPC_AUTH_H_ | 45 | #ifndef _RPC_AUTH_H_ | |
46 | #define _RPC_AUTH_H_ | 46 | #define _RPC_AUTH_H_ | |
47 | #include <sys/cdefs.h> | 47 | #include <sys/cdefs.h> | |
48 | 48 | |||
49 | #define MAX_AUTH_BYTES 400 | 49 | #define MAX_AUTH_BYTES 400 | |
50 | #define MAXNETNAMELEN 255 /* maximum length of network user's name */ | 50 | #define MAXNETNAMELEN 255 /* maximum length of network user's name */ | |
51 | 51 | |||
52 | /* | 52 | /* | |
53 | * Status returned from authentication check | 53 | * Status returned from authentication check | |
54 | */ | 54 | */ | |
55 | enum auth_stat { | 55 | enum auth_stat { | |
56 | AUTH_OK=0, | 56 | AUTH_OK=0, | |
57 | /* | 57 | /* | |
58 | * failed at remote end | 58 | * failed at remote end | |
59 | */ | 59 | */ | |
60 | AUTH_BADCRED=1, /* bogus credentials (seal broken) */ | 60 | AUTH_BADCRED=1, /* bogus credentials (seal broken) */ | |
61 | AUTH_REJECTEDCRED=2, /* client should begin new session */ | 61 | AUTH_REJECTEDCRED=2, /* client should begin new session */ | |
62 | AUTH_BADVERF=3, /* bogus verifier (seal broken) */ | 62 | AUTH_BADVERF=3, /* bogus verifier (seal broken) */ | |
63 | AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ | 63 | AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ | |
64 | AUTH_TOOWEAK=5, /* rejected due to security reasons */ | 64 | AUTH_TOOWEAK=5, /* rejected due to security reasons */ | |
65 | /* | 65 | /* | |
66 | * failed locally | 66 | * failed locally | |
67 | */ | 67 | */ | |
68 | AUTH_INVALIDRESP=6, /* bogus response verifier */ | 68 | AUTH_INVALIDRESP=6, /* bogus response verifier */ | |
69 | AUTH_FAILED=7 /* some unknown reason */ | 69 | AUTH_FAILED=7 /* some unknown reason */ | |
70 | }; | 70 | }; | |
71 | 71 | |||
72 | union des_block { | 72 | union des_block { | |
73 | struct { | 73 | struct { | |
74 | uint32_t high; | 74 | uint32_t high; | |
75 | uint32_t low; | 75 | uint32_t low; | |
76 | } key; | 76 | } key; | |
77 | char c[8]; | 77 | char c[8]; | |
78 | }; | 78 | }; | |
79 | typedef union des_block des_block; | 79 | typedef union des_block des_block; | |
80 | __BEGIN_DECLS | 80 | __BEGIN_DECLS | |
81 | extern bool_t xdr_des_block(XDR *, des_block *); | 81 | extern bool_t xdr_des_block(XDR *, des_block *); | |
82 | __END_DECLS | 82 | __END_DECLS | |
83 | 83 | |||
84 | /* | 84 | /* | |
85 | * Authentication info. Opaque to client. | 85 | * Authentication info. Opaque to client. | |
86 | */ | 86 | */ | |
87 | struct opaque_auth { | 87 | struct opaque_auth { | |
88 | enum_t oa_flavor; /* flavor of auth */ | 88 | enum_t oa_flavor; /* flavor of auth */ | |
89 | caddr_t oa_base; /* address of more auth stuff */ | 89 | caddr_t oa_base; /* address of more auth stuff */ | |
90 | unsigned oa_length; /* not to exceed MAX_AUTH_BYTES */ | 90 | unsigned int oa_length; /* not to exceed MAX_AUTH_BYTES */ | |
91 | }; | 91 | }; | |
92 | 92 | |||
93 | 93 | |||
94 | /* | 94 | /* | |
95 | * Auth handle, interface to client side authenticators. | 95 | * Auth handle, interface to client side authenticators. | |
96 | */ | 96 | */ | |
97 | typedef struct __rpc_auth { | 97 | typedef struct __rpc_auth { | |
98 | struct opaque_auth ah_cred; | 98 | struct opaque_auth ah_cred; | |
99 | struct opaque_auth ah_verf; | 99 | struct opaque_auth ah_verf; | |
100 | union des_block ah_key; | 100 | union des_block ah_key; | |
101 | const struct auth_ops { | 101 | const struct auth_ops { | |
102 | void (*ah_nextverf)(struct __rpc_auth *); | 102 | void (*ah_nextverf)(struct __rpc_auth *); | |
103 | /* nextverf & serialize */ | 103 | /* nextverf & serialize */ | |
104 | int (*ah_marshal)(struct __rpc_auth *, XDR *); | 104 | int (*ah_marshal)(struct __rpc_auth *, XDR *); | |
105 | /* validate varifier */ | 105 | /* validate varifier */ | |
106 | int (*ah_validate)(struct __rpc_auth *, | 106 | int (*ah_validate)(struct __rpc_auth *, | |
107 | struct opaque_auth *); | 107 | struct opaque_auth *); | |
108 | /* refresh credentials */ | 108 | /* refresh credentials */ | |
109 | int (*ah_refresh)(struct __rpc_auth *); | 109 | int (*ah_refresh)(struct __rpc_auth *); | |
110 | /* destroy this structure */ | 110 | /* destroy this structure */ | |
111 | void (*ah_destroy)(struct __rpc_auth *); | 111 | void (*ah_destroy)(struct __rpc_auth *); | |
112 | } *ah_ops; | 112 | } *ah_ops; | |
113 | void *ah_private; | 113 | void *ah_private; | |
114 | } AUTH; | 114 | } AUTH; | |
115 | 115 | |||
116 | 116 | |||
117 | /* | 117 | /* | |
118 | * Authentication ops. | 118 | * Authentication ops. | |
119 | * The ops and the auth handle provide the interface to the authenticators. | 119 | * The ops and the auth handle provide the interface to the authenticators. | |
120 | * | 120 | * | |
121 | * AUTH *auth; | 121 | * AUTH *auth; | |
122 | * XDR *xdrs; | 122 | * XDR *xdrs; | |
123 | * struct opaque_auth verf; | 123 | * struct opaque_auth verf; | |
124 | */ | 124 | */ | |
125 | #define AUTH_NEXTVERF(auth) \ | 125 | #define AUTH_NEXTVERF(auth) \ | |
126 | ((*((auth)->ah_ops->ah_nextverf))(auth)) | 126 | ((*((auth)->ah_ops->ah_nextverf))(auth)) | |
127 | #define auth_nextverf(auth) \ | 127 | #define auth_nextverf(auth) \ | |
128 | ((*((auth)->ah_ops->ah_nextverf))(auth)) | 128 | ((*((auth)->ah_ops->ah_nextverf))(auth)) | |
129 | 129 | |||
130 | #define AUTH_MARSHALL(auth, xdrs) \ | 130 | #define AUTH_MARSHALL(auth, xdrs) \ | |
131 | ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) | 131 | ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) | |
132 | #define auth_marshall(auth, xdrs) \ | 132 | #define auth_marshall(auth, xdrs) \ | |
133 | ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) | 133 | ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) | |
134 | 134 | |||
135 | #define AUTH_VALIDATE(auth, verfp) \ | 135 | #define AUTH_VALIDATE(auth, verfp) \ | |
136 | ((*((auth)->ah_ops->ah_validate))((auth), verfp)) | 136 | ((*((auth)->ah_ops->ah_validate))((auth), verfp)) | |
137 | #define auth_validate(auth, verfp) \ | 137 | #define auth_validate(auth, verfp) \ | |
138 | ((*((auth)->ah_ops->ah_validate))((auth), verfp)) | 138 | ((*((auth)->ah_ops->ah_validate))((auth), verfp)) | |
139 | 139 | |||
140 | #define AUTH_REFRESH(auth) \ | 140 | #define AUTH_REFRESH(auth) \ | |
141 | ((*((auth)->ah_ops->ah_refresh))(auth)) | 141 | ((*((auth)->ah_ops->ah_refresh))(auth)) | |
142 | #define auth_refresh(auth) \ | 142 | #define auth_refresh(auth) \ | |
143 | ((*((auth)->ah_ops->ah_refresh))(auth)) | 143 | ((*((auth)->ah_ops->ah_refresh))(auth)) | |
144 | 144 | |||
145 | #define AUTH_DESTROY(auth) \ | 145 | #define AUTH_DESTROY(auth) \ | |
146 | ((*((auth)->ah_ops->ah_destroy))(auth)) | 146 | ((*((auth)->ah_ops->ah_destroy))(auth)) | |
147 | #define auth_destroy(auth) \ | 147 | #define auth_destroy(auth) \ | |
148 | ((*((auth)->ah_ops->ah_destroy))(auth)) | 148 | ((*((auth)->ah_ops->ah_destroy))(auth)) | |
149 | 149 | |||
150 | 150 | |||
151 | extern struct opaque_auth _null_auth; | 151 | extern struct opaque_auth _null_auth; | |
152 | 152 | |||
153 | 153 | |||
154 | /* | 154 | /* | |
155 | * These are the various implementations of client side authenticators. | 155 | * These are the various implementations of client side authenticators. | |
156 | */ | 156 | */ | |
157 | 157 | |||
158 | /* | 158 | /* | |
159 | * Unix style authentication | 159 | * Unix style authentication | |
160 | * AUTH *authunix_create(machname, uid, gid, len, aup_gids) | 160 | * AUTH *authunix_create(machname, uid, gid, len, aup_gids) | |
161 | * char *machname; | 161 | * char *machname; | |
162 | * int uid; | 162 | * int uid; | |
163 | * int gid; | 163 | * int gid; | |
164 | * int len; | 164 | * int len; | |
165 | * int *aup_gids; | 165 | * int *aup_gids; | |
166 | */ | 166 | */ | |
167 | __BEGIN_DECLS | 167 | __BEGIN_DECLS | |
168 | struct sockaddr_in; | 168 | struct sockaddr_in; | |
169 | extern AUTH *authunix_create (char *, int, int, int, int *); | 169 | extern AUTH *authunix_create (char *, int, int, int, int *); | |
170 | extern AUTH *authunix_create_default (void); | 170 | extern AUTH *authunix_create_default (void); | |
171 | extern AUTH *authnone_create (void); | 171 | extern AUTH *authnone_create (void); | |
172 | extern AUTH *authdes_create (char *, unsigned, | 172 | extern AUTH *authdes_create (char *, unsigned int, | |
173 | struct sockaddr_in *, des_block *); | 173 | struct sockaddr_in *, des_block *); | |
174 | extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); | 174 | extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); | |
175 | 175 | |||
176 | #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip)) | 176 | #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip)) | |
177 | #define authsys_create_default() authunix_create_default() | 177 | #define authsys_create_default() authunix_create_default() | |
178 | 178 | |||
179 | struct svc_req; | 179 | struct svc_req; | |
180 | struct rpc_msg; | 180 | struct rpc_msg; | |
181 | enum auth_stat _svcauth_null(struct svc_req *, struct rpc_msg *); | 181 | enum auth_stat _svcauth_null(struct svc_req *, struct rpc_msg *); | |
182 | enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *); | 182 | enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *); | |
183 | enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *); | 183 | enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *); | |
184 | __END_DECLS | 184 | __END_DECLS | |
185 | 185 | |||
186 | #define AUTH_NONE 0 /* no authentication */ | 186 | #define AUTH_NONE 0 /* no authentication */ | |
187 | #define AUTH_NULL 0 /* backward compatibility */ | 187 | #define AUTH_NULL 0 /* backward compatibility */ | |
188 | #define AUTH_SYS 1 /* unix style (uid, gids) */ | 188 | #define AUTH_SYS 1 /* unix style (uid, gids) */ | |
189 | #define AUTH_UNIX AUTH_SYS /* backward compatibility */ | 189 | #define AUTH_UNIX AUTH_SYS /* backward compatibility */ | |
190 | #define AUTH_SHORT 2 /* short hand unix style */ | 190 | #define AUTH_SHORT 2 /* short hand unix style */ | |
191 | #define AUTH_DES 3 /* des style (encrypted timestamps) */ | 191 | #define AUTH_DES 3 /* des style (encrypted timestamps) */ | |
192 | 192 | |||
193 | #endif /* !_RPC_AUTH_H_ */ | 193 | #endif /* !_RPC_AUTH_H_ */ |
--- src/include/rpc/auth_unix.h 2016/01/23 01:05:30 1.9
+++ src/include/rpc/auth_unix.h 2016/01/23 02:34:09 1.10
@@ -1,83 +1,83 @@ | @@ -1,83 +1,83 @@ | |||
1 | /* $NetBSD: auth_unix.h,v 1.9 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: auth_unix.h,v 1.10 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)auth_unix.h 1.8 88/02/08 SMI | 31 | * from: @(#)auth_unix.h 1.8 88/02/08 SMI | |
32 | * @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC | 32 | * @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * auth_unix.h, Protocol for UNIX style authentication parameters for RPC | 36 | * auth_unix.h, Protocol for UNIX style authentication parameters for RPC | |
37 | * | 37 | * | |
38 | * Copyright (C) 1984, Sun Microsystems, Inc. | 38 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | /* | 41 | /* | |
42 | * The system is very weak. The client uses no encryption for it | 42 | * The system is very weak. The client uses no encryption for it | |
43 | * credentials and only sends null verifiers. The server sends backs | 43 | * credentials and only sends null verifiers. The server sends backs | |
44 | * null verifiers or optionally a verifier that suggests a new short hand | 44 | * null verifiers or optionally a verifier that suggests a new short hand | |
45 | * for the credentials. | 45 | * for the credentials. | |
46 | */ | 46 | */ | |
47 | 47 | |||
48 | #ifndef _RPC_AUTH_UNIX_H_ | 48 | #ifndef _RPC_AUTH_UNIX_H_ | |
49 | #define _RPC_AUTH_UNIX_H_ | 49 | #define _RPC_AUTH_UNIX_H_ | |
50 | #include <sys/cdefs.h> | 50 | #include <sys/cdefs.h> | |
51 | 51 | |||
52 | /* The machine name is part of a credential; it may not exceed 255 bytes */ | 52 | /* The machine name is part of a credential; it may not exceed 255 bytes */ | |
53 | #define MAX_MACHINE_NAME 255 | 53 | #define MAX_MACHINE_NAME 255 | |
54 | 54 | |||
55 | /* gids compose part of a credential; there may not be more than 16 of them */ | 55 | /* gids compose part of a credential; there may not be more than 16 of them */ | |
56 | #define NGRPS 16 | 56 | #define NGRPS 16 | |
57 | 57 | |||
58 | /* | 58 | /* | |
59 | * Unix style credentials. | 59 | * Unix style credentials. | |
60 | */ | 60 | */ | |
61 | struct authunix_parms { | 61 | struct authunix_parms { | |
62 | unsigned long aup_time; | 62 | unsigned long aup_time; | |
63 | char *aup_machname; | 63 | char *aup_machname; | |
64 | int aup_uid; | 64 | int aup_uid; | |
65 | int aup_gid; | 65 | int aup_gid; | |
66 | unsigned aup_len; | 66 | unsigned int aup_len; | |
67 | int *aup_gids; | 67 | int *aup_gids; | |
68 | }; | 68 | }; | |
69 | 69 | |||
70 | __BEGIN_DECLS | 70 | __BEGIN_DECLS | |
71 | extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); | 71 | extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *); | |
72 | __END_DECLS | 72 | __END_DECLS | |
73 | 73 | |||
74 | /* | 74 | /* | |
75 | * If a response verifier has flavor AUTH_SHORT, | 75 | * If a response verifier has flavor AUTH_SHORT, | |
76 | * then the body of the response verifier encapsulates the following structure; | 76 | * then the body of the response verifier encapsulates the following structure; | |
77 | * again it is serialized in the obvious fashion. | 77 | * again it is serialized in the obvious fashion. | |
78 | */ | 78 | */ | |
79 | struct short_hand_verf { | 79 | struct short_hand_verf { | |
80 | struct opaque_auth new_cred; | 80 | struct opaque_auth new_cred; | |
81 | }; | 81 | }; | |
82 | 82 | |||
83 | #endif /* !_RPC_AUTH_UNIX_H_ */ | 83 | #endif /* !_RPC_AUTH_UNIX_H_ */ |
--- src/include/rpc/clnt.h 2016/01/23 01:05:30 1.23
+++ src/include/rpc/clnt.h 2016/01/23 02:34:09 1.24
@@ -1,538 +1,538 @@ | @@ -1,538 +1,538 @@ | |||
1 | /* $NetBSD: clnt.h,v 1.23 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: clnt.h,v 1.24 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)clnt.h 1.31 94/04/29 SMI | 31 | * from: @(#)clnt.h 1.31 94/04/29 SMI | |
32 | * @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC | 32 | * @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * clnt.h - Client side remote procedure call interface. | 36 | * clnt.h - Client side remote procedure call interface. | |
37 | * | 37 | * | |
38 | * Copyright (C) 1984, Sun Microsystems, Inc. | 38 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #ifndef _RPC_CLNT_H_ | 41 | #ifndef _RPC_CLNT_H_ | |
42 | #define _RPC_CLNT_H_ | 42 | #define _RPC_CLNT_H_ | |
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | 44 | |||
45 | #include <rpc/rpc_com.h> | 45 | #include <rpc/rpc_com.h> | |
46 | 46 | |||
47 | /* | 47 | /* | |
48 | * Well-known IPV6 RPC broadcast address. | 48 | * Well-known IPV6 RPC broadcast address. | |
49 | */ | 49 | */ | |
50 | #define RPCB_MULTICAST_ADDR "ff02::202" | 50 | #define RPCB_MULTICAST_ADDR "ff02::202" | |
51 | 51 | |||
52 | /* | 52 | /* | |
53 | * Rpc calls return an enum clnt_stat. This should be looked at more, | 53 | * Rpc calls return an enum clnt_stat. This should be looked at more, | |
54 | * since each implementation is required to live with this (implementation | 54 | * since each implementation is required to live with this (implementation | |
55 | * independent) list of errors. | 55 | * independent) list of errors. | |
56 | */ | 56 | */ | |
57 | enum clnt_stat { | 57 | enum clnt_stat { | |
58 | RPC_SUCCESS=0, /* call succeeded */ | 58 | RPC_SUCCESS=0, /* call succeeded */ | |
59 | /* | 59 | /* | |
60 | * local errors | 60 | * local errors | |
61 | */ | 61 | */ | |
62 | RPC_CANTENCODEARGS=1, /* can't encode arguments */ | 62 | RPC_CANTENCODEARGS=1, /* can't encode arguments */ | |
63 | RPC_CANTDECODERES=2, /* can't decode results */ | 63 | RPC_CANTDECODERES=2, /* can't decode results */ | |
64 | RPC_CANTSEND=3, /* failure in sending call */ | 64 | RPC_CANTSEND=3, /* failure in sending call */ | |
65 | RPC_CANTRECV=4, /* failure in receiving result */ | 65 | RPC_CANTRECV=4, /* failure in receiving result */ | |
66 | RPC_TIMEDOUT=5, /* call timed out */ | 66 | RPC_TIMEDOUT=5, /* call timed out */ | |
67 | /* | 67 | /* | |
68 | * remote errors | 68 | * remote errors | |
69 | */ | 69 | */ | |
70 | RPC_VERSMISMATCH=6, /* rpc versions not compatible */ | 70 | RPC_VERSMISMATCH=6, /* rpc versions not compatible */ | |
71 | RPC_AUTHERROR=7, /* authentication error */ | 71 | RPC_AUTHERROR=7, /* authentication error */ | |
72 | RPC_PROGUNAVAIL=8, /* program not available */ | 72 | RPC_PROGUNAVAIL=8, /* program not available */ | |
73 | RPC_PROGVERSMISMATCH=9, /* program version mismatched */ | 73 | RPC_PROGVERSMISMATCH=9, /* program version mismatched */ | |
74 | RPC_PROCUNAVAIL=10, /* procedure unavailable */ | 74 | RPC_PROCUNAVAIL=10, /* procedure unavailable */ | |
75 | RPC_CANTDECODEARGS=11, /* decode arguments error */ | 75 | RPC_CANTDECODEARGS=11, /* decode arguments error */ | |
76 | RPC_SYSTEMERROR=12, /* generic "other problem" */ | 76 | RPC_SYSTEMERROR=12, /* generic "other problem" */ | |
77 | 77 | |||
78 | /* | 78 | /* | |
79 | * rpc_call & clnt_create errors | 79 | * rpc_call & clnt_create errors | |
80 | */ | 80 | */ | |
81 | RPC_UNKNOWNHOST=13, /* unknown host name */ | 81 | RPC_UNKNOWNHOST=13, /* unknown host name */ | |
82 | RPC_UNKNOWNPROTO=17, /* unknown protocol */ | 82 | RPC_UNKNOWNPROTO=17, /* unknown protocol */ | |
83 | RPC_UNKNOWNADDR = 19, /* Remote address unknown */ | 83 | RPC_UNKNOWNADDR = 19, /* Remote address unknown */ | |
84 | RPC_NOBROADCAST = 21, /* Broadcasting not supported */ | 84 | RPC_NOBROADCAST = 21, /* Broadcasting not supported */ | |
85 | 85 | |||
86 | /* | 86 | /* | |
87 | * rpcbind errors | 87 | * rpcbind errors | |
88 | */ | 88 | */ | |
89 | RPC_RPCBFAILURE=14, /* the pmapper failed in its call */ | 89 | RPC_RPCBFAILURE=14, /* the pmapper failed in its call */ | |
90 | #define RPC_PMAPFAILURE RPC_RPCBFAILURE | 90 | #define RPC_PMAPFAILURE RPC_RPCBFAILURE | |
91 | RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ | 91 | RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ | |
92 | RPC_N2AXLATEFAILURE = 22, /* name -> addr translation failed */ | 92 | RPC_N2AXLATEFAILURE = 22, /* name -> addr translation failed */ | |
93 | 93 | |||
94 | /* | 94 | /* | |
95 | * Misc error in the TLI library (provided for compatibility) | 95 | * Misc error in the TLI library (provided for compatibility) | |
96 | */ | 96 | */ | |
97 | RPC_TLIERROR = 20, | 97 | RPC_TLIERROR = 20, | |
98 | 98 | |||
99 | /* | 99 | /* | |
100 | * unspecified error | 100 | * unspecified error | |
101 | */ | 101 | */ | |
102 | RPC_FAILED=16, | 102 | RPC_FAILED=16, | |
103 | 103 | |||
104 | /* | 104 | /* | |
105 | * asynchronous errors | 105 | * asynchronous errors | |
106 | */ | 106 | */ | |
107 | RPC_INPROGRESS = 24, | 107 | RPC_INPROGRESS = 24, | |
108 | RPC_STALERACHANDLE = 25 | 108 | RPC_STALERACHANDLE = 25 | |
109 | }; | 109 | }; | |
110 | 110 | |||
111 | 111 | |||
112 | /* | 112 | /* | |
113 | * Error info. | 113 | * Error info. | |
114 | */ | 114 | */ | |
115 | struct rpc_err { | 115 | struct rpc_err { | |
116 | enum clnt_stat re_status; | 116 | enum clnt_stat re_status; | |
117 | union { | 117 | union { | |
118 | int RE_errno; /* related system error */ | 118 | int RE_errno; /* related system error */ | |
119 | enum auth_stat RE_why; /* why the auth error occurred */ | 119 | enum auth_stat RE_why; /* why the auth error occurred */ | |
120 | struct { | 120 | struct { | |
121 | rpcvers_t low; /* lowest version supported */ | 121 | rpcvers_t low; /* lowest version supported */ | |
122 | rpcvers_t high; /* highest version supported */ | 122 | rpcvers_t high; /* highest version supported */ | |
123 | } RE_vers; | 123 | } RE_vers; | |
124 | struct { /* maybe meaningful if RPC_FAILED */ | 124 | struct { /* maybe meaningful if RPC_FAILED */ | |
125 | int32_t s1; | 125 | int32_t s1; | |
126 | int32_t s2; | 126 | int32_t s2; | |
127 | } RE_lb; /* life boot & debugging only */ | 127 | } RE_lb; /* life boot & debugging only */ | |
128 | } ru; | 128 | } ru; | |
129 | #define re_errno ru.RE_errno | 129 | #define re_errno ru.RE_errno | |
130 | #define re_why ru.RE_why | 130 | #define re_why ru.RE_why | |
131 | #define re_vers ru.RE_vers | 131 | #define re_vers ru.RE_vers | |
132 | #define re_lb ru.RE_lb | 132 | #define re_lb ru.RE_lb | |
133 | }; | 133 | }; | |
134 | 134 | |||
135 | 135 | |||
136 | /* | 136 | /* | |
137 | * Client rpc handle. | 137 | * Client rpc handle. | |
138 | * Created by individual implementations | 138 | * Created by individual implementations | |
139 | * Client is responsible for initializing auth, see e.g. auth_none.c. | 139 | * Client is responsible for initializing auth, see e.g. auth_none.c. | |
140 | */ | 140 | */ | |
141 | typedef struct __rpc_client { | 141 | typedef struct __rpc_client { | |
142 | AUTH *cl_auth; /* authenticator */ | 142 | AUTH *cl_auth; /* authenticator */ | |
143 | const struct clnt_ops { | 143 | const struct clnt_ops { | |
144 | /* call remote procedure */ | 144 | /* call remote procedure */ | |
145 | enum clnt_stat (*cl_call)(struct __rpc_client *, | 145 | enum clnt_stat (*cl_call)(struct __rpc_client *, | |
146 | rpcproc_t, xdrproc_t, const char *, | 146 | rpcproc_t, xdrproc_t, const char *, | |
147 | xdrproc_t, caddr_t, struct timeval); | 147 | xdrproc_t, caddr_t, struct timeval); | |
148 | /* abort a call */ | 148 | /* abort a call */ | |
149 | void (*cl_abort)(struct __rpc_client *); | 149 | void (*cl_abort)(struct __rpc_client *); | |
150 | /* get specific error code */ | 150 | /* get specific error code */ | |
151 | void (*cl_geterr)(struct __rpc_client *, | 151 | void (*cl_geterr)(struct __rpc_client *, | |
152 | struct rpc_err *); | 152 | struct rpc_err *); | |
153 | /* frees results */ | 153 | /* frees results */ | |
154 | bool_t (*cl_freeres)(struct __rpc_client *, | 154 | bool_t (*cl_freeres)(struct __rpc_client *, | |
155 | xdrproc_t, caddr_t); | 155 | xdrproc_t, caddr_t); | |
156 | /* destroy this structure */ | 156 | /* destroy this structure */ | |
157 | void (*cl_destroy)(struct __rpc_client *); | 157 | void (*cl_destroy)(struct __rpc_client *); | |
158 | /* the ioctl() of rpc */ | 158 | /* the ioctl() of rpc */ | |
159 | bool_t (*cl_control)(struct __rpc_client *, unsigned, | 159 | bool_t (*cl_control)(struct __rpc_client *, | |
160 | char *); | 160 | unsigned int, char *); | |
161 | } *cl_ops; | 161 | } *cl_ops; | |
162 | void *cl_private; /* private stuff */ | 162 | void *cl_private; /* private stuff */ | |
163 | char *cl_netid; /* network token */ | 163 | char *cl_netid; /* network token */ | |
164 | char *cl_tp; /* device name */ | 164 | char *cl_tp; /* device name */ | |
165 | } CLIENT; | 165 | } CLIENT; | |
166 | 166 | |||
167 | 167 | |||
168 | /* | 168 | /* | |
169 | * Timers used for the pseudo-transport protocol when using datagrams | 169 | * Timers used for the pseudo-transport protocol when using datagrams | |
170 | */ | 170 | */ | |
171 | struct rpc_timers { | 171 | struct rpc_timers { | |
172 | unsigned short rt_srtt; /* smoothed round-trip time */ | 172 | unsigned short rt_srtt; /* smoothed round-trip time */ | |
173 | unsigned short rt_deviate; /* estimated deviation */ | 173 | unsigned short rt_deviate; /* estimated deviation */ | |
174 | unsigned long rt_rtxcur; /* current (backed-off) rto */ | 174 | unsigned long rt_rtxcur; /* current (backed-off) rto */ | |
175 | }; | 175 | }; | |
176 | 176 | |||
177 | /* | 177 | /* | |
178 | * Feedback values used for possible congestion and rate control | 178 | * Feedback values used for possible congestion and rate control | |
179 | */ | 179 | */ | |
180 | #define FEEDBACK_REXMIT1 1 /* first retransmit */ | 180 | #define FEEDBACK_REXMIT1 1 /* first retransmit */ | |
181 | #define FEEDBACK_OK 2 /* no retransmits */ | 181 | #define FEEDBACK_OK 2 /* no retransmits */ | |
182 | 182 | |||
183 | /* Used to set version of portmapper used in broadcast */ | 183 | /* Used to set version of portmapper used in broadcast */ | |
184 | 184 | |||
185 | #define CLCR_SET_LOWVERS 3 | 185 | #define CLCR_SET_LOWVERS 3 | |
186 | #define CLCR_GET_LOWVERS 4 | 186 | #define CLCR_GET_LOWVERS 4 | |
187 | 187 | |||
188 | #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ | 188 | #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ | |
189 | 189 | |||
190 | /* | 190 | /* | |
191 | * client side rpc interface ops | 191 | * client side rpc interface ops | |
192 | * | 192 | * | |
193 | * Parameter types are: | 193 | * Parameter types are: | |
194 | * | 194 | * | |
195 | */ | 195 | */ | |
196 | 196 | |||
197 | /* | 197 | /* | |
198 | * enum clnt_stat | 198 | * enum clnt_stat | |
199 | * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) | 199 | * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) | |
200 | * CLIENT *rh; | 200 | * CLIENT *rh; | |
201 | * rpcproc_t proc; | 201 | * rpcproc_t proc; | |
202 | * xdrproc_t xargs; | 202 | * xdrproc_t xargs; | |
203 | * caddr_t argsp; | 203 | * caddr_t argsp; | |
204 | * xdrproc_t xres; | 204 | * xdrproc_t xres; | |
205 | * caddr_t resp; | 205 | * caddr_t resp; | |
206 | * struct timeval timeout; | 206 | * struct timeval timeout; | |
207 | */ | 207 | */ | |
208 | #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ | 208 | #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ | |
209 | ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ | 209 | ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ | |
210 | (const char *)(const void *)(argsp), (xdrproc_t)xres, \ | 210 | (const char *)(const void *)(argsp), (xdrproc_t)xres, \ | |
211 | (caddr_t)(void *)resp, secs)) | 211 | (caddr_t)(void *)resp, secs)) | |
212 | #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ | 212 | #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ | |
213 | ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ | 213 | ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ | |
214 | (const char *)(const void *)(argsp), (xdrproc_t)xres, \ | 214 | (const char *)(const void *)(argsp), (xdrproc_t)xres, \ | |
215 | (caddr_t)(void *)resp, secs)) | 215 | (caddr_t)(void *)resp, secs)) | |
216 | 216 | |||
217 | /* | 217 | /* | |
218 | * void | 218 | * void | |
219 | * CLNT_ABORT(rh); | 219 | * CLNT_ABORT(rh); | |
220 | * CLIENT *rh; | 220 | * CLIENT *rh; | |
221 | */ | 221 | */ | |
222 | #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) | 222 | #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) | |
223 | #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) | 223 | #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) | |
224 | 224 | |||
225 | /* | 225 | /* | |
226 | * struct rpc_err | 226 | * struct rpc_err | |
227 | * CLNT_GETERR(rh); | 227 | * CLNT_GETERR(rh); | |
228 | * CLIENT *rh; | 228 | * CLIENT *rh; | |
229 | */ | 229 | */ | |
230 | #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) | 230 | #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) | |
231 | #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) | 231 | #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) | |
232 | 232 | |||
233 | 233 | |||
234 | /* | 234 | /* | |
235 | * bool_t | 235 | * bool_t | |
236 | * CLNT_FREERES(rh, xres, resp); | 236 | * CLNT_FREERES(rh, xres, resp); | |
237 | * CLIENT *rh; | 237 | * CLIENT *rh; | |
238 | * xdrproc_t xres; | 238 | * xdrproc_t xres; | |
239 | * caddr_t resp; | 239 | * caddr_t resp; | |
240 | */ | 240 | */ | |
241 | #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) | 241 | #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) | |
242 | #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) | 242 | #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) | |
243 | 243 | |||
244 | /* | 244 | /* | |
245 | * bool_t | 245 | * bool_t | |
246 | * CLNT_CONTROL(cl, request, info) | 246 | * CLNT_CONTROL(cl, request, info) | |
247 | * CLIENT *cl; | 247 | * CLIENT *cl; | |
248 | * unsigned request; | 248 | * unsigned request; | |
249 | * char *info; | 249 | * char *info; | |
250 | */ | 250 | */ | |
251 | #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) | 251 | #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) | |
252 | #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) | 252 | #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) | |
253 | 253 | |||
254 | /* | 254 | /* | |
255 | * control operations that apply to both udp and tcp transports | 255 | * control operations that apply to both udp and tcp transports | |
256 | */ | 256 | */ | |
257 | #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ | 257 | #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ | |
258 | #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ | 258 | #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ | |
259 | #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ | 259 | #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ | |
260 | #define CLGET_FD 6 /* get connections file descriptor */ | 260 | #define CLGET_FD 6 /* get connections file descriptor */ | |
261 | #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ | 261 | #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ | |
262 | #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ | 262 | #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ | |
263 | #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ | 263 | #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ | |
264 | #define CLGET_XID 10 /* Get xid */ | 264 | #define CLGET_XID 10 /* Get xid */ | |
265 | #define CLSET_XID 11 /* Set xid */ | 265 | #define CLSET_XID 11 /* Set xid */ | |
266 | #define CLGET_VERS 12 /* Get version number */ | 266 | #define CLGET_VERS 12 /* Get version number */ | |
267 | #define CLSET_VERS 13 /* Set version number */ | 267 | #define CLSET_VERS 13 /* Set version number */ | |
268 | #define CLGET_PROG 14 /* Get program number */ | 268 | #define CLGET_PROG 14 /* Get program number */ | |
269 | #define CLSET_PROG 15 /* Set program number */ | 269 | #define CLSET_PROG 15 /* Set program number */ | |
270 | #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ | 270 | #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ | |
271 | #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ | 271 | #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ | |
272 | #define CLSET_POP_TIMOD 18 /* pop timod */ | 272 | #define CLSET_POP_TIMOD 18 /* pop timod */ | |
273 | /* | 273 | /* | |
274 | * Connectionless only control operations | 274 | * Connectionless only control operations | |
275 | */ | 275 | */ | |
276 | #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ | 276 | #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ | |
277 | #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ | 277 | #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ | |
278 | 278 | |||
279 | /* | 279 | /* | |
280 | * void | 280 | * void | |
281 | * CLNT_DESTROY(rh); | 281 | * CLNT_DESTROY(rh); | |
282 | * CLIENT *rh; | 282 | * CLIENT *rh; | |
283 | */ | 283 | */ | |
284 | #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) | 284 | #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) | |
285 | #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) | 285 | #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) | |
286 | 286 | |||
287 | 287 | |||
288 | /* | 288 | /* | |
289 | * RPCTEST is a test program which is accessible on every rpc | 289 | * RPCTEST is a test program which is accessible on every rpc | |
290 | * transport/port. It is used for testing, performance evaluation, | 290 | * transport/port. It is used for testing, performance evaluation, | |
291 | * and network administration. | 291 | * and network administration. | |
292 | */ | 292 | */ | |
293 | 293 | |||
294 | #define RPCTEST_PROGRAM ((rpcprog_t)1) | 294 | #define RPCTEST_PROGRAM ((rpcprog_t)1) | |
295 | #define RPCTEST_VERSION ((rpcvers_t)1) | 295 | #define RPCTEST_VERSION ((rpcvers_t)1) | |
296 | #define RPCTEST_NULL_PROC ((rpcproc_t)2) | 296 | #define RPCTEST_NULL_PROC ((rpcproc_t)2) | |
297 | #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) | 297 | #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) | |
298 | 298 | |||
299 | /* | 299 | /* | |
300 | * By convention, procedure 0 takes null arguments and returns them | 300 | * By convention, procedure 0 takes null arguments and returns them | |
301 | */ | 301 | */ | |
302 | 302 | |||
303 | #define NULLPROC ((rpcproc_t)0) | 303 | #define NULLPROC ((rpcproc_t)0) | |
304 | 304 | |||
305 | /* | 305 | /* | |
306 | * Below are the client handle creation routines for the various | 306 | * Below are the client handle creation routines for the various | |
307 | * implementations of client side rpc. They can return NULL if a | 307 | * implementations of client side rpc. They can return NULL if a | |
308 | * creation failure occurs. | 308 | * creation failure occurs. | |
309 | */ | 309 | */ | |
310 | 310 | |||
311 | /* | 311 | /* | |
312 | * Generic client creation routine. Supported protocols are those that | 312 | * Generic client creation routine. Supported protocols are those that | |
313 | * belong to the nettype namespace (/etc/netconfig). | 313 | * belong to the nettype namespace (/etc/netconfig). | |
314 | * CLIENT * | 314 | * CLIENT * | |
315 | * clnt_create(host, prog, vers, prot); | 315 | * clnt_create(host, prog, vers, prot); | |
316 | * const char *host; -- hostname | 316 | * const char *host; -- hostname | |
317 | * const rpcprog_t prog; -- program number | 317 | * const rpcprog_t prog; -- program number | |
318 | * const rpcvers_t vers; -- version number | 318 | * const rpcvers_t vers; -- version number | |
319 | * const char *prot; -- protocol | 319 | * const char *prot; -- protocol | |
320 | */ | 320 | */ | |
321 | __BEGIN_DECLS | 321 | __BEGIN_DECLS | |
322 | extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, | 322 | extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, | |
323 | const char *); | 323 | const char *); | |
324 | /* | 324 | /* | |
325 | * | 325 | * | |
326 | * const char *hostname; -- hostname | 326 | * const char *hostname; -- hostname | |
327 | * const rpcprog_t prog; -- program number | 327 | * const rpcprog_t prog; -- program number | |
328 | * const rpcvers_t vers; -- version number | 328 | * const rpcvers_t vers; -- version number | |
329 | * const char *nettype; -- network type | 329 | * const char *nettype; -- network type | |
330 | */ | 330 | */ | |
331 | 331 | |||
332 | /* | 332 | /* | |
333 | * Generic client creation routine. Supported protocols are which belong | 333 | * Generic client creation routine. Supported protocols are which belong | |
334 | * to the nettype name space. | 334 | * to the nettype name space. | |
335 | */ | 335 | */ | |
336 | extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *, | 336 | extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *, | |
337 | const rpcvers_t, const rpcvers_t, | 337 | const rpcvers_t, const rpcvers_t, | |
338 | const char *); | 338 | const char *); | |
339 | /* | 339 | /* | |
340 | * const char *host; -- hostname | 340 | * const char *host; -- hostname | |
341 | * const rpcprog_t prog; -- program number | 341 | * const rpcprog_t prog; -- program number | |
342 | * rpcvers_t *vers_out; -- servers highest available version | 342 | * rpcvers_t *vers_out; -- servers highest available version | |
343 | * const rpcvers_t vers_low; -- low version number | 343 | * const rpcvers_t vers_low; -- low version number | |
344 | * const rpcvers_t vers_high; -- high version number | 344 | * const rpcvers_t vers_high; -- high version number | |
345 | * const char *nettype; -- network type | 345 | * const char *nettype; -- network type | |
346 | */ | 346 | */ | |
347 | 347 | |||
348 | 348 | |||
349 | /* | 349 | /* | |
350 | * Generic client creation routine. It takes a netconfig structure | 350 | * Generic client creation routine. It takes a netconfig structure | |
351 | * instead of nettype | 351 | * instead of nettype | |
352 | */ | 352 | */ | |
353 | extern CLIENT *clnt_tp_create(const char *, const rpcprog_t, | 353 | extern CLIENT *clnt_tp_create(const char *, const rpcprog_t, | |
354 | const rpcvers_t, const struct netconfig *); | 354 | const rpcvers_t, const struct netconfig *); | |
355 | /* | 355 | /* | |
356 | * const char *hostname; -- hostname | 356 | * const char *hostname; -- hostname | |
357 | * const rpcprog_t prog; -- program number | 357 | * const rpcprog_t prog; -- program number | |
358 | * const rpcvers_t vers; -- version number | 358 | * const rpcvers_t vers; -- version number | |
359 | * const struct netconfig *netconf; -- network config structure | 359 | * const struct netconfig *netconf; -- network config structure | |
360 | */ | 360 | */ | |
361 | 361 | |||
362 | /* | 362 | /* | |
363 | * Generic TLI create routine. Only provided for compatibility. | 363 | * Generic TLI create routine. Only provided for compatibility. | |
364 | */ | 364 | */ | |
365 | 365 | |||
366 | extern CLIENT *clnt_tli_create(const int, const struct netconfig *, | 366 | extern CLIENT *clnt_tli_create(const int, const struct netconfig *, | |
367 | const struct netbuf *, const rpcprog_t, | 367 | const struct netbuf *, const rpcprog_t, | |
368 | const rpcvers_t, const unsigned, | 368 | const rpcvers_t, const unsigned int, | |
369 | const unsigned); | 369 | const unsigned int); | |
370 | /* | 370 | /* | |
371 | * const register int fd; -- fd | 371 | * const register int fd; -- fd | |
372 | * const struct netconfig *nconf; -- netconfig structure | 372 | * const struct netconfig *nconf; -- netconfig structure | |
373 | * const struct netbuf *svcaddr; -- servers address | 373 | * const struct netbuf *svcaddr; -- servers address | |
374 | * const unsigned long prog; -- program number | 374 | * const unsigned long prog; -- program number | |
375 | * const unsigned long vers; -- version number | 375 | * const unsigned long vers; -- version number | |
376 | * const unsigned sendsz; -- send size | 376 | * const unsigned sendsz; -- send size | |
377 | * const unsigned recvsz; -- recv size | 377 | * const unsigned recvsz; -- recv size | |
378 | */ | 378 | */ | |
379 | 379 | |||
380 | /* | 380 | /* | |
381 | * Low level clnt create routine for connectionful transports, e.g. tcp. | 381 | * Low level clnt create routine for connectionful transports, e.g. tcp. | |
382 | */ | 382 | */ | |
383 | extern CLIENT *clnt_vc_create(const int, const struct netbuf *, | 383 | extern CLIENT *clnt_vc_create(const int, const struct netbuf *, | |
384 | const rpcprog_t, const rpcvers_t, | 384 | const rpcprog_t, const rpcvers_t, | |
385 | const unsigned, const unsigned); | 385 | const unsigned int, const unsigned int); | |
386 | /* | 386 | /* | |
387 | * const int fd; -- open file descriptor | 387 | * const int fd; -- open file descriptor | |
388 | * const struct netbuf *svcaddr; -- servers address | 388 | * const struct netbuf *svcaddr; -- servers address | |
389 | * const rpcprog_t prog; -- program number | 389 | * const rpcprog_t prog; -- program number | |
390 | * const rpcvers_t vers; -- version number | 390 | * const rpcvers_t vers; -- version number | |
391 | * const unsigned sendsz; -- buffer recv size | 391 | * const unsigned sendsz; -- buffer recv size | |
392 | * const unsigned recvsz; -- buffer send size | 392 | * const unsigned recvsz; -- buffer send size | |
393 | */ | 393 | */ | |
394 | 394 | |||
395 | /* | 395 | /* | |
396 | * Low level clnt create routine for connectionless transports, e.g. udp. | 396 | * Low level clnt create routine for connectionless transports, e.g. udp. | |
397 | */ | 397 | */ | |
398 | extern CLIENT *clnt_dg_create(const int, const struct netbuf *, | 398 | extern CLIENT *clnt_dg_create(const int, const struct netbuf *, | |
399 | const rpcprog_t, const rpcvers_t, | 399 | const rpcprog_t, const rpcvers_t, | |
400 | const unsigned, const unsigned); | 400 | const unsigned int, const unsigned int); | |
401 | /* | 401 | /* | |
402 | * const int fd; -- open file descriptor | 402 | * const int fd; -- open file descriptor | |
403 | * const struct netbuf *svcaddr; -- servers address | 403 | * const struct netbuf *svcaddr; -- servers address | |
404 | * const rpcprog_t program; -- program number | 404 | * const rpcprog_t program; -- program number | |
405 | * const rpcvers_t version; -- version number | 405 | * const rpcvers_t version; -- version number | |
406 | * const unsigned sendsz; -- buffer recv size | 406 | * const unsigned sendsz; -- buffer recv size | |
407 | * const unsigned recvsz; -- buffer send size | 407 | * const unsigned recvsz; -- buffer send size | |
408 | */ | 408 | */ | |
409 | 409 | |||
410 | /* | 410 | /* | |
411 | * Memory based rpc (for speed check and testing) | 411 | * Memory based rpc (for speed check and testing) | |
412 | * CLIENT * | 412 | * CLIENT * | |
413 | * clnt_raw_create(prog, vers) | 413 | * clnt_raw_create(prog, vers) | |
414 | * unsigned long prog; | 414 | * unsigned long prog; | |
415 | * unsigned long vers; | 415 | * unsigned long vers; | |
416 | */ | 416 | */ | |
417 | extern CLIENT *clnt_raw_create (rpcprog_t, rpcvers_t); | 417 | extern CLIENT *clnt_raw_create (rpcprog_t, rpcvers_t); | |
418 | 418 | |||
419 | __END_DECLS | 419 | __END_DECLS | |
420 | 420 | |||
421 | 421 | |||
422 | /* | 422 | /* | |
423 | * Print why creation failed | 423 | * Print why creation failed | |
424 | */ | 424 | */ | |
425 | __BEGIN_DECLS | 425 | __BEGIN_DECLS | |
426 | extern void clnt_pcreateerror (const char *); /* stderr */ | 426 | extern void clnt_pcreateerror (const char *); /* stderr */ | |
427 | extern char *clnt_spcreateerror (const char *); /* string */ | 427 | extern char *clnt_spcreateerror (const char *); /* string */ | |
428 | __END_DECLS | 428 | __END_DECLS | |
429 | 429 | |||
430 | /* | 430 | /* | |
431 | * Like clnt_perror(), but is more verbose in its output | 431 | * Like clnt_perror(), but is more verbose in its output | |
432 | */ | 432 | */ | |
433 | __BEGIN_DECLS | 433 | __BEGIN_DECLS | |
434 | extern void clnt_perrno (enum clnt_stat); /* stderr */ | 434 | extern void clnt_perrno (enum clnt_stat); /* stderr */ | |
435 | extern char *clnt_sperrno (enum clnt_stat); /* string */ | 435 | extern char *clnt_sperrno (enum clnt_stat); /* string */ | |
436 | __END_DECLS | 436 | __END_DECLS | |
437 | 437 | |||
438 | /* | 438 | /* | |
439 | * Print an English error message, given the client error code | 439 | * Print an English error message, given the client error code | |
440 | */ | 440 | */ | |
441 | __BEGIN_DECLS | 441 | __BEGIN_DECLS | |
442 | extern void clnt_perror (CLIENT *, const char *); /* stderr */ | 442 | extern void clnt_perror (CLIENT *, const char *); /* stderr */ | |
443 | extern char *clnt_sperror (CLIENT *, const char *); /* string */ | 443 | extern char *clnt_sperror (CLIENT *, const char *); /* string */ | |
444 | __END_DECLS | 444 | __END_DECLS | |
445 | 445 | |||
446 | 446 | |||
447 | /* | 447 | /* | |
448 | * If a creation fails, the following allows the user to figure out why. | 448 | * If a creation fails, the following allows the user to figure out why. | |
449 | */ | 449 | */ | |
450 | struct rpc_createerr { | 450 | struct rpc_createerr { | |
451 | enum clnt_stat cf_stat; | 451 | enum clnt_stat cf_stat; | |
452 | struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ | 452 | struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ | |
453 | }; | 453 | }; | |
454 | 454 | |||
455 | __BEGIN_DECLS | 455 | __BEGIN_DECLS | |
456 | extern struct rpc_createerr *__rpc_createerr(void); | 456 | extern struct rpc_createerr *__rpc_createerr(void); | |
457 | __END_DECLS | 457 | __END_DECLS | |
458 | #define rpc_createerr (*(__rpc_createerr())) | 458 | #define rpc_createerr (*(__rpc_createerr())) | |
459 | 459 | |||
460 | /* | 460 | /* | |
461 | * The simplified interface: | 461 | * The simplified interface: | |
462 | * enum clnt_stat | 462 | * enum clnt_stat | |
463 | * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) | 463 | * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) | |
464 | * const char *host; | 464 | * const char *host; | |
465 | * const rpcprog_t prognum; | 465 | * const rpcprog_t prognum; | |
466 | * const rpcvers_t versnum; | 466 | * const rpcvers_t versnum; | |
467 | * const rpcproc_t procnum; | 467 | * const rpcproc_t procnum; | |
468 | * const xdrproc_t inproc, outproc; | 468 | * const xdrproc_t inproc, outproc; | |
469 | * const char *in; | 469 | * const char *in; | |
470 | * char *out; | 470 | * char *out; | |
471 | * const char *nettype; | 471 | * const char *nettype; | |
472 | */ | 472 | */ | |
473 | __BEGIN_DECLS | 473 | __BEGIN_DECLS | |
474 | extern enum clnt_stat rpc_call(const char *, const rpcprog_t, | 474 | extern enum clnt_stat rpc_call(const char *, const rpcprog_t, | |
475 | const rpcvers_t, const rpcproc_t, | 475 | const rpcvers_t, const rpcproc_t, | |
476 | const xdrproc_t, const char *, | 476 | const xdrproc_t, const char *, | |
477 | const xdrproc_t, char *, const char *); | 477 | const xdrproc_t, char *, const char *); | |
478 | __END_DECLS | 478 | __END_DECLS | |
479 | 479 | |||
480 | /* | 480 | /* | |
481 | * RPC broadcast interface | 481 | * RPC broadcast interface | |
482 | * The call is broadcasted to all locally connected nets. | 482 | * The call is broadcasted to all locally connected nets. | |
483 | * | 483 | * | |
484 | * extern enum clnt_stat | 484 | * extern enum clnt_stat | |
485 | * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, | 485 | * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, | |
486 | * eachresult, nettype) | 486 | * eachresult, nettype) | |
487 | * const rpcprog_t prog; -- program number | 487 | * const rpcprog_t prog; -- program number | |
488 | * const rpcvers_t vers; -- version number | 488 | * const rpcvers_t vers; -- version number | |
489 | * const rpcproc_t proc; -- procedure number | 489 | * const rpcproc_t proc; -- procedure number | |
490 | * const xdrproc_t xargs; -- xdr routine for args | 490 | * const xdrproc_t xargs; -- xdr routine for args | |
491 | * caddr_t argsp; -- pointer to args | 491 | * caddr_t argsp; -- pointer to args | |
492 | * const xdrproc_t xresults; -- xdr routine for results | 492 | * const xdrproc_t xresults; -- xdr routine for results | |
493 | * caddr_t resultsp; -- pointer to results | 493 | * caddr_t resultsp; -- pointer to results | |
494 | * const resultproc_t eachresult; -- call with each result | 494 | * const resultproc_t eachresult; -- call with each result | |
495 | * const char *nettype; -- Transport type | 495 | * const char *nettype; -- Transport type | |
496 | * | 496 | * | |
497 | * For each valid response received, the procedure eachresult is called. | 497 | * For each valid response received, the procedure eachresult is called. | |
498 | * Its form is: | 498 | * Its form is: | |
499 | * done = eachresult(resp, raddr, nconf) | 499 | * done = eachresult(resp, raddr, nconf) | |
500 | * bool_t done; | 500 | * bool_t done; | |
501 | * caddr_t resp; | 501 | * caddr_t resp; | |
502 | * struct netbuf *raddr; | 502 | * struct netbuf *raddr; | |
503 | * struct netconfig *nconf; | 503 | * struct netconfig *nconf; | |
504 | * where resp points to the results of the call and raddr is the | 504 | * where resp points to the results of the call and raddr is the | |
505 | * address if the responder to the broadcast. nconf is the transport | 505 | * address if the responder to the broadcast. nconf is the transport | |
506 | * on which the response was received. | 506 | * on which the response was received. | |
507 | * | 507 | * | |
508 | * extern enum clnt_stat | 508 | * extern enum clnt_stat | |
509 | * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, | 509 | * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, | |
510 | * eachresult, inittime, waittime, nettype) | 510 | * eachresult, inittime, waittime, nettype) | |
511 | * const rpcprog_t prog; -- program number | 511 | * const rpcprog_t prog; -- program number | |
512 | * const rpcvers_t vers; -- version number | 512 | * const rpcvers_t vers; -- version number | |
513 | * const rpcproc_t proc; -- procedure number | 513 | * const rpcproc_t proc; -- procedure number | |
514 | * const xdrproc_t xargs; -- xdr routine for args | 514 | * const xdrproc_t xargs; -- xdr routine for args | |
515 | * caddr_t argsp; -- pointer to args | 515 | * caddr_t argsp; -- pointer to args | |
516 | * const xdrproc_t xresults; -- xdr routine for results | 516 | * const xdrproc_t xresults; -- xdr routine for results | |
517 | * caddr_t resultsp; -- pointer to results | 517 | * caddr_t resultsp; -- pointer to results | |
518 | * const resultproc_t eachresult; -- call with each result | 518 | * const resultproc_t eachresult; -- call with each result | |
519 | * const int inittime; -- how long to wait initially | 519 | * const int inittime; -- how long to wait initially | |
520 | * const int waittime; -- maximum time to wait | 520 | * const int waittime; -- maximum time to wait | |
521 | * const char *nettype; -- Transport type | 521 | * const char *nettype; -- Transport type | |
522 | */ | 522 | */ | |
523 | 523 | |||
524 | typedef bool_t (*resultproc_t)(caddr_t, ...); | 524 | typedef bool_t (*resultproc_t)(caddr_t, ...); | |
525 | 525 | |||
526 | __BEGIN_DECLS | 526 | __BEGIN_DECLS | |
527 | extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, | 527 | extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, | |
528 | const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, | 528 | const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, | |
529 | const resultproc_t, const char *); | 529 | const resultproc_t, const char *); | |
530 | extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, | 530 | extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, | |
531 | const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, | 531 | const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, | |
532 | const resultproc_t, const int, const int, const char *); | 532 | const resultproc_t, const int, const int, const char *); | |
533 | __END_DECLS | 533 | __END_DECLS | |
534 | 534 | |||
535 | /* For backward compatibility */ | 535 | /* For backward compatibility */ | |
536 | #include <rpc/clnt_soc.h> | 536 | #include <rpc/clnt_soc.h> | |
537 | 537 | |||
538 | #endif /* !_RPC_CLNT_H_ */ | 538 | #endif /* !_RPC_CLNT_H_ */ |
--- src/include/rpc/clnt_soc.h 2016/01/23 01:05:30 1.4
+++ src/include/rpc/clnt_soc.h 2016/01/23 02:34:09 1.5
@@ -1,117 +1,117 @@ | @@ -1,117 +1,117 @@ | |||
1 | /* $NetBSD: clnt_soc.h,v 1.4 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: clnt_soc.h,v 1.5 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | */ | 30 | */ | |
31 | /* | 31 | /* | |
32 | * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. | 32 | * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * clnt.h - Client side remote procedure call interface. | 36 | * clnt.h - Client side remote procedure call interface. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #ifndef _RPC_CLNT_SOC_H | 39 | #ifndef _RPC_CLNT_SOC_H | |
40 | #define _RPC_CLNT_SOC_H | 40 | #define _RPC_CLNT_SOC_H | |
41 | 41 | |||
42 | /* derived from clnt_soc.h 1.3 88/12/17 SMI */ | 42 | /* derived from clnt_soc.h 1.3 88/12/17 SMI */ | |
43 | 43 | |||
44 | /* | 44 | /* | |
45 | * All the following declarations are only for backward compatibility | 45 | * All the following declarations are only for backward compatibility | |
46 | * with TS-RPC. | 46 | * with TS-RPC. | |
47 | */ | 47 | */ | |
48 | 48 | |||
49 | #include <sys/cdefs.h> | 49 | #include <sys/cdefs.h> | |
50 | 50 | |||
51 | #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ | 51 | #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ | |
52 | 52 | |||
53 | /* | 53 | /* | |
54 | * TCP based rpc | 54 | * TCP based rpc | |
55 | * CLIENT * | 55 | * CLIENT * | |
56 | * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) | 56 | * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) | |
57 | * struct sockaddr_in *raddr; | 57 | * struct sockaddr_in *raddr; | |
58 | * unsigned long prog; | 58 | * unsigned long prog; | |
59 | * unsigned long version; | 59 | * unsigned long version; | |
60 | * int *sockp; | 60 | * int *sockp; | |
61 | * unsigned sendsz; | 61 | * unsigned sendsz; | |
62 | * unsigned recvsz; | 62 | * unsigned recvsz; | |
63 | */ | 63 | */ | |
64 | __BEGIN_DECLS | 64 | __BEGIN_DECLS | |
65 | extern CLIENT *clnttcp_create(struct sockaddr_in *, | 65 | extern CLIENT *clnttcp_create(struct sockaddr_in *, | |
66 | unsigned long, | 66 | unsigned long, | |
67 | unsigned long, | 67 | unsigned long, | |
68 | int *, | 68 | int *, | |
69 | unsigned, | 69 | unsigned int, | |
70 | unsigned); | 70 | unsigned int); | |
71 | __END_DECLS | 71 | __END_DECLS | |
72 | 72 | |||
73 | /* | 73 | /* | |
74 | * Raw (memory) rpc. | 74 | * Raw (memory) rpc. | |
75 | */ | 75 | */ | |
76 | __BEGIN_DECLS | 76 | __BEGIN_DECLS | |
77 | extern CLIENT *clntraw_create (unsigned long, unsigned long); | 77 | extern CLIENT *clntraw_create (unsigned long, unsigned long); | |
78 | __END_DECLS | 78 | __END_DECLS | |
79 | 79 | |||
80 | 80 | |||
81 | /* | 81 | /* | |
82 | * UDP based rpc. | 82 | * UDP based rpc. | |
83 | * CLIENT * | 83 | * CLIENT * | |
84 | * clntudp_create(raddr, program, version, wait, sockp) | 84 | * clntudp_create(raddr, program, version, wait, sockp) | |
85 | * struct sockaddr_in *raddr; | 85 | * struct sockaddr_in *raddr; | |
86 | * unsigned long program; | 86 | * unsigned long program; | |
87 | * unsigned long version; | 87 | * unsigned long version; | |
88 | * struct timeval wait; | 88 | * struct timeval wait; | |
89 | * int *sockp; | 89 | * int *sockp; | |
90 | * | 90 | * | |
91 | * Same as above, but you specify max packet sizes. | 91 | * Same as above, but you specify max packet sizes. | |
92 | * CLIENT * | 92 | * CLIENT * | |
93 | * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) | 93 | * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) | |
94 | * struct sockaddr_in *raddr; | 94 | * struct sockaddr_in *raddr; | |
95 | * unsigned long program; | 95 | * unsigned long program; | |
96 | * unsigned long version; | 96 | * unsigned long version; | |
97 | * struct timeval wait; | 97 | * struct timeval wait; | |
98 | * int *sockp; | 98 | * int *sockp; | |
99 | * unsigned sendsz; | 99 | * unsigned sendsz; | |
100 | * unsigned recvsz; | 100 | * unsigned recvsz; | |
101 | */ | 101 | */ | |
102 | __BEGIN_DECLS | 102 | __BEGIN_DECLS | |
103 | extern CLIENT *clntudp_create(struct sockaddr_in *, | 103 | extern CLIENT *clntudp_create(struct sockaddr_in *, | |
104 | unsigned long, | 104 | unsigned long, | |
105 | unsigned long, | 105 | unsigned long, | |
106 | struct timeval, | 106 | struct timeval, | |
107 | int *); | 107 | int *); | |
108 | extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, | 108 | extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, | |
109 | unsigned long, | 109 | unsigned long, | |
110 | unsigned long, | 110 | unsigned long, | |
111 | struct timeval, | 111 | struct timeval, | |
112 | int *, | 112 | int *, | |
113 | unsigned, | 113 | unsigned int, | |
114 | unsigned); | 114 | unsigned int); | |
115 | __END_DECLS | 115 | __END_DECLS | |
116 | 116 | |||
117 | #endif /* _RPC_CLNT_SOC_H */ | 117 | #endif /* _RPC_CLNT_SOC_H */ |
--- src/include/rpc/pmap_clnt.h 2016/01/23 01:05:30 1.12
+++ src/include/rpc/pmap_clnt.h 2016/01/23 02:34:09 1.13
@@ -1,91 +1,91 @@ | @@ -1,91 +1,91 @@ | |||
1 | /* $NetBSD: pmap_clnt.h,v 1.12 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: pmap_clnt.h,v 1.13 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)pmap_clnt.h 1.11 88/02/08 SMI | 31 | * from: @(#)pmap_clnt.h 1.11 88/02/08 SMI | |
32 | * @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC | 32 | * @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * pmap_clnt.h | 36 | * pmap_clnt.h | |
37 | * Supplies C routines to get to portmap services. | 37 | * Supplies C routines to get to portmap services. | |
38 | * | 38 | * | |
39 | * Copyright (C) 1984, Sun Microsystems, Inc. | 39 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
40 | */ | 40 | */ | |
41 | 41 | |||
42 | /* | 42 | /* | |
43 | * Usage: | 43 | * Usage: | |
44 | * success = pmap_set(program, version, protocol, port); | 44 | * success = pmap_set(program, version, protocol, port); | |
45 | * success = pmap_unset(program, version); | 45 | * success = pmap_unset(program, version); | |
46 | * port = pmap_getport(address, program, version, protocol); | 46 | * port = pmap_getport(address, program, version, protocol); | |
47 | * head = pmap_getmaps(address); | 47 | * head = pmap_getmaps(address); | |
48 | * clnt_stat = pmap_rmtcall(address, program, version, procedure, | 48 | * clnt_stat = pmap_rmtcall(address, program, version, procedure, | |
49 | * xdrargs, argsp, xdrres, resp, tout, port_ptr) | 49 | * xdrargs, argsp, xdrres, resp, tout, port_ptr) | |
50 | * (works for udp only.) | 50 | * (works for udp only.) | |
51 | * clnt_stat = clnt_broadcast(program, version, procedure, | 51 | * clnt_stat = clnt_broadcast(program, version, procedure, | |
52 | * xdrargs, argsp, xdrres, resp, eachresult) | 52 | * xdrargs, argsp, xdrres, resp, eachresult) | |
53 | * (like pmap_rmtcall, except the call is broadcasted to all | 53 | * (like pmap_rmtcall, except the call is broadcasted to all | |
54 | * locally connected nets. For each valid response received, | 54 | * locally connected nets. For each valid response received, | |
55 | * the procedure eachresult is called. Its form is: | 55 | * the procedure eachresult is called. Its form is: | |
56 | * done = eachresult(resp, raddr) | 56 | * done = eachresult(resp, raddr) | |
57 | * bool_t done; | 57 | * bool_t done; | |
58 | * caddr_t resp; | 58 | * caddr_t resp; | |
59 | * struct sockaddr_in raddr; | 59 | * struct sockaddr_in raddr; | |
60 | * where resp points to the results of the call and raddr is the | 60 | * where resp points to the results of the call and raddr is the | |
61 | * address if the responder to the broadcast. | 61 | * address if the responder to the broadcast. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #ifndef _RPC_PMAP_CLNT_H_ | 64 | #ifndef _RPC_PMAP_CLNT_H_ | |
65 | #define _RPC_PMAP_CLNT_H_ | 65 | #define _RPC_PMAP_CLNT_H_ | |
66 | #include <sys/cdefs.h> | 66 | #include <sys/cdefs.h> | |
67 | 67 | |||
68 | __BEGIN_DECLS | 68 | __BEGIN_DECLS | |
69 | extern bool_t pmap_set(unsigned long, unsigned long, int, int); | 69 | extern bool_t pmap_set(unsigned long, unsigned long, int, int); | |
70 | extern bool_t pmap_unset(unsigned long, unsigned long); | 70 | extern bool_t pmap_unset(unsigned long, unsigned long); | |
71 | extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); | 71 | extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); | |
72 | #ifndef __LIBC12_SOURCE__ | 72 | #ifndef __LIBC12_SOURCE__ | |
73 | extern enum clnt_stat pmap_rmtcall(struct sockaddr_in *, | 73 | extern enum clnt_stat pmap_rmtcall(struct sockaddr_in *, | |
74 | unsigned long, unsigned long, | 74 | unsigned long, unsigned long, | |
75 | unsigned long, | 75 | unsigned long, | |
76 | xdrproc_t, caddr_t, | 76 | xdrproc_t, caddr_t, | |
77 | xdrproc_t, caddr_t, | 77 | xdrproc_t, caddr_t, | |
78 | struct timeval, unsigned long *) | 78 | struct timeval, unsigned long *) | |
79 | __RENAME(__pmap_rmtcall50); | 79 | __RENAME(__pmap_rmtcall50); | |
80 | #endif | 80 | #endif | |
81 | extern enum clnt_stat clnt_broadcast(unsigned long, unsigned long, | 81 | extern enum clnt_stat clnt_broadcast(unsigned long, unsigned long, | |
82 | unsigned long, | 82 | unsigned long, | |
83 | xdrproc_t, char *, | 83 | xdrproc_t, char *, | |
84 | xdrproc_t, char *, | 84 | xdrproc_t, char *, | |
85 | resultproc_t); | 85 | resultproc_t); | |
86 | extern u_short pmap_getport(struct sockaddr_in *, | 86 | extern unsigned short pmap_getport(struct sockaddr_in *, | |
87 | unsigned long, unsigned long, | 87 | unsigned long, unsigned long, | |
88 | unsigned); | 88 | unsigned int); | |
89 | __END_DECLS | 89 | __END_DECLS | |
90 | 90 | |||
91 | #endif /* !_RPC_PMAP_CLNT_H_ */ | 91 | #endif /* !_RPC_PMAP_CLNT_H_ */ |
--- src/include/rpc/rpcb_prot.x 2016/01/23 01:05:30 1.5
+++ src/include/rpc/rpcb_prot.x 2016/01/23 02:34:09 1.6
@@ -1,559 +1,559 @@ | @@ -1,559 +1,559 @@ | |||
1 | %/* | 1 | %/* | |
2 | % * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 2 | % * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
3 | % * unrestricted use provided that this legend is included on all tape | 3 | % * unrestricted use provided that this legend is included on all tape | |
4 | % * media and as a part of the software program in whole or part. Users | 4 | % * media and as a part of the software program in whole or part. Users | |
5 | % * may copy or modify Sun RPC without charge, but are not authorized | 5 | % * may copy or modify Sun RPC without charge, but are not authorized | |
6 | % * to license or distribute it to anyone else except as part of a product or | 6 | % * to license or distribute it to anyone else except as part of a product or | |
7 | % * program developed by the user. | 7 | % * program developed by the user. | |
8 | % * | 8 | % * | |
9 | % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 9 | % * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
10 | % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 10 | % * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
11 | % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 11 | % * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
12 | % * | 12 | % * | |
13 | % * Sun RPC is provided with no support and without any obligation on the | 13 | % * Sun RPC is provided with no support and without any obligation on the | |
14 | % * part of Sun Microsystems, Inc. to assist in its use, correction, | 14 | % * part of Sun Microsystems, Inc. to assist in its use, correction, | |
15 | % * modification or enhancement. | 15 | % * modification or enhancement. | |
16 | % * | 16 | % * | |
17 | % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 17 | % * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
18 | % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 18 | % * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
19 | % * OR ANY PART THEREOF. | 19 | % * OR ANY PART THEREOF. | |
20 | % * | 20 | % * | |
21 | % * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 21 | % * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
22 | % * or profits or other special, indirect and consequential damages, even if | 22 | % * or profits or other special, indirect and consequential damages, even if | |
23 | % * Sun has been advised of the possibility of such damages. | 23 | % * Sun has been advised of the possibility of such damages. | |
24 | % * | 24 | % * | |
25 | % * Sun Microsystems, Inc. | 25 | % * Sun Microsystems, Inc. | |
26 | % * 2550 Garcia Avenue | 26 | % * 2550 Garcia Avenue | |
27 | % * Mountain View, California 94043 | 27 | % * Mountain View, California 94043 | |
28 | % */ | 28 | % */ | |
29 | %/* | 29 | %/* | |
30 | % * Copyright (c) 1988 by Sun Microsystems, Inc. | 30 | % * Copyright (c) 1988 by Sun Microsystems, Inc. | |
31 | % */ | 31 | % */ | |
32 | 32 | |||
33 | %/* from rpcb_prot.x */ | 33 | %/* from rpcb_prot.x */ | |
34 | 34 | |||
35 | #ifdef RPC_HDR | 35 | #ifdef RPC_HDR | |
36 | % | 36 | % | |
37 | %/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ | 37 | %/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ | |
38 | % | 38 | % | |
39 | %#ifndef _KERNEL | 39 | %#ifndef _KERNEL | |
40 | % | 40 | % | |
41 | #endif | 41 | #endif | |
42 | 42 | |||
43 | /* | 43 | /* | |
44 | * rpcb_prot.x | 44 | * rpcb_prot.x | |
45 | * rpcbind protocol, versions 3 and 4, in RPC Language | 45 | * rpcbind protocol, versions 3 and 4, in RPC Language | |
46 | */ | 46 | */ | |
47 | % | 47 | % | |
48 | %/* | 48 | %/* | |
49 | % * The following procedures are supported by the protocol in version 3: | 49 | % * The following procedures are supported by the protocol in version 3: | |
50 | % * | 50 | % * | |
51 | % * RPCBPROC_NULL() returns () | 51 | % * RPCBPROC_NULL() returns () | |
52 | % * takes nothing, returns nothing | 52 | % * takes nothing, returns nothing | |
53 | % * | 53 | % * | |
54 | % * RPCBPROC_SET(rpcb) returns (bool_t) | 54 | % * RPCBPROC_SET(rpcb) returns (bool_t) | |
55 | % * TRUE is success, FALSE is failure. Registers the tuple | 55 | % * TRUE is success, FALSE is failure. Registers the tuple | |
56 | % * [prog, vers, address, owner, netid]. | 56 | % * [prog, vers, address, owner, netid]. | |
57 | % * Finds out owner and netid information on its own. | 57 | % * Finds out owner and netid information on its own. | |
58 | % * | 58 | % * | |
59 | % * RPCBPROC_UNSET(rpcb) returns (bool_t) | 59 | % * RPCBPROC_UNSET(rpcb) returns (bool_t) | |
60 | % * TRUE is success, FALSE is failure. Un-registers tuple | 60 | % * TRUE is success, FALSE is failure. Un-registers tuple | |
61 | % * [prog, vers, netid]. addresses is ignored. | 61 | % * [prog, vers, netid]. addresses is ignored. | |
62 | % * If netid is NULL, unregister all. | 62 | % * If netid is NULL, unregister all. | |
63 | % * | 63 | % * | |
64 | % * RPCBPROC_GETADDR(rpcb) returns (string). | 64 | % * RPCBPROC_GETADDR(rpcb) returns (string). | |
65 | % * 0 is failure. Otherwise returns the universal address where the | 65 | % * 0 is failure. Otherwise returns the universal address where the | |
66 | % * triple [prog, vers, netid] is registered. Ignore address and owner. | 66 | % * triple [prog, vers, netid] is registered. Ignore address and owner. | |
67 | % * | 67 | % * | |
68 | % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr) | 68 | % * RPCBPROC_DUMP() RETURNS (rpcblist_ptr) | |
69 | % * used to dump the entire rpcbind maps | 69 | % * used to dump the entire rpcbind maps | |
70 | % * | 70 | % * | |
71 | % * RPCBPROC_CALLIT(rpcb_rmtcallargs) | 71 | % * RPCBPROC_CALLIT(rpcb_rmtcallargs) | |
72 | % * RETURNS (rpcb_rmtcallres); | 72 | % * RETURNS (rpcb_rmtcallres); | |
73 | % * Calls the procedure on the remote machine. If it is not registered, | 73 | % * Calls the procedure on the remote machine. If it is not registered, | |
74 | % * this procedure is quiet; i.e. it does not return error information!!! | 74 | % * this procedure is quiet; i.e. it does not return error information!!! | |
75 | % * This routine only passes null authentication parameters. | 75 | % * This routine only passes null authentication parameters. | |
76 | % * It has no interface to xdr routines for RPCBPROC_CALLIT. | 76 | % * It has no interface to xdr routines for RPCBPROC_CALLIT. | |
77 | % * | 77 | % * | |
78 | % * RPCBPROC_GETTIME() returns (int). | 78 | % * RPCBPROC_GETTIME() returns (int). | |
79 | % * Gets the remote machines time | 79 | % * Gets the remote machines time | |
80 | % * | 80 | % * | |
81 | % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf) | 81 | % * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf) | |
82 | % * Returns the netbuf address from universal address. | 82 | % * Returns the netbuf address from universal address. | |
83 | % * | 83 | % * | |
84 | % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string) | 84 | % * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string) | |
85 | % * Returns the universal address from netbuf address. | 85 | % * Returns the universal address from netbuf address. | |
86 | % * | 86 | % * | |
87 | % * END OF RPCBIND VERSION 3 PROCEDURES | 87 | % * END OF RPCBIND VERSION 3 PROCEDURES | |
88 | % */ | 88 | % */ | |
89 | %/* | 89 | %/* | |
90 | % * Except for RPCBPROC_CALLIT, the procedures above are carried over to | 90 | % * Except for RPCBPROC_CALLIT, the procedures above are carried over to | |
91 | % * rpcbind version 4. Those below are added or modified for version 4. | 91 | % * rpcbind version 4. Those below are added or modified for version 4. | |
92 | % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER | 92 | % * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER | |
93 | % * AS RPCBPROC_CALLIT. | 93 | % * AS RPCBPROC_CALLIT. | |
94 | % * | 94 | % * | |
95 | % * RPCBPROC_BCAST(rpcb_rmtcallargs) | 95 | % * RPCBPROC_BCAST(rpcb_rmtcallargs) | |
96 | % * RETURNS (rpcb_rmtcallres); | 96 | % * RETURNS (rpcb_rmtcallres); | |
97 | % * Calls the procedure on the remote machine. If it is not registered, | 97 | % * Calls the procedure on the remote machine. If it is not registered, | |
98 | % * this procedure IS quiet; i.e. it DOES NOT return error information!!! | 98 | % * this procedure IS quiet; i.e. it DOES NOT return error information!!! | |
99 | % * This routine should be used for broadcasting and nothing else. | 99 | % * This routine should be used for broadcasting and nothing else. | |
100 | % * | 100 | % * | |
101 | % * RPCBPROC_GETVERSADDR(rpcb) returns (string). | 101 | % * RPCBPROC_GETVERSADDR(rpcb) returns (string). | |
102 | % * 0 is failure. Otherwise returns the universal address where the | 102 | % * 0 is failure. Otherwise returns the universal address where the | |
103 | % * triple [prog, vers, netid] is registered. Ignore address and owner. | 103 | % * triple [prog, vers, netid] is registered. Ignore address and owner. | |
104 | % * Same as RPCBPROC_GETADDR except that if the given version number | 104 | % * Same as RPCBPROC_GETADDR except that if the given version number | |
105 | % * is not available, the address is not returned. | 105 | % * is not available, the address is not returned. | |
106 | % * | 106 | % * | |
107 | % * RPCBPROC_INDIRECT(rpcb_rmtcallargs) | 107 | % * RPCBPROC_INDIRECT(rpcb_rmtcallargs) | |
108 | % * RETURNS (rpcb_rmtcallres); | 108 | % * RETURNS (rpcb_rmtcallres); | |
109 | % * Calls the procedure on the remote machine. If it is not registered, | 109 | % * Calls the procedure on the remote machine. If it is not registered, | |
110 | % * this procedure is NOT quiet; i.e. it DOES return error information!!! | 110 | % * this procedure is NOT quiet; i.e. it DOES return error information!!! | |
111 | % * as any normal application would expect. | 111 | % * as any normal application would expect. | |
112 | % * | 112 | % * | |
113 | % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr). | 113 | % * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr). | |
114 | % * Same as RPCBPROC_GETADDR except that it returns a list of all the | 114 | % * Same as RPCBPROC_GETADDR except that it returns a list of all the | |
115 | % * addresses registered for the combination (prog, vers) (for all | 115 | % * addresses registered for the combination (prog, vers) (for all | |
116 | % * transports). | 116 | % * transports). | |
117 | % * | 117 | % * | |
118 | % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers) | 118 | % * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers) | |
119 | % * Returns the statistics about the kind of requests received by rpcbind. | 119 | % * Returns the statistics about the kind of requests received by rpcbind. | |
120 | % */ | 120 | % */ | |
121 | % | 121 | % | |
122 | %/* | 122 | %/* | |
123 | % * A mapping of (program, version, network ID) to address | 123 | % * A mapping of (program, version, network ID) to address | |
124 | % */ | 124 | % */ | |
125 | struct rpcb { | 125 | struct rpcb { | |
126 | rpcprog_t r_prog; /* program number */ | 126 | rpcprog_t r_prog; /* program number */ | |
127 | rpcvers_t r_vers; /* version number */ | 127 | rpcvers_t r_vers; /* version number */ | |
128 | string r_netid<>; /* network id */ | 128 | string r_netid<>; /* network id */ | |
129 | string r_addr<>; /* universal address */ | 129 | string r_addr<>; /* universal address */ | |
130 | string r_owner<>; /* owner of this service */ | 130 | string r_owner<>; /* owner of this service */ | |
131 | }; | 131 | }; | |
132 | #ifdef RPC_HDR | 132 | #ifdef RPC_HDR | |
133 | % | 133 | % | |
134 | %typedef rpcb RPCB; | 134 | %typedef rpcb RPCB; | |
135 | % | 135 | % | |
136 | #endif | 136 | #endif | |
137 | % | 137 | % | |
138 | %/* | 138 | %/* | |
139 | % * A list of mappings | 139 | % * A list of mappings | |
140 | % * | 140 | % * | |
141 | % * Below are two definitions for the rpcblist structure. This is done because | 141 | % * Below are two definitions for the rpcblist structure. This is done because | |
142 | % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a | 142 | % * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a | |
143 | % * struct rpcblist * that rpcgen would produce. One version of the rpcblist | 143 | % * struct rpcblist * that rpcgen would produce. One version of the rpcblist | |
144 | % * structure (actually called rp__list) is used with rpcgen, and the other is | 144 | % * structure (actually called rp__list) is used with rpcgen, and the other is | |
145 | % * defined only in the header file for compatibility with the specified | 145 | % * defined only in the header file for compatibility with the specified | |
146 | % * interface. | 146 | % * interface. | |
147 | % */ | 147 | % */ | |
148 | 148 | |||
149 | struct rp__list { | 149 | struct rp__list { | |
150 | rpcb rpcb_map; | 150 | rpcb rpcb_map; | |
151 | struct rp__list *rpcb_next; | 151 | struct rp__list *rpcb_next; | |
152 | }; | 152 | }; | |
153 | 153 | |||
154 | typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */ | 154 | typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */ | |
155 | 155 | |||
156 | #ifdef RPC_HDR | 156 | #ifdef RPC_HDR | |
157 | % | 157 | % | |
158 | %typedef struct rp__list rpcblist; | 158 | %typedef struct rp__list rpcblist; | |
159 | %typedef struct rp__list RPCBLIST; | 159 | %typedef struct rp__list RPCBLIST; | |
160 | % | 160 | % | |
161 | %#ifndef __cplusplus | 161 | %#ifndef __cplusplus | |
162 | %struct rpcblist { | 162 | %struct rpcblist { | |
163 | % RPCB rpcb_map; | 163 | % RPCB rpcb_map; | |
164 | % struct rpcblist *rpcb_next; | 164 | % struct rpcblist *rpcb_next; | |
165 | %}; | 165 | %}; | |
166 | %#endif | 166 | %#endif | |
167 | % | 167 | % | |
168 | %#ifdef __cplusplus | 168 | %#ifdef __cplusplus | |
169 | %extern "C" { | 169 | %extern "C" { | |
170 | %#endif | 170 | %#endif | |
171 | %#if __STDC__ | 171 | %#if __STDC__ | |
172 | %extern bool_t xdr_rpcblist(XDR *, rpcblist**); | 172 | %extern bool_t xdr_rpcblist(XDR *, rpcblist**); | |
173 | %#else /* K&R C */ | 173 | %#else /* K&R C */ | |
174 | %bool_t xdr_rpcblist(); | 174 | %bool_t xdr_rpcblist(); | |
175 | %#endif | 175 | %#endif | |
176 | %#ifdef __cplusplus | 176 | %#ifdef __cplusplus | |
177 | %} | 177 | %} | |
178 | %#endif | 178 | %#endif | |
179 | % | 179 | % | |
180 | #endif | 180 | #endif | |
181 | 181 | |||
182 | % | 182 | % | |
183 | %/* | 183 | %/* | |
184 | % * Arguments of remote calls | 184 | % * Arguments of remote calls | |
185 | % */ | 185 | % */ | |
186 | struct rpcb_rmtcallargs { | 186 | struct rpcb_rmtcallargs { | |
187 | rpcprog_t prog; /* program number */ | 187 | rpcprog_t prog; /* program number */ | |
188 | rpcvers_t vers; /* version number */ | 188 | rpcvers_t vers; /* version number */ | |
189 | rpcproc_t proc; /* procedure number */ | 189 | rpcproc_t proc; /* procedure number */ | |
190 | opaque args<>; /* argument */ | 190 | opaque args<>; /* argument */ | |
191 | }; | 191 | }; | |
192 | #ifdef RPC_HDR | 192 | #ifdef RPC_HDR | |
193 | % | 193 | % | |
194 | %/* | 194 | %/* | |
195 | % * Client-side only representation of rpcb_rmtcallargs structure. | 195 | % * Client-side only representation of rpcb_rmtcallargs structure. | |
196 | % * | 196 | % * | |
197 | % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the | 197 | % * The routine that XDRs the rpcb_rmtcallargs structure must deal with the | |
198 | % * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to | 198 | % * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to | |
199 | % * be passed the XDR routine that knows the args' structure. This routine | 199 | % * be passed the XDR routine that knows the args' structure. This routine | |
200 | % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since | 200 | % * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since | |
201 | % * the application being called already knows the args structure. So we use a | 201 | % * the application being called already knows the args structure. So we use a | |
202 | % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which | 202 | % * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which | |
203 | % * includes the args' XDR routine. | 203 | % * includes the args' XDR routine. | |
204 | % */ | 204 | % */ | |
205 | %struct r_rpcb_rmtcallargs { | 205 | %struct r_rpcb_rmtcallargs { | |
206 | % rpcprog_t prog; | 206 | % rpcprog_t prog; | |
207 | % rpcvers_t vers; | 207 | % rpcvers_t vers; | |
208 | % rpcproc_t proc; | 208 | % rpcproc_t proc; | |
209 | % struct { | 209 | % struct { | |
210 | % unsigned args_len; | 210 | % unsigned int args_len; | |
211 | % const char *args_val; | 211 | % const char *args_val; | |
212 | % } args; | 212 | % } args; | |
213 | % xdrproc_t xdr_args; /* encodes args */ | 213 | % xdrproc_t xdr_args; /* encodes args */ | |
214 | %}; | 214 | %}; | |
215 | % | 215 | % | |
216 | #endif /* def RPC_HDR */ | 216 | #endif /* def RPC_HDR */ | |
217 | % | 217 | % | |
218 | %/* | 218 | %/* | |
219 | % * Results of the remote call | 219 | % * Results of the remote call | |
220 | % */ | 220 | % */ | |
221 | struct rpcb_rmtcallres { | 221 | struct rpcb_rmtcallres { | |
222 | string addr<>; /* remote universal address */ | 222 | string addr<>; /* remote universal address */ | |
223 | opaque results<>; /* result */ | 223 | opaque results<>; /* result */ | |
224 | }; | 224 | }; | |
225 | #ifdef RPC_HDR | 225 | #ifdef RPC_HDR | |
226 | % | 226 | % | |
227 | %/* | 227 | %/* | |
228 | % * Client-side only representation of rpcb_rmtcallres structure. | 228 | % * Client-side only representation of rpcb_rmtcallres structure. | |
229 | % */ | 229 | % */ | |
230 | %struct r_rpcb_rmtcallres { | 230 | %struct r_rpcb_rmtcallres { | |
231 | % char *addr; | 231 | % char *addr; | |
232 | % struct { | 232 | % struct { | |
233 | % uint32_t results_len; | 233 | % uint32_t results_len; | |
234 | % char *results_val; | 234 | % char *results_val; | |
235 | % } results; | 235 | % } results; | |
236 | % xdrproc_t xdr_res; /* decodes results */ | 236 | % xdrproc_t xdr_res; /* decodes results */ | |
237 | %}; | 237 | %}; | |
238 | #endif /* RPC_HDR */ | 238 | #endif /* RPC_HDR */ | |
239 | % | 239 | % | |
240 | %/* | 240 | %/* | |
241 | % * rpcb_entry contains a merged address of a service on a particular | 241 | % * rpcb_entry contains a merged address of a service on a particular | |
242 | % * transport, plus associated netconfig information. A list of rpcb_entrys | 242 | % * transport, plus associated netconfig information. A list of rpcb_entrys | |
243 | % * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used | 243 | % * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used | |
244 | % * in r_nc_* fields. | 244 | % * in r_nc_* fields. | |
245 | % */ | 245 | % */ | |
246 | struct rpcb_entry { | 246 | struct rpcb_entry { | |
247 | string r_maddr<>; /* merged address of service */ | 247 | string r_maddr<>; /* merged address of service */ | |
248 | string r_nc_netid<>; /* netid field */ | 248 | string r_nc_netid<>; /* netid field */ | |
249 | unsigned int r_nc_semantics; /* semantics of transport */ | 249 | unsigned int r_nc_semantics; /* semantics of transport */ | |
250 | string r_nc_protofmly<>; /* protocol family */ | 250 | string r_nc_protofmly<>; /* protocol family */ | |
251 | string r_nc_proto<>; /* protocol name */ | 251 | string r_nc_proto<>; /* protocol name */ | |
252 | }; | 252 | }; | |
253 | % | 253 | % | |
254 | %/* | 254 | %/* | |
255 | % * A list of addresses supported by a service. | 255 | % * A list of addresses supported by a service. | |
256 | % */ | 256 | % */ | |
257 | struct rpcb_entry_list { | 257 | struct rpcb_entry_list { | |
258 | rpcb_entry rpcb_entry_map; | 258 | rpcb_entry rpcb_entry_map; | |
259 | struct rpcb_entry_list *rpcb_entry_next; | 259 | struct rpcb_entry_list *rpcb_entry_next; | |
260 | }; | 260 | }; | |
261 | 261 | |||
262 | typedef rpcb_entry_list *rpcb_entry_list_ptr; | 262 | typedef rpcb_entry_list *rpcb_entry_list_ptr; | |
263 | 263 | |||
264 | % | 264 | % | |
265 | %/* | 265 | %/* | |
266 | % * rpcbind statistics | 266 | % * rpcbind statistics | |
267 | % */ | 267 | % */ | |
268 | % | 268 | % | |
269 | const rpcb_highproc_2 = RPCBPROC_CALLIT; | 269 | const rpcb_highproc_2 = RPCBPROC_CALLIT; | |
270 | const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR; | 270 | const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR; | |
271 | const rpcb_highproc_4 = RPCBPROC_GETSTAT; | 271 | const rpcb_highproc_4 = RPCBPROC_GETSTAT; | |
272 | 272 | |||
273 | const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */ | 273 | const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */ | |
274 | const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */ | 274 | const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */ | |
275 | const RPCBVERS_4_STAT = 2; | 275 | const RPCBVERS_4_STAT = 2; | |
276 | const RPCBVERS_3_STAT = 1; | 276 | const RPCBVERS_3_STAT = 1; | |
277 | const RPCBVERS_2_STAT = 0; | 277 | const RPCBVERS_2_STAT = 0; | |
278 | % | 278 | % | |
279 | %/* Link list of all the stats about getport and getaddr */ | 279 | %/* Link list of all the stats about getport and getaddr */ | |
280 | struct rpcbs_addrlist { | 280 | struct rpcbs_addrlist { | |
281 | rpcprog_t prog; | 281 | rpcprog_t prog; | |
282 | rpcvers_t vers; | 282 | rpcvers_t vers; | |
283 | int success; | 283 | int success; | |
284 | int failure; | 284 | int failure; | |
285 | string netid<>; | 285 | string netid<>; | |
286 | struct rpcbs_addrlist *next; | 286 | struct rpcbs_addrlist *next; | |
287 | }; | 287 | }; | |
288 | % | 288 | % | |
289 | %/* Link list of all the stats about rmtcall */ | 289 | %/* Link list of all the stats about rmtcall */ | |
290 | struct rpcbs_rmtcalllist { | 290 | struct rpcbs_rmtcalllist { | |
291 | rpcprog_t prog; | 291 | rpcprog_t prog; | |
292 | rpcvers_t vers; | 292 | rpcvers_t vers; | |
293 | rpcproc_t proc; | 293 | rpcproc_t proc; | |
294 | int success; | 294 | int success; | |
295 | int failure; | 295 | int failure; | |
296 | int indirect; /* whether callit or indirect */ | 296 | int indirect; /* whether callit or indirect */ | |
297 | string netid<>; | 297 | string netid<>; | |
298 | struct rpcbs_rmtcalllist *next; | 298 | struct rpcbs_rmtcalllist *next; | |
299 | }; | 299 | }; | |
300 | 300 | |||
301 | typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; | 301 | typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; | |
302 | typedef rpcbs_addrlist *rpcbs_addrlist_ptr; | 302 | typedef rpcbs_addrlist *rpcbs_addrlist_ptr; | |
303 | typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; | 303 | typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; | |
304 | 304 | |||
305 | struct rpcb_stat { | 305 | struct rpcb_stat { | |
306 | rpcbs_proc info; | 306 | rpcbs_proc info; | |
307 | int setinfo; | 307 | int setinfo; | |
308 | int unsetinfo; | 308 | int unsetinfo; | |
309 | rpcbs_addrlist_ptr addrinfo; | 309 | rpcbs_addrlist_ptr addrinfo; | |
310 | rpcbs_rmtcalllist_ptr rmtinfo; | 310 | rpcbs_rmtcalllist_ptr rmtinfo; | |
311 | }; | 311 | }; | |
312 | % | 312 | % | |
313 | %/* | 313 | %/* | |
314 | % * One rpcb_stat structure is returned for each version of rpcbind | 314 | % * One rpcb_stat structure is returned for each version of rpcbind | |
315 | % * being monitored. | 315 | % * being monitored. | |
316 | % */ | 316 | % */ | |
317 | 317 | |||
318 | typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; | 318 | typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; | |
319 | 319 | |||
320 | #ifdef RPC_HDR | 320 | #ifdef RPC_HDR | |
321 | % | 321 | % | |
322 | %/* | 322 | %/* | |
323 | % * We don't define netbuf in RPCL, since it would contain structure member | 323 | % * We don't define netbuf in RPCL, since it would contain structure member | |
324 | % * names that would conflict with the definition of struct netbuf in | 324 | % * names that would conflict with the definition of struct netbuf in | |
325 | % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here, | 325 | % * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here, | |
326 | % * and implement it ourselves in rpc/rpcb_prot.c. | 326 | % * and implement it ourselves in rpc/rpcb_prot.c. | |
327 | % */ | 327 | % */ | |
328 | %#ifdef __cplusplus | 328 | %#ifdef __cplusplus | |
329 | %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); | 329 | %extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *); | |
330 | % | 330 | % | |
331 | %#elif __STDC__ | 331 | %#elif __STDC__ | |
332 | %extern bool_t xdr_netbuf(XDR *, struct netbuf *); | 332 | %extern bool_t xdr_netbuf(XDR *, struct netbuf *); | |
333 | % | 333 | % | |
334 | %#else /* K&R C */ | 334 | %#else /* K&R C */ | |
335 | %bool_t xdr_netbuf(); | 335 | %bool_t xdr_netbuf(); | |
336 | % | 336 | % | |
337 | %#endif /* K&R C*/ | 337 | %#endif /* K&R C*/ | |
338 | #endif /* def RPC_HDR */ | 338 | #endif /* def RPC_HDR */ | |
339 | 339 | |||
340 | /* | 340 | /* | |
341 | * rpcbind procedures | 341 | * rpcbind procedures | |
342 | */ | 342 | */ | |
343 | program RPCBPROG { | 343 | program RPCBPROG { | |
344 | version RPCBVERS { | 344 | version RPCBVERS { | |
345 | bool | 345 | bool | |
346 | RPCBPROC_SET(rpcb) = 1; | 346 | RPCBPROC_SET(rpcb) = 1; | |
347 | 347 | |||
348 | bool | 348 | bool | |
349 | RPCBPROC_UNSET(rpcb) = 2; | 349 | RPCBPROC_UNSET(rpcb) = 2; | |
350 | 350 | |||
351 | string | 351 | string | |
352 | RPCBPROC_GETADDR(rpcb) = 3; | 352 | RPCBPROC_GETADDR(rpcb) = 3; | |
353 | 353 | |||
354 | rpcblist_ptr | 354 | rpcblist_ptr | |
355 | RPCBPROC_DUMP(void) = 4; | 355 | RPCBPROC_DUMP(void) = 4; | |
356 | 356 | |||
357 | rpcb_rmtcallres | 357 | rpcb_rmtcallres | |
358 | RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5; | 358 | RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5; | |
359 | 359 | |||
360 | unsigned int | 360 | unsigned int | |
361 | RPCBPROC_GETTIME(void) = 6; | 361 | RPCBPROC_GETTIME(void) = 6; | |
362 | 362 | |||
363 | struct netbuf | 363 | struct netbuf | |
364 | RPCBPROC_UADDR2TADDR(string) = 7; | 364 | RPCBPROC_UADDR2TADDR(string) = 7; | |
365 | 365 | |||
366 | string | 366 | string | |
367 | RPCBPROC_TADDR2UADDR(struct netbuf) = 8; | 367 | RPCBPROC_TADDR2UADDR(struct netbuf) = 8; | |
368 | } = 3; | 368 | } = 3; | |
369 | 369 | |||
370 | version RPCBVERS4 { | 370 | version RPCBVERS4 { | |
371 | bool | 371 | bool | |
372 | RPCBPROC_SET(rpcb) = 1; | 372 | RPCBPROC_SET(rpcb) = 1; | |
373 | 373 | |||
374 | bool | 374 | bool | |
375 | RPCBPROC_UNSET(rpcb) = 2; | 375 | RPCBPROC_UNSET(rpcb) = 2; | |
376 | 376 | |||
377 | string | 377 | string | |
378 | RPCBPROC_GETADDR(rpcb) = 3; | 378 | RPCBPROC_GETADDR(rpcb) = 3; | |
379 | 379 | |||
380 | rpcblist_ptr | 380 | rpcblist_ptr | |
381 | RPCBPROC_DUMP(void) = 4; | 381 | RPCBPROC_DUMP(void) = 4; | |
382 | 382 | |||
383 | /* | 383 | /* | |
384 | * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT; | 384 | * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT; | |
385 | * the new name is intended to indicate that this | 385 | * the new name is intended to indicate that this | |
386 | * procedure should be used for broadcast RPC, and | 386 | * procedure should be used for broadcast RPC, and | |
387 | * RPCBPROC_INDIRECT should be used for indirect calls. | 387 | * RPCBPROC_INDIRECT should be used for indirect calls. | |
388 | */ | 388 | */ | |
389 | rpcb_rmtcallres | 389 | rpcb_rmtcallres | |
390 | RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT; | 390 | RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT; | |
391 | 391 | |||
392 | unsigned int | 392 | unsigned int | |
393 | RPCBPROC_GETTIME(void) = 6; | 393 | RPCBPROC_GETTIME(void) = 6; | |
394 | 394 | |||
395 | struct netbuf | 395 | struct netbuf | |
396 | RPCBPROC_UADDR2TADDR(string) = 7; | 396 | RPCBPROC_UADDR2TADDR(string) = 7; | |
397 | 397 | |||
398 | string | 398 | string | |
399 | RPCBPROC_TADDR2UADDR(struct netbuf) = 8; | 399 | RPCBPROC_TADDR2UADDR(struct netbuf) = 8; | |
400 | 400 | |||
401 | string | 401 | string | |
402 | RPCBPROC_GETVERSADDR(rpcb) = 9; | 402 | RPCBPROC_GETVERSADDR(rpcb) = 9; | |
403 | 403 | |||
404 | rpcb_rmtcallres | 404 | rpcb_rmtcallres | |
405 | RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10; | 405 | RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10; | |
406 | 406 | |||
407 | rpcb_entry_list_ptr | 407 | rpcb_entry_list_ptr | |
408 | RPCBPROC_GETADDRLIST(rpcb) = 11; | 408 | RPCBPROC_GETADDRLIST(rpcb) = 11; | |
409 | 409 | |||
410 | rpcb_stat_byvers | 410 | rpcb_stat_byvers | |
411 | RPCBPROC_GETSTAT(void) = 12; | 411 | RPCBPROC_GETSTAT(void) = 12; | |
412 | } = 4; | 412 | } = 4; | |
413 | } = 100000; | 413 | } = 100000; | |
414 | #ifdef RPC_HDR | 414 | #ifdef RPC_HDR | |
415 | % | 415 | % | |
416 | %#define RPCBVERS_3 RPCBVERS | 416 | %#define RPCBVERS_3 RPCBVERS | |
417 | %#define RPCBVERS_4 RPCBVERS4 | 417 | %#define RPCBVERS_4 RPCBVERS4 | |
418 | % | 418 | % | |
419 | %#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock" | 419 | %#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock" | |
420 | % | 420 | % | |
421 | %#else /* ifndef _KERNEL */ | 421 | %#else /* ifndef _KERNEL */ | |
422 | %#ifdef __cplusplus | 422 | %#ifdef __cplusplus | |
423 | %extern "C" { | 423 | %extern "C" { | |
424 | %#endif | 424 | %#endif | |
425 | % | 425 | % | |
426 | %/* | 426 | %/* | |
427 | % * A mapping of (program, version, network ID) to address | 427 | % * A mapping of (program, version, network ID) to address | |
428 | % */ | 428 | % */ | |
429 | %struct rpcb { | 429 | %struct rpcb { | |
430 | % rpcprog_t r_prog; /* program number */ | 430 | % rpcprog_t r_prog; /* program number */ | |
431 | % rpcvers_t r_vers; /* version number */ | 431 | % rpcvers_t r_vers; /* version number */ | |
432 | % char *r_netid; /* network id */ | 432 | % char *r_netid; /* network id */ | |
433 | % char *r_addr; /* universal address */ | 433 | % char *r_addr; /* universal address */ | |
434 | % char *r_owner; /* owner of the mapping */ | 434 | % char *r_owner; /* owner of the mapping */ | |
435 | %}; | 435 | %}; | |
436 | %typedef struct rpcb RPCB; | 436 | %typedef struct rpcb RPCB; | |
437 | % | 437 | % | |
438 | %/* | 438 | %/* | |
439 | % * A list of mappings | 439 | % * A list of mappings | |
440 | % */ | 440 | % */ | |
441 | %struct rpcblist { | 441 | %struct rpcblist { | |
442 | % RPCB rpcb_map; | 442 | % RPCB rpcb_map; | |
443 | % struct rpcblist *rpcb_next; | 443 | % struct rpcblist *rpcb_next; | |
444 | %}; | 444 | %}; | |
445 | %typedef struct rpcblist RPCBLIST; | 445 | %typedef struct rpcblist RPCBLIST; | |
446 | %typedef struct rpcblist *rpcblist_ptr; | 446 | %typedef struct rpcblist *rpcblist_ptr; | |
447 | % | 447 | % | |
448 | %/* | 448 | %/* | |
449 | % * Remote calls arguments | 449 | % * Remote calls arguments | |
450 | % */ | 450 | % */ | |
451 | %struct rpcb_rmtcallargs { | 451 | %struct rpcb_rmtcallargs { | |
452 | % rpcprog_t prog; /* program number */ | 452 | % rpcprog_t prog; /* program number */ | |
453 | % rpcvers_t vers; /* version number */ | 453 | % rpcvers_t vers; /* version number */ | |
454 | % rpcproc_t proc; /* procedure number */ | 454 | % rpcproc_t proc; /* procedure number */ | |
455 | % uint32_t arglen; /* arg len */ | 455 | % uint32_t arglen; /* arg len */ | |
456 | % caddr_t args_ptr; /* argument */ | 456 | % caddr_t args_ptr; /* argument */ | |
457 | % xdrproc_t xdr_args; /* XDR routine for argument */ | 457 | % xdrproc_t xdr_args; /* XDR routine for argument */ | |
458 | %}; | 458 | %}; | |
459 | %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; | 459 | %typedef struct rpcb_rmtcallargs rpcb_rmtcallargs; | |
460 | % | 460 | % | |
461 | %/* | 461 | %/* | |
462 | % * Remote calls results | 462 | % * Remote calls results | |
463 | % */ | 463 | % */ | |
464 | %struct rpcb_rmtcallres { | 464 | %struct rpcb_rmtcallres { | |
465 | % char *addr_ptr; /* remote universal address */ | 465 | % char *addr_ptr; /* remote universal address */ | |
466 | % uint32_t resultslen; /* results length */ | 466 | % uint32_t resultslen; /* results length */ | |
467 | % caddr_t results_ptr; /* results */ | 467 | % caddr_t results_ptr; /* results */ | |
468 | % xdrproc_t xdr_results; /* XDR routine for result */ | 468 | % xdrproc_t xdr_results; /* XDR routine for result */ | |
469 | %}; | 469 | %}; | |
470 | %typedef struct rpcb_rmtcallres rpcb_rmtcallres; | 470 | %typedef struct rpcb_rmtcallres rpcb_rmtcallres; | |
471 | % | 471 | % | |
472 | %struct rpcb_entry { | 472 | %struct rpcb_entry { | |
473 | % char *r_maddr; | 473 | % char *r_maddr; | |
474 | % char *r_nc_netid; | 474 | % char *r_nc_netid; | |
475 | % unsigned int r_nc_semantics; | 475 | % unsigned int r_nc_semantics; | |
476 | % char *r_nc_protofmly; | 476 | % char *r_nc_protofmly; | |
477 | % char *r_nc_proto; | 477 | % char *r_nc_proto; | |
478 | %}; | 478 | %}; | |
479 | %typedef struct rpcb_entry rpcb_entry; | 479 | %typedef struct rpcb_entry rpcb_entry; | |
480 | % | 480 | % | |
481 | %/* | 481 | %/* | |
482 | % * A list of addresses supported by a service. | 482 | % * A list of addresses supported by a service. | |
483 | % */ | 483 | % */ | |
484 | % | 484 | % | |
485 | %struct rpcb_entry_list { | 485 | %struct rpcb_entry_list { | |
486 | % rpcb_entry rpcb_entry_map; | 486 | % rpcb_entry rpcb_entry_map; | |
487 | % struct rpcb_entry_list *rpcb_entry_next; | 487 | % struct rpcb_entry_list *rpcb_entry_next; | |
488 | %}; | 488 | %}; | |
489 | %typedef struct rpcb_entry_list rpcb_entry_list; | 489 | %typedef struct rpcb_entry_list rpcb_entry_list; | |
490 | % | 490 | % | |
491 | %typedef rpcb_entry_list *rpcb_entry_list_ptr; | 491 | %typedef rpcb_entry_list *rpcb_entry_list_ptr; | |
492 | % | 492 | % | |
493 | %/* | 493 | %/* | |
494 | % * rpcbind statistics | 494 | % * rpcbind statistics | |
495 | % */ | 495 | % */ | |
496 | % | 496 | % | |
497 | %#define rpcb_highproc_2 RPCBPROC_CALLIT | 497 | %#define rpcb_highproc_2 RPCBPROC_CALLIT | |
498 | %#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR | 498 | %#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR | |
499 | %#define rpcb_highproc_4 RPCBPROC_GETSTAT | 499 | %#define rpcb_highproc_4 RPCBPROC_GETSTAT | |
500 | %#define RPCBSTAT_HIGHPROC 13 | 500 | %#define RPCBSTAT_HIGHPROC 13 | |
501 | %#define RPCBVERS_STAT 3 | 501 | %#define RPCBVERS_STAT 3 | |
502 | %#define RPCBVERS_4_STAT 2 | 502 | %#define RPCBVERS_4_STAT 2 | |
503 | %#define RPCBVERS_3_STAT 1 | 503 | %#define RPCBVERS_3_STAT 1 | |
504 | %#define RPCBVERS_2_STAT 0 | 504 | %#define RPCBVERS_2_STAT 0 | |
505 | % | 505 | % | |
506 | %/* Link list of all the stats about getport and getaddr */ | 506 | %/* Link list of all the stats about getport and getaddr */ | |
507 | % | 507 | % | |
508 | %struct rpcbs_addrlist { | 508 | %struct rpcbs_addrlist { | |
509 | % rpcprog_t prog; | 509 | % rpcprog_t prog; | |
510 | % rpcvers_t vers; | 510 | % rpcvers_t vers; | |
511 | % int success; | 511 | % int success; | |
512 | % int failure; | 512 | % int failure; | |
513 | % char *netid; | 513 | % char *netid; | |
514 | % struct rpcbs_addrlist *next; | 514 | % struct rpcbs_addrlist *next; | |
515 | %}; | 515 | %}; | |
516 | %typedef struct rpcbs_addrlist rpcbs_addrlist; | 516 | %typedef struct rpcbs_addrlist rpcbs_addrlist; | |
517 | % | 517 | % | |
518 | %/* Link list of all the stats about rmtcall */ | 518 | %/* Link list of all the stats about rmtcall */ | |
519 | % | 519 | % | |
520 | %struct rpcbs_rmtcalllist { | 520 | %struct rpcbs_rmtcalllist { | |
521 | % rpcprog_t prog; | 521 | % rpcprog_t prog; | |
522 | % rpcvers_t vers; | 522 | % rpcvers_t vers; | |
523 | % rpcproc_t proc; | 523 | % rpcproc_t proc; | |
524 | % int success; | 524 | % int success; | |
525 | % int failure; | 525 | % int failure; | |
526 | % int indirect; | 526 | % int indirect; | |
527 | % char *netid; | 527 | % char *netid; | |
528 | % struct rpcbs_rmtcalllist *next; | 528 | % struct rpcbs_rmtcalllist *next; | |
529 | %}; | 529 | %}; | |
530 | %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; | 530 | %typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist; | |
531 | % | 531 | % | |
532 | %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; | 532 | %typedef int rpcbs_proc[RPCBSTAT_HIGHPROC]; | |
533 | % | 533 | % | |
534 | %typedef rpcbs_addrlist *rpcbs_addrlist_ptr; | 534 | %typedef rpcbs_addrlist *rpcbs_addrlist_ptr; | |
535 | % | 535 | % | |
536 | %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; | 536 | %typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr; | |
537 | % | 537 | % | |
538 | %struct rpcb_stat { | 538 | %struct rpcb_stat { | |
539 | % rpcbs_proc info; | 539 | % rpcbs_proc info; | |
540 | % int setinfo; | 540 | % int setinfo; | |
541 | % int unsetinfo; | 541 | % int unsetinfo; | |
542 | % rpcbs_addrlist_ptr addrinfo; | 542 | % rpcbs_addrlist_ptr addrinfo; | |
543 | % rpcbs_rmtcalllist_ptr rmtinfo; | 543 | % rpcbs_rmtcalllist_ptr rmtinfo; | |
544 | %}; | 544 | %}; | |
545 | %typedef struct rpcb_stat rpcb_stat; | 545 | %typedef struct rpcb_stat rpcb_stat; | |
546 | % | 546 | % | |
547 | %/* | 547 | %/* | |
548 | % * One rpcb_stat structure is returned for each version of rpcbind | 548 | % * One rpcb_stat structure is returned for each version of rpcbind | |
549 | % * being monitored. | 549 | % * being monitored. | |
550 | % */ | 550 | % */ | |
551 | % | 551 | % | |
552 | %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; | 552 | %typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT]; | |
553 | % | 553 | % | |
554 | %#ifdef __cplusplus | 554 | %#ifdef __cplusplus | |
555 | %} | 555 | %} | |
556 | %#endif | 556 | %#endif | |
557 | % | 557 | % | |
558 | %#endif /* ifndef _KERNEL */ | 558 | %#endif /* ifndef _KERNEL */ | |
559 | #endif /* RPC_HDR */ | 559 | #endif /* RPC_HDR */ |
--- src/include/rpc/svc.h 2016/01/23 01:05:30 1.30
+++ src/include/rpc/svc.h 2016/01/23 02:34:09 1.31
@@ -1,446 +1,449 @@ | @@ -1,446 +1,449 @@ | |||
1 | /* $NetBSD: svc.h,v 1.30 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: svc.h,v 1.31 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)svc.h 1.35 88/12/17 SMI | 31 | * from: @(#)svc.h 1.35 88/12/17 SMI | |
32 | * @(#)svc.h 1.27 94/04/25 SMI | 32 | * @(#)svc.h 1.27 94/04/25 SMI | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * svc.h, Server-side remote procedure call interface. | 36 | * svc.h, Server-side remote procedure call interface. | |
37 | * | 37 | * | |
38 | * Copyright (C) 1986-1993 by Sun Microsystems, Inc. | 38 | * Copyright (C) 1986-1993 by Sun Microsystems, Inc. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #ifndef _RPC_SVC_H_ | 41 | #ifndef _RPC_SVC_H_ | |
42 | #define _RPC_SVC_H_ | 42 | #define _RPC_SVC_H_ | |
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | 44 | |||
45 | #include <rpc/rpc_com.h> | 45 | #include <rpc/rpc_com.h> | |
46 | 46 | |||
47 | /* | 47 | /* | |
48 | * This interface must manage two items concerning remote procedure calling: | 48 | * This interface must manage two items concerning remote procedure calling: | |
49 | * | 49 | * | |
50 | * 1) An arbitrary number of transport connections upon which rpc requests | 50 | * 1) An arbitrary number of transport connections upon which rpc requests | |
51 | * are received. The two most notable transports are TCP and UDP; they are | 51 | * are received. The two most notable transports are TCP and UDP; they are | |
52 | * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; | 52 | * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; | |
53 | * they in turn call xprt_register and xprt_unregister. | 53 | * they in turn call xprt_register and xprt_unregister. | |
54 | * | 54 | * | |
55 | * 2) An arbitrary number of locally registered services. Services are | 55 | * 2) An arbitrary number of locally registered services. Services are | |
56 | * described by the following four data: program number, version number, | 56 | * described by the following four data: program number, version number, | |
57 | * "service dispatch" function, a transport handle, and a boolean that | 57 | * "service dispatch" function, a transport handle, and a boolean that | |
58 | * indicates whether or not the exported program should be registered with a | 58 | * indicates whether or not the exported program should be registered with a | |
59 | * local binder service; if true the program's number and version and the | 59 | * local binder service; if true the program's number and version and the | |
60 | * port number from the transport handle are registered with the binder. | 60 | * port number from the transport handle are registered with the binder. | |
61 | * These data are registered with the rpc svc system via svc_register. | 61 | * These data are registered with the rpc svc system via svc_register. | |
62 | * | 62 | * | |
63 | * A service's dispatch function is called whenever an rpc request comes in | 63 | * A service's dispatch function is called whenever an rpc request comes in | |
64 | * on a transport. The request's program and version numbers must match | 64 | * on a transport. The request's program and version numbers must match | |
65 | * those of the registered service. The dispatch function is passed two | 65 | * those of the registered service. The dispatch function is passed two | |
66 | * parameters, struct svc_req * and SVCXPRT *, defined below. | 66 | * parameters, struct svc_req * and SVCXPRT *, defined below. | |
67 | */ | 67 | */ | |
68 | 68 | |||
69 | /* | 69 | /* | |
70 | * Service control requests | 70 | * Service control requests | |
71 | */ | 71 | */ | |
72 | #define SVCGET_VERSQUIET 1 | 72 | #define SVCGET_VERSQUIET 1 | |
73 | #define SVCSET_VERSQUIET 2 | 73 | #define SVCSET_VERSQUIET 2 | |
74 | #define SVCGET_CONNMAXREC 3 | 74 | #define SVCGET_CONNMAXREC 3 | |
75 | #define SVCSET_CONNMAXREC 4 | 75 | #define SVCSET_CONNMAXREC 4 | |
76 | 76 | |||
77 | 77 | |||
78 | enum xprt_stat { | 78 | enum xprt_stat { | |
79 | XPRT_DIED, | 79 | XPRT_DIED, | |
80 | XPRT_MOREREQS, | 80 | XPRT_MOREREQS, | |
81 | XPRT_IDLE | 81 | XPRT_IDLE | |
82 | }; | 82 | }; | |
83 | 83 | |||
84 | /* | 84 | /* | |
85 | * Server side transport handle | 85 | * Server side transport handle | |
86 | */ | 86 | */ | |
87 | typedef struct __rpc_svcxprt { | 87 | typedef struct __rpc_svcxprt { | |
88 | int xp_fd; | 88 | int xp_fd; | |
89 | unsigned short xp_port; /* associated port number */ | 89 | unsigned short xp_port; /* associated port number */ | |
90 | const struct xp_ops { | 90 | const struct xp_ops { | |
91 | /* receive incomming requests */ | 91 | /* receive incomming requests */ | |
92 | bool_t (*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *); | 92 | bool_t (*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *); | |
93 | /* get transport status */ | 93 | /* get transport status */ | |
94 | enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *); | 94 | enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *); | |
95 | /* get arguments */ | 95 | /* get arguments */ | |
96 | bool_t (*xp_getargs)(struct __rpc_svcxprt *, xdrproc_t, | 96 | bool_t (*xp_getargs)(struct __rpc_svcxprt *, xdrproc_t, | |
97 | caddr_t); | 97 | caddr_t); | |
98 | /* send reply */ | 98 | /* send reply */ | |
99 | bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *); | 99 | bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *); | |
100 | /* free mem allocated for args */ | 100 | /* free mem allocated for args */ | |
101 | bool_t (*xp_freeargs)(struct __rpc_svcxprt *, xdrproc_t, | 101 | bool_t (*xp_freeargs)(struct __rpc_svcxprt *, xdrproc_t, | |
102 | caddr_t); | 102 | caddr_t); | |
103 | /* destroy this struct */ | 103 | /* destroy this struct */ | |
104 | void (*xp_destroy)(struct __rpc_svcxprt *); | 104 | void (*xp_destroy)(struct __rpc_svcxprt *); | |
105 | } *xp_ops; | 105 | } *xp_ops; | |
106 | int xp_addrlen; /* length of remote address */ | 106 | int xp_addrlen; /* length of remote address */ | |
107 | struct sockaddr_in xp_raddr; /* rem. addr. (backward ABI compat) */ | 107 | struct sockaddr_in xp_raddr; /* rem. addr. (backward ABI compat) */ | |
108 | /* XXX - fvdl stick this here for ABI backward compat reasons */ | 108 | /* XXX - fvdl stick this here for ABI backward compat reasons */ | |
109 | const struct xp_ops2 { | 109 | const struct xp_ops2 { | |
110 | /* catch-all function */ | 110 | /* catch-all function */ | |
111 | bool_t (*xp_control)(struct __rpc_svcxprt *, const unsigned, | 111 | bool_t (*xp_control)(struct __rpc_svcxprt *, | |
112 | void *); | 112 | const unsigned int, void *); | |
113 | } *xp_ops2; | 113 | } *xp_ops2; | |
114 | char *xp_tp; /* transport provider device name */ | 114 | char *xp_tp; /* transport provider device name */ | |
115 | char *xp_netid; /* network token */ | 115 | char *xp_netid; /* network token */ | |
116 | struct netbuf xp_ltaddr; /* local transport address */ | 116 | struct netbuf xp_ltaddr; /* local transport address */ | |
117 | struct netbuf xp_rtaddr; /* remote transport address */ | 117 | struct netbuf xp_rtaddr; /* remote transport address */ | |
118 | struct opaque_auth xp_verf; /* raw response verifier */ | 118 | struct opaque_auth xp_verf; /* raw response verifier */ | |
119 | void *xp_p1; /* private: for use by svc ops */ | 119 | void *xp_p1; /* private: for use by svc ops */ | |
120 | void *xp_p2; /* private: for use by svc ops */ | 120 | void *xp_p2; /* private: for use by svc ops */ | |
121 | void *xp_p3; /* private: for use by svc lib */ | 121 | void *xp_p3; /* private: for use by svc lib */ | |
122 | int xp_type; /* transport type */ | 122 | int xp_type; /* transport type */ | |
123 | } SVCXPRT; | 123 | } SVCXPRT; | |
124 | 124 | |||
125 | /* | 125 | /* | |
126 | * Service request | 126 | * Service request | |
127 | */ | 127 | */ | |
128 | struct svc_req { | 128 | struct svc_req { | |
129 | uint32_t rq_prog; /* service program number */ | 129 | uint32_t rq_prog; /* service program number */ | |
130 | uint32_t rq_vers; /* service protocol version */ | 130 | uint32_t rq_vers; /* service protocol version */ | |
131 | uint32_t rq_proc; /* the desired procedure */ | 131 | uint32_t rq_proc; /* the desired procedure */ | |
132 | struct opaque_auth rq_cred; /* raw creds from the wire */ | 132 | struct opaque_auth rq_cred; /* raw creds from the wire */ | |
133 | void *rq_clntcred; /* read only cooked cred */ | 133 | void *rq_clntcred; /* read only cooked cred */ | |
134 | SVCXPRT *rq_xprt; /* associated transport */ | 134 | SVCXPRT *rq_xprt; /* associated transport */ | |
135 | }; | 135 | }; | |
136 | 136 | |||
137 | /* | 137 | /* | |
138 | * Approved way of getting address of caller | 138 | * Approved way of getting address of caller | |
139 | */ | 139 | */ | |
140 | #define svc_getrpccaller(x) (&(x)->xp_rtaddr) | 140 | #define svc_getrpccaller(x) (&(x)->xp_rtaddr) | |
141 | 141 | |||
142 | /* | 142 | /* | |
143 | * NetBSD-only definition to get the creds of the caller (AF_LOCAL). | 143 | * NetBSD-only definition to get the creds of the caller (AF_LOCAL). | |
144 | */ | 144 | */ | |
145 | #define __svc_getcallercreds(x) ((struct sockcred *)(x)->xp_p2) | 145 | #define __svc_getcallercreds(x) ((struct sockcred *)(x)->xp_p2) | |
146 | 146 | |||
147 | /* | 147 | /* | |
148 | * Operations defined on an SVCXPRT handle | 148 | * Operations defined on an SVCXPRT handle | |
149 | * | 149 | * | |
150 | * SVCXPRT *xprt; | 150 | * SVCXPRT *xprt; | |
151 | * struct rpc_msg *msg; | 151 | * struct rpc_msg *msg; | |
152 | * xdrproc_t xargs; | 152 | * xdrproc_t xargs; | |
153 | * caddr_t argsp; | 153 | * caddr_t argsp; | |
154 | */ | 154 | */ | |
155 | #define SVC_RECV(xprt, msg) \ | 155 | #define SVC_RECV(xprt, msg) \ | |
156 | (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) | 156 | (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) | |
157 | #define svc_recv(xprt, msg) \ | 157 | #define svc_recv(xprt, msg) \ | |
158 | (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) | 158 | (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) | |
159 | 159 | |||
160 | #define SVC_STAT(xprt) \ | 160 | #define SVC_STAT(xprt) \ | |
161 | (*(xprt)->xp_ops->xp_stat)(xprt) | 161 | (*(xprt)->xp_ops->xp_stat)(xprt) | |
162 | #define svc_stat(xprt) \ | 162 | #define svc_stat(xprt) \ | |
163 | (*(xprt)->xp_ops->xp_stat)(xprt) | 163 | (*(xprt)->xp_ops->xp_stat)(xprt) | |
164 | 164 | |||
165 | #define SVC_GETARGS(xprt, xargs, argsp) \ | 165 | #define SVC_GETARGS(xprt, xargs, argsp) \ | |
166 | (*(xprt)->xp_ops->xp_getargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | 166 | (*(xprt)->xp_ops->xp_getargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | |
167 | #define svc_getargs(xprt, xargs, argsp) \ | 167 | #define svc_getargs(xprt, xargs, argsp) \ | |
168 | (*(xprt)->xp_ops->xp_getargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | 168 | (*(xprt)->xp_ops->xp_getargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | |
169 | 169 | |||
170 | #define SVC_REPLY(xprt, msg) \ | 170 | #define SVC_REPLY(xprt, msg) \ | |
171 | (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) | 171 | (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) | |
172 | #define svc_reply(xprt, msg) \ | 172 | #define svc_reply(xprt, msg) \ | |
173 | (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) | 173 | (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) | |
174 | 174 | |||
175 | #define SVC_FREEARGS(xprt, xargs, argsp) \ | 175 | #define SVC_FREEARGS(xprt, xargs, argsp) \ | |
176 | (*(xprt)->xp_ops->xp_freeargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | 176 | (*(xprt)->xp_ops->xp_freeargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | |
177 | #define svc_freeargs(xprt, xargs, argsp) \ | 177 | #define svc_freeargs(xprt, xargs, argsp) \ | |
178 | (*(xprt)->xp_ops->xp_freeargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | 178 | (*(xprt)->xp_ops->xp_freeargs)((xprt), ((xdrproc_t)(xargs)), (argsp)) | |
179 | 179 | |||
180 | #define SVC_DESTROY(xprt) \ | 180 | #define SVC_DESTROY(xprt) \ | |
181 | (*(xprt)->xp_ops->xp_destroy)(xprt) | 181 | (*(xprt)->xp_ops->xp_destroy)(xprt) | |
182 | #define svc_destroy(xprt) \ | 182 | #define svc_destroy(xprt) \ | |
183 | (*(xprt)->xp_ops->xp_destroy)(xprt) | 183 | (*(xprt)->xp_ops->xp_destroy)(xprt) | |
184 | 184 | |||
185 | #define SVC_CONTROL(xprt, rq, in) \ | 185 | #define SVC_CONTROL(xprt, rq, in) \ | |
186 | (*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in)) | 186 | (*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in)) | |
187 | 187 | |||
188 | /* | 188 | /* | |
189 | * Service registration | 189 | * Service registration | |
190 | * | 190 | * | |
191 | * svc_reg(xprt, prog, vers, dispatch, nconf) | 191 | * svc_reg(xprt, prog, vers, dispatch, nconf) | |
192 | * const SVCXPRT *xprt; | 192 | * const SVCXPRT *xprt; | |
193 | * const rpcprog_t prog; | 193 | * const rpcprog_t prog; | |
194 | * const rpcvers_t vers; | 194 | * const rpcvers_t vers; | |
195 | * const void (*dispatch)(...); | 195 | * const void (*dispatch)(...); | |
196 | * const struct netconfig *nconf; | 196 | * const struct netconfig *nconf; | |
197 | */ | 197 | */ | |
198 | 198 | |||
199 | __BEGIN_DECLS | 199 | __BEGIN_DECLS | |
200 | extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t, | 200 | extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t, | |
201 | void (*)(struct svc_req *, SVCXPRT *), | 201 | void (*)(struct svc_req *, SVCXPRT *), | |
202 | const struct netconfig *); | 202 | const struct netconfig *); | |
203 | __END_DECLS | 203 | __END_DECLS | |
204 | 204 | |||
205 | /* | 205 | /* | |
206 | * Service un-registration | 206 | * Service un-registration | |
207 | * | 207 | * | |
208 | * svc_unreg(prog, vers) | 208 | * svc_unreg(prog, vers) | |
209 | * const rpcprog_t prog; | 209 | * const rpcprog_t prog; | |
210 | * const rpcvers_t vers; | 210 | * const rpcvers_t vers; | |
211 | */ | 211 | */ | |
212 | 212 | |||
213 | __BEGIN_DECLS | 213 | __BEGIN_DECLS | |
214 | extern void svc_unreg(const rpcprog_t, const rpcvers_t); | 214 | extern void svc_unreg(const rpcprog_t, const rpcvers_t); | |
215 | __END_DECLS | 215 | __END_DECLS | |
216 | 216 | |||
217 | /* | 217 | /* | |
218 | * Transport registration. | 218 | * Transport registration. | |
219 | * | 219 | * | |
220 | * xprt_register(xprt) | 220 | * xprt_register(xprt) | |
221 | * SVCXPRT *xprt; | 221 | * SVCXPRT *xprt; | |
222 | */ | 222 | */ | |
223 | __BEGIN_DECLS | 223 | __BEGIN_DECLS | |
224 | extern bool_t xprt_register (SVCXPRT *); | 224 | extern bool_t xprt_register (SVCXPRT *); | |
225 | __END_DECLS | 225 | __END_DECLS | |
226 | 226 | |||
227 | /* | 227 | /* | |
228 | * Transport un-register | 228 | * Transport un-register | |
229 | * | 229 | * | |
230 | * xprt_unregister(xprt) | 230 | * xprt_unregister(xprt) | |
231 | * SVCXPRT *xprt; | 231 | * SVCXPRT *xprt; | |
232 | */ | 232 | */ | |
233 | __BEGIN_DECLS | 233 | __BEGIN_DECLS | |
234 | extern void xprt_unregister (SVCXPRT *); | 234 | extern void xprt_unregister (SVCXPRT *); | |
235 | __END_DECLS | 235 | __END_DECLS | |
236 | 236 | |||
237 | 237 | |||
238 | /* | 238 | /* | |
239 | * When the service routine is called, it must first check to see if it | 239 | * When the service routine is called, it must first check to see if it | |
240 | * knows about the procedure; if not, it should call svcerr_noproc | 240 | * knows about the procedure; if not, it should call svcerr_noproc | |
241 | * and return. If so, it should deserialize its arguments via | 241 | * and return. If so, it should deserialize its arguments via | |
242 | * SVC_GETARGS (defined above). If the deserialization does not work, | 242 | * SVC_GETARGS (defined above). If the deserialization does not work, | |
243 | * svcerr_decode should be called followed by a return. Successful | 243 | * svcerr_decode should be called followed by a return. Successful | |
244 | * decoding of the arguments should be followed the execution of the | 244 | * decoding of the arguments should be followed the execution of the | |
245 | * procedure's code and a call to svc_sendreply. | 245 | * procedure's code and a call to svc_sendreply. | |
246 | * | 246 | * | |
247 | * Also, if the service refuses to execute the procedure due to too- | 247 | * Also, if the service refuses to execute the procedure due to too- | |
248 | * weak authentication parameters, svcerr_weakauth should be called. | 248 | * weak authentication parameters, svcerr_weakauth should be called. | |
249 | * Note: do not confuse access-control failure with weak authentication! | 249 | * Note: do not confuse access-control failure with weak authentication! | |
250 | * | 250 | * | |
251 | * NB: In pure implementations of rpc, the caller always waits for a reply | 251 | * NB: In pure implementations of rpc, the caller always waits for a reply | |
252 | * msg. This message is sent when svc_sendreply is called. | 252 | * msg. This message is sent when svc_sendreply is called. | |
253 | * Therefore pure service implementations should always call | 253 | * Therefore pure service implementations should always call | |
254 | * svc_sendreply even if the function logically returns void; use | 254 | * svc_sendreply even if the function logically returns void; use | |
255 | * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows | 255 | * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows | |
256 | * for the abuse of pure rpc via batched calling or pipelining. In the | 256 | * for the abuse of pure rpc via batched calling or pipelining. In the | |
257 | * case of a batched call, svc_sendreply should NOT be called since | 257 | * case of a batched call, svc_sendreply should NOT be called since | |
258 | * this would send a return message, which is what batching tries to avoid. | 258 | * this would send a return message, which is what batching tries to avoid. | |
259 | * It is the service/protocol writer's responsibility to know which calls are | 259 | * It is the service/protocol writer's responsibility to know which calls are | |
260 | * batched and which are not. Warning: responding to batch calls may | 260 | * batched and which are not. Warning: responding to batch calls may | |
261 | * deadlock the caller and server processes! | 261 | * deadlock the caller and server processes! | |
262 | */ | 262 | */ | |
263 | 263 | |||
264 | __BEGIN_DECLS | 264 | __BEGIN_DECLS | |
265 | extern bool_t svc_sendreply (SVCXPRT *, xdrproc_t, const char *); | 265 | extern bool_t svc_sendreply (SVCXPRT *, xdrproc_t, const char *); | |
266 | extern void svcerr_decode (SVCXPRT *); | 266 | extern void svcerr_decode (SVCXPRT *); | |
267 | extern void svcerr_weakauth (SVCXPRT *); | 267 | extern void svcerr_weakauth (SVCXPRT *); | |
268 | extern void svcerr_noproc (SVCXPRT *); | 268 | extern void svcerr_noproc (SVCXPRT *); | |
269 | extern void svcerr_progvers (SVCXPRT *, rpcvers_t, rpcvers_t); | 269 | extern void svcerr_progvers (SVCXPRT *, rpcvers_t, rpcvers_t); | |
270 | extern void svcerr_auth (SVCXPRT *, enum auth_stat); | 270 | extern void svcerr_auth (SVCXPRT *, enum auth_stat); | |
271 | extern void svcerr_noprog (SVCXPRT *); | 271 | extern void svcerr_noprog (SVCXPRT *); | |
272 | extern void svcerr_systemerr(SVCXPRT *); | 272 | extern void svcerr_systemerr(SVCXPRT *); | |
273 | extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t, | 273 | extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t, | |
274 | char *(*)(char *), xdrproc_t, xdrproc_t, | 274 | char *(*)(char *), xdrproc_t, xdrproc_t, | |
275 | char *); | 275 | char *); | |
276 | __END_DECLS | 276 | __END_DECLS | |
277 | 277 | |||
278 | /* | 278 | /* | |
279 | * Lowest level dispatching -OR- who owns this process anyway. | 279 | * Lowest level dispatching -OR- who owns this process anyway. | |
280 | * Somebody has to wait for incoming requests and then call the correct | 280 | * Somebody has to wait for incoming requests and then call the correct | |
281 | * service routine. The routine svc_run does infinite waiting; i.e., | 281 | * service routine. The routine svc_run does infinite waiting; i.e., | |
282 | * svc_run never returns. | 282 | * svc_run never returns. | |
283 | * Since another (co-existent) package may wish to selectively wait for | 283 | * Since another (co-existent) package may wish to selectively wait for | |
284 | * incoming calls or other events outside of the rpc architecture, the | 284 | * incoming calls or other events outside of the rpc architecture, the | |
285 | * routine svc_getreq is provided. It must be passed readfds, the | 285 | * routine svc_getreq is provided. It must be passed readfds, the | |
286 | * "in-place" results of a select system call (see select, section 2). | 286 | * "in-place" results of a select system call (see select, section 2). | |
287 | */ | 287 | */ | |
288 | 288 | |||
289 | /* | 289 | /* | |
290 | * Global keeper of rpc service descriptors in use | 290 | * Global keeper of rpc service descriptors in use | |
291 | * dynamic; must be inspected before each call to select | 291 | * dynamic; must be inspected before each call to select | |
292 | */ | 292 | */ | |
293 | #ifdef SVC_LEGACY | 293 | #ifdef SVC_LEGACY | |
294 | extern int svc_maxfd; | 294 | extern int svc_maxfd; | |
295 | extern fd_set svc_fdset; | 295 | extern fd_set svc_fdset; | |
296 | #else | 296 | #else | |
297 | #define svc_maxfd (*svc_fdset_getmax()) | 297 | #define svc_maxfd (*svc_fdset_getmax()) | |
298 | #define svc_fdset (*svc_fdset_get()) | 298 | #define svc_fdset (*svc_fdset_get()) | |
299 | #define svc_pollfd svc_pollfd_get() | 299 | #define svc_pollfd svc_pollfd_get() | |
300 | #define svc_max_pollfd (*svc_fdset_getmax()) | 300 | #define svc_max_pollfd (*svc_fdset_getmax()) | |
301 | #endif | 301 | #endif | |
302 | 302 | |||
303 | #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ | 303 | #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ | |
304 | 304 | |||
305 | /* | 305 | /* | |
306 | * a small program implemented by the svc_rpc implementation itself; | 306 | * a small program implemented by the svc_rpc implementation itself; | |
307 | * also see clnt.h for protocol numbers. | 307 | * also see clnt.h for protocol numbers. | |
308 | */ | 308 | */ | |
309 | __BEGIN_DECLS | 309 | __BEGIN_DECLS | |
310 | extern void rpctest_service(void); | 310 | extern void rpctest_service(void); | |
311 | __END_DECLS | 311 | __END_DECLS | |
312 | 312 | |||
313 | __BEGIN_DECLS | 313 | __BEGIN_DECLS | |
314 | 314 | |||
315 | #define SVC_FDSET_MT 1 /* each thread gets own fd_set/pollfd */ | 315 | #define SVC_FDSET_MT 1 /* each thread gets own fd_set/pollfd */ | |
316 | #define SVC_FDSET_POLL 2 /* use poll in svc_run */ | 316 | #define SVC_FDSET_POLL 2 /* use poll in svc_run */ | |
317 | extern void svc_fdset_init(int); | 317 | extern void svc_fdset_init(int); | |
318 | 318 | |||
319 | 319 | |||
320 | extern void svc_fdset_zero(void); | 320 | extern void svc_fdset_zero(void); | |
321 | extern int svc_fdset_isset(int); | 321 | extern int svc_fdset_isset(int); | |
322 | extern int svc_fdset_clr(int); | 322 | extern int svc_fdset_clr(int); | |
323 | extern int svc_fdset_set(int); | 323 | extern int svc_fdset_set(int); | |
324 | 324 | |||
325 | extern fd_set *svc_fdset_get(void); | 325 | extern fd_set *svc_fdset_get(void); | |
326 | extern int svc_fdset_getsize(int); | 326 | extern int svc_fdset_getsize(int); | |
327 | extern int *svc_fdset_getmax(void); | 327 | extern int *svc_fdset_getmax(void); | |
328 | extern fd_set *svc_fdset_copy(const fd_set *); | 328 | extern fd_set *svc_fdset_copy(const fd_set *); | |
329 | 329 | |||
330 | extern struct pollfd *svc_pollfd_get(void); | 330 | extern struct pollfd *svc_pollfd_get(void); | |
331 | extern int svc_pollfd_getsize(int); | 331 | extern int svc_pollfd_getsize(int); | |
332 | extern int *svc_pollfd_getmax(void); | 332 | extern int *svc_pollfd_getmax(void); | |
333 | extern struct pollfd *svc_pollfd_copy(const struct pollfd *); | 333 | extern struct pollfd *svc_pollfd_copy(const struct pollfd *); | |
334 | 334 | |||
335 | extern void svc_getreq (int); | 335 | extern void svc_getreq (int); | |
336 | extern void svc_getreqset (fd_set *); | 336 | extern void svc_getreqset (fd_set *); | |
337 | extern void svc_getreqset2 (fd_set *, int); | 337 | extern void svc_getreqset2 (fd_set *, int); | |
338 | extern void svc_getreq_common (int); | 338 | extern void svc_getreq_common (int); | |
339 | struct pollfd; | 339 | struct pollfd; | |
340 | extern void svc_getreq_poll(struct pollfd *, int); | 340 | extern void svc_getreq_poll(struct pollfd *, int); | |
341 | 341 | |||
342 | extern void svc_run (void); | 342 | extern void svc_run (void); | |
343 | extern void svc_exit (void); | 343 | extern void svc_exit (void); | |
344 | __END_DECLS | 344 | __END_DECLS | |
345 | 345 | |||
346 | /* | 346 | /* | |
347 | * Socket to use on svcxxx_create call to get default socket | 347 | * Socket to use on svcxxx_create call to get default socket | |
348 | */ | 348 | */ | |
349 | #define RPC_ANYSOCK -1 | 349 | #define RPC_ANYSOCK -1 | |
350 | #define RPC_ANYFD RPC_ANYSOCK | 350 | #define RPC_ANYFD RPC_ANYSOCK | |
351 | 351 | |||
352 | /* | 352 | /* | |
353 | * These are the existing service side transport implementations | 353 | * These are the existing service side transport implementations | |
354 | */ | 354 | */ | |
355 | 355 | |||
356 | __BEGIN_DECLS | 356 | __BEGIN_DECLS | |
357 | /* | 357 | /* | |
358 | * Transport independent svc_create routine. | 358 | * Transport independent svc_create routine. | |
359 | */ | 359 | */ | |
360 | extern int svc_create(void (*)(struct svc_req *, SVCXPRT *), | 360 | extern int svc_create(void (*)(struct svc_req *, SVCXPRT *), | |
361 | const rpcprog_t, const rpcvers_t, const char *); | 361 | const rpcprog_t, const rpcvers_t, const char *); | |
362 | /* | 362 | /* | |
363 | * void (*dispatch)(...); -- dispatch routine | 363 | * void (*dispatch)(...); -- dispatch routine | |
364 | * const rpcprog_t prognum; -- program number | 364 | * const rpcprog_t prognum; -- program number | |
365 | * const rpcvers_t versnum; -- version number | 365 | * const rpcvers_t versnum; -- version number | |
366 | * const char *nettype; -- network type | 366 | * const char *nettype; -- network type | |
367 | */ | 367 | */ | |
368 | 368 | |||
369 | 369 | |||
370 | /* | 370 | /* | |
371 | * Generic server creation routine. It takes a netconfig structure | 371 | * Generic server creation routine. It takes a netconfig structure | |
372 | * instead of a nettype. | 372 | * instead of a nettype. | |
373 | */ | 373 | */ | |
374 | 374 | |||
375 | extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *), | 375 | extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *), | |
376 | const rpcprog_t, const rpcvers_t, | 376 | const rpcprog_t, const rpcvers_t, | |
377 | const struct netconfig *); | 377 | const struct netconfig *); | |
378 | /* | 378 | /* | |
379 | * void (*dispatch)(...); -- dispatch routine | 379 | * void (*dispatch)(...); -- dispatch routine | |
380 | * const rpcprog_t prognum; -- program number | 380 | * const rpcprog_t prognum; -- program number | |
381 | * const rpcvers_t versnum; -- version number | 381 | * const rpcvers_t versnum; -- version number | |
382 | * const struct netconfig *nconf; -- netconfig structure | 382 | * const struct netconfig *nconf; -- netconfig structure | |
383 | */ | 383 | */ | |
384 | 384 | |||
385 | 385 | |||
386 | /* | 386 | /* | |
387 | * Generic TLI create routine | 387 | * Generic TLI create routine | |
388 | */ | 388 | */ | |
389 | extern SVCXPRT *svc_tli_create(const int, const struct netconfig *, | 389 | extern SVCXPRT *svc_tli_create(const int, const struct netconfig *, | |
390 | const struct t_bind *, const unsigned, | 390 | const struct t_bind *, const unsigned int, | |
391 | const unsigned); | 391 | const unsigned int); | |
392 | /* | 392 | /* | |
393 | * const int fd; -- connection end point | 393 | * const int fd; -- connection end point | |
394 | * const struct netconfig *nconf; -- netconfig structure for network | 394 | * const struct netconfig *nconf; -- netconfig structure for network | |
395 | * const struct t_bind *bindaddr; -- local bind address | 395 | * const struct t_bind *bindaddr; -- local bind address | |
396 | * const unsigned sendsz; -- max sendsize | 396 | * const unsigned sendsz; -- max sendsize | |
397 | * const unsigned recvsz; -- max recvsize | 397 | * const unsigned recvsz; -- max recvsize | |
398 | */ | 398 | */ | |
399 | 399 | |||
400 | /* | 400 | /* | |
401 | * Connectionless and connectionful create routines | 401 | * Connectionless and connectionful create routines | |
402 | */ | 402 | */ | |
403 | 403 | |||
404 | extern SVCXPRT *svc_vc_create(const int, const unsigned, const unsigned); | 404 | extern SVCXPRT *svc_vc_create(const int, const unsigned int, | |
405 | const unsigned int); | |||
405 | /* | 406 | /* | |
406 | * const int fd; -- open connection end point | 407 | * const int fd; -- open connection end point | |
407 | * const unsigned sendsize; -- max send size | 408 | * const unsigned sendsize; -- max send size | |
408 | * const unsigned recvsize; -- max recv size | 409 | * const unsigned recvsize; -- max recv size | |
409 | */ | 410 | */ | |
410 | 411 | |||
411 | extern SVCXPRT *svc_dg_create(const int, const unsigned, const unsigned); | 412 | extern SVCXPRT *svc_dg_create(const int, const unsigned int, | |
413 | const unsigned int); | |||
412 | /* | 414 | /* | |
413 | * const int fd; -- open connection | 415 | * const int fd; -- open connection | |
414 | * const unsigned sendsize; -- max send size | 416 | * const unsigned sendsize; -- max send size | |
415 | * const unsigned recvsize; -- max recv size | 417 | * const unsigned recvsize; -- max recv size | |
416 | */ | 418 | */ | |
417 | 419 | |||
418 | 420 | |||
419 | /* | 421 | /* | |
420 | * the routine takes any *open* connection | 422 | * the routine takes any *open* connection | |
421 | * descriptor as its first input and is used for open connections. | 423 | * descriptor as its first input and is used for open connections. | |
422 | */ | 424 | */ | |
423 | extern SVCXPRT *svc_fd_create(const int, const unsigned, const unsigned); | 425 | extern SVCXPRT *svc_fd_create(const int, const unsigned int, | |
426 | const unsigned int); | |||
424 | /* | 427 | /* | |
425 | * const int fd; -- open connection end point | 428 | * const int fd; -- open connection end point | |
426 | * const unsigned sendsize; -- max send size | 429 | * const unsigned sendsize; -- max send size | |
427 | * const unsigned recvsize; -- max recv size | 430 | * const unsigned recvsize; -- max recv size | |
428 | */ | 431 | */ | |
429 | 432 | |||
430 | /* | 433 | /* | |
431 | * Memory based rpc (for speed check and testing) | 434 | * Memory based rpc (for speed check and testing) | |
432 | */ | 435 | */ | |
433 | extern SVCXPRT *svc_raw_create(void); | 436 | extern SVCXPRT *svc_raw_create(void); | |
434 | 437 | |||
435 | /* | 438 | /* | |
436 | * svc_dg_enable_cache() enables the cache on dg transports. | 439 | * svc_dg_enable_cache() enables the cache on dg transports. | |
437 | */ | 440 | */ | |
438 | int svc_dg_enablecache(SVCXPRT *, const unsigned); | 441 | int svc_dg_enablecache(SVCXPRT *, const unsigned int); | |
439 | 442 | |||
440 | __END_DECLS | 443 | __END_DECLS | |
441 | 444 | |||
442 | 445 | |||
443 | /* for backward compatibility */ | 446 | /* for backward compatibility */ | |
444 | #include <rpc/svc_soc.h> | 447 | #include <rpc/svc_soc.h> | |
445 | 448 | |||
446 | #endif /* !_RPC_SVC_H_ */ | 449 | #endif /* !_RPC_SVC_H_ */ |
--- src/include/rpc/svc_soc.h 2016/01/23 01:05:30 1.3
+++ src/include/rpc/svc_soc.h 2016/01/23 02:34:09 1.4
@@ -1,115 +1,115 @@ | @@ -1,115 +1,115 @@ | |||
1 | /* $NetBSD: svc_soc.h,v 1.3 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: svc_soc.h,v 1.4 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | */ | 30 | */ | |
31 | /* | 31 | /* | |
32 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. | 32 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * svc.h, Server-side remote procedure call interface. | 36 | * svc.h, Server-side remote procedure call interface. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #ifndef _RPC_SVC_SOC_H | 39 | #ifndef _RPC_SVC_SOC_H | |
40 | #define _RPC_SVC_SOC_H | 40 | #define _RPC_SVC_SOC_H | |
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | 42 | |||
43 | /* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ | 43 | /* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ | |
44 | /* svc_soc.h 1.8 89/05/01 SMI */ | 44 | /* svc_soc.h 1.8 89/05/01 SMI */ | |
45 | 45 | |||
46 | /* | 46 | /* | |
47 | * All the following declarations are only for backward compatibility | 47 | * All the following declarations are only for backward compatibility | |
48 | * with TS-RPC | 48 | * with TS-RPC | |
49 | */ | 49 | */ | |
50 | 50 | |||
51 | /* | 51 | /* | |
52 | * Approved way of getting address of caller | 52 | * Approved way of getting address of caller | |
53 | */ | 53 | */ | |
54 | #define svc_getcaller(x) (&(x)->xp_raddr) | 54 | #define svc_getcaller(x) (&(x)->xp_raddr) | |
55 | 55 | |||
56 | /* | 56 | /* | |
57 | * Service registration | 57 | * Service registration | |
58 | * | 58 | * | |
59 | * svc_register(xprt, prog, vers, dispatch, protocol) | 59 | * svc_register(xprt, prog, vers, dispatch, protocol) | |
60 | * SVCXPRT *xprt; | 60 | * SVCXPRT *xprt; | |
61 | * unsigned long prog; | 61 | * unsigned long prog; | |
62 | * unsigned long vers; | 62 | * unsigned long vers; | |
63 | * void (*dispatch)(); | 63 | * void (*dispatch)(); | |
64 | * int protocol; like TCP or UDP, zero means do not register | 64 | * int protocol; like TCP or UDP, zero means do not register | |
65 | */ | 65 | */ | |
66 | __BEGIN_DECLS | 66 | __BEGIN_DECLS | |
67 | extern bool_t svc_register(SVCXPRT *, unsigned long, unsigned long, | 67 | extern bool_t svc_register(SVCXPRT *, unsigned long, unsigned long, | |
68 | void (*)(struct svc_req *, SVCXPRT *), int); | 68 | void (*)(struct svc_req *, SVCXPRT *), int); | |
69 | __END_DECLS | 69 | __END_DECLS | |
70 | 70 | |||
71 | /* | 71 | /* | |
72 | * Service un-registration | 72 | * Service un-registration | |
73 | * | 73 | * | |
74 | * svc_unregister(prog, vers) | 74 | * svc_unregister(prog, vers) | |
75 | * unsigned long prog; | 75 | * unsigned long prog; | |
76 | * unsigned long vers; | 76 | * unsigned long vers; | |
77 | */ | 77 | */ | |
78 | __BEGIN_DECLS | 78 | __BEGIN_DECLS | |
79 | extern void svc_unregister(unsigned long, unsigned long); | 79 | extern void svc_unregister(unsigned long, unsigned long); | |
80 | __END_DECLS | 80 | __END_DECLS | |
81 | 81 | |||
82 | 82 | |||
83 | /* | 83 | /* | |
84 | * Memory based rpc for testing and timing. | 84 | * Memory based rpc for testing and timing. | |
85 | */ | 85 | */ | |
86 | __BEGIN_DECLS | 86 | __BEGIN_DECLS | |
87 | extern SVCXPRT *svcraw_create(void); | 87 | extern SVCXPRT *svcraw_create(void); | |
88 | __END_DECLS | 88 | __END_DECLS | |
89 | 89 | |||
90 | 90 | |||
91 | /* | 91 | /* | |
92 | * Udp based rpc. | 92 | * Udp based rpc. | |
93 | */ | 93 | */ | |
94 | __BEGIN_DECLS | 94 | __BEGIN_DECLS | |
95 | extern SVCXPRT *svcudp_create(int); | 95 | extern SVCXPRT *svcudp_create(int); | |
96 | extern SVCXPRT *svcudp_bufcreate(int, unsigned, unsigned); | 96 | extern SVCXPRT *svcudp_bufcreate(int, unsigned int, unsigned int); | |
97 | extern int svcudp_enablecache(SVCXPRT *, unsigned long); | 97 | extern int svcudp_enablecache(SVCXPRT *, unsigned long); | |
98 | __END_DECLS | 98 | __END_DECLS | |
99 | 99 | |||
100 | 100 | |||
101 | /* | 101 | /* | |
102 | * Tcp based rpc. | 102 | * Tcp based rpc. | |
103 | */ | 103 | */ | |
104 | __BEGIN_DECLS | 104 | __BEGIN_DECLS | |
105 | extern SVCXPRT *svctcp_create(int, unsigned, unsigned); | 105 | extern SVCXPRT *svctcp_create(int, unsigned int, unsigned int); | |
106 | __END_DECLS | 106 | __END_DECLS | |
107 | 107 | |||
108 | /* | 108 | /* | |
109 | * Fd based rpc. | 109 | * Fd based rpc. | |
110 | */ | 110 | */ | |
111 | __BEGIN_DECLS | 111 | __BEGIN_DECLS | |
112 | extern SVCXPRT *svcfd_create(int, unsigned, unsigned); | 112 | extern SVCXPRT *svcfd_create(int, unsigned int, unsigned int); | |
113 | __END_DECLS | 113 | __END_DECLS | |
114 | 114 | |||
115 | #endif /* !_RPC_SVC_SOC_H */ | 115 | #endif /* !_RPC_SVC_SOC_H */ |
--- src/include/rpc/Attic/xdr.h 2016/01/23 01:05:30 1.28
+++ src/include/rpc/Attic/xdr.h 2016/01/23 02:34:09 1.29
@@ -1,359 +1,361 @@ | @@ -1,359 +1,361 @@ | |||
1 | /* $NetBSD: xdr.h,v 1.28 2016/01/23 01:05:30 dholland Exp $ */ | 1 | /* $NetBSD: xdr.h,v 1.29 2016/01/23 02:34:09 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | 4 | * Sun RPC is a product of Sun Microsystems, Inc. and is provided for | |
5 | * unrestricted use provided that this legend is included on all tape | 5 | * unrestricted use provided that this legend is included on all tape | |
6 | * media and as a part of the software program in whole or part. Users | 6 | * media and as a part of the software program in whole or part. Users | |
7 | * may copy or modify Sun RPC without charge, but are not authorized | 7 | * may copy or modify Sun RPC without charge, but are not authorized | |
8 | * to license or distribute it to anyone else except as part of a product or | 8 | * to license or distribute it to anyone else except as part of a product or | |
9 | * program developed by the user. | 9 | * program developed by the user. | |
10 | * | 10 | * | |
11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | 11 | * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE | |
12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | 12 | * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR | |
13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | 13 | * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. | |
14 | * | 14 | * | |
15 | * Sun RPC is provided with no support and without any obligation on the | 15 | * Sun RPC is provided with no support and without any obligation on the | |
16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | 16 | * part of Sun Microsystems, Inc. to assist in its use, correction, | |
17 | * modification or enhancement. | 17 | * modification or enhancement. | |
18 | * | 18 | * | |
19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | 19 | * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE | |
20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | 20 | * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC | |
21 | * OR ANY PART THEREOF. | 21 | * OR ANY PART THEREOF. | |
22 | * | 22 | * | |
23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | 23 | * In no event will Sun Microsystems, Inc. be liable for any lost revenue | |
24 | * or profits or other special, indirect and consequential damages, even if | 24 | * or profits or other special, indirect and consequential damages, even if | |
25 | * Sun has been advised of the possibility of such damages. | 25 | * Sun has been advised of the possibility of such damages. | |
26 | * | 26 | * | |
27 | * Sun Microsystems, Inc. | 27 | * Sun Microsystems, Inc. | |
28 | * 2550 Garcia Avenue | 28 | * 2550 Garcia Avenue | |
29 | * Mountain View, California 94043 | 29 | * Mountain View, California 94043 | |
30 | * | 30 | * | |
31 | * from: @(#)xdr.h 1.19 87/04/22 SMI | 31 | * from: @(#)xdr.h 1.19 87/04/22 SMI | |
32 | * @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC | 32 | * @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * xdr.h, External Data Representation Serialization Routines. | 36 | * xdr.h, External Data Representation Serialization Routines. | |
37 | * | 37 | * | |
38 | * Copyright (C) 1984, Sun Microsystems, Inc. | 38 | * Copyright (C) 1984, Sun Microsystems, Inc. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #ifndef _RPC_XDR_H_ | 41 | #ifndef _RPC_XDR_H_ | |
42 | #define _RPC_XDR_H_ | 42 | #define _RPC_XDR_H_ | |
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | 44 | |||
45 | /* | 45 | /* | |
46 | * XDR provides a conventional way for converting between C data | 46 | * XDR provides a conventional way for converting between C data | |
47 | * types and an external bit-string representation. Library supplied | 47 | * types and an external bit-string representation. Library supplied | |
48 | * routines provide for the conversion on built-in C data types. These | 48 | * routines provide for the conversion on built-in C data types. These | |
49 | * routines and utility routines defined here are used to help implement | 49 | * routines and utility routines defined here are used to help implement | |
50 | * a type encode/decode routine for each user-defined type. | 50 | * a type encode/decode routine for each user-defined type. | |
51 | * | 51 | * | |
52 | * Each data type provides a single procedure which takes two arguments: | 52 | * Each data type provides a single procedure which takes two arguments: | |
53 | * | 53 | * | |
54 | * bool_t | 54 | * bool_t | |
55 | * xdrproc(xdrs, argresp) | 55 | * xdrproc(xdrs, argresp) | |
56 | * XDR *xdrs; | 56 | * XDR *xdrs; | |
57 | * <type> *argresp; | 57 | * <type> *argresp; | |
58 | * | 58 | * | |
59 | * xdrs is an instance of a XDR handle, to which or from which the data | 59 | * xdrs is an instance of a XDR handle, to which or from which the data | |
60 | * type is to be converted. argresp is a pointer to the structure to be | 60 | * type is to be converted. argresp is a pointer to the structure to be | |
61 | * converted. The XDR handle contains an operation field which indicates | 61 | * converted. The XDR handle contains an operation field which indicates | |
62 | * which of the operations (ENCODE, DECODE * or FREE) is to be performed. | 62 | * which of the operations (ENCODE, DECODE * or FREE) is to be performed. | |
63 | * | 63 | * | |
64 | * XDR_DECODE may allocate space if the pointer argresp is null. This | 64 | * XDR_DECODE may allocate space if the pointer argresp is null. This | |
65 | * data can be freed with the XDR_FREE operation. | 65 | * data can be freed with the XDR_FREE operation. | |
66 | * | 66 | * | |
67 | * We write only one procedure per data type to make it easy | 67 | * We write only one procedure per data type to make it easy | |
68 | * to keep the encode and decode procedures for a data type consistent. | 68 | * to keep the encode and decode procedures for a data type consistent. | |
69 | * In many cases the same code performs all operations on a user defined type, | 69 | * In many cases the same code performs all operations on a user defined type, | |
70 | * because all the hard work is done in the component type routines. | 70 | * because all the hard work is done in the component type routines. | |
71 | * decode as a series of calls on the nested data types. | 71 | * decode as a series of calls on the nested data types. | |
72 | */ | 72 | */ | |
73 | 73 | |||
74 | /* | 74 | /* | |
75 | * Xdr operations. XDR_ENCODE causes the type to be encoded into the | 75 | * Xdr operations. XDR_ENCODE causes the type to be encoded into the | |
76 | * stream. XDR_DECODE causes the type to be extracted from the stream. | 76 | * stream. XDR_DECODE causes the type to be extracted from the stream. | |
77 | * XDR_FREE can be used to release the space allocated by an XDR_DECODE | 77 | * XDR_FREE can be used to release the space allocated by an XDR_DECODE | |
78 | * request. | 78 | * request. | |
79 | */ | 79 | */ | |
80 | enum xdr_op { | 80 | enum xdr_op { | |
81 | XDR_ENCODE=0, | 81 | XDR_ENCODE=0, | |
82 | XDR_DECODE=1, | 82 | XDR_DECODE=1, | |
83 | XDR_FREE=2 | 83 | XDR_FREE=2 | |
84 | }; | 84 | }; | |
85 | 85 | |||
86 | /* | 86 | /* | |
87 | * This is the number of bytes per unit of external data. | 87 | * This is the number of bytes per unit of external data. | |
88 | */ | 88 | */ | |
89 | #define BYTES_PER_XDR_UNIT (4) | 89 | #define BYTES_PER_XDR_UNIT (4) | |
90 | #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ | 90 | #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ | |
91 | * BYTES_PER_XDR_UNIT) | 91 | * BYTES_PER_XDR_UNIT) | |
92 | 92 | |||
93 | /* | 93 | /* | |
94 | * The XDR handle. | 94 | * The XDR handle. | |
95 | * Contains operation which is being applied to the stream, | 95 | * Contains operation which is being applied to the stream, | |
96 | * an operations vector for the paticular implementation (e.g. see xdr_mem.c), | 96 | * an operations vector for the paticular implementation (e.g. see xdr_mem.c), | |
97 | * and two private fields for the use of the particular impelementation. | 97 | * and two private fields for the use of the particular impelementation. | |
98 | */ | 98 | */ | |
99 | typedef struct __rpc_xdr { | 99 | typedef struct __rpc_xdr { | |
100 | enum xdr_op x_op; /* operation; fast additional param */ | 100 | enum xdr_op x_op; /* operation; fast additional param */ | |
101 | const struct xdr_ops { | 101 | const struct xdr_ops { | |
102 | /* get a long from underlying stream */ | 102 | /* get a long from underlying stream */ | |
103 | bool_t (*x_getlong)(struct __rpc_xdr *, long *); | 103 | bool_t (*x_getlong)(struct __rpc_xdr *, long *); | |
104 | /* put a long to " */ | 104 | /* put a long to " */ | |
105 | bool_t (*x_putlong)(struct __rpc_xdr *, const long *); | 105 | bool_t (*x_putlong)(struct __rpc_xdr *, const long *); | |
106 | /* get some bytes from " */ | 106 | /* get some bytes from " */ | |
107 | bool_t (*x_getbytes)(struct __rpc_xdr *, char *, unsigned); | 107 | bool_t (*x_getbytes)(struct __rpc_xdr *, char *, unsigned int); | |
108 | /* put some bytes to " */ | 108 | /* put some bytes to " */ | |
109 | bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, | 109 | bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, | |
110 | unsigned); | 110 | unsigned int); | |
111 | /* returns bytes off from beginning */ | 111 | /* returns bytes off from beginning */ | |
112 | unsigned (*x_getpostn)(struct __rpc_xdr *); | 112 | unsigned (*x_getpostn)(struct __rpc_xdr *); | |
113 | /* lets you reposition the stream */ | 113 | /* lets you reposition the stream */ | |
114 | bool_t (*x_setpostn)(struct __rpc_xdr *, unsigned); | 114 | bool_t (*x_setpostn)(struct __rpc_xdr *, unsigned int); | |
115 | /* buf quick ptr to buffered data */ | 115 | /* buf quick ptr to buffered data */ | |
116 | int32_t *(*x_inline)(struct __rpc_xdr *, unsigned); | 116 | int32_t *(*x_inline)(struct __rpc_xdr *, unsigned int); | |
117 | /* free privates of this xdr_stream */ | 117 | /* free privates of this xdr_stream */ | |
118 | void (*x_destroy)(struct __rpc_xdr *); | 118 | void (*x_destroy)(struct __rpc_xdr *); | |
119 | bool_t (*x_control)(struct __rpc_xdr *, int, void *); | 119 | bool_t (*x_control)(struct __rpc_xdr *, int, void *); | |
120 | } *x_ops; | 120 | } *x_ops; | |
121 | char * x_public; /* users' data */ | 121 | char * x_public; /* users' data */ | |
122 | void * x_private; /* pointer to private data */ | 122 | void * x_private; /* pointer to private data */ | |
123 | char * x_base; /* private used for position info */ | 123 | char * x_base; /* private used for position info */ | |
124 | unsigned x_handy; /* extra private word */ | 124 | unsigned int x_handy; /* extra private word */ | |
125 | } XDR; | 125 | } XDR; | |
126 | 126 | |||
127 | /* | 127 | /* | |
128 | * A xdrproc_t exists for each data type which is to be encoded or decoded. | 128 | * A xdrproc_t exists for each data type which is to be encoded or decoded. | |
129 | * | 129 | * | |
130 | * The second argument to the xdrproc_t is a pointer to an opaque pointer. | 130 | * The second argument to the xdrproc_t is a pointer to an opaque pointer. | |
131 | * The opaque pointer generally points to a structure of the data type | 131 | * The opaque pointer generally points to a structure of the data type | |
132 | * to be decoded. If this pointer is 0, then the type routines should | 132 | * to be decoded. If this pointer is 0, then the type routines should | |
133 | * allocate dynamic storage of the appropriate size and return it. | 133 | * allocate dynamic storage of the appropriate size and return it. | |
134 | */ | 134 | */ | |
135 | typedef bool_t (*xdrproc_t)(XDR *, const void *); | 135 | typedef bool_t (*xdrproc_t)(XDR *, const void *); | |
136 | 136 | |||
137 | /* | 137 | /* | |
138 | * Operations defined on a XDR handle | 138 | * Operations defined on a XDR handle | |
139 | * | 139 | * | |
140 | * XDR *xdrs; | 140 | * XDR *xdrs; | |
141 | * long *longp; | 141 | * long *longp; | |
142 | * char * addr; | 142 | * char * addr; | |
143 | * unsigned len; | 143 | * unsigned len; | |
144 | * unsigned pos; | 144 | * unsigned pos; | |
145 | */ | 145 | */ | |
146 | #define XDR_GETLONG(xdrs, longp) \ | 146 | #define XDR_GETLONG(xdrs, longp) \ | |
147 | (*(xdrs)->x_ops->x_getlong)(xdrs, longp) | 147 | (*(xdrs)->x_ops->x_getlong)(xdrs, longp) | |
148 | #define xdr_getlong(xdrs, longp) \ | 148 | #define xdr_getlong(xdrs, longp) \ | |
149 | (*(xdrs)->x_ops->x_getlong)(xdrs, longp) | 149 | (*(xdrs)->x_ops->x_getlong)(xdrs, longp) | |
150 | 150 | |||
151 | #define XDR_PUTLONG(xdrs, longp) \ | 151 | #define XDR_PUTLONG(xdrs, longp) \ | |
152 | (*(xdrs)->x_ops->x_putlong)(xdrs, longp) | 152 | (*(xdrs)->x_ops->x_putlong)(xdrs, longp) | |
153 | #define xdr_putlong(xdrs, longp) \ | 153 | #define xdr_putlong(xdrs, longp) \ | |
154 | (*(xdrs)->x_ops->x_putlong)(xdrs, longp) | 154 | (*(xdrs)->x_ops->x_putlong)(xdrs, longp) | |
155 | 155 | |||
156 | static __inline int | 156 | static __inline int | |
157 | xdr_getint32(XDR *xdrs, int32_t *ip) | 157 | xdr_getint32(XDR *xdrs, int32_t *ip) | |
158 | { | 158 | { | |
159 | long l; | 159 | long l; | |
160 | 160 | |||
161 | if (!xdr_getlong(xdrs, &l)) | 161 | if (!xdr_getlong(xdrs, &l)) | |
162 | return 0; | 162 | return 0; | |
163 | *ip = (int32_t)l; | 163 | *ip = (int32_t)l; | |
164 | return 1; | 164 | return 1; | |
165 | } | 165 | } | |
166 | 166 | |||
167 | static __inline int | 167 | static __inline int | |
168 | xdr_putint32(XDR *xdrs, int32_t *ip) | 168 | xdr_putint32(XDR *xdrs, int32_t *ip) | |
169 | { | 169 | { | |
170 | long l; | 170 | long l; | |
171 | 171 | |||
172 | l = (long)*ip; | 172 | l = (long)*ip; | |
173 | return xdr_putlong(xdrs, &l); | 173 | return xdr_putlong(xdrs, &l); | |
174 | } | 174 | } | |
175 | 175 | |||
176 | #define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p) | 176 | #define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p) | |
177 | #define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p) | 177 | #define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p) | |
178 | 178 | |||
179 | #define XDR_GETBYTES(xdrs, addr, len) \ | 179 | #define XDR_GETBYTES(xdrs, addr, len) \ | |
180 | (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) | 180 | (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) | |
181 | #define xdr_getbytes(xdrs, addr, len) \ | 181 | #define xdr_getbytes(xdrs, addr, len) \ | |
182 | (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) | 182 | (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) | |
183 | 183 | |||
184 | #define XDR_PUTBYTES(xdrs, addr, len) \ | 184 | #define XDR_PUTBYTES(xdrs, addr, len) \ | |
185 | (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) | 185 | (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) | |
186 | #define xdr_putbytes(xdrs, addr, len) \ | 186 | #define xdr_putbytes(xdrs, addr, len) \ | |
187 | (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) | 187 | (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) | |
188 | 188 | |||
189 | #define XDR_GETPOS(xdrs) \ | 189 | #define XDR_GETPOS(xdrs) \ | |
190 | (*(xdrs)->x_ops->x_getpostn)(xdrs) | 190 | (*(xdrs)->x_ops->x_getpostn)(xdrs) | |
191 | #define xdr_getpos(xdrs) \ | 191 | #define xdr_getpos(xdrs) \ | |
192 | (*(xdrs)->x_ops->x_getpostn)(xdrs) | 192 | (*(xdrs)->x_ops->x_getpostn)(xdrs) | |
193 | 193 | |||
194 | #define XDR_SETPOS(xdrs, pos) \ | 194 | #define XDR_SETPOS(xdrs, pos) \ | |
195 | (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) | 195 | (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) | |
196 | #define xdr_setpos(xdrs, pos) \ | 196 | #define xdr_setpos(xdrs, pos) \ | |
197 | (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) | 197 | (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) | |
198 | 198 | |||
199 | #define XDR_INLINE(xdrs, len) \ | 199 | #define XDR_INLINE(xdrs, len) \ | |
200 | (*(xdrs)->x_ops->x_inline)(xdrs, len) | 200 | (*(xdrs)->x_ops->x_inline)(xdrs, len) | |
201 | #define xdr_inline(xdrs, len) \ | 201 | #define xdr_inline(xdrs, len) \ | |
202 | (*(xdrs)->x_ops->x_inline)(xdrs, len) | 202 | (*(xdrs)->x_ops->x_inline)(xdrs, len) | |
203 | 203 | |||
204 | #define XDR_DESTROY(xdrs) \ | 204 | #define XDR_DESTROY(xdrs) \ | |
205 | if ((xdrs)->x_ops->x_destroy) \ | 205 | if ((xdrs)->x_ops->x_destroy) \ | |
206 | (*(xdrs)->x_ops->x_destroy)(xdrs) | 206 | (*(xdrs)->x_ops->x_destroy)(xdrs) | |
207 | #define xdr_destroy(xdrs) \ | 207 | #define xdr_destroy(xdrs) \ | |
208 | if ((xdrs)->x_ops->x_destroy) \ | 208 | if ((xdrs)->x_ops->x_destroy) \ | |
209 | (*(xdrs)->x_ops->x_destroy)(xdrs) | 209 | (*(xdrs)->x_ops->x_destroy)(xdrs) | |
210 | 210 | |||
211 | #define XDR_CONTROL(xdrs, req, op) \ | 211 | #define XDR_CONTROL(xdrs, req, op) \ | |
212 | if ((xdrs)->x_ops->x_control) \ | 212 | if ((xdrs)->x_ops->x_control) \ | |
213 | (*(xdrs)->x_ops->x_control)(xdrs, req, op) | 213 | (*(xdrs)->x_ops->x_control)(xdrs, req, op) | |
214 | #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) | 214 | #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) | |
215 | 215 | |||
216 | /* | 216 | /* | |
217 | * Solaris strips the '_t' from these types -- not sure why. | 217 | * Solaris strips the '_t' from these types -- not sure why. | |
218 | * But, let's be compatible. | 218 | * But, let's be compatible. | |
219 | */ | 219 | */ | |
220 | #define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp) | 220 | #define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp) | |
221 | #define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp) | 221 | #define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp) | |
222 | #define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp) | 222 | #define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp) | |
223 | #define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp) | 223 | #define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp) | |
224 | #define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp) | 224 | #define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp) | |
225 | 225 | |||
226 | /* | 226 | /* | |
227 | * Support struct for discriminated unions. | 227 | * Support struct for discriminated unions. | |
228 | * You create an array of xdrdiscrim structures, terminated with | 228 | * You create an array of xdrdiscrim structures, terminated with | |
229 | * a entry with a null procedure pointer. The xdr_union routine gets | 229 | * a entry with a null procedure pointer. The xdr_union routine gets | |
230 | * the discriminant value and then searches the array of structures | 230 | * the discriminant value and then searches the array of structures | |
231 | * for a matching value. If a match is found the associated xdr routine | 231 | * for a matching value. If a match is found the associated xdr routine | |
232 | * is called to handle that part of the union. If there is | 232 | * is called to handle that part of the union. If there is | |
233 | * no match, then a default routine may be called. | 233 | * no match, then a default routine may be called. | |
234 | * If there is no match and no default routine it is an error. | 234 | * If there is no match and no default routine it is an error. | |
235 | */ | 235 | */ | |
236 | #define NULL_xdrproc_t ((xdrproc_t)0) | 236 | #define NULL_xdrproc_t ((xdrproc_t)0) | |
237 | struct xdr_discrim { | 237 | struct xdr_discrim { | |
238 | int value; | 238 | int value; | |
239 | xdrproc_t proc; | 239 | xdrproc_t proc; | |
240 | }; | 240 | }; | |
241 | 241 | |||
242 | /* | 242 | /* | |
243 | * In-line routines for fast encode/decode of primitive data types. | 243 | * In-line routines for fast encode/decode of primitive data types. | |
244 | * Caveat emptor: these use single memory cycles to get the | 244 | * Caveat emptor: these use single memory cycles to get the | |
245 | * data from the underlying buffer, and will fail to operate | 245 | * data from the underlying buffer, and will fail to operate | |
246 | * properly if the data is not aligned. The standard way to use these | 246 | * properly if the data is not aligned. The standard way to use these | |
247 | * is to say: | 247 | * is to say: | |
248 | * if ((buf = XDR_INLINE(xdrs, count)) == NULL) | 248 | * if ((buf = XDR_INLINE(xdrs, count)) == NULL) | |
249 | * return (0); | 249 | * return (0); | |
250 | * <<< macro calls >>> | 250 | * <<< macro calls >>> | |
251 | * where ``count'' is the number of bytes of data occupied | 251 | * where ``count'' is the number of bytes of data occupied | |
252 | * by the primitive data types. | 252 | * by the primitive data types. | |
253 | * | 253 | * | |
254 | * N.B. and frozen for all time: each data type here uses 4 bytes | 254 | * N.B. and frozen for all time: each data type here uses 4 bytes | |
255 | * of external representation. | 255 | * of external representation. | |
256 | */ | 256 | */ | |
257 | #define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) | 257 | #define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) | |
258 | #define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((uint32_t)v)) | 258 | #define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((uint32_t)v)) | |
259 | #define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) | 259 | #define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) | |
260 | #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v))) | 260 | #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v))) | |
261 | 261 | |||
262 | #define IXDR_GET_LONG(buf) ((long)ntohl((uint32_t)*(buf)++)) | 262 | #define IXDR_GET_LONG(buf) ((long)ntohl((uint32_t)*(buf)++)) | |
263 | #define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((uint32_t)v)) | 263 | #define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((uint32_t)v)) | |
264 | 264 | |||
265 | #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) | 265 | #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) | |
266 | #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) | 266 | #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) | |
267 | #define IXDR_GET_U_LONG(buf) ((unsigned long)IXDR_GET_LONG(buf)) | 267 | #define IXDR_GET_U_LONG(buf) ((unsigned long)IXDR_GET_LONG(buf)) | |
268 | #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) | 268 | #define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) | |
269 | #define IXDR_GET_U_SHORT(buf) ((unsigned short)IXDR_GET_LONG(buf)) | 269 | #define IXDR_GET_U_SHORT(buf) ((unsigned short)IXDR_GET_LONG(buf)) | |
270 | 270 | |||
271 | #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), (v)) | 271 | #define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), (v)) | |
272 | #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v)) | 272 | #define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v)) | |
273 | #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v)) | 273 | #define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v)) | |
274 | #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) | 274 | #define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) | |
275 | #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) | 275 | #define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v)) | |
276 | 276 | |||
277 | /* | 277 | /* | |
278 | * These are the "generic" xdr routines. | 278 | * These are the "generic" xdr routines. | |
279 | */ | 279 | */ | |
280 | __BEGIN_DECLS | 280 | __BEGIN_DECLS | |
281 | extern bool_t xdr_void(void); | 281 | extern bool_t xdr_void(void); | |
282 | extern bool_t xdr_int(XDR *, int *); | 282 | extern bool_t xdr_int(XDR *, int *); | |
283 | extern bool_t xdr_u_int(XDR *, unsigned *); | 283 | extern bool_t xdr_u_int(XDR *, unsigned int *); | |
284 | extern bool_t xdr_long(XDR *, long *); | 284 | extern bool_t xdr_long(XDR *, long *); | |
285 | extern bool_t xdr_u_long(XDR *, unsigned long *); | 285 | extern bool_t xdr_u_long(XDR *, unsigned long *); | |
286 | extern bool_t xdr_short(XDR *, short *); | 286 | extern bool_t xdr_short(XDR *, short *); | |
287 | extern bool_t xdr_u_short(XDR *, unsigned short *); | 287 | extern bool_t xdr_u_short(XDR *, unsigned short *); | |
288 | extern bool_t xdr_int16_t(XDR *, int16_t *); | 288 | extern bool_t xdr_int16_t(XDR *, int16_t *); | |
289 | extern bool_t xdr_u_int16_t(XDR *, uint16_t *); | 289 | extern bool_t xdr_u_int16_t(XDR *, uint16_t *); | |
290 | extern bool_t xdr_int32_t(XDR *, int32_t *); | 290 | extern bool_t xdr_int32_t(XDR *, int32_t *); | |
291 | extern bool_t xdr_u_int32_t(XDR *, uint32_t *); | 291 | extern bool_t xdr_u_int32_t(XDR *, uint32_t *); | |
292 | extern bool_t xdr_int64_t(XDR *, int64_t *); | 292 | extern bool_t xdr_int64_t(XDR *, int64_t *); | |
293 | extern bool_t xdr_u_int64_t(XDR *, uint64_t *); | 293 | extern bool_t xdr_u_int64_t(XDR *, uint64_t *); | |
294 | extern bool_t xdr_bool(XDR *, bool_t *); | 294 | extern bool_t xdr_bool(XDR *, bool_t *); | |
295 | extern bool_t xdr_enum(XDR *, enum_t *); | 295 | extern bool_t xdr_enum(XDR *, enum_t *); | |
296 | extern bool_t xdr_array(XDR *, char **, unsigned *, unsigned, unsigned, xdrproc_t); | 296 | extern bool_t xdr_array(XDR *, char **, unsigned int *, unsigned int, | |
297 | extern bool_t xdr_bytes(XDR *, char **, unsigned *, unsigned); | 297 | unsigned int, xdrproc_t); | |
298 | extern bool_t xdr_opaque(XDR *, char *, unsigned); | 298 | extern bool_t xdr_bytes(XDR *, char **, unsigned int *, unsigned int); | |
299 | extern bool_t xdr_string(XDR *, char **, unsigned); | 299 | extern bool_t xdr_opaque(XDR *, char *, unsigned int); | |
300 | extern bool_t xdr_string(XDR *, char **, unsigned int); | |||
300 | extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t); | 301 | extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t); | |
301 | extern bool_t xdr_char(XDR *, char *); | 302 | extern bool_t xdr_char(XDR *, char *); | |
302 | extern bool_t xdr_u_char(XDR *, unsigned char *); | 303 | extern bool_t xdr_u_char(XDR *, unsigned char *); | |
303 | extern bool_t xdr_vector(XDR *, char *, unsigned, unsigned, xdrproc_t); | 304 | extern bool_t xdr_vector(XDR *, char *, unsigned int, unsigned int, | |
305 | xdrproc_t); | |||
304 | extern bool_t xdr_float(XDR *, float *); | 306 | extern bool_t xdr_float(XDR *, float *); | |
305 | extern bool_t xdr_double(XDR *, double *); | 307 | extern bool_t xdr_double(XDR *, double *); | |
306 | extern bool_t xdr_quadruple(XDR *, long double *); | 308 | extern bool_t xdr_quadruple(XDR *, long double *); | |
307 | extern bool_t xdr_reference(XDR *, char **, unsigned, xdrproc_t); | 309 | extern bool_t xdr_reference(XDR *, char **, unsigned int, xdrproc_t); | |
308 | extern bool_t xdr_pointer(XDR *, char **, unsigned, xdrproc_t); | 310 | extern bool_t xdr_pointer(XDR *, char **, unsigned int, xdrproc_t); | |
309 | extern bool_t xdr_wrapstring(XDR *, char **); | 311 | extern bool_t xdr_wrapstring(XDR *, char **); | |
310 | extern void xdr_free(xdrproc_t, char *); | 312 | extern void xdr_free(xdrproc_t, char *); | |
311 | extern bool_t xdr_hyper(XDR *, longlong_t *); | 313 | extern bool_t xdr_hyper(XDR *, longlong_t *); | |
312 | extern bool_t xdr_u_hyper(XDR *, u_longlong_t *); | 314 | extern bool_t xdr_u_hyper(XDR *, u_longlong_t *); | |
313 | extern bool_t xdr_longlong_t(XDR *, longlong_t *); | 315 | extern bool_t xdr_longlong_t(XDR *, longlong_t *); | |
314 | extern bool_t xdr_u_longlong_t(XDR *, u_longlong_t *); | 316 | extern bool_t xdr_u_longlong_t(XDR *, u_longlong_t *); | |
315 | extern unsigned long xdr_sizeof(xdrproc_t, void *); | 317 | extern unsigned long xdr_sizeof(xdrproc_t, void *); | |
316 | __END_DECLS | 318 | __END_DECLS | |
317 | 319 | |||
318 | /* | 320 | /* | |
319 | * Common opaque bytes objects used by many rpc protocols; | 321 | * Common opaque bytes objects used by many rpc protocols; | |
320 | * declared here due to commonality. | 322 | * declared here due to commonality. | |
321 | */ | 323 | */ | |
322 | #define MAX_NETOBJ_SZ 1024 | 324 | #define MAX_NETOBJ_SZ 1024 | |
323 | struct netobj { | 325 | struct netobj { | |
324 | unsigned n_len; | 326 | unsigned int n_len; | |
325 | char *n_bytes; | 327 | char *n_bytes; | |
326 | }; | 328 | }; | |
327 | typedef struct netobj netobj; | 329 | typedef struct netobj netobj; | |
328 | extern bool_t xdr_netobj(XDR *, struct netobj *); | 330 | extern bool_t xdr_netobj(XDR *, struct netobj *); | |
329 | 331 | |||
330 | /* | 332 | /* | |
331 | * These are the public routines for the various implementations of | 333 | * These are the public routines for the various implementations of | |
332 | * xdr streams. | 334 | * xdr streams. | |
333 | */ | 335 | */ | |
334 | __BEGIN_DECLS | 336 | __BEGIN_DECLS | |
335 | /* XDR using memory buffers */ | 337 | /* XDR using memory buffers */ | |
336 | extern void xdrmem_create(XDR *, char *, unsigned, enum xdr_op); | 338 | extern void xdrmem_create(XDR *, char *, unsigned int, enum xdr_op); | |
337 | 339 | |||
338 | /* XDR using stdio library */ | 340 | /* XDR using stdio library */ | |
339 | #ifdef _STDIO_H_ | 341 | #ifdef _STDIO_H_ | |
340 | extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); | 342 | extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); | |
341 | #endif | 343 | #endif | |
342 | 344 | |||
343 | /* XDR pseudo records for tcp */ | 345 | /* XDR pseudo records for tcp */ | |
344 | extern void xdrrec_create(XDR *, unsigned, unsigned, char *, | 346 | extern void xdrrec_create(XDR *, unsigned int, unsigned int, char *, | |
345 | int (*)(char *, char *, int), | 347 | int (*)(char *, char *, int), | |
346 | int (*)(char *, char *, int)); | 348 | int (*)(char *, char *, int)); | |
347 | 349 | |||
348 | /* make end of xdr record */ | 350 | /* make end of xdr record */ | |
349 | extern bool_t xdrrec_endofrecord(XDR *, int); | 351 | extern bool_t xdrrec_endofrecord(XDR *, int); | |
350 | 352 | |||
351 | /* move to beginning of next record */ | 353 | /* move to beginning of next record */ | |
352 | extern bool_t xdrrec_skiprecord(XDR *); | 354 | extern bool_t xdrrec_skiprecord(XDR *); | |
353 | 355 | |||
354 | /* true if no more input */ | 356 | /* true if no more input */ | |
355 | extern bool_t xdrrec_eof(XDR *); | 357 | extern bool_t xdrrec_eof(XDR *); | |
356 | extern unsigned xdrrec_readbytes(XDR *, caddr_t, unsigned); | 358 | extern unsigned xdrrec_readbytes(XDR *, caddr_t, unsigned int); | |
357 | __END_DECLS | 359 | __END_DECLS | |
358 | 360 | |||
359 | #endif /* !_RPC_XDR_H_ */ | 361 | #endif /* !_RPC_XDR_H_ */ |