Lines Matching defs:cu

110 static int _rcv_unitdata_err(struct cu_data *cu);
131 struct cu_data *cu = NULL; /* private data */
184 cu = malloc(sizeof (*cu) + ssz + rsz);
185 if (cu == NULL)
187 if ((cu->cu_raddr.buf = malloc(svcaddr->len)) == NULL)
189 (void) memcpy(cu->cu_raddr.buf, svcaddr->buf, (size_t)svcaddr->len);
190 cu->cu_raddr.len = cu->cu_raddr.maxlen = svcaddr->len;
191 cu->cu_outbuf_start = &cu->cu_inbuf[rsz];
193 cu->cu_wait.tv_sec = 15; /* heuristically chosen */
194 cu->cu_wait.tv_usec = 0;
195 cu->cu_total.tv_sec = -1;
196 cu->cu_total.tv_usec = -1;
197 cu->cu_sendsz = ssz;
198 cu->cu_recvsz = rsz;
203 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, ssz, XDR_ENCODE);
204 if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
210 cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
211 XDR_DESTROY(&(cu->cu_outxdrs));
212 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf_start, ssz, XDR_ENCODE);
217 tr_data->udata.maxlen = cu->cu_recvsz;
218 tr_data->udata.buf = cu->cu_inbuf;
219 cu->cu_tr_data = tr_data;
226 cu->cu_closeit = FALSE;
227 cu->cu_fd = fd;
229 cl->cl_private = (caddr_t)cu;
233 cu->pfdp.fd = cu->cu_fd;
234 cu->pfdp.events = MASKVAL;
244 if (cu) {
245 free(cu->cu_raddr.buf);
246 free(cu);
257 struct cu_data *cu = (struct cu_data *)cl->cl_private;
273 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
276 rpc_fd_unlock(dgtbl, cu->cu_fd);
280 if (cu->cu_total.tv_usec == -1) {
283 timeout = cu->cu_total; /* use default timeout */
288 retransmit_time = cu->cu_wait;
290 tu_data.addr = cu->cu_raddr;
293 xdrs = &(cu->cu_outxdrs);
301 x_id = ntohl(*(uint32_t *)(cu->cu_outbuf)) + 1; /* set XID */
303 *(uint32_t *)cu->cu_outbuf = htonl(x_id);
306 if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) ||
310 rpc_fd_unlock(dgtbl, cu->cu_fd);
315 uint32_t *u = (uint32_t *)&cu->cu_outbuf[cu->cu_xdrpos];
317 if (!__rpc_gss_wrap(cl->cl_auth, cu->cu_outbuf,
318 ((char *)u) - cu->cu_outbuf, xdrs, xargs, argsp)) {
319 rpc_fd_unlock(dgtbl, cu->cu_fd);
326 tu_data.udata.buf = cu->cu_outbuf_start;
329 if (t_sndudata(cu->cu_fd, &tu_data) == -1) {
332 rpc_fd_unlock(dgtbl, cu->cu_fd);
340 rpc_fd_unlock(dgtbl, cu->cu_fd);
369 rpc_fd_unlock(dgtbl, cu->cu_fd);
383 switch (poll(&cu->pfdp, 1,
389 rpc_fd_unlock(dgtbl, cu->cu_fd);
465 rpc_fd_unlock(dgtbl, cu->cu_fd);
472 if (cu->pfdp.revents & POLLNVAL || (cu->pfdp.revents == 0)) {
482 rpc_fd_unlock(dgtbl, cu->cu_fd);
492 res = t_rcvudata(cu->cu_fd, cu->cu_tr_data, &moreflag);
518 if ((err = _rcv_unitdata_err(cu)) == 0)
527 rpc_fd_unlock(dgtbl, cu->cu_fd);
530 if (cu->cu_tr_data->udata.len < (uint_t)sizeof (uint32_t))
534 if (*((uint32_t *)(cu->cu_inbuf)) !=
536 *((uint32_t *)(cu->cu_outbuf)))
546 xdrmem_create(&reply_xdrs, cu->cu_inbuf,
547 (uint_t)cu->cu_tr_data->udata.len, XDR_DECODE);
609 rpc_fd_unlock(dgtbl, cu->cu_fd);
617 struct cu_data *cu = (struct cu_data *)cl->cl_private;
623 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
626 rpc_fd_unlock(dgtbl, cu->cu_fd);
630 tu_data.addr = cu->cu_raddr;
632 xdrs = &(cu->cu_outxdrs);
640 x_id = ntohl(*(uint32_t *)(cu->cu_outbuf)) + 1; /* set XID */
642 *(uint32_t *)cu->cu_outbuf = htonl(x_id);
645 if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) ||
649 rpc_fd_unlock(dgtbl, cu->cu_fd);
654 uint32_t *u = (uint32_t *)&cu->cu_outbuf[cu->cu_xdrpos];
656 if (!__rpc_gss_wrap(cl->cl_auth, cu->cu_outbuf,
657 ((char *)u) - cu->cu_outbuf, xdrs, xargs, argsp)) {
658 rpc_fd_unlock(dgtbl, cu->cu_fd);
664 tu_data.udata.buf = cu->cu_outbuf_start;
667 if (t_sndudata(cu->cu_fd, &tu_data) == -1) {
670 rpc_fd_unlock(dgtbl, cu->cu_fd);
674 rpc_fd_unlock(dgtbl, cu->cu_fd);
682 struct cu_data *cu = (struct cu_data *)cl->cl_private;
691 struct cu_data *cu = (struct cu_data *)cl->cl_private;
692 XDR *xdrs = &(cu->cu_outxdrs);
695 (void) rpc_fd_lock(dgtbl, cu->cu_fd);
698 rpc_fd_unlock(dgtbl, cu->cu_fd);
712 struct cu_data *cu = (struct cu_data *)cl->cl_private;
714 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
715 rpc_fd_unlock(dgtbl, cu->cu_fd);
721 cu->cu_closeit = TRUE;
722 rpc_fd_unlock(dgtbl, cu->cu_fd);
725 cu->cu_closeit = FALSE;
726 rpc_fd_unlock(dgtbl, cu->cu_fd);
732 rpc_fd_unlock(dgtbl, cu->cu_fd);
739 rpc_fd_unlock(dgtbl, cu->cu_fd);
743 cu->cu_total = *(struct timeval *)info;
747 *(struct timeval *)info = cu->cu_total;
751 (void) memcpy(info, cu->cu_raddr.buf, (size_t)cu->cu_raddr.len);
756 rpc_fd_unlock(dgtbl, cu->cu_fd);
760 cu->cu_wait = *(struct timeval *)info;
764 *(struct timeval *)info = cu->cu_wait;
768 *(int *)info = cu->cu_fd;
772 *(struct netbuf *)info = cu->cu_raddr;
777 if (cu->cu_raddr.maxlen < addr->len) {
778 free(cu->cu_raddr.buf);
779 if ((cu->cu_raddr.buf = malloc(addr->len)) == NULL) {
780 rpc_fd_unlock(dgtbl, cu->cu_fd);
783 cu->cu_raddr.maxlen = addr->len;
785 cu->cu_raddr.len = addr->len;
786 (void) memcpy(cu->cu_raddr.buf, addr->buf, addr->len);
795 *(uint32_t *)info = ntohl(*(uint32_t *)cu->cu_outbuf);
801 *(uint32_t *)cu->cu_outbuf = htonl(*(uint32_t *)info - 1);
813 *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf +
819 *(uint32_t *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT) =
832 *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf +
838 *(uint32_t *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT) =
844 rpc_fd_unlock(dgtbl, cu->cu_fd);
847 rpc_fd_unlock(dgtbl, cu->cu_fd);
855 struct cu_data *cu = (struct cu_data *)cl->cl_private;
856 int cu_fd = cu->cu_fd;
859 if (cu->cu_closeit)
861 XDR_DESTROY(&(cu->cu_outxdrs));
862 cu->cu_tr_data->udata.buf = NULL;
863 (void) t_free((char *)cu->cu_tr_data, T_UNITDATA);
864 free(cu->cu_raddr.buf);
865 free(cu);
913 _rcv_unitdata_err(struct cu_data *cu)
919 uderr = (struct t_uderr *)t_alloc(cu->cu_fd, T_UDERROR, T_ADDR);
921 if (t_rcvuderr(cu->cu_fd, uderr) == 0) {
925 if (uderr->addr.len != cu->cu_raddr.len ||
926 (memcmp(uderr->addr.buf, cu->cu_raddr.buf,
927 cu->cu_raddr.len))) {