Lines Matching refs:ct

204 	struct ct_data *ct = NULL;	/* client handle */
216 ct = (struct ct_data *)mem_alloc(sizeof (*ct));
217 if ((cl == (CLIENT *)NULL) || (ct == (struct ct_data *)NULL)) {
224 ct->ct_addr.buf = NULL;
248 ct->ct_closeit = FALSE;
253 ct->ct_fd = fd;
254 ct->ct_wait.tv_usec = 0;
255 ct->ct_waitset = FALSE;
256 ct->ct_addr.buf = malloc(raddr->maxlen);
257 if (ct->ct_addr.buf == NULL)
259 memcpy(ct->ct_addr.buf, raddr->buf, raddr->len);
260 ct->ct_addr.len = raddr->len;
261 ct->ct_addr.maxlen = raddr->maxlen;
276 xdrmem_create(&(ct->ct_xdrs), ct->ct_u.ct_mcallc, MCALL_MSG_SIZE,
278 if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
279 if (ct->ct_closeit) {
284 ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs));
285 XDR_DESTROY(&(ct->ct_xdrs));
286 assert(ct->ct_mpos + sizeof(uint32_t) <= MCALL_MSG_SIZE);
293 cl->cl_private = ct;
297 xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
302 if (ct) {
303 if (ct->ct_addr.len)
304 mem_free(ct->ct_addr.buf, ct->ct_addr.len);
305 mem_free(ct, sizeof (struct ct_data));
316 struct ct_data *ct = (struct ct_data *) cl->cl_private;
317 XDR *xdrs = &(ct->ct_xdrs);
321 u_int32_t *msg_x_id = &ct->ct_u.ct_mcalli; /* yuk */
332 elem = vc_fd_find(ct->ct_fd);
335 if (!ct->ct_waitset) {
338 ct->ct_wait = timeout;
347 ct->ct_error.re_status = RPC_SUCCESS;
351 if ((! XDR_PUTBYTES(xdrs, ct->ct_u.ct_mcallc, ct->ct_mpos)) ||
355 if (ct->ct_error.re_status == RPC_SUCCESS)
356 ct->ct_error.re_status = RPC_CANTENCODEARGS;
359 return (ct->ct_error.re_status);
362 *(uint32_t *) &ct->ct_u.ct_mcallc[ct->ct_mpos] = htonl(proc);
363 if (! __rpc_gss_wrap(cl->cl_auth, ct->ct_u.ct_mcallc,
364 ct->ct_mpos + sizeof(uint32_t),
366 if (ct->ct_error.re_status == RPC_SUCCESS)
367 ct->ct_error.re_status = RPC_CANTENCODEARGS;
370 return (ct->ct_error.re_status);
375 return (ct->ct_error.re_status = RPC_CANTSEND);
386 return(ct->ct_error.re_status = RPC_TIMEDOUT);
400 return (ct->ct_error.re_status);
404 if (ct->ct_error.re_status == RPC_SUCCESS)
407 return (ct->ct_error.re_status);
416 _seterr_reply(&reply_msg, &(ct->ct_error));
417 if (ct->ct_error.re_status == RPC_SUCCESS) {
420 ct->ct_error.re_status = RPC_AUTHERROR;
421 ct->ct_error.re_why = AUTH_INVALIDRESP;
430 if (ct->ct_error.re_status == RPC_SUCCESS)
431 ct->ct_error.re_status =
448 return (ct->ct_error.re_status);
454 struct ct_data *ct;
459 ct = (struct ct_data *) cl->cl_private;
460 *errp = ct->ct_error;
466 struct ct_data *ct;
475 ct = (struct ct_data *)cl->cl_private;
476 xdrs = &(ct->ct_xdrs);
481 elem = vc_fd_find(ct->ct_fd);
514 struct ct_data *ct;
522 ct = (struct ct_data *)cl->cl_private;
527 elem = vc_fd_find(ct->ct_fd);
533 ct->ct_closeit = TRUE;
537 ct->ct_closeit = FALSE;
555 ct->ct_wait = *(struct timeval *)infop;
556 ct->ct_waitset = TRUE;
559 *(struct timeval *)infop = ct->ct_wait;
562 (void) memcpy(info, ct->ct_addr.buf, (size_t)ct->ct_addr.len);
565 *(int *)info = ct->ct_fd;
569 *(struct netbuf *)info = ct->ct_addr;
580 ntohlp(info, &ct->ct_u.ct_mcalli);
585 htonlp(&ct->ct_u.ct_mcalli, info, 1);
594 ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
598 htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
608 ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
612 htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
627 struct ct_data *ct = (struct ct_data *) cl->cl_private;
629 int ct_fd = ct->ct_fd;
635 ct = (struct ct_data *) cl->cl_private;
642 if (ct->ct_closeit && ct->ct_fd != -1) {
643 (void)_close(ct->ct_fd);
645 XDR_DESTROY(&(ct->ct_xdrs));
646 free(ct->ct_addr.buf);
647 mem_free(ct, sizeof(struct ct_data));
667 struct ct_data *ct = (struct ct_data *)ctp;
669 int milliseconds = (int)((ct->ct_wait.tv_sec * 1000) +
670 (ct->ct_wait.tv_usec / 1000));
674 fd.fd = ct->ct_fd;
679 ct->ct_error.re_status = RPC_TIMEDOUT;
685 ct->ct_error.re_status = RPC_CANTRECV;
686 ct->ct_error.re_errno = errno;
693 if ((_getpeername(ct->ct_fd, &sa, &sal) == 0) &&
695 len = __msgread(ct->ct_fd, buf, (size_t)len);
697 len = _read(ct->ct_fd, buf, (size_t)len);
703 ct->ct_error.re_errno = ECONNRESET;
704 ct->ct_error.re_status = RPC_CANTRECV;
709 ct->ct_error.re_errno = errno;
710 ct->ct_error.re_status = RPC_CANTRECV;
721 struct ct_data *ct = (struct ct_data *)ctp;
725 if ((_getpeername(ct->ct_fd, &sa, &sal) == 0) &&
728 if ((i = __msgwrite(ct->ct_fd, buf,
730 ct->ct_error.re_errno = errno;
731 ct->ct_error.re_status = RPC_CANTSEND;
737 if ((i = _write(ct->ct_fd, buf, (size_t)cnt)) == -1) {
738 ct->ct_error.re_errno = errno;
739 ct->ct_error.re_status = RPC_CANTSEND;