diff -urN wireshark-trunk/epan/dissectors/packet-rtps2.c wireshark-rti/epan/dissectors/packet-rtps2.c
--- wireshark-trunk/epan/dissectors/packet-rtps2.c	2009-03-03 16:31:33.000000000 -0800
+++ wireshark-rti/epan/dissectors/packet-rtps2.c	2009-03-03 16:48:28.000000000 -0800
@@ -5,8 +5,13 @@
  *
  * Copyright 2005, Fabrizio Bertocci <fabrizio@rti.com>
  * Real-Time Innovations, Inc.
- * 3975 Freedom Circle
- * Santa Clara, CA 95054
+ * 385 Moffett Park Drive
+ * Sunnyvale, CA 94089
+ *
+ * Version 2.1 bug fixes to RTPS_DATA provided by
+ * Twin Oaks Computing, Inc.  <contact@twinoakscomputing.com>
+ * 755 Maleta Ln, Ste 203
+ * Castle Rock, CO 80108
  *
  * $Id$
  *
@@ -153,6 +158,7 @@
 static gint ett_rtps_wrentity                   = -1;
 static gint ett_rtps_guid_prefix                = -1;
 static gint ett_rtps_part_message_data          = -1;
+static gint ett_rtps_part_message_guid          = -1;
 static gint ett_rtps_locator_udp_v4             = -1;
 static gint ett_rtps_locator                    = -1;
 static gint ett_rtps_locator_list               = -1;
@@ -163,6 +169,8 @@
 static gint ett_rtps_serialized_data            = -1;
 static gint ett_rtps_sample_info_list           = -1;
 static gint ett_rtps_sample_info                = -1;
+static gint ett_rtps_locator_filter_channel     = -1;
+static gint ett_rtps_locator_filter_locator     = -1;
 
 /***************************************************************************/
 /* Value-to-String Tables */
@@ -245,6 +253,9 @@
   { SUBMESSAGE_HEARTBEAT_FRAG,          "HEARTBEAT_FRAG" },
   { SUBMESSAGE_ACKNACK_BATCH,           "ACKNACK_BATCH" },
   { SUBMESSAGE_HEARTBEAT_BATCH,         "HEARTBEAT_BATCH" },
+  { SUBMESSAGE_ACKNACK_SESSION,         "ACKNACK_SESSION" },
+  { SUBMESSAGE_HEARTBEAT_SESSION,       "HEARTBEAT_SESSION" },
+  { SUBMESSAGE_RTPS_DATA_SESSION,       "DATA_SESSION" },
   /* Deprecated submessages */
   { SUBMESSAGE_DATA,                    "DATA_deprecated" },
   { SUBMESSAGE_NOKEY_DATA,              "NOKEY_DATA_deprecated" },
@@ -346,6 +357,8 @@
   { PID_ENTITY_VIRTUAL_GUID,            "PID_ENTITY_VIRTUAL_GUID" },
   { PID_SERVICE_KIND,                   "PID_SERVICE_KIND" },
   { PID_TYPECODE,                       "PID_TYPECODE" },
+  { PID_DISABLE_POSITIVE_ACKS,          "DISABLE_POSITIVE_ACKS" },
+  { PID_LOCATOR_FILTER_LIST,            "PID_LOCATOR_FILTER_LIST" },
 
   /* The following PID are deprecated */
   { PID_DEADLINE_OFFERED,               "PID_DEADLINE_OFFERED [deprecated]" },
