Lines Matching defs:ipx

149 	ip_xprt_t *ipx;
160 ipx = fmd_xprt_getspecific(hdl, xp);
169 ip_debug(IP_DEBUG_FINE, "burping ipx %s", IPX_ID(ipx));
170 ipx->ipx_flags |= FMD_XPRT_SUSPENDED;
171 ipx->ipx_spnd_timer = fmd_timer_install(
172 ip_hdl, ipx, NULL, ip_burp);
186 if (ipx->ipx_sndbuf.ipb_size < size) {
187 fmd_hdl_free(hdl, ipx->ipx_sndbuf.ipb_buf,
188 ipx->ipx_sndbuf.ipb_size);
189 ipx->ipx_sndbuf.ipb_size = P2ROUNDUP(size, 16);
190 ipx->ipx_sndbuf.ipb_buf = fmd_hdl_alloc(hdl,
191 ipx->ipx_sndbuf.ipb_size, FMD_SLEEP);
194 buf = ipx->ipx_sndbuf.ipb_buf;
207 "transport %p: %s\n", (void *)ipx->ipx_xprt, strerror(err));
213 if ((n = send(ipx->ipx_fd, buf, r, 0)) < 0) {
216 "failed to send to %s", IPX_ID(ipx));
226 size, IPX_ID(ipx));
244 ip_xprt_t *ipx;
249 for (ipx = ip_xps; ipx != NULL; ipx = ipx->ipx_next) {
250 err = ip_fmdo_send(hdl, ipx->ipx_xprt, ep, nvl);
252 err = ip_fmdo_send(hdl, ipx->ipx_xprt, ep, nvl);
266 ip_xprt_recv(ip_xprt_t *ipx, size_t size)
268 char *buf = ipx->ipx_rcvbuf.ipb_buf;
271 if (ipx->ipx_rcvbuf.ipb_size < size) {
272 fmd_hdl_free(ip_hdl, ipx->ipx_rcvbuf.ipb_buf,
273 ipx->ipx_rcvbuf.ipb_size);
274 ipx->ipx_rcvbuf.ipb_size = P2ROUNDUP(size, 16);
275 ipx->ipx_rcvbuf.ipb_buf = buf = fmd_hdl_alloc(ip_hdl,
276 ipx->ipx_rcvbuf.ipb_size, FMD_SLEEP);
280 if ((n = recv(ipx->ipx_fd, buf, r, MSG_WAITALL)) == 0) {
281 ipx->ipx_done++;
288 "failed to recv on ipx %s", IPX_ID(ipx));
293 if (ipx->ipx_cinfo) {
294 ipx->ipx_cinfo->ipc_retry = ip_retry;
301 return (r ? NULL: ipx->ipx_rcvbuf.ipb_buf);
310 ip_xprt_set_addr(ip_xprt_t *ipx, const struct sockaddr *sap)
338 if (ipx->ipx_addr)
339 fmd_hdl_strfree(ip_hdl, ipx->ipx_addr);
340 ipx->ipx_addr = fmd_hdl_strdup(ip_hdl, buf, FMD_SLEEP);
342 ipx->ipx_addr, (void *)ipx);
346 ip_xprt_auth(ip_xprt_t *ipx)
367 FM_FMRI_AUTH_SERVER, ipx->ipx_addr);
370 (void) nvlist_add_string(nvl, FM_FMRI_AUTH_SERVER, ipx->ipx_addr);
376 ip_xprt_accept(ip_xprt_t *ipx)
385 if ((fd = accept(ipx->ipx_fd, (struct sockaddr *)&sa, &salen)) == -1) {
392 ip_xprt_set_addr(ipx, (struct sockaddr *)&sa);
393 xp = fmd_xprt_open(ip_hdl, ipx->ipx_flags,
394 ip_xprt_auth(ipx), NULL);
395 ip_xprt_create(xp, fd, ipx->ipx_flags, ipx->ipx_cinfo, ipx->ipx_addr);
399 ip_xprt_recv_event(ip_xprt_t *ipx)
407 if ((iph = ip_xprt_recv(ipx, sizeof (ip_hdr_t))) == NULL)
414 iph->iph_magic[3], IPX_ID(ipx));
421 if ((buf = ip_xprt_recv(ipx, size)) == NULL)
427 IPX_ID(ipx), strerror(err));
432 fmd_xprt_post(ip_hdl, ipx->ipx_xprt, nvl, 0);
435 if (fmd_xprt_error(ip_hdl, ipx->ipx_xprt)) {
437 (void *)ipx->ipx_xprt);
438 ipx->ipx_done++;
441 size, IPX_ID(ipx));
447 ip_xprt_t *ipx = arg;
454 while (!ip_quit && !ipx->ipx_done) {
455 if (ipx->ipx_xprt != NULL || (ipx->ipx_flags & FMD_XPRT_ACCEPT))
460 pfd.fd = ipx->ipx_fd;
467 ip_debug(IP_DEBUG_FINE, "hangup fd %d\n", ipx->ipx_fd);
477 (void) fcntl(ipx->ipx_fd, F_SETFL,
478 fcntl(ipx->ipx_fd, F_GETFL, 0) & ~O_NONBLOCK);
480 if (getpeername(ipx->ipx_fd, (struct sockaddr *)&sa,
485 ipx->ipx_fd);
489 ip_xprt_set_addr(ipx, (struct sockaddr *)&sa);
490 ipx->ipx_xprt = fmd_xprt_open(ip_hdl, ipx->ipx_flags,
491 ip_xprt_auth(ipx), ipx);
493 ip_debug(IP_DEBUG_FINE, "connect fd %d ipx %p",
494 ipx->ipx_fd, (void *)ipx);
499 if (ipx->ipx_xprt == NULL)
500 ip_xprt_accept(ipx);
502 ip_xprt_recv_event(ipx);
506 ipx->ipx_cinfo->ipc_timer = fmd_timer_install(ip_hdl, ipx, NULL, 0);
507 ip_debug(IP_DEBUG_FINE, "close fd %d (timer %d)", ipx->ipx_fd,
508 (int)ipx->ipx_cinfo->ipc_timer);
514 ip_xprt_t *ipx = fmd_hdl_zalloc(ip_hdl, sizeof (ip_xprt_t), FMD_SLEEP);
516 ip_debug(IP_DEBUG_FINER, "Enter ip_xprt_create %p", (void *)ipx);
518 ipx->ipx_xprt = xp;
519 ipx->ipx_flags = flags;
520 ipx->ipx_fd = fd;
521 ipx->ipx_tid = fmd_thr_create(ip_hdl, ip_xprt_thread, ipx);
522 ipx->ipx_cinfo = cinfo;
523 ipx->ipx_addr = fmd_hdl_strdup(ip_hdl, addr, FMD_SLEEP);
525 if (ipx->ipx_xprt != NULL)
526 fmd_xprt_setspecific(ip_hdl, ipx->ipx_xprt, ipx);
530 ipx->ipx_next = ip_xps;
531 ip_xps = ipx;
537 ip_xprt_destroy(ip_xprt_t *ipx)
542 IPX_ID(ipx), (void *)ipx);
547 if (ipp != ipx)
553 if (ipp != ipx) {
555 fmd_hdl_abort(ip_hdl, "ipx %p not on xps list\n", (void *)ipx);
558 *ppx = ipx->ipx_next;
559 ipx->ipx_next = NULL;
563 if (ipx->ipx_spnd_timer)
564 fmd_timer_remove(ip_hdl, ipx->ipx_spnd_timer);
566 fmd_thr_signal(ip_hdl, ipx->ipx_tid);
567 fmd_thr_destroy(ip_hdl, ipx->ipx_tid);
569 if (ipx->ipx_xprt != NULL)
570 fmd_xprt_close(ip_hdl, ipx->ipx_xprt);
572 fmd_hdl_free(ip_hdl, ipx->ipx_sndbuf.ipb_buf, ipx->ipx_sndbuf.ipb_size);
573 fmd_hdl_free(ip_hdl, ipx->ipx_rcvbuf.ipb_buf, ipx->ipx_rcvbuf.ipb_size);
575 (void) close(ipx->ipx_fd);
576 if (ipx->ipx_addr) {
577 fmd_hdl_strfree(ip_hdl, ipx->ipx_addr);
578 ipx->ipx_addr = NULL;
580 fmd_hdl_free(ip_hdl, ipx, sizeof (ip_xprt_t));
858 ip_xprt_t *ipx;
872 ipx = arg;
873 if (ipx->ipx_flags & FMD_XPRT_SUSPENDED) {
874 ipx->ipx_spnd_timer = NULL;
875 ip_debug(IP_DEBUG_FINE, "timer %d waking ipx %p",
877 ipx->ipx_flags &= ~FMD_XPRT_SUSPENDED;
878 fmd_xprt_resume(hdl, ipx->ipx_xprt);
880 ip_debug(IP_DEBUG_FINE, "timer %d closing ipx %p",
882 cinfo = ipx->ipx_cinfo;
883 install_timer = (ipx->ipx_flags & FMD_XPRT_ACCEPT) !=
885 ip_xprt_destroy(ipx);