Sdiff svc.h


18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27 /* All Rights Reserved */ 28 /* 29 * Portions of this source code were derived from Berkeley 30 * 4.3 BSD under license from the Regents of the University of 31 * California. 32 */ 33 34 /* 35 * svc.h, Server-side remote procedure call interface. 36 */ 37 38 #ifndef _RPC_SVC_H 39 #define _RPC_SVC_H 40 41 #pragma ident "@(#)svc.h 1.86 05/06/10 SMI" 42 43 #include <rpc/rpc_com.h> 44 #include <rpc/rpc_msg.h> 45 #include <sys/tihdr.h> 46 #include <sys/poll.h> 47 48 #ifdef _KERNEL 49 #include <rpc/svc_auth.h> 50 #include <sys/callb.h> 51 #endif /* _KERNEL */ 52 53 /* 54 * This interface must manage two items concerning remote procedure calling: 55 * 56 * 1) An arbitrary number of transport connections upon which rpc requests 57 * are received. They are created and registered by routines in svc_generic.c,
171 /* get arguments */ 172 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *); 173 /* send reply */ 174 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t); 175 /* free mem allocated for args */ 176 void (*xp_destroy)(SVCMASTERXPRT *); 177 /* destroy this struct */ 178 int (*xp_dup)(struct svc_req *, caddr_t, int, 179 struct dupreq **, bool_t *); 180 /* check for dup */ 181 void (*xp_dupdone)(struct dupreq *, caddr_t, void (*)(), int, int); 182 /* mark dup entry as completed */ 183 int32_t *(*xp_getres)(SVCXPRT *, int); 184 /* get pointer to response buffer */ 185 void (*xp_freeres)(SVCXPRT *); 186 /* destroy pre-serialized response */ 187 void (*xp_clone_destroy)(SVCXPRT *); 188 /* destroy a clone xprt */ 189 void (*xp_start)(SVCMASTERXPRT *); 190 /* `ready-to-receive' */ 191 }; 192 #else /* _KERNEL */ 193 /* 194 * Service control requests 195 */ 196 #define SVCGET_VERSQUIET 1 197 #define SVCSET_VERSQUIET 2 198 #define SVCGET_XID 4 199 #define SVCSET_KEEPALIVE 5 200 #define SVCSET_CONNMAXREC 6 201 #define SVCGET_CONNMAXREC 7 202 #define SVCGET_RECVERRHANDLER 8 203 #define SVCSET_RECVERRHANDLER 9 204 205 enum xprt_stat { 206 XPRT_DIED, 207 XPRT_MOREREQS, 208 XPRT_IDLE 209 }; 210
417 /* optional; see comments above */ 418 char *xp_netid; /* network token */ 419 struct netbuf xp_addrmask; /* address mask */ 420 421 caddr_t xp_p2; /* private: for use by svc ops */ 422 }; 423 424 /* 425 * Service thread `clone' transport handle (SVCXPRT) 426 * 427 * PSARC 2003/523 Contract Private Interface 428 * SVCXPRT 429 * Changes must be reviewed by Solaris File Sharing 430 * Changes must be communicated to contract-2003-523@sun.com 431 * 432 * The xp_p2buf buffer is used as the storage for a transport type 433 * specific structure. It is private for the svc ops for a given 434 * transport type. 435 */ 436 437 #define SVC_P2LEN 64 438 439 struct __svcxprt { 440 __SVCXPRT_COMMON xp_xpc; 441 SVCMASTERXPRT *xp_master; /* back ptr to master */ 442 443 /* The following fileds are on a per-thread basis */ 444 callb_cpr_t *xp_cprp; /* unused padding for Contract */ 445 bool_t xp_reserved : 1; /* is thread reserved? */ 446 bool_t xp_detached : 1; /* is thread detached? */ 447 int xp_same_xprt; /* Reqs from the same xprt */ 448 449 /* The following fields are used on a per-request basis */ 450 struct opaque_auth xp_verf; /* raw response verifier */ 451 SVCAUTH xp_auth; /* auth flavor of current req */ 452 void *xp_cookie; /* a cookie */ 453 uint32_t xp_xid; /* id */ 454 XDR xp_xdrin; /* input xdr stream */ 455 XDR xp_xdrout; /* output xdr stream */ 456 457 /* Private for svc ops */
545 */ 546 #define SVC_DUP_EXT(clone_xprt, req, res, size, drpp, dupcachedp) \ 547 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, dupcachedp) 548 549 #define SVC_DUPDONE_EXT(clone_xprt, dr, res, resfree, size, status) \ 550 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, resfree, size, status) 551 552 #define SVC_DUP(clone_xprt, req, res, size, drpp) \ 553 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, NULL) 554 555 #define SVC_DUPDONE(clone_xprt, dr, res, size, status) \ 556 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, NULL, size, status) 557 558 #define SVC_CLONE_DESTROY(clone_xprt) \ 559 (*(clone_xprt)->xp_ops->xp_clone_destroy)(clone_xprt) 560 561 562 #define SVC_START(xprt) \ 563 (*(xprt)->xp_ops->xp_start)(xprt) 564 565 #else /* _KERNEL */ 566 567 #define SVC_RECV(xprt, msg) \ 568 (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) 569 #define svc_recv(xprt, msg) \ 570 (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) 571 572 #define SVC_STAT(xprt) \ 573 (*(xprt)->xp_ops->xp_stat)(xprt) 574 #define svc_stat(xprt) \ 575 (*(xprt)->xp_ops->xp_stat)(xprt) 576 577 #define SVC_GETARGS(xprt, xargs, argsp) \ 578 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) 579 #define svc_getargs(xprt, xargs, argsp) \ 580 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) 581 582 #define SVC_REPLY(xprt, msg) \ 583 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) 584 #define svc_reply(xprt, msg) \
785 * or records in a kRPC thread pool. 786 */ 787 typedef struct rdma_xprt_record rdma_xprt_record_t; 788 struct rdma_xprt_record { 789 int rtr_type; /* Type of rdma; IB/VI/RDDP */ 790 SVCMASTERXPRT *rtr_xprt_ptr; /* Ptr to master xprt handle */ 791 rdma_xprt_record_t *rtr_next; /* Ptr to next record */ 792 }; 793 794 typedef struct { 795 int rtg_count; /* Number transport records */ 796 int rtg_poolid; /* Pool Id for this group */ 797 rdma_xprt_record_t *rtg_listhead; /* Head of the records list */ 798 } rdma_xprt_group_t; 799 800 extern int svc_rdma_kcreate(char *, SVC_CALLOUT_TABLE *, int, 801 rdma_xprt_group_t *); 802 extern void svc_rdma_kstop(SVCMASTERXPRT *); 803 extern void svc_rdma_kdestroy(SVCMASTERXPRT *); 804 extern void rdma_stop(rdma_xprt_group_t); 805 806 /* 807 * GSS cleanup method. 808 */ 809 extern void rpc_gss_cleanup(SVCXPRT *); 810 #else /* _KERNEL */ 811 /* 812 * Lowest level dispatching -OR- who owns this process anyway. 813 * Somebody has to wait for incoming requests and then call the correct 814 * service routine. The routine svc_run does infinite waiting; i.e., 815 * svc_run never returns. 816 * Since another (co-existant) package may wish to selectively wait for 817 * incoming calls or other events outside of the rpc architecture, the 818 * routine svc_getreq_poll is provided. It must be passed pollfds, the 819 * "in-place" results of a poll call (see poll, section 2). 820 */ 821 822 /* 823 * Global keeper of rpc service descriptors in use 824 * dynamic; must be inspected before each call to select or poll


18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27 /* All Rights Reserved */ 28 /* 29 * Portions of this source code were derived from Berkeley 30 * 4.3 BSD under license from the Regents of the University of 31 * California. 32 */ 33 34 /* 35 * svc.h, Server-side remote procedure call interface. 36 */ 37 38 /* Copyright (c) 2006, The Ohio State University. All rights reserved. 39 * 40 * Portions of this source code is developed by the team members of 41 * The Ohio State University's Network-Based Computing Laboratory (NBCL), 42 * headed by Professor Dhabaleswar K. (DK) Panda. 43 * 44 * Acknowledgements to contributions from developors: 45 * Ranjit Noronha: noronha@cse.ohio-state.edu 46 * Lei Chai : chail@cse.ohio-state.edu 47 * Weikuan Yu : yuw@cse.ohio-state.edu 48 * 49 */ 50 51 #ifndef _RPC_SVC_H 52 #define _RPC_SVC_H 53 54 #pragma ident "@(#)svc.h 1.86 05/06/10 SMI" 55 56 #include <rpc/rpc_com.h> 57 #include <rpc/rpc_msg.h> 58 #include <sys/tihdr.h> 59 #include <sys/poll.h> 60 61 #ifdef _KERNEL 62 #include <rpc/svc_auth.h> 63 #include <sys/callb.h> 64 #endif /* _KERNEL */ 65 66 /* 67 * This interface must manage two items concerning remote procedure calling: 68 * 69 * 1) An arbitrary number of transport connections upon which rpc requests 70 * are received. They are created and registered by routines in svc_generic.c,
184 /* get arguments */ 185 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *); 186 /* send reply */ 187 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t); 188 /* free mem allocated for args */ 189 void (*xp_destroy)(SVCMASTERXPRT *); 190 /* destroy this struct */ 191 int (*xp_dup)(struct svc_req *, caddr_t, int, 192 struct dupreq **, bool_t *); 193 /* check for dup */ 194 void (*xp_dupdone)(struct dupreq *, caddr_t, void (*)(), int, int); 195 /* mark dup entry as completed */ 196 int32_t *(*xp_getres)(SVCXPRT *, int); 197 /* get pointer to response buffer */ 198 void (*xp_freeres)(SVCXPRT *); 199 /* destroy pre-serialized response */ 200 void (*xp_clone_destroy)(SVCXPRT *); 201 /* destroy a clone xprt */ 202 void (*xp_start)(SVCMASTERXPRT *); 203 /* `ready-to-receive' */ 204 bool_t (*xp_get_wchunk)(struct svc_req *, iovec_t *); 205 }; 206 #else /* _KERNEL */ 207 /* 208 * Service control requests 209 */ 210 #define SVCGET_VERSQUIET 1 211 #define SVCSET_VERSQUIET 2 212 #define SVCGET_XID 4 213 #define SVCSET_KEEPALIVE 5 214 #define SVCSET_CONNMAXREC 6 215 #define SVCGET_CONNMAXREC 7 216 #define SVCGET_RECVERRHANDLER 8 217 #define SVCSET_RECVERRHANDLER 9 218 219 enum xprt_stat { 220 XPRT_DIED, 221 XPRT_MOREREQS, 222 XPRT_IDLE 223 }; 224
431 /* optional; see comments above */ 432 char *xp_netid; /* network token */ 433 struct netbuf xp_addrmask; /* address mask */ 434 435 caddr_t xp_p2; /* private: for use by svc ops */ 436 }; 437 438 /* 439 * Service thread `clone' transport handle (SVCXPRT) 440 * 441 * PSARC 2003/523 Contract Private Interface 442 * SVCXPRT 443 * Changes must be reviewed by Solaris File Sharing 444 * Changes must be communicated to contract-2003-523@sun.com 445 * 446 * The xp_p2buf buffer is used as the storage for a transport type 447 * specific structure. It is private for the svc ops for a given 448 * transport type. 449 */ 450 451 #define SVC_P2LEN 104 /* torplen + credctl + wlist */ 452 453 struct __svcxprt { 454 __SVCXPRT_COMMON xp_xpc; 455 SVCMASTERXPRT *xp_master; /* back ptr to master */ 456 457 /* The following fileds are on a per-thread basis */ 458 callb_cpr_t *xp_cprp; /* unused padding for Contract */ 459 bool_t xp_reserved : 1; /* is thread reserved? */ 460 bool_t xp_detached : 1; /* is thread detached? */ 461 int xp_same_xprt; /* Reqs from the same xprt */ 462 463 /* The following fields are used on a per-request basis */ 464 struct opaque_auth xp_verf; /* raw response verifier */ 465 SVCAUTH xp_auth; /* auth flavor of current req */ 466 void *xp_cookie; /* a cookie */ 467 uint32_t xp_xid; /* id */ 468 XDR xp_xdrin; /* input xdr stream */ 469 XDR xp_xdrout; /* output xdr stream */ 470 471 /* Private for svc ops */
559 */ 560 #define SVC_DUP_EXT(clone_xprt, req, res, size, drpp, dupcachedp) \ 561 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, dupcachedp) 562 563 #define SVC_DUPDONE_EXT(clone_xprt, dr, res, resfree, size, status) \ 564 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, resfree, size, status) 565 566 #define SVC_DUP(clone_xprt, req, res, size, drpp) \ 567 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, NULL) 568 569 #define SVC_DUPDONE(clone_xprt, dr, res, size, status) \ 570 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, NULL, size, status) 571 572 #define SVC_CLONE_DESTROY(clone_xprt) \ 573 (*(clone_xprt)->xp_ops->xp_clone_destroy)(clone_xprt) 574 575 576 #define SVC_START(xprt) \ 577 (*(xprt)->xp_ops->xp_start)(xprt) 578 579 #define SVC_GET_WCHUNK(xprt, req, iov) \ 580 (*(xprt)->xp_ops->xp_get_wchunk)(req, iov) 581 582 #else /* _KERNEL */ 583 584 #define SVC_RECV(xprt, msg) \ 585 (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) 586 #define svc_recv(xprt, msg) \ 587 (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) 588 589 #define SVC_STAT(xprt) \ 590 (*(xprt)->xp_ops->xp_stat)(xprt) 591 #define svc_stat(xprt) \ 592 (*(xprt)->xp_ops->xp_stat)(xprt) 593 594 #define SVC_GETARGS(xprt, xargs, argsp) \ 595 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) 596 #define svc_getargs(xprt, xargs, argsp) \ 597 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) 598 599 #define SVC_REPLY(xprt, msg) \ 600 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) 601 #define svc_reply(xprt, msg) \
802 * or records in a kRPC thread pool. 803 */ 804 typedef struct rdma_xprt_record rdma_xprt_record_t; 805 struct rdma_xprt_record { 806 int rtr_type; /* Type of rdma; IB/VI/RDDP */ 807 SVCMASTERXPRT *rtr_xprt_ptr; /* Ptr to master xprt handle */ 808 rdma_xprt_record_t *rtr_next; /* Ptr to next record */ 809 }; 810 811 typedef struct { 812 int rtg_count; /* Number transport records */ 813 int rtg_poolid; /* Pool Id for this group */ 814 rdma_xprt_record_t *rtg_listhead; /* Head of the records list */ 815 } rdma_xprt_group_t; 816 817 extern int svc_rdma_kcreate(char *, SVC_CALLOUT_TABLE *, int, 818 rdma_xprt_group_t *); 819 extern void svc_rdma_kstop(SVCMASTERXPRT *); 820 extern void svc_rdma_kdestroy(SVCMASTERXPRT *); 821 extern void rdma_stop(rdma_xprt_group_t); 822 extern bool_t rdma_get_wchunk_seg(struct svc_req *, iovec_t *); 823 824 /* 825 * GSS cleanup method. 826 */ 827 extern void rpc_gss_cleanup(SVCXPRT *); 828 #else /* _KERNEL */ 829 /* 830 * Lowest level dispatching -OR- who owns this process anyway. 831 * Somebody has to wait for incoming requests and then call the correct 832 * service routine. The routine svc_run does infinite waiting; i.e., 833 * svc_run never returns. 834 * Since another (co-existant) package may wish to selectively wait for 835 * incoming calls or other events outside of the rpc architecture, the 836 * routine svc_getreq_poll is provided. It must be passed pollfds, the 837 * "in-place" results of a poll call (see poll, section 2). 838 */ 839 840 /* 841 * Global keeper of rpc service descriptors in use 842 * dynamic; must be inspected before each call to select or poll