First pass pinfo->pool conversion

Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.

I also tweaked a few of the docs which got caught up.
pespin/rlcmac
Evan Huus 2021-07-16 11:36:34 -04:00 committed by Wireshark GitLab Utility
parent ef542759d0
commit d6d7dd1e56
194 changed files with 803 additions and 802 deletions

View File

@ -452,7 +452,7 @@ instead allocate a buffer dynamically using the string-specific or plain wmem
routines (see README.wmem) such as
wmem_strbuf_t *strbuf;
strbuf = wmem_strbuf_new(wmem_packet_scope(), "");
strbuf = wmem_strbuf_new(pinfo->pool, "");
wmem_strbuf_append_printf(strbuf, ...
or
@ -460,7 +460,7 @@ or
char *buffer=NULL;
...
#define MAX_BUFFER 1024
buffer=wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
buffer=wmem_alloc(pinfo->pool, MAX_BUFFER);
buffer[0]='\0';
...
snprintf(buffer, MAX_BUFFER, ...
@ -491,7 +491,7 @@ instead write the code as
static void
foo_to_str(char **buffer, ...
#define MAX_BUFFER x
*buffer=wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
*buffer=wmem_alloc(pinfo->pool, MAX_BUFFER);
<fill in *buffer>
}
...

View File

@ -122,7 +122,7 @@ actual dissector.
}
if (!pana_trans) {
/* create a "fake" pana_trans structure */
pana_trans=wmem_new(wmem_packet_scope(), pana_transaction_t);
pana_trans=wmem_new(pinfo->pool, pana_transaction_t);
pana_trans->req_frame = 0;
pana_trans->rep_frame = 0;
pana_trans->req_time = pinfo->fd->abs_ts;

View File

@ -54,17 +54,18 @@ changed without warning.
2.2 Wireshark Global Pools
Dissectors that include the wmem header file will have three pools available
to them automatically: wmem_packet_scope(), wmem_file_scope() and
wmem_epan_scope();
to them automatically: pinfo->pool, wmem_file_scope() and
wmem_epan_scope(); there is also a wmem_packet_scope() for cases when the
`pinfo` argument is not accessible, but pinfo->pool should be preferred.
The packet pool is scoped to the dissection of each packet, meaning that any
The pinfo pool is scoped to the dissection of each packet, meaning that any
memory allocated in it will be automatically freed at the end of the current
packet. The file pool is similarly scoped to the dissection of each file,
meaning that any memory allocated in it will be automatically freed when the
current capture file is closed.
NB: Using these pools outside of the appropriate scope (e.g. using the packet
pool when there isn't a packet being dissected) will throw an assertion.
NB: Using these pools outside of the appropriate scope (e.g. using the file
pool when there isn't a file open) will throw an assertion.
See the comment in epan/wmem/wmem_scopes.c for details.
The epan pool is scoped to the library's lifetime - memory allocated in it is

View File

@ -1188,7 +1188,7 @@ static int
dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
...
fooinfo = wmem_alloc(wmem_packet_scope(), sizeof(struct FooTap));
fooinfo = wmem_alloc(pinfo->pool, sizeof(struct FooTap));
fooinfo->packet_type = tvb_get_guint8(tvb, 0);
fooinfo->priority = tvb_get_ntohs(tvb, 8);
...

View File

@ -123,7 +123,7 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o
/** Initialize an address with the given values, allocating a new buffer
* for the address data using wmem-scoped memory.
*
* @param scope [in] The lifetime of the allocated memory, e.g., wmem_packet_scope()
* @param scope [in] The lifetime of the allocated memory, e.g., pinfo->pool
* @param addr [in,out] The address to initialize.
* @param addr_type [in] Address type.
* @param addr_len [in] The length in bytes of the address data. For example, 4 for
@ -154,7 +154,7 @@ alloc_address_wmem(wmem_allocator_t *scope, address *addr,
*
* Same as alloc_address_wmem but it takes a TVB and an offset.
*
* @param scope [in] The lifetime of the allocated memory, e.g., wmem_packet_scope()
* @param scope [in] The lifetime of the allocated memory, e.g., pinfo->pool
* @param addr [in,out] The address to initialize.
* @param addr_type [in] Address type.
* @param addr_len [in] The length in bytes of the address data. For example, 4 for
@ -258,7 +258,7 @@ copy_address_shallow(address *to, const address *from) {
/** Copy an address, allocating a new buffer for the address data
* using wmem-scoped memory.
*
* @param scope [in] The lifetime of the allocated memory, e.g., wmem_packet_scope()
* @param scope [in] The lifetime of the allocated memory, e.g., pinfo->pool
* @param to [in,out] The destination address.
* @param from [in] The source address.
*/
@ -279,7 +279,7 @@ copy_address(address *to, const address *from) {
/** Free an address allocated with wmem-scoped memory.
*
* @param scope [in] The lifetime of the allocated memory, e.g., wmem_packet_scope()
* @param scope [in] The lifetime of the allocated memory, e.g., pinfo->pool
* @param addr [in,out] The address whose data to free.
*/
static inline void

View File

@ -1322,7 +1322,7 @@ dissect_elf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
file_size = ehsize + (guint32)phnum * (guint32)phentsize + (guint32)shnum * (guint32)shentsize;
/* Collect infos for blackholes */
segment_info = (segment_info_t *) wmem_alloc(wmem_packet_scope(), sizeof(segment_info_t) * (shnum + phnum + 3));
segment_info = (segment_info_t *) wmem_alloc(pinfo->pool, sizeof(segment_info_t) * (shnum + phnum + 3));
segment_info[area_counter].offset = 0;
segment_info[area_counter].size = ehsize;
@ -1436,7 +1436,7 @@ dissect_elf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
if (segment_size) {
gchar *name;
name = wmem_strdup_printf(wmem_packet_scope(), "ProgramHeaderEntry #%u", phnum - i_16 - 1);
name = wmem_strdup_printf(pinfo->pool, "ProgramHeaderEntry #%u", phnum - i_16 - 1);
proto_tree_add_bytes_format(ph_entry_tree, hf_elf_segment, tvb, value_guard(p_offset), value_guard(segment_size), NULL, "Segment");

View File

@ -207,7 +207,7 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
ENDTRY;
if(proto_field_is_referenced(tree, hf_file_protocols)) {
wmem_strbuf_t *val = wmem_strbuf_new(wmem_packet_scope(), "");
wmem_strbuf_t *val = wmem_strbuf_new(pinfo->pool, "");
wmem_list_frame_t *frame;
/* skip the first entry, it's always the "frame" protocol */
frame = wmem_list_frame_next(wmem_list_head(pinfo->layers));

View File

@ -338,7 +338,7 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* GIF signature */
proto_tree_add_item_ret_string(gif_tree, &hfi_version,
tvb, offset, 6, ENC_ASCII|ENC_NA, wmem_packet_scope(), &ver_str);
tvb, offset, 6, ENC_ASCII|ENC_NA, pinfo->pool, &ver_str);
proto_item_append_text(ti, ", Version: %s", ver_str);
col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ver_str);
offset += 6;

View File

@ -836,7 +836,7 @@ dissect_mp4_box(guint32 parent_box_type _U_, guint depth,
return -1;
box_type = tvb_get_ntohl(tvb, offset+4);
box_type_str = tvb_get_string_enc(wmem_packet_scope(), tvb,
box_type_str = tvb_get_string_enc(pinfo->pool, tvb,
offset+4, 4, ENC_ASCII|ENC_NA);
box_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_mp4_box, &type_pi, "%s (%s)",

View File

@ -713,24 +713,24 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
proto_item_set_len(option_item, option_length + 2 * 2);
break;
} else if (option_code == 1) {
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_comment, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_comment, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
} else switch (block_type) {
case BLOCK_SECTION_HEADER:
switch (option_code) {
case 2:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_hardware, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_hardware, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
break;
case 3:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_os, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_os, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
break;
case 4:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_user_application, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_section_header_user_application, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
break;
@ -744,12 +744,12 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
switch (option_code) {
case 2:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_description_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_description_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
break;
case 3:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_description_description, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_description_description, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
break;
@ -768,8 +768,8 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += 4;
proto_item_append_text(option_item, " = %s/%s",
address_to_display(wmem_packet_scope(), &addr),
address_to_display(wmem_packet_scope(), &addr_mask));
address_to_display(pinfo->pool, &addr),
address_to_display(pinfo->pool, &addr_mask));
break;
case 5:
if (option_length != 17) {
@ -786,7 +786,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += 1;
proto_item_append_text(option_item, " = %s/%u",
address_to_display(wmem_packet_scope(), &addr), value_u32);
address_to_display(pinfo->pool, &addr), value_u32);
break;;
case 6:
@ -814,7 +814,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += 8;
proto_item_append_text(option_item, " = %s",
address_to_display(wmem_packet_scope(), &addr));
address_to_display(pinfo->pool, &addr));
break;
case 8:
@ -833,7 +833,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
} else if (value_u64 == 1000000000) {
const_str = "1 Gbps";
} else {
const_str = wmem_strdup_printf(wmem_packet_scope(), "%"G_GUINT64_FORMAT, value_u64);
const_str = wmem_strdup_printf(pinfo->pool, "%"G_GUINT64_FORMAT, value_u64);
}
proto_item_append_text(p_item, "%s", const_str);
proto_item_append_text(option_item, " = %s", const_str);
@ -864,7 +864,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
}
exponent = value_u8 & 0x7F;
strbuf = wmem_strbuf_new(wmem_packet_scope(), "");
strbuf = wmem_strbuf_new(pinfo->pool, "");
wmem_strbuf_append_printf(strbuf, "%u^-%u", base, exponent);
resolution = 1;
for (i = 0; i < exponent; i += 1)
@ -970,7 +970,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
switch (if_filter_type) {
case 0:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_filter_string, tvb, offset, option_length - 1, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_filter_string, tvb, offset, option_length - 1, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
break;
@ -988,7 +988,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
break;
case 12:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_os, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_os, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
@ -1022,7 +1022,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
break;
case 15:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_hardware, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_interface_hardware, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
@ -1074,7 +1074,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
case BLOCK_NAME_RESOLUTION:
switch (option_code) {
case 2:
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_dns_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_data_dns_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
proto_item_append_text(option_item, " = %s", str);
offset += option_length;
@ -1091,7 +1091,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += 4;
proto_item_append_text(option_item, " = %s",
address_to_display(wmem_packet_scope(), &addr));
address_to_display(pinfo->pool, &addr));
break;
case 4:
@ -1106,7 +1106,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += 16;
proto_item_append_text(option_item, " = %s",
address_to_display(wmem_packet_scope(), &addr));
address_to_display(pinfo->pool, &addr));
break;
default:
@ -1331,7 +1331,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
case BLOCK_DARWIN_PROCESS:
switch (option_code) {
case 2: /* Darwin Process Name */
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_darwin_process_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, wmem_packet_scope(), &str);
proto_tree_add_item_ret_display_string(option_tree, hf_pcapng_option_darwin_process_name, tvb, offset, option_length, ENC_NA | ENC_UTF_8, pinfo->pool, &str);
offset += option_length;
break;
@ -1341,7 +1341,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
offset += option_length;
proto_item_append_text(option_item, " = %s",
guid_to_str(wmem_packet_scope(), &uuid));
guid_to_str(pinfo->pool, &uuid));
break;
default:
@ -1709,7 +1709,7 @@ dissect_nrb_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
}
}
str = address_to_display(wmem_packet_scope(), &addr);
str = address_to_display(pinfo->pool, &addr);
break;
case 0x0002: /* IPv6 Record */
if (record_length < 17) {
@ -1740,7 +1740,7 @@ dissect_nrb_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
}
}
str = address_to_display(wmem_packet_scope(), &addr);
str = address_to_display(pinfo->pool, &addr);
break;
default:
@ -1917,9 +1917,9 @@ static gint dissect_block(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
info->darwin_process_event_number = 0;
info->frame_number = 1;
if (info->interfaces != NULL) {
wmem_free(wmem_packet_scope(), info->interfaces);
wmem_free(pinfo->pool, info->interfaces);
}
info->interfaces = wmem_array_new(wmem_packet_scope(), sizeof(struct interface_description));
info->interfaces = wmem_array_new(pinfo->pool, sizeof(struct interface_description));
if (tvb_memeql(tvb, 8, pcapng_big_endian_magic, BYTE_ORDER_MAGIC_SIZE) == 0) {
info->encoding = ENC_BIG_ENDIAN;
@ -2077,8 +2077,8 @@ dissect_pcapng(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
info.darwin_process_event_number = 0;
info.frame_number = 1;
info.encoding = encoding;
info.interfaces = wmem_array_new(wmem_packet_scope(), sizeof(struct interface_description));
info.darwin_process_events = wmem_array_new(wmem_packet_scope(), sizeof(struct darwin_process_event_description));
info.interfaces = wmem_array_new(pinfo->pool, sizeof(struct interface_description));
info.darwin_process_events = wmem_array_new(pinfo->pool, sizeof(struct darwin_process_event_description));
main_item = proto_tree_add_item(tree, proto_pcapng, tvb, offset, -1, ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_pcapng);

View File

@ -456,7 +456,7 @@ dissect_png(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *da
len_field = tvb_get_ntohl(tvb, offset);
type = tvb_get_ntohl(tvb, offset+4);
type_str = tvb_get_string_enc(wmem_packet_scope(),
type_str = tvb_get_string_enc(pinfo->pool,
tvb, offset+4, 4, ENC_ASCII|ENC_NA);
/* 4 byte len field, 4 byte chunk type, 4 byte CRC */

View File

@ -143,7 +143,7 @@ static void dissect_rbm_integer(tvbuff_t* tvb, packet_info* pinfo, proto_tree* t
proto_tree_add_int_format_value(tree, hf_rbm_integer, tvb, *offset, len, value, "%d", value);
*offset += len;
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%d", value);
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
static void dissect_rbm_basic(tvbuff_t* tvb _U_, packet_info* pinfo, proto_tree* tree _U_, guint* offset _U_, const guint8 subtype,
@ -179,10 +179,10 @@ static void dissect_rbm_string_data_trailer(tvbuff_t* tvb, packet_info* pinfo, p
get_rbm_integer(tvb, *offset, &value, &len);
proto_tree_add_int_format_value(tree, hf_rbm_length, tvb, *offset, len, value, "%d", value);
*offset += len;
s = (const char*)tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, value, ENC_NA);
s = (const char*)tvb_get_string_enc(pinfo->pool, tvb, *offset, value, ENC_NA);
proto_tree_add_string_format_value(tree, hf_rbm_string, tvb, *offset, value, s, "%s%s%s", prefix, s, trailer);
*offset += value;
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s", prefix, s, trailer);
*value_str = wmem_strdup_printf(pinfo->pool, "%s%s%s", prefix, s, trailer);
}
static void dissect_rbm_string_data(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, const gchar* label,
@ -214,7 +214,7 @@ static void dissect_rbm_array(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre
proto_item_set_len(array_tree, *offset - offset_start);
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%d", value);
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
static void dissect_rbm_hash(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
@ -248,7 +248,7 @@ static void dissect_rbm_hash(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree
proto_item_set_len(hash_tree, *offset - offset_start);
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%d", value);
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
static void dissect_rbm_link(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, guint8 subtype,
@ -269,14 +269,14 @@ static void dissect_rbm_link(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree
DISSECTOR_ASSERT_NOT_REACHED();
}
rbm_set_info(pinfo, wmem_strdup_printf(wmem_packet_scope(), "%s Link", label));
rbm_set_info(pinfo, wmem_strdup_printf(pinfo->pool, "%s Link", label));
get_rbm_integer(tvb, *offset, &value, &len);
proto_tree_add_int_format_value(tree, hf_rbm_link, tvb, *offset, len, value, "%d", value);
*offset += len;
if (type)
*type = label;
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%d", value);
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
static void dissect_rbm_double(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
@ -291,12 +291,12 @@ static void dissect_rbm_double(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr
get_rbm_integer(tvb, *offset, &value, &len);
proto_tree_add_int_format_value(tree, hf_rbm_length, tvb, *offset, len, value, "%d", value);
*offset += len;
s = (const char*)tvb_get_string_enc(wmem_packet_scope(), tvb, *offset, value, ENC_NA);
s = (const char*)tvb_get_string_enc(pinfo->pool, tvb, *offset, value, ENC_NA);
valued = g_ascii_strtod(s, NULL);
proto_tree_add_double(tree, hf_rbm_double, tvb, *offset, value, valued);
*offset += value;
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%f", valued);
*value_str = wmem_strdup_printf(pinfo->pool, "%f", valued);
}
static void dissect_rbm_struct_data(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
@ -313,7 +313,7 @@ static void dissect_rbm_struct_data(tvbuff_t* tvb, packet_info* pinfo, proto_tre
proto_tree_add_item(tree, hf_rbm_struct, tvb, *offset + 1, value, ENC_ASCII|ENC_NA);
*offset += 1 + value;
if (value_str)
*value_str = wmem_strdup_printf(wmem_packet_scope(), "%d", value);
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
static void dissect_rbm_string(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value)
@ -518,7 +518,7 @@ static gboolean dissect_rbm_header(tvbuff_t* tvb, packet_info* pinfo, proto_tree
major = tvb_get_guint8(tvb, *offset);
minor = tvb_get_guint8(tvb, *offset + 1);
version = wmem_strdup_printf(wmem_packet_scope(), "%u.%u", major, minor);
version = wmem_strdup_printf(pinfo->pool, "%u.%u", major, minor);
proto_tree_add_string_format(tree, hf_rbm_version, tvb, *offset, 2, version, "Version: %s", version);
*offset += 2;

View File

@ -198,7 +198,7 @@ dissect_rfc7468(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/*
* Extract the label, and put it in that subtree.
*/
label = wmem_strndup(wmem_packet_scope(), labelp, labellen);
label = wmem_strndup(pinfo->pool, labelp, labellen);
proto_tree_add_item(preeb_tree, hf_rfc7468_preeb_label, tvb,
offset + (int)preeb_prefix_len, labellen, ENC_ASCII|ENC_NA);

View File

@ -516,8 +516,8 @@ verify_password(tvbuff_t *tvb, const char *password)
gcry_md_hd_t md5_handle;
guint8 *digest;
workbuffer=wmem_alloc(wmem_packet_scope(), 32);
digest=wmem_alloc(wmem_packet_scope(), 16);
workbuffer=wmem_alloc(pinfo->pool, 32);
digest=wmem_alloc(pinfo->pool, 16);
length = tvb_get_ntohs(tvb, 6);
packetdata = tvb_get_ptr(tvb, 0, length);

View File

@ -628,7 +628,7 @@ decode_sse(proto_tree *ext_tree, packet_info *pinfo, tvbuff_t *tvb, int offset,
return;
}
msid_digits = (char *)wmem_alloc(wmem_packet_scope(), A11_MSG_MSID_LEN_MAX+2);
msid_digits = (char *)wmem_alloc(pinfo->pool, A11_MSG_MSID_LEN_MAX+2);
msid_start_offset = offset;
if (msid_len > A11_MSG_MSID_ELEM_LEN_MAX) {

View File

@ -1797,7 +1797,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg
/* Construct the next header for the UDP datagram. */
offset = BITS_TO_BYTE_LEN(0, bit_offset);
length = tvb_captured_length_remaining(tvb, offset);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(pinfo->pool, sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length);
nhdr_list->next = NULL;
nhdr_list->proto = IP_PROTO_UDP;
nhdr_list->length = length + (int)sizeof(struct udp_hdr);
@ -1815,7 +1815,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg
gint length;
offset = BITS_TO_BYTE_LEN(0, bit_offset);
length = tvb_captured_length_remaining(tvb, offset);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + length);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(pinfo->pool, sizeof(struct lowpan_nhdr) + length);
nhdr_list->next = NULL;
nhdr_list->proto = ipv6.ip6h_nxt;
nhdr_list->length = length;
@ -2086,7 +2086,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d
}
if (ipv6_summary_in_tree) {
address src_addr = ADDRESS_INIT(AT_IPv6, sizeof(ipv6.ip6h_src), &ipv6.ip6h_src);
proto_item_append_text(tree, ", Src: %s", address_with_resolution_to_str(wmem_packet_scope(), &src_addr));
proto_item_append_text(tree, ", Src: %s", address_with_resolution_to_str(pinfo->pool, &src_addr));
}
/* Add information about where the context came from. */
@ -2218,7 +2218,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d
}
if (ipv6_summary_in_tree) {
address dst_addr = ADDRESS_INIT(AT_IPv6, sizeof(ipv6.ip6h_dst), &ipv6.ip6h_dst);
proto_item_append_text(tree, ", Dest: %s", address_with_resolution_to_str(wmem_packet_scope(), &dst_addr));
proto_item_append_text(tree, ", Dest: %s", address_with_resolution_to_str(pinfo->pool, &dst_addr));
}
/* Add information about where the context came from. */
@ -2253,7 +2253,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d
/* Create an extension header for the remaining payload. */
else {
length = tvb_captured_length_remaining(tvb, offset);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + length);
nhdr_list = (struct lowpan_nhdr *)wmem_alloc(pinfo->pool, sizeof(struct lowpan_nhdr) + length);
nhdr_list->next = NULL;
nhdr_list->proto = ipv6.ip6h_nxt;
nhdr_list->length = length;
@ -2331,7 +2331,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
if (!iphc_tvb) return NULL;
/* Create the next header structure for the tunneled IPv6 header. */
nhdr = (struct lowpan_nhdr *)wmem_alloc0(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + tvb_captured_length(iphc_tvb));
nhdr = (struct lowpan_nhdr *)wmem_alloc0(pinfo->pool, sizeof(struct lowpan_nhdr) + tvb_captured_length(iphc_tvb));
nhdr->next = NULL;
nhdr->proto = IP_PROTO_IPV6;
nhdr->length = tvb_captured_length(iphc_tvb);
@ -2397,7 +2397,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
}
/* Create the next header structure for the IPv6 extension header. */
nhdr = (struct lowpan_nhdr *)wmem_alloc0(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + length);
nhdr = (struct lowpan_nhdr *)wmem_alloc0(pinfo->pool, sizeof(struct lowpan_nhdr) + length);
nhdr->next = NULL;
nhdr->proto = ext_proto;
nhdr->length = length;
@ -2463,7 +2463,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
else if (ipv6_ext.ip6e_nxt != IP_PROTO_NONE) {
/* Create another next header structure for the remaining payload. */
length = tvb_captured_length_remaining(tvb, offset);
nhdr->next = (struct lowpan_nhdr *)wmem_alloc(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + length);
nhdr->next = (struct lowpan_nhdr *)wmem_alloc(pinfo->pool, sizeof(struct lowpan_nhdr) + length);
nhdr->next->next = NULL;
nhdr->next->proto = ipv6_ext.ip6e_nxt;
nhdr->next->length = length;
@ -2610,7 +2610,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
/* Create the next header structure for the UDP datagram. */
length = tvb_captured_length_remaining(tvb, offset);
nhdr = (struct lowpan_nhdr *)wmem_alloc(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length);
nhdr = (struct lowpan_nhdr *)wmem_alloc(pinfo->pool, sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length);
nhdr->next = NULL;
nhdr->proto = IP_PROTO_UDP;
nhdr->length = length + (int)sizeof(struct udp_hdr);

View File

@ -1248,7 +1248,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tvb_s = (char *)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char *)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
if (!strcmp(tvb_s, "9P2000.L")) {
u32 = _9P2000_L;
@ -1318,7 +1318,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if(!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tvb_s = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
conv_set_fid(pinfo, fid, tvb_s, _9p_len+1);
}
offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_aname, ett_9P_aname);
@ -1337,7 +1337,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
fid_path = conv_get_fid(pinfo, fid);
proto_item_append_text(ti, " (%s)", fid_path);
if (!pinfo->fd->visited) {
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
tmppath = wmem_strbuf_sized_new(pinfo->pool, 0, MAXPATHLEN);
wmem_strbuf_append(tmppath, fid_path);
}
offset += 4;
@ -1353,7 +1353,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
for(i = 0 ; i < u16; i++) {
if (!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tvb_s = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
wmem_strbuf_append_c(tmppath, '/');
wmem_strbuf_append(tmppath, tvb_s);
}
@ -1430,10 +1430,10 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
tmppath = wmem_strbuf_sized_new(pinfo->pool, 0, MAXPATHLEN);
wmem_strbuf_append(tmppath, fid_path);
wmem_strbuf_append_c(tmppath, '/');
tvb_s = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
wmem_strbuf_append(tmppath, tvb_s);
}
offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_filename, ett_9P_filename);
@ -1463,10 +1463,10 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
tmppath = wmem_strbuf_sized_new(pinfo->pool, 0, MAXPATHLEN);
wmem_strbuf_append(tmppath, fid_path);
wmem_strbuf_append_c(tmppath, '/');
tvb_s = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
wmem_strbuf_append(tmppath, tvb_s);
}
offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_filename, ett_9P_filename);
@ -1808,11 +1808,11 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (!pinfo->fd->visited) {
_9p_len = tvb_get_letohs(tvb, offset);
tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN);
tmppath = wmem_strbuf_sized_new(pinfo->pool, 0, MAXPATHLEN);
wmem_strbuf_append(tmppath, conv_get_fid(pinfo, dfid));
wmem_strbuf_append_c(tmppath, '/');
tvb_s = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
tvb_s = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA);
wmem_strbuf_append(tmppath, tvb_s);
conv_set_fid(pinfo, fid, wmem_strbuf_get_str(tmppath), wmem_strbuf_get_len(tmppath)+1);

View File

@ -247,7 +247,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int is_
const char *frame_type;
char *info;
info = (char *)wmem_alloc(wmem_packet_scope(), 80);
info = (char *)wmem_alloc(pinfo->pool, 80);
/* Grab complete control field */
ctl = tvb_get_ntohs(tvb, 1) >> 4;

View File

@ -810,8 +810,8 @@ static int dissect_segment_ofstable(tvbuff_t * tvb, int offset, packet_info * pi
proto_tree_add_item(subtree, hf_lbmpdm_segment_res, tvb, offset + O_LBMPDM_SEG_HDR_T_RES, L_LBMPDM_SEG_HDR_T_RES, encoding);
proto_tree_add_item(subtree, hf_lbmpdm_segment_len, tvb, offset + O_LBMPDM_SEG_HDR_T_LEN, L_LBMPDM_SEG_HDR_T_LEN, encoding);
field_count = datalen / L_LBMPDM_OFFSET_ENTRY_T;
id_list = wmem_alloc_array(wmem_packet_scope(), gint32, field_count);
ofs_list = wmem_alloc_array(wmem_packet_scope(), gint32, field_count);
id_list = wmem_alloc_array(pinfo->pool, gint32, field_count);
ofs_list = wmem_alloc_array(pinfo->pool, gint32, field_count);
for (idx = 0; idx < field_count; ++idx)
{
id_list[idx] = -1;
@ -841,10 +841,10 @@ static int dissect_segment_ofstable(tvbuff_t * tvb, int offset, packet_info * pi
min_offset = ofs_list[idx];
}
}
ofs_table = wmem_new(wmem_packet_scope(), lbmpdm_offset_table_t);
ofs_table = wmem_new(pinfo->pool, lbmpdm_offset_table_t);
ofs_table->num_flds = max_index + 1;
ofs_table->min_set_offset = NULL;
ofs_table->offset_list = wmem_alloc_array(wmem_packet_scope(), gint32, ofs_table->num_flds);
ofs_table->offset_list = wmem_alloc_array(pinfo->pool, gint32, ofs_table->num_flds);
for (idx = 0; idx < (int)ofs_table->num_flds; ++idx)
{
ofs_table->offset_list[idx] = -1;

View File

@ -1209,7 +1209,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
break;
}
addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size);
addr=(guint8 *)wmem_alloc0(pinfo->pool, addr_size);
for(ax=0; ax+1 <= prefix_len_octets; ax++)
addr[ax]=tvb_get_guint8(tvb, offset+ax);
@ -1217,7 +1217,7 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
addr[ax-1] = addr[ax-1]&(0xFF<<(8-prefix_len%8));
set_address(&addr_str, addr_type, addr_size, addr);
str = address_to_str(wmem_packet_scope(), &addr_str);
str = address_to_str(pinfo->pool, &addr_str);
proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_pfval, tvb, offset, prefix_len_octets,
str, "Prefix: %s", str);
@ -1284,13 +1284,13 @@ dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tre
break;
}
addr=(guint8 *)wmem_alloc0(wmem_packet_scope(), addr_size);
addr=(guint8 *)wmem_alloc0(pinfo->pool, addr_size);
for(ax=0; ax+1 <= host_len; ax++)
addr[ax]=tvb_get_guint8(tvb, offset+ax);
set_address(&addr_str, addr_type, addr_size, addr);
str = address_to_str(wmem_packet_scope(), &addr_str);
str = address_to_str(pinfo->pool, &addr_str);
proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_hoval, tvb, offset, host_len,
str, "Address: %s", str);
@ -1680,7 +1680,7 @@ dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
offset+=2; rem-=2;
val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Addresses");
addr=(guint8 *)wmem_alloc(wmem_packet_scope(), addr_size);
addr=(guint8 *)wmem_alloc(pinfo->pool, addr_size);
for(ix=1; rem >= addr_size; ix++, offset += addr_size,
rem -= addr_size) {
@ -1689,7 +1689,7 @@ dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_
break;
set_address(&addr_str, addr_type, addr_size, addr);
str = address_to_str(wmem_packet_scope(), &addr_str);
str = address_to_str(pinfo->pool, &addr_str);
proto_tree_add_string_format(val_tree,
hf_ldp_tlv_addrl_addr, tvb, offset, addr_size, str,
"Address %u: %s", ix, str);

View File

@ -492,7 +492,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
/* Include new-line in line */
line = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, linelen, ENC_ASCII);
line = tvb_get_string_enc(pinfo->pool, tvb, offset, linelen, ENC_ASCII);
line_tree = proto_tree_add_subtree(ldss_tree, tvb, offset, linelen,
ett_ldss_transfer_req, NULL,

View File

@ -118,16 +118,16 @@ dissect_lithionics(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
lithionics_tree = proto_item_add_subtree(ti, ett_lithionics);
//just put the whole packet string (minus newlines) in the Info column
col_set_str(pinfo->cinfo, COL_INFO, (const gchar*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_reported_length_remaining(tvb, offset)-2, ENC_ASCII));
col_set_str(pinfo->cinfo, COL_INFO, (const gchar*)tvb_get_string_enc(pinfo->pool, tvb, offset, tvb_reported_length_remaining(tvb, offset)-2, ENC_ASCII));
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 1, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 1, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_battery_address, tvb, offset, 2, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_battery_address, tvb, offset, 2, value);
offset += 2;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 5, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 5, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_float_format_value(lithionics_tree, hf_lithionics_amp_hours_remain, tvb, offset, 6, 0.0, "<Invalid value \"%s\">", str);
else {
@ -136,7 +136,7 @@ dissect_lithionics(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
}
offset += 6;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 4, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 4, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_float_format_value(lithionics_tree, hf_lithionics_volts, tvb, offset, 5, 0.0, "<Invalid value \"%s\">", str);
else {
@ -145,28 +145,28 @@ dissect_lithionics(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
}
offset += 5;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 3, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 3, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_bat_gauge, tvb, offset, 4, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_bat_gauge, tvb, offset, 4, value);
offset += 4;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 3, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 3, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_soc, tvb, offset, 4, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_soc, tvb, offset, 4, value);
offset += 4;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 1, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 1, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_direction, tvb, offset, 2, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_direction, tvb, offset, 2, value);
offset += 2;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 5, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 5, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_float_format_value(lithionics_tree, hf_lithionics_amps, tvb, offset, 6, 0.0, "<Invalid value \"%s\">", str);
else {
@ -175,21 +175,21 @@ dissect_lithionics(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
}
offset += 6;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 6, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 6, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_watts, tvb, offset, 7, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_watts, tvb, offset, 7, value);
offset += 7;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 3, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 3, ENC_ASCII);
if (!ws_strtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_temperature, tvb, offset, 4, 0, "<Invalid value \"%s\">", str);
else
proto_tree_add_uint(lithionics_tree, hf_lithionics_temperature, tvb, offset, 4, value);
offset += 4;
str = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, 6, ENC_ASCII);
str = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, 6, ENC_ASCII);
//do this over proto_tree_add_bitmask_value to get better field highlighting
if (!ws_hexstrtou32(str, NULL, &value))
proto_tree_add_uint_format_value(lithionics_tree, hf_lithionics_system_status, tvb, offset, 7, 0, "<Invalid value \"%s\">", str);

View File

@ -1455,7 +1455,7 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
idType="MA";
strPtr = tvb_ether_to_str(tvb, offset);
proto_tree_add_item(chassis_tree, hf_chassis_id_mac, tvb, offset, 6, ENC_NA);
pn_lldp_column_info->chassis_id_mac = wmem_strdup(wmem_packet_scope(), strPtr);
pn_lldp_column_info->chassis_id_mac = wmem_strdup(pinfo->pool, strPtr);
offset += (dataLen - 1);
break;
}
@ -1496,7 +1496,7 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
break;
default:
strPtr = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, (dataLen-2));
strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-2));
proto_tree_add_item(chassis_tree, hf_chassis_id, tvb, offset, (dataLen-2), ENC_NA);
break;
@ -1532,7 +1532,7 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
case 7: /* Locally assigned */
idType="LA";
strPtr = tvb_format_stringzpad(tvb, offset, (dataLen-1));
pn_lldp_column_info->chassis_id_locally_assigned = wmem_strdup(wmem_packet_scope(), strPtr);
pn_lldp_column_info->chassis_id_locally_assigned = wmem_strdup(pinfo->pool, strPtr);
break;
case 1: /* Chassis component */
idType="CC";
@ -1540,7 +1540,7 @@ dissect_lldp_chassis_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
break;
case 3: /* Port component */
idType="PC";
strPtr = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, (dataLen-1));
strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-1));
break;
default:
@ -1669,7 +1669,7 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3
break;
default:
strPtr = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, (dataLen-2));
strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-2));
proto_tree_add_item(port_tree, hf_port_id, tvb, offset, (dataLen-2), ENC_ASCII|ENC_NA);
break;
@ -1698,7 +1698,7 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3
break;
case 2: /* Port component */
idType = "PC";
strPtr = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, (dataLen-1));
strPtr = tvb_bytes_to_str(pinfo->pool, tvb, offset, (dataLen-1));
break;
case 5: /* Interface name */
idType = "IN";
@ -1711,7 +1711,7 @@ dissect_lldp_port_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint3
case 7: /* Locally assigned */
idType = "LA";
strPtr = tvb_format_stringzpad(tvb, offset, (dataLen-1));
pn_lldp_column_info->port_id_locally_assigned = wmem_strdup(wmem_packet_scope(), strPtr);
pn_lldp_column_info->port_id_locally_assigned = wmem_strdup(pinfo->pool, strPtr);
break;
default:
idType = "Rs";
@ -3511,7 +3511,7 @@ set_name_of_station_for_profinet_specialized_column_info
{
pn_lldp_column_info->is_nos_assigned = TRUE;
pn_lldp_column_info->is_port_id_assigned = TRUE;
lldpPortIdCombinedWithNameOfStation = wmem_strdup(wmem_packet_scope(), pn_lldp_column_info->port_id_locally_assigned);
lldpPortIdCombinedWithNameOfStation = wmem_strdup(pinfo->pool, pn_lldp_column_info->port_id_locally_assigned);
tokenPortId = strtok(lldpPortIdCombinedWithNameOfStation, delimForProfinetv23);
tokenNameOfStation = strtok(NULL, delimForProfinetv23);
col_append_fstr(pinfo->cinfo, COL_INFO, "NoS = %s ", tokenNameOfStation);
@ -3717,37 +3717,37 @@ dissect_cisco_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
/* ACI */
case 0xc9: // 201 port-state, uint8
tf = proto_tree_add_item(tree, hf_cisco_aci_portstate, tvb, offset, length, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset++;
length--;
break;
case 0xca: // 202 node-role, uint8
tf = proto_tree_add_item(tree, hf_cisco_aci_noderole, tvb, offset, length, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset++;
length--;
break;
case 0xcb: // 203 node-id, uint32
tf = proto_tree_add_item(tree, hf_cisco_aci_nodeid, tvb, offset, length, ENC_BIG_ENDIAN);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += 4;
length -= 4;
break;
case 0xcc: // 204 spine-level, uint8
tf = proto_tree_add_item(tree, hf_cisco_aci_spinelevel, tvb, offset, length, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset++;
length--;
break;
case 0xcd: // 205 pod-id, uint16
tf = proto_tree_add_item(tree, hf_cisco_aci_podid, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += 2;
length -= 2;
break;
case 0xce: // 206 fabric-name, string
tf = proto_tree_add_item(tree, hf_cisco_aci_fabricname, tvb, offset, length, ENC_ASCII|ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += length;
length -= length;
break;
@ -3755,7 +3755,7 @@ dissect_cisco_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
proto_tree_add_item(tree, hf_cisco_aci_apiclist, tvb, offset, length, ENC_NA);
while (length > 0) {
tf = proto_tree_add_item(tree, hf_cisco_aci_apicid, tvb, offset, 1, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset++;
length--;
proto_tree_add_item(tree, hf_cisco_aci_apicipv4, tvb, offset, 4, ENC_NA);
@ -3768,31 +3768,31 @@ dissect_cisco_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
break;
case 0xd0: // 208 node-ip, ipv4
tf = proto_tree_add_item(tree, hf_cisco_aci_nodeip, tvb, offset, length, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += 4;
length -= 4;
break;
case 0xd1: // 209 port-role, uint8
tf = proto_tree_add_item(tree, hf_cisco_aci_portrole, tvb, offset, length, ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset++;
length--;
break;
case 0xd2: // 210 fw-ver, string
tf = proto_tree_add_item(tree, hf_cisco_aci_version, tvb, offset, length, ENC_ASCII|ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += length;
length -= length;
break;
case 0xd3: // 211 infra-vlan, uint16
tf = proto_tree_add_item(tree, hf_cisco_aci_fabricvlan, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += 2;
length -= 2;
break;
case 0xd4: // 212 serial-number, string
tf = proto_tree_add_item(tree, hf_cisco_aci_serialno, tvb, offset, length, ENC_ASCII|ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += length;
length -= length;
break;
@ -3802,37 +3802,37 @@ dissect_cisco_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
#endif
case 0xd6: // 214 model, string
tf = proto_tree_add_item(tree, hf_cisco_aci_model, tvb, offset, length, ENC_ASCII|ENC_NA);
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(wmem_packet_scope(), tf));
proto_item_append_text(parent_item, ": %s", proto_item_get_display_repr(pinfo->pool, tf));
offset += length;