add new function dissect_dcerpc_uuid_t and let dissect_ndr_uuid_t call it
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 12 Jan 2005 21:20:50 +0000 (21:20 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 12 Jan 2005 21:20:50 +0000 (21:20 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13006 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-dcerpc-ndr.c
epan/dissectors/packet-dcerpc.c
epan/dissectors/packet-dcerpc.h
epan/dissectors/packet-dcom.c

index df2193ca72986407b291d860e205d9f926a65791..bfa3baad21b84fc888bbc905482ac5f99438b4a3 100644 (file)
@@ -192,10 +192,7 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
                     proto_tree *tree, guint8 *drep,
                     int hfindex, e_uuid_t *pdata)
 {
-    e_uuid_t uuid;
     dcerpc_info *di;
-    char uuid_str[DCERPC_UUID_STR_LEN]; 
-    int uuid_str_len;
 
     di=pinfo->private_data;
     if(di->conformant_run){
@@ -207,31 +204,8 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
     if (offset % 4) {
         offset += 4 - (offset % 4);
     }
-    dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
-    if (tree) {
-        /*
-         * XXX - look up the UUID to see if it's registered, and use
-         * the name of the protocol?  Unfortunately, we need the version
-         * as well.
-         */
-        uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN, 
-                                "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                                uuid.Data1, uuid.Data2, uuid.Data3,
-                                uuid.Data4[0], uuid.Data4[1],
-                                uuid.Data4[2], uuid.Data4[3],
-                                uuid.Data4[4], uuid.Data4[5],
-                                uuid.Data4[6], uuid.Data4[7]);
-        if (uuid_str_len >= DCERPC_UUID_STR_LEN)
-            memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
-        proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, 
-                                      uuid_str, "%s: %s",
-                                      proto_registrar_get_name(hfindex),
-                                      uuid_str);
-    }
-    if (pdata) {
-        *pdata = uuid;
-    }
-    return offset + 16;
+    return dissect_dcerpc_uuid_t (tvb, offset, pinfo,
+                                  tree, drep, hfindex, pdata);
 }
 
 /*
index 2e33fedc726439ceb08adffbbbf207c237e160d5..33860a8c584b57653e535d1d19b2d7cc1b9435e9 100644 (file)
@@ -1088,6 +1088,60 @@ dissect_dcerpc_double(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
 }
 
 
+int
+dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+                    proto_tree *tree, char *drep,
+                    int hfindex, e_uuid_t *pdata)
+{
+    e_uuid_t uuid;
+       header_field_info* hfi;
+#if 0
+       gchar *uuid_name;
+#endif
+
+
+    dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
+    if (tree) {
+               /* get name of protocol field to prepend it later */
+               hfi = proto_registrar_get_nth(hfindex);
+
+#if 0
+        /* XXX - get the name won't work correct, as we don't know the version of this uuid (if it has one) */
+               /* look for a registered uuid name */
+               uuid_name = dcerpc_get_uuid_name(&uuid, 0);
+
+               if (uuid_name) {
+                       /* we know the name of this uuid */
+                       proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
+                                      "%s: %s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
+                                                                         hfi->name, uuid_name,
+                                      uuid.Data1, uuid.Data2, uuid.Data3,
+                                      uuid.Data4[0], uuid.Data4[1],
+                                      uuid.Data4[2], uuid.Data4[3],
+                                      uuid.Data4[4], uuid.Data4[5],
+                                      uuid.Data4[6], uuid.Data4[7]);
+               } else {
+#endif
+                       /* we don't know the name of this uuid */
+                       proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
+                                      "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                                                                         hfi->name,
+                                      uuid.Data1, uuid.Data2, uuid.Data3,
+                                      uuid.Data4[0], uuid.Data4[1],
+                                      uuid.Data4[2], uuid.Data4[3],
+                                      uuid.Data4[4], uuid.Data4[5],
+                                      uuid.Data4[6], uuid.Data4[7]);
+#if 0
+               }
+#endif
+    }
+    if (pdata) {
+        *pdata = uuid;
+    }
+    return offset + 16;
+}
+
+
 /*
  * a couple simpler things
  */
index ce1b45dc42c7034bac453ca63353ce10b290130d..81f8bef23cb519a7978e9a63392dddbb959f5db4 100644 (file)
@@ -135,6 +135,10 @@ int dissect_dcerpc_double (tvbuff_t *tvb, gint offset, packet_info *pinfo,
 int dissect_dcerpc_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
                            proto_tree *tree, guint8 *drep, 
                            int hfindex, guint32 *pdata);
+int dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+                           proto_tree *tree, char *drep,
+                           int hfindex, e_uuid_t *pdata);
+
 /*
  * NDR routines for subdissectors.
  */
index 1bc0d14e565bff94e7c5c96842fe9be0617a0e1f..a4d08870e1078e178b45e98e8c7c458378145ffc 100644 (file)
@@ -670,56 +670,6 @@ gchar* dcom_uuid_to_str(e_uuid_t *uuid) {
 }
 
 
-#if 0
-/* currently unused (do not remove) */
-int
-dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
-                    proto_tree *tree, char *drep,
-                    int hfindex, e_uuid_t *pdata)
-{
-    e_uuid_t uuid;
-       gchar *uuid_name;
-       header_field_info* hfi;
-
-
-    dcerpc_tvb_get_uuid (tvb, offset, drep, &uuid);
-    if (tree) {
-               /* get name of protocol field to prepend it later */
-               hfi = proto_registrar_get_nth(hfindex);
-
-               /* look for a registered uuid name */
-               uuid_name = dcerpc_get_uuid_name(&uuid, 0);
-
-               if (uuid_name) {
-                       /* we know the name of this uuid */
-                       proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
-                                      "%s: %s (%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
-                                                                         hfi->name, uuid_name,
-                                      uuid.Data1, uuid.Data2, uuid.Data3,
-                                      uuid.Data4[0], uuid.Data4[1],
-                                      uuid.Data4[2], uuid.Data4[3],
-                                      uuid.Data4[4], uuid.Data4[5],
-                                      uuid.Data4[6], uuid.Data4[7]);
-               } else {
-                       /* we don't know the name of this uuid */
-                       proto_tree_add_string_format (tree, hfindex, tvb, offset, 16, "",
-                                      "%s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                                                                         hfi->name,
-                                      uuid.Data1, uuid.Data2, uuid.Data3,
-                                      uuid.Data4[0], uuid.Data4[1],
-                                      uuid.Data4[2], uuid.Data4[3],
-                                      uuid.Data4[4], uuid.Data4[5],
-                                      uuid.Data4[6], uuid.Data4[7]);
-               }
-    }
-    if (pdata) {
-        *pdata = uuid;
-    }
-    return offset + 16;
-}
-#endif
-
-
 /* dissect 64bits integer with alignment of 8 bytes (use this for VT_I8 type only) */
 int
 dissect_dcom_I8(tvbuff_t *tvb, gint offset, packet_info *pinfo,