@@ -647,7 +660,7 @@
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 6 */
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 5 */
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 4 */
-  { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 3 */
+  { 'K', "Key present"  },                      /* Bit 3 */
   { 'D', "Data present" },                      /* Bit 2 */
   { 'Q', "Inline QoS" },                        /* Bit 1 */
   { 'E', "Endianness bit" }                     /* Bit 0 */
@@ -659,7 +672,7 @@
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 5 */
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 4 */
   { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 3 */
-  { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING },   /* Bit 2 */
+  { 'K', "Key present"  },                      /* Bit 2 */
   { 'Q', "Inline QoS" },                        /* Bit 1 */
   { 'E', "Endianness bit" }                     /* Bit 0 */
 };
@@ -782,32 +795,6 @@
 
 
 
-/* Sub-message dissector functions */
-#define DECLARE_DISSECTOR_SUBMESSAGE(sm)    \
-static void dissect_## sm (tvbuff_t *tvb, gint offset, guint8 flags,    \
-                        gboolean little_endian, int next_submsg_offset, \
-                        proto_tree *rtps_submessage_tree,               \
-                        char *info_summary_text, guint16 vendor_id)
-DECLARE_DISSECTOR_SUBMESSAGE(PAD);
-DECLARE_DISSECTOR_SUBMESSAGE(DATA);
-DECLARE_DISSECTOR_SUBMESSAGE(DATA_FRAG);
-DECLARE_DISSECTOR_SUBMESSAGE(NOKEY_DATA);
-DECLARE_DISSECTOR_SUBMESSAGE(NOKEY_DATA_FRAG);
-DECLARE_DISSECTOR_SUBMESSAGE(NACK_FRAG);
-DECLARE_DISSECTOR_SUBMESSAGE(ACKNACK);
-DECLARE_DISSECTOR_SUBMESSAGE(HEARTBEAT);
-DECLARE_DISSECTOR_SUBMESSAGE(HEARTBEAT_FRAG);
-DECLARE_DISSECTOR_SUBMESSAGE(GAP);
-DECLARE_DISSECTOR_SUBMESSAGE(INFO_TS);
-DECLARE_DISSECTOR_SUBMESSAGE(INFO_SRC);
-DECLARE_DISSECTOR_SUBMESSAGE(INFO_REPLY_IP4);
-DECLARE_DISSECTOR_SUBMESSAGE(INFO_DST);
-DECLARE_DISSECTOR_SUBMESSAGE(INFO_REPLY);
-DECLARE_DISSECTOR_SUBMESSAGE(RTPS_DATA);
-DECLARE_DISSECTOR_SUBMESSAGE(RTPS_DATA_FRAG);
-DECLARE_DISSECTOR_SUBMESSAGE(RTPS_DATA_BATCH);
-DECLARE_DISSECTOR_SUBMESSAGE(HEARTBEAT_BATCH);
-#undef DECLARE_DISSECTOR_SUBMESSAGE
 
 /* The main packet dissector */
 static gboolean dissect_rtps(tvbuff_t *, packet_info *, proto_tree *);
@@ -826,9 +813,16 @@
 /***************************************************************************/
 /* Global variables controlled by Wireshark preference panel               */
 /***************************************************************************/
-/* static gboolean glob_do_something = TRUE; */
+/*static gboolean glob_do_something = TRUE; */
 static guint rtps_max_batch_samples_dissected = 16;
 
