blob: 35b5a196d8bfe6096a9711fe8c4e612db01c6009 [file] [log] [blame]
The Android Open Source Project2949f582009-03-03 19:30:46 -08001/*
2 * Copyright (c) 1993, 1994, 1995, 1996
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
Elliott Hughese2e3bd12017-05-15 10:59:29 -070022/* \summary: White Board printer */
23
The Android Open Source Project2949f582009-03-03 19:30:46 -080024#ifdef HAVE_CONFIG_H
Elliott Hughes820eced2021-08-20 18:00:50 -070025#include <config.h>
The Android Open Source Project2949f582009-03-03 19:30:46 -080026#endif
27
Elliott Hughes820eced2021-08-20 18:00:50 -070028#include "netdissect-stdinc.h"
The Android Open Source Project2949f582009-03-03 19:30:46 -080029
Elliott Hughes820eced2021-08-20 18:00:50 -070030#define ND_LONGJMP_FROM_TCHECK
Elliott Hughese2e3bd12017-05-15 10:59:29 -070031#include "netdissect.h"
The Android Open Source Project2949f582009-03-03 19:30:46 -080032#include "addrtoname.h"
33#include "extract.h"
34
Elliott Hughes892a68b2015-10-19 14:43:53 -070035
Elliott Hughes820eced2021-08-20 18:00:50 -070036#if 0
The Android Open Source Project2949f582009-03-03 19:30:46 -080037/*
38 * Largest packet size. Everything should fit within this space.
39 * For instance, multiline objects are sent piecewise.
40 */
41#define MAXFRAMESIZE 1024
Elliott Hughes820eced2021-08-20 18:00:50 -070042#endif
The Android Open Source Project2949f582009-03-03 19:30:46 -080043
44/*
45 * Multiple drawing ops can be sent in one packet. Each one starts on a
46 * an even multiple of DOP_ALIGN bytes, which must be a power of two.
47 */
48#define DOP_ALIGN 4
Elliott Hughes820eced2021-08-20 18:00:50 -070049#define DOP_ROUNDUP(x) roundup2(x, DOP_ALIGN)
The Android Open Source Project2949f582009-03-03 19:30:46 -080050#define DOP_NEXT(d)\
Elliott Hughese2e3bd12017-05-15 10:59:29 -070051 ((const struct dophdr *)((const u_char *)(d) + \
Elliott Hughes820eced2021-08-20 18:00:50 -070052 DOP_ROUNDUP(GET_BE_U_2((d)->dh_len) + sizeof(*(d)))))
The Android Open Source Project2949f582009-03-03 19:30:46 -080053
54/*
55 * Format of the whiteboard packet header.
56 * The transport level header.
57 */
58struct pkt_hdr {
Elliott Hughes820eced2021-08-20 18:00:50 -070059 nd_uint32_t ph_src; /* site id of source */
60 nd_uint32_t ph_ts; /* time stamp (for skew computation) */
61 nd_uint16_t ph_version; /* version number */
62 nd_uint8_t ph_type; /* message type */
63 nd_uint8_t ph_flags; /* message flags */
The Android Open Source Project2949f582009-03-03 19:30:46 -080064};
65
66/* Packet types */
67#define PT_DRAWOP 0 /* drawing operation */
68#define PT_ID 1 /* announcement packet */
69#define PT_RREQ 2 /* repair request */
70#define PT_RREP 3 /* repair reply */
71#define PT_KILL 4 /* terminate participation */
72#define PT_PREQ 5 /* page vector request */
73#define PT_PREP 7 /* page vector reply */
74
Elliott Hughes820eced2021-08-20 18:00:50 -070075#if 0
The Android Open Source Project2949f582009-03-03 19:30:46 -080076#ifdef PF_USER
77#undef PF_USER /* {Digital,Tru64} UNIX define this, alas */
78#endif
79
80/* flags */
81#define PF_USER 0x01 /* hint that packet has interactive data */
82#define PF_VIS 0x02 /* only visible ops wanted */
Elliott Hughes820eced2021-08-20 18:00:50 -070083#endif
The Android Open Source Project2949f582009-03-03 19:30:46 -080084
85struct PageID {
Elliott Hughes820eced2021-08-20 18:00:50 -070086 nd_uint32_t p_sid; /* session id of initiator */
87 nd_uint32_t p_uid; /* page number */
The Android Open Source Project2949f582009-03-03 19:30:46 -080088};
89
90struct dophdr {
Elliott Hughes820eced2021-08-20 18:00:50 -070091 nd_uint32_t dh_ts; /* sender's timestamp */
92 nd_uint16_t dh_len; /* body length */
93 nd_uint8_t dh_flags;
94 nd_uint8_t dh_type; /* body type */
The Android Open Source Project2949f582009-03-03 19:30:46 -080095 /* body follows */
96};
97/*
98 * Drawing op sub-types.
99 */
100#define DT_RECT 2
101#define DT_LINE 3
102#define DT_ML 4
103#define DT_DEL 5
104#define DT_XFORM 6
105#define DT_ELL 7
106#define DT_CHAR 8
107#define DT_STR 9
108#define DT_NOP 10
109#define DT_PSCODE 11
110#define DT_PSCOMP 12
111#define DT_REF 13
112#define DT_SKIP 14
113#define DT_HOLE 15
Elliott Hughes820eced2021-08-20 18:00:50 -0700114static const struct tok dop_str[] = {
115 { DT_RECT, "RECT" },
116 { DT_LINE, "LINE" },
117 { DT_ML, "ML" },
118 { DT_DEL, "DEL" },
119 { DT_XFORM, "XFORM" },
120 { DT_ELL, "ELL" },
121 { DT_CHAR, "CHAR" },
122 { DT_STR, "STR" },
123 { DT_NOP, "NOP" },
124 { DT_PSCODE, "PSCODE" },
125 { DT_PSCOMP, "PSCOMP" },
126 { DT_REF, "REF" },
127 { DT_SKIP, "SKIP" },
128 { DT_HOLE, "HOLE" },
129 { 0, NULL }
130};
The Android Open Source Project2949f582009-03-03 19:30:46 -0800131
132/*
133 * A drawing operation.
134 */
135struct pkt_dop {
136 struct PageID pd_page; /* page that operations apply to */
Elliott Hughes820eced2021-08-20 18:00:50 -0700137 nd_uint32_t pd_sseq; /* start sequence number */
138 nd_uint32_t pd_eseq; /* end sequence number */
The Android Open Source Project2949f582009-03-03 19:30:46 -0800139 /* drawing ops follow */
140};
141
142/*
143 * A repair request.
144 */
145struct pkt_rreq {
Elliott Hughes820eced2021-08-20 18:00:50 -0700146 nd_uint32_t pr_id; /* source id of drawops to be repaired */
147 struct PageID pr_page; /* page of drawops */
148 nd_uint32_t pr_sseq; /* start seqno */
149 nd_uint32_t pr_eseq; /* end seqno */
The Android Open Source Project2949f582009-03-03 19:30:46 -0800150};
151
152/*
153 * A repair reply.
154 */
155struct pkt_rrep {
Elliott Hughes820eced2021-08-20 18:00:50 -0700156 nd_uint32_t pr_id; /* original site id of ops */
The Android Open Source Project2949f582009-03-03 19:30:46 -0800157 struct pkt_dop pr_dop;
158 /* drawing ops follow */
159};
160
161struct id_off {
Elliott Hughes820eced2021-08-20 18:00:50 -0700162 nd_uint32_t id;
163 nd_uint32_t off;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800164};
165
166struct pgstate {
Elliott Hughes820eced2021-08-20 18:00:50 -0700167 nd_uint32_t slot;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800168 struct PageID page;
Elliott Hughes820eced2021-08-20 18:00:50 -0700169 nd_uint16_t nid;
170 nd_uint16_t rsvd;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800171 /* seqptr's */
172};
173
174/*
175 * An announcement packet.
176 */
177struct pkt_id {
Elliott Hughes820eced2021-08-20 18:00:50 -0700178 nd_uint32_t pi_mslot;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800179 struct PageID pi_mpage; /* current page */
180 struct pgstate pi_ps;
181 /* seqptr's */
182 /* null-terminated site name */
183};
184
185struct pkt_preq {
186 struct PageID pp_page;
Elliott Hughes820eced2021-08-20 18:00:50 -0700187 nd_uint32_t pp_low;
188 nd_uint32_t pp_high;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800189};
190
191struct pkt_prep {
Elliott Hughes820eced2021-08-20 18:00:50 -0700192 nd_uint32_t pp_n; /* size of pageid array */
The Android Open Source Project2949f582009-03-03 19:30:46 -0800193 /* pgstate's follow */
194};
195
196static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700197wb_id(netdissect_options *ndo,
198 const struct pkt_id *id, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800199{
Elliott Hughes820eced2021-08-20 18:00:50 -0700200 u_int i;
201 const u_char *sitename;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800202 const struct id_off *io;
203 char c;
Elliott Hughes820eced2021-08-20 18:00:50 -0700204 u_int nid;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800205
Elliott Hughes820eced2021-08-20 18:00:50 -0700206 ND_PRINT(" wb-id:");
207 if (len < sizeof(*id))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800208 return (-1);
209 len -= sizeof(*id);
210
Elliott Hughes820eced2021-08-20 18:00:50 -0700211 ND_PRINT(" %u/%s:%u (max %u/%s:%u) ",
212 GET_BE_U_4(id->pi_ps.slot),
213 GET_IPADDR_STRING(id->pi_ps.page.p_sid),
214 GET_BE_U_4(id->pi_ps.page.p_uid),
215 GET_BE_U_4(id->pi_mslot),
216 GET_IPADDR_STRING(id->pi_mpage.p_sid),
217 GET_BE_U_4(id->pi_mpage.p_uid));
218 /* now the rest of the fixed-size part of struct pkt_id */
219 ND_TCHECK_SIZE(id);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800220
Elliott Hughes820eced2021-08-20 18:00:50 -0700221 nid = GET_BE_U_2(id->pi_ps.nid);
222 if (len < sizeof(*io) * nid)
223 return (-1);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800224 len -= sizeof(*io) * nid;
Elliott Hughese2e3bd12017-05-15 10:59:29 -0700225 io = (const struct id_off *)(id + 1);
Elliott Hughes820eced2021-08-20 18:00:50 -0700226 sitename = (const u_char *)(io + nid);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800227
228 c = '<';
Elliott Hughes820eced2021-08-20 18:00:50 -0700229 for (i = 0; i < nid; ++io, ++i) {
230 ND_PRINT("%c%s:%u",
231 c, GET_IPADDR_STRING(io->id), GET_BE_U_4(io->off));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800232 c = ',';
233 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700234 ND_PRINT("> \"");
235 nd_printjnp(ndo, sitename, len);
236 ND_PRINT("\"");
237 return (0);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800238}
239
240static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700241wb_rreq(netdissect_options *ndo,
242 const struct pkt_rreq *rreq, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800243{
Elliott Hughes820eced2021-08-20 18:00:50 -0700244 ND_PRINT(" wb-rreq:");
245 if (len < sizeof(*rreq))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800246 return (-1);
247
Elliott Hughes820eced2021-08-20 18:00:50 -0700248 ND_PRINT(" please repair %s %s:%u<%u:%u>",
249 GET_IPADDR_STRING(rreq->pr_id),
250 GET_IPADDR_STRING(rreq->pr_page.p_sid),
251 GET_BE_U_4(rreq->pr_page.p_uid),
252 GET_BE_U_4(rreq->pr_sseq),
253 GET_BE_U_4(rreq->pr_eseq));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800254 return (0);
255}
256
257static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700258wb_preq(netdissect_options *ndo,
259 const struct pkt_preq *preq, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800260{
Elliott Hughes820eced2021-08-20 18:00:50 -0700261 ND_PRINT(" wb-preq:");
262 if (len < sizeof(*preq))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800263 return (-1);
264
Elliott Hughes820eced2021-08-20 18:00:50 -0700265 ND_PRINT(" need %u/%s:%u",
266 GET_BE_U_4(preq->pp_low),
267 GET_IPADDR_STRING(preq->pp_page.p_sid),
268 GET_BE_U_4(preq->pp_page.p_uid));
269 /* now the rest of the fixed-size part of struct pkt_req */
270 ND_TCHECK_SIZE(preq);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800271 return (0);
272}
273
274static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700275wb_prep(netdissect_options *ndo,
276 const struct pkt_prep *prep, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800277{
Elliott Hughes820eced2021-08-20 18:00:50 -0700278 u_int n;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800279 const struct pgstate *ps;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800280
Elliott Hughes820eced2021-08-20 18:00:50 -0700281 ND_PRINT(" wb-prep:");
282 if (len < sizeof(*prep))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800283 return (-1);
Elliott Hughes820eced2021-08-20 18:00:50 -0700284 n = GET_BE_U_4(prep->pp_n);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800285 ps = (const struct pgstate *)(prep + 1);
Elliott Hughes820eced2021-08-20 18:00:50 -0700286 while (n != 0) {
The Android Open Source Project2949f582009-03-03 19:30:46 -0800287 const struct id_off *io, *ie;
288 char c = '<';
289
Elliott Hughes820eced2021-08-20 18:00:50 -0700290 ND_PRINT(" %u/%s:%u",
291 GET_BE_U_4(ps->slot),
292 GET_IPADDR_STRING(ps->page.p_sid),
293 GET_BE_U_4(ps->page.p_uid));
294 /* now the rest of the fixed-size part of struct pgstate */
295 ND_TCHECK_SIZE(ps);
Elliott Hughese2e3bd12017-05-15 10:59:29 -0700296 io = (const struct id_off *)(ps + 1);
Elliott Hughes820eced2021-08-20 18:00:50 -0700297 for (ie = io + GET_U_1(ps->nid); io < ie; ++io) {
298 ND_PRINT("%c%s:%u", c, GET_IPADDR_STRING(io->id),
299 GET_BE_U_4(io->off));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800300 c = ',';
301 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700302 ND_PRINT(">");
Elliott Hughese2e3bd12017-05-15 10:59:29 -0700303 ps = (const struct pgstate *)io;
Elliott Hughes820eced2021-08-20 18:00:50 -0700304 n--;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800305 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700306 return 0;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800307}
308
Elliott Hughes820eced2021-08-20 18:00:50 -0700309static void
Elliott Hughes892a68b2015-10-19 14:43:53 -0700310wb_dops(netdissect_options *ndo, const struct pkt_dop *dop,
311 uint32_t ss, uint32_t es)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800312{
Elliott Hughes892a68b2015-10-19 14:43:53 -0700313 const struct dophdr *dh = (const struct dophdr *)((const u_char *)dop + sizeof(*dop));
314
Elliott Hughes820eced2021-08-20 18:00:50 -0700315 ND_PRINT(" <");
The Android Open Source Project2949f582009-03-03 19:30:46 -0800316 for ( ; ss <= es; ++ss) {
Elliott Hughes820eced2021-08-20 18:00:50 -0700317 u_int t;
Elliott Hughes892a68b2015-10-19 14:43:53 -0700318
Elliott Hughes820eced2021-08-20 18:00:50 -0700319 t = GET_U_1(dh->dh_type);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800320
Elliott Hughes820eced2021-08-20 18:00:50 -0700321 ND_PRINT(" %s", tok2str(dop_str, "dop-%u!", t));
322 if (t == DT_SKIP || t == DT_HOLE) {
323 uint32_t ts = GET_BE_U_4(dh->dh_ts);
324 ND_PRINT("%u", ts - ss + 1);
325 if (ss > ts || ts > es) {
326 ND_PRINT("[|]");
327 if (ts < ss)
328 return;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800329 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700330 ss = ts;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800331 }
332 dh = DOP_NEXT(dh);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800333 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700334 ND_PRINT(" >");
The Android Open Source Project2949f582009-03-03 19:30:46 -0800335}
336
337static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700338wb_rrep(netdissect_options *ndo,
339 const struct pkt_rrep *rrep, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800340{
341 const struct pkt_dop *dop = &rrep->pr_dop;
342
Elliott Hughes820eced2021-08-20 18:00:50 -0700343 ND_PRINT(" wb-rrep:");
344 if (len < sizeof(*rrep))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800345 return (-1);
346 len -= sizeof(*rrep);
347
Elliott Hughes820eced2021-08-20 18:00:50 -0700348 ND_PRINT(" for %s %s:%u<%u:%u>",
349 GET_IPADDR_STRING(rrep->pr_id),
350 GET_IPADDR_STRING(dop->pd_page.p_sid),
351 GET_BE_U_4(dop->pd_page.p_uid),
352 GET_BE_U_4(dop->pd_sseq),
353 GET_BE_U_4(dop->pd_eseq));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800354
Elliott Hughes892a68b2015-10-19 14:43:53 -0700355 if (ndo->ndo_vflag)
Elliott Hughes820eced2021-08-20 18:00:50 -0700356 wb_dops(ndo, dop,
357 GET_BE_U_4(dop->pd_sseq),
358 GET_BE_U_4(dop->pd_eseq));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800359 return (0);
360}
361
362static int
Elliott Hughes892a68b2015-10-19 14:43:53 -0700363wb_drawop(netdissect_options *ndo,
364 const struct pkt_dop *dop, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800365{
Elliott Hughes820eced2021-08-20 18:00:50 -0700366 ND_PRINT(" wb-dop:");
367 if (len < sizeof(*dop))
The Android Open Source Project2949f582009-03-03 19:30:46 -0800368 return (-1);
369 len -= sizeof(*dop);
370
Elliott Hughes820eced2021-08-20 18:00:50 -0700371 ND_PRINT(" %s:%u<%u:%u>",
372 GET_IPADDR_STRING(dop->pd_page.p_sid),
373 GET_BE_U_4(dop->pd_page.p_uid),
374 GET_BE_U_4(dop->pd_sseq),
375 GET_BE_U_4(dop->pd_eseq));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800376
Elliott Hughes892a68b2015-10-19 14:43:53 -0700377 if (ndo->ndo_vflag)
Elliott Hughes820eced2021-08-20 18:00:50 -0700378 wb_dops(ndo, dop,
379 GET_BE_U_4(dop->pd_sseq),
380 GET_BE_U_4(dop->pd_eseq));
The Android Open Source Project2949f582009-03-03 19:30:46 -0800381 return (0);
382}
383
384/*
385 * Print whiteboard multicast packets.
386 */
387void
Elliott Hughes892a68b2015-10-19 14:43:53 -0700388wb_print(netdissect_options *ndo,
Elliott Hughes820eced2021-08-20 18:00:50 -0700389 const u_char *hdr, u_int len)
The Android Open Source Project2949f582009-03-03 19:30:46 -0800390{
Elliott Hughes820eced2021-08-20 18:00:50 -0700391 const struct pkt_hdr *ph;
392 uint8_t type;
393 int print_result;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800394
Elliott Hughes820eced2021-08-20 18:00:50 -0700395 ndo->ndo_protocol = "wb";
The Android Open Source Project2949f582009-03-03 19:30:46 -0800396 ph = (const struct pkt_hdr *)hdr;
Elliott Hughes820eced2021-08-20 18:00:50 -0700397 if (len < sizeof(*ph))
398 goto invalid;
399 ND_TCHECK_SIZE(ph);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800400 len -= sizeof(*ph);
401
Elliott Hughes820eced2021-08-20 18:00:50 -0700402 if (GET_U_1(ph->ph_flags))
403 ND_PRINT("*");
404 type = GET_U_1(ph->ph_type);
405 switch (type) {
The Android Open Source Project2949f582009-03-03 19:30:46 -0800406
407 case PT_KILL:
Elliott Hughes820eced2021-08-20 18:00:50 -0700408 ND_PRINT(" wb-kill");
The Android Open Source Project2949f582009-03-03 19:30:46 -0800409 return;
410
411 case PT_ID:
Elliott Hughes820eced2021-08-20 18:00:50 -0700412 print_result = wb_id(ndo, (const struct pkt_id *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800413 break;
414
415 case PT_RREQ:
Elliott Hughes820eced2021-08-20 18:00:50 -0700416 print_result = wb_rreq(ndo, (const struct pkt_rreq *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800417 break;
418
419 case PT_RREP:
Elliott Hughes820eced2021-08-20 18:00:50 -0700420 print_result = wb_rrep(ndo, (const struct pkt_rrep *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800421 break;
422
423 case PT_DRAWOP:
Elliott Hughes820eced2021-08-20 18:00:50 -0700424 print_result = wb_drawop(ndo, (const struct pkt_dop *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800425 break;
426
427 case PT_PREQ:
Elliott Hughes820eced2021-08-20 18:00:50 -0700428 print_result = wb_preq(ndo, (const struct pkt_preq *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800429 break;
430
431 case PT_PREP:
Elliott Hughes820eced2021-08-20 18:00:50 -0700432 print_result = wb_prep(ndo, (const struct pkt_prep *)(ph + 1), len);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800433 break;
434
435 default:
Elliott Hughes820eced2021-08-20 18:00:50 -0700436 ND_PRINT(" wb-%u!", type);
437 print_result = -1;
The Android Open Source Project2949f582009-03-03 19:30:46 -0800438 }
Elliott Hughes820eced2021-08-20 18:00:50 -0700439 if (print_result < 0)
440 goto invalid;
441 return;
442
443invalid:
444 nd_print_invalid(ndo);
The Android Open Source Project2949f582009-03-03 19:30:46 -0800445}