Ethereal-dev: Re: [Ethereal-dev] Problem in linking the files

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 07 Dec 2004 10:59:48 -0800
harsha ss wrote:

    Thanks for your guidence,
  I want to display the hexdump i am reading on the third window.

What gets displayed in the third pane is the packet data. I presume what you mean by "the hexdump I am reading" is the packet data from your file. (If not, then what you're asking for is something other than what Ethereal does. It's not a hex editor, for example....)

But I am getting the hexdump in the rightmost side and the corresponding hex code in leftside ie immedeately after the line number.

Line number? There are no line numbers in the Ethereal hex dump pane, because Ethereal doesn't deal with text files, it deals with packets; a particular capture file might happen to be in the form of a text file, rather than a binary file, but that's intentionally and deliberately hidden from the rest of Ethereal by Wiretap.

The hex dump pane has:

	on the left, a hex value that's an offset in the packet data;

	in the middle, the hex data in the packet;

	to the left of that, the hex data in the packet, displayed as ASCII.

I want to know where the ascii values of my hexdump are converted to equivalant hexadecimal values.

If a capture file *happens* to be a text file rather than a binary file (most capture file formats are binary, not text!), then:

the Wiretap module for that file format will convert the text that corresponds to a hex dump of the packet into bytes - for example text such as

		FF 03 02 40 7B

would be converted to a sequence of bytes with values 0xff, 0x03, 0x02, 0x40, and 0x7B;

Ethereal would read that sequence of bytes - it would *NOT* get a sequence of characters 'F', 'F', ' ', '0', '3', ' ', '0', '2', ' ', '4', '0', ' ', '7', and 'B', it would get a sequence of bytes 0xff, 0x03, 0x02, 0x40, and 0x7B;

	it would process those bytes as packet data.

See, for example, the code to read Ascend files, "dbs-etherwatch.c", "toshiba.c", and "vms.c" for examples of code that reads text files.

I am reading the raw bytes as (guint8 *) from the read function in
  wiretap.

Note that "raw bytes", if the capture file is a text file, does *NOT* mean "the raw text from the file".

The first window displays the contents.
I saw in proto_draw.c I am not getting where exactly the bytes are converted to hex equivalant and printed.

It's done in "packet_hex_print_common()".