+static void reinit_rtps(void) {
+  /* Do something here when global arguments are changed */
+}
+
+
+
+
 
 /* *********************************************************************** */
 /* Appends a submessage description to the info summary text
@@ -1442,7 +1436,8 @@
     ti = proto_tree_add_text(tree,
                         tvb,
                         offset,
-                        12, "%s",
+                        12,
+                        "%s",
                         temp_buff);
 
     guid_tree = proto_item_add_subtree(ti,
@@ -2144,7 +2139,7 @@
                         "size: %d", num_strings);
   offset += 4;
 
-  /* Create the string node with a fake string, the replace it later */
+  /* Create the string node with a fake string, then replace it later */
   if (tree) {
     ti = proto_tree_add_text(tree, 
                         tvb,
@@ -2557,18 +2552,144 @@
     } /* end of case UNION */
 
 
-    case RTI_CDR_TK_ENUM:
-    case RTI_CDR_TK_STRUCT: {
+#if 0
+    case RTI_CDR_TK_VALUE_PARARM:  {
     /* Structure of the typecode data:
-     *
-     * <union_type_code> ::=
+     * <param_value_type_code ::=
      *          <type_code_header>
      *          <name>
-     *          <default_index>
-     *          <discriminator_type_code>
+     *          <type_modifier>
+     *          <base_type_code>
      *          <member_count>
      *          <member>+
      *
+     *     <type_modifier> := short (0=NONE, 1=CUSTOM, 2=ABSTRACT, 3=TRUNCABLE)
+     *     <base_type-code> := this can have several forms, alias, value, null
+     *                         or param_value type code.
+     *                         In this version we only support NULL type code.
+     */
+        guint32 struct_name_len;
+        gint8 * struct_name;
+        guint32 num_members;
+        guint16 member_length;
+        guint8  member_is_key;
+        guint32 member_name_len;
+        guint8 *member_name = NULL;
+        guint32 next_offset;
+        guint32 field_offset_begin;
+        guint32 ordinal_number;
+	guint16 member_visibility;
+	guint16 member_representation_count;
+
+	guint16 type_modifier;
+	guint32 baseTypeCodeKind;
+	guint32 baseTypeCodeLength;
+
+        /* Pad-align */
+        LONG_ALIGN(offset);
+
+        /* Get structure name length */
+        struct_name_len = NEXT_guint32(tvb, offset, little_endian);
+        offset += 4;
+
+        /* struct name */
+        struct_name = tvb_get_string(tvb, offset, struct_name_len);
+        offset += struct_name_len;
+
+
+	/* Need to read the type modifier and the base type code */
+	SHORT_ALIGN(offset);
+	type_modifier = NEXT_guint16(tvb, offset, little_endian);
+	offset += 2;
+	LONG_ALIGN(offset);
+	baseTypeCodeKind = NEXT_guint32(tvb, offset, little_endian);
+	offset += 4;
+	baseTypeCodeLength = NEXT_guint32(tvb, offset, little_endian);
+	offset += 4;
+	offset += baseTypeCodeLength;
+
+        /* Prints the typecode header */
+        proto_tree_add_text(tree,
+                    tvb,
+                    original_offset,
+                    retVal,
+                    "%s<sparse_type> %s {",
+                    indent_string,
+                    struct_name);
+        g_free(struct_name);
+
+        /* PAD align */
+        LONG_ALIGN(offset);
+
+        /* number of members */
+        num_members = NEXT_guint32(tvb, offset, little_endian);
+        offset += 4;
+
+        next_offset = offset;
+        for (i = 0; i < num_members; ++i) {
+          /* Safety: this theoretically should be the same already */
+          field_offset_begin = offset = next_offset;
+
+          SHORT_ALIGN(offset);
+
+          /* member's length */
+          member_length = NEXT_guint16(tvb, offset, little_endian);
+          offset += 2;
+          next_offset = offset + member_length;
+
+          /* Name length */
+          LONG_ALIGN(offset);
+          member_name_len = NEXT_guint32(tvb, offset, little_endian);
+          offset += 4;
+
+          /* Name */
+          member_name = tvb_get_string(tvb, offset, member_name_len);
+          offset += member_name_len;
+
+          /* <param_value_member> */
+
+          /* is Key ? */
+          member_is_key = tvb_get_guint8(tvb, offset);
+          offset++;
+
+	  /* <visibility> */
+          SHORT_ALIGN(offset);
+          member_visibility = NEXT_guint16(tvb, offset, little_endian);
+          offset += 2;
+
+          /* <representation_count> */
+          SHORT_ALIGN(offset);
+          member_representation_count = NEXT_guint16(tvb, offset, little_endian);
+          offset += 2;
+
+          offset += rtps_util_add_typecode(
+                          tree,
+                          tvb, 
+                          offset, 
+                          little_endian, 
+                          indent_level+1,
+                          false,
+                          false,
+                          member_is_key,
+                          field_offset_begin,
+                          member_name,
+                          -1,
+                          NULL,
+                          ndds_40_hack);
+          }
+
+          g_free(member_name);
+        }
+        /* Finally prints the name of the struct (if provided) */
+        g_strlcpy(type_name, "}", 40);
+        break;
+    }
+#endif
+
+    case RTI_CDR_TK_ENUM:
+    case RTI_CDR_TK_STRUCT: {
+    /* Structure of the typecode data:
+     *
      * <struct_type_code> ::=
      *          <type_code_header>
      *          <name>
@@ -2593,6 +2714,10 @@
      *          - A2  2: length
      * }
      *
+     *     <type_modifier> := short (0=NONE, 1=CUSTOM, 2=ABSTRACT, 3=TRUNCABLE)
+     *     <base_type-code> := this can have several forms, alias, value, null
+     *                         or param_value type code.
+     *                         In this version we only support NULL type code.
      * ENUM:
      *     Foreach member {
      *          - A2: 2: member length
@@ -2633,6 +2758,21 @@
 
         if (tk_id == RTI_CDR_TK_ENUM) {
             typecode_name = "enum";
+        } else if (tk_id == RTI_CDR_TK_VALUE_PARARM) {
+            guint16 type_modifier;
+            guint32 baseTypeCodeKind;
+            guint32 baseTypeCodeLength;
+            /* Need to read the type modifier and the base type code */
+            typecode_name = "<sparse type>";
+            SHORT_ALIGN(offset);
+            type_modifier = NEXT_guint16(tvb, offset, little_endian);
+	    offset += 2;
+            LONG_ALIGN(offset);
+            baseTypeCodeKind = NEXT_guint32(tvb, offset, little_endian);
+	    offset += 4;
+            baseTypeCodeLength = NEXT_guint32(tvb, offset, little_endian);
+	    offset += 4;
+            offset += baseTypeCodeLength;
         } else {
             typecode_name = "struct";
         }
@@ -2643,7 +2783,7 @@
           g_free(struct_name);
           break;
         }
-        /* Prints it */
+        /* Prints the typecode header */
         proto_tree_add_text(tree,
                     tvb,
                     original_offset,
@@ -2856,11 +2996,13 @@
      * Foreach member: (it's just like a struct)           
      *
      */
+    case RTI_CDR_TK_VALUE_PARARM: 
     case RTI_CDR_TK_VALUE: {
         /* Not fully dissected for now */
         /* Pad-align */
         guint32 value_name_len;
         gint8 * value_name;
+        const char * type_id_name = "valuetype";
         LONG_ALIGN(offset);
 
         /* Get structure name length */
@@ -2871,7 +3013,10 @@
         value_name = tvb_get_string(tvb, offset, value_name_len);
         offset += value_name_len;
 
-        g_snprintf(type_name, 40, "valuetype %s", value_name);
+        if (tk_id == RTI_CDR_TK_VALUE_PARARM) {
+            type_id_name = "valueparam";
+        }
+        g_snprintf(type_name, 40, "%s '%s'", type_id_name, value_name);
         break;
     }
   } /* switch(tk_id) */
@@ -2981,7 +3126,8 @@
       proto_tree_add_text(tree,
                         tvb, 
                         offset, 
-                        param_length, "%s",
+                        param_length,
+                        "%s",
                         buffer);
     }
     return ;
