aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-10-19 09:39:59 -0700
committerGuy Harris <guy@alum.mit.edu>2015-10-19 16:40:43 +0000
commit90c4cbef192b299b424d03a3de1727bf2dd0af4a (patch)
tree74889d41079450c9106f741c1c9d288bb24884ed /epan/to_str.h
parent7fc88045ea7ea36ee1b1c8a7bf57a112dbb838d6 (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>
Diffstat (limited to 'epan/to_str.h')
-rw-r--r--epan/to_str.h45
1 files changed, 43 insertions, 2 deletions
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
}