If it's used by dissectors, it belongs in to_str.h, not to_str-int.h.

Assuming *any* of the routines that generate printable strings should be
thought of as "for internal use by libwireshark routines only, not by
dissectors", the ones that *are* used by dissectors obviously shouldn't
be.  The ability for dissectors to register address types certainly
expands the list of routines they would use.

Move everything used by dissectors from to_str-int.h into to_str.h, and
have dissectors not include to_str-int.h.

(Perhaps we should just get rid of to_str-int.h altogether.)

Change-Id: I3c583351f038233c9bcd8f9216188f82630267fa
Reviewed-on: https://code.wireshark.org/review/11149
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-10-19 09:39:59 -07:00
parent 7fc88045ea
commit 90c4cbef19
10 changed files with 50 additions and 54 deletions

View File

@ -28,7 +28,7 @@
#include "packet-arcnet.h"
#include <epan/address_types.h>
#include <epan/arcnet_pids.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include "packet-ip.h"
void proto_register_arcnet(void);

View File

@ -36,7 +36,6 @@
#include <epan/reassemble.h>
#include <epan/address_types.h>
#include <epan/to_str.h>
#include <epan/to_str-int.h>
#include <wiretap/wtap.h>
#include "packet-atalk.h"
#include "packet-afp.h"

View File

@ -31,7 +31,7 @@
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/address_types.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include "packet-cip.h"
void proto_register_devicenet(void);

View File

@ -99,7 +99,7 @@
#include <epan/conversation_table.h>
#include <epan/uat.h>
#include <epan/eapol_keydes_types.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include "packet-wps.h"
#include "packet-e212.h"

View File

@ -70,7 +70,7 @@
#include <epan/prefs.h>
#include <epan/uat.h>
#include <epan/strutil.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include <epan/show_exception.h>
#include <wsutil/pint.h>

View File

@ -26,7 +26,7 @@
#include <epan/packet.h>
#include <epan/address_types.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
void proto_register_j1939(void);
void proto_reg_handoff_j1939(void);

View File

@ -35,7 +35,7 @@
#include <wiretap/wtap.h>
#include <epan/expert.h>
#include <epan/address_types.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include "packet-mstp.h"
void proto_register_mstp(void);

View File

@ -30,7 +30,7 @@
#include <epan/address_types.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <epan/to_str-int.h>
#include <epan/to_str.h>
#include "wsutil/pint.h"
/*

View File

@ -25,17 +25,6 @@
#include <glib.h>
/**
* word_to_hex()
*
* Output guint16 hex represetation to 'out', and return pointer after last character (out + 4).
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least 4 bytes in the buffer.
*/
char *word_to_hex(char *out, guint16 word);
/**
* word_to_hex_punct()
*
@ -59,17 +48,6 @@ char *word_to_hex_punct(char *out, guint16 word, char punct);
*/
char *word_to_hex_npad(char *out, guint16 word);
/**
* dword_to_hex()
*
* Output guint32 hex represetation to 'out', and return pointer after last character.
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least 8 bytes in the buffer.
*/
char *dword_to_hex(char *out, guint32 dword);
/**
* dword_to_hex_punct()
*
@ -105,17 +83,6 @@ char *qword_to_hex(char *out, guint64 qword);
*/
char *qword_to_hex_punct(char *out, guint64 qword, char punct);
/**
* bytes_to_hexstr()
*
* Output hex represetation of guint8 ad array, and return pointer after last character.
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least len * 2 bytes in the buffer.
*/
char *bytes_to_hexstr(char *out, const guint8 *ad, guint32 len);
/**
* bytes_to_hexstr_punct()
*
@ -174,17 +141,6 @@ char *hex_to_str_back(char *ptr, int len, guint32 value);
*/
char *hex64_to_str_back(char *ptr, int len, guint64 value);
/**
* uint_to_str_back()
*
* Output guint32 decimal representation backward (last character will be written on ptr - 1),
* and return pointer to first character.
*
* String is not NUL terminated by this routine.
* There needs to be at least 10 bytes in the buffer.
*/
char *uint_to_str_back(char *ptr, guint32 value);
/**
* uint64_str_back()
*

View File

@ -142,6 +142,28 @@ WS_DLL_PUBLIC gchar* tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb,
*/
WS_DLL_PUBLIC gchar* tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset, int length);
/**
* word_to_hex()
*
* Output guint16 hex represetation to 'out', and return pointer after last character (out + 4).
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least 4 bytes in the buffer.
*/
WS_DLL_PUBLIC char *word_to_hex(char *out, guint16 word);
/**
* dword_to_hex()
*
* Output guint32 hex represetation to 'out', and return pointer after last character.
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least 8 bytes in the buffer.
*/
WS_DLL_PUBLIC char *dword_to_hex(char *out, guint32 dword);
/** Turn an array of bytes into a string showing the bytes in hex.
*
* @param scope memory allocation scheme used
@ -164,8 +186,27 @@ WS_DLL_PUBLIC char *bytes_to_str(wmem_allocator_t *scope, const guint8 *bd, int
*/
WS_DLL_PUBLIC const gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct);
WS_DLL_PUBLIC char *
bytes_to_hexstr(char *out, const guint8 *ad, guint32 len);
/**
* bytes_to_hexstr()
*
* Output hex represetation of guint8 ad array, and return pointer after last character.
* It always output full representation (padded with 0).
*
* String is not NUL terminated by this routine.
* There needs to be at least len * 2 bytes in the buffer.
*/
WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const guint8 *ad, guint32 len);
/**
* uint_to_str_back()
*
* Output guint32 decimal representation backward (last character will be written on ptr - 1),
* and return pointer to first character.
*
* String is not NUL terminated by this routine.
* There needs to be at least 10 bytes in the buffer.
*/
WS_DLL_PUBLIC char *uint_to_str_back(char *ptr, guint32 value);
#ifdef __cplusplus
}