@@ -3443,7 +3589,8 @@
           proto_tree_add_text(rtps_parameter_sequence_tree,
                         tvb,
                         offset,
-                        size, "%s",
+                        size,
+                        "%s",
                         label);
   }  
 }
@@ -3611,7 +3758,7 @@
                         tvb,
                         offset,
                         1,
-                        "RTPS PROTOCOL ERROR: not enough bytes to read "
+                        "RTPS PROTOCOL ERROR: not enough bytes to read"
                                                 " the parameter value");
       }
       return 0;
@@ -3739,7 +3886,8 @@
         proto_tree_add_text(rtps_parameter_tree,
                         tvb,
                         offset,
-                        param_length, "%s",
+                        param_length,
+                        "%s",
                         buffer);
         break;
       }
@@ -5323,6 +5471,110 @@
                         0);     /* ndds 4.0 hack: init to false */
               break;
 
+            /* 0...2...........7...............15.............23...............31
+             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
+             * | PID_DISABLE_POSITIVE_ACKS     |            length             | 
+             * +---------------+---------------+---------------+---------------+
+             * | boolean value | = = = = = = = =  u n u s e d  = = = = = = = = |
+             * +---------------+---------------+---------------+---------------+
+             */
+            case PID_DISABLE_POSITIVE_ACKS:
+	      ENSURE_LENGTH(1);
+	      rtps_util_add_boolean(rtps_parameter_tree,
+                        tvb,
+                        offset,
+                        "disablePositiveAcks",
+                        buffer,
+                        MAX_PARAM_SIZE);
+              break;
+
+            /* 0...2...........7...............15.............23...............31
+             * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
+             * | PID_LOCATOR_FILTER_LIST       |            length             | 
+             * +---------------+---------------+---------------+---------------+
+             * | unsigned long number_of_channels                              |
+             * +---------------+---------------+---------------+---------------+
+	     * |                                                               |
+	     * ~ String filter_name                                            ~
+	     * |                                                               |
+	     * +---------------+---------------+---------------+---------------+
+	     * |                                                               |
+	     * ~ LocatorList                                                   ~ <----------+
+	     * |                                                               |    Repeat  |
+	     * +---------------+---------------+---------------+---------------+    For each|
+	     * |                                                               |    Channel |
+	     * ~ String filter_expression                                      ~            | 
+	     * |                                                               |            |
+	     * +---------------+---------------+---------------+---------------+ <----------+
+             */
+            case PID_LOCATOR_FILTER_LIST: {
+              guint32 number_of_channels = 0;
+	      proto_tree *channel_tree = NULL;
+	      proto_item *ti_channel = NULL;
+	      char temp_buff[MAX_LABEL_SIZE];
+	      guint32 ch;
+	      gint old_offset;
+	      guint32 off = offset;
+				
+              ENSURE_LENGTH(4);
+              number_of_channels = NEXT_guint32(tvb, off, little_endian);
+	      g_snprintf(buffer, MAX_PARAM_SIZE, "%d channels", number_of_channels);
+	      off += 4;
+	      
+	      if (number_of_channels == 0) {
+		/* Do not dissect the rest */
+	        proto_tree_add_text(rtps_parameter_tree,
+                        tvb,
+                        off-4,
+                        4,
+                        "numberOfChannels: %d", number_of_channels);
+		break;
+	      }
+		
+	      /* filter name */
+	      off = rtps_util_add_string(rtps_parameter_tree,
+			tvb,
+			off,
+			-1,		/* hf_item not set */
+			little_endian,
+			"filterName",	/* label */
+			NULL,		/* buffer not set */
+			0);		/* buffer length */
+
+	      /* Foreach channel... */
+	      for (ch = 0; ch < number_of_channels; ++ch) {
+		g_snprintf(temp_buff, MAX_LABEL_SIZE, "Channel[%u]", ch);
+		old_offset = off;
+		if (tree) {
+		  ti_channel = proto_tree_add_text(rtps_parameter_tree,
+			tvb,
+			off,
+			0,
+			temp_buff);
+		  channel_tree = proto_item_add_subtree(ti_channel, ett_rtps_locator_filter_channel);
+		}
+		off = rtps_util_add_locator_list(channel_tree,
+			tvb,
+			off,
+			temp_buff,
+			little_endian);
+		/* Filter expression */
+	        off = rtps_util_add_string(channel_tree,
+			tvb,
+			off,
+			-1,		/* hf_item not set */
+			little_endian,
+			"filterExpression",	/* label */
+			NULL,		/* buffer not set */
+			0);		/* buffer length */
+		/* Now we know the length of the channel data, set the length */
+		if (ti_channel) {
+	          proto_item_set_len(ti_channel, (off - old_offset));
+		}
+	      } /* End of for each channel */
+              break;
+	    } /* End of case PID_LOCATOR_FILTER_LIST */
+
           } /* End of switch for parameters for vendor RTI */
         } /* End of branch vendor RTI */
         
