Lines Matching full:cu
205 struct cu_data *cu = NULL; /* private data */ in clnt_dg_create() local
239 cu = mem_alloc(sizeof (*cu) + sendsz + recvsz); in clnt_dg_create()
240 if (cu == NULL) in clnt_dg_create()
242 (void) memcpy(&cu->cu_raddr, svcaddr->buf, (size_t)svcaddr->len); in clnt_dg_create()
243 cu->cu_rlen = svcaddr->len; in clnt_dg_create()
244 cu->cu_outbuf = &cu->cu_inbuf[recvsz]; in clnt_dg_create()
246 cu->cu_wait.tv_sec = 15; /* heuristically chosen */ in clnt_dg_create()
247 cu->cu_wait.tv_usec = 0; in clnt_dg_create()
248 cu->cu_total.tv_sec = -1; in clnt_dg_create()
249 cu->cu_total.tv_usec = -1; in clnt_dg_create()
250 cu->cu_sendsz = sendsz; in clnt_dg_create()
251 cu->cu_recvsz = recvsz; in clnt_dg_create()
252 cu->cu_async = FALSE; in clnt_dg_create()
253 cu->cu_connect = FALSE; in clnt_dg_create()
254 cu->cu_connected = FALSE; in clnt_dg_create()
259 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outhdr, MCALL_MSG_SIZE, in clnt_dg_create()
261 if (! xdr_callhdr(&cu->cu_outxdrs, &call_msg)) { in clnt_dg_create()
266 cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); in clnt_dg_create()
267 XDR_DESTROY(&cu->cu_outxdrs); in clnt_dg_create()
268 xdrmem_create(&cu->cu_outxdrs, cu->cu_outbuf, sendsz, XDR_ENCODE); in clnt_dg_create()
281 cu->cu_closeit = FALSE; in clnt_dg_create()
282 cu->cu_fd = fd; in clnt_dg_create()
284 cl->cl_private = (caddr_t)(void *)cu; in clnt_dg_create()
288 cu->cu_kq = -1; in clnt_dg_create()
289 EV_SET(&cu->cu_kin, cu->cu_fd, EVFILT_READ, EV_ADD, 0, 0, 0); in clnt_dg_create()
298 if (cu) in clnt_dg_create()
299 mem_free(cu, sizeof (*cu) + sendsz + recvsz); in clnt_dg_create()
317 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_call() local
343 elem = dg_fd_find(cu->cu_fd); in clnt_dg_call()
346 if (cu->cu_total.tv_usec == -1) { in clnt_dg_call()
349 timeout = cu->cu_total; /* use default timeout */ in clnt_dg_call()
352 if (cu->cu_connect && !cu->cu_connected) { in clnt_dg_call()
353 if (_connect(cu->cu_fd, (struct sockaddr *)&cu->cu_raddr, in clnt_dg_call()
354 cu->cu_rlen) < 0) { in clnt_dg_call()
355 cu->cu_error.re_errno = errno; in clnt_dg_call()
356 cu->cu_error.re_status = RPC_CANTSEND; in clnt_dg_call()
359 cu->cu_connected = 1; in clnt_dg_call()
361 if (cu->cu_connected) { in clnt_dg_call()
365 sa = (struct sockaddr *)&cu->cu_raddr; in clnt_dg_call()
366 salen = cu->cu_rlen; in clnt_dg_call()
370 retransmit_time = next_sendtime = cu->cu_wait; in clnt_dg_call()
374 if (cu->cu_kq >= 0) in clnt_dg_call()
375 _close(cu->cu_kq); in clnt_dg_call()
376 if ((cu->cu_kq = kqueue()) < 0) { in clnt_dg_call()
377 cu->cu_error.re_errno = errno; in clnt_dg_call()
378 cu->cu_error.re_status = RPC_CANTSEND; in clnt_dg_call()
384 if (cu->cu_async == TRUE && xargs == NULL) in clnt_dg_call()
391 xid = ntohl(*(u_int32_t *)(void *)(cu->cu_outhdr)); in clnt_dg_call()
393 *(u_int32_t *)(void *)(cu->cu_outhdr) = htonl(xid); in clnt_dg_call()
395 xdrs = &(cu->cu_outxdrs); in clnt_dg_call()
400 if ((! XDR_PUTBYTES(xdrs, cu->cu_outhdr, cu->cu_xdrpos)) || in clnt_dg_call()
404 cu->cu_error.re_status = RPC_CANTENCODEARGS; in clnt_dg_call()
408 *(uint32_t *) &cu->cu_outhdr[cu->cu_xdrpos] = htonl(proc); in clnt_dg_call()
409 if (!__rpc_gss_wrap(cl->cl_auth, cu->cu_outhdr, in clnt_dg_call()
410 cu->cu_xdrpos + sizeof(uint32_t), in clnt_dg_call()
412 cu->cu_error.re_status = RPC_CANTENCODEARGS; in clnt_dg_call()
419 if (_sendto(cu->cu_fd, cu->cu_outbuf, outlen, 0, sa, salen) != outlen) { in clnt_dg_call()
420 cu->cu_error.re_errno = errno; in clnt_dg_call()
421 cu->cu_error.re_status = RPC_CANTSEND; in clnt_dg_call()
429 cu->cu_error.re_status = RPC_TIMEDOUT; in clnt_dg_call()
459 n = _kevent(cu->cu_kq, &cu->cu_kin, kin_len, &kv, 1, &ts); in clnt_dg_call()
465 cu->cu_error.re_errno = kv.data; in clnt_dg_call()
466 cu->cu_error.re_status = RPC_CANTRECV; in clnt_dg_call()
471 recvlen = _recvfrom(cu->cu_fd, cu->cu_inbuf, in clnt_dg_call()
472 cu->cu_recvsz, 0, NULL, NULL); in clnt_dg_call()
475 cu->cu_error.re_errno = errno; in clnt_dg_call()
476 cu->cu_error.re_status = RPC_CANTRECV; in clnt_dg_call()
480 (cu->cu_async == TRUE || in clnt_dg_call()
481 *((u_int32_t *)(void *)(cu->cu_inbuf)) == in clnt_dg_call()
482 *((u_int32_t *)(void *)(cu->cu_outbuf)))) { in clnt_dg_call()
488 cu->cu_error.re_errno = errno; in clnt_dg_call()
489 cu->cu_error.re_status = RPC_CANTRECV; in clnt_dg_call()
497 cu->cu_error.re_status = RPC_TIMEDOUT; in clnt_dg_call()
527 xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int)recvlen, XDR_DECODE); in clnt_dg_call()
533 cu->cu_error.re_status = RPC_SUCCESS; in clnt_dg_call()
535 _seterr_reply(&reply_msg, &(cu->cu_error)); in clnt_dg_call()
537 if (cu->cu_error.re_status == RPC_SUCCESS) { in clnt_dg_call()
560 cu->cu_error.re_status = RPC_AUTHERROR; in clnt_dg_call()
561 cu->cu_error.re_why = AUTH_INVALIDRESP; in clnt_dg_call()
568 cu->cu_error.re_status = in clnt_dg_call()
582 else if (cu->cu_error.re_status == RPC_AUTHERROR) in clnt_dg_call()
592 cu->cu_error.re_status = RPC_CANTDECODERES; in clnt_dg_call()
596 if (cu->cu_kq >= 0) in clnt_dg_call()
597 _close(cu->cu_kq); in clnt_dg_call()
598 cu->cu_kq = -1; in clnt_dg_call()
600 return (cu->cu_error.re_status); in clnt_dg_call()
606 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_geterr() local
608 *errp = cu->cu_error; in clnt_dg_geterr()
614 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_freeres() local
616 XDR *xdrs = &(cu->cu_outxdrs); in clnt_dg_freeres()
624 elem = dg_fd_find(cu->cu_fd); in clnt_dg_freeres()
642 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_control() local
651 elem = dg_fd_find(cu->cu_fd); in clnt_dg_control()
656 cu->cu_closeit = TRUE; in clnt_dg_control()
660 cu->cu_closeit = FALSE; in clnt_dg_control()
676 cu->cu_total = *(struct timeval *)info; in clnt_dg_control()
679 *(struct timeval *)info = cu->cu_total; in clnt_dg_control()
683 (void) memcpy(info, &cu->cu_raddr, (size_t)cu->cu_rlen); in clnt_dg_control()
690 cu->cu_wait = *(struct timeval *)info; in clnt_dg_control()
693 *(struct timeval *)info = cu->cu_wait; in clnt_dg_control()
696 *(int *)info = cu->cu_fd; in clnt_dg_control()
700 addr->buf = &cu->cu_raddr; in clnt_dg_control()
701 addr->len = cu->cu_rlen; in clnt_dg_control()
702 addr->maxlen = sizeof cu->cu_raddr; in clnt_dg_control()
706 if (addr->len < sizeof cu->cu_raddr) { in clnt_dg_control()
710 (void) memcpy(&cu->cu_raddr, addr->buf, addr->len); in clnt_dg_control()
711 cu->cu_rlen = addr->len; in clnt_dg_control()
720 ntohl(*(u_int32_t *)(void *)cu->cu_outhdr); in clnt_dg_control()
725 *(u_int32_t *)(void *)cu->cu_outhdr = in clnt_dg_control()
738 ntohl(*(u_int32_t *)(void *)(cu->cu_outhdr + in clnt_dg_control()
743 *(u_int32_t *)(void *)(cu->cu_outhdr + 4 * BYTES_PER_XDR_UNIT) in clnt_dg_control()
755 ntohl(*(u_int32_t *)(void *)(cu->cu_outhdr + in clnt_dg_control()
760 *(u_int32_t *)(void *)(cu->cu_outhdr + 3 * BYTES_PER_XDR_UNIT) in clnt_dg_control()
764 cu->cu_async = *(int *)info; in clnt_dg_control()
767 cu->cu_connect = *(int *)info; in clnt_dg_control()
780 struct cu_data *cu = (struct cu_data *)cl->cl_private; in clnt_dg_destroy() local
782 int cu_fd = cu->cu_fd; in clnt_dg_destroy()
791 if (cu->cu_closeit) in clnt_dg_destroy()
793 if (cu->cu_kq >= 0) in clnt_dg_destroy()
794 _close(cu->cu_kq); in clnt_dg_destroy()
795 XDR_DESTROY(&(cu->cu_outxdrs)); in clnt_dg_destroy()
796 mem_free(cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); in clnt_dg_destroy()