wireshark-1.8.0-emulab.patch 60.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
diff -rNu epan/dissectors/Makefile.common epan/dissectors/Makefile.common
--- epan/dissectors/Makefile.common	2012-06-05 10:33:38.000000000 -0600
+++ epan/dissectors/Makefile.common	2012-07-05 17:02:00.000000000 -0600
@@ -534,6 +534,7 @@
 	packet-fr.c		\
 	packet-fractalgeneratorprotocol.c \
 	packet-frame.c		\
+	packet-frisbee.c	\
 	packet-ftp.c		\
 	packet-fw1.c		\
 	packet-g723.c		\
@@ -886,6 +887,7 @@
 	packet-pptp.c		\
 	packet-prp.c		\
 	packet-ptp.c		\
+	packet-pubsub.c		\
 	packet-pvfs2.c		\
 	packet-pw-atm.c		\
 	packet-pw-cesopsn.c	\
diff -rNu epan/dissectors/Makefile.in epan/dissectors/Makefile.in
--- epan/dissectors/Makefile.in	2012-06-21 12:21:39.000000000 -0600
+++ epan/dissectors/Makefile.in	2012-07-05 17:04:03.789219737 -0600
@@ -420,6 +420,7 @@
 	libdissectors_la-packet-fr.lo \
 	libdissectors_la-packet-fractalgeneratorprotocol.lo \
 	libdissectors_la-packet-frame.lo \
+	libdissectors_la-packet-frisbee.lo \
 	libdissectors_la-packet-ftp.lo libdissectors_la-packet-fw1.lo \
 	libdissectors_la-packet-g723.lo \
 	libdissectors_la-packet-gadu-gadu.lo \
@@ -747,6 +748,7 @@
 	libdissectors_la-packet-pppoe.lo \
 	libdissectors_la-packet-pptp.lo libdissectors_la-packet-prp.lo \
 	libdissectors_la-packet-ptp.lo \
+	libdissectors_la-packet-pubsub.lo \
 	libdissectors_la-packet-pvfs2.lo \
 	libdissectors_la-packet-pw-atm.lo \
 	libdissectors_la-packet-pw-cesopsn.lo \
@@ -1902,6 +1904,7 @@
 	packet-fr.c		\
 	packet-fractalgeneratorprotocol.c \
 	packet-frame.c		\
+	packet-frisbee.c	\
 	packet-ftp.c		\
 	packet-fw1.c		\
 	packet-g723.c		\
@@ -2254,6 +2257,7 @@
 	packet-pptp.c		\
 	packet-prp.c		\
 	packet-ptp.c		\
+	packet-pubsub.c		\
 	packet-pvfs2.c		\
 	packet-pw-atm.c		\
 	packet-pw-cesopsn.c	\
@@ -2642,6 +2646,7 @@
 	packet-fmp.h	\
 	packet-fr.h	\
 	packet-frame.h	\
+	packet-frisbee.h	\
 	packet-ftam.h	\
 	packet-giop.h	\
 	packet-gluster.h	\
@@ -2768,6 +2773,7 @@
 	packet-ppi-geolocation-common.h		\
 	packet-ppp.h	\
 	packet-pres.h	\
+	packet-pubsub.h	\
 	packet-pw-atm.h		\
 	packet-pw-common.h	\
 	packet-q708.h	\
@@ -3407,6 +3413,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-fr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-fractalgeneratorprotocol.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-frame.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-frisbee.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-ftam.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-ftp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-fw1.Plo@am__quote@
@@ -3807,6 +3814,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-pptp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-prp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-ptp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-pubsub.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-pvfs2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-pw-atm.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdissectors_la-packet-pw-cesopsn.Plo@am__quote@
@@ -6432,6 +6440,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -c -o libdissectors_la-packet-frame.lo `test -f 'packet-frame.c' || echo '$(srcdir)/'`packet-frame.c
 
+libdissectors_la-packet-frisbee.lo: packet-frisbee.c
+@am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -MT libdissectors_la-packet-frisbee.lo -MD -MP -MF "$(DEPDIR)/libdissectors_la-packet-frisbee.Tpo" -c -o libdissectors_la-packet-frisbee.lo `test -f 'packet-frisbee.c' || echo '$(srcdir)/'`packet-frisbee.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libdissectors_la-packet-frisbee.Tpo" "$(DEPDIR)/libdissectors_la-packet-frisbee.Plo"; else rm -f "$(DEPDIR)/libdissectors_la-packet-frisbee.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='packet-frisbee.c' object='libdissectors_la-packet-frisbee.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -c -o libdissectors_la-packet-frisbee.lo `test -f 'packet-frisbee.c' || echo '$(srcdir)/'`packet-frisbee.c
+
 libdissectors_la-packet-ftp.lo: packet-ftp.c
 @am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -MT libdissectors_la-packet-ftp.lo -MD -MP -MF "$(DEPDIR)/libdissectors_la-packet-ftp.Tpo" -c -o libdissectors_la-packet-ftp.lo `test -f 'packet-ftp.c' || echo '$(srcdir)/'`packet-ftp.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libdissectors_la-packet-ftp.Tpo" "$(DEPDIR)/libdissectors_la-packet-ftp.Plo"; else rm -f "$(DEPDIR)/libdissectors_la-packet-ftp.Tpo"; exit 1; fi
@@ -8896,6 +8911,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -c -o libdissectors_la-packet-ptp.lo `test -f 'packet-ptp.c' || echo '$(srcdir)/'`packet-ptp.c
 
+libdissectors_la-packet-pubsub.lo: packet-pubsub.c
+@am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -MT libdissectors_la-packet-pubsub.lo -MD -MP -MF "$(DEPDIR)/libdissectors_la-packet-pubsub.Tpo" -c -o libdissectors_la-packet-pubsub.lo `test -f 'packet-pubsub.c' || echo '$(srcdir)/'`packet-pubsub.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libdissectors_la-packet-pubsub.Tpo" "$(DEPDIR)/libdissectors_la-packet-pubsub.Plo"; else rm -f "$(DEPDIR)/libdissectors_la-packet-pubsub.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='packet-pubsub.c' object='libdissectors_la-packet-pubsub.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -c -o libdissectors_la-packet-pubsub.lo `test -f 'packet-pubsub.c' || echo '$(srcdir)/'`packet-pubsub.c
+
 libdissectors_la-packet-pvfs2.lo: packet-pvfs2.c
 @am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdissectors_la_CFLAGS) $(CFLAGS) -MT libdissectors_la-packet-pvfs2.lo -MD -MP -MF "$(DEPDIR)/libdissectors_la-packet-pvfs2.Tpo" -c -o libdissectors_la-packet-pvfs2.lo `test -f 'packet-pvfs2.c' || echo '$(srcdir)/'`packet-pvfs2.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libdissectors_la-packet-pvfs2.Tpo" "$(DEPDIR)/libdissectors_la-packet-pvfs2.Plo"; else rm -f "$(DEPDIR)/libdissectors_la-packet-pvfs2.Tpo"; exit 1; fi
