diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2013-09-22 15:50:55 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2013-09-22 15:50:55 +0000 |
commit | a0c53ffaa1bb46d8c9db2ec739401aa411c9790e (patch) | |
tree | 56a11c9e0910032ad43476462dd2c95ed65e5cc1 /doc | |
parent | c4a608a94071f4a23eaf16fd3ab9545e26309f76 (diff) |
emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly
svn path=/trunk/; revision=52172
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.developer | 4 | ||||
-rw-r--r-- | doc/README.dissector | 44 |
2 files changed, 11 insertions, 37 deletions
diff --git a/doc/README.developer b/doc/README.developer index 4c5a85307c..b37dfa5417 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -577,8 +577,8 @@ the buffer. If you're fetching into such a chunk of memory a 2-byte Unicode string from the buffer, and the string has a specified size, you can use -"tvb_get_ephemeral_faked_unicode()", which will check whether the entire -string is present before allocating a buffer for the string, and will also +"tvb_get_faked_unicode()", which will check whether the entire string +is present before allocating a buffer for the string, and will also put a trailing '\0' at the end of the buffer. The resulting string will be a sequence of single-byte characters; the only Unicode characters that will be handled correctly are those in the ASCII range. (Wireshark's diff --git a/doc/README.dissector b/doc/README.dissector index e5082da767..cc13f265d6 100644 --- a/doc/README.dissector +++ b/doc/README.dissector @@ -251,42 +251,24 @@ void tvb_get_guid(tvbuff_t *tvb, const gint offset, e_guid_t *guid, const guint String accessors: -guint8 *tvb_get_string(tvbuff_t *tvb, const gint offset, const gint length); -gchar *tvb_get_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding); -guint8 *tvb_get_ephemeral_string(tvbuff_t *tvb, const gint offset, const gint length); -guint8 *tvb_get_ephemeral_string_enc(tvbuff_t *tvb, const gint offset, const gint length, const guint encoding); -gchar *tvb_get_ephemeral_unicode_string(tvbuff_t *tvb, const gint offset, gint length, const guint encoding); -guint8 *tvb_get_seasonal_string(tvbuff_t *tvb, const gint offset, const gint length); +guint8 *tvb_get_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint length); +gchar *tvb_get_unicode_string(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint length, const guint encoding); +guint8 *tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint length, const guint encoding); Returns a null-terminated buffer containing data from the specified tvbuff, starting at the specified offset, and containing the specified length worth of characters (the length of the buffer will be length+1, as it includes a null character to terminate the string). -tvb_get_string() returns a buffer allocated by g_malloc() so you must -g_free() it when you are finished with the string. Failure to g_free() this -buffer will lead to memory leaks. +tvb_get_string() returns a buffer allocated by g_malloc() if scope is set +to NULL (in that case memory must be explicitely freed), or with the +allocator lifetime if scope is not NULL. tvb_get_unicode_string() is a unicode (UTF-16) version of above. This is intended for reading UTF-16 unicode strings out of a tvbuff and returning them as a UTF-8 string for use in Wireshark. The offset and returned length pointer are in bytes, not UTF-16 characters. -tvb_get_ephemeral_string() returns a buffer allocated from a special heap -with a lifetime until the next packet is dissected. You do not need to -free() this buffer, it will happen automatically once the next packet is -dissected. - -tvb_get_ephemeral_unicode_string() is a unicode (UTF-16) version of above. -This is intended for reading UTF-16 unicode strings out of a tvbuff and -returning them as a UTF-8 string for use in Wireshark. The offset and -returned length pointer are in bytes, not UTF-16 characters. - -tvb_get_seasonal_string() returns a buffer allocated from a special heap -with a lifetime of the current capture session. You do not need to -free() this buffer, it will happen automatically once the a new capture or -file is opened. - guint8 *tvb_get_stringz(tvbuff_t *tvb, const gint offset, gint *lengthp); guint8 *tvb_get_stringz_enc(tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding); const guint8 *tvb_get_const stringz(tvbuff_t *tvb, const gint offset, gint *lengthp); @@ -327,13 +309,9 @@ with a lifetime of the current capture session. You do not need to free() this buffer, it will happen automatically once the a new capture or file is opened. -tvb_fake_unicode() has been superseded by tvb_get_unicode_string(), which +tvb_get_faked_unicode() has been superseded by tvb_get_string(), which properly handles Unicode (UTF-16) strings by converting them to UTF-8. -tvb_get_ephemeral_faked_unicode() has been superseded by -tvb_get_ephemeral_string(), which properly handles Unicode (UTF-16) strings by -converting them to UTF-8. - Byte Array Accessors: gchar *tvb_bytes_to_str(tvbuff_t *tvb, gint offset, gint len); @@ -366,13 +344,9 @@ guint8* tvb_memcpy(tvbuff_t *tvb, guint8* target, gint offset, gint length); Copies into the specified target the specified length's worth of data from the specified tvbuff, starting at the specified offset. -guint8* tvb_memdup(tvbuff_t *tvb, gint offset, gint length); -guint8* ep_tvb_memdup(tvbuff_t *tvb, gint offset, gint length); +guint8* tvb_memdup(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length); -Returns a buffer, allocated with "g_malloc()", containing the specified -length's worth of data from the specified tvbuff, starting at the -specified offset. The ephemeral variant is freed automatically after the -packet is dissected. +Returns a buffer, allocated with "g_malloc()" if scope is NULL, or with the specified pool. Pointer-retrieval: /* WARNING! Don't use this function. There is almost always a better way. |