Ethereal-dev: Re: [ethereal-dev] Re: Sniffer 3.50 file format

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Fri, 23 Jun 2000 22:31:54 -0700
On Fri, Jun 23, 2000 at 10:16:53PM -0700, Guy Harris wrote:
> The general philosophy with Wiretap is that a new capture file type
> should be added for a new version of an existing file type only if the
> new version requires that the reader (and writer, if there's a writer)
> has to read the new version differently.

Make that "has to handle the new version differently.

> It looks, from your patch, as if the new format doesn't change anything
> we currently do, so I'm inclined to rename "WTAP_FILE_NETXRAY_2_001" to
> "WTAP_FILE_NETXRAY_2_00x" for now, and use it both for 2.001 and 2.002.

Here's a patch for the change; I just checked it in to CVS.
Index: file.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/file.c,v
retrieving revision 1.53
diff -c -r1.53 file.c
*** file.c	2000/05/25 09:00:20	1.53
--- file.c	2000/06/24 05:32:26
***************
*** 273,280 ****
  	{ "Network Associates Sniffer (Windows-based) 1.1", "ngwsniffer_1_1",
  	  netxray_dump_can_write_encap, netxray_dump_open_1_1 },
  
! 	/* WTAP_FILE_NETXRAY_2_001 */
! 	{ "Network Associates Sniffer (Windows-based) 2.001", NULL,
  	  NULL, NULL },
  
  	/* WTAP_FILE_RADCOM */
--- 273,280 ----
  	{ "Network Associates Sniffer (Windows-based) 1.1", "ngwsniffer_1_1",
  	  netxray_dump_can_write_encap, netxray_dump_open_1_1 },
  
! 	/* WTAP_FILE_NETXRAY_2_00x */
! 	{ "Network Associates Sniffer (Windows-based) 2.00x", NULL,
  	  NULL, NULL },
  
  	/* WTAP_FILE_RADCOM */
Index: netxray.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/netxray.c,v
retrieving revision 1.28
diff -c -r1.28 netxray.c
*** netxray.c	2000/05/19 23:06:58	1.28
--- netxray.c	2000/06/24 05:32:27
***************
*** 72,77 ****
--- 72,81 ----
  	'0', '0', '2', '.', '0', '0', '1', '\0'
  };
  
+ static const char vers_2_002[] = {
+ 	'0', '0', '2', '.', '0', '0', '2', '\0'
+ };
+ 
  /* NetXRay 1.x data record format - followed by frame data. */
  struct netxrayrec_1_x_hdr {
  	guint32	timelo;		/* lower 32 bits of time stamp */
***************
*** 164,173 ****
  		timeunit = 1000000.0;
  		version_major = 1;
  		file_type = WTAP_FILE_NETXRAY_1_1;
! 	} else if (memcmp(hdr.version, vers_2_001, sizeof vers_2_001) == 0) {
  		timeunit = 1000000.0;
  		version_major = 2;
! 		file_type = WTAP_FILE_NETXRAY_2_001;
  	} else {
  		g_message("netxray: version \"%.8s\" unsupported", hdr.version);
  		*err = WTAP_ERR_UNSUPPORTED;
--- 168,178 ----
  		timeunit = 1000000.0;
  		version_major = 1;
  		file_type = WTAP_FILE_NETXRAY_1_1;
! 	} else if (memcmp(hdr.version, vers_2_001, sizeof vers_2_001) == 0
! 	    || memcmp(hdr.version, vers_2_002, sizeof vers_2_002) == 0) {
  		timeunit = 1000000.0;
  		version_major = 2;
! 		file_type = WTAP_FILE_NETXRAY_2_00x;
  	} else {
  		g_message("netxray: version \"%.8s\" unsupported", hdr.version);
  		*err = WTAP_ERR_UNSUPPORTED;
Index: wtap.h
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/wtap.h,v
retrieving revision 1.72
diff -c -r1.72 wtap.h
*** wtap.h	2000/05/25 09:00:24	1.72
--- wtap.h	2000/06/24 05:32:28
***************
*** 115,121 ****
  #define WTAP_FILE_NETMON_2_x			12
  #define WTAP_FILE_NETXRAY_1_0			13
  #define WTAP_FILE_NETXRAY_1_1			14
! #define WTAP_FILE_NETXRAY_2_001			15
  #define WTAP_FILE_RADCOM			16
  #define WTAP_FILE_ASCEND			17
  #define WTAP_FILE_NETTL				18
--- 115,121 ----
  #define WTAP_FILE_NETMON_2_x			12
  #define WTAP_FILE_NETXRAY_1_0			13
  #define WTAP_FILE_NETXRAY_1_1			14
! #define WTAP_FILE_NETXRAY_2_00x			15
  #define WTAP_FILE_RADCOM			16
  #define WTAP_FILE_ASCEND			17
  #define WTAP_FILE_NETTL				18