Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/rpc/clnt.h
$ cat -n /usr/include/ntirpc/rpc/clnt.h 1 /* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */ 2 3 /* 4 * Copyright (c) 2010, Oracle America, Inc. 5 * Copyright (c) 2012-2018 Red Hat, Inc. and/or its affiliates. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * - Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * - Neither the name of the "Oracle America, Inc." nor the names of its 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 * 31 * from: @(#)clnt.h 1.31 94/04/29 SMI 32 * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC 33 * $FreeBSD: src/include/rpc/clnt.h,v 1.21 2003/01/24 01:47:55 fjoe Exp $ 34 */ 35 36 /* 37 * clnt.h - Client side remote procedure call interface. 38 * 39 * (1) There is only one SVCXPRT (service transport) per connection. 40 * (2) There can be several CLIENT per SVCXPRT. 41 * (3) Each CLIENT rpc_err cl_error is idempotent, initially 42 * RPC_SUCCESS (0). Once set to anything else, it should never be 43 * modified, and CLNT_DESTROY() should be invoked. 44 * (4) There can be many asynchronous clnt_req per CLIENT. 45 * (5) Each clnt_req has its own idempotent rpc_err cc_error. 46 */ 47 48 #ifndef _TIRPC_CLNT_H_ 49 #define _TIRPC_CLNT_H_ 50 51 #include
52 #include
53 #include
54 #include
55 #include
56 #include
57 #include "reentrant.h" 58 59 #include
60 #include
61 #if !defined(_WIN32) 62 #include
63 #endif 64 65 /* 66 * Well-known IPV6 RPC broadcast address. 67 */ 68 #define RPCB_MULTICAST_ADDR "ff02::202" 69 70 /* 71 * the following errors are in general unrecoverable. The caller 72 * should give up rather than retry. 73 */ 74 #define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \ 75 ((s) == RPC_CANTENCODEARGS) || \ 76 ((s) == RPC_CANTDECODERES) || \ 77 ((s) == RPC_VERSMISMATCH) || \ 78 ((s) == RPC_PROCUNAVAIL) || \ 79 ((s) == RPC_PROGUNAVAIL) || \ 80 ((s) == RPC_PROGVERSMISMATCH) || \ 81 ((s) == RPC_CANTDECODEARGS)) 82 83 struct clnt_req; 84 typedef void (*clnt_req_freer)(struct clnt_req *, size_t); 85 86 /* 87 * Client rpc handle. 88 * Created by individual implementations 89 * Client is responsible for initializing auth, see e.g. auth_none.c. 90 */ 91 typedef struct rpc_client { 92 93 struct clnt_ops { 94 /* call remote procedure */ 95 enum clnt_stat (*cl_call) (struct clnt_req *); 96 97 /* abort a call */ 98 void (*cl_abort) (struct rpc_client *); 99 100 /* frees results */ 101 bool(*cl_freeres) (struct rpc_client *, xdrproc_t, void *); 102 103 /* release and mark destroyed */ 104 void (*cl_destroy) (struct rpc_client *); 105 106 /* the ioctl() of rpc */ 107 bool(*cl_control) (struct rpc_client *, u_int, void *); 108 } *cl_ops; 109 110 char *cl_netid; /* network token */ 111 char *cl_tp; /* device name */ 112 void *cl_u1; /* client user data */ 113 void *cl_u2; /* client user data */ 114 115 mutex_t cl_lock; /* serialize private data */ 116 struct rpc_err cl_error; /* specific error code */ 117 int32_t cl_refcnt; /* handle reference count */ 118 uint16_t cl_flags; /* state flags */ 119 120 } CLIENT; 121 122 #define CLNT_REQ_FLAG_NONE 0x0000 123 #define CLNT_REQ_FLAG_EXPIRING 0x0001 124 #define CLNT_REQ_FLAG_BACKSYNC 0x0004 125 #define CLNT_REQ_FLAG_ACKSYNC 0x0008 126 127 /* 128 * RPC context. Intended to enable efficient multiplexing of calls 129 * and replies sharing a common channel. 130 */ 131 struct clnt_req { 132 struct work_pool_entry cc_wpe; 133 struct opr_rbtree_node cc_dplx; 134 struct opr_rbtree_node cc_rqst; 135 struct waitq_entry cc_we; 136 struct opaque_auth cc_verf; 137 138 AUTH *cc_auth; 139 CLIENT *cc_clnt; 140 struct xdrpair cc_call; 141 struct xdrpair cc_reply; 142 void (*cc_process_cb)(struct clnt_req *); 143 clnt_req_freer cc_free_cb; 144 struct timespec cc_timeout; 145 struct rpc_err cc_error; 146 size_t cc_size; 147 int cc_expire_ms; 148 int cc_refreshes; 149 rpcproc_t cc_proc; 150 uint32_t cc_xid; 151 int32_t cc_refcnt; 152 uint16_t cc_flags; 153 }; 154 155 /* 156 * Timers used for the pseudo-transport protocol when using datagrams 157 */ 158 struct rpc_timers { 159 u_short rt_srtt; /* smoothed round-trip time */ 160 u_short rt_deviate; /* estimated deviation */ 161 u_long rt_rtxcur; /* current (backed-off) rto */ 162 }; 163 164 /* 165 * Feedback values used for possible congestion and rate control 166 */ 167 #define FEEDBACK_REXMIT1 1 /* first retransmit */ 168 #define FEEDBACK_OK 2 /* no retransmits */ 169 170 /* Used to set version of portmapper used in broadcast */ 171 172 #define CLCR_SET_LOWVERS 3 173 #define CLCR_GET_LOWVERS 4 174 175 #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ 176 177 /* 178 * CLNT flags 179 */ 180 181 #define CLNT_FLAG_NONE SVC_XPRT_FLAG_NONE 182 #define CLNT_FLAG_DESTROYING SVC_XPRT_FLAG_DESTROYING 183 #define CLNT_FLAG_RELEASING SVC_XPRT_FLAG_RELEASING 184 #define CLNT_FLAG_DESTROYED SVC_XPRT_FLAG_DESTROYED 185 #define CLNT_FLAG_LOCAL 0x8000 /* Client is unshared/local */ 186 187 /* 188 * CLNT_REF flags 189 */ 190 191 #define CLNT_REF_FLAG_NONE SVC_XPRT_FLAG_NONE 192 #define CLNT_REF_FLAG_LOCKED SVC_XPRT_FLAG_LOCKED 193 194 /* 195 * CLNT_RELEASE flags 196 */ 197 198 #define CLNT_RELEASE_FLAG_NONE SVC_XPRT_FLAG_NONE 199 #define CLNT_RELEASE_FLAG_LOCKED SVC_XPRT_FLAG_LOCKED 200 201 /* 202 * client side rpc interface ops 203 */ 204 #define CLNT_FAILURE(rh) ((rh)->cl_error.re_status != RPC_SUCCESS) 205 #define CLNT_SUCCESS(rh) ((rh)->cl_error.re_status == RPC_SUCCESS) 206 207 /* 208 * enum clnt_stat 209 * CLNT_CALL_BACK(cc) 210 * CLNT_CALL_ONCE(cc) 211 * CLNT_CALL_WAIT(cc) 212 * struct clnt_req *cc; 213 */ 214 #define CLNT_CALL_BACK(cc) clnt_req_callback(cc) 215 #define CLNT_CALL_ONCE(cc) ((*(cc)->cc_clnt->cl_ops->cl_call)(cc)) 216 #define CLNT_CALL_WAIT(cc) clnt_req_wait_reply(cc) 217 218 /* 219 * void 220 * CLNT_ABORT(rh); 221 * CLIENT *rh; 222 */ 223 #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 224 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 225 226 /* 227 * bool 228 * CLNT_FREERES(rh, xres, resp); 229 * CLIENT *rh; 230 * xdrproc_t xres; 231 * void *resp; 232 */ 233 #define CLNT_FREERES(rh, xres, resp) \ 234 ((*(rh)->cl_ops->cl_freeres)(rh, xres, resp)) 235 #define clnt_freeres(rh, xres, resp) \ 236 ((*(rh)->cl_ops->cl_freeres)(rh, xres, resp)) 237 238 /* 239 * bool 240 * CLNT_CONTROL(cl, request, info) 241 * CLIENT *cl; 242 * u_int request; 243 * char *info; 244 */ 245 #define CLNT_CONTROL(cl, rq, in) \ 246 ((*(cl)->cl_ops->cl_control)(cl, rq, in)) 247 #define clnt_control(cl, rq, in) \ 248 ((*(cl)->cl_ops->cl_control)(cl, rq, in)) 249 250 /* 251 * control operations that apply to all transports 252 */ 253 /* reserved 1 */ 254 /* reserved 2 */ 255 #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ 256 /* reserved 4 */ 257 /* reserved 5 */ 258 #define CLGET_FD 6 /* get connections file descriptor */ 259 #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ 260 #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ 261 #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ 262 #define CLGET_XID 10 /* Get xid */ 263 #define CLSET_XID 11 /* Set xid */ 264 #define CLGET_VERS 12 /* Get version number */ 265 #define CLSET_VERS 13 /* Set version number */ 266 #define CLGET_PROG 14 /* Get program number */ 267 #define CLSET_PROG 15 /* Set program number */ 268 #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ 269 #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ 270 #define CLSET_POP_TIMOD 18 /* pop timod */ 271 272 /* Protect a CLIENT with a CLNT_REF for each call or request. 273 */ 274 static inline void clnt_ref_it(CLIENT *clnt, uint32_t flags, 275 const char *tag, const int line) 276 { 277 int32_t refs = atomic_inc_int32_t(&clnt->cl_refcnt); 278 279 if (flags & CLNT_REF_FLAG_LOCKED) { 280 /* unlock before warning trace */ 281 mutex_unlock(&clnt->cl_lock); 282 } 283 __warnx(TIRPC_DEBUG_FLAG_REFCNT, "%s: %p %" PRId32 " @%s:%d", 284 __func__, clnt, refs, tag, line); 285 } 286 #define CLNT_REF(clnt, flags) \ 287 clnt_ref_it(clnt, flags, __func__, __LINE__) 288 289 static inline void clnt_release_it(CLIENT *clnt, uint32_t flags, 290 const char *tag, const int line) 291 { 292 int32_t refs = atomic_dec_int32_t(&clnt->cl_refcnt); 293 uint16_t cl_flags; 294 295 if (flags & CLNT_RELEASE_FLAG_LOCKED) { 296 /* unlock before warning trace */ 297 mutex_unlock(&clnt->cl_lock); 298 } 299 __warnx(TIRPC_DEBUG_FLAG_REFCNT, "%s: %p %" PRId32 " @%s:%d", 300 __func__, clnt, refs, tag, line); 301 302 if (likely(refs > 0)) { 303 /* normal case */ 304 return; 305 } 306 307 /* enforce once-only semantic, trace others */ 308 cl_flags = atomic_postset_uint16_t_bits(&clnt->cl_flags, 309 CLNT_FLAG_RELEASING); 310 311 if (cl_flags & CLNT_FLAG_RELEASING) { 312 __warnx(TIRPC_DEBUG_FLAG_ERROR, 313 "%s: %p WARNING! already destroying! @%s:%d", 314 __func__, clnt, tag, line); 315 return; 316 } 317 318 /* Releasing last reference */ 319 (*(clnt)->cl_ops->cl_destroy)(clnt); 320 } 321 #define CLNT_RELEASE(clnt, flags) \ 322 clnt_release_it(clnt, flags, __func__, __LINE__) 323 324 /* CLNT_DESTROY is CLNT_RELEASE with once-only semantics. Also, idempotent 325 * CLNT_FLAG_DESTROYED indicates that more references should not be taken. 326 */ 327 static inline void clnt_destroy_it(CLIENT *clnt, 328 const char *tag, const int line) 329 { 330 uint16_t flags = atomic_postset_uint16_t_bits(&clnt->cl_flags, 331 CLNT_FLAG_DESTROYING); 332 333 __warnx(TIRPC_DEBUG_FLAG_REFCNT, "%s: %p %" PRId32 " @%s:%d", 334 __func__, clnt, clnt->cl_refcnt, tag, line); 335 336 if (flags & CLNT_FLAG_DESTROYING) { 337 /* previously set, do nothing */ 338 return; 339 } 340 341 clnt_release_it(clnt, CLNT_RELEASE_FLAG_NONE, tag, line); 342 } 343 #define CLNT_DESTROY(clnt) \ 344 clnt_destroy_it(clnt, __func__, __LINE__) 345 346 /* 347 * RPCTEST is a test program which is accessible on every rpc 348 * transport/port. It is used for testing, performance evaluation, 349 * and network administration. 350 */ 351 352 #define RPCTEST_PROGRAM ((rpcprog_t)1) 353 #define RPCTEST_VERSION ((rpcvers_t)1) 354 #define RPCTEST_NULL_PROC ((rpcproc_t)2) 355 #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) 356 357 /* 358 * By convention, procedure 0 takes null arguments and returns them 359 */ 360 361 #define NULLPROC ((rpcproc_t)0) 362 363 /* 364 * Below are the client handle creation routines for the various 365 * implementations of client side rpc. 366 * 367 * Always returns CLIENT. Must check cl_error.re_status, 368 * followed by CLNT_DESTROY() as necessary. 369 */ 370 __BEGIN_DECLS 371 372 /* 373 * Generic client creation routine. Supported protocols are those that 374 * belong to the nettype namespace (/etc/netconfig). 375 */ 376 extern CLIENT *clnt_ncreate_timed(const char *, const rpcprog_t, 377 const rpcvers_t, const char *, 378 const struct timeval *); 379 /* 380 * 381 * const char *hostname; -- hostname 382 * const rpcprog_t prog; -- program number 383 * const rpcvers_t vers; -- version number 384 * const char *nettype; -- network type 385 * const struct timeval *tp; -- timeout 386 */ 387 388 /* 389 * Calls clnt_ncreate_timed() with a NULL value for the timeout 390 * pointer, indicating that the default timeout should be used. 391 */ 392 static inline CLIENT * 393 clnt_ncreate(const char *hostname, const rpcprog_t prog, const rpcvers_t vers, 394 const char *nettype) 395 { 396 return (clnt_ncreate_timed(hostname, prog, vers, nettype, NULL)); 397 } 398 399 /* 400 * Generic client creation routine. Supported protocols belong 401 * to the nettype name space. 402 */ 403 extern CLIENT *clnt_ncreate_vers_timed(const char *, const rpcprog_t, 404 rpcvers_t *, const rpcvers_t, 405 const rpcvers_t, const char *, 406 const struct timeval *); 407 /* 408 * const char *host; -- hostname 409 * const rpcprog_t prog; -- program number 410 * rpcvers_t *vers_out; -- servers highest available version 411 * const rpcvers_t vers_low; -- low version number 412 * const rpcvers_t vers_high; -- high version number 413 * const char *nettype; -- network type 414 * const struct timeval *tp -- timeout 415 */ 416 417 /* 418 * Calls clnt_create_vers_timed() with a NULL value for the timeout 419 * pointer, indicating that the default timeout should be used. 420 */ 421 static inline CLIENT * 422 clnt_ncreate_vers(const char *hostname, const rpcprog_t prog, 423 rpcvers_t *vers_out, const rpcvers_t vers_low, 424 const rpcvers_t vers_high, const char *nettype) 425 { 426 return (clnt_ncreate_vers_timed 427 (hostname, prog, vers_out, vers_low, vers_high, nettype, NULL)); 428 } 429 430 /* 431 * Generic client creation routine. It takes a netconfig structure 432 * instead of nettype 433 */ 434 extern CLIENT *clnt_tp_ncreate_timed(const char *, const rpcprog_t, 435 const rpcvers_t, const struct netconfig *, 436 const struct timeval *); 437 /* 438 * const char *hostname; -- hostname 439 * const rpcprog_t prog; -- program number 440 * const rpcvers_t vers; -- version number 441 * const struct netconfig *netconf; -- network config structure 442 * const struct timeval *tp -- timeout 443 */ 444 445 /* 446 * Calls clnt_tp_create_timed() with a NULL value for the timeout 447 * pointer, indicating that the default timeout should be used. 448 */ 449 static inline CLIENT * 450 clnt_tp_ncreate(const char *hostname, const rpcprog_t prog, 451 const rpcvers_t vers, const struct netconfig *nconf) 452 { 453 return (clnt_tp_ncreate_timed(hostname, prog, vers, nconf, NULL)); 454 } 455 456 /* 457 * Generic TLI create routine. Only provided for compatibility. 458 */ 459 460 extern CLIENT *clnt_tli_ncreate(const int, const struct netconfig *, 461 struct netbuf *, const rpcprog_t, 462 const rpcvers_t, const u_int, const u_int); 463 /* 464 * const register int fd; -- fd 465 * const struct netconfig *nconf; -- netconfig structure 466 * struct netbuf *svcaddr; -- servers address 467 * const u_long prog; -- program number 468 * const u_long vers; -- version number 469 * const u_int sendsz; -- send size 470 * const u_int recvsz; -- recv size 471 */ 472 473 /* 474 * Low level clnt create routines for connectionful transports, e.g. tcp. 475 */ 476 477 /* uint16_t actually used */ 478 #define CLNT_CREATE_FLAG_NONE SVC_CREATE_FLAG_NONE 479 #define CLNT_CREATE_FLAG_CLOSE SVC_CREATE_FLAG_CLOSE 480 481 /* uint32_t instructions */ 482 #define CLNT_CREATE_FLAG_CONNECT 0x10000000 483 #define CLNT_CREATE_FLAG_LISTEN SVC_CREATE_FLAG_LISTEN 484 #define CLNT_CREATE_FLAG_SVCXPRT 0x40000000 485 #define CLNT_CREATE_FLAG_XPRT_DOREG SVC_CREATE_FLAG_XPRT_DOREG 486 #define CLNT_CREATE_FLAG_XPRT_NOREG SVC_CREATE_FLAG_XPRT_NOREG 487 488 extern CLIENT *clnt_vc_ncreatef(const int, const struct netbuf *, 489 const rpcprog_t, const rpcvers_t, 490 const u_int, const u_int, const uint32_t); 491 492 static inline CLIENT * 493 clnt_vc_ncreate(const int fd, const struct netbuf *raddr, 494 const rpcprog_t prog, const rpcvers_t vers, 495 const u_int sendsz, const u_int recvsz) 496 { 497 return (clnt_vc_ncreatef(fd, raddr, prog, vers, sendsz, recvsz, 498 CLNT_CREATE_FLAG_CONNECT)); 499 } 500 501 /* 502 * Create a client handle from an active service transport handle. 503 */ 504 extern CLIENT *clnt_vc_ncreate_svc(const SVCXPRT *, const rpcprog_t, 505 const rpcvers_t, const uint32_t); 506 /* 507 * const SVCXPRT *xprt; -- active service xprt 508 * const rpcprog_t prog; -- RPC program number 509 * const rpcvers_t vers; -- RPC program version 510 * const uint32_t flags; -- flags 511 */ 512 513 /* 514 * Low level clnt create routine for connectionless transports, e.g. udp. 515 */ 516 extern CLIENT *clnt_dg_ncreatef(const int, const struct netbuf *, 517 const rpcprog_t, const rpcvers_t, 518 const u_int, const u_int, const uint32_t); 519 /* 520 * const int fd; -- open file descriptor 521 * const struct netbuf *svcaddr; -- servers address 522 * const rpcprog_t program; -- program number 523 * const rpcvers_t version; -- version number 524 * const u_int sendsz; -- buffer recv size 525 * const u_int recvsz; -- buffer send size 526 */ 527 528 static inline CLIENT * 529 clnt_dg_ncreate(const int fd, const struct netbuf *raddr, 530 const rpcprog_t prog, const rpcvers_t vers, 531 const u_int sendsz, const u_int recvsz) 532 { 533 return (clnt_dg_ncreatef(fd, raddr, prog, vers, sendsz, recvsz, 534 CLNT_CREATE_FLAG_NONE)); 535 } 536 537 /* 538 * Memory based rpc (for speed check and testing) 539 * CLIENT * 540 * clnt_raw_create(prog, vers) 541 * u_long prog; 542 * u_long vers; 543 */ 544 extern CLIENT *clnt_raw_ncreate(rpcprog_t, rpcvers_t); 545 546 /* 547 * Client request processing 548 */ 549 static inline void clnt_req_fill(struct clnt_req *cc, struct rpc_client *clnt, 550 AUTH *auth, rpcproc_t proc, 551 xdrproc_t xargs, void *argsp, 552 xdrproc_t xresults, void *resultsp) 553 { 554 cc->cc_clnt = clnt; 555 cc->cc_auth = auth; 556 cc->cc_proc = proc; 557 cc->cc_call.proc = xargs; 558 cc->cc_call.where = argsp; 559 cc->cc_reply.proc = xresults; 560 cc->cc_reply.where = resultsp; 561 cc->cc_verf = _null_auth; 562 563 cc->cc_free_cb = (clnt_req_freer)__ntirpc_pkg_params.free_size_; 564 cc->cc_size = sizeof(*cc); 565 cc->cc_refcnt = 1; 566 567 /* protects this */ 568 pthread_mutex_init(&cc->cc_we.mtx, NULL); 569 pthread_mutex_lock(&cc->cc_we.mtx); 570 pthread_cond_init(&cc->cc_we.cv, 0); 571 } 572 573 static inline void clnt_req_fini(struct clnt_req *cc) 574 { 575 pthread_cond_destroy(&cc->cc_we.cv); 576 pthread_mutex_unlock(&cc->cc_we.mtx); 577 pthread_mutex_destroy(&cc->cc_we.mtx); 578 } 579 580 enum clnt_stat clnt_req_callback(struct clnt_req *); 581 enum clnt_stat clnt_req_refresh(struct clnt_req *); 582 void clnt_req_reset(struct clnt_req *); 583 enum clnt_stat clnt_req_setup(struct clnt_req *, struct timespec); 584 enum clnt_stat clnt_req_wait_reply(struct clnt_req *); 585 int clnt_req_release(struct clnt_req *); 586 587 __END_DECLS 588 /* 589 * Used by rpc_perror() and rpc_sperror() 590 */ 591 __BEGIN_DECLS 592 extern void clnt_perrno(enum clnt_stat); /* stderr */ 593 extern char *clnt_sperrno(enum clnt_stat); /* string */ 594 __END_DECLS 595 /* 596 * The simplified interface: 597 * enum clnt_stat 598 * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) 599 * const char *host; 600 * const rpcprog_t prognum; 601 * const rpcvers_t versnum; 602 * const rpcproc_t procnum; 603 * const xdrproc_t inproc; 604 * const void *in; 605 * const xdrproc_t outproc; 606 * void *out; 607 * const char *nettype; 608 */ 609 __BEGIN_DECLS 610 extern enum clnt_stat rpc_call(const char *, const rpcprog_t, 611 const rpcvers_t, const rpcproc_t, 612 const xdrproc_t, const void *, 613 const xdrproc_t, void *, 614 const char *); 615 __END_DECLS 616 /* 617 * RPC broadcast interface 618 * The call is broadcasted to all locally connected nets. 619 * 620 * extern enum clnt_stat 621 * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, 622 * eachresult, nettype) 623 * const rpcprog_t prog; -- program number 624 * const rpcvers_t vers; -- version number 625 * const rpcproc_t proc; -- procedure number 626 * const xdrproc_t xargs; -- xdr routine for args 627 * void *argsp; -- pointer to args 628 * const xdrproc_t xresults; -- xdr routine for results 629 * void *resultsp; -- pointer to results 630 * const resultproc_t eachresult; -- call with each result 631 * const char *nettype; -- Transport type 632 * 633 * For each valid response received, the procedure eachresult is called. 634 * Its form is: 635 * done = eachresult(resp, raddr, nconf) 636 * bool done; 637 * void *resp; 638 * struct netbuf *raddr; 639 * struct netconfig *nconf; 640 * where resp points to the results of the call and raddr is the 641 * address if the responder to the broadcast. nconf is the transport 642 * on which the response was received. 643 * 644 * extern enum clnt_stat 645 * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, 646 * eachresult, inittime, waittime, nettype) 647 * const rpcprog_t prog; -- program number 648 * const rpcvers_t vers; -- version number 649 * const rpcproc_t proc; -- procedure number 650 * const xdrproc_t xargs; -- xdr routine for args 651 * void *argsp; -- pointer to args 652 * const xdrproc_t xresults; -- xdr routine for results 653 * void *resultsp; -- pointer to results 654 * const resultproc_t eachresult; -- call with each result 655 * const int inittime; -- how long to wait initially 656 * const int waittime; -- maximum time to wait 657 * const char *nettype; -- Transport type 658 */ 659 typedef bool(*resultproc_t) (void *, ...); 660 661 __BEGIN_DECLS 662 extern enum clnt_stat rpc_broadcast(const rpcprog_t, 663 const rpcvers_t, 664 const rpcproc_t, 665 const xdrproc_t, void *, 666 const xdrproc_t, void *, 667 const resultproc_t, 668 const char *); 669 extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, 670 const rpcproc_t, const xdrproc_t, 671 void *, const xdrproc_t, void *, 672 const resultproc_t, const int, 673 const int, const char *); 674 __END_DECLS 675 /* For backward compatibility */ 676 #include
677 #endif /* !_TIRPC_CLNT_H_ */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™