Ethereal-dev: [Ethereal-dev] What's the reason we have packet-dcerpc-epm.c and packet-dcerpc-e

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Sat, 18 Dec 2004 11:08:49 +0100
Hi List!

Why do we have both files?

I wanted to start a bugfix in the epm dissector (epm_dissect_tower being able to dissect both little and big endian, currently only able to dissect little endian)

Then I've noticed, that we have two files: packet-dcerpc-epm.c and ..._epm4.c, which have only minor differences.


I've compared both files (replacing all appearances of epm4 by epm, so my diff tool wasn't confused :-).

I've found the following differences (with line number), diff attached:

1) 76/733: of course the interface version number differs (3 / 4)
2) 274/305/421/717: recently done "RPC over HTTP" patch: only in epm but not in epm4, I would guess it's simply forgotten in epm4, should be copied to epm4 3) 399: little/big endian difference, I would guess that's a bug in epm or epm4, fixed only in one of the files

So the only real differences are bugfixes/enhancements only done in one of the two files, which should be fixed anyway.

Why do we have two files here then? Currently, this will only lead to maintenance problems like the ones described above.

Is there a reason against merging the two files together (putting both protocol dissectors in it), so people changing something in it will probably correctly change both versions?

Regards, ULFL


--- D:\ulfl\proj\Ethereal\subversion\epan\dissectors\packet-dcerpc-epm.c	Fri Dec 17 22:04:52 2004
+++ D:\ulfl\proj\Ethereal\subversion\epan\dissectors\packet-dcerpc-epm4.c	Sat Dec 18 10:32:05 2004
@@ -2,7 +2,7 @@
  * Routines for dcerpc endpoint mapper dissection
  * Copyright 2001, Todd Sabin <tas@xxxxxxxxxxx>
  *
- * $Id: packet-dcerpc-epm.c 12756 2004-12-15 09:10:07Z guy $
+ * $Id: packet-dcerpc-epm.c 11410 2004-07-18 18:06:47Z gram $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -67,14 +67,13 @@
 static int hf_epm_proto_ip = -1;
 static int hf_epm_proto_udp_port = -1;
 static int hf_epm_proto_tcp_port = -1;
-static int hf_epm_proto_http_port = -1;
 
 static gint ett_epm = -1;
 static gint ett_epm_tower_floor = -1;
 static gint ett_epm_entry = -1;
 
 static e_uuid_t uuid_epm = { 0xe1af8308, 0x5d1f, 0x11c9, { 0x91, 0xa4, 0x08, 0x00, 0x2b, 0x14, 0xa0, 0xfa } };
