1 1.24 dholland /* $NetBSD: clnt.h,v 1.24 2016/01/23 02:34:09 dholland Exp $ */ 2 1.4 cgd 3 1.1 deraadt /* 4 1.1 deraadt * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5 1.1 deraadt * unrestricted use provided that this legend is included on all tape 6 1.1 deraadt * media and as a part of the software program in whole or part. Users 7 1.1 deraadt * may copy or modify Sun RPC without charge, but are not authorized 8 1.1 deraadt * to license or distribute it to anyone else except as part of a product or 9 1.1 deraadt * program developed by the user. 10 1.1 deraadt * 11 1.1 deraadt * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 12 1.1 deraadt * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 13 1.1 deraadt * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 14 1.1 deraadt * 15 1.1 deraadt * Sun RPC is provided with no support and without any obligation on the 16 1.1 deraadt * part of Sun Microsystems, Inc. to assist in its use, correction, 17 1.1 deraadt * modification or enhancement. 18 1.1 deraadt * 19 1.1 deraadt * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 20 1.1 deraadt * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 21 1.1 deraadt * OR ANY PART THEREOF. 22 1.1 deraadt * 23 1.1 deraadt * In no event will Sun Microsystems, Inc. be liable for any lost revenue 24 1.1 deraadt * or profits or other special, indirect and consequential damages, even if 25 1.1 deraadt * Sun has been advised of the possibility of such damages. 26 1.1 deraadt * 27 1.1 deraadt * Sun Microsystems, Inc. 28 1.1 deraadt * 2550 Garcia Avenue 29 1.1 deraadt * Mountain View, California 94043 30 1.3 mycroft * 31 1.14 fvdl * from: @(#)clnt.h 1.31 94/04/29 SMI 32 1.4 cgd * @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC 33 1.1 deraadt */ 34 1.1 deraadt 35 1.1 deraadt /* 36 1.1 deraadt * clnt.h - Client side remote procedure call interface. 37 1.1 deraadt * 38 1.1 deraadt * Copyright (C) 1984, Sun Microsystems, Inc. 39 1.1 deraadt */ 40 1.1 deraadt 41 1.2 brezak #ifndef _RPC_CLNT_H_ 42 1.2 brezak #define _RPC_CLNT_H_ 43 1.2 brezak #include <sys/cdefs.h> 44 1.17 fvdl 45 1.17 fvdl #include <rpc/rpc_com.h> 46 1.1 deraadt 47 1.1 deraadt /* 48 1.14 fvdl * Well-known IPV6 RPC broadcast address. 49 1.14 fvdl */ 50 1.14 fvdl #define RPCB_MULTICAST_ADDR "ff02::202" 51 1.14 fvdl 52 1.14 fvdl /* 53 1.10 lukem * Rpc calls return an enum clnt_stat. This should be looked at more, 54 1.1 deraadt * since each implementation is required to live with this (implementation 55 1.1 deraadt * independent) list of errors. 56 1.1 deraadt */ 57 1.1 deraadt enum clnt_stat { 58 1.1 deraadt RPC_SUCCESS=0, /* call succeeded */ 59 1.1 deraadt /* 60 1.1 deraadt * local errors 61 1.1 deraadt */ 62 1.1 deraadt RPC_CANTENCODEARGS=1, /* can't encode arguments */ 63 1.1 deraadt RPC_CANTDECODERES=2, /* can't decode results */ 64 1.1 deraadt RPC_CANTSEND=3, /* failure in sending call */ 65 1.1 deraadt RPC_CANTRECV=4, /* failure in receiving result */ 66 1.1 deraadt RPC_TIMEDOUT=5, /* call timed out */ 67 1.1 deraadt /* 68 1.1 deraadt * remote errors 69 1.1 deraadt */ 70 1.10 lukem RPC_VERSMISMATCH=6, /* rpc versions not compatible */ 71 1.1 deraadt RPC_AUTHERROR=7, /* authentication error */ 72 1.1 deraadt RPC_PROGUNAVAIL=8, /* program not available */ 73 1.1 deraadt RPC_PROGVERSMISMATCH=9, /* program version mismatched */ 74 1.1 deraadt RPC_PROCUNAVAIL=10, /* procedure unavailable */ 75 1.1 deraadt RPC_CANTDECODEARGS=11, /* decode arguments error */ 76 1.1 deraadt RPC_SYSTEMERROR=12, /* generic "other problem" */ 77 1.1 deraadt 78 1.1 deraadt /* 79 1.14 fvdl * rpc_call & clnt_create errors 80 1.1 deraadt */ 81 1.1 deraadt RPC_UNKNOWNHOST=13, /* unknown host name */ 82 1.18 wiz RPC_UNKNOWNPROTO=17, /* unknown protocol */ 83 1.14 fvdl RPC_UNKNOWNADDR = 19, /* Remote address unknown */ 84 1.14 fvdl RPC_NOBROADCAST = 21, /* Broadcasting not supported */ 85 1.1 deraadt 86 1.1 deraadt /* 87 1.14 fvdl * rpcbind errors 88 1.1 deraadt */ 89 1.14 fvdl RPC_RPCBFAILURE=14, /* the pmapper failed in its call */ 90 1.14 fvdl #define RPC_PMAPFAILURE RPC_RPCBFAILURE 91 1.1 deraadt RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ 92 1.14 fvdl RPC_N2AXLATEFAILURE = 22, /* name -> addr translation failed */ 93 1.14 fvdl 94 1.14 fvdl /* 95 1.14 fvdl * Misc error in the TLI library (provided for compatibility) 96 1.14 fvdl */ 97 1.14 fvdl RPC_TLIERROR = 20, 98 1.14 fvdl 99 1.1 deraadt /* 100 1.1 deraadt * unspecified error 101 1.1 deraadt */ 102 1.14 fvdl RPC_FAILED=16, 103 1.14 fvdl 104 1.14 fvdl /* 105 1.14 fvdl * asynchronous errors 106 1.14 fvdl */ 107 1.14 fvdl RPC_INPROGRESS = 24, 108 1.14 fvdl RPC_STALERACHANDLE = 25 109 1.1 deraadt }; 110 1.1 deraadt 111 1.1 deraadt 112 1.1 deraadt /* 113 1.1 deraadt * Error info. 114 1.1 deraadt */ 115 1.1 deraadt struct rpc_err { 116 1.1 deraadt enum clnt_stat re_status; 117 1.1 deraadt union { 118 1.11 lukem int RE_errno; /* related system error */ 119 1.1 deraadt enum auth_stat RE_why; /* why the auth error occurred */ 120 1.1 deraadt struct { 121 1.14 fvdl rpcvers_t low; /* lowest version supported */ 122 1.14 fvdl rpcvers_t high; /* highest version supported */ 123 1.1 deraadt } RE_vers; 124 1.1 deraadt struct { /* maybe meaningful if RPC_FAILED */ 125 1.6 cgd int32_t s1; 126 1.6 cgd int32_t s2; 127 1.1 deraadt } RE_lb; /* life boot & debugging only */ 128 1.1 deraadt } ru; 129 1.1 deraadt #define re_errno ru.RE_errno 130 1.1 deraadt #define re_why ru.RE_why 131 1.1 deraadt #define re_vers ru.RE_vers 132 1.1 deraadt #define re_lb ru.RE_lb 133 1.1 deraadt }; 134 1.1 deraadt 135 1.1 deraadt 136 1.1 deraadt /* 137 1.10 lukem * Client rpc handle. 138 1.14 fvdl * Created by individual implementations 139 1.1 deraadt * Client is responsible for initializing auth, see e.g. auth_none.c. 140 1.1 deraadt */ 141 1.5 cgd typedef struct __rpc_client { 142 1.1 deraadt AUTH *cl_auth; /* authenticator */ 143 1.12 mycroft const struct clnt_ops { 144 1.10 lukem /* call remote procedure */ 145 1.19 perry enum clnt_stat (*cl_call)(struct __rpc_client *, 146 1.20 yamt rpcproc_t, xdrproc_t, const char *, 147 1.20 yamt xdrproc_t, caddr_t, struct timeval); 148 1.10 lukem /* abort a call */ 149 1.19 perry void (*cl_abort)(struct __rpc_client *); 150 1.10 lukem /* get specific error code */ 151 1.19 perry void (*cl_geterr)(struct __rpc_client *, 152 1.19 perry struct rpc_err *); 153 1.10 lukem /* frees results */ 154 1.19 perry bool_t (*cl_freeres)(struct __rpc_client *, 155 1.19 perry xdrproc_t, caddr_t); 156 1.10 lukem /* destroy this structure */ 157 1.19 perry void (*cl_destroy)(struct __rpc_client *); 158 1.10 lukem /* the ioctl() of rpc */ 159 1.24 dholland bool_t (*cl_control)(struct __rpc_client *, 160 1.24 dholland unsigned int, char *); 161 1.1 deraadt } *cl_ops; 162 1.13 christos void *cl_private; /* private stuff */ 163 1.14 fvdl char *cl_netid; /* network token */ 164 1.14 fvdl char *cl_tp; /* device name */ 165 1.1 deraadt } CLIENT; 166 1.1 deraadt 167 1.1 deraadt 168 1.1 deraadt /* 169 1.14 fvdl * Timers used for the pseudo-transport protocol when using datagrams 170 1.14 fvdl */ 171 1.14 fvdl struct rpc_timers { 172 1.23 dholland unsigned short rt_srtt; /* smoothed round-trip time */ 173 1.23 dholland unsigned short rt_deviate; /* estimated deviation */ 174 1.23 dholland unsigned long rt_rtxcur; /* current (backed-off) rto */ 175 1.14 fvdl }; 176 1.14 fvdl 177 1.14 fvdl /* 178 1.14 fvdl * Feedback values used for possible congestion and rate control 179 1.14 fvdl */ 180 1.14 fvdl #define FEEDBACK_REXMIT1 1 /* first retransmit */ 181 1.14 fvdl #define FEEDBACK_OK 2 /* no retransmits */ 182 1.14 fvdl 183 1.14 fvdl /* Used to set version of portmapper used in broadcast */ 184 1.14 fvdl 185 1.14 fvdl #define CLCR_SET_LOWVERS 3 186 1.14 fvdl #define CLCR_GET_LOWVERS 4 187 1.14 fvdl 188 1.14 fvdl #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ 189 1.14 fvdl 190 1.14 fvdl /* 191 1.10 lukem * client side rpc interface ops 192 1.1 deraadt * 193 1.1 deraadt * Parameter types are: 194 1.1 deraadt * 195 1.1 deraadt */ 196 1.1 deraadt 197 1.1 deraadt /* 198 1.1 deraadt * enum clnt_stat 199 1.1 deraadt * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) 200 1.10 lukem * CLIENT *rh; 201 1.14 fvdl * rpcproc_t proc; 202 1.10 lukem * xdrproc_t xargs; 203 1.10 lukem * caddr_t argsp; 204 1.10 lukem * xdrproc_t xres; 205 1.10 lukem * caddr_t resp; 206 1.10 lukem * struct timeval timeout; 207 1.1 deraadt */ 208 1.5 cgd #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ 209 1.21 plunky ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ 210 1.21 plunky (const char *)(const void *)(argsp), (xdrproc_t)xres, \ 211 1.21 plunky (caddr_t)(void *)resp, secs)) 212 1.5 cgd #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ 213 1.21 plunky ((*(rh)->cl_ops->cl_call)(rh, proc, (xdrproc_t)xargs, \ 214 1.21 plunky (const char *)(const void *)(argsp), (xdrproc_t)xres, \ 215 1.21 plunky (caddr_t)(void *)resp, secs)) 216 1.1 deraadt 217 1.1 deraadt /* 218 1.1 deraadt * void 219 1.1 deraadt * CLNT_ABORT(rh); 220 1.10 lukem * CLIENT *rh; 221 1.1 deraadt */ 222 1.1 deraadt #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 223 1.1 deraadt #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 224 1.1 deraadt 225 1.1 deraadt /* 226 1.1 deraadt * struct rpc_err 227 1.1 deraadt * CLNT_GETERR(rh); 228 1.10 lukem * CLIENT *rh; 229 1.1 deraadt */ 230 1.1 deraadt #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 231 1.1 deraadt #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 232 1.1 deraadt 233 1.1 deraadt 234 1.1 deraadt /* 235 1.1 deraadt * bool_t 236 1.1 deraadt * CLNT_FREERES(rh, xres, resp); 237 1.10 lukem * CLIENT *rh; 238 1.10 lukem * xdrproc_t xres; 239 1.10 lukem * caddr_t resp; 240 1.1 deraadt */ 241 1.1 deraadt #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) 242 1.1 deraadt #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) 243 1.1 deraadt 244 1.1 deraadt /* 245 1.1 deraadt * bool_t 246 1.1 deraadt * CLNT_CONTROL(cl, request, info) 247 1.10 lukem * CLIENT *cl; 248 1.23 dholland * unsigned request; 249 1.10 lukem * char *info; 250 1.1 deraadt */ 251 1.1 deraadt #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) 252 1.1 deraadt #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) 253 1.1 deraadt 254 1.1 deraadt /* 255 1.1 deraadt * control operations that apply to both udp and tcp transports 256 1.1 deraadt */ 257 1.14 fvdl #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ 258 1.14 fvdl #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ 259 1.14 fvdl #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ 260 1.14 fvdl #define CLGET_FD 6 /* get connections file descriptor */ 261 1.14 fvdl #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ 262 1.14 fvdl #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ 263 1.14 fvdl #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ 264 1.14 fvdl #define CLGET_XID 10 /* Get xid */ 265 1.14 fvdl #define CLSET_XID 11 /* Set xid */ 266 1.14 fvdl #define CLGET_VERS 12 /* Get version number */ 267 1.14 fvdl #define CLSET_VERS 13 /* Set version number */ 268 1.14 fvdl #define CLGET_PROG 14 /* Get program number */ 269 1.14 fvdl #define CLSET_PROG 15 /* Set program number */ 270 1.14 fvdl #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ 271 1.14 fvdl #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ 272 1.14 fvdl #define CLSET_POP_TIMOD 18 /* pop timod */ 273 1.1 deraadt /* 274 1.14 fvdl * Connectionless only control operations 275 1.1 deraadt */ 276 1.1 deraadt #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ 277 1.1 deraadt #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ 278 1.1 deraadt 279 1.1 deraadt /* 280 1.1 deraadt * void 281 1.1 deraadt * CLNT_DESTROY(rh); 282 1.10 lukem * CLIENT *rh; 283 1.1 deraadt */ 284 1.1 deraadt #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 285 1.1 deraadt #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 286 1.1 deraadt 287 1.1 deraadt 288 1.1 deraadt /* 289 1.16 wiz * RPCTEST is a test program which is accessible on every rpc 290 1.1 deraadt * transport/port. It is used for testing, performance evaluation, 291 1.1 deraadt * and network administration. 292 1.1 deraadt */ 293 1.1 deraadt 294 1.14 fvdl #define RPCTEST_PROGRAM ((rpcprog_t)1) 295 1.14 fvdl #define RPCTEST_VERSION ((rpcvers_t)1) 296 1.14 fvdl #define RPCTEST_NULL_PROC ((rpcproc_t)2) 297 1.14 fvdl #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) 298 1.1 deraadt 299 1.1 deraadt /* 300 1.1 deraadt * By convention, procedure 0 takes null arguments and returns them 301 1.1 deraadt */ 302 1.1 deraadt 303 1.14 fvdl #define NULLPROC ((rpcproc_t)0) 304 1.1 deraadt 305 1.1 deraadt /* 306 1.1 deraadt * Below are the client handle creation routines for the various 307 1.14 fvdl * implementations of client side rpc. They can return NULL if a 308 1.14 fvdl * creation failure occurs. 309 1.14 fvdl */ 310 1.1 deraadt 311 1.1 deraadt /* 312 1.14 fvdl * Generic client creation routine. Supported protocols are those that 313 1.14 fvdl * belong to the nettype namespace (/etc/netconfig). 314 1.1 deraadt * CLIENT * 315 1.14 fvdl * clnt_create(host, prog, vers, prot); 316 1.14 fvdl * const char *host; -- hostname 317 1.14 fvdl * const rpcprog_t prog; -- program number 318 1.14 fvdl * const rpcvers_t vers; -- version number 319 1.14 fvdl * const char *prot; -- protocol 320 1.1 deraadt */ 321 1.2 brezak __BEGIN_DECLS 322 1.19 perry extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, 323 1.19 perry const char *); 324 1.14 fvdl /* 325 1.14 fvdl * 326 1.14 fvdl * const char *hostname; -- hostname 327 1.14 fvdl * const rpcprog_t prog; -- program number 328 1.14 fvdl * const rpcvers_t vers; -- version number 329 1.14 fvdl * const char *nettype; -- network type 330 1.14 fvdl */ 331 1.14 fvdl 332 1.14 fvdl /* 333 1.14 fvdl * Generic client creation routine. Supported protocols are which belong 334 1.14 fvdl * to the nettype name space. 335 1.14 fvdl */ 336 1.19 perry extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *, 337 1.14 fvdl const rpcvers_t, const rpcvers_t, 338 1.19 perry const char *); 339 1.14 fvdl /* 340 1.14 fvdl * const char *host; -- hostname 341 1.14 fvdl * const rpcprog_t prog; -- program number 342 1.14 fvdl * rpcvers_t *vers_out; -- servers highest available version 343 1.14 fvdl * const rpcvers_t vers_low; -- low version number 344 1.14 fvdl * const rpcvers_t vers_high; -- high version number 345 1.14 fvdl * const char *nettype; -- network type 346 1.14 fvdl */ 347 1.1 deraadt 348 1.1 deraadt 349 1.1 deraadt /* 350 1.14 fvdl * Generic client creation routine. It takes a netconfig structure 351 1.14 fvdl * instead of nettype 352 1.14 fvdl */ 353 1.19 perry extern CLIENT *clnt_tp_create(const char *, const rpcprog_t, 354 1.19 perry const rpcvers_t, const struct netconfig *); 355 1.14 fvdl /* 356 1.14 fvdl * const char *hostname; -- hostname 357 1.14 fvdl * const rpcprog_t prog; -- program number 358 1.14 fvdl * const rpcvers_t vers; -- version number 359 1.14 fvdl * const struct netconfig *netconf; -- network config structure 360 1.14 fvdl */ 361 1.14 fvdl 362 1.14 fvdl /* 363 1.14 fvdl * Generic TLI create routine. Only provided for compatibility. 364 1.2 brezak */ 365 1.1 deraadt 366 1.19 perry extern CLIENT *clnt_tli_create(const int, const struct netconfig *, 367 1.14 fvdl const struct netbuf *, const rpcprog_t, 368 1.24 dholland const rpcvers_t, const unsigned int, 369 1.24 dholland const unsigned int); 370 1.14 fvdl /* 371 1.14 fvdl * const register int fd; -- fd 372 1.14 fvdl * const struct netconfig *nconf; -- netconfig structure 373 1.14 fvdl * const struct netbuf *svcaddr; -- servers address 374 1.23 dholland * const unsigned long prog; -- program number 375 1.23 dholland * const unsigned long vers; -- version number 376 1.23 dholland * const unsigned sendsz; -- send size 377 1.23 dholland * const unsigned recvsz; -- recv size 378 1.14 fvdl */ 379 1.1 deraadt 380 1.1 deraadt /* 381 1.14 fvdl * Low level clnt create routine for connectionful transports, e.g. tcp. 382 1.14 fvdl */ 383 1.19 perry extern CLIENT *clnt_vc_create(const int, const struct netbuf *, 384 1.14 fvdl const rpcprog_t, const rpcvers_t, 385 1.24 dholland const unsigned int, const unsigned int); 386 1.14 fvdl /* 387 1.14 fvdl * const int fd; -- open file descriptor 388 1.14 fvdl * const struct netbuf *svcaddr; -- servers address 389 1.14 fvdl * const rpcprog_t prog; -- program number 390 1.14 fvdl * const rpcvers_t vers; -- version number 391 1.23 dholland * const unsigned sendsz; -- buffer recv size 392 1.23 dholland * const unsigned recvsz; -- buffer send size 393 1.1 deraadt */ 394 1.1 deraadt 395 1.14 fvdl /* 396 1.14 fvdl * Low level clnt create routine for connectionless transports, e.g. udp. 397 1.14 fvdl */ 398 1.19 perry extern CLIENT *clnt_dg_create(const int, const struct netbuf *, 399 1.14 fvdl const rpcprog_t, const rpcvers_t, 400 1.24 dholland const unsigned int, const unsigned int); 401 1.14 fvdl /* 402 1.14 fvdl * const int fd; -- open file descriptor 403 1.14 fvdl * const struct netbuf *svcaddr; -- servers address 404 1.14 fvdl * const rpcprog_t program; -- program number 405 1.14 fvdl * const rpcvers_t version; -- version number 406 1.23 dholland * const unsigned sendsz; -- buffer recv size 407 1.23 dholland * const unsigned recvsz; -- buffer send size 408 1.14 fvdl */ 409 1.2 brezak 410 1.1 deraadt /* 411 1.14 fvdl * Memory based rpc (for speed check and testing) 412 1.1 deraadt * CLIENT * 413 1.14 fvdl * clnt_raw_create(prog, vers) 414 1.23 dholland * unsigned long prog; 415 1.23 dholland * unsigned long vers; 416 1.1 deraadt */ 417 1.19 perry extern CLIENT *clnt_raw_create (rpcprog_t, rpcvers_t); 418 1.14 fvdl 419 1.2 brezak __END_DECLS 420 1.2 brezak 421 1.1 deraadt 422 1.1 deraadt /* 423 1.1 deraadt * Print why creation failed 424 1.1 deraadt */ 425 1.2 brezak __BEGIN_DECLS 426 1.19 perry extern void clnt_pcreateerror (const char *); /* stderr */ 427 1.19 perry extern char *clnt_spcreateerror (const char *); /* string */ 428 1.2 brezak __END_DECLS 429 1.1 deraadt 430 1.1 deraadt /* 431 1.1 deraadt * Like clnt_perror(), but is more verbose in its output 432 1.1 deraadt */ 433 1.2 brezak __BEGIN_DECLS 434 1.19 perry extern void clnt_perrno (enum clnt_stat); /* stderr */ 435 1.19 perry extern char *clnt_sperrno (enum clnt_stat); /* string */ 436 1.2 brezak __END_DECLS 437 1.1 deraadt 438 1.1 deraadt /* 439 1.1 deraadt * Print an English error message, given the client error code 440 1.1 deraadt */ 441 1.2 brezak __BEGIN_DECLS 442 1.19 perry extern void clnt_perror (CLIENT *, const char *); /* stderr */ 443 1.19 perry extern char *clnt_sperror (CLIENT *, const char *); /* string */ 444 1.2 brezak __END_DECLS 445 1.2 brezak 446 1.1 deraadt 447 1.1 deraadt /* 448 1.1 deraadt * If a creation fails, the following allows the user to figure out why. 449 1.1 deraadt */ 450 1.1 deraadt struct rpc_createerr { 451 1.1 deraadt enum clnt_stat cf_stat; 452 1.1 deraadt struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ 453 1.1 deraadt }; 454 1.1 deraadt 455 1.14 fvdl __BEGIN_DECLS 456 1.19 perry extern struct rpc_createerr *__rpc_createerr(void); 457 1.14 fvdl __END_DECLS 458 1.14 fvdl #define rpc_createerr (*(__rpc_createerr())) 459 1.14 fvdl 460 1.14 fvdl /* 461 1.14 fvdl * The simplified interface: 462 1.14 fvdl * enum clnt_stat 463 1.14 fvdl * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) 464 1.14 fvdl * const char *host; 465 1.14 fvdl * const rpcprog_t prognum; 466 1.14 fvdl * const rpcvers_t versnum; 467 1.14 fvdl * const rpcproc_t procnum; 468 1.14 fvdl * const xdrproc_t inproc, outproc; 469 1.14 fvdl * const char *in; 470 1.14 fvdl * char *out; 471 1.14 fvdl * const char *nettype; 472 1.14 fvdl */ 473 1.14 fvdl __BEGIN_DECLS 474 1.19 perry extern enum clnt_stat rpc_call(const char *, const rpcprog_t, 475 1.14 fvdl const rpcvers_t, const rpcproc_t, 476 1.14 fvdl const xdrproc_t, const char *, 477 1.19 perry const xdrproc_t, char *, const char *); 478 1.14 fvdl __END_DECLS 479 1.1 deraadt 480 1.14 fvdl /* 481 1.14 fvdl * RPC broadcast interface 482 1.14 fvdl * The call is broadcasted to all locally connected nets. 483 1.14 fvdl * 484 1.14 fvdl * extern enum clnt_stat 485 1.14 fvdl * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, 486 1.14 fvdl * eachresult, nettype) 487 1.14 fvdl * const rpcprog_t prog; -- program number 488 1.14 fvdl * const rpcvers_t vers; -- version number 489 1.14 fvdl * const rpcproc_t proc; -- procedure number 490 1.14 fvdl * const xdrproc_t xargs; -- xdr routine for args 491 1.14 fvdl * caddr_t argsp; -- pointer to args 492 1.14 fvdl * const xdrproc_t xresults; -- xdr routine for results 493 1.14 fvdl * caddr_t resultsp; -- pointer to results 494 1.14 fvdl * const resultproc_t eachresult; -- call with each result 495 1.14 fvdl * const char *nettype; -- Transport type 496 1.14 fvdl * 497 1.14 fvdl * For each valid response received, the procedure eachresult is called. 498 1.14 fvdl * Its form is: 499 1.14 fvdl * done = eachresult(resp, raddr, nconf) 500 1.14 fvdl * bool_t done; 501 1.14 fvdl * caddr_t resp; 502 1.14 fvdl * struct netbuf *raddr; 503 1.14 fvdl * struct netconfig *nconf; 504 1.14 fvdl * where resp points to the results of the call and raddr is the 505 1.14 fvdl * address if the responder to the broadcast. nconf is the transport 506 1.14 fvdl * on which the response was received. 507 1.14 fvdl * 508 1.14 fvdl * extern enum clnt_stat 509 1.14 fvdl * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, 510 1.14 fvdl * eachresult, inittime, waittime, nettype) 511 1.14 fvdl * const rpcprog_t prog; -- program number 512 1.14 fvdl * const rpcvers_t vers; -- version number 513 1.14 fvdl * const rpcproc_t proc; -- procedure number 514 1.14 fvdl * const xdrproc_t xargs; -- xdr routine for args 515 1.14 fvdl * caddr_t argsp; -- pointer to args 516 1.14 fvdl * const xdrproc_t xresults; -- xdr routine for results 517 1.14 fvdl * caddr_t resultsp; -- pointer to results 518 1.14 fvdl * const resultproc_t eachresult; -- call with each result 519 1.14 fvdl * const int inittime; -- how long to wait initially 520 1.14 fvdl * const int waittime; -- maximum time to wait 521 1.14 fvdl * const char *nettype; -- Transport type 522 1.14 fvdl */ 523 1.14 fvdl 524 1.19 perry typedef bool_t (*resultproc_t)(caddr_t, ...); 525 1.14 fvdl 526 1.14 fvdl __BEGIN_DECLS 527 1.19 perry extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, 528 1.20 yamt const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, 529 1.20 yamt const resultproc_t, const char *); 530 1.19 perry extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, 531 1.20 yamt const rpcproc_t, const xdrproc_t, const char *, const xdrproc_t, caddr_t, 532 1.20 yamt const resultproc_t, const int, const int, const char *); 533 1.14 fvdl __END_DECLS 534 1.1 deraadt 535 1.14 fvdl /* For backward compatibility */ 536 1.14 fvdl #include <rpc/clnt_soc.h> 537 1.1 deraadt 538 1.7 perry #endif /* !_RPC_CLNT_H_ */ 539