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 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); |
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); |
163 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt); |
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); |
237 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt); |
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); |
357 soupcall_clear(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); |
402 soupcall_clear(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); |
637 soupcall_clear(xprt->xp_socket, SO_RCV); |
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 |
722static int |
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); |
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 --- |