-static guint16  ver_epm = 3;
+static guint16  ver_epm = 4;
 
 static const value_string ep_service[] = {
 	{ 0, "rpc_c_ep_all_elts" },
@@ -271,7 +270,6 @@
 #define PROTO_ID_VINES_SPP	0x1a
 #define PROTO_ID_VINES_IPC	0x1b
 #define PROTO_ID_STREETTALK	0x1c
-#define PROTO_ID_HTTP		0x1f
 #define PROTO_ID_UNIX_DOMAIN	0x20
 #define PROTO_ID_NULL		0x21
 #define PROTO_ID_NETBIOS_3	0x22
@@ -302,7 +300,6 @@
 	{ PROTO_ID_VINES_SPP,		"Vines SPP"},
 	{ PROTO_ID_VINES_IPC,		"Vines IPC"},
 	{ PROTO_ID_STREETTALK,		"StreetTalk"},
-	{ PROTO_ID_HTTP, 		"RPC over HTTP"},
 	{ PROTO_ID_UNIX_DOMAIN,		"Unix Domain Socket"},
 	{ PROTO_ID_NULL,		"null"},
 	{ PROTO_ID_NETBIOS_3,		"NetBIOS"},
@@ -396,7 +393,7 @@
             break;
 
         case PROTO_ID_IP: /* this one is always big endian */
-            proto_tree_add_item(tr, hf_epm_proto_ip, tvb, offset, 4, FALSE);
+            proto_tree_add_item(tr, hf_epm_proto_ip, tvb, offset, 4, TRUE);
             proto_item_append_text(tr, "IP:%s", ip_to_str(tvb_get_ptr(tvb, offset, 4)));
             break;
 
@@ -418,11 +415,7 @@
             proto_tree_add_item(tr, hf_epm_proto_netbios_name, tvb, offset, len, TRUE);
             proto_item_append_text(tr, "NetBIOS:%*s",MIN(len,tvb_length_remaining(tvb, offset)), tvb_get_ptr(tvb, offset, -1)); 
             break;
-        case PROTO_ID_HTTP: /* RPC over HTTP */
-            proto_tree_add_item(tr, hf_epm_proto_http_port, tvb, offset, 2, FALSE);
-            proto_item_append_text(tr, "RPC over HTTP Port:%d", tvb_get_ntohs(tvb, offset));
-            break;
-			
+
         default:
             if(len){
                 proto_tree_add_text(tr, tvb, offset, len, "not decoded yet");
@@ -662,7 +655,7 @@
 void
 proto_register_epm (void)
 {
-    static hf_register_info hf[] = {
+	static hf_register_info hf[] = {
         { &hf_epm_opnum,
 	  { "Operation", "epm.opnum", FT_UINT16, BASE_DEC,
 	    NULL, 0x0, "Operation", HFILL }},
@@ -714,8 +707,6 @@
           { "UDP Port", "epm.proto.udp_port", FT_UINT16, BASE_DEC, NULL, 0x0, "UDP Port where this service can be found", HFILL }},
         { &hf_epm_proto_tcp_port,
           { "TCP Port", "epm.proto.tcp_port", FT_UINT16, BASE_DEC, NULL, 0x0, "TCP Port where this service can be found", HFILL }},
-        { &hf_epm_proto_http_port,
-          { "TCP Port", "epm.proto.http_port", FT_UINT16, BASE_DEC, NULL, 0x0, "TCP Port where this service can be found", HFILL }},      
         { &hf_epm_tower_rhs_len,
           { "RHS Length", "epm.tower.rhs.len", FT_UINT16, BASE_DEC, NULL, 0x0, "Length of RHS data", HFILL }},
         { &hf_epm_tower_lhs_len,
@@ -725,19 +716,20 @@
         { &hf_epm_tower_proto_id,
           { "Protocol", "epm.tower.proto_id", FT_UINT8, BASE_HEX, VALS(proto_id_vals), 0x0, "Protocol identifier", HFILL }}
     };
-    static gint *ett[] = {
-        &ett_epm,
-        &ett_epm_tower_floor,
-        &ett_epm_entry
-    };
-    proto_epm = proto_register_protocol ("DCE/RPC Endpoint Mapper", "EPM", "epm");
-    proto_register_field_array (proto_epm, hf, array_length (hf));
-    proto_register_subtree_array (ett, array_length (ett));
+
+	static gint *ett[] = {
+		&ett_epm,
+		&ett_epm_tower_floor,
+		&ett_epm_entry
+	};
+	proto_epm = proto_register_protocol ("DCE/RPC Endpoint Mapper4", "epm", "epm");
+	proto_register_field_array (proto_epm, hf, array_length (hf));
+	proto_register_subtree_array (ett, array_length (ett));
 }
 
 void
 proto_reg_handoff_epm (void)
 {
-    /* Register the protocol as dcerpc */
-    dcerpc_init_uuid (proto_epm, ett_epm, &uuid_epm, ver_epm, epm_dissectors, hf_epm_opnum);
+	/* Register the protocol as dcerpc */
+	dcerpc_init_uuid (proto_epm, ett_epm, &uuid_epm, ver_epm, epm_dissectors, hf_epm_opnum);
 }