Ethereal-dev: RE: [Ethereal-dev] Creating a new Dissector

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

From: Richard Urwin <RUrwin@xxxxxxxxxxxxxx>
Date: Tue, 8 Oct 2002 09:48:36 +0100
Your disector contains the following code:

>	user_ip = tvb_get_letohl(tvb, offset);
>	proto_tree_add_ipv4 (ac_tree, ac_user_ip, tvb, offset + 4, 4,
user_ip);

This will not work on big-endian machines. 

As Brad wrote:
> There is a specific warning against this in doc/README.developer:
> NOTE: IPv4 addresses are not to be converted to host byte order before
> being passed to "proto_tree_add_ipv4()".  You should use
"tvb_memcpy()"
> to fetch them, not "tvb_get_ntohl()" *OR* "tvb_get_letohl()" - don't,
> for example, try to use "tvb_get_ntohl()", find that it gives you the
> wrong answer on the PC on which you're doing development, and try
> "tvb_get_letohl()" instead, as "tvb_get_letohl()" will give the wrong
> answer on big-endian machines.


--
Richard Urwin, Private
"No 9000 series computer has ever made a mitsake or corrubiteddatatato."




-----Original Message-----
From: pevee [mailto:clkuan@xxxxxxxxxxxxxxx]
Sent: 08 October 2002 04:11
To: Richard Sharpe
Cc: Ronnie Sahlberg; ethereal-dev@xxxxxxxxxxxx
Subject: Re: [Ethereal-dev] Creating a new Dissector


Hi, 

  whoppss...here is the dissector again...using C-style comment...

thank you :)


_____________________________________________________________________
This e-mail has been scanned for viruses by the WorldCom Internet
Managed Scanning Service - powered by MessageLabs. For further
information visit http://www.worldcom.com


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________