svc_vc.c (184588) | svc_vc.c (193272) |
---|---|
1/* $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $ */ 2 3/* 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 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 8 * to license or distribute it to anyone else except as part of a product or --- 20 unchanged lines hidden (view full) --- 29 * Mountain View, California 94043 30 */ 31 32#if defined(LIBC_SCCS) && !defined(lint) 33static char *sccsid2 = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; 34static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC"; 35#endif 36#include <sys/cdefs.h> | 1/* $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $ */ 2 3/* 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 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 8 * to license or distribute it to anyone else except as part of a product or --- 20 unchanged lines hidden (view full) --- 29 * Mountain View, California 94043 30 */ 31 32#if defined(LIBC_SCCS) && !defined(lint) 33static char *sccsid2 = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; 34static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC"; 35#endif 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/rpc/svc_vc.c 184588 2008-11-03 10:38:00Z dfr $"); | 37__FBSDID("$FreeBSD: head/sys/rpc/svc_vc.c 193272 2009-06-01 21:17:03Z jhb $"); |
38 39/* 40 * svc_vc.c, Server side for Connection Oriented based RPC. 41 * 42 * Actually implements two flavors of transporter - 43 * a tcp rendezvouser (a listner and connection establisher) 44 * and a record/tcp stream. 45 */ --- 29 unchanged lines hidden (view full) --- 75static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *, 76 struct sockaddr *, struct mbuf *); 77static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in); 78static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq, 79 void *in); 80static SVCXPRT *svc_vc_create_conn(SVCPOOL *pool, struct socket *so, 81 struct sockaddr *raddr); 82static int svc_vc_accept(struct socket *head, struct socket **sop); | 38 39/* 40 * svc_vc.c, Server side for Connection Oriented based RPC. 41 * 42 * Actually implements two flavors of transporter - 43 * a tcp rendezvouser (a listner and connection establisher) 44 * and a record/tcp stream. 45 */ --- 29 unchanged lines hidden (view full) --- 75static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *, 76 struct sockaddr *, struct mbuf *); 77static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in); 78static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq, 79 void *in); 80static SVCXPRT *svc_vc_create_conn(SVCPOOL *pool, struct socket *so, 81 struct sockaddr *raddr); 82static int svc_vc_accept(struct socket *head, struct socket **sop); |
83static void svc_vc_soupcall(struct socket *so, void *arg, int waitflag); | 83static int svc_vc_soupcall(struct socket *so, void *arg, int waitflag); |
84 85static struct xp_ops svc_vc_rendezvous_ops = { 86 .xp_recv = svc_vc_rendezvous_recv, 87 .xp_stat = svc_vc_rendezvous_stat, 88 .xp_reply = (bool_t (*)(SVCXPRT *, struct rpc_msg *, 89 struct sockaddr *, struct mbuf *))svc_vc_null, 90 .xp_destroy = svc_vc_rendezvous_destroy, 91 .xp_control = svc_vc_rendezvous_control --- 63 unchanged lines hidden (view full) --- 155 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); 156 free(sa, M_SONAME); 157 158 xprt_register(xprt); 159 160 solisten(so, SOMAXCONN, curthread); 161 162 SOCKBUF_LOCK(&so->so_rcv); | 84 85static struct xp_ops svc_vc_rendezvous_ops = { 86 .xp_recv = svc_vc_rendezvous_recv, 87 .xp_stat = svc_vc_rendezvous_stat, 88 .xp_reply = (bool_t (*)(SVCXPRT *, struct rpc_msg *, 89 struct sockaddr *, struct mbuf *))svc_vc_null, 90 .xp_destroy = svc_vc_rendezvous_destroy, 91 .xp_control = svc_vc_rendezvous_control --- 63 unchanged lines hidden (view full) --- 155 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); 156 free(sa, M_SONAME); 157 158 xprt_register(xprt); 159 160 solisten(so, SOMAXCONN, curthread); 161 162 SOCKBUF_LOCK(&so->so_rcv); |
163 so->so_upcallarg = xprt; 164 so->so_upcall = svc_vc_soupcall; 165 so->so_rcv.sb_flags |= SB_UPCALL; | 163 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt); |
166 SOCKBUF_UNLOCK(&so->so_rcv); 167 168 return (xprt); 169cleanup_svc_vc_create: 170 if (xprt) 171 svc_xprt_free(xprt); 172 return (NULL); 173} --- 57 unchanged lines hidden (view full) --- 231 goto cleanup_svc_vc_create; 232 233 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); 234 free(sa, M_SONAME); 235 236 xprt_register(xprt); 237 238 SOCKBUF_LOCK(&so->so_rcv); | 164 SOCKBUF_UNLOCK(&so->so_rcv); 165 166 return (xprt); 167cleanup_svc_vc_create: 168 if (xprt) 169 svc_xprt_free(xprt); 170 return (NULL); 171} --- 57 unchanged lines hidden (view full) --- 229 goto cleanup_svc_vc_create; 230 231 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); 232 free(sa, M_SONAME); 233 234 xprt_register(xprt); 235 236 SOCKBUF_LOCK(&so->so_rcv); |
239 so->so_upcallarg = xprt; 240 so->so_upcall = svc_vc_soupcall; 241 so->so_rcv.sb_flags |= SB_UPCALL; | 237 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt); |
242 SOCKBUF_UNLOCK(&so->so_rcv); 243 244 /* 245 * Throw the transport into the active list in case it already 246 * has some data buffered. 247 */ 248 sx_xlock(&xprt->xp_lock); 249 xprt_active(xprt); --- 103 unchanged lines hidden (view full) --- 353 mtx_unlock(&xprt->xp_pool->sp_lock); 354 ACCEPT_UNLOCK(); 355 sx_xunlock(&xprt->xp_lock); 356 return (FALSE); 357 } 358 359 if (error) { 360 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); | 238 SOCKBUF_UNLOCK(&so->so_rcv); 239 240 /* 241 * Throw the transport into the active list in case it already 242 * has some data buffered. 243 */ 244 sx_xlock(&xprt->xp_lock); 245 xprt_active(xprt); --- 103 unchanged lines hidden (view full) --- 349 mtx_unlock(&xprt->xp_pool->sp_lock); 350 ACCEPT_UNLOCK(); 351 sx_xunlock(&xprt->xp_lock); 352 return (FALSE); 353 } 354 355 if (error) { 356 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); |
361 xprt->xp_socket->so_upcallarg = NULL; 362 xprt->xp_socket->so_upcall = NULL; 363 xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; | 357 soupcall_clear(xprt->xp_socket, SO_RCV); |
364 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 365 xprt_inactive(xprt); 366 sx_xunlock(&xprt->xp_lock); 367 return (FALSE); 368 } 369 370 sx_xunlock(&xprt->xp_lock); 371 --- 28 unchanged lines hidden (view full) --- 400 401 return (XPRT_IDLE); 402} 403 404static void 405svc_vc_destroy_common(SVCXPRT *xprt) 406{ 407 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); | 358 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 359 xprt_inactive(xprt); 360 sx_xunlock(&xprt->xp_lock); 361 return (FALSE); 362 } 363 364 sx_xunlock(&xprt->xp_lock); 365 --- 28 unchanged lines hidden (view full) --- 394 395 return (XPRT_IDLE); 396} 397 398static void 399svc_vc_destroy_common(SVCXPRT *xprt) 400{ 401 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); |
408 xprt->xp_socket->so_upcallarg = NULL; 409 xprt->xp_socket->so_upcall = NULL; 410 xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; | 402 soupcall_clear(xprt->xp_socket, SO_RCV); |
411 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 412 413 sx_destroy(&xprt->xp_lock); 414 if (xprt->xp_socket) 415 (void)soclose(xprt->xp_socket); 416 417 if (xprt->xp_netid) 418 (void) mem_free(xprt->xp_netid, strlen(xprt->xp_netid) + 1); --- 218 unchanged lines hidden (view full) --- 637 xprt_inactive_locked(xprt); 638 mtx_unlock(&xprt->xp_pool->sp_lock); 639 sx_xunlock(&xprt->xp_lock); 640 return (FALSE); 641 } 642 643 if (error) { 644 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); | 403 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 404 405 sx_destroy(&xprt->xp_lock); 406 if (xprt->xp_socket) 407 (void)soclose(xprt->xp_socket); 408 409 if (xprt->xp_netid) 410 (void) mem_free(xprt->xp_netid, strlen(xprt->xp_netid) + 1); --- 218 unchanged lines hidden (view full) --- 629 xprt_inactive_locked(xprt); 630 mtx_unlock(&xprt->xp_pool->sp_lock); 631 sx_xunlock(&xprt->xp_lock); 632 return (FALSE); 633 } 634 635 if (error) { 636 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); |
645 xprt->xp_socket->so_upcallarg = NULL; 646 xprt->xp_socket->so_upcall = NULL; 647 xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; | 637 soupcall_clear(xprt->xp_socket, SO_RCV); |
648 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 649 xprt_inactive(xprt); 650 cd->strm_stat = XPRT_DIED; 651 sx_xunlock(&xprt->xp_lock); 652 return (FALSE); 653 } 654 655 if (!m) { --- 68 unchanged lines hidden (view full) --- 724 725static bool_t 726svc_vc_null() 727{ 728 729 return (FALSE); 730} 731 | 638 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 639 xprt_inactive(xprt); 640 cd->strm_stat = XPRT_DIED; 641 sx_xunlock(&xprt->xp_lock); 642 return (FALSE); 643 } 644 645 if (!m) { --- 68 unchanged lines hidden (view full) --- 714 715static bool_t 716svc_vc_null() 717{ 718 719 return (FALSE); 720} 721 |
732static void | 722static int |
733svc_vc_soupcall(struct socket *so, void *arg, int waitflag) 734{ 735 SVCXPRT *xprt = (SVCXPRT *) arg; 736 737 xprt_active(xprt); | 723svc_vc_soupcall(struct socket *so, void *arg, int waitflag) 724{ 725 SVCXPRT *xprt = (SVCXPRT *) arg; 726 727 xprt_active(xprt); |
728 return (SU_OK); |
|
738} 739 740#if 0 741/* 742 * Get the effective UID of the sending process. Used by rpcbind, keyserv 743 * and rpc.yppasswdd on AF_LOCAL. 744 */ 745int --- 17 unchanged lines hidden --- | 729} 730 731#if 0 732/* 733 * Get the effective UID of the sending process. Used by rpcbind, keyserv 734 * and rpc.yppasswdd on AF_LOCAL. 735 */ 736int --- 17 unchanged lines hidden --- |