[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ethereal-dev
Subject:    Re: [ethereal-dev] Patches for SINEC H1-Dissector, request for CVS-tarballs
From:       Guy Harris <gharris () flashcom ! net>
Date:       2000-04-29 7:58:23
[Download RAW message or body]

> Btw.: A hint about the val_to_str function should be added to the
> README.developer.
> It's a very important function, because the simple match_strval leads to
> crashes with
> bogous packets. But I simply didn't found it earlier.......

I'll make the following change to "README.developer":

962c962,994
< 1.7 Editing Makefile.am and Makefile.nmake to add your dissector.
---
> 1.7 Utility routines
> 
> 1.7.1 match_strval and val_to_str
> 
> A dissector may need to convert a value to a string, using a
> 'value_string' structure, by hand, rather than by declaring a field with
> an associated 'value_string' structure; this might be used, for example,
> to generate a COL_INFO line for a frame.
> 
> 'match_strval()' will do that:
> 
> 	gchar*
> 	match_strval(guint32 val, const value_string *vs)
> 
> It will look up the value 'val' in the 'value_string' table pointed to
> by 'vs', and return either the corresponding string, or NULL if the
> value could not be found in the table.
> 
> 'val_to_str()' can be used to generate a string for values not found in
> the table:
> 
> 	gchar*
> 	val_to_str(guint32 val, const value_string *vs, const char *fmt)
> 
> If the value 'val' is found in the 'value_string' table pointed to by
> 'vs', 'val_to_str' will return the corresponding string; otherwise, it
> will use 'fmt' as an 'sprintf'-style format, with 'val' as an argument,
> to generate a string, and will return a pointer to that string. 
> (Currently, it has three 64-byte static buffers, and cycles through
> them; this permits the results of up to three calls to 'val_to_str' to
> be passed as arguments to a routine using those strings.)
> 
> 1.8 Editing Makefile.am and Makefile.nmake to add your dissector.
982c1014
< 1.8 Using the CVS source code tree.
---
> 1.9 Using the CVS source code tree.
984c1016
< 1.9 Submitting code for your new dissector.
---
> 1.10 Submitting code for your new dissector.

Other utility routines, such as the ones to translate network addresses
and the like to strings, should probably also be documented there.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic