diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-10-19 09:39:59 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-10-19 16:40:43 +0000 |
commit | 90c4cbef192b299b424d03a3de1727bf2dd0af4a (patch) | |
tree | 74889d41079450c9106f741c1c9d288bb24884ed | |
parent | 7fc88045ea7ea36ee1b1c8a7bf57a112dbb838d6 (diff) |
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>
-rw-r--r-- | epan/dissectors/packet-arcnet.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-atalk.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-devicenet.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-j1939.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mstp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-sna.c | 2 | ||||
-rw-r--r-- | epan/to_str-int.h | 44 | ||||
-rw-r--r-- | epan/to_str.h | 45 |
10 files changed, 50 insertions, 54 deletions
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c index c7fbfd1618..7aec361f56 100644 --- a/epan/dissectors/packet-arcnet.c +++ b/epan/dissectors/packet-arcnet.c @@ -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); diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index 85300f7128..be2b53db12 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -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" diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c index 9631e7afbe..4412654b1d 100644 --- a/epan/dissectors/packet-devicenet.c +++ b/epan/dissectors/packet-devicenet.c @@ -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); diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 75dc83fb68..2f281be87a 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -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" diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index f115d4c18c..e47b0901e7 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -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> diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c index 37cd4afbaa..70b144a970 100644 --- a/epan/dissectors/packet-j1939.c +++ b/epan/dissectors/packet-j1939.c @@ -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); diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c index 5e9448c174..d0d63c4949 100644 --- a/epan/dissectors/packet-mstp.c +++ b/epan/dissectors/packet-mstp.c @@ -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); diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index 3e506aa7f0..41fadf98c0 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -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" /* diff --git a/epan/to_str-int.h b/epan/to_str-int.h index 29dc88f65c..0013b780b8 100644 --- a/epan/to_str-int.h +++ b/epan/to_str-int.h @@ -26,17 +26,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() * * Output guint16 hex represetation to 'out', and return pointer after last character. @@ -60,17 +49,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() * * Output guint32 hex represetation to 'out', and return pointer after last character. @@ -106,17 +84,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() * * Output hex represetation of guint8 ad array, and return pointer after last character. @@ -175,17 +142,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() * * Output guint64 decimal representation backward (last character will be written on ptr - 1), diff --git a/epan/to_str.h b/epan/to_str.h index b89c9059f4..7475b0c672 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -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 } |