@@ -7304,6 +7556,8 @@
 
 /* *********************************************************************** */
 /* *                     R T P S _ D A T A                               * */
+/* *                           A N D                                     * */
+/* *             R T P S _ D A T A _ S E S S I O N                       * */
 /* *********************************************************************** */
 static void dissect_RTPS_DATA(tvbuff_t *tvb, 
                 gint offset, 
@@ -7312,12 +7566,13 @@
                 int octets_to_next_header, 
                 proto_tree *tree,
                 char * info_summary_text, 
-                guint16 vendor_id) {
+                guint16 vendor_id,
+		int is_session) {
   /* 
    *
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
-   * | RTPS_DATA     |X|X|X|X|X|D|Q|E|      octetsToNextHeader       | 
+   * | RTPS_DATA     |X|X|X|X|K|D|Q|E|      octetsToNextHeader       | 
    * +---------------+---------------+---------------+---------------+
    * | Flags extraFlags              |      octetsToInlineQos        | 
    * +---------------+---------------+---------------+---------------+
@@ -7334,7 +7589,34 @@
    * |                                                               |
    * +---------------+---------------+---------------+---------------+
    * |                                                               | 
-   * ~ SerializedData serializedData [only if D==1]                  ~
+   * ~ SerializedData serializedData [only if D==1 || K==1]          ~
+   * |                                                               |
+   * +---------------+---------------+---------------+---------------+
+   *
+   * 0...2...........7...............15.............23...............31
+   * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
+   * |RTPS_DATA_SESSI|X|X|X|X|K|D|Q|E|      octetsToNextHeader       | 
+   * +---------------+---------------+---------------+---------------+
+   * | Flags extraFlags              |      octetsToInlineQos        | 
+   * +---------------+---------------+---------------+---------------+
+   * | EntityId readerEntityId                                       |
+   * +---------------+---------------+---------------+---------------+
+   * | EntityId writerEntityId                                       |
+   * +---------------+---------------+---------------+---------------+
+   * |                                                               |
+   * + SequenceNumber writerSessionSeqNum                            +
+   * |                                                               |
+   * +---------------+---------------+---------------+---------------+
+   * |                                                               |
+   * + SequenceNumber writerVirtualSeqNum                            +
+   * |                                                               |
+   * +---------------+---------------+---------------+---------------+
+   * |                                                               |
+   * ~ ParameterList inlineQos [only if Q==1]                        ~
+   * |                                                               |
+   * +---------------+---------------+---------------+---------------+
+   * |                                                               | 
+   * ~ SerializedData serializedData [only if D==1 || K==1]          ~
    * |                                                               |
    * +---------------+---------------+---------------+---------------+
    */
@@ -7347,8 +7629,12 @@
 
   /* Calculates the minimum length for this submessage */
   min_len = 24;
+  if (is_session) {
+    min_len += 8;
+  }
   if ((flags & FLAG_RTPS_DATA_Q) != 0) min_len += 4;
   if ((flags & FLAG_RTPS_DATA_D) != 0) min_len += 4;
+  if ((flags & FLAG_RTPS_DATA_K) != 0) min_len += 4;
 
   if (octets_to_next_header < min_len) {
     proto_tree_add_uint_format(tree, 
@@ -7372,7 +7658,7 @@
     wid = NEXT_guint32(tvb, offset, little_endian);
  
     offset += 12;
-    if ((flags & FLAG_DATA_Q) != 0) {
+    if ((flags & FLAG_RTPS_DATA_Q) != 0) {
       offset = dissect_parameter_sequence(tree, 
                         tvb, 
                         offset, 
@@ -7437,15 +7723,30 @@
   offset += 4;
 
   /* Sequence number */
-  rtps_util_add_seq_number(tree,
+  if (is_session) {
+    rtps_util_add_seq_number(tree,
+                        tvb,
+                        offset,
+                        little_endian,
+                        "writerSessionSeqNumber");
+    offset += 8;
+    rtps_util_add_seq_number(tree,
+                        tvb,
+                        offset,
+                        little_endian,
+                        "writerVirtualSeqNumber");
+    offset += 8;
+  } else {
+    rtps_util_add_seq_number(tree,
                         tvb,
                         offset,
                         little_endian,
                         "writerSeqNumber");
-  offset += 8;
-  
+    offset += 8;
+  }
+
   /* InlineQos */
-  if ((flags & FLAG_DATA_Q) != 0) {
+  if ((flags & FLAG_RTPS_DATA_Q) != 0) {
     offset = dissect_parameter_sequence(tree, 
                         tvb, 
                         offset, 
@@ -7457,7 +7758,7 @@
   }
 
   /* SerializedData */
-  if ((flags & FLAG_DATA_D) != 0) {
+  if (((flags & FLAG_RTPS_DATA_D) != 0) || ((flags & FLAG_RTPS_DATA_K) != 0)) {
     if (wid == ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER) {
       /* Dissect the serialized data as ParticipantMessageData:
        *  struct ParticipantMessageData {
@@ -7466,13 +7767,47 @@
        *    sequence<octet> data;
        * }
        */
+      proto_tree * rtps_pm_tree;
       proto_tree * guid_tree;
       guint32 kind;
+      guint16 encapsulation_id;
+      guint16 encapsulation_len;
+      int encapsulation_little_endian = 0;
       proto_item * ti = proto_tree_add_text(tree,
                         tvb,
                         offset,
                         octets_to_next_header - (offset - old_offset) + 4,
                         "ParticipantMessageData");
+
+      rtps_pm_tree = proto_item_add_subtree(ti, ett_rtps_part_message_data);
+      /* Encapsulation ID */
+      encapsulation_id =  NEXT_guint16(tvb, offset, 0);   /* Always big endian */
+
+      proto_tree_add_text(rtps_pm_tree,
+                        tvb,
+                        offset,
+                        2,
+                        "encapsulation kind: %s",
+                        val_to_str(encapsulation_id,
+                        encapsulation_id_vals, "unknown (%02x)"));
+      offset += 2;
+
+      /* Sets the correct values for encapsulation_le */
+      if (encapsulation_id == ENCAPSULATION_CDR_LE ||
+          encapsulation_id == ENCAPSULATION_PL_CDR_LE) {
+        encapsulation_little_endian = 1;
+      }
+
+      /* Encapsulation length (or option) */
+      encapsulation_len =  NEXT_guint16(tvb, offset, 0);    /* Always big endian */
+      proto_tree_add_text(rtps_pm_tree,
+                        tvb,
+                        offset,
+                        2,
+                        "encapsulation options: %04x",
+                        encapsulation_len);
+      offset += 2;
+                        
       guid_tree = proto_item_add_subtree(ti,
                         ett_rtps_part_message_data);
           
@@ -7498,7 +7833,7 @@
             val_to_str(kind, participant_message_data_kind, "unknown (%04x)"));
       offset += 4;
 
-      dissect_octet_seq(guid_tree,
+      dissect_octet_seq(rtps_pm_tree, /* guid_tree, */
                         tvb, 
                         offset, 
                         "serializedData");
@@ -7534,7 +7869,7 @@
    *
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
-   * |RTPS_DATA_FRAG |X|X|X|X|X|X|Q|E|      octetsToNextHeader       | 
+   * |RTPS_DATA_FRAG |X|X|X|X|X|K|Q|E|      octetsToNextHeader       | 
    * +---------------+---------------+---------------+---------------+
    * | Flags extraFlags              |      octetsToInlineQos        | 
    * +---------------+---------------+---------------+---------------+
@@ -7594,7 +7929,7 @@
     wid = NEXT_guint32(tvb, offset, little_endian);
  
     offset += 24;
-    if ((flags & FLAG_DATA_Q) != 0) {
+    if ((flags & FLAG_RTPS_DATA_FRAG_Q) != 0) {
       offset = dissect_parameter_sequence(tree, 
                         tvb, 
                         offset, 
@@ -8235,7 +8570,15 @@
 
   if (is_ping) {
     g_strlcpy(info_summary_text, "PING", MAX_SUMMARY_SIZE);
+  } 
+#ifdef RTI_BUILD
+  else {
+    pinfo->guid_prefix_host = tvb_get_ntohl(tvb, offset + 8);
+    pinfo->guid_prefix_app  = tvb_get_ntohl(tvb, offset + 12);
+    pinfo->guid_prefix_count = tvb_get_ntohl(tvb, offset + 16);
+    pinfo->guid_rtps2 = 1;
   }
+#endif
 
   /* Extract the domain id and participant index for the default mapping */
   if (tree) {
@@ -8473,6 +8816,7 @@
         break;
 
 
+      case SUBMESSAGE_ACKNACK_SESSION:
       case SUBMESSAGE_ACKNACK_BATCH:
       case SUBMESSAGE_ACKNACK:
         dissect_ACKNACK(tvb, 
@@ -8496,6 +8840,7 @@
                         vendor_id);
         break;
 
+      case SUBMESSAGE_HEARTBEAT_SESSION:
       case SUBMESSAGE_HEARTBEAT_BATCH:
         dissect_HEARTBEAT_BATCH(tvb, 
                         offset, 
@@ -8584,6 +8929,7 @@
                         vendor_id);
         break;
 
+      case SUBMESSAGE_RTPS_DATA_SESSION:
       case SUBMESSAGE_RTPS_DATA:
         dissect_RTPS_DATA(tvb, 
                         offset, 
@@ -8592,7 +8938,8 @@
                         octets_to_next_header,
                         rtps_submessage_tree,
                         info_summary_text,
-                        vendor_id);
+                        vendor_id,
+			(submessageId == SUBMESSAGE_RTPS_DATA_SESSION));
         break;
         
       case SUBMESSAGE_RTPS_DATA_FRAG:
@@ -9221,6 +9568,7 @@
     &ett_rtps_wrentity,
     &ett_rtps_guid_prefix,
     &ett_rtps_part_message_data,
+    &ett_rtps_part_message_guid,
     &ett_rtps_locator_udp_v4,
     &ett_rtps_locator,
     &ett_rtps_locator_list,
@@ -9230,7 +9578,9 @@
     &ett_rtps_seq_ulong,
     &ett_rtps_serialized_data,
     &ett_rtps_sample_info_list,
-    &ett_rtps_sample_info
+    &ett_rtps_sample_info,
+    &ett_rtps_locator_filter_channel,
+    &ett_rtps_locator_filter_locator
   };
   module_t *rtps_module;
 
@@ -9242,13 +9592,22 @@
   proto_register_subtree_array(ett, array_length(ett));
 
   /* Registers the control in the preference panel */
-  rtps_module = prefs_register_protocol(proto_rtps, NULL);
+  rtps_module = prefs_register_protocol(proto_rtps, reinit_rtps);
+/*
+  prefs_register_bool_preference(rtps_module, "do_something",
+            "Do somethinig short description",
+            "Do something long and very exhaustive description "
+            "that can go on and on and on and on... ",
+            &glob_do_something);
+*/
   prefs_register_uint_preference(rtps_module, "max_batch_samples_dissected",
             "Max samples dissected for DATA_BATCH",
             "Specifies the maximum number of samples dissected in "
             "a DATA_BATCH submessage. Increasing this value may affect "
             "performances if the trace has a lot of big batched samples.",
             10, &rtps_max_batch_samples_dissected);
+
+
 }
 
 void proto_reg_handoff_rtps2(void) {
diff -urN wireshark-trunk/epan/dissectors/packet-rtps2.h wireshark-rti/epan/dissectors/packet-rtps2.h
--- wireshark-trunk/epan/dissectors/packet-rtps2.h	2009-03-03 16:31:53.000000000 -0800
+++ wireshark-rti/epan/dissectors/packet-rtps2.h	2009-03-03 16:41:29.000000000 -0800
@@ -5,8 +5,8 @@
  *
  * Copyright 2005, Fabrizio Bertocci <fabrizio@rti.com>
  * Real-Time Innovations, Inc.
- * 3975 Freedom Circle
- * Santa Clara, CA 95054
+ * 385 Moffett Park Drive
+ * Sunnyvale, CA 94089
  *
  * $Id$
  *
@@ -58,29 +58,30 @@
 
 
 typedef enum {
-    RTI_CDR_TK_NULL,
-    RTI_CDR_TK_SHORT,
-    RTI_CDR_TK_LONG,
-    RTI_CDR_TK_USHORT,
-    RTI_CDR_TK_ULONG,
-    RTI_CDR_TK_FLOAT,
-    RTI_CDR_TK_DOUBLE,
-    RTI_CDR_TK_BOOLEAN,
-    RTI_CDR_TK_CHAR,
-    RTI_CDR_TK_OCTET,
-    RTI_CDR_TK_STRUCT,
-    RTI_CDR_TK_UNION,
-    RTI_CDR_TK_ENUM,
-    RTI_CDR_TK_STRING,
-    RTI_CDR_TK_SEQUENCE,
-    RTI_CDR_TK_ARRAY,
-    RTI_CDR_TK_ALIAS,
-    RTI_CDR_TK_LONGLONG,
-    RTI_CDR_TK_ULONGLONG,
-    RTI_CDR_TK_LONGDOUBLE,
-    RTI_CDR_TK_WCHAR,
-    RTI_CDR_TK_WSTRING,
-    RTI_CDR_TK_VALUE
+    RTI_CDR_TK_NULL=0,          // 0
+    RTI_CDR_TK_SHORT,           // 1
+    RTI_CDR_TK_LONG,            // 2
+    RTI_CDR_TK_USHORT,          // 3
+    RTI_CDR_TK_ULONG,           // 4
+    RTI_CDR_TK_FLOAT,           // 5
+    RTI_CDR_TK_DOUBLE,          // 6
+    RTI_CDR_TK_BOOLEAN,         // 7
+    RTI_CDR_TK_CHAR,            // 8
+    RTI_CDR_TK_OCTET,           // 9
+    RTI_CDR_TK_STRUCT,          // 10
+    RTI_CDR_TK_UNION,           // 11
+    RTI_CDR_TK_ENUM,            // 12
+    RTI_CDR_TK_STRING,          // 13
+    RTI_CDR_TK_SEQUENCE,        // 14
+    RTI_CDR_TK_ARRAY,           // 15
+    RTI_CDR_TK_ALIAS,           // 16
+    RTI_CDR_TK_LONGLONG,        // 17
+    RTI_CDR_TK_ULONGLONG,       // 18
+    RTI_CDR_TK_LONGDOUBLE,      // 19
+    RTI_CDR_TK_WCHAR,           // 20
+    RTI_CDR_TK_WSTRING,         // 21
+    RTI_CDR_TK_VALUE,           // 22
+    RTI_CDR_TK_VALUE_PARARM     // 23
 } RTICdrTCKind;
 
 
@@ -120,6 +121,7 @@
 
 #define FLAG_RTPS_DATA_Q        (0x02)
 #define FLAG_RTPS_DATA_D        (0x04)
+#define FLAG_RTPS_DATA_K        (0x08)
 
 #define FLAG_RTPS_DATA_FRAG_Q   (0x02)
 
@@ -199,6 +201,9 @@
 #define PID_ENTITY_VIRTUAL_GUID                 (0x8002)
 #define PID_SERVICE_KIND                        (0x8003)
 #define PID_TYPECODE                            (0x8004)        /* Was: 0x47 in RTPS 1.2 */
+#define PID_DISABLE_POSITIVE_ACKS		(0x8005)
+#define PID_LOCATOR_FILTER_LIST			(0x8006)
+
 
 /* The following QoS are deprecated (used in RTPS 1.0 and older) */
 #define PID_PERSISTENCE                         (0x0003)
@@ -290,11 +295,14 @@
 #define SUBMESSAGE_NACK_FRAG                            (0x12)  /* RTPS 2.0 Only */
 #define SUBMESSAGE_HEARTBEAT_FRAG                       (0x13)  /* RTPS 2.0 Only */
 
+#define SUBMESSAGE_RTPS_DATA_SESSION                    (0x14)  /* RTPS 2.1 only */
 #define SUBMESSAGE_RTPS_DATA                            (0x15)  /* RTPS 2.1 only */
 #define SUBMESSAGE_RTPS_DATA_FRAG                       (0x16)  /* RTPS 2.1 only */
 #define SUBMESSAGE_ACKNACK_BATCH                        (0x17)  /* RTPS 2.1 only */
 #define SUBMESSAGE_RTPS_DATA_BATCH                      (0x18)  /* RTPS 2.1 Only */
 #define SUBMESSAGE_HEARTBEAT_BATCH                      (0x19)  /* RTPS 2.1 only */
+#define SUBMESSAGE_ACKNACK_SESSION                      (0x1a)  /* RTPS 2.1 only */
+#define SUBMESSAGE_HEARTBEAT_SESSION                    (0x1b)  /* RTPS 2.1 only */
 
 /* Data encapsulation */
 #define ENCAPSULATION_CDR_BE            (0x0000)
diff -urN wireshark-trunk/epan/dissectors/packet-rtps.c wireshark-rti/epan/dissectors/packet-rtps.c
--- wireshark-trunk/epan/dissectors/packet-rtps.c	2009-03-03 16:30:40.000000000 -0800
+++ wireshark-rti/epan/dissectors/packet-rtps.c	2009-03-03 16:40:44.000000000 -0800
@@ -5,8 +5,8 @@
  *
  * Copyright 2005, Fabrizio Bertocci <fabrizio@rti.com>
  * Real-Time Innovations, Inc.
- * 3975 Freedom Circle
- * Santa Clara, CA 95054
+ * 385 Moffett Park Drive
+ * Sunnyvale, CA 94089
  *
  * Copyright 2003, LUKAS POKORNY <maskis@seznam.cz>
  *                 PETR SMOLIK   <petr.smolik@wo.cz>
@@ -5644,6 +5644,11 @@
     }
   }
 
+#ifdef RTI_BUILD
+  pinfo->guid_prefix_host = tvb_get_ntohl(tvb, offset + 8);
+  pinfo->guid_prefix_app  = tvb_get_ntohl(tvb, offset + 12);
+#endif
+
   /* Extract the domain id and participant index */
   {
     int domain_id;
diff -urN wireshark-trunk/epan/dissectors/packet-rtps.h wireshark-rti/epan/dissectors/packet-rtps.h
--- wireshark-trunk/epan/dissectors/packet-rtps.h	2009-03-03 16:31:14.000000000 -0800
+++ wireshark-rti/epan/dissectors/packet-rtps.h	2009-03-03 16:37:13.000000000 -0800
@@ -5,8 +5,8 @@
  *
  * Copyright 2005, Fabrizio Bertocci <fabrizio@rti.com>
  * Real-Time Innovations, Inc.
- * 3975 Freedom Circle
- * Santa Clara, CA 95054
+ * 385 Moffett Park Drive, Suite 115
+ * Sunnyvale, CA 94089
  *
  * Copyright 2003, LUKAS POKORNY <maskis@seznam.cz>
  *                 PETR SMOLIK   <petr.smolik@wo.cz>
@@ -16,7 +16,7 @@
  *  Faculty of Electrical Engineering <www.fel.cvut.cz>
  *  Department of Control Engineering <dce.felk.cvut.cz>                
  *                   
- * $Id$
+ * $Id: $
  *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
