Lines Matching defs:xprt
69 #define rpc_buffer(xprt) ((xprt)->xp_p1)
73 * xprt = svc_dg_create(sock, sendsize, recvsize);
75 * Once *xprt is initialized, it is registered.
87 /* Structure used to initialize SVC_XP_AUTH(xprt).svc_ah_ops. */
92 svc_dg_xprtfree(SVCXPRT *xprt)
95 SVCXPRT_EXT *xt = xprt ? SVCEXT(xprt) : NULL;
97 struct svc_dg_data *su = xprt ? get_svc_dg_data(xprt) : NULL;
99 if (xprt == NULL)
101 if (xprt->xp_netid)
102 free(xprt->xp_netid);
103 if (xprt->xp_tp)
104 free(xprt->xp_tp);
106 if (xprt->xp_ltaddr.buf)
107 free(xprt->xp_ltaddr.buf);
108 if (xprt->xp_rtaddr.buf)
109 free(xprt->xp_rtaddr.buf);
114 if (rpc_buffer(xprt))
115 free(rpc_buffer(xprt));
116 svc_xprt_free(xprt);
122 SVCXPRT *xprt;
148 if ((xprt = svc_xprt_alloc()) == NULL)
151 svc_flags(xprt) |= SVC_DGRAM;
157 if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL)
159 xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
162 xprt->xp_fd = fd;
163 xprt->xp_p2 = (caddr_t)su;
164 xprt->xp_verf.oa_base = su->su_verfbody;
165 xprt->xp_ops = svc_dg_ops();
169 su->su_tudata.udata.buf = (char *)rpc_buffer(xprt);
174 SVC_XP_AUTH(xprt).svc_ah_ops = svc_auth_any_ops;
176 SVC_XP_AUTH(xprt).svc_ah_private = NULL;
177 return (xprt);
180 if (xprt)
181 svc_dg_xprtfree(xprt);
188 SVCXPRT *xprt;
190 if ((xprt = svc_dg_create_private(fd, sendsize, recvsize)) != NULL)
191 xprt_register(xprt);
192 return (xprt);
198 SVCXPRT *xprt;
202 if ((xprt = svc_xprt_alloc()) == NULL)
206 SVCEXT(xprt)->parent = parent;
208 SVCEXT(xprt)->flags = SVCEXT(parent)->flags;
210 xprt->xp_fd = parent->xp_fd;
211 xprt->xp_port = parent->xp_port;
212 xprt->xp_ops = svc_dg_ops();
214 xprt->xp_tp = (char *)strdup(parent->xp_tp);
215 if (xprt->xp_tp == NULL) {
217 svc_dg_xprtfree(xprt);
222 xprt->xp_netid = (char *)strdup(parent->xp_netid);
223 if (xprt->xp_netid == NULL) {
227 svc_dg_xprtfree(xprt);
231 xprt->xp_ltaddr = parent->xp_ltaddr; /* shared with parent */
233 xprt->xp_rtaddr = parent->xp_rtaddr;
234 xprt->xp_rtaddr.buf = malloc(xprt->xp_rtaddr.maxlen);
235 if (xprt->xp_rtaddr.buf == NULL) {
236 svc_dg_xprtfree(xprt);
239 (void) memcpy(xprt->xp_rtaddr.buf, parent->xp_rtaddr.buf,
240 xprt->xp_rtaddr.maxlen);
241 xprt->xp_type = parent->xp_type;
244 svc_dg_xprtfree(xprt);
249 if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL) {
250 svc_dg_xprtfree(xprt);
254 xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
258 su->su_tudata.udata.buf = (char *)rpc_buffer(xprt);
262 xprt->xp_p2 = (caddr_t)su; /* get_svc_dg_data(xprt) = su */
263 xprt->xp_verf.oa_base = su->su_verfbody;
265 return (xprt);
270 svc_dg_stat(SVCXPRT *xprt)
313 set_src_addr(SVCXPRT *xprt, struct netbuf *opt)
322 nbufp = (struct netbuf *)xprt->xp_p2;
323 ltaddr = &xprt->xp_ltaddr;
360 svc_dg_recv(SVCXPRT *xprt, struct rpc_msg *msg)
363 struct svc_dg_data *su = get_svc_dg_data(xprt);
372 tu_data->addr = xprt->xp_rtaddr;
379 if (t_rcvudata(xprt->xp_fd, tu_data, &moreflag) == -1) {
387 lookres = t_look(xprt->xp_fd);
389 (t_rcvuderr(xprt->xp_fd,
415 xprt->xp_rtaddr.len = tu_data->addr.len;
425 if (cache_get(xprt, msg, &reply, &replylen)) {
430 set_src_addr(xprt, &tu_data->opt);
431 (void) t_sndudata(xprt->xp_fd, tu_data);
432 tu_data->udata.buf = (char *)rpc_buffer(xprt);
441 if ((nconf = getnetconfigent(xprt->xp_netid)) != NULL) {
446 nbufp = (struct netbuf *)(xprt->xp_p2);
448 &xprt->xp_ltaddr) < 0) {
474 svc_dg_reply(SVCXPRT *xprt, struct rpc_msg *msg)
477 struct svc_dg_data *su = get_svc_dg_data(xprt);
499 SVCAUTH_WRAP(&SVC_XP_AUTH(xprt), xdrs, xdr_results,
507 set_src_addr(xprt, &tu_data->opt);
509 if (t_sndudata(xprt->xp_fd, tu_data) == 0) {
512 cache_set(xprt, (uint32_t)slen);
527 svc_dg_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
530 svc_args_done(xprt);
532 return (SVCAUTH_UNWRAP(&SVC_XP_AUTH(xprt),
533 &(get_svc_dg_data(xprt)->su_xdrs), xdr_args, args_ptr));
537 svc_dg_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
540 XDR *xdrs = &(get_svc_dg_data(xprt)->su_xdrs);
547 svc_dg_destroy(SVCXPRT *xprt)
550 _svc_dg_destroy_private(xprt);
555 _svc_dg_destroy_private(SVCXPRT *xprt)
559 if (SVCEXT(xprt)->parent)
561 xprt = SVCEXT(xprt)->parent;
563 svc_flags(xprt) |= SVC_DEFUNCT;
565 if (SVCEXT(xprt)->refcnt > 0)
569 xprt_unregister(xprt);
570 (void) t_close(xprt->xp_fd);
573 svc_xprt_destroy(xprt);
575 svc_dg_xprtfree(xprt);
580 svc_dg_control(SVCXPRT *xprt, const uint_t rq, void *in)
584 if (xprt->xp_p2 == NULL)
587 *(uint32_t *)in = ((struct svc_dg_data *)(xprt->xp_p2))->su_xid;
685 svc_dg_enablecache(SVCXPRT *xprt, const uint_t size)
692 if (svc_mt_mode != RPC_SVC_MT_NONE && SVCEXT(xprt)->parent != NULL)
694 transp = SVCEXT(xprt)->parent;
696 transp = xprt;
750 cache_set(SVCXPRT *xprt, uint32_t replylen)
766 if (svc_mt_mode != RPC_SVC_MT_NONE && SVCEXT(xprt)->parent != NULL)
768 parent = SVCEXT(xprt)->parent;
770 parent = xprt;
772 su = get_svc_dg_data(xprt);
817 if (nconf = getnetconfigent(xprt->xp_netid)) {
818 uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr);
826 newbuf2 = malloc(sizeof (char) * xprt->xp_rtaddr.len);
837 victim->cache_reply = rpc_buffer(xprt);
838 rpc_buffer(xprt) = newbuf;
839 xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
841 su->su_tudata.udata.buf = (char *)rpc_buffer(xprt);
846 victim->cache_addr = xprt->xp_rtaddr;
848 (void) memcpy(victim->cache_addr.buf, xprt->xp_rtaddr.buf,
849 (int)xprt->xp_rtaddr.len);
864 cache_get(SVCXPRT *xprt, struct rpc_msg *msg, char **replyp,
878 if (svc_mt_mode != RPC_SVC_MT_NONE && SVCEXT(xprt)->parent != NULL)
880 parent = SVCEXT(xprt)->parent;
882 parent = xprt;
884 su = get_svc_dg_data(xprt);
896 ent->cache_addr.len == xprt->xp_rtaddr.len &&
897 (memcmp(ent->cache_addr.buf, xprt->xp_rtaddr.buf,
898 xprt->xp_rtaddr.len) == 0)) {
900 if (nconf = getnetconfigent(xprt->xp_netid)) {
901 uaddr = taddr2uaddr(nconf, &xprt->xp_rtaddr);