4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1991-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <sys/types.h>
35 static char *adsp_ctrl(uint8_t);
38 interpret_adsp(int flags
, struct ddp_adsphdr
*adp
, int len
)
40 struct ddp_adsp_open
*apo
;
43 if (len
< sizeof (struct ddp_adsphdr
)) {
44 (void) snprintf(get_sum_line(), MAXLINE
,
45 "ADSP (short packet)");
48 (void) snprintf(get_sum_line(), MAXLINE
,
49 "ADSP ConnID=%u (%s)",
50 get_short(adp
->ad_connid
),
51 adsp_ctrl(adp
->ad_desc
));
54 if (flags
& F_DTAIL
) {
55 show_header("ADSP: ", "ADSP Header",
56 len
- sizeof (struct ddp_adsphdr
));
59 if (len
< sizeof (struct ddp_adsphdr
)) {
60 (void) snprintf(get_line(0, 0), get_line_remain(),
65 (void) snprintf(get_line(0, 0), get_line_remain(),
66 "ConnID = %u, ByteSeq = %u, RecvSeq = %u",
67 get_short(adp
->ad_connid
),
68 get_long(adp
->ad_fbseq
),
69 get_long(adp
->ad_nrseq
));
71 (void) snprintf(get_line(0, 0), get_line_remain(),
72 "RcvWin = %u, Ctrl = 0x%x (%s)",
73 get_short(adp
->ad_rcvwin
),
75 adsp_ctrl(adp
->ad_desc
));
77 switch (adp
->ad_desc
) {
78 case AD_CREQ
: /* open requests */
82 apo
= (struct ddp_adsp_open
*)adp
;
83 if (len
< sizeof (struct ddp_adsp_open
)) {
84 (void) snprintf(get_line(0, 0),
89 (void) snprintf(get_line(0, 0), get_line_remain(),
90 "Dest ConnID = %u, AttRcvSeq = %u",
91 get_short(apo
->ad_dconnid
),
92 get_long(apo
->ad_attseq
));
96 if (adp
->ad_desc
& AD_ATT
) {
97 (void) snprintf(get_line(0, 0), get_line_remain(),
99 get_short(((struct ddp_adsp_att
*)adp
)->
105 static char *adsp_ctrl_msg
[] = {
115 "9", "10", "11", "12", "13", "14", "15",
119 adsp_ctrl(uint8_t ctrl
)
123 char *tail
= &buf
[sizeof (buf
)];
125 if (ctrl
& AD_ACKREQ
)
126 p
+= snprintf(p
, tail
-p
, "AckReq");
129 p
+= snprintf(p
, tail
-p
, p
== buf
? "EOM" : " EOM");
133 p
+= snprintf(p
, tail
-p
, p
== buf
? "Att" : " Att");
136 if (ctrl
& AD_CTRL
) {
137 (void) snprintf(p
, tail
-p
, "%s%s", p
== buf
? "" : " ",
138 adsp_ctrl_msg
[ctrl
& AD_CTRL_MASK
]);