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) 2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <sys/types.h>
35 static void show_rtmp_tuples(uint8_t *, int);
38 rtmp_func_long(uint8_t fun
)
44 return ("Route Data Request, split horizon");
46 return ("Route Data Request, no split horizon");
53 rtmp_func_short(uint8_t fun
)
61 return ("RDR, no sh");
68 interpret_rtmp(int flags
, struct ddp_hdr
*ddp
, int len
)
81 data
= (uint8_t *)ddp
+ DDPHDR_SIZE
;
83 switch (ddp
->ddp_type
) {
84 case DDP_TYPE_RTMPRQ
: /* simple rtmp */
89 (void) snprintf(get_sum_line(), MAXLINE
,
91 rtmp_func_short(data
[0]));
94 if (flags
& F_DTAIL
) {
95 show_header("RTMP: ", "RTMP Header", len
);
98 (void) snprintf(get_line(0, 0), get_line_remain(),
100 data
[0], rtmp_func_long(data
[0]));
103 case DDP_TYPE_RTMPRESP
: /* RTMP data */
107 snet
= get_short(data
);
108 if (data
[2] != 8) /* ID length is always 8 */
110 node
= data
[3]; /* assume id_len == 8 */
111 extended
= (data
[6] != RTMP_FILLER
) &&
112 (get_short(&data
[4]) != 0);
114 tuples
= (len
- 4) / 3;
115 runt
= (len
- 4) % 3; /* integral length? */
118 (void) snprintf(get_sum_line(), MAXLINE
,
119 "RTMP Data Snet=%d, Snode=%d%s",
120 snet
, node
, runt
!= 0 ? " (short)" : "");
123 if (flags
& F_DTAIL
) {
124 show_header("RTMP: ", "RTMP Header", len
);
127 (void) snprintf(get_line(0, 0), get_line_remain(),
128 "RTMP Data, Length = %d%s",
129 len
, runt
!= 0 ? " (short packet)" : "");
130 (void) snprintf(get_line(0, 0), get_line_remain(),
131 "Senders Net = %d, Sender Node %d",
134 show_rtmp_tuples(&data
[4], tuples
);
136 show_rtmp_tuples(&data
[7], tuples
-1);
144 (void) snprintf(get_sum_line(), MAXLINE
,
145 "RTMP (short packet)");
148 if (flags
& F_DTAIL
) {
149 show_header("RTMP: ", "RTMP Header", len
);
152 (void) snprintf(get_line(0, 0), get_line_remain(),
158 show_rtmp_tuples(uint8_t *p
, int tuples
)
162 if (p
[2] & RTMP_EXTEND
) { /* extended tuple? */
164 (void) snprintf(get_line(0, 0),
166 "Network = %d-%d, Distance = %d",
167 get_short(p
), get_short(&p
[3]),
168 p
[2] & RTMP_DIST_MASK
);
173 (void) snprintf(get_line(0, 0),
175 "Network = %d, Distance = %d",