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" },
303 unsigned long size, start, cur, end, abbrev_end;
309 nfds = tcp->u_arg[1];
310 size = sizeof(fds) * nfds;
311 start = tcp->u_arg[0];
313 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
314 tprintf("%#lx, %d, %ld",
315 tcp->u_arg[0], nfds, tcp->u_arg[2]);
319 abbrev_end = start + max_strlen * sizeof(fds);
320 if (abbrev_end < start)
326 for (cur = start; cur < end; cur += sizeof(fds)) {
329 if (cur >= abbrev_end) {
333 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
339 tprintf("{fd=%d}", fds.fd);
342 tprintf("{fd=%d, events=", fds.fd);
343 printflags(pollflags, fds.events, "POLL???");
344 if (!syserror(tcp) && fds.revents) {
345 tprintf(", revents=");
346 printflags(pollflags, fds.revents, "POLL???");
352 tprintf(" %#lx", start);
353 tprintf(", %d, ", nfds);
355 if (tcp->u_arg[2] == INFTIM)
359 tprintf("%ld", tcp->u_arg[2]);
364 #else /* !HAVE_SYS_POLL_H */
373 #if !defined(LINUX) && !defined(FREEBSD)
375 static const struct xlat stream_flush_options[] = {
376 { FLUSHR, "FLUSHR" },
377 { FLUSHW, "FLUSHW" },
378 { FLUSHRW, "FLUSHRW" },
380 { FLUSHBAND, "FLUSHBAND" },
385 static const struct xlat stream_setsig_flags[] = {
386 { S_INPUT, "S_INPUT" },
387 { S_HIPRI, "S_HIPRI" },
388 { S_OUTPUT, "S_OUTPUT" },
391 { S_ERROR, "S_ERROR" },
394 { S_HANGUP, "S_HANGUP" },
397 { S_RDNORM, "S_RDNORM" },
400 { S_WRNORM, "S_WRNORM" },
403 { S_RDBAND, "S_RDBAND" },
406 { S_WRBAND, "S_WRBAND" },
409 { S_BANDURG, "S_BANDURG" },
414 static const struct xlat stream_read_options[] = {
421 static const struct xlat stream_read_flags[] = {
423 { RPROTDAT, "RPROTDAT" },
426 { RPROTDIS, "RPROTDIS" },
429 { RPROTNORM, "RPROTNORM" },
435 #define RMODEMASK (~0)
439 static const struct xlat stream_write_flags[] = {
440 { SNDZERO, "SNDZERO" },
441 { SNDPIPE, "SNDPIPE" },
444 #endif /* I_SWROPT */
447 static const struct xlat stream_atmark_options[] = {
448 { ANYMARK, "ANYMARK" },
449 { LASTMARK, "LASTMARK" },
452 #endif /* I_ATMARK */
455 static const struct xlat transport_user_options[] = {
456 { T_CONN_REQ, "T_CONN_REQ" },
457 { T_CONN_RES, "T_CONN_RES" },
458 { T_DISCON_REQ, "T_DISCON_REQ" },
459 { T_DATA_REQ, "T_DATA_REQ" },
460 { T_EXDATA_REQ, "T_EXDATA_REQ" },
461 { T_INFO_REQ, "T_INFO_REQ" },
462 { T_BIND_REQ, "T_BIND_REQ" },
463 { T_UNBIND_REQ, "T_UNBIND_REQ" },
464 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
465 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
466 { T_ORDREL_REQ, "T_ORDREL_REQ" },
470 static const struct xlat transport_user_flags [] = {
472 { T_MORE, "T_MORE" },
473 { T_EXPEDITED, "T_EXPEDITED" },
474 { T_NEGOTIATE, "T_NEGOTIATE" },
475 { T_CHECK, "T_CHECK" },
476 { T_DEFAULT, "T_DEFAULT" },
477 { T_SUCCESS, "T_SUCCESS" },
478 { T_FAILURE, "T_FAILURE" },
479 { T_CURRENT, "T_CURRENT" },
480 { T_PARTSUCCESS,"T_PARTSUCCESS" },
481 { T_READONLY, "T_READONLY" },
482 { T_NOTSUPPORT, "T_NOTSUPPORT" },
487 #ifdef HAVE_STRUCT_T_OPTHDR
489 static const struct xlat xti_level [] = {
490 { XTI_GENERIC, "XTI_GENERIC" },
494 static const struct xlat xti_generic [] = {
495 { XTI_DEBUG, "XTI_DEBUG" },
496 { XTI_LINGER, "XTI_LINGER" },
497 { XTI_RCVBUF, "XTI_RCVBUF" },
498 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
499 { XTI_SNDBUF, "XTI_SNDBUF" },
500 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
507 print_xti_optmgmt (tcp, addr, len)
515 while (len >= (int) sizeof hdr) {
516 if (umove(tcp, addr, &hdr) < 0) break;
520 else if (len > hdr.len + sizeof hdr) {
524 printxval (xti_level, hdr.level, "???");
528 printxval (xti_generic, hdr.name, "XTI_???");
531 tprintf ("%ld", hdr.name);
534 tprintf (", status=");
535 printxval (transport_user_flags, hdr.status, "T_???");
538 if ((hdr.len -= sizeof hdr) > 0) {
539 if (hdr.len > len) break;
541 if (len == sizeof (int))
542 printnum (tcp, addr, "%d");
544 printstr (tcp, addr, hdr.len);
551 if (c++) tprintf (", ");
552 printstr (tcp, addr, len);
554 if (c > 1) tprintf ("]");
561 print_optmgmt (tcp, addr, len)
566 /* We don't know how to tell if TLI (socket) or XTI
567 optmgmt is being used yet, assume TLI. */
568 #if defined (HAVE_STRUCT_OPTHDR)
569 print_sock_optmgmt (tcp, addr, len);
570 #elif defined (HAVE_STRUCT_T_OPTHDR)
571 print_xti_optmgmt (tcp, addr, len);
573 printstr (tcp, addr, len);
580 static const struct xlat service_type [] = {
581 { T_COTS, "T_COTS" },
582 { T_COTS_ORD, "T_COTS_ORD" },
583 { T_CLTS, "T_CLTS" },
587 static const struct xlat ts_state [] = {
588 { TS_UNBND, "TS_UNBND" },
589 { TS_WACK_BREQ, "TS_WACK_BREQ" },
590 { TS_WACK_UREQ, "TS_WACK_UREQ" },
591 { TS_IDLE, "TS_IDLE" },
592 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
593 { TS_WACK_CREQ, "TS_WACK_CREQ" },
594 { TS_WCON_CREQ, "TS_WCON_CREQ" },
595 { TS_WRES_CIND, "TS_WRES_CIND" },
596 { TS_WACK_CRES, "TS_WACK_CRES" },
597 { TS_DATA_XFER, "TS_DATA_XFER" },
598 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
599 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
600 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
601 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
602 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
603 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
604 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
608 static const struct xlat provider_flags [] = {
610 { SENDZERO, "SENDZERO" },
611 { EXPINLINE, "EXPINLINE" },
612 { XPG4_1, "XPG4_1" },
617 static const struct xlat tli_errors [] = {
618 { TBADADDR, "TBADADDR" },
619 { TBADOPT, "TBADOPT" },
620 { TACCES, "TACCES" },
622 { TNOADDR, "TNOADDR" },
623 { TOUTSTATE, "TOUTSTATE" },
624 { TBADSEQ, "TBADSEQ" },
625 { TSYSERR, "TSYSERR" },
627 { TBADDATA, "TBADDATA" },
628 { TBUFOVFLW, "TBUFOVFLW" },
630 { TNODATA, "TNODATA" },
631 { TNODIS, "TNODIS" },
632 { TNOUDERR, "TNOUDERR" },
633 { TBADFLAG, "TBADFLAG" },
634 { TNOREL, "TNOREL" },
635 { TNOTSUPPORT, "TNOTSUPPORT" },
636 { TSTATECHNG, "TSTATECHNG" },
637 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
638 { TBADNAME, "TBADNAME" },
639 { TBADQLEN, "TBADQLEN" },
640 { TADDRBUSY, "TADDRBUSY" },
641 { TINDOUT, "TINDOUT" },
642 { TPROVMISMATCH,"TPROVMISMATCH" },
643 { TRESQLEN, "TRESQLEN" },
644 { TRESADDR, "TRESADDR" },
645 { TQFULL, "TQFULL" },
646 { TPROTO, "TPROTO" },
652 print_transport_message (tcp, expect, addr, len)
658 union T_primitives m;
661 if (len < sizeof m.type) goto dump;
663 if (umove (tcp, addr, &m.type) < 0) goto dump;
665 #define GET(type, struct) \
667 if (len < sizeof m.struct) goto dump; \
668 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
670 if (expect != type) { \
678 do { if (c++) tprintf (", "); } while (0)
681 #define STRUCT(struct, elem, print) \
684 if (m.struct.elem##_length < 0 || \
685 m.struct.elem##_offset < sizeof m.struct || \
686 m.struct.elem##_offset + m.struct.elem##_length > len) \
688 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
689 m.struct.elem##_length, \
690 m.struct.elem##_offset); \
693 tprintf (#elem "="); \
695 addr + m.struct.elem##_offset, \
696 m.struct.elem##_length); \
701 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
705 case T_CONN_REQ: /* connect request */
706 GET (T_CONN_REQ, conn_req);
707 ADDR (conn_req, DEST);
708 ADDR (conn_req, OPT);
712 case T_CONN_RES: /* connect response */
713 GET (T_CONN_RES, conn_res);
714 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
716 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
717 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
719 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
721 ADDR (conn_res, OPT);
723 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
727 case T_DISCON_REQ: /* disconnect request */
728 GET (T_DISCON_REQ, discon_req);
730 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
734 case T_DATA_REQ: /* data request */
735 GET (T_DATA_REQ, data_req);
737 tprintf ("MORE=%ld", m.data_req.MORE_flag);
741 case T_EXDATA_REQ: /* expedited data req */
742 GET (T_EXDATA_REQ, exdata_req);
744 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
748 case T_INFO_REQ: /* information req */
749 GET (T_INFO_REQ, info_req);
753 case T_BIND_REQ: /* bind request */
755 case O_T_BIND_REQ: /* Ugly xti/tli hack */
757 GET (T_BIND_REQ, bind_req);
758 ADDR (bind_req, ADDR);
760 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
764 case T_UNBIND_REQ: /* unbind request */
765 GET (T_UNBIND_REQ, unbind_req);
768 #ifdef T_UNITDATA_REQ
769 case T_UNITDATA_REQ: /* unitdata requset */
770 GET (T_UNITDATA_REQ, unitdata_req);
771 ADDR (unitdata_req, DEST);
772 ADDR (unitdata_req, OPT);
776 case T_OPTMGMT_REQ: /* manage opt req */
777 GET (T_OPTMGMT_REQ, optmgmt_req);
780 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
782 STRUCT (optmgmt_req, OPT, print_optmgmt);
786 case T_ORDREL_REQ: /* orderly rel req */
787 GET (T_ORDREL_REQ, ordrel_req);
791 case T_CONN_IND: /* connect indication */
792 GET (T_CONN_IND, conn_ind);
793 ADDR (conn_ind, SRC);
794 ADDR (conn_ind, OPT);
795 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
799 case T_CONN_CON: /* connect corfirm */
800 GET (T_CONN_CON, conn_con);
801 ADDR (conn_con, RES);
802 ADDR (conn_con, OPT);
806 case T_DISCON_IND: /* discon indication */
807 GET (T_DISCON_IND, discon_ind);
809 tprintf ("DISCON=%ld, SEQ=%ld",
810 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
814 case T_DATA_IND: /* data indication */
815 GET (T_DATA_IND, data_ind);
817 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
821 case T_EXDATA_IND: /* expedited data ind */
822 GET (T_EXDATA_IND, exdata_ind);
824 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
828 case T_INFO_ACK: /* info ack */
829 GET (T_INFO_ACK, info_ack);
831 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
832 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
833 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
834 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
835 m.info_ack.ADDR_size, m.info_ack.OPT_size,
836 m.info_ack.TIDU_size);
837 printxval (service_type, m.info_ack.SERV_type, "T_???");
838 tprintf (", CURRENT=");
839 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
840 tprintf (", PROVIDER=");
841 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
845 case T_BIND_ACK: /* bind ack */
846 GET (T_BIND_ACK, bind_ack);
847 ADDR (bind_ack, ADDR);
848 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
852 case T_ERROR_ACK: /* error ack */
853 GET (T_ERROR_ACK, error_ack);
856 printxval (transport_user_options,
857 m.error_ack.ERROR_prim, "TI_???");
859 printxval (tli_errors, m.error_ack.TLI_error, "T???");
860 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
864 case T_OK_ACK: /* ok ack */
865 GET (T_OK_ACK, ok_ack);
867 tprintf ("CORRECT=");
868 printxval (transport_user_options,
869 m.ok_ack.CORRECT_prim, "TI_???");
872 #ifdef T_UNITDATA_IND
873 case T_UNITDATA_IND: /* unitdata ind */
874 GET (T_UNITDATA_IND, unitdata_ind);
875 ADDR (unitdata_ind, SRC);
876 ADDR (unitdata_ind, OPT);
880 case T_UDERROR_IND: /* unitdata error ind */
881 GET (T_UDERROR_IND, uderror_ind);
882 ADDR (uderror_ind, DEST);
883 ADDR (uderror_ind, OPT);
884 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
888 case T_OPTMGMT_ACK: /* manage opt ack */
889 GET (T_OPTMGMT_ACK, optmgmt_ack);
892 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
894 STRUCT (optmgmt_ack, OPT, print_optmgmt);
898 case T_ORDREL_IND: /* orderly rel ind */
899 GET (T_ORDREL_IND, ordrel_ind);
903 case T_ADDR_REQ: /* address req */
904 GET (T_ADDR_REQ, addr_req);
908 case T_ADDR_ACK: /* address response */
909 GET (T_ADDR_ACK, addr_ack);
910 ADDR (addr_ack, LOCADDR);
911 ADDR (addr_ack, REMADDR);
917 printstr(tcp, addr, len);
921 if (c >= 0) tprintf ("}");
935 internal_stream_ioctl(tcp, arg)
940 struct ioctlent *iop;
944 struct si_udata udata;
945 #endif /* SI_GETUDATA */
949 if (umove(tcp, arg, &si) < 0) {
955 iop = ioctl_lookup(si.ic_cmd);
957 tprintf(", {ic_cmd=%s", iop->symbol);
958 while ((iop = ioctl_next_match(iop)))
959 tprintf(" or %s", iop->symbol);
961 tprintf(", {ic_cmd=%#x", si.ic_cmd);
962 if (si.ic_timout == INFTIM)
963 tprintf(", ic_timout=INFTIM, ");
965 tprintf(" ic_timout=%d, ", si.ic_timout);
973 #endif /* SI_GETUDATA */
977 tprintf("/* in */ ");
979 tprintf(", /* out */ ");
981 if (in_and_out || entering(tcp))
982 tprintf("ic_len=%d, ic_dp=", si.ic_len);
986 /* in T_BIND_REQ, out T_BIND_ACK */
989 print_transport_message (tcp,
991 si.ic_dp, si.ic_len);
994 print_transport_message (tcp,
996 si.ic_dp, si.ic_len);
1002 /* in T_UNBIND_REQ, out T_OK_ACK */
1004 if (entering(tcp)) {
1005 print_transport_message (tcp,
1007 si.ic_dp, si.ic_len);
1010 print_transport_message (tcp,
1012 si.ic_dp, si.ic_len);
1015 #endif /* TI_UNBIND */
1018 /* in T_INFO_REQ, out T_INFO_ACK */
1020 if (entering(tcp)) {
1021 print_transport_message (tcp,
1023 si.ic_dp, si.ic_len);
1026 print_transport_message (tcp,
1028 si.ic_dp, si.ic_len);
1031 #endif /* TI_GETINFO */
1034 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1036 if (entering(tcp)) {
1037 print_transport_message (tcp,
1039 si.ic_dp, si.ic_len);
1042 print_transport_message (tcp,
1044 si.ic_dp, si.ic_len);
1047 #endif /* TI_OPTMGMT */
1053 tprintf("struct si_udata ");
1055 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1058 tprintf("{tidusize=%d, addrsize=%d, ",
1059 udata.tidusize, udata.addrsize);
1060 tprintf("optsize=%d, etsdusize=%d, ",
1061 udata.optsize, udata.etsdusize);
1062 tprintf("servtype=%d, so_state=%d, ",
1063 udata.servtype, udata.so_state);
1064 tprintf("so_options=%d", udata.so_options);
1066 tprintf(", tsdusize=%d", udata.tsdusize);
1071 #endif /* SI_GETUDATA */
1073 printstr(tcp, (long) si.ic_dp, si.ic_len);
1078 if (timod && tcp->u_rval) {
1079 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1080 return RVAL_STR + 1;
1088 stream_ioctl(tcp, code, arg)
1100 struct strfdinsert sfi;
1101 struct strrecvfd srf;
1106 /* I_STR is a special case because the data is read & written. */
1108 return internal_stream_ioctl(tcp, arg);
1116 /* arg is a string */
1118 printpath(tcp, arg);
1121 /* doesn't take an argument */
1124 /* argument is an option */
1126 printxval(stream_flush_options, arg, "FLUSH???");
1130 /* argument is a pointer to a bandinfo struct */
1131 if (umove(tcp, arg, &bi) < 0)
1134 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1135 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1139 #endif /* I_FLUSHBAND */
1141 /* argument is a set of flags */
1143 printflags(stream_setsig_flags, arg, "S_???");
1146 /* argument is a pointer to a set of flags */
1150 if (umove(tcp, arg, &val) < 0)
1153 printflags(stream_setsig_flags, val, "S_???");
1157 /* argument is a pointer to a strpeek structure */
1158 if (syserror(tcp) || !arg)
1160 if (umove(tcp, arg, &sp) < 0) {
1164 tprintf(", {ctlbuf=");
1165 printstrbuf(tcp, &sp.ctlbuf, 1);
1166 tprintf(", databuf=");
1167 printstrbuf(tcp, &sp.databuf, 1);
1168 tprintf(", flags=");
1169 printflags(msgflags, sp.flags, "RS_???");
1173 /* argument is an option with flags */
1175 printxval(stream_read_options, arg & RMODEMASK, "R???");
1176 addflags(stream_read_flags, arg & ~RMODEMASK);
1179 /* argument is an pointer to an option with flags */
1183 if (umove(tcp, arg, &val) < 0)
1186 printxval(stream_read_options,
1187 arg & RMODEMASK, "R???");
1188 addflags(stream_read_flags, arg & ~RMODEMASK);
1202 /* argument is a pointer to a decimal integer */
1206 printnum(tcp, arg, "%d");
1209 /* argument is a pointer to a strfdinsert structure */
1210 if (syserror(tcp) || !arg)
1212 if (umove(tcp, arg, &sfi) < 0) {
1216 tprintf(", {ctlbuf=");
1217 printstrbuf(tcp, &sfi.ctlbuf, 1);
1218 tprintf(", databuf=");
1219 printstrbuf(tcp, &sfi.databuf, 1);
1220 tprintf(", flags=");
1221 printflags(msgflags, sfi.flags, "RS_???");
1222 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1226 /* argument is a set of flags */
1228 printflags(stream_write_flags, arg, "SND???");
1230 #endif /* I_SWROPT */
1233 /* argument is an pointer to an option with flags */
1237 if (umove(tcp, arg, &val) < 0)
1240 printflags(stream_write_flags, arg, "SND???");
1243 #endif /* I_GWROPT */
1255 /* argument is a decimal integer */
1256 tprintf(", %d", arg);
1259 /* argument is a pointer to a strrecvfd structure */
1260 if (syserror(tcp) || !arg)
1262 if (umove(tcp, arg, &srf) < 0) {
1266 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1267 (unsigned long) srf.uid, (unsigned long) srf.gid);
1277 if (umove(tcp, arg, &sl) < 0) {
1281 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1282 for (i = 0; i < tcp->u_rval; i++) {
1285 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1293 printxval(stream_atmark_options, arg, "???MARK");
1295 #endif /* I_ATMARK */
1301 #endif /* !LINUX && !FREEBSD */
1303 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */