Lines Matching defs:cu

117 static int _rcv_unitdata_err(struct cu_data *cu);
138 struct cu_data *cu = NULL; /* private data */
191 cu = malloc(sizeof (*cu) + ssz + rsz);
192 if (cu == NULL)
194 if ((cu->cu_raddr.buf = malloc(svcaddr->len)) == NULL)
196 (void) memcpy(cu->cu_raddr.buf, svcaddr->buf, (size_t)svcaddr->len);
197 cu->cu_raddr.len = cu->cu_raddr.maxlen = svcaddr->len;
198 cu->cu_outbuf_start = &cu->cu_inbuf[rsz];
200 cu->cu_wait.tv_sec = 15; /* heuristically chosen */
201 cu->cu_wait.tv_usec = 0;
202 cu->cu_total.tv_sec = -1;
203 cu->cu_total.tv_usec = -1;
204 cu->cu_sendsz = ssz;
205 cu->cu_recvsz = rsz;
210 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, ssz, XDR_ENCODE);
211 if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
217 cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
218 XDR_DESTROY(&(cu->cu_outxdrs));
219 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf_start, ssz, XDR_ENCODE);
225 tr_data->udata.maxlen = cu->cu_recvsz;
226 tr_data->udata.buf = cu->cu_inbuf;
227 cu->cu_tr_data = tr_data;
234 cu->cu_closeit = FALSE;
235 cu->cu_fd = fd;
237 cl->cl_private = (caddr_t)cu;
241 cu->pfdp.fd = cu->cu_fd;
242 cu->pfdp.events = MASKVAL;
252 if (cu) {
253 free(cu->cu_raddr.buf);
254 free(cu);
265 struct cu_data *cu = (struct cu_data *)cl->cl_private;
281 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
284 rpc_fd_unlock(dgtbl, cu->cu_fd);
288 if (cu->cu_total.tv_usec == -1) {
291 timeout = cu->cu_total; /* use default timeout */
296 retransmit_time = cu->cu_wait;
298 tu_data.addr = cu->cu_raddr;
301 xdrs = &(cu->cu_outxdrs);
309 x_id = ntohl(*(uint32_t *)(cu->cu_outbuf)) + 1; /* set XID */
311 *(uint32_t *)cu->cu_outbuf = htonl(x_id);
314 if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) ||
318 rpc_fd_unlock(dgtbl, cu->cu_fd);
323 uint32_t *u = (uint32_t *)&cu->cu_outbuf[cu->cu_xdrpos];
325 if (!__rpc_gss_wrap(cl->cl_auth, cu->cu_outbuf,
326 ((char *)u) - cu->cu_outbuf, xdrs, xargs, argsp)) {
327 rpc_fd_unlock(dgtbl, cu->cu_fd);
334 tu_data.udata.buf = cu->cu_outbuf_start;
337 if (t_sndudata(cu->cu_fd, &tu_data) == -1) {
340 rpc_fd_unlock(dgtbl, cu->cu_fd);
348 rpc_fd_unlock(dgtbl, cu->cu_fd);
377 rpc_fd_unlock(dgtbl, cu->cu_fd);
391 switch (poll(&cu->pfdp, 1,
397 rpc_fd_unlock(dgtbl, cu->cu_fd);
472 rpc_fd_unlock(dgtbl, cu->cu_fd);
479 if (cu->pfdp.revents & POLLNVAL || (cu->pfdp.revents == 0)) {
489 rpc_fd_unlock(dgtbl, cu->cu_fd);
499 res = t_rcvudata(cu->cu_fd, cu->cu_tr_data, &moreflag);
525 if ((err = _rcv_unitdata_err(cu)) == 0)
534 rpc_fd_unlock(dgtbl, cu->cu_fd);
537 if (cu->cu_tr_data->udata.len < (uint_t)sizeof (uint32_t))
541 if (*((uint32_t *)(cu->cu_inbuf)) !=
543 *((uint32_t *)(cu->cu_outbuf)))
553 xdrmem_create(&reply_xdrs, cu->cu_inbuf,
554 (uint_t)cu->cu_tr_data->udata.len, XDR_DECODE);
616 rpc_fd_unlock(dgtbl, cu->cu_fd);
624 struct cu_data *cu = (struct cu_data *)cl->cl_private;
630 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
633 rpc_fd_unlock(dgtbl, cu->cu_fd);
637 tu_data.addr = cu->cu_raddr;
639 xdrs = &(cu->cu_outxdrs);
647 x_id = ntohl(*(uint32_t *)(cu->cu_outbuf)) + 1; /* set XID */
649 *(uint32_t *)cu->cu_outbuf = htonl(x_id);
652 if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) ||
656 rpc_fd_unlock(dgtbl, cu->cu_fd);
661 uint32_t *u = (uint32_t *)&cu->cu_outbuf[cu->cu_xdrpos];
663 if (!__rpc_gss_wrap(cl->cl_auth, cu->cu_outbuf,
664 ((char *)u) - cu->cu_outbuf, xdrs, xargs, argsp)) {
665 rpc_fd_unlock(dgtbl, cu->cu_fd);
671 tu_data.udata.buf = cu->cu_outbuf_start;
674 if (t_sndudata(cu->cu_fd, &tu_data) == -1) {
677 rpc_fd_unlock(dgtbl, cu->cu_fd);
681 rpc_fd_unlock(dgtbl, cu->cu_fd);
696 struct cu_data *cu = (struct cu_data *)cl->cl_private;
697 XDR *xdrs = &(cu->cu_outxdrs);
700 (void) rpc_fd_lock(dgtbl, cu->cu_fd);
703 rpc_fd_unlock(dgtbl, cu->cu_fd);
717 struct cu_data *cu = (struct cu_data *)cl->cl_private;
719 if (rpc_fd_lock(dgtbl, cu->cu_fd)) {
720 rpc_fd_unlock(dgtbl, cu->cu_fd);
726 cu->cu_closeit = TRUE;
727 rpc_fd_unlock(dgtbl, cu->cu_fd);
730 cu->cu_closeit = FALSE;
731 rpc_fd_unlock(dgtbl, cu->cu_fd);
737 rpc_fd_unlock(dgtbl, cu->cu_fd);
744 rpc_fd_unlock(dgtbl, cu->cu_fd);
748 cu->cu_total = *(struct timeval *)info;
752 *(struct timeval *)info = cu->cu_total;
756 (void) memcpy(info, cu->cu_raddr.buf, (size_t)cu->cu_raddr.len);
761 rpc_fd_unlock(dgtbl, cu->cu_fd);
765 cu->cu_wait = *(struct timeval *)info;
769 *(struct timeval *)info = cu->cu_wait;
773 *(int *)info = cu->cu_fd;
777 *(struct netbuf *)info = cu->cu_raddr;
782 if (cu->cu_raddr.maxlen < addr->len) {
783 free(cu->cu_raddr.buf);
784 if ((cu->cu_raddr.buf = malloc(addr->len)) == NULL) {
785 rpc_fd_unlock(dgtbl, cu->cu_fd);
788 cu->cu_raddr.maxlen = addr->len;
790 cu->cu_raddr.len = addr->len;
791 (void) memcpy(cu->cu_raddr.buf, addr->buf, addr->len);
800 *(uint32_t *)info = ntohl(*(uint32_t *)cu->cu_outbuf);
806 *(uint32_t *)cu->cu_outbuf = htonl(*(uint32_t *)info - 1);
818 *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf +
824 *(uint32_t *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT) =
837 *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf +
843 *(uint32_t *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT) =
849 rpc_fd_unlock(dgtbl, cu->cu_fd);
852 rpc_fd_unlock(dgtbl, cu->cu_fd);
860 struct cu_data *cu = (struct cu_data *)cl->cl_private;
861 int cu_fd = cu->cu_fd;
864 if (cu->cu_closeit)
866 XDR_DESTROY(&(cu->cu_outxdrs));
867 cu->cu_tr_data->udata.buf = NULL;
868 (void) t_free((char *)cu->cu_tr_data, T_UNITDATA);
869 free(cu->cu_raddr.buf);
870 free(cu);
918 _rcv_unitdata_err(struct cu_data *cu)
925 uderr = (struct t_uderr *)t_alloc(cu->cu_fd, T_UDERROR, T_ADDR);
927 if (t_rcvuderr(cu->cu_fd, uderr) == 0) {
931 if (uderr->addr.len != cu->cu_raddr.len ||
932 (memcmp(uderr->addr.buf, cu->cu_raddr.buf,
933 cu->cu_raddr.len))) {