ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: Re: [Ethereal-dev] Simple C datatype query

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Wed, 30 Mar 2005 20:47:22 +0200 (CEST)
On 30 Mar 2005, bunty  wrote:

> > If you want to add a string (FT_STRING), use BASE_NONE and the
> > appropriate proto_add_ function.
> Actually i am confused here on whether to use FT_STRING or FT_STRINGZ
> as my string is fix which is 8 bytes( that mean its NULL terminated) so
> should i use FT_STRINGZ or its ok to use FT_STRING.

Both should be possible. Presentation of FT_STRINGZ is a bit nicer.
See epan/dissectors/packet-tftp.c for examples of use.

> Also what about initializtion of string field in my case i did
>  static unsigned char* hf_myip_text = "NULL";
> what is right thing to assign string?

That should be
  static int hf_myip_text = -1;

> > You'll find a detailed description of the field types in the file
> > doc/README.developer.

> I read that but i found most explanation on integet types with
> its example but not for string data type.

Thats what the other dissectors are for. Monkey-see-monkey-do. :-)

Greetz