2 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
3 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/syscall.h>
37 #ifdef HAVE_SYS_POLL_H
43 #ifdef HAVE_SYS_CONF_H
46 #ifdef HAVE_SYS_STREAM_H
47 #include <sys/stream.h>
49 #ifdef HAVE_SYS_TIHDR_H
50 #include <sys/tihdr.h>
53 #if defined(HAVE_SYS_STREAM_H) || defined(LINUX) || defined(FREEBSD)
55 #ifndef HAVE_STROPTS_H
58 int maxlen; /* no. of bytes in buffer */
59 int len; /* no. of bytes returned */
60 char *buf; /* pointer to data */
64 #endif /* !HAVE_STROPTS_H */
66 #ifdef HAVE_SYS_TIUSER_H
67 #include <sys/tiuser.h>
68 #include <sys/sockmod.h>
69 #include <sys/timod.h>
70 #endif /* HAVE_SYS_TIUSER_H */
73 static const struct xlat msgflags[] = {
74 { RS_HIPRI, "RS_HIPRI" },
80 printstrbuf(tcp, sbp, getting)
85 if (sbp->maxlen == -1 && getting)
86 tprintf("{maxlen=-1}");
90 tprintf("maxlen=%d, ", sbp->maxlen);
91 tprintf("len=%d, buf=", sbp->len);
92 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
98 printstrbufarg(tcp, arg, getting)
107 else if (umove(tcp, arg, &buf) < 0)
110 printstrbuf(tcp, &buf, getting);
122 tprintf("%ld, ", tcp->u_arg[0]);
123 /* control and data */
124 for (i = 1; i < 3; i++)
125 printstrbufarg(tcp, tcp->u_arg[i], 0);
127 printflags(msgflags, tcp->u_arg[3], "RS_???");
140 tprintf("%lu, ", tcp->u_arg[0]);
143 tprintf("%#lx, %#lx, %#lx",
144 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
147 /* control and data */
148 for (i = 1; i < 3; i++)
149 printstrbufarg(tcp, tcp->u_arg[i], 1);
150 /* pointer to flags */
151 if (tcp->u_arg[3] == 0)
153 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
157 printflags(msgflags, flags, "RS_???");
160 /* decode return value */
161 switch (tcp->u_rval) {
163 tcp->auxstr = "MORECTL";
165 case MORECTL|MOREDATA:
166 tcp->auxstr = "MORECTL|MOREDATA";
169 tcp->auxstr = "MORECTL";
176 return RVAL_HEX | RVAL_STR;
179 #if defined SYS_putpmsg || defined SYS_getpmsg
180 static const struct xlat pmsgflags[] = {
182 { MSG_HIPRI, "MSG_HIPRI" },
185 { MSG_ANY, "MSG_ANY" },
188 { MSG_BAND, "MSG_BAND" },
203 tprintf("%ld, ", tcp->u_arg[0]);
204 /* control and data */
205 for (i = 1; i < 3; i++)
206 printstrbufarg(tcp, tcp->u_arg[i], 0);
208 tprintf("%ld, ", tcp->u_arg[3]);
210 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
214 #endif /* SYS_putpmsg */
225 tprintf("%lu, ", tcp->u_arg[0]);
228 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
229 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
232 /* control and data */
233 for (i = 1; i < 3; i++)
234 printstrbufarg(tcp, tcp->u_arg[i], 1);
235 /* pointer to band */
236 printnum(tcp, tcp->u_arg[3], "%d");
238 /* pointer to flags */
239 if (tcp->u_arg[4] == 0)
241 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
245 printflags(pmsgflags, flags, "MSG_???");
248 /* decode return value */
249 switch (tcp->u_rval) {
251 tcp->auxstr = "MORECTL";
253 case MORECTL|MOREDATA:
254 tcp->auxstr = "MORECTL|MOREDATA";
257 tcp->auxstr = "MORECTL";
264 return RVAL_HEX | RVAL_STR;
266 #endif /* SYS_getpmsg */
268 #endif /* !FREEBSD */
271 #ifdef HAVE_SYS_POLL_H
273 static const struct xlat pollflags[] = {
275 { POLLIN, "POLLIN" },
276 { POLLPRI, "POLLPRI" },
277 { POLLOUT, "POLLOUT" },
279 { POLLRDNORM, "POLLRDNORM" },
282 { POLLWRNORM, "POLLWRNORM" },
285 { POLLRDBAND, "POLLRDBAND" },
288 { POLLWRBAND, "POLLWRBAND" },
290 { POLLERR, "POLLERR" },
291 { POLLHUP, "POLLHUP" },
292 { POLLNVAL, "POLLNVAL" },
301 struct pollfd *pollp;
305 int nfds = tcp->u_arg[1];
308 tprintf("%#lx, %d, %ld\n",
309 tcp->u_arg[0], nfds, tcp->u_arg[2]);
312 pollp = (struct pollfd *) malloc(nfds * sizeof(*pollp));
314 fprintf(stderr, "sys_poll: no memory\n");
315 tprintf("%#lx, %d, %ld",
316 tcp->u_arg[0], nfds, tcp->u_arg[2]);
319 if (umoven(tcp, tcp->u_arg[0],
320 (nfds * sizeof(*pollp)), (char *) pollp) < 0) {
321 tprintf("%#lx", tcp->u_arg[0]);
325 for (i = 0; i < nfds; i++) {
328 if (pollp[i].fd < 0) {
329 tprintf("{fd=%d}", pollp[i].fd);
332 tprintf("{fd=%d, events=", pollp[i].fd);
333 printflags(pollflags, pollp[i].events,
335 if (!syserror(tcp) && pollp[i].revents) {
336 tprintf(", revents=");
337 printflags(pollflags, pollp[i].revents,
344 tprintf(", %d, ", nfds);
346 if (tcp->u_arg[2] == INFTIM)
350 tprintf("%ld", tcp->u_arg[2]);
356 #else /* !HAVE_SYS_POLL_H */
365 #if !defined(LINUX) && !defined(FREEBSD)
367 static const struct xlat stream_flush_options[] = {
368 { FLUSHR, "FLUSHR" },
369 { FLUSHW, "FLUSHW" },
370 { FLUSHRW, "FLUSHRW" },
372 { FLUSHBAND, "FLUSHBAND" },
377 static const struct xlat stream_setsig_flags[] = {
378 { S_INPUT, "S_INPUT" },
379 { S_HIPRI, "S_HIPRI" },
380 { S_OUTPUT, "S_OUTPUT" },
383 { S_ERROR, "S_ERROR" },
386 { S_HANGUP, "S_HANGUP" },
389 { S_RDNORM, "S_RDNORM" },
392 { S_WRNORM, "S_WRNORM" },
395 { S_RDBAND, "S_RDBAND" },
398 { S_WRBAND, "S_WRBAND" },
401 { S_BANDURG, "S_BANDURG" },
406 static const struct xlat stream_read_options[] = {
413 static const struct xlat stream_read_flags[] = {
415 { RPROTDAT, "RPROTDAT" },
418 { RPROTDIS, "RPROTDIS" },
421 { RPROTNORM, "RPROTNORM" },
427 #define RMODEMASK (~0)
431 static const struct xlat stream_write_flags[] = {
432 { SNDZERO, "SNDZERO" },
433 { SNDPIPE, "SNDPIPE" },
436 #endif /* I_SWROPT */
439 static const struct xlat stream_atmark_options[] = {
440 { ANYMARK, "ANYMARK" },
441 { LASTMARK, "LASTMARK" },
444 #endif /* I_ATMARK */
447 static const struct xlat transport_user_options[] = {
448 { T_CONN_REQ, "T_CONN_REQ" },
449 { T_CONN_RES, "T_CONN_RES" },
450 { T_DISCON_REQ, "T_DISCON_REQ" },
451 { T_DATA_REQ, "T_DATA_REQ" },
452 { T_EXDATA_REQ, "T_EXDATA_REQ" },
453 { T_INFO_REQ, "T_INFO_REQ" },
454 { T_BIND_REQ, "T_BIND_REQ" },
455 { T_UNBIND_REQ, "T_UNBIND_REQ" },
456 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
457 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
458 { T_ORDREL_REQ, "T_ORDREL_REQ" },
462 static const struct xlat transport_user_flags [] = {
464 { T_MORE, "T_MORE" },
465 { T_EXPEDITED, "T_EXPEDITED" },
466 { T_NEGOTIATE, "T_NEGOTIATE" },
467 { T_CHECK, "T_CHECK" },
468 { T_DEFAULT, "T_DEFAULT" },
469 { T_SUCCESS, "T_SUCCESS" },
470 { T_FAILURE, "T_FAILURE" },
471 { T_CURRENT, "T_CURRENT" },
472 { T_PARTSUCCESS,"T_PARTSUCCESS" },
473 { T_READONLY, "T_READONLY" },
474 { T_NOTSUPPORT, "T_NOTSUPPORT" },
479 #ifdef HAVE_STRUCT_T_OPTHDR
481 static const struct xlat xti_level [] = {
482 { XTI_GENERIC, "XTI_GENERIC" },
486 static const struct xlat xti_generic [] = {
487 { XTI_DEBUG, "XTI_DEBUG" },
488 { XTI_LINGER, "XTI_LINGER" },
489 { XTI_RCVBUF, "XTI_RCVBUF" },
490 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
491 { XTI_SNDBUF, "XTI_SNDBUF" },
492 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
499 print_xti_optmgmt (tcp, addr, len)
507 while (len >= (int) sizeof hdr) {
508 if (umove(tcp, addr, &hdr) < 0) break;
512 else if (len > hdr.len + sizeof hdr) {
516 printxval (xti_level, hdr.level, "???");
520 printxval (xti_generic, hdr.name, "XTI_???");
523 tprintf ("%ld", hdr.name);
526 tprintf (", status=");
527 printxval (transport_user_flags, hdr.status, "T_???");
530 if ((hdr.len -= sizeof hdr) > 0) {
531 if (hdr.len > len) break;
533 if (len == sizeof (int))
534 printnum (tcp, addr, "%d");
536 printstr (tcp, addr, hdr.len);
543 if (c++) tprintf (", ");
544 printstr (tcp, addr, len);
546 if (c > 1) tprintf ("]");
553 print_optmgmt (tcp, addr, len)
558 /* We don't know how to tell if TLI (socket) or XTI
559 optmgmt is being used yet, assume TLI. */
560 #if defined (HAVE_STRUCT_OPTHDR)
561 print_sock_optmgmt (tcp, addr, len);
562 #elif defined (HAVE_STRUCT_T_OPTHDR)
563 print_xti_optmgmt (tcp, addr, len);
565 printstr (tcp, addr, len);
572 static const struct xlat service_type [] = {
573 { T_COTS, "T_COTS" },
574 { T_COTS_ORD, "T_COTS_ORD" },
575 { T_CLTS, "T_CLTS" },
579 static const struct xlat ts_state [] = {
580 { TS_UNBND, "TS_UNBND" },
581 { TS_WACK_BREQ, "TS_WACK_BREQ" },
582 { TS_WACK_UREQ, "TS_WACK_UREQ" },
583 { TS_IDLE, "TS_IDLE" },
584 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
585 { TS_WACK_CREQ, "TS_WACK_CREQ" },
586 { TS_WCON_CREQ, "TS_WCON_CREQ" },
587 { TS_WRES_CIND, "TS_WRES_CIND" },
588 { TS_WACK_CRES, "TS_WACK_CRES" },
589 { TS_DATA_XFER, "TS_DATA_XFER" },
590 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
591 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
592 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
593 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
594 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
595 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
596 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
600 static const struct xlat provider_flags [] = {
602 { SENDZERO, "SENDZERO" },
603 { EXPINLINE, "EXPINLINE" },
604 { XPG4_1, "XPG4_1" },
609 static const struct xlat tli_errors [] = {
610 { TBADADDR, "TBADADDR" },
611 { TBADOPT, "TBADOPT" },
612 { TACCES, "TACCES" },
614 { TNOADDR, "TNOADDR" },
615 { TOUTSTATE, "TOUTSTATE" },
616 { TBADSEQ, "TBADSEQ" },
617 { TSYSERR, "TSYSERR" },
619 { TBADDATA, "TBADDATA" },
620 { TBUFOVFLW, "TBUFOVFLW" },
622 { TNODATA, "TNODATA" },
623 { TNODIS, "TNODIS" },
624 { TNOUDERR, "TNOUDERR" },
625 { TBADFLAG, "TBADFLAG" },
626 { TNOREL, "TNOREL" },
627 { TNOTSUPPORT, "TNOTSUPPORT" },
628 { TSTATECHNG, "TSTATECHNG" },
629 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
630 { TBADNAME, "TBADNAME" },
631 { TBADQLEN, "TBADQLEN" },
632 { TADDRBUSY, "TADDRBUSY" },
633 { TINDOUT, "TINDOUT" },
634 { TPROVMISMATCH,"TPROVMISMATCH" },
635 { TRESQLEN, "TRESQLEN" },
636 { TRESADDR, "TRESADDR" },
637 { TQFULL, "TQFULL" },
638 { TPROTO, "TPROTO" },
644 print_transport_message (tcp, expect, addr, len)
650 union T_primitives m;
653 if (len < sizeof m.type) goto dump;
655 if (umove (tcp, addr, &m.type) < 0) goto dump;
657 #define GET(type, struct) \
659 if (len < sizeof m.struct) goto dump; \
660 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
662 if (expect != type) { \
670 do { if (c++) tprintf (", "); } while (0)
673 #define STRUCT(struct, elem, print) \
676 if (m.struct.elem##_length < 0 || \
677 m.struct.elem##_offset < sizeof m.struct || \
678 m.struct.elem##_offset + m.struct.elem##_length > len) \
680 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
681 m.struct.elem##_length, \
682 m.struct.elem##_offset); \
685 tprintf (#elem "="); \
687 addr + m.struct.elem##_offset, \
688 m.struct.elem##_length); \
693 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
697 case T_CONN_REQ: /* connect request */
698 GET (T_CONN_REQ, conn_req);
699 ADDR (conn_req, DEST);
700 ADDR (conn_req, OPT);
704 case T_CONN_RES: /* connect response */
705 GET (T_CONN_RES, conn_res);
706 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
708 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
709 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
711 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
713 ADDR (conn_res, OPT);
715 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
719 case T_DISCON_REQ: /* disconnect request */
720 GET (T_DISCON_REQ, discon_req);
722 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
726 case T_DATA_REQ: /* data request */
727 GET (T_DATA_REQ, data_req);
729 tprintf ("MORE=%ld", m.data_req.MORE_flag);
733 case T_EXDATA_REQ: /* expedited data req */
734 GET (T_EXDATA_REQ, exdata_req);
736 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
740 case T_INFO_REQ: /* information req */
741 GET (T_INFO_REQ, info_req);
745 case T_BIND_REQ: /* bind request */
747 case O_T_BIND_REQ: /* Ugly xti/tli hack */
749 GET (T_BIND_REQ, bind_req);
750 ADDR (bind_req, ADDR);
752 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
756 case T_UNBIND_REQ: /* unbind request */
757 GET (T_UNBIND_REQ, unbind_req);
760 #ifdef T_UNITDATA_REQ
761 case T_UNITDATA_REQ: /* unitdata requset */
762 GET (T_UNITDATA_REQ, unitdata_req);
763 ADDR (unitdata_req, DEST);
764 ADDR (unitdata_req, OPT);
768 case T_OPTMGMT_REQ: /* manage opt req */
769 GET (T_OPTMGMT_REQ, optmgmt_req);
772 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
774 STRUCT (optmgmt_req, OPT, print_optmgmt);
778 case T_ORDREL_REQ: /* orderly rel req */
779 GET (T_ORDREL_REQ, ordrel_req);
783 case T_CONN_IND: /* connect indication */
784 GET (T_CONN_IND, conn_ind);
785 ADDR (conn_ind, SRC);
786 ADDR (conn_ind, OPT);
787 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
791 case T_CONN_CON: /* connect corfirm */
792 GET (T_CONN_CON, conn_con);
793 ADDR (conn_con, RES);
794 ADDR (conn_con, OPT);
798 case T_DISCON_IND: /* discon indication */
799 GET (T_DISCON_IND, discon_ind);
801 tprintf ("DISCON=%ld, SEQ=%ld",
802 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
806 case T_DATA_IND: /* data indication */
807 GET (T_DATA_IND, data_ind);
809 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
813 case T_EXDATA_IND: /* expedited data ind */
814 GET (T_EXDATA_IND, exdata_ind);
816 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
820 case T_INFO_ACK: /* info ack */
821 GET (T_INFO_ACK, info_ack);
823 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
824 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
825 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
826 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
827 m.info_ack.ADDR_size, m.info_ack.OPT_size,
828 m.info_ack.TIDU_size);
829 printxval (service_type, m.info_ack.SERV_type, "T_???");
830 tprintf (", CURRENT=");
831 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
832 tprintf (", PROVIDER=");
833 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
837 case T_BIND_ACK: /* bind ack */
838 GET (T_BIND_ACK, bind_ack);
839 ADDR (bind_ack, ADDR);
840 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
844 case T_ERROR_ACK: /* error ack */
845 GET (T_ERROR_ACK, error_ack);
848 printxval (transport_user_options,
849 m.error_ack.ERROR_prim, "TI_???");
851 printxval (tli_errors, m.error_ack.TLI_error, "T???");
852 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
856 case T_OK_ACK: /* ok ack */
857 GET (T_OK_ACK, ok_ack);
859 tprintf ("CORRECT=");
860 printxval (transport_user_options,
861 m.ok_ack.CORRECT_prim, "TI_???");
864 #ifdef T_UNITDATA_IND
865 case T_UNITDATA_IND: /* unitdata ind */
866 GET (T_UNITDATA_IND, unitdata_ind);
867 ADDR (unitdata_ind, SRC);
868 ADDR (unitdata_ind, OPT);
872 case T_UDERROR_IND: /* unitdata error ind */
873 GET (T_UDERROR_IND, uderror_ind);
874 ADDR (uderror_ind, DEST);
875 ADDR (uderror_ind, OPT);
876 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
880 case T_OPTMGMT_ACK: /* manage opt ack */
881 GET (T_OPTMGMT_ACK, optmgmt_ack);
884 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
886 STRUCT (optmgmt_ack, OPT, print_optmgmt);
890 case T_ORDREL_IND: /* orderly rel ind */
891 GET (T_ORDREL_IND, ordrel_ind);
895 case T_ADDR_REQ: /* address req */
896 GET (T_ADDR_REQ, addr_req);
900 case T_ADDR_ACK: /* address response */
901 GET (T_ADDR_ACK, addr_ack);
902 ADDR (addr_ack, LOCADDR);
903 ADDR (addr_ack, REMADDR);
909 printstr(tcp, addr, len);
913 if (c >= 0) tprintf ("}");
927 internal_stream_ioctl(tcp, arg)
932 struct ioctlent *iop;
936 struct si_udata udata;
937 #endif /* SI_GETUDATA */
941 if (umove(tcp, arg, &si) < 0) {
947 iop = ioctl_lookup(si.ic_cmd);
949 tprintf(", {ic_cmd=%s", iop->symbol);
950 while ((iop = ioctl_next_match(iop)))
951 tprintf(" or %s", iop->symbol);
953 tprintf(", {ic_cmd=%#x", si.ic_cmd);
954 if (si.ic_timout == INFTIM)
955 tprintf(", ic_timout=INFTIM, ");
957 tprintf(" ic_timout=%d, ", si.ic_timout);
965 #endif /* SI_GETUDATA */
969 tprintf("/* in */ ");
971 tprintf(", /* out */ ");
973 if (in_and_out || entering(tcp))
974 tprintf("ic_len=%d, ic_dp=", si.ic_len);
978 /* in T_BIND_REQ, out T_BIND_ACK */
981 print_transport_message (tcp,
983 si.ic_dp, si.ic_len);
986 print_transport_message (tcp,
988 si.ic_dp, si.ic_len);
994 /* in T_UNBIND_REQ, out T_OK_ACK */
997 print_transport_message (tcp,
999 si.ic_dp, si.ic_len);
1002 print_transport_message (tcp,
1004 si.ic_dp, si.ic_len);
1007 #endif /* TI_UNBIND */
1010 /* in T_INFO_REQ, out T_INFO_ACK */
1012 if (entering(tcp)) {
1013 print_transport_message (tcp,
1015 si.ic_dp, si.ic_len);
1018 print_transport_message (tcp,
1020 si.ic_dp, si.ic_len);
1023 #endif /* TI_GETINFO */
1026 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1028 if (entering(tcp)) {
1029 print_transport_message (tcp,
1031 si.ic_dp, si.ic_len);
1034 print_transport_message (tcp,
1036 si.ic_dp, si.ic_len);
1039 #endif /* TI_OPTMGMT */
1045 tprintf("struct si_udata ");
1047 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1050 tprintf("{tidusize=%d, addrsize=%d, ",
1051 udata.tidusize, udata.addrsize);
1052 tprintf("optsize=%d, etsdusize=%d, ",
1053 udata.optsize, udata.etsdusize);
1054 tprintf("servtype=%d, so_state=%d, ",
1055 udata.servtype, udata.so_state);
1056 tprintf("so_options=%d", udata.so_options);
1058 tprintf(", tsdusize=%d", udata.tsdusize);
1063 #endif /* SI_GETUDATA */
1065 printstr(tcp, (long) si.ic_dp, si.ic_len);
1070 if (timod && tcp->u_rval) {
1071 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1072 return RVAL_STR + 1;
1080 stream_ioctl(tcp, code, arg)
1092 struct strfdinsert sfi;
1093 struct strrecvfd srf;
1098 /* I_STR is a special case because the data is read & written. */
1100 return internal_stream_ioctl(tcp, arg);
1108 /* arg is a string */
1110 printpath(tcp, arg);
1113 /* doesn't take an argument */
1116 /* argument is an option */
1118 printxval(stream_flush_options, arg, "FLUSH???");
1122 /* argument is a pointer to a bandinfo struct */
1123 if (umove(tcp, arg, &bi) < 0)
1126 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1127 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1131 #endif /* I_FLUSHBAND */
1133 /* argument is a set of flags */
1135 printflags(stream_setsig_flags, arg, "S_???");
1138 /* argument is a pointer to a set of flags */
1142 if (umove(tcp, arg, &val) < 0)
1145 printflags(stream_setsig_flags, val, "S_???");
1149 /* argument is a pointer to a strpeek structure */
1150 if (syserror(tcp) || !arg)
1152 if (umove(tcp, arg, &sp) < 0) {
1156 tprintf(", {ctlbuf=");
1157 printstrbuf(tcp, &sp.ctlbuf, 1);
1158 tprintf(", databuf=");
1159 printstrbuf(tcp, &sp.databuf, 1);
1160 tprintf(", flags=");
1161 printflags(msgflags, sp.flags, "RS_???");
1165 /* argument is an option with flags */
1167 printxval(stream_read_options, arg & RMODEMASK, "R???");
1168 addflags(stream_read_flags, arg & ~RMODEMASK);
1171 /* argument is an pointer to an option with flags */
1175 if (umove(tcp, arg, &val) < 0)
1178 printxval(stream_read_options,
1179 arg & RMODEMASK, "R???");
1180 addflags(stream_read_flags, arg & ~RMODEMASK);
1194 /* argument is a pointer to a decimal integer */
1198 printnum(tcp, arg, "%d");
1201 /* argument is a pointer to a strfdinsert structure */
1202 if (syserror(tcp) || !arg)
1204 if (umove(tcp, arg, &sfi) < 0) {
1208 tprintf(", {ctlbuf=");
1209 printstrbuf(tcp, &sfi.ctlbuf, 1);
1210 tprintf(", databuf=");
1211 printstrbuf(tcp, &sfi.databuf, 1);
1212 tprintf(", flags=");
1213 printflags(msgflags, sfi.flags, "RS_???");
1214 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1218 /* argument is a set of flags */
1220 printflags(stream_write_flags, arg, "SND???");
1222 #endif /* I_SWROPT */
1225 /* argument is an pointer to an option with flags */
1229 if (umove(tcp, arg, &val) < 0)
1232 printflags(stream_write_flags, arg, "SND???");
1235 #endif /* I_GWROPT */
1247 /* argument is a decimal integer */
1248 tprintf(", %d", arg);
1251 /* argument is a pointer to a strrecvfd structure */
1252 if (syserror(tcp) || !arg)
1254 if (umove(tcp, arg, &srf) < 0) {
1258 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1259 (unsigned long) srf.uid, (unsigned long) srf.gid);
1269 if (umove(tcp, arg, &sl) < 0) {
1273 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1274 for (i = 0; i < tcp->u_rval; i++) {
1277 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1285 printxval(stream_atmark_options, arg, "???MARK");
1287 #endif /* I_ATMARK */
1293 #endif /* !LINUX && !FREEBSD */
1295 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */