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_???");
132 #if defined(SPARC) || defined(SPARC64) || defined(SUNOS4) || defined(SVR4)
141 tprintf("%lu, ", tcp->u_arg[0]);
144 tprintf("%#lx, %#lx, %#lx",
145 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
148 /* control and data */
149 for (i = 1; i < 3; i++)
150 printstrbufarg(tcp, tcp->u_arg[i], 1);
151 /* pointer to flags */
152 if (tcp->u_arg[3] == 0)
154 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
158 printflags(msgflags, flags, "RS_???");
161 /* decode return value */
162 switch (tcp->u_rval) {
164 tcp->auxstr = "MORECTL";
166 case MORECTL|MOREDATA:
167 tcp->auxstr = "MORECTL|MOREDATA";
170 tcp->auxstr = "MORECTL";
177 return RVAL_HEX | RVAL_STR;
179 #endif /* SPARC || SPARC64 || SUNOS4 || SVR4 */
181 #if defined SYS_putpmsg || defined SYS_getpmsg
182 static const struct xlat pmsgflags[] = {
184 { MSG_HIPRI, "MSG_HIPRI" },
187 { MSG_ANY, "MSG_ANY" },
190 { MSG_BAND, "MSG_BAND" },
205 tprintf("%ld, ", tcp->u_arg[0]);
206 /* control and data */
207 for (i = 1; i < 3; i++)
208 printstrbufarg(tcp, tcp->u_arg[i], 0);
210 tprintf("%ld, ", tcp->u_arg[3]);
212 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
216 #endif /* SYS_putpmsg */
227 tprintf("%lu, ", tcp->u_arg[0]);
230 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
231 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
234 /* control and data */
235 for (i = 1; i < 3; i++)
236 printstrbufarg(tcp, tcp->u_arg[i], 1);
237 /* pointer to band */
238 printnum(tcp, tcp->u_arg[3], "%d");
240 /* pointer to flags */
241 if (tcp->u_arg[4] == 0)
243 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
247 printflags(pmsgflags, flags, "MSG_???");
250 /* decode return value */
251 switch (tcp->u_rval) {
253 tcp->auxstr = "MORECTL";
255 case MORECTL|MOREDATA:
256 tcp->auxstr = "MORECTL|MOREDATA";
259 tcp->auxstr = "MORECTL";
266 return RVAL_HEX | RVAL_STR;
268 #endif /* SYS_getpmsg */
270 #endif /* !FREEBSD */
273 #ifdef HAVE_SYS_POLL_H
275 static const struct xlat pollflags[] = {
277 { POLLIN, "POLLIN" },
278 { POLLPRI, "POLLPRI" },
279 { POLLOUT, "POLLOUT" },
281 { POLLRDNORM, "POLLRDNORM" },
284 { POLLWRNORM, "POLLWRNORM" },
287 { POLLRDBAND, "POLLRDBAND" },
290 { POLLWRBAND, "POLLWRBAND" },
292 { POLLERR, "POLLERR" },
293 { POLLHUP, "POLLHUP" },
294 { POLLNVAL, "POLLNVAL" },
300 decode_poll(struct tcb *tcp, long pts)
304 unsigned long size, start, cur, end, abbrev_end;
308 nfds = tcp->u_arg[1];
309 size = sizeof(fds) * nfds;
310 start = tcp->u_arg[0];
312 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
313 tprintf("%#lx, %d, ",
314 tcp->u_arg[0], nfds);
318 abbrev_end = start + max_strlen * sizeof(fds);
319 if (abbrev_end < start)
325 for (cur = start; cur < end; cur += sizeof(fds)) {
328 if (cur >= abbrev_end) {
332 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
338 tprintf("{fd=%d}", fds.fd);
341 tprintf("{fd=%d, events=", fds.fd);
342 printflags(pollflags, fds.events, "POLL???");
347 tprintf(" %#lx", start);
348 tprintf(", %d, ", nfds);
351 static char outstr[1024];
358 if (tcp->u_rval == 0) {
359 tcp->auxstr = "Timeout";
363 nfds = tcp->u_arg[1];
364 size = sizeof(fds) * nfds;
365 start = tcp->u_arg[0];
367 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
370 abbrev_end = start + max_strlen * sizeof(fds);
371 if (abbrev_end < start)
380 for (cur = start; cur < end; cur += sizeof(fds)) {
381 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
383 if (cumlen < sizeof(outstr))
395 if (cumlen < sizeof(outstr))
396 strcat(outstr, ", ");
398 if (cur >= abbrev_end) {
400 if (cumlen < sizeof(outstr))
401 strcat(outstr, "...");
404 sprintf(str, "{fd=%d, revents=", fds.fd);
405 flagstr=sprintflags("", pollflags, fds.revents);
406 cumlen += strlen(str) + strlen(flagstr) + 1;
407 if (cumlen < sizeof(outstr)) {
409 strcat(outstr, flagstr);
416 if (cumlen && ++cumlen < sizeof(outstr))
423 sprintf(str, "%sleft ", cumlen ? ", " : "");
424 if (umove(tcp, pts, &ts) == 0)
425 sprintf(str + strlen(str), "{%lu, %lu}",
426 ts.tv_sec, ts.tv_nsec);
428 strcat(str, "{...}");
429 if ((cumlen += strlen(str)) < sizeof(outstr))
436 tcp->auxstr = outstr;
442 sys_poll(struct tcb *tcp)
444 int rc = decode_poll(tcp, 0);
447 if (tcp->u_arg[2] == INFTIM)
451 tprintf("%ld", tcp->u_arg[2]);
458 sys_ppoll(struct tcb *tcp)
460 int rc = decode_poll(tcp, tcp->u_arg[2]);
463 if (umove(tcp, tcp->u_arg[2], &ts) == 0)
464 tprintf("{%lu, %lu}, ", ts.tv_sec, ts.tv_nsec);
467 print_sigset(tcp, tcp->u_arg[3], 0);
468 tprintf(", %lu", tcp->u_arg[4]);
474 #else /* !HAVE_SYS_POLL_H */
483 #if !defined(LINUX) && !defined(FREEBSD)
485 static const struct xlat stream_flush_options[] = {
486 { FLUSHR, "FLUSHR" },
487 { FLUSHW, "FLUSHW" },
488 { FLUSHRW, "FLUSHRW" },
490 { FLUSHBAND, "FLUSHBAND" },
495 static const struct xlat stream_setsig_flags[] = {
496 { S_INPUT, "S_INPUT" },
497 { S_HIPRI, "S_HIPRI" },
498 { S_OUTPUT, "S_OUTPUT" },
501 { S_ERROR, "S_ERROR" },
504 { S_HANGUP, "S_HANGUP" },
507 { S_RDNORM, "S_RDNORM" },
510 { S_WRNORM, "S_WRNORM" },
513 { S_RDBAND, "S_RDBAND" },
516 { S_WRBAND, "S_WRBAND" },
519 { S_BANDURG, "S_BANDURG" },
524 static const struct xlat stream_read_options[] = {
531 static const struct xlat stream_read_flags[] = {
533 { RPROTDAT, "RPROTDAT" },
536 { RPROTDIS, "RPROTDIS" },
539 { RPROTNORM, "RPROTNORM" },
545 #define RMODEMASK (~0)
549 static const struct xlat stream_write_flags[] = {
550 { SNDZERO, "SNDZERO" },
551 { SNDPIPE, "SNDPIPE" },
554 #endif /* I_SWROPT */
557 static const struct xlat stream_atmark_options[] = {
558 { ANYMARK, "ANYMARK" },
559 { LASTMARK, "LASTMARK" },
562 #endif /* I_ATMARK */
565 static const struct xlat transport_user_options[] = {
566 { T_CONN_REQ, "T_CONN_REQ" },
567 { T_CONN_RES, "T_CONN_RES" },
568 { T_DISCON_REQ, "T_DISCON_REQ" },
569 { T_DATA_REQ, "T_DATA_REQ" },
570 { T_EXDATA_REQ, "T_EXDATA_REQ" },
571 { T_INFO_REQ, "T_INFO_REQ" },
572 { T_BIND_REQ, "T_BIND_REQ" },
573 { T_UNBIND_REQ, "T_UNBIND_REQ" },
574 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
575 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
576 { T_ORDREL_REQ, "T_ORDREL_REQ" },
580 static const struct xlat transport_user_flags [] = {
582 { T_MORE, "T_MORE" },
583 { T_EXPEDITED, "T_EXPEDITED" },
584 { T_NEGOTIATE, "T_NEGOTIATE" },
585 { T_CHECK, "T_CHECK" },
586 { T_DEFAULT, "T_DEFAULT" },
587 { T_SUCCESS, "T_SUCCESS" },
588 { T_FAILURE, "T_FAILURE" },
589 { T_CURRENT, "T_CURRENT" },
590 { T_PARTSUCCESS,"T_PARTSUCCESS" },
591 { T_READONLY, "T_READONLY" },
592 { T_NOTSUPPORT, "T_NOTSUPPORT" },
597 #ifdef HAVE_STRUCT_T_OPTHDR
599 static const struct xlat xti_level [] = {
600 { XTI_GENERIC, "XTI_GENERIC" },
604 static const struct xlat xti_generic [] = {
605 { XTI_DEBUG, "XTI_DEBUG" },
606 { XTI_LINGER, "XTI_LINGER" },
607 { XTI_RCVBUF, "XTI_RCVBUF" },
608 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
609 { XTI_SNDBUF, "XTI_SNDBUF" },
610 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
617 print_xti_optmgmt (tcp, addr, len)
625 while (len >= (int) sizeof hdr) {
626 if (umove(tcp, addr, &hdr) < 0) break;
630 else if (len > hdr.len + sizeof hdr) {
634 printxval (xti_level, hdr.level, "???");
638 printxval (xti_generic, hdr.name, "XTI_???");
641 tprintf ("%ld", hdr.name);
644 tprintf (", status=");
645 printxval (transport_user_flags, hdr.status, "T_???");
648 if ((hdr.len -= sizeof hdr) > 0) {
649 if (hdr.len > len) break;
651 if (len == sizeof (int))
652 printnum (tcp, addr, "%d");
654 printstr (tcp, addr, hdr.len);
661 if (c++) tprintf (", ");
662 printstr (tcp, addr, len);
664 if (c > 1) tprintf ("]");
671 print_optmgmt (tcp, addr, len)
676 /* We don't know how to tell if TLI (socket) or XTI
677 optmgmt is being used yet, assume TLI. */
678 #if defined (HAVE_STRUCT_OPTHDR)
679 print_sock_optmgmt (tcp, addr, len);
680 #elif defined (HAVE_STRUCT_T_OPTHDR)
681 print_xti_optmgmt (tcp, addr, len);
683 printstr (tcp, addr, len);
690 static const struct xlat service_type [] = {
691 { T_COTS, "T_COTS" },
692 { T_COTS_ORD, "T_COTS_ORD" },
693 { T_CLTS, "T_CLTS" },
697 static const struct xlat ts_state [] = {
698 { TS_UNBND, "TS_UNBND" },
699 { TS_WACK_BREQ, "TS_WACK_BREQ" },
700 { TS_WACK_UREQ, "TS_WACK_UREQ" },
701 { TS_IDLE, "TS_IDLE" },
702 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
703 { TS_WACK_CREQ, "TS_WACK_CREQ" },
704 { TS_WCON_CREQ, "TS_WCON_CREQ" },
705 { TS_WRES_CIND, "TS_WRES_CIND" },
706 { TS_WACK_CRES, "TS_WACK_CRES" },
707 { TS_DATA_XFER, "TS_DATA_XFER" },
708 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
709 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
710 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
711 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
712 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
713 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
714 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
718 static const struct xlat provider_flags [] = {
720 { SENDZERO, "SENDZERO" },
721 { EXPINLINE, "EXPINLINE" },
722 { XPG4_1, "XPG4_1" },
727 static const struct xlat tli_errors [] = {
728 { TBADADDR, "TBADADDR" },
729 { TBADOPT, "TBADOPT" },
730 { TACCES, "TACCES" },
732 { TNOADDR, "TNOADDR" },
733 { TOUTSTATE, "TOUTSTATE" },
734 { TBADSEQ, "TBADSEQ" },
735 { TSYSERR, "TSYSERR" },
737 { TBADDATA, "TBADDATA" },
738 { TBUFOVFLW, "TBUFOVFLW" },
740 { TNODATA, "TNODATA" },
741 { TNODIS, "TNODIS" },
742 { TNOUDERR, "TNOUDERR" },
743 { TBADFLAG, "TBADFLAG" },
744 { TNOREL, "TNOREL" },
745 { TNOTSUPPORT, "TNOTSUPPORT" },
746 { TSTATECHNG, "TSTATECHNG" },
747 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
748 { TBADNAME, "TBADNAME" },
749 { TBADQLEN, "TBADQLEN" },
750 { TADDRBUSY, "TADDRBUSY" },
751 { TINDOUT, "TINDOUT" },
752 { TPROVMISMATCH,"TPROVMISMATCH" },
753 { TRESQLEN, "TRESQLEN" },
754 { TRESADDR, "TRESADDR" },
755 { TQFULL, "TQFULL" },
756 { TPROTO, "TPROTO" },
762 print_transport_message (tcp, expect, addr, len)
768 union T_primitives m;
771 if (len < sizeof m.type) goto dump;
773 if (umove (tcp, addr, &m.type) < 0) goto dump;
775 #define GET(type, struct) \
777 if (len < sizeof m.struct) goto dump; \
778 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
780 if (expect != type) { \
788 do { if (c++) tprintf (", "); } while (0)
791 #define STRUCT(struct, elem, print) \
794 if (m.struct.elem##_length < 0 || \
795 m.struct.elem##_offset < sizeof m.struct || \
796 m.struct.elem##_offset + m.struct.elem##_length > len) \
798 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
799 m.struct.elem##_length, \
800 m.struct.elem##_offset); \
803 tprintf (#elem "="); \
805 addr + m.struct.elem##_offset, \
806 m.struct.elem##_length); \
811 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
815 case T_CONN_REQ: /* connect request */
816 GET (T_CONN_REQ, conn_req);
817 ADDR (conn_req, DEST);
818 ADDR (conn_req, OPT);
822 case T_CONN_RES: /* connect response */
823 GET (T_CONN_RES, conn_res);
824 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
826 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
827 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
829 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
831 ADDR (conn_res, OPT);
833 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
837 case T_DISCON_REQ: /* disconnect request */
838 GET (T_DISCON_REQ, discon_req);
840 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
844 case T_DATA_REQ: /* data request */
845 GET (T_DATA_REQ, data_req);
847 tprintf ("MORE=%ld", m.data_req.MORE_flag);
851 case T_EXDATA_REQ: /* expedited data req */
852 GET (T_EXDATA_REQ, exdata_req);
854 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
858 case T_INFO_REQ: /* information req */
859 GET (T_INFO_REQ, info_req);
863 case T_BIND_REQ: /* bind request */
865 case O_T_BIND_REQ: /* Ugly xti/tli hack */
867 GET (T_BIND_REQ, bind_req);
868 ADDR (bind_req, ADDR);
870 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
874 case T_UNBIND_REQ: /* unbind request */
875 GET (T_UNBIND_REQ, unbind_req);
878 #ifdef T_UNITDATA_REQ
879 case T_UNITDATA_REQ: /* unitdata requset */
880 GET (T_UNITDATA_REQ, unitdata_req);
881 ADDR (unitdata_req, DEST);
882 ADDR (unitdata_req, OPT);
886 case T_OPTMGMT_REQ: /* manage opt req */
887 GET (T_OPTMGMT_REQ, optmgmt_req);
890 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
892 STRUCT (optmgmt_req, OPT, print_optmgmt);
896 case T_ORDREL_REQ: /* orderly rel req */
897 GET (T_ORDREL_REQ, ordrel_req);
901 case T_CONN_IND: /* connect indication */
902 GET (T_CONN_IND, conn_ind);
903 ADDR (conn_ind, SRC);
904 ADDR (conn_ind, OPT);
905 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
909 case T_CONN_CON: /* connect corfirm */
910 GET (T_CONN_CON, conn_con);
911 ADDR (conn_con, RES);
912 ADDR (conn_con, OPT);
916 case T_DISCON_IND: /* discon indication */
917 GET (T_DISCON_IND, discon_ind);
919 tprintf ("DISCON=%ld, SEQ=%ld",
920 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
924 case T_DATA_IND: /* data indication */
925 GET (T_DATA_IND, data_ind);
927 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
931 case T_EXDATA_IND: /* expedited data ind */
932 GET (T_EXDATA_IND, exdata_ind);
934 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
938 case T_INFO_ACK: /* info ack */
939 GET (T_INFO_ACK, info_ack);
941 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
942 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
943 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
944 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
945 m.info_ack.ADDR_size, m.info_ack.OPT_size,
946 m.info_ack.TIDU_size);
947 printxval (service_type, m.info_ack.SERV_type, "T_???");
948 tprintf (", CURRENT=");
949 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
950 tprintf (", PROVIDER=");
951 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
955 case T_BIND_ACK: /* bind ack */
956 GET (T_BIND_ACK, bind_ack);
957 ADDR (bind_ack, ADDR);
958 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
962 case T_ERROR_ACK: /* error ack */
963 GET (T_ERROR_ACK, error_ack);
966 printxval (transport_user_options,
967 m.error_ack.ERROR_prim, "TI_???");
969 printxval (tli_errors, m.error_ack.TLI_error, "T???");
970 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
974 case T_OK_ACK: /* ok ack */
975 GET (T_OK_ACK, ok_ack);
977 tprintf ("CORRECT=");
978 printxval (transport_user_options,
979 m.ok_ack.CORRECT_prim, "TI_???");
982 #ifdef T_UNITDATA_IND
983 case T_UNITDATA_IND: /* unitdata ind */
984 GET (T_UNITDATA_IND, unitdata_ind);
985 ADDR (unitdata_ind, SRC);
986 ADDR (unitdata_ind, OPT);
990 case T_UDERROR_IND: /* unitdata error ind */
991 GET (T_UDERROR_IND, uderror_ind);
992 ADDR (uderror_ind, DEST);
993 ADDR (uderror_ind, OPT);
994 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
998 case T_OPTMGMT_ACK: /* manage opt ack */
999 GET (T_OPTMGMT_ACK, optmgmt_ack);
1002 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
1004 STRUCT (optmgmt_ack, OPT, print_optmgmt);
1008 case T_ORDREL_IND: /* orderly rel ind */
1009 GET (T_ORDREL_IND, ordrel_ind);
1013 case T_ADDR_REQ: /* address req */
1014 GET (T_ADDR_REQ, addr_req);
1018 case T_ADDR_ACK: /* address response */
1019 GET (T_ADDR_ACK, addr_ack);
1020 ADDR (addr_ack, LOCADDR);
1021 ADDR (addr_ack, REMADDR);
1027 printstr(tcp, addr, len);
1031 if (c >= 0) tprintf ("}");
1041 #endif /* TI_BIND */
1045 internal_stream_ioctl(tcp, arg)
1050 struct ioctlent *iop;
1054 struct si_udata udata;
1055 #endif /* SI_GETUDATA */
1059 if (umove(tcp, arg, &si) < 0) {
1064 if (entering(tcp)) {
1065 iop = ioctl_lookup(si.ic_cmd);
1067 tprintf(", {ic_cmd=%s", iop->symbol);
1068 while ((iop = ioctl_next_match(iop)))
1069 tprintf(" or %s", iop->symbol);
1071 tprintf(", {ic_cmd=%#x", si.ic_cmd);
1072 if (si.ic_timout == INFTIM)
1073 tprintf(", ic_timout=INFTIM, ");
1075 tprintf(" ic_timout=%d, ", si.ic_timout);
1078 switch (si.ic_cmd) {
1083 #endif /* SI_GETUDATA */
1087 tprintf("/* in */ ");
1089 tprintf(", /* out */ ");
1091 if (in_and_out || entering(tcp))
1092 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1093 switch (si.ic_cmd) {
1096 /* in T_BIND_REQ, out T_BIND_ACK */
1098 if (entering(tcp)) {
1099 print_transport_message (tcp,
1101 si.ic_dp, si.ic_len);
1104 print_transport_message (tcp,
1106 si.ic_dp, si.ic_len);
1109 #endif /* TI_BIND */
1112 /* in T_UNBIND_REQ, out T_OK_ACK */
1114 if (entering(tcp)) {
1115 print_transport_message (tcp,
1117 si.ic_dp, si.ic_len);
1120 print_transport_message (tcp,
1122 si.ic_dp, si.ic_len);
1125 #endif /* TI_UNBIND */
1128 /* in T_INFO_REQ, out T_INFO_ACK */
1130 if (entering(tcp)) {
1131 print_transport_message (tcp,
1133 si.ic_dp, si.ic_len);
1136 print_transport_message (tcp,
1138 si.ic_dp, si.ic_len);
1141 #endif /* TI_GETINFO */
1144 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1146 if (entering(tcp)) {
1147 print_transport_message (tcp,
1149 si.ic_dp, si.ic_len);
1152 print_transport_message (tcp,
1154 si.ic_dp, si.ic_len);
1157 #endif /* TI_OPTMGMT */
1163 tprintf("struct si_udata ");
1165 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1168 tprintf("{tidusize=%d, addrsize=%d, ",
1169 udata.tidusize, udata.addrsize);
1170 tprintf("optsize=%d, etsdusize=%d, ",
1171 udata.optsize, udata.etsdusize);
1172 tprintf("servtype=%d, so_state=%d, ",
1173 udata.servtype, udata.so_state);
1174 tprintf("so_options=%d", udata.so_options);
1176 tprintf(", tsdusize=%d", udata.tsdusize);
1181 #endif /* SI_GETUDATA */
1183 printstr(tcp, (long) si.ic_dp, si.ic_len);
1188 if (timod && tcp->u_rval) {
1189 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1190 return RVAL_STR + 1;
1198 stream_ioctl(tcp, code, arg)
1210 struct strfdinsert sfi;
1211 struct strrecvfd srf;
1216 /* I_STR is a special case because the data is read & written. */
1218 return internal_stream_ioctl(tcp, arg);
1226 /* arg is a string */
1228 printpath(tcp, arg);
1231 /* doesn't take an argument */
1234 /* argument is an option */
1236 printxval(stream_flush_options, arg, "FLUSH???");
1240 /* argument is a pointer to a bandinfo struct */
1241 if (umove(tcp, arg, &bi) < 0)
1244 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1245 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1249 #endif /* I_FLUSHBAND */
1251 /* argument is a set of flags */
1253 printflags(stream_setsig_flags, arg, "S_???");
1256 /* argument is a pointer to a set of flags */
1260 if (umove(tcp, arg, &val) < 0)
1263 printflags(stream_setsig_flags, val, "S_???");
1267 /* argument is a pointer to a strpeek structure */
1268 if (syserror(tcp) || !arg)
1270 if (umove(tcp, arg, &sp) < 0) {
1274 tprintf(", {ctlbuf=");
1275 printstrbuf(tcp, &sp.ctlbuf, 1);
1276 tprintf(", databuf=");
1277 printstrbuf(tcp, &sp.databuf, 1);
1278 tprintf(", flags=");
1279 printflags(msgflags, sp.flags, "RS_???");
1283 /* argument is an option with flags */
1285 printxval(stream_read_options, arg & RMODEMASK, "R???");
1286 addflags(stream_read_flags, arg & ~RMODEMASK);
1289 /* argument is an pointer to an option with flags */
1293 if (umove(tcp, arg, &val) < 0)
1296 printxval(stream_read_options,
1297 arg & RMODEMASK, "R???");
1298 addflags(stream_read_flags, arg & ~RMODEMASK);
1312 /* argument is a pointer to a decimal integer */
1316 printnum(tcp, arg, "%d");
1319 /* argument is a pointer to a strfdinsert structure */
1320 if (syserror(tcp) || !arg)
1322 if (umove(tcp, arg, &sfi) < 0) {
1326 tprintf(", {ctlbuf=");
1327 printstrbuf(tcp, &sfi.ctlbuf, 1);
1328 tprintf(", databuf=");
1329 printstrbuf(tcp, &sfi.databuf, 1);
1330 tprintf(", flags=");
1331 printflags(msgflags, sfi.flags, "RS_???");
1332 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1336 /* argument is a set of flags */
1338 printflags(stream_write_flags, arg, "SND???");
1340 #endif /* I_SWROPT */
1343 /* argument is an pointer to an option with flags */
1347 if (umove(tcp, arg, &val) < 0)
1350 printflags(stream_write_flags, arg, "SND???");
1353 #endif /* I_GWROPT */
1365 /* argument is a decimal integer */
1366 tprintf(", %d", arg);
1369 /* argument is a pointer to a strrecvfd structure */
1370 if (syserror(tcp) || !arg)
1372 if (umove(tcp, arg, &srf) < 0) {
1376 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1377 (unsigned long) srf.uid, (unsigned long) srf.gid);
1387 if (umove(tcp, arg, &sl) < 0) {
1391 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1392 for (i = 0; i < tcp->u_rval; i++) {
1395 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1403 printxval(stream_atmark_options, arg, "???MARK");
1405 #endif /* I_ATMARK */
1411 #endif /* !LINUX && !FREEBSD */
1413 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */