Lines Matching defs:xprt
79 /* Structure used to initialize SVC_XP_AUTH(xprt).svc_ah_ops. */
93 struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */
105 struct cf_conn { /* kept in xprt->xp_p1 for actual connection */
168 svc_vc_xprtfree(SVCXPRT *xprt)
171 SVCXPRT_EXT *xt = xprt ? SVCEXT(xprt) : NULL;
172 struct cf_rendezvous *r = xprt ?
174 (struct cf_rendezvous *)xprt->xp_p1 : NULL;
176 if (!xprt)
179 if (xprt->xp_tp)
180 free(xprt->xp_tp);
181 if (xprt->xp_netid)
182 free(xprt->xp_netid);
184 if (xprt->xp_ltaddr.buf)
185 free(xprt->xp_ltaddr.buf);
186 if (xprt->xp_rtaddr.buf)
187 free(xprt->xp_rtaddr.buf);
196 svc_xprt_free(xprt);
201 * xprt = svc_vc_create(fd, sendsize, recvsize);
211 SVCXPRT *xprt;
221 if ((xprt = svc_xprt_alloc()) == NULL) {
227 svc_flags(xprt) |= SVC_RENDEZVOUS;
233 svc_vc_xprtfree(xprt);
244 svc_vc_xprtfree(xprt);
257 svc_vc_xprtfree(xprt);
266 svc_vc_xprtfree(xprt);
276 svc_vc_xprtfree(xprt);
284 xprt->xp_fd = fd;
285 xprt->xp_p1 = (caddr_t)r;
286 xprt->xp_p2 = NULL;
287 xprt->xp_verf = _null_auth;
288 xprt->xp_ops = svc_vc_rendezvous_ops();
290 SVC_XP_AUTH(xprt).svc_ah_ops = svc_auth_any_ops;
292 SVC_XP_AUTH(xprt).svc_ah_private = NULL;
294 return (xprt);
300 SVCXPRT *xprt;
302 if ((xprt = svc_vc_create_private(fd, sendsize, recvsize)) != NULL)
303 xprt_register(xprt);
304 return (xprt);
310 SVCXPRT *xprt;
314 if ((xprt = svc_xprt_alloc()) == NULL)
318 SVCEXT(xprt)->parent = parent;
320 SVCEXT(xprt)->flags = SVCEXT(parent)->flags;
322 xprt->xp_fd = fd;
323 xprt->xp_ops = svc_vc_rendezvous_ops();
325 xprt->xp_tp = (char *)strdup(parent->xp_tp);
326 if (xprt->xp_tp == NULL) {
328 svc_vc_xprtfree(xprt);
333 xprt->xp_netid = (char *)strdup(parent->xp_netid);
334 if (xprt->xp_netid == NULL) {
336 if (xprt->xp_tp)
337 free(xprt->xp_tp);
338 svc_vc_xprtfree(xprt);
346 xprt->xp_ltaddr = parent->xp_ltaddr;
347 xprt->xp_rtaddr = parent->xp_rtaddr; /* XXX - not used for rendezvous */
348 xprt->xp_type = parent->xp_type;
349 xprt->xp_verf = parent->xp_verf;
352 svc_vc_xprtfree(xprt);
355 xprt->xp_p1 = (caddr_t)r;
367 svc_vc_xprtfree(xprt);
372 svc_vc_xprtfree(xprt);
376 return (xprt);
385 __svc_vc_setflag(SVCXPRT *xprt, int flag)
390 r = (struct cf_rendezvous *)xprt->xp_p1;
445 SVCXPRT *xprt;
447 if ((xprt = svc_fd_create_private(fd, sendsize, recvsize)) != NULL)
448 xprt_register(xprt);
449 return (xprt);
453 svc_fd_xprtfree(SVCXPRT *xprt)
456 SVCXPRT_EXT *xt = xprt ? SVCEXT(xprt) : NULL;
458 struct cf_conn *cd = xprt ? (struct cf_conn *)xprt->xp_p1 : NULL;
460 if (!xprt)
463 if (xprt->xp_tp)
464 free(xprt->xp_tp);
465 if (xprt->xp_netid)
466 free(xprt->xp_netid);
468 if (xprt->xp_ltaddr.buf)
469 free(xprt->xp_ltaddr.buf);
470 if (xprt->xp_rtaddr.buf)
471 free(xprt->xp_rtaddr.buf);
477 if (xt && (xt->parent == NULL) && xprt->xp_p2) {
479 free(((struct netbuf *)xprt->xp_p2)->buf);
480 free(xprt->xp_p2);
482 svc_xprt_free(xprt);
489 SVCXPRT *xprt;
492 xprt = svc_xprt_alloc();
493 if (xprt == NULL) {
498 svc_flags(xprt) |= SVC_CONNECTION;
503 svc_fd_xprtfree(xprt);
514 xdrrec_create(&(cd->xdrs), sendsize, 0, (caddr_t)xprt,
519 svc_fd_xprtfree(xprt);
531 svc_fd_xprtfree(xprt);
547 svc_fd_xprtfree(xprt);
565 svc_fd_xprtfree(xprt);
570 xdrrec_create(svc_xdrs[fd], 0, recvsize, (caddr_t)xprt,
577 svc_fd_xprtfree(xprt);
583 xprt->xp_p1 = (caddr_t)cd;
584 xprt->xp_p2 = NULL;
585 xprt->xp_verf.oa_base = cd->verf_body;
586 xprt->xp_ops = svc_vc_ops(); /* truely deals with calls */
587 xprt->xp_fd = fd;
588 return (xprt);
594 SVCXPRT *xprt;
597 if ((xprt = svc_xprt_alloc()) == NULL)
601 SVCEXT(xprt)->parent = parent;
603 SVCEXT(xprt)->flags = SVCEXT(parent)->flags;
605 xprt->xp_fd = parent->xp_fd;
606 xprt->xp_ops = svc_vc_ops();
608 xprt->xp_tp = (char *)strdup(parent->xp_tp);
609 if (xprt->xp_tp == NULL) {
611 svc_fd_xprtfree(xprt);
616 xprt->xp_netid = (char *)strdup(parent->xp_netid);
617 if (xprt->xp_netid == NULL) {
619 if (xprt->xp_tp)
620 free(xprt->xp_tp);
621 svc_fd_xprtfree(xprt);
628 xprt->xp_ltaddr = parent->xp_ltaddr;
629 xprt->xp_rtaddr = parent->xp_rtaddr;
630 xprt->xp_type = parent->xp_type;
633 svc_fd_xprtfree(xprt);
647 xdrrec_create(&(cd->xdrs), cd->sendsize, 0, (caddr_t)xprt,
651 svc_fd_xprtfree(xprt);
654 xprt->xp_verf.oa_base = cd->verf_body;
655 xprt->xp_p1 = (char *)cd;
656 xprt->xp_p2 = parent->xp_p2; /* shared */
658 return (xprt);
673 rendezvous_request(SVCXPRT *xprt, struct rpc_msg *msg)
680 r = (struct cf_rendezvous *)xprt->xp_p1;
683 switch (t_look(xprt->xp_fd)) {
685 (void) t_rcvdis(xprt->xp_fd, NULL);
690 if (t_listen(xprt->xp_fd, r->t_call) == -1) {
695 if (t_look(xprt->xp_fd) == T_DISCONNECT)
696 (void) t_rcvdis(xprt->xp_fd, NULL);
709 if (xprt->xp_tp) {
710 tpname = xprt->xp_tp;
713 * If xprt->xp_tp is NULL, then try to extract the
715 * protcol corresponding to xprt->xp_fd
719 if ((nconf = __rpcfd_to_nconf(xprt->xp_fd, xprt->xp_type))
730 do_accept(xprt->xp_fd, tpname, xprt->xp_netid, r->t_call, r);
744 SVCXPRT *xprt = NULL;
756 * too many open files, the LRU connection xprt should
768 * Do not destroy LRU xprt unless there are
967 xprt = makefd_xprt(destfd, r->sendsize, r->recvsize, r->cf_tsdu,
969 if (xprt == NULL) {
971 * makefd_xprt() returns a NULL xprt only when
981 xprt->xp_rtaddr.len = tcp->addr.len;
982 xprt->xp_rtaddr.maxlen = tcp->addr.len;
983 if ((xprt->xp_rtaddr.buf = malloc(tcp->addr.len)) == NULL)
985 (void) memcpy(xprt->xp_rtaddr.buf, tcp->addr.buf, tcp->addr.len);
988 xprt->xp_ltaddr.maxlen = sizeof (struct sockaddr_in);
989 if ((xprt->xp_ltaddr.buf =
990 malloc(xprt->xp_ltaddr.maxlen)) == NULL)
992 if (t_getname(destfd, &xprt->xp_ltaddr, LOCALNAME) < 0) {
998 xprt->xp_ltaddr.maxlen = sizeof (struct sockaddr_in6);
999 if ((xprt->xp_ltaddr.buf =
1000 malloc(xprt->xp_ltaddr.maxlen)) == NULL)
1002 if (t_getname(destfd, &xprt->xp_ltaddr, LOCALNAME) < 0) {
1009 xprt->xp_tp = strdup(tpname);
1010 xprt->xp_netid = strdup(netid);
1011 if ((xprt->xp_tp == NULL) ||
1012 (xprt->xp_netid == NULL)) {
1018 xprt->xp_p2 = malloc(sizeof (struct netbuf));
1020 if (xprt->xp_p2 != NULL) {
1022 netptr = (struct netbuf *)xprt->xp_p2;
1041 if (!svc_vc_nonblock(xprt_srcfd, xprt))
1049 xprt->xp_closeclnt = xprt_srcfd->xp_closeclnt;
1050 xprt_register(xprt);
1057 if (xprt)
1058 svc_vc_destroy(xprt);
1111 rendezvous_stat(SVCXPRT *xprt)
1117 svc_vc_destroy(SVCXPRT *xprt)
1120 _svc_vc_destroy_private(xprt, TRUE);
1126 _svc_vc_destroy_private(SVCXPRT *xprt, bool_t lock_not_held)
1130 if (SVCEXT(xprt)->parent)
1132 xprt = SVCEXT(xprt)->parent;
1134 svc_flags(xprt) |= SVC_DEFUNCT;
1136 if (SVCEXT(xprt)->refcnt > 0)
1140 if (xprt->xp_closeclnt != NULL) {
1141 svc_errorhandler_t cb = xprt->xp_closeclnt;
1147 xprt->xp_closeclnt = NULL;
1148 cb(xprt, (xprt->xp_rtaddr.len != 0));
1151 __xprt_unregister_private(xprt, lock_not_held);
1152 (void) t_close(xprt->xp_fd);
1155 if (timestamps && xprt->xp_fd < ntimestamps) {
1156 timestamps[xprt->xp_fd] = 0;
1161 svc_xprt_destroy(xprt);
1164 if (svc_type(xprt) == SVC_RENDEZVOUS)
1165 svc_vc_xprtfree(xprt);
1167 svc_fd_xprtfree(xprt);
1173 svc_vc_control(SVCXPRT *xprt, const uint_t rq, void *in)
1177 xprt->xp_closeclnt = (svc_errorhandler_t)in;
1180 *(svc_errorhandler_t *)in = xprt->xp_closeclnt;
1183 if (xprt->xp_p1 == NULL)
1186 *(uint32_t *)in = ((struct cf_conn *)(xprt->xp_p1))->x_id;
1194 rendezvous_control(SVCXPRT *xprt, const uint_t rq, void *in)
1201 xprt->xp_closeclnt = (svc_errorhandler_t)in;
1204 *(svc_errorhandler_t *)in = xprt->xp_closeclnt;
1208 r = (struct cf_rendezvous *)xprt->xp_p1;
1223 r = (struct cf_rendezvous *)xprt->xp_p1;
1232 r = (struct cf_rendezvous *)xprt->xp_p1;
1302 read_vc(SVCXPRT *xprt, caddr_t buf, int len)
1304 int fd = xprt->xp_fd;
1313 if (svc_failed(xprt))
1317 if (((struct cf_conn *)(xprt->xp_p1))->cf_conn_nonblock) {
1332 if ((len = t_rcvnonblock(xprt, buf, len)) >= 0) {
1335 update_nonblock_timestamps(xprt);
1370 ((struct cf_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED;
1372 svc_flags(xprt) |= SVC_FAILED;
1381 t_rcvnonblock(SVCXPRT *xprt, caddr_t buf, int len)
1383 int fd = xprt->xp_fd;
1405 * Either poll() lied, or the xprt/fd was closed and
1422 * seconds, timeout the fd by destroying its xprt.
1424 * that the least busy xprt gets destroyed as well.
1431 SVCXPRT *xprt;
1457 if ((xprt = svc_xports[fd_idx]) == NULL) {
1462 if (svc_type(xprt) != SVC_CONNECTION) {
1466 cd = (struct cf_conn *)xprt->xp_p1;
1473 dead_xprt[dead_idx++] = xprt;
1478 /* Possible LRU xprt */
1479 candidate_xprt = xprt;
1540 write_vc(SVCXPRT *xprt, caddr_t buf, int len)
1549 maxsz = ((struct cf_conn *)(xprt->xp_p1))->cf_tsdu;
1551 nonblock = ((struct cf_conn *)(xprt->xp_p1))->cf_conn_nonblock;
1555 if ((len = t_snd(xprt->xp_fd, buf, (unsigned)len,
1558 switch (t_look(xprt->xp_fd)) {
1560 (void) t_rcvdis(xprt->xp_fd, NULL);
1563 (void) t_rcvrel(xprt->xp_fd);
1564 (void) t_sndrel(xprt->xp_fd);
1571 ((struct cf_conn *)(xprt->xp_p1))->strm_stat
1574 svc_flags(xprt) |= SVC_FAILED;
1583 pfd.fd = xprt->xp_fd;
1593 if ((i = t_snd(xprt->xp_fd, buf,
1596 switch (t_look(xprt->xp_fd)) {
1598 (void) t_rcvdis(xprt->xp_fd, NULL);
1601 (void) t_rcvrel(xprt->xp_fd);
1630 ((struct cf_conn *)(xprt->xp_p1))->strm_stat
1633 svc_flags(xprt) |= SVC_FAILED;
1641 svc_vc_stat(SVCXPRT *xprt)
1644 SVCXPRT *parent = SVCEXT(xprt)->parent ? SVCEXT(xprt)->parent : xprt;
1647 if (svc_failed(parent) || svc_failed(xprt))
1649 if (!xdrrec_eof(svc_xdrs[xprt->xp_fd]))
1656 if (svc_failed(parent) || svc_failed(xprt))
1664 svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg)
1667 struct cf_conn *cd = (struct cf_conn *)(xprt->xp_p1);
1668 XDR *xdrs = svc_xdrs[xprt->xp_fd];
1677 * If the xprt has died, pass it along in svc_flags.
1686 svc_flags(xprt) |= SVC_FAILED;
1706 svc_flags(xprt) |= SVC_FAILED;
1713 svc_vc_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
1718 dummy = SVCAUTH_UNWRAP(&SVC_XP_AUTH(xprt), svc_xdrs[xprt->xp_fd],
1721 svc_args_done(xprt);
1726 svc_vc_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
1729 XDR *xdrs = &(((struct cf_conn *)(xprt->xp_p1))->xdrs);
1736 svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg)
1739 struct cf_conn *cd = (struct cf_conn *)(xprt->xp_p1);
1747 (void) mutex_lock(&svc_send_mutex(SVCEXT(xprt)->parent));
1751 (void) mutex_lock(&svc_send_mutex(SVCEXT(xprt)->parent));
1768 &SVC_XP_AUTH(xprt), xdrs, xdr_results, xdr_location))) {
1774 (void) mutex_unlock(&svc_send_mutex(SVCEXT(xprt)->parent));
1778 (void) mutex_unlock(&svc_send_mutex(SVCEXT(xprt)->parent));
1871 SVCXPRT *xprt;
1880 if ((xprt = svc_xports[fd_idx]) == NULL)
1883 if (svc_type(xprt) != SVC_CONNECTION)
1886 dead_xprt[dead_idx++] = xprt;
1924 SVCXPRT *xprt;
1934 if ((xprt = svc_xports[fd_idx]) == NULL) {
1938 if (svc_type(xprt) != SVC_CONNECTION) {
1946 dead_xprt[dead_idx++] = xprt;
1971 __svc_vc_dupcache_init(SVCXPRT *xprt, void *condition, int basis)
1975 &(((struct cf_rendezvous *)xprt->xp_p1)->cf_cache)));