1996-08-19 20:34:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1993, 1994, 1995, 1996
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that: (1) source code distributions
|
|
|
|
* retain the above copyright notice and this paragraph in its entirety, (2)
|
|
|
|
* distributions including binary code include the above copyright notice and
|
|
|
|
* this paragraph in its entirety in the documentation or other materials
|
|
|
|
* provided with the distribution, and (3) all advertising materials mentioning
|
|
|
|
* features or use of this software display the following acknowledgement:
|
|
|
|
* ``This product includes software developed by the University of California,
|
|
|
|
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
|
|
|
* the University nor the names of its contributors may be used to endorse
|
|
|
|
* or promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*/
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
#define NETDISSECT_REWORKED
|
2000-01-30 00:45:58 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
1996-08-19 20:34:12 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
#include <tcpdump-stdinc.h>
|
1996-08-19 20:34:12 +00:00
|
|
|
|
|
|
|
#include "interface.h"
|
|
|
|
#include "addrtoname.h"
|
2004-03-31 09:17:26 +00:00
|
|
|
#include "extract.h"
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const char tstr[] = "[|wb]";
|
|
|
|
|
1996-08-19 20:34:12 +00:00
|
|
|
/* XXX need to add byte-swapping macros! */
|
2004-03-31 09:17:26 +00:00
|
|
|
/* XXX - you mean like the ones in "extract.h"? */
|
1996-08-19 20:34:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Largest packet size. Everything should fit within this space.
|
|
|
|
* For instance, multiline objects are sent piecewise.
|
|
|
|
*/
|
|
|
|
#define MAXFRAMESIZE 1024
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Multiple drawing ops can be sent in one packet. Each one starts on a
|
|
|
|
* an even multiple of DOP_ALIGN bytes, which must be a power of two.
|
|
|
|
*/
|
|
|
|
#define DOP_ALIGN 4
|
|
|
|
#define DOP_ROUNDUP(x) ((((int)(x)) + (DOP_ALIGN - 1)) & ~(DOP_ALIGN - 1))
|
|
|
|
#define DOP_NEXT(d)\
|
1997-05-27 02:11:31 +00:00
|
|
|
((struct dophdr *)((u_char *)(d) + \
|
2004-03-31 09:17:26 +00:00
|
|
|
DOP_ROUNDUP(EXTRACT_16BITS(&(d)->dh_len) + sizeof(*(d)))))
|
1996-08-19 20:34:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Format of the whiteboard packet header.
|
|
|
|
* The transport level header.
|
|
|
|
*/
|
|
|
|
struct pkt_hdr {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t ph_src; /* site id of source */
|
|
|
|
uint32_t ph_ts; /* time stamp (for skew computation) */
|
|
|
|
uint16_t ph_version; /* version number */
|
1996-08-19 20:34:12 +00:00
|
|
|
u_char ph_type; /* message type */
|
|
|
|
u_char ph_flags; /* message flags */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Packet types */
|
|
|
|
#define PT_DRAWOP 0 /* drawing operation */
|
|
|
|
#define PT_ID 1 /* announcement packet */
|
|
|
|
#define PT_RREQ 2 /* repair request */
|
|
|
|
#define PT_RREP 3 /* repair reply */
|
|
|
|
#define PT_KILL 4 /* terminate participation */
|
|
|
|
#define PT_PREQ 5 /* page vector request */
|
|
|
|
#define PT_PREP 7 /* page vector reply */
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
#ifdef PF_USER
|
|
|
|
#undef PF_USER /* {Digital,Tru64} UNIX define this, alas */
|
|
|
|
#endif
|
|
|
|
|
1996-08-19 20:34:12 +00:00
|
|
|
/* flags */
|
|
|
|
#define PF_USER 0x01 /* hint that packet has interactive data */
|
|
|
|
#define PF_VIS 0x02 /* only visible ops wanted */
|
|
|
|
|
|
|
|
struct PageID {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t p_sid; /* session id of initiator */
|
|
|
|
uint32_t p_uid; /* page number */
|
1996-08-19 20:34:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dophdr {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t dh_ts; /* sender's timestamp */
|
|
|
|
uint16_t dh_len; /* body length */
|
1996-08-19 20:34:12 +00:00
|
|
|
u_char dh_flags;
|
|
|
|
u_char dh_type; /* body type */
|
|
|
|
/* body follows */
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Drawing op sub-types.
|
|
|
|
*/
|
|
|
|
#define DT_RECT 2
|
|
|
|
#define DT_LINE 3
|
|
|
|
#define DT_ML 4
|
|
|
|
#define DT_DEL 5
|
|
|
|
#define DT_XFORM 6
|
|
|
|
#define DT_ELL 7
|
|
|
|
#define DT_CHAR 8
|
|
|
|
#define DT_STR 9
|
|
|
|
#define DT_NOP 10
|
|
|
|
#define DT_PSCODE 11
|
|
|
|
#define DT_PSCOMP 12
|
|
|
|
#define DT_REF 13
|
|
|
|
#define DT_SKIP 14
|
|
|
|
#define DT_HOLE 15
|
|
|
|
#define DT_MAXTYPE 15
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A drawing operation.
|
|
|
|
*/
|
|
|
|
struct pkt_dop {
|
|
|
|
struct PageID pd_page; /* page that operations apply to */
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pd_sseq; /* start sequence number */
|
|
|
|
uint32_t pd_eseq; /* end sequence number */
|
1996-08-19 20:34:12 +00:00
|
|
|
/* drawing ops follow */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A repair request.
|
|
|
|
*/
|
|
|
|
struct pkt_rreq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pr_id; /* source id of drawops to be repaired */
|
1996-08-19 20:34:12 +00:00
|
|
|
struct PageID pr_page; /* page of drawops */
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pr_sseq; /* start seqno */
|
|
|
|
uint32_t pr_eseq; /* end seqno */
|
1996-08-19 20:34:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A repair reply.
|
|
|
|
*/
|
|
|
|
struct pkt_rrep {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pr_id; /* original site id of ops */
|
1996-08-19 20:34:12 +00:00
|
|
|
struct pkt_dop pr_dop;
|
|
|
|
/* drawing ops follow */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct id_off {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t id;
|
|
|
|
uint32_t off;
|
1996-08-19 20:34:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pgstate {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t slot;
|
1996-08-19 20:34:12 +00:00
|
|
|
struct PageID page;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t nid;
|
|
|
|
uint16_t rsvd;
|
1996-08-19 20:34:12 +00:00
|
|
|
/* seqptr's */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An announcement packet.
|
|
|
|
*/
|
|
|
|
struct pkt_id {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pi_mslot;
|
1996-08-19 20:34:12 +00:00
|
|
|
struct PageID pi_mpage; /* current page */
|
|
|
|
struct pgstate pi_ps;
|
|
|
|
/* seqptr's */
|
|
|
|
/* null-terminated site name */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pkt_preq {
|
|
|
|
struct PageID pp_page;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pp_low;
|
|
|
|
uint32_t pp_high;
|
1996-08-19 20:34:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pkt_prep {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pp_n; /* size of pageid array */
|
1996-08-19 20:34:12 +00:00
|
|
|
/* pgstate's follow */
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_id(netdissect_options *ndo,
|
|
|
|
const struct pkt_id *id, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
const char *cp;
|
|
|
|
const struct id_off *io;
|
|
|
|
char c;
|
|
|
|
int nid;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-id:"));
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*id) || !ND_TTEST(*id))
|
1996-08-19 20:34:12 +00:00
|
|
|
return (-1);
|
1998-09-15 19:36:32 +00:00
|
|
|
len -= sizeof(*id);
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " %u/%s:%u (max %u/%s:%u) ",
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&id->pi_ps.slot),
|
2015-01-06 19:03:11 +00:00
|
|
|
ipaddr_string(ndo, &id->pi_ps.page.p_sid),
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&id->pi_ps.page.p_uid),
|
|
|
|
EXTRACT_32BITS(&id->pi_mslot),
|
2015-01-06 19:03:11 +00:00
|
|
|
ipaddr_string(ndo, &id->pi_mpage.p_sid),
|
|
|
|
EXTRACT_32BITS(&id->pi_mpage.p_uid)));
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
nid = EXTRACT_16BITS(&id->pi_ps.nid);
|
1996-08-19 20:34:12 +00:00
|
|
|
len -= sizeof(*io) * nid;
|
|
|
|
io = (struct id_off *)(id + 1);
|
|
|
|
cp = (char *)(io + nid);
|
2015-07-06 02:16:08 +00:00
|
|
|
if (ND_TTEST2(cp, len)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\""));
|
|
|
|
fn_print(ndo, (u_char *)cp, (u_char *)cp + len);
|
|
|
|
ND_PRINT((ndo, "\""));
|
1996-08-19 20:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
c = '<';
|
2015-07-06 02:16:08 +00:00
|
|
|
for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%c%s:%u",
|
|
|
|
c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off)));
|
1996-08-19 20:34:12 +00:00
|
|
|
c = ',';
|
|
|
|
}
|
|
|
|
if (i >= nid) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ">"));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_rreq(netdissect_options *ndo,
|
|
|
|
const struct pkt_rreq *rreq, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-rreq:"));
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*rreq) || !ND_TTEST(*rreq))
|
1996-08-19 20:34:12 +00:00
|
|
|
return (-1);
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>",
|
|
|
|
ipaddr_string(ndo, &rreq->pr_id),
|
|
|
|
ipaddr_string(ndo, &rreq->pr_page.p_sid),
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&rreq->pr_page.p_uid),
|
|
|
|
EXTRACT_32BITS(&rreq->pr_sseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&rreq->pr_eseq)));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_preq(netdissect_options *ndo,
|
|
|
|
const struct pkt_preq *preq, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-preq:"));
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*preq) || !ND_TTEST(*preq))
|
1996-08-19 20:34:12 +00:00
|
|
|
return (-1);
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " need %u/%s:%u",
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&preq->pp_low),
|
2015-01-06 19:03:11 +00:00
|
|
|
ipaddr_string(ndo, &preq->pp_page.p_sid),
|
|
|
|
EXTRACT_32BITS(&preq->pp_page.p_uid)));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_prep(netdissect_options *ndo,
|
|
|
|
const struct pkt_prep *prep, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
|
|
|
int n;
|
1997-05-27 02:11:31 +00:00
|
|
|
const struct pgstate *ps;
|
2015-01-06 19:03:11 +00:00
|
|
|
const u_char *ep = ndo->ndo_snapend;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-prep:"));
|
1996-08-19 20:34:12 +00:00
|
|
|
if (len < sizeof(*prep)) {
|
|
|
|
return (-1);
|
|
|
|
}
|
2004-03-31 09:17:26 +00:00
|
|
|
n = EXTRACT_32BITS(&prep->pp_n);
|
1997-05-27 02:11:31 +00:00
|
|
|
ps = (const struct pgstate *)(prep + 1);
|
2015-07-06 02:16:08 +00:00
|
|
|
while (--n >= 0 && ND_TTEST(*ps)) {
|
1996-08-19 20:34:12 +00:00
|
|
|
const struct id_off *io, *ie;
|
|
|
|
char c = '<';
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " %u/%s:%u",
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&ps->slot),
|
2015-01-06 19:03:11 +00:00
|
|
|
ipaddr_string(ndo, &ps->page.p_sid),
|
|
|
|
EXTRACT_32BITS(&ps->page.p_uid)));
|
1997-05-27 02:11:31 +00:00
|
|
|
io = (struct id_off *)(ps + 1);
|
2015-07-06 02:16:08 +00:00
|
|
|
for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
|
|
|
|
EXTRACT_32BITS(&io->off)));
|
1996-08-19 20:34:12 +00:00
|
|
|
c = ',';
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ">"));
|
1997-05-27 02:11:31 +00:00
|
|
|
ps = (struct pgstate *)io;
|
1996-08-19 20:34:12 +00:00
|
|
|
}
|
1997-05-27 02:11:31 +00:00
|
|
|
return ((u_char *)ps <= ep? 0 : -1);
|
1996-08-19 20:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const char *dopstr[] = {
|
1996-08-19 20:34:12 +00:00
|
|
|
"dop-0!",
|
|
|
|
"dop-1!",
|
|
|
|
"RECT",
|
|
|
|
"LINE",
|
|
|
|
"ML",
|
|
|
|
"DEL",
|
|
|
|
"XFORM",
|
|
|
|
"ELL",
|
|
|
|
"CHAR",
|
|
|
|
"STR",
|
|
|
|
"NOP",
|
|
|
|
"PSCODE",
|
|
|
|
"PSCOMP",
|
|
|
|
"REF",
|
|
|
|
"SKIP",
|
|
|
|
"HOLE",
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2015-07-06 02:16:08 +00:00
|
|
|
wb_dops(netdissect_options *ndo, const struct pkt_dop *dop,
|
|
|
|
uint32_t ss, uint32_t es)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
2015-07-06 02:16:08 +00:00
|
|
|
const struct dophdr *dh = (const struct dophdr *)((const u_char *)dop + sizeof(*dop));
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " <"));
|
1996-08-19 20:34:12 +00:00
|
|
|
for ( ; ss <= es; ++ss) {
|
2015-07-06 02:16:08 +00:00
|
|
|
int t;
|
|
|
|
|
|
|
|
if (!ND_TTEST(*dh)) {
|
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
t = dh->dh_type;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
|
|
|
if (t > DT_MAXTYPE)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " dop-%d!", t));
|
1996-08-19 20:34:12 +00:00
|
|
|
else {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " %s", dopstr[t]));
|
1996-08-19 20:34:12 +00:00
|
|
|
if (t == DT_SKIP || t == DT_HOLE) {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t ts = EXTRACT_32BITS(&dh->dh_ts);
|
|
|
|
ND_PRINT((ndo, "%d", ts - ss + 1));
|
1996-08-19 20:34:12 +00:00
|
|
|
if (ss > ts || ts > es) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[|]"));
|
1996-08-19 20:34:12 +00:00
|
|
|
if (ts < ss)
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
ss = ts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dh = DOP_NEXT(dh);
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " >"));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_rrep(netdissect_options *ndo,
|
|
|
|
const struct pkt_rrep *rrep, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
|
|
|
const struct pkt_dop *dop = &rrep->pr_dop;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-rrep:"));
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*rrep) || !ND_TTEST(*rrep))
|
1996-08-19 20:34:12 +00:00
|
|
|
return (-1);
|
1998-09-15 19:36:32 +00:00
|
|
|
len -= sizeof(*rrep);
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " for %s %s:%u<%u:%u>",
|
|
|
|
ipaddr_string(ndo, &rrep->pr_id),
|
|
|
|
ipaddr_string(ndo, &dop->pd_page.p_sid),
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_page.p_uid),
|
|
|
|
EXTRACT_32BITS(&dop->pd_sseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_eseq)));
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag)
|
2015-07-06 02:16:08 +00:00
|
|
|
return (wb_dops(ndo, dop,
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_sseq),
|
|
|
|
EXTRACT_32BITS(&dop->pd_eseq)));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_drawop(netdissect_options *ndo,
|
|
|
|
const struct pkt_dop *dop, u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-dop:"));
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*dop) || !ND_TTEST(*dop))
|
1996-08-19 20:34:12 +00:00
|
|
|
return (-1);
|
1998-09-15 19:36:32 +00:00
|
|
|
len -= sizeof(*dop);
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " %s:%u<%u:%u>",
|
|
|
|
ipaddr_string(ndo, &dop->pd_page.p_sid),
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_page.p_uid),
|
|
|
|
EXTRACT_32BITS(&dop->pd_sseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_eseq)));
|
1996-08-19 20:34:12 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag)
|
2015-07-06 02:16:08 +00:00
|
|
|
return (wb_dops(ndo, dop,
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_32BITS(&dop->pd_sseq),
|
|
|
|
EXTRACT_32BITS(&dop->pd_eseq)));
|
1996-08-19 20:34:12 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print whiteboard multicast packets.
|
|
|
|
*/
|
|
|
|
void
|
2015-01-06 19:03:11 +00:00
|
|
|
wb_print(netdissect_options *ndo,
|
|
|
|
register const void *hdr, register u_int len)
|
1996-08-19 20:34:12 +00:00
|
|
|
{
|
1997-05-27 02:11:31 +00:00
|
|
|
register const struct pkt_hdr *ph;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1997-05-27 02:11:31 +00:00
|
|
|
ph = (const struct pkt_hdr *)hdr;
|
2015-07-06 02:16:08 +00:00
|
|
|
if (len < sizeof(*ph) || !ND_TTEST(*ph)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
}
|
1996-08-19 20:34:12 +00:00
|
|
|
len -= sizeof(*ph);
|
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
if (ph->ph_flags)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "*"));
|
1998-09-15 19:36:32 +00:00
|
|
|
switch (ph->ph_type) {
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_KILL:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-kill"));
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_ID:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_id(ndo, (struct pkt_id *)(ph + 1), len) >= 0)
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_RREQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_rreq(ndo, (struct pkt_rreq *)(ph + 1), len) >= 0)
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_RREP:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_rrep(ndo, (struct pkt_rrep *)(ph + 1), len) >= 0)
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_DRAWOP:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_drawop(ndo, (struct pkt_dop *)(ph + 1), len) >= 0)
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_PREQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_preq(ndo, (struct pkt_preq *)(ph + 1), len) >= 0)
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
|
|
|
break;
|
1996-08-19 20:34:12 +00:00
|
|
|
|
1998-09-15 19:36:32 +00:00
|
|
|
case PT_PREP:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (wb_prep(ndo, (struct pkt_prep *)(ph + 1), len) >= 0)
|
1996-08-19 20:34:12 +00:00
|
|
|
return;
|
1998-09-15 19:36:32 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " wb-%d!", ph->ph_type));
|
1998-09-15 19:36:32 +00:00
|
|
|
return;
|
1996-08-19 20:34:12 +00:00
|
|
|
}
|
|
|
|
}
|