diff -rNu epan/dissectors/packet-frisbee.c epan/dissectors/packet-frisbee.c
--- epan/dissectors/packet-frisbee.c	1969-12-31 17:00:00.000000000 -0700
+++ epan/dissectors/packet-frisbee.c	2012-07-06 17:05:37.000000000 -0600
@@ -0,0 +1,590 @@
+/* packet-frisbee.c
+ * Routines for Utah Emulab frisbee protocol.
+ * Mike Hibler
+ *
+ * TODO:
+ * - Add dissection of master server messages
+ * - Add conversations for tracking frisbee sessions
+ *   (assuming they can track many-to-one relationships)
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/prefs.h>
+
+#include "packet-frisbee.h"
+
+static int proto_frisbee = -1;
+static int hf_frisbee_msg = -1;
+static int hf_frisbee_type = -1;
+static int hf_frisbee_subtype = -1;
+static int hf_frisbee_datalen = -1;
+static int hf_frisbee_srcip = -1;
+static int hf_frisbee_join_id = -1;
+static int hf_frisbee_join_bcount = -1;
+static int hf_frisbee_leave_id = -1;
+static int hf_frisbee_leave_elapsed = -1;
+static int hf_frisbee_req_chunk = -1;
+static int hf_frisbee_req_block = -1;
+static int hf_frisbee_req_count = -1;
+static int hf_frisbee_preq_chunk = -1;
+static int hf_frisbee_preq_retries = -1;
+static int hf_frisbee_blk_chunk = -1;
+static int hf_frisbee_blk_block = -1;
+static int hf_frisbee_blk_data = -1;
+static int hf_frisbee_join2_id = -1;
+static int hf_frisbee_join2_bcount = -1;
+static int hf_frisbee_join2_csize = -1;
+static int hf_frisbee_join2_bsize = -1;
+static int hf_frisbee_join2_bycount = -1;
+static int hf_frisbee_leave2_id = -1;
+static int hf_frisbee_leave2_elapsed = -1;
+static int hf_frisbee_leave2_stats = -1;
+
+static gint ett_frisbee = -1;
+static gint ett_frisbee_msg = -1;
+
+static const value_string frisbee_type_vals[] = {
+    { PKTTYPE_REQUEST,         "Request" },
+    { PKTTYPE_REPLY,           "Reply" },
+    { 0, NULL }
+};
+
+static const value_string frisbee_subtype_vals[] = {
+    { PKTSUBTYPE_JOIN,     "JOIN" },
+    { PKTSUBTYPE_LEAVE,    "LEAVE" },
+    { PKTSUBTYPE_BLOCK,    "BLOCK" },
+    { PKTSUBTYPE_REQUEST,  "REQUEST" },
+    { PKTSUBTYPE_LEAVE2,   "LEAVE2" },
+    { PKTSUBTYPE_PREQUEST, "PREQUEST" },
+    { PKTSUBTYPE_JOIN2,    "JOIN2" },
+    { 0, NULL }
+};
+
+/*
+ * Parse a frisbee blockmap and create a string of block numbers.
+ * Returns number of blocks in map.
+ */
+int
+parse_blockmap(BlockMap_t *blockmap, emem_strbuf_t *buf)
+{
+    int block, count, mask;
+    unsigned int i;
+    int bit, val;
+    int did = 0;
+
+    block = count = 0;
+    for (i = 0; i < sizeof(blockmap->map); i++) {
+        val = blockmap->map[i];
+        for (bit = 0; bit < CHAR_BIT; bit++) {
+            mask = 1 << bit;
+            if ((val & mask) != 0) {
+                val &= ~mask;
+                if (count == 0)
+                    block = (i * CHAR_BIT) + bit;
+                count++;
+            } else {
+                if (count > 0) {
+                    if (did > 0)
+                        ep_strbuf_append(buf, ",");
+                    if (count > 1)
+                        ep_strbuf_append_printf(buf, "%d-%d",
+                                                block, block+count-1);
+                    else
+                        ep_strbuf_append_printf(buf, "%d", block);
+                    did += count;
+                    count = 0;
+                }
+                if (val == 0)
+                    break;
+            }
+        }
+    }
+    if (count > 0) {
+        if (did > 0)
+            ep_strbuf_append(buf, ",");
+        if (count > 1)
+            ep_strbuf_append_printf(buf, "%d-%d",
+                                    block, block+count-1);
+        else
+            ep_strbuf_append_printf(buf, "%d", block);
+        did += count;
+    }
+
+    return did;
+}
+
+/*
+ * Grievous oversight: all values are in little-endian on the wire!
+ */
+static int
+dissect_frisbee(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    proto_item	*ti = NULL;
+    proto_tree	*frisbee_tree = NULL;
+    proto_tree	*msg_tree = NULL;
+    int		offset = 0, count;
+    guint	len;
+    Packet_t	tmp;
+    emem_strbuf_t *buf;
+
+    /* Quick sanity check */
+    if (tvb_length(tvb) < sizeof(tmp.hdr))
+        return 0;
+
+    /* Read the header and do some more sanity */
+    tmp.hdr.type = tvb_get_letohl(tvb, 0);
+    tmp.hdr.subtype = tvb_get_letohl(tvb, 4);
+    tmp.hdr.datalen = tvb_get_letohl(tvb, 8);
+    tmp.hdr.srcip = tvb_get_letohl(tvb, 12);
+    if (!(tmp.hdr.type == PKTTYPE_REQUEST || tmp.hdr.type == PKTTYPE_REPLY) ||
+        tmp.hdr.subtype > PKTSUBTYPE_MAX ||
+        (guint32)(sizeof(tmp.hdr) + tmp.hdr.datalen) > sizeof(tmp))
+        return 0;
+
+    /* Summary information */
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Frisbee");
+    col_clear(pinfo->cinfo, COL_INFO);
+    /* XXX only JOINs have request/reply, all others are just request */
+    if (tmp.hdr.subtype == PKTSUBTYPE_JOIN)
+        col_add_fstr(pinfo->cinfo, COL_INFO, "%s (%s)",
+                     val_to_str(tmp.hdr.subtype, frisbee_subtype_vals, "??"),
+                     val_to_str(tmp.hdr.type, frisbee_type_vals, "??"));
+    else
+        col_add_str(pinfo->cinfo, COL_INFO,
+                    val_to_str(tmp.hdr.subtype, frisbee_subtype_vals, "??"));
+
+    /* Create the protocol tree and put in the common header info */
+    if (tree) {
+        ti = proto_tree_add_item(tree, proto_frisbee, tvb,
+                                 0, -1, ENC_ASCII|ENC_NA);
+        frisbee_tree = proto_item_add_subtree(ti, ett_frisbee);
+
+        proto_tree_add_uint(frisbee_tree, hf_frisbee_type, tvb,
+                            offset, 4, tmp.hdr.type);
+        offset += 4;
+        proto_tree_add_uint(frisbee_tree, hf_frisbee_subtype, tvb,
+                            offset, 4, tmp.hdr.subtype);
+        offset += 4;
+        proto_tree_add_uint(frisbee_tree, hf_frisbee_datalen, tvb,
+                            offset, 4, tmp.hdr.datalen);
+        offset += 4;
+        proto_tree_add_ipv4(frisbee_tree, hf_frisbee_srcip, tvb,
+                            offset, 4, tmp.hdr.srcip);
+        offset += 4;
+    }
+
+    /* Create a subtree for the particular message type */
+    if (tree) {
+        proto_item *mti = NULL;
+
+        mti = proto_tree_add_item(tree, hf_frisbee_msg, tvb,
+                                  offset, tmp.hdr.datalen, ENC_NA);
+        msg_tree = proto_item_add_subtree(mti, ett_frisbee_msg);
+    }
+
+    switch (tmp.hdr.subtype) {
+    case PKTSUBTYPE_JOIN:
+        if (tmp.hdr.type == PKTTYPE_REQUEST) {
+            tmp.msg.join.clientid = tvb_get_letohl(tvb, offset);
+            col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%d ",
+                            tmp.msg.join.clientid);
+            if (tree) {
+                proto_tree_add_uint(msg_tree, hf_frisbee_join_id, tvb,
+                                    offset, 4, tmp.msg.join.clientid);
+            }
+        } else {
+            tmp.msg.join.blockcount = tvb_get_letohl(tvb, offset);
+            col_append_fstr(pinfo->cinfo, COL_INFO, " blockcount=%d",
+                            tmp.msg.join.blockcount);
+            if (tree) {
+                proto_tree_add_uint(msg_tree, hf_frisbee_join_bcount, tvb,
+                                    offset, 4, tmp.msg.join.blockcount);
+            }
+        }
+        offset += 4;
+        break;
+
+    case PKTSUBTYPE_LEAVE:
+        tmp.msg.leave.clientid = tvb_get_letohl(tvb, offset);
+        col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%d ",
+                        tmp.msg.leave.clientid);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_leave_id, tvb,
+                                offset, 4, tmp.msg.leave.clientid);
+        }
+        offset += 4;
+        tmp.msg.leave.elapsed = tvb_get_letohl(tvb, offset);
+        col_append_fstr(pinfo->cinfo, COL_INFO, ", elapsed=%d",
+                        tmp.msg.leave.elapsed);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_leave_elapsed, tvb,
+                                offset, 4, tmp.msg.leave.elapsed);
+        }
+        offset += 4;
+        break;
+
+    case PKTSUBTYPE_REQUEST:
+        tmp.msg.request.chunk = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_req_chunk, tvb,
+                                offset, 4, tmp.msg.request.chunk);
+        }
+        offset += 4;
+
+        tmp.msg.request.block = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_req_block, tvb,
+                                offset, 4, tmp.msg.request.block);
+        }
+        offset += 4;
+
+        tmp.msg.request.count = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_req_count, tvb,
+                                offset, 4, tmp.msg.request.count);
+        }
+        offset += 4;
+
+        col_append_fstr(pinfo->cinfo, COL_INFO, " chunk %d[%d-%d]",
+                        tmp.msg.request.chunk, tmp.msg.request.block,
+                        tmp.msg.request.block+tmp.msg.request.count);
+        break;
+
+    case PKTSUBTYPE_PREQUEST:
+        tmp.msg.prequest.chunk = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_preq_chunk, tvb,
+                                offset, 4, tmp.msg.prequest.chunk);
+        }
+        offset += 4;
+
+        tmp.msg.prequest.retries = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_preq_retries, tvb,
+                                offset, 4, tmp.msg.prequest.retries);
+        }
+        offset += 4;
+
+        col_append_fstr(pinfo->cinfo, COL_INFO, " chunk %d (%d retries)",
+                        tmp.msg.prequest.chunk, tmp.msg.prequest.retries);
+
+        memset(&tmp.msg.prequest.blockmap, 0, sizeof(BlockMap_t));
+        len = tvb_length_remaining(tvb, offset);
+        if (len > sizeof(BlockMap_t))
+            len = sizeof(BlockMap_t);
+        tvb_memcpy(tvb, &tmp.msg.prequest.blockmap, offset, len);
+        buf = ep_strbuf_new_label(NULL);
+        count = parse_blockmap(&tmp.msg.prequest.blockmap, buf);
+        if (count > 0) {
+            if (tree) {
+                if (len < sizeof(BlockMap_t))
+                    proto_tree_add_text(msg_tree, tvb, offset, len,
+                                        "blocks (Truncated after %d of %d blocks): %d [%s]",
+                                        len*CHAR_BIT, sizeof(BlockMap_t)*CHAR_BIT,
+                                        count, buf->str);
+
+                else
+                    proto_tree_add_text(msg_tree, tvb, offset, len,
+                                        "blocks: %d [%s]", count, buf->str);
+            }
+            offset += len;
+            col_append_fstr(pinfo->cinfo, COL_INFO, ", %d blocks", count);
+            if (len < sizeof(BlockMap_t))
+                col_append_fstr(pinfo->cinfo, COL_INFO, " (Truncated)");
+        }
+        break;
+
+    case PKTSUBTYPE_BLOCK:
+        tmp.msg.request.chunk = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_blk_chunk, tvb,
+                                offset, 4, tmp.msg.block.chunk);
+        }
+        offset += 4;
+
+        tmp.msg.request.block = tvb_get_letohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_blk_block, tvb,
+                                offset, 4, tmp.msg.block.block);
+        }
+        offset += 4;
+
+        len = tvb_length_remaining(tvb, offset);
+        if (len > sizeof(tmp.msg.block.buf))
+            len = sizeof(tmp.msg.block.buf);
+        if (tree) {
+            proto_tree_add_item(msg_tree, hf_frisbee_blk_data, tvb,
+                                offset, len, ENC_LITTLE_ENDIAN|ENC_NA);
+        }
+        offset += len;
+
+        col_append_fstr(pinfo->cinfo, COL_INFO, " chunk %d[%d]",
+                        tmp.msg.block.chunk, tmp.msg.block.block);
+        if (len < sizeof(tmp.msg.block.buf))
+            col_append_fstr(pinfo->cinfo, COL_INFO, " (Truncated)");
+        break;
+
+    case PKTSUBTYPE_JOIN2:
+        tmp.msg.join2.clientid = tvb_get_letohl(tvb, offset);
+        tmp.msg.join2.blockcount = tvb_get_letohl(tvb, offset+4);
+        tmp.msg.join2.chunksize = tvb_get_letohl(tvb, offset+8);
+        tmp.msg.join2.blocksize = tvb_get_letohl(tvb, offset+12);
+        tmp.msg.join2.bytecount = tvb_get_letoh64(tvb, offset+16);
+        if (tmp.hdr.type == PKTTYPE_REQUEST) {
+            col_append_fstr(pinfo->cinfo, COL_INFO,
+                            " ID=%d chunksize=%d blocksize=%d",
+                            tmp.msg.join2.clientid,
+                            tmp.msg.join2.chunksize, tmp.msg.join2.blocksize);
+        } else {
+            col_append_fstr(pinfo->cinfo, COL_INFO,
+                            " chunksize=%d blocksize=%d bytecount=%" G_GINT64_MODIFIER "u",
+                            tmp.msg.join2.chunksize, tmp.msg.join2.blocksize,
+                            tmp.msg.join2.bytecount);
+        }
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_join2_id, tvb,
+                                offset, 4, tmp.msg.join2.clientid);
+            offset += 4;
+            proto_tree_add_uint(msg_tree, hf_frisbee_join2_bcount, tvb,
+                                offset, 4, tmp.msg.join2.blockcount);
+            offset += 4;
+            proto_tree_add_uint(msg_tree, hf_frisbee_join2_csize, tvb,
+                                offset, 4, tmp.msg.join2.chunksize);
+            offset += 4;
+            proto_tree_add_uint(msg_tree, hf_frisbee_join2_bsize, tvb,
+                                offset, 4, tmp.msg.join2.blocksize);
+            offset += 4;
+            proto_tree_add_uint64(msg_tree, hf_frisbee_join2_bycount, tvb,
+                                  offset, 8, tmp.msg.join2.bytecount);
+            offset += 8;
+        }
+        break;
+
+    case PKTSUBTYPE_LEAVE2:
+        tmp.msg.leave2.clientid = tvb_get_letohl(tvb, offset);
+        col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%d ",
+                        tmp.msg.leave2.clientid);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_leave2_id, tvb,
+                                offset, 4, tmp.msg.leave2.clientid);
+        }
+        offset += 4;
+        tmp.msg.leave2.elapsed = tvb_get_letohl(tvb, offset);
+        col_append_fstr(pinfo->cinfo, COL_INFO, ", elapsed=%d",
+                        tmp.msg.leave2.elapsed);
+        if (tree) {
+            proto_tree_add_uint(msg_tree, hf_frisbee_leave2_elapsed, tvb,
+                                offset, 4, tmp.msg.leave2.elapsed);
+        }
+        offset += 4;
+        len = tvb_length_remaining(tvb, offset);
+        if (len > sizeof(tmp.msg.leave2.stats))
+            len = sizeof(tmp.msg.leave2.stats);
+        if (tree) {
+            proto_tree_add_item(msg_tree, hf_frisbee_leave2_stats, tvb,
+                                offset, len, ENC_LITTLE_ENDIAN|ENC_NA);
+        }
+        offset += len;
+        break;
+
+    default:
+        break;
+    }
+
+    return tvb_length(tvb);
+}
+
+/*
+ * NOTE: the extra "_" in the name is just to get us registered before e100
+ * since their heuristic dissector will accidentally pick up some frisbee
+ * packets. There has got to be a better way to do this!
+ */
+void
+proto_register__frisbee(void)
+{
+    static hf_register_info hf[] = {
+        { &hf_frisbee_type,
+          { "Type",	"frisbee.type",
+            FT_UINT32, BASE_DEC, VALS(frisbee_type_vals), 0x0,
+            "Frisbee message type", HFILL }},
+
+        { &hf_frisbee_subtype,
+          { "Subtype",	"frisbee.subtype",
+            FT_UINT32, BASE_DEC, VALS(frisbee_subtype_vals), 0x0,
+            "Frisbee message subtype", HFILL }},
+
+        { &hf_frisbee_datalen,
+          { "Datalen",	"frisbee.datalen",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "Frisbee message payload length", HFILL }},
+
+        { &hf_frisbee_srcip,
+          { "SrcIP",	"frisbee.srcip",
+            FT_IPv4, BASE_NONE, NULL, 0x0,
+            "Frisbee source IP", HFILL }},
+
+        { &hf_frisbee_msg,
+          { "Frisbee message", "frisbee.msg",
+            FT_NONE, BASE_NONE, NULL, 0x0,
+            "Frisbee message", HFILL }},
+
+        { &hf_frisbee_join_id,
+          { "client ID",	"frisbee.join.clientid",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN clientid", HFILL }},
+        { &hf_frisbee_join_bcount,
+          { "block count",	"frisbee.join.blockcount",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN blockcount", HFILL }},
+
+        { &hf_frisbee_leave_id,
+          { "client ID",	"frisbee.leave.clientid",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "LEAVE clientid", HFILL }},
+        { &hf_frisbee_leave_elapsed,
+          { "elapsed time",	"frisbee.leave.elapsed",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "LEAVE elapsed", HFILL }},
+
+        { &hf_frisbee_req_chunk,
+          { "chunk",	"frisbee.request.chunk",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "REQUEST chunk #", HFILL }},
+        { &hf_frisbee_req_block,
+          { "block",	"frisbee.request.block",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "REQUEST block #", HFILL }},
+        { &hf_frisbee_req_count,
+          { "count",	"frisbee.request.count",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "REQUEST block count", HFILL }},
+
+        { &hf_frisbee_preq_chunk,
+          { "chunk",	"frisbee.prequest.chunk",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PREQUEST chunk #", HFILL }},
+        { &hf_frisbee_preq_retries,
+          { "retries",	"frisbee.prequest.retries",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "REQUEST retries", HFILL }},
+
+        { &hf_frisbee_blk_chunk,
+          { "chunk",	"frisbee.block.chunk",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "BLOCK chunk #", HFILL }},
+        { &hf_frisbee_blk_block,
+          { "block",	"frisbee.block.block",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "BLOCK block #", HFILL }},
+        { &hf_frisbee_blk_data,
+          { "data",	"frisbee.block.data",
+            FT_BYTES, BASE_NONE, NULL, 0x0,
+            "BLOCK data", HFILL }},
+
+        { &hf_frisbee_join2_id,
+          { "client ID",	"frisbee.join2.clientid",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN2 clientid", HFILL }},
+        { &hf_frisbee_join2_bcount,
+          { "block count",	"frisbee.join2.blockcount",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN2 blockcount", HFILL }},
+        { &hf_frisbee_join2_csize,
+          { "chunk size",	"frisbee.join2.chunksize",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN2 chunksize", HFILL }},
+        { &hf_frisbee_join2_bsize,
+          { "block size",	"frisbee.join2.blocksize",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "JOIN2 blocksize", HFILL }},
+        { &hf_frisbee_join2_bycount,
+          { "byte count",	"frisbee.join2.bytecount",
+            FT_UINT64, BASE_DEC, NULL, 0x0,
+            "JOIN2 bytecount", HFILL }},
+
+        { &hf_frisbee_leave2_id,
+          { "client ID",	"frisbee.leave2.clientid",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "LEAVE2 clientid", HFILL }},
+        { &hf_frisbee_leave2_elapsed,
+          { "elapsed time",	"frisbee.leave2.elapsed",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "LEAVE2 elapsed", HFILL }},
+        { &hf_frisbee_leave2_stats,
+          { "stats data",	"frisbee.leave2.stats",
+            FT_BYTES, BASE_NONE, NULL, 0x0,
+            "LEAVE2 stats data", HFILL }},
+	};
+
+	static gint *ett[] = {
+		&ett_frisbee,
+                &ett_frisbee_msg,
+	};
+
+	proto_frisbee = proto_register_protocol("Frisbee Image Distribution Protocol", "Frisbee", "frisbee");
+	proto_register_field_array(proto_frisbee, hf, array_length(hf));
+	proto_register_subtree_array(ett, array_length(ett));
+}
+
+static gboolean
+dissect_frisbee_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+	if (dissect_frisbee(tvb, pinfo, tree) == 0)
+		return FALSE;
+
+	return TRUE;
+}
+
+/*
+ * NOTE: the extra "_" in the name is just to get us registered before e100
+ * since their heuristic dissector will accidentally pick up some frisbee
+ * packets. There has got to be a better way to do this!
+ */
+void
+proto_reg_handoff__frisbee(void)
+{
+	dissector_handle_t frisbee_handle;
+
+	frisbee_handle = new_create_dissector_handle(dissect_frisbee,
+                                                     proto_frisbee);
+	heur_dissector_add("udp", dissect_frisbee_heur, proto_frisbee);
+}
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff -rNu epan/dissectors/packet-frisbee.h epan/dissectors/packet-frisbee.h
--- epan/dissectors/packet-frisbee.h	1969-12-31 17:00:00.000000000 -0700
+++ epan/dissectors/packet-frisbee.h	2012-07-05 12:11:44.000000000 -0600
@@ -0,0 +1,423 @@
+/*
+ * From clientside/os/frisbee.redux/decls.h
+ */
+
+/*
+ * Copyright (c) 2000-2011 University of Utah and the Flux Group.
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737
+ * 
+ * {{{EMULAB-LICENSE
+ * 
+ * This file is part of the Emulab network testbed software.
+ * 
+ * This file is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ * 
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
+ * License for more details.
+ * 
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this file.  If not, see <http://www.gnu.org/licenses/>.
+ * 
+ * }}}
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699
+ */
+
+/*
+ * Shared for defintions for frisbee client/server code.
+ */
+
+#include <inttypes.h>
+#include <limits.h>	/* CHAR_BIT */
+
+/*
+ * Ethernet MTU (1514 or 9000) - eth header (14) - min UDP/IP (28) - BLOCK msg
+ * header (24).
+ */
+#ifdef JUMBO
+#define MAXPACKETDATA	8934
+#else
+#define MAXPACKETDATA	1448
+#endif
+
+/*
+ * Images are broken into chunks which are the standalone unit of decompression
+ * Chunks are broken into blocks which are the unit of transmission
+ */
+#ifdef JUMBO
+#define MAXCHUNKSIZE	128
+#define MAXBLOCKSIZE	8192
+#else
+#define MAXCHUNKSIZE	1024
+#define MAXBLOCKSIZE	1024
+#endif
+
+/*
+ * Make sure we can fit a block in a single ethernet MTU.
+ */
+#if MAXBLOCKSIZE > MAXPACKETDATA
+#error "Invalid block size"
+#endif
+
+/*
+ * Make sure we can represent a bitmap of blocks in a single packet.
+ * This limits the maximum number of blocks in a chunk to 1448*8 == 11584.
+ * With the maximum block size of 1448, this limits a chunk to no more
+ * than 16,773,632 bytes (just under 16MB).
+ */
+#if (MAXCHUNKSIZE%CHAR_BIT) != 0 || (MAXCHUNKSIZE/CHAR_BIT) > MAXPACKETDATA
+#error "Invalid chunk size"
+#endif
+
+/*
+ * Chunk buffers and output write buffers constitute most of the memory
+ * used in the system.  These should be sized to fit in the physical memory
+ * of the client (forcing pieces of frisbee to be paged out to disk, even
+ * if there is a swap disk to use, is not a very efficient way to load disks!)
+ *
+ * MAXCHUNKBUFS is the number of MAXBLOCKSIZE*MAXCHUNKSIZE chunk buffers used
+ * to receive data from the network.  With the default values, these are 1MB
+ * each.
+ *
+ * MAXWRITEBUFMEM is the amount, in MB, of write buffer memory in the client.
+ * This is the amount of queued write data that can be pending.  A value of
+ * zero means unlimited.
+ *
+ * The ratio of the number of these two buffer types depends on the ratio
+ * of network to disk speed and the degree of compression in the image.
+ */
+#define MAXCHUNKBUFS	64	/* 64MB with default chunk size */
+#define MAXWRITEBUFMEM	64	/* in MB */
+
+/*
+ * Socket buffer size, used for both send and receive in client and
+ * server right now.  If DYN_SOCKBUFSIZE is set, we find the larger
+ * socketbuffer size possible that is less than or equal to SOCKBUFSIZE.
+ */
+#define SOCKBUFSIZE	(512 * 1024)
+#define DYN_SOCKBUFSIZE	1
+
+/*
+ * The number of read-ahead chunks that the client will request
+ * at a time. No point in requesting too far ahead either, since they
+ * are uncompressed/written at a fraction of the network transfer speed.
+ * Also, with multiple clients at different stages, each requesting blocks,
+ * it is likely that there will be plenty more chunks ready or in progress.
+ */
+#define MAXREADAHEAD	2
+#define MAXINPROGRESS	8
+
+/*
+ * Timeout (in usecs) for packet receive. The idletimer number is how
+ * many PKT timeouts we allow before requesting more data from the server.
+ * That is, if we go TIMEOUT usecs without getting a packet, then ask for
+ * more.
+ */
+#define PKTRCV_TIMEOUT		30000
+#define CLIENT_IDLETIMER_COUNT	3
+#define TIMEOUT_HZ		(1000000 / PKTRCV_TIMEOUT)
+#define TIMEOUT_HALFHZ		(TIMEOUT_HZ / 2)
+
+/*
+ * Timeout (in seconds!) server will hang around with no active clients.
+ * Make it zero to never exit. 
+ */
+#define SERVER_INACTIVE_SECONDS	(60 * 30)
+
+/*
+ * The number of disk read blocks in a single read on the server.
+ * Must be an integer divisor of MAXCHUNKSIZE.
+ */
+#define SERVER_READ_SIZE	32
+
+/*
+ * Parameters for server network usage:
+ *
+ *	SERVER_BURST_SIZE	Max MAXBLOCKSIZE packets sent in a burst.
+ *				Should be a multiple of SERVER_READ_SIZE
+ *				Should be less than SOCKBUFSIZE/MAXBLOCKSIZE,
+ *				bursts of greater than the send socket
+ *				buffer size are almost certain to cause
+ *				lost packets.
+ *	SERVER_BURST_GAP	Delay in usec between output bursts.
+ *				Given the typical scheduling granularity
+ *				of 10ms for most unix systems, this
+ *				will likely be set to either 0 or 10000.
+ *				On FreeBSD we set the clock to 1ms
+ *				granularity.
+ *
+ * Together with the MAXBLOCKSIZE, these two params form a theoretical upper
+ * bound on bandwidth consumption for the server.  That upper bound (for
+ * ethernet) is:
+ *
+ *	(1000000 / SERVER_BURST_GAP)		   # bursts per second
+ *	* (MAXBLOCKSIZE+24+42) * SERVER_BURST_SIZE # * wire size of a burst
+ *
+ * which for the default 1k packets, gap of 1ms and burst of 16 packets
+ * is about 17.4MB/sec.  That is beyond the capacity of a 100Mb ethernet
+ * but with a 1ms granularity clock, the average gap size is going to be
+ * 1.5ms yielding 11.6MB/sec.  In practice, the server is ultimately
+ * throttled by clients' ability to generate requests which is limited by
+ * their ability to decompress and write to disk.
+ */
+#define SERVER_BURST_SIZE	16
+#define SERVER_BURST_GAP	2000
+
+/*
+ * Max burst size when doing dynamic bandwidth adjustment.
+ * Needs to be large enough to induce loss.
+ */ 
+#define SERVER_DYNBURST_SIZE	128
+
+/*
+ * How long (in usecs) to wait before re-reqesting a chunk.
+ * It will take the server more than:
+ *
+ *	(MAXCHUNKSIZE/SERVER_BURST_SIZE) * SERVER_BURST_GAP
+ *
+ * usec (0.13 sec with defaults) for each each chunk it pumps out,
+ * and we conservatively assume that there are a fair number of other
+ * chunks that must be processed before it gets to our chunk.
+ *
+ * XXX don't like making the client rely on compiled in server constants,
+ * lets just set it to 1 second right now.
+ */
+#define CLIENT_REQUEST_REDO_DELAY	1000000
+
+/*
+ * How long for the writer to sleep if there are no blocks currently
+ * ready to write.  Allow a full server burst period, assuming that
+ * something in the next burst will complete a block.
+ */
+#define CLIENT_WRITER_IDLE_DELAY	1000
+
+/*
+ * Client parameters and statistics.
+ */
+#define CLIENT_STATS_VERSION	1
+typedef struct {
+	int32_t	version;
+	union {
+		struct {
+			int32_t	 runsec;
+			int32_t	 runmsec;
+			int32_t	 delayms;
+			uint64_t rbyteswritten;
+			uint64_t ebyteswritten;
+			int32_t	 chunkbufs;
+			int32_t	 maxreadahead;
+			int32_t	 maxinprogress;
+			int32_t	 pkttimeout;
+			int32_t	 startdelay;
+			int32_t	 idletimer;
+			int32_t	 idledelay;
+			int32_t	 redodelay;
+			int32_t	 randomize;
+			uint32_t nochunksready;
+			uint32_t nofreechunks;
+			uint32_t dupchunk;
+			uint32_t dupblock;
+			uint32_t prequests;
+			uint32_t recvidles;
+			uint32_t joinattempts;
+			uint32_t requests;
+			uint32_t decompblocks;
+			uint32_t writeridles;
+			int32_t	 writebufmem;
+			uint32_t lostblocks;
+			uint32_t rerequests;
+		} __attribute__((__packed__)) v1;
+		uint32_t limit[256];
+	} u;
+} __attribute__((__packed__)) ClientStats_t;
+
+typedef struct {
+	char	map[MAXCHUNKSIZE/CHAR_BIT];
+} BlockMap_t;
+
+/*
+ * Packet defs.
+ */
+typedef struct {
+	struct {
+		int32_t		type;
+		int32_t		subtype;
+		int32_t 	datalen; /* Useful amount of data in packet */
+		uint32_t	srcip;   /* Filled in by network level. */
+	} hdr;
+	union {
+		/*
+		 * Join/leave the Team. Send a randomized ID, and receive
+		 * the number of blocks in the file. This is strictly
+		 * informational; the info is reported in the log file.
+		 * We must return the number of chunks in the file though.
+		 */
+		union {
+			uint32_t	clientid;
+			int32_t		blockcount;
+		} join;
+		
+		struct {
+			uint32_t	clientid;
+			int32_t		elapsed;	/* Stats only */
+		} leave;
+
+		/*
+		 * A data block, indexed by chunk,block.
+		 */
+		struct {
+			int32_t		chunk;
+			int32_t		block;
+			int8_t		buf[MAXBLOCKSIZE];
+		} block;
+
+		/*
+		 * A request for a data block, indexed by chunk,block.
+		 */
+		struct {
+			int32_t		chunk;
+			int32_t		block;
+			int32_t		count;	/* Number of blocks */
+		} request;
+
+		/*
+		 * Partial chunk request, a bit map of the desired blocks
+		 * for a chunk.  An alternative to issuing multiple standard
+		 * requests.  Retries is a hint to the server for congestion
+		 * control, non-zero if this is a retry of an earlier request
+		 * we made.
+		 */
+		struct {
+			int32_t		chunk;
+			int32_t		retries;
+			BlockMap_t	blockmap;
+		} prequest;
+
+		/*
+		 * Join V2 allows:
+		 * - client to request a specific chunk/block size
+		 *   server will return what it will provide
+		 * - server to return the size in bytes
+		 *   so that we can transfer files that are not a
+		 *   multiple of the block/chunk size
+		 * Note the blockcount field remains for vague
+		 * compatibility-ish reasons.
+		 */
+		struct {
+			uint32_t	clientid;
+			int32_t		blockcount;
+			int32_t		chunksize;
+			int32_t		blocksize;
+			uint64_t		bytecount;
+		} join2;
+
+		/*
+		 * Leave reporting client params/stats
+		 */
+		struct {
+			uint32_t	clientid;
+			int32_t		elapsed;
+			ClientStats_t	stats;
+		} leave2;
+	} msg;
+} Packet_t;
+#define PKTTYPE_REQUEST		1
+#define PKTTYPE_REPLY		2
+
+#define PKTSUBTYPE_JOIN		1
+#define PKTSUBTYPE_LEAVE	2
+#define PKTSUBTYPE_BLOCK	3
+#define PKTSUBTYPE_REQUEST	4
+#define PKTSUBTYPE_LEAVE2	5
+#define PKTSUBTYPE_PREQUEST	6
+#define PKTSUBTYPE_JOIN2	7
+
+#define PKTSUBTYPE_MAX		7
+
+#ifdef MASTER_SERVER
+#include <netinet/in.h>
+
+/* default port number: 0xfbee */
+#define MS_PORTNUM	64494
+
+/* imageid length: large enough to hold an ascii encoded SHA 1024 hash */
+#define MS_MAXIDLEN	256
+/* ditto for signature */
+#define MS_MAXSIGLEN	256
+
+/*
+ * Master server messages.
+ * These are sent via unicast TCP.
+ */
+typedef struct {
+	uint32_t	hostip;
+	uint8_t		methods;
+	uint8_t		status;
+	uint16_t	idlen;
+	uint8_t		imageid[MS_MAXIDLEN];
+} __attribute__((__packed__)) GetRequest;
+
+typedef struct {
+	uint8_t		method;
+	uint8_t		isrunning;
+	uint16_t	error;	
+	uint32_t	servaddr;
+	uint32_t	addr;
+	uint16_t	port;
+	uint16_t	sigtype;
+	uint8_t		signature[MS_MAXSIGLEN];
+	uint32_t	hisize;
+	uint32_t	losize;
+} __attribute__((__packed__)) GetReply;
+
+typedef struct {
+	uint32_t	hostip;
+	uint8_t		status;
+	uint16_t	idlen;
+	uint8_t		imageid[MS_MAXIDLEN];
+	uint32_t	hisize;
+	uint32_t	losize;
+	uint32_t	mtime;
+	uint32_t	timeout;
+} __attribute__((__packed__)) PutRequest;
+
+typedef struct {
+	uint16_t	error;	
+	uint32_t	addr;
+	uint16_t	port;
+	uint8_t		exists;
+	uint16_t	sigtype;
+	uint8_t		signature[MS_MAXSIGLEN];
+	uint32_t	hisize;
+	uint32_t	losize;
+	uint32_t	himaxsize;
+	uint32_t	lomaxsize;
+} __attribute__((__packed__)) PutReply;
+
+typedef struct {
+	struct {
+		int8_t		version[4];
+		int32_t		type;
+	} hdr;
+	union {
+		GetRequest	getrequest;
+		GetReply	getreply;
+		PutRequest	putrequest;
+		PutReply	putreply;
+	} body;
+} MasterMsg_t;
+
+#define MS_MSGVERS_1		"V01"
+
+#define MS_MSGTYPE_GETREQUEST	1
+#define MS_MSGTYPE_GETREPLY	2
+#define MS_MSGTYPE_PUTREQUEST	3
+#define MS_MSGTYPE_PUTREPLY	4
+
+#define MS_METHOD_UNKNOWN	0
+#define MS_METHOD_UNICAST	1
+#define MS_METHOD_MULTICAST	2
+#define MS_METHOD_BROADCAST	4
+#define MS_METHOD_ANY		7
+
+#define MS_SIGTYPE_NONE		0
+#define MS_SIGTYPE_MTIME	1
+#define MS_SIGTYPE_MD5		2
+#define MS_SIGTYPE_SHA1		3
+
+#define MS_ERROR_FAILED		1	/* internal host auth error */
+#define MS_ERROR_NOHOST		2	/* no such host */
+#define MS_ERROR_NOIMAGE	3	/* no such image */
+#define MS_ERROR_NOACCESS	4	/* access not allowed for host */
+#define MS_ERROR_NOMETHOD	5	/* not avail to host via method */
+#define MS_ERROR_INVALID	6	/* invalid argument */
+#define MS_ERROR_TRYAGAIN	7	/* try again later */
+#define MS_ERROR_TOOBIG		8	/* attempted PUT is too large */
+#define MS_ERROR_BADMTIME	9	/* attempt to set bad mtime */
+#define MS_ERROR_NOTIMPL	10	/* operation not implemented */
+#endif
diff -rNu epan/dissectors/packet-pubsub.c epan/dissectors/packet-pubsub.c
--- epan/dissectors/packet-pubsub.c	1969-12-31 17:00:00.000000000 -0700
+++ epan/dissectors/packet-pubsub.c	2012-07-06 17:17:29.000000000 -0600
@@ -0,0 +1,415 @@
+/* packet-pubsub.c
+ * Routines for Utah Emulab pubsub protocol
+ * Mike Hibler
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <time.h>
+#include <glib.h>
+#include <epan/packet.h>
+#include "packet-pubsub.h"
+
+static int proto_pubsub = -1;
+static int hf_pubsub_len = -1;
+static int hf_pubsub_type = -1;
+static int hf_pubsub_flags = -1;
+static int hf_pubsub_seq = -1;
+static int hf_pubsub_error = -1;
+static int hf_pubsub_vers = -1;
+static int hf_pubsub_token = -1;
+static int hf_pubsub_expr = -1;
+static int hf_pubsub_used = -1;
+static int hf_pubsub_items = -1;
+static int hf_pubsub_keytype = -1;
+static int hf_pubsub_keylen = -1;
+static int hf_pubsub_key = -1;
+static int hf_pubsub_valtype = -1;
+static int hf_pubsub_vallen = -1;
+static int hf_pubsub_value = -1;
+
+static gint ett_pubsub = -1;
+static gint ett_pubsub_items = -1;
+
+static void dissect_items(tvbuff_t *tvb, int offset,
+			  proto_tree *tree, packet_info *pinfo);
+
+#define TCP_PORT_PUBSUB    16505
+
+static const value_string pubsub_type_vals[] = {
+    { PUBSUB_PKT_CONNECT,     "Connect" },
+    { PUBSUB_PKT_DISCONNECT,  "Disconnect" },
+    { PUBSUB_PKT_SUBSCRIBE,   "Subscribe" },
+    { PUBSUB_PKT_UNSUBSCRIBE, "Unsubscribe" },
+    { PUBSUB_PKT_NOTIFY,      "Notify" },
+    { PUBSUB_PKT_NOTIFICATION,"Notification" },
+    { PUBSUB_PKT_PING,        "Ping" },
+    { 0, NULL }
+};
+
+static const value_string item_type_vals[] = {
+/*    { TERNARY_TYPE,      "Ternary" },*/
+/*    { BEGIN_NUMERIC_TYPE,"STARTNUM" },*/
+    { INT32_TYPE,        "INT32" },
+    { INT64_TYPE,        "INT64" },
+    { REAL64_TYPE,       "REAL64" },
+/*    { END_NUMERIC_TYPE,  "ENDNUM" },*/
+    { STRING_TYPE,       "STRING" },
+    { OPAQUE_TYPE,       "OPAQUE" },
+    { 0, NULL }
+};
+
+static int
+dissect_pubsub(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    int		offset = 0;
+    proto_tree	*pubsub_tree = NULL;
+    proto_item	*pubsub_ti = NULL;
+    pheader_t	tmp;
+    short		val;
+
+    /* Summary information */
+    col_set_str(pinfo->cinfo, COL_PROTOCOL, "PUBSUB");
+    val = tvb_get_ntohs(tvb, 4);
+    col_add_str(pinfo->cinfo, COL_INFO,
+                val_to_str(val, pubsub_type_vals, "Unknown (0x%04x)"));
+    if (tree) {
+        pubsub_ti = proto_tree_add_item(tree, proto_pubsub, tvb,
+                                        offset, -1, ENC_ASCII|ENC_NA);
+        pubsub_tree = proto_item_add_subtree(pubsub_ti, ett_pubsub);
+    }
+
+    tmp.len = tvb_get_ntohl(tvb, offset);
+    if (tree) {
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_len, tvb,
+                            offset, 4, tmp.len);
+    }
+    offset += 4;
+
+    tmp.type = tvb_get_ntohs(tvb, offset);
+    if (tree)
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_type, tvb,
+                            offset, 2, tmp.type);
+    offset += 2;
+
+    tmp.flags = tvb_get_ntohs(tvb, offset);
+    if (tree)
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_flags, tvb,
+                            offset, 2, tmp.flags);
+    offset += 2;
+
+    tmp.seq = tvb_get_ntohl(tvb, offset);
+    if (tree) {
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_seq, tvb,
+                            offset, 4, tmp.seq);
+    }
+    offset += 4;
+
+    tmp.error = tvb_get_ntohl(tvb, offset);
+    if (tree) {
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_error, tvb,
+                            offset, 4, tmp.error);
+    }
+    offset += 4;
+
+    tmp.vers = tvb_get_ntohl(tvb, offset);
+    if (tree) {
+        proto_tree_add_uint(pubsub_tree, hf_pubsub_vers, tvb,
+                            offset, 4, tmp.vers);
+    }
+    offset += 4;
+
+    /*
+     * XXX if packet is just a header, it is a reply to the indicated type
+     */
+    if (tmp.len == sizeof(pheader_t)) {
+        col_append_fstr(pinfo->cinfo, COL_INFO,
+                        " Reply: Seq=%d", tmp.seq);
+        return tvb_length(tvb);
+    }
+    col_append_fstr(pinfo->cinfo, COL_INFO, ": Seq=%d ", tmp.seq);
+
+    switch (tmp.type) {
+    case PUBSUB_PKT_SUBSCRIBE:
+    {
+        unsigned int token;
+        int exprlen;
+
+        token = tvb_get_ntohl(tvb, offset);
+#if 0
+        col_append_fstr(pinfo->cinfo, COL_INFO, ": token=%d ", token);
+#endif
+        if (tree) {
+            proto_tree_add_uint(pubsub_tree, hf_pubsub_token, tvb,
+                                offset, 4, token);
+        }
+        offset += 4;
+
+        exprlen = tvb_strsize(tvb, offset);
+        col_append_fstr(pinfo->cinfo, COL_INFO, "Expr: \"%s\" ",
+                        tvb_format_stringzpad(tvb, offset, exprlen));
+        if (tree) {
+            proto_tree_add_item(pubsub_tree, hf_pubsub_expr, tvb,
+                                offset, exprlen, ENC_ASCII|ENC_NA);
+        }
+        offset += exprlen;
+        break;
+    }
+    case PUBSUB_PKT_NOTIFY:
+    case PUBSUB_PKT_NOTIFICATION:
+    {
+        unsigned int token;
+        unsigned int used;
+
+        token = tvb_get_ntohl(tvb, offset);
+#if 0
+        col_append_fstr(pinfo->cinfo, COL_INFO, ": token=%d ", token);
+#endif
+        if (tree) {
+            proto_tree_add_uint(pubsub_tree, hf_pubsub_token, tvb,
+                                offset, 4, token);
+        }
+        offset += 4;
+
+        used = tvb_get_ntohl(tvb, offset);
+        if (tree) {
+            proto_tree_add_uint(pubsub_tree, hf_pubsub_used, tvb,
+                                offset, 4, used);
+        }
+        offset += 4;
+        dissect_items(tvb, offset, pubsub_tree, pinfo);
+        break;
+    }
+    default:
+        break;
+    }
+
+    return tvb_length(tvb);
+}
+
+static void
+dissect_items(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo)
+{
+    proto_tree	*item_tree = NULL;
+    proto_item	*item_ti = NULL;
+    int		item_offset, val_offset;
+    int		len, itype, ilen;
+    char	*key, *val, valbuf[1024];
+
+    while ((len = tvb_reported_length_remaining(tvb, offset)) > 0) {
+        item_ti = proto_tree_add_item(tree, hf_pubsub_items, tvb,
+                                      offset, len, ENC_ASCII|ENC_NA);
+        item_tree = proto_item_add_subtree(item_ti, ett_pubsub_items);
+		
+        /* Get key */
+        item_offset = offset;
+        itype = tvb_get_ntohl(tvb, offset);
+        offset += 4;
+
+        ilen = tvb_get_ntohl(tvb, offset);
+        offset += 4;
+
+        key = tvb_get_ephemeral_string(tvb, offset, ilen);
+        offset += ilen;
+        if (ilen % 4)
+            offset += (4 - (ilen % 4));
+
+        proto_tree_add_text(item_tree, tvb,
+                            item_offset, offset - item_offset,
+                            "Key: %s [type=%s(%d), len=%d]",
+                            key,
+                            val_to_str(itype, item_type_vals, "UNKNOWN"),
+                            itype,
+                            ilen);
+
+        /* get value */
+        val_offset = offset;
+        itype = tvb_get_ntohl(tvb, offset);
+        offset += 4;
+
+        ilen = tvb_get_ntohl(tvb, offset);
+        offset += 4;
+
+        switch (itype) {
+        case INT32_TYPE:
+        {
+            gint32 v = tvb_get_ntohl(tvb, offset);
+            g_snprintf(valbuf, sizeof(valbuf), "%d", v);
+            val = valbuf;
+            break;
+        }
+        case INT64_TYPE:
+        {
+            gint64 v = tvb_get_ntoh64(tvb, offset);
+            g_snprintf(valbuf, sizeof(valbuf), "%lld", (long long)v);
+            val = valbuf;
+            break;
+        }
+        case REAL64_TYPE:
+        {
+            gdouble v = tvb_get_ntohieee_double(tvb, offset);
+            g_snprintf(valbuf, sizeof(valbuf), "%f", v);
+            val = valbuf;
+            break;
+        }
+        case STRING_TYPE:
+            val = tvb_get_ephemeral_string(tvb, offset, ilen);
+            break;
+        case OPAQUE_TYPE:
+            val = "[data]";
+            break;
+        default:
+            val = "[unknown]";
+            break;
+        }
+        offset += ilen;
+        if (ilen % 4)
+            offset += (4 - (ilen % 4));
+
+        proto_tree_add_text(item_tree, tvb,
+                            item_offset, offset - val_offset,
+                            "Val: %s [type=%s(%d), len=%d]",
+                            val,
+                            val_to_str(itype, item_type_vals, "UNKNOWN"),
+                            itype,
+                            ilen);
+
+        /* update length */
+        proto_item_set_len(item_ti, offset - item_offset);
+
+        col_append_fstr(pinfo->cinfo, COL_INFO, "%s=%s ", key, val);
+    }
+}
+
+void
+proto_register_pubsub(void)
+{
+    static hf_register_info hf[] = {
+        { &hf_pubsub_len,
+          { "Packet Len",	"pubsub.len",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB packet length", HFILL }},
+
+        { &hf_pubsub_type,
+          { "Type",	"pubsub.type",
+            FT_UINT16, BASE_DEC, VALS(pubsub_type_vals), 0x0,
+            "PUBSUB message type", HFILL }},
+
+        { &hf_pubsub_flags,
+          { "Flags",	"pubsub.flags",
+            FT_UINT16, BASE_HEX, NULL, 0x0,
+            "PUBSUB flags", HFILL }},
+
+        { &hf_pubsub_seq,
+          { "Sequence", "pubsub.seq",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB sequence number", HFILL }},
+
+        { &hf_pubsub_error,
+          { "Error", "pubsub.error",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB error code", HFILL }},
+
+        { &hf_pubsub_vers,
+          { "Version", "pubsub.vers",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB version", HFILL }},
+
+        { &hf_pubsub_token,
+          { "Token", "pubsub.token",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB token", HFILL }},
+
+        { &hf_pubsub_expr,
+          { "Expression", "pubsub.expr",
+            FT_STRINGZ, BASE_NONE, NULL, 0x0,
+            "PUBSUB subscription expression", HFILL }},
+
+        { &hf_pubsub_used,
+          { "Used", "pubsub.used",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB space used", HFILL }},
+
+        { &hf_pubsub_items,
+          { "Key/value pair", "pubsub.items",
+            FT_NONE, BASE_NONE, NULL, 0x0,
+            "PUBSUB key/value pair", HFILL }},
+
+        { &hf_pubsub_keytype,
+          { "Item keytype", "pubsub.keytype",
+            FT_UINT32, BASE_DEC, VALS(item_type_vals), 0x0,
+            "PUBSUB item key type", HFILL }},
+
+        { &hf_pubsub_keylen,
+          { "Item keylen", "pubsub.keylen",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB item key length", HFILL }},
+
+        { &hf_pubsub_key,
+          { "Item key", "pubsub.key",
+            FT_STRINGZ, BASE_NONE, NULL, 0x0,
+            "PUBSUB item key", HFILL }},
+
+        { &hf_pubsub_valtype,
+          { "Item valtype", "pubsub.valtype",
+            FT_UINT32, BASE_DEC, VALS(item_type_vals), 0x0,
+            "PUBSUB value type", HFILL }},
+
+        { &hf_pubsub_vallen,
+          { "Item vallen", "pubsub.vallen",
+            FT_UINT32, BASE_DEC, NULL, 0x0,
+            "PUBSUB value length", HFILL }},
+    };
+
+    static gint *ett[] = {
+        &ett_pubsub,
+        &ett_pubsub_items,
+    };
+
+    proto_pubsub = proto_register_protocol("Pubsub publish/subscribe protocol", "PUBSUB", "pubsub");
+    proto_register_field_array(proto_pubsub, hf, array_length(hf));
+    proto_register_subtree_array(ett, array_length(ett));
+}
+
+void
+proto_reg_handoff_pubsub(void)
+{
+	dissector_handle_t pubsub_handle;
+
+	pubsub_handle = create_dissector_handle(dissect_pubsub, proto_pubsub);
+	dissector_add("tcp.port", TCP_PORT_PUBSUB, pubsub_handle);
+}
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 expandtab:
+ * :indentSize=8:tabSize=8:noTabs=true:
+ */
diff -rNu epan/dissectors/packet-pubsub.h epan/dissectors/packet-pubsub.h
--- epan/dissectors/packet-pubsub.h	1969-12-31 17:00:00.000000000 -0700
+++ epan/dissectors/packet-pubsub.h	2012-07-05 09:14:46.000000000 -0600
@@ -0,0 +1,73 @@
+/*
+ * From pubsub/network.h
+ */
+
+/*
+ * The structure of a request (response) packet. The len is field used to
+ * calculate how much more data to read to get the entire packet. 
+ */
+typedef struct {
+	int		len;		/* length of entire packet */
+	short		type;		/* See below */
+	short		flags;		/* See below */
+	int		seq;	        /* unique sequence number */
+	int		error;		/* Error code (0 == no error) */
+	int		vers;		/* protocol version */
+} pheader_t;
+
+/* The complete packet */
+typedef struct packet {
+	pheader_t	header;
+	char		data[0];
+} packet_t;
+
+#define PUBSUB_MAX_PACKET		4096	/* XXX arbitrary */
+
+/* A maximum size packet. */
+typedef struct {
+	pheader_t	header;
+	char		data[PUBSUB_MAX_PACKET-sizeof(pheader_t)];
+} maxpacket_t;
+
+/* Protocol Versions */
+#define PUBSUB_WIRE_V1			1
+#define PUBSUB_MIN_VERSION		PUBSUB_WIRE_V1
+#define PUBSUB_CUR_VERSION		PUBSUB_WIRE_V1
+#define PUBSUB_MAX_VERSION		PUBSUB_WIRE_V1
+
+/* Packet Type */
+#define PUBSUB_PKT_CONNECT		1
+#define PUBSUB_PKT_DISCONNECT		2
+#define PUBSUB_PKT_SUBSCRIBE		3
+#define PUBSUB_PKT_UNSUBSCRIBE		4
+#define PUBSUB_PKT_NOTIFY		5
+#define PUBSUB_PKT_NOTIFICATION		6
+#define PUBSUB_PKT_PING			7
+
+/* Subpacket definitions */
+typedef struct {
+	pheader_t	header;
+	unsigned int	token;		/* Unique token to identify it */
+	char		expression[0];  /* subscription string. */
+} subscription_packet_t;
+
+/*
+ * XXX This needs to match the version in clientapi.h ...
+ */
+typedef struct {
+	pheader_t	header;
+	unsigned int	token;		/* Token to match subscription */
+	unsigned int	used;
+	char		data[0];	/* key=value pairs */
+} notification_packet_t;
+
+typedef enum {
+	TERNARY_TYPE = 0,
+	BEGIN_NUMERIC_TYPE = 1,
+	INT32_TYPE = 2,
+	INT64_TYPE = 3,
+	REAL64_TYPE = 4,
+	END_NUMERIC_TYPE = 5,
+	STRING_TYPE = 6,
+	OPAQUE_TYPE = 7,
+} pubsub_type_t;
diff -rNu epan/dissectors/register.c epan/dissectors/register.c
--- epan/dissectors/register.c	2012-06-21 12:23:16.000000000 -0600
+++ epan/dissectors/register.c	2012-07-06 17:18:09.000000000 -0600
@@ -21,6 +21,7 @@
   {extern void proto_register_9P (void); if(cb) (*cb)(RA_REGISTER, "proto_register_9P", client_data); proto_register_9P ();}
   {extern void proto_register_HI2Operations (void); if(cb) (*cb)(RA_REGISTER, "proto_register_HI2Operations", client_data); proto_register_HI2Operations ();}
   {extern void proto_register_ISystemActivator (void); if(cb) (*cb)(RA_REGISTER, "proto_register_ISystemActivator", client_data); proto_register_ISystemActivator ();}
+  {extern void proto_register__frisbee (void); if(cb) (*cb)(RA_REGISTER, "proto_register__frisbee", client_data); proto_register__frisbee ();}
   {extern void proto_register_a11 (void); if(cb) (*cb)(RA_REGISTER, "proto_register_a11", client_data); proto_register_a11 ();}
   {extern void proto_register_aarp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_aarp", client_data); proto_register_aarp ();}
   {extern void proto_register_aasp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_aasp", client_data); proto_register_aasp ();}
@@ -783,6 +784,7 @@
   {extern void proto_register_pres (void); if(cb) (*cb)(RA_REGISTER, "proto_register_pres", client_data); proto_register_pres ();}
   {extern void proto_register_prp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_prp", client_data); proto_register_prp ();}
   {extern void proto_register_ptp (void); if(cb) (*cb)(RA_REGISTER, "proto_register_ptp", client_data); proto_register_ptp ();}
+  {extern void proto_register_pubsub (void); if(cb) (*cb)(RA_REGISTER, "proto_register_pubsub", client_data); proto_register_pubsub ();}
   {extern void proto_register_pvfs (void); if(cb) (*cb)(RA_REGISTER, "proto_register_pvfs", client_data); proto_register_pvfs ();}
   {extern void proto_register_pw_atm_ata (void); if(cb) (*cb)(RA_REGISTER, "proto_register_pw_atm_ata", client_data); proto_register_pw_atm_ata ();}
   {extern void proto_register_pw_cesopsn (void); if(cb) (*cb)(RA_REGISTER, "proto_register_pw_cesopsn", client_data); proto_register_pw_cesopsn ();}
@@ -1123,6 +1125,7 @@
   {extern void proto_reg_handoff_9P (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_9P", client_data); proto_reg_handoff_9P ();}
   {extern void proto_reg_handoff_HI2Operations (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_HI2Operations", client_data); proto_reg_handoff_HI2Operations ();}
   {extern void proto_reg_handoff_ISystemActivator (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_ISystemActivator", client_data); proto_reg_handoff_ISystemActivator ();}
+  {extern void proto_reg_handoff__frisbee (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff__frisbee", client_data); proto_reg_handoff__frisbee ();}
   {extern void proto_reg_handoff_a11 (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_a11", client_data); proto_reg_handoff_a11 ();}
   {extern void proto_reg_handoff_aarp (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_aarp", client_data); proto_reg_handoff_aarp ();}
   {extern void proto_reg_handoff_aasp (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_aasp", client_data); proto_reg_handoff_aasp ();}
@@ -1836,6 +1839,7 @@
   {extern void proto_reg_handoff_pres (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_pres", client_data); proto_reg_handoff_pres ();}
   {extern void proto_reg_handoff_prp (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_prp", client_data); proto_reg_handoff_prp ();}
   {extern void proto_reg_handoff_ptp (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_ptp", client_data); proto_reg_handoff_ptp ();}
+  {extern void proto_reg_handoff_pubsub (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_pubsub", client_data); proto_reg_handoff_pubsub ();}
   {extern void proto_reg_handoff_pvfs (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_pvfs", client_data); proto_reg_handoff_pvfs ();}
   {extern void proto_reg_handoff_pw_atm_ata (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_pw_atm_ata", client_data); proto_reg_handoff_pw_atm_ata ();}
   {extern void proto_reg_handoff_pw_cesopsn (void); if(cb) (*cb)(RA_HANDOFF, "proto_reg_handoff_pw_cesopsn", client_data); proto_reg_handoff_pw_cesopsn ();}
@@ -2152,13 +2156,13 @@
 
 static gulong proto_reg_count(void)
 {
-  return 1097;
+  return 1099;
 
 }
 
 static gulong handoff_reg_count(void)
 {
-  return 1033;
+  return 1035;
 
 }