Change some `wmem_packet_scope()` to `pinfo->pool`

This commit is contained in:
David Perry 2022-11-01 14:03:44 +00:00 committed by AndersBroman
parent dbc688ccb9
commit c18809a861
24 changed files with 361 additions and 358 deletions

View File

@ -4314,7 +4314,7 @@ dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
if (have_tap_listener(bluetooth_device_tap)) {
bluetooth_device_tap_t *tap_device;
tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
tap_device = wmem_new(pinfo->pool, bluetooth_device_tap_t);
tap_device->interface_id = interface_id;
tap_device->adapter_id = adapter_id;
memcpy(tap_device->bd_addr, bd_addr, 6);
@ -4353,7 +4353,7 @@ save_local_device_name_from_eir_ad(tvbuff_t *tvb, gint offset, packet_info *pinf
switch(tvb_get_guint8(tvb, offset + i + 1)) {
case 0x08: /* Device Name, shortened */
case 0x09: /* Device Name, full */
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + i + 2, length - 1, ENC_ASCII);
name = tvb_get_string_enc(pinfo->pool, tvb, offset + i + 2, length - 1, ENC_ASCII);
k_interface_id = bluetooth_data->interface_id;
k_adapter_id = bluetooth_data->adapter_id;
@ -4531,17 +4531,17 @@ get_bluetooth_uuid(tvbuff_t *tvb, gint offset, gint size)
}
const gchar *
print_numeric_bluetooth_uuid(bluetooth_uuid_t *uuid)
print_numeric_bluetooth_uuid(wmem_allocator_t *pool, bluetooth_uuid_t *uuid)
{
if (!(uuid && uuid->size > 0))
return NULL;
if (uuid->size != 16) {
return bytes_to_str(wmem_packet_scope(), uuid->data, uuid->size);
return bytes_to_str(pool, uuid->data, uuid->size);
} else {
gchar *text;
text = (gchar *) wmem_alloc(wmem_packet_scope(), 38);
text = (gchar *) wmem_alloc(pool, 38);
bytes_to_hexstr(&text[0], uuid->data, 4);
text[8] = '-';
bytes_to_hexstr(&text[9], uuid->data + 4, 2);
@ -4560,7 +4560,7 @@ print_numeric_bluetooth_uuid(bluetooth_uuid_t *uuid)
}
const gchar *
print_bluetooth_uuid(bluetooth_uuid_t *uuid)
print_bluetooth_uuid(wmem_allocator_t *pool, bluetooth_uuid_t *uuid)
{
const gchar *description;
@ -4584,7 +4584,7 @@ print_bluetooth_uuid(bluetooth_uuid_t *uuid)
*/
}
description = print_numeric_bluetooth_uuid(uuid);
description = print_numeric_bluetooth_uuid(pool, uuid);
if (description) {
description = (const gchar *) wmem_tree_lookup_string(bluetooth_uuids, description, 0);
@ -4627,7 +4627,7 @@ dissect_bluetooth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
main_item = proto_tree_add_item(tree, proto_bluetooth, tvb, 0, tvb_captured_length(tvb), ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_bluetooth);
bluetooth_data = (bluetooth_data_t *) wmem_new(wmem_packet_scope(), bluetooth_data_t);
bluetooth_data = (bluetooth_data_t *) wmem_new(pinfo->pool, bluetooth_data_t);
if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID)
bluetooth_data->interface_id = pinfo->rec->rec_header.packet_header.interface_id;
else
@ -4647,7 +4647,7 @@ dissect_bluetooth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (have_tap_listener(bluetooth_tap)) {
bluetooth_tap_data_t *bluetooth_tap_data;
bluetooth_tap_data = wmem_new(wmem_packet_scope(), bluetooth_tap_data_t);
bluetooth_tap_data = wmem_new(pinfo->pool, bluetooth_tap_data_t);
bluetooth_tap_data->interface_id = bluetooth_data->interface_id;
bluetooth_tap_data->adapter_id = bluetooth_data->adapter_id;

View File

@ -313,8 +313,8 @@ extern gint dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tre
guint32 interface_id, guint32 adapter_id, guint8 *bdaddr);
extern bluetooth_uuid_t get_bluetooth_uuid(tvbuff_t *tvb, gint offset, gint size);
WS_DLL_PUBLIC const gchar *print_bluetooth_uuid(bluetooth_uuid_t *uuid);
WS_DLL_PUBLIC const gchar *print_numeric_bluetooth_uuid(bluetooth_uuid_t *uuid);
WS_DLL_PUBLIC const gchar *print_bluetooth_uuid(wmem_allocator_t *pool, bluetooth_uuid_t *uuid);
WS_DLL_PUBLIC const gchar *print_numeric_bluetooth_uuid(wmem_allocator_t *pool, bluetooth_uuid_t *uuid);
extern void save_local_device_name_from_eir_ad(tvbuff_t *tvb, gint offset,
packet_info *pinfo, guint8 size, bluetooth_data_t *bluetooth_data);

View File

@ -4547,13 +4547,13 @@ static void col_append_info_by_handle(packet_info *pinfo, guint16 handle, blueto
if (!memcmp(&service_uuid, &uuid, sizeof(uuid))) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Handle: 0x%04x (%s)",
handle, print_bluetooth_uuid(&uuid));
handle, print_bluetooth_uuid(pinfo->pool, &uuid));
} else if (!memcmp(&characteristic_uuid, &uuid, sizeof(uuid))) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Handle: 0x%04x (%s: %s)",
handle, print_bluetooth_uuid(&service_uuid), print_bluetooth_uuid(&uuid));
handle, print_bluetooth_uuid(pinfo->pool, &service_uuid), print_bluetooth_uuid(pinfo->pool, &uuid));
} else {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Handle: 0x%04x (%s: %s: %s)",
handle, print_bluetooth_uuid(&service_uuid), print_bluetooth_uuid(&characteristic_uuid), print_bluetooth_uuid(&uuid));
handle, print_bluetooth_uuid(pinfo->pool, &service_uuid), print_bluetooth_uuid(pinfo->pool, &characteristic_uuid), print_bluetooth_uuid(pinfo->pool, &uuid));
}
}
@ -4569,7 +4569,7 @@ static gint dissect_gatt_uuid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv
} else if (tvb_reported_length_remaining(tvb, offset) == 16) {
sub_item = proto_tree_add_item(tree, hf_btatt_uuid128, tvb, offset, 16, ENC_NA);
sub_uuid = get_bluetooth_uuid(tvb, offset, 16);
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 16;
} else {
sub_item = proto_tree_add_item(tree, hf_btatt_value, tvb, offset, -1, ENC_NA);
@ -4609,7 +4609,7 @@ dissect_handle(proto_tree *tree, packet_info *pinfo, gint hf,
proto_item_append_text(handle_item, " (");
if (memcmp(&service_uuid, &attribute_uuid, sizeof(attribute_uuid))) {
if (service_uuid.size == 2 || service_uuid.size == 16) {
proto_item_append_text(handle_item, "%s: ", print_bluetooth_uuid(&service_uuid));
proto_item_append_text(handle_item, "%s: ", print_bluetooth_uuid(pinfo->pool, &service_uuid));
sub_tree = proto_item_add_subtree(handle_item, ett_btatt_handle);
if (service_uuid.size == 2)
@ -4623,7 +4623,7 @@ dissect_handle(proto_tree *tree, packet_info *pinfo, gint hf,
if (memcmp(&characteristic_uuid, &attribute_uuid, sizeof(attribute_uuid))) {
if (characteristic_uuid.size == 2 || characteristic_uuid.size == 16) {
proto_item_append_text(handle_item, "%s: ", print_bluetooth_uuid(&characteristic_uuid));
proto_item_append_text(handle_item, "%s: ", print_bluetooth_uuid(pinfo->pool, &characteristic_uuid));
sub_tree = proto_item_add_subtree(handle_item, ett_btatt_handle);
if (characteristic_uuid.size == 2)
@ -4635,7 +4635,7 @@ dissect_handle(proto_tree *tree, packet_info *pinfo, gint hf,
}
}
proto_item_append_text(handle_item, "%s)", print_bluetooth_uuid(&attribute_uuid));
proto_item_append_text(handle_item, "%s)", print_bluetooth_uuid(pinfo->pool, &attribute_uuid));
if (attribute_uuid.size == 2 || attribute_uuid.size == 16) {
sub_tree = proto_item_add_subtree(handle_item, ett_btatt_handle);
@ -4815,13 +4815,13 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
if (p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
guint8 *value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
/* hier wird subddisector aufgerufen */
/* dort wird auch von einem neuen PAket ausgegangen, was es natürlich nicht ist, darum fehelern und kein subddisector aufgerufen*/
if (dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), tvb, pinfo, tree, att_data))
if (dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), tvb, pinfo, tree, att_data))
return old_offset + length;
else if (!uuid.bt_uuid) {
if (bluetooth_gatt_has_no_parameter(att_data->opcode))
@ -4849,10 +4849,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
if (tvb_reported_length_remaining(tvb, offset) == 2) {
proto_tree_add_item(tree, hf_btatt_uuid16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
sub_uuid = get_bluetooth_uuid(tvb, offset, 2);
proto_item_append_text(patron_item, ", UUID: %s", print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(patron_item, ", UUID: %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(&sub_uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
save_handle(pinfo, sub_uuid, handle, ATTRIBUTE_TYPE_SERVICE, bluetooth_data);
}
@ -4860,10 +4860,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
{
proto_tree_add_item(tree, hf_btatt_uuid128, tvb, offset, 16, ENC_NA);
sub_uuid = get_bluetooth_uuid(tvb, offset, 16);
proto_item_append_text(patron_item, ", UUID128: %s", print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(patron_item, ", UUID128: %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 16;
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(&sub_uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
save_handle(pinfo, sub_uuid, handle, ATTRIBUTE_TYPE_SERVICE, bluetooth_data);
}
@ -4893,10 +4893,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
proto_tree_add_item(tree, hf_btatt_uuid16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
sub_uuid = get_bluetooth_uuid(tvb, offset, 2);
proto_item_append_text(patron_item, ", Included Handle: 0x%04x, UUID: %s", sub_handle, print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(patron_item, ", Included Handle: 0x%04x, UUID: %s", sub_handle, print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(&sub_uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
save_handle(pinfo, sub_uuid, sub_handle, ATTRIBUTE_TYPE_OTHER, bluetooth_data);
@ -4920,10 +4920,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
if (tvb_reported_length_remaining(tvb, offset) == 16) {
proto_tree_add_item(tree, hf_btatt_uuid128, tvb, offset, 16, ENC_NA);
sub_uuid = get_bluetooth_uuid(tvb, offset, 16);
proto_item_append_text(patron_item, ", Characteristic Handle: 0x%04x, UUID128: %s", tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN), print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(patron_item, ", Characteristic Handle: 0x%04x, UUID128: %s", tvb_get_guint16(tvb, offset - 2, ENC_LITTLE_ENDIAN), print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 16;
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(&sub_uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
save_handle(pinfo, sub_uuid, sub_handle, ATTRIBUTE_TYPE_CHARACTERISTIC, bluetooth_data);
}
@ -4931,10 +4931,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
{
proto_tree_add_item(tree, hf_btatt_uuid16, tvb, offset, 2, ENC_LITTLE_ENDIAN);
sub_uuid = get_bluetooth_uuid(tvb, offset, 2);
proto_item_append_text(patron_item, ", Characteristic Handle: 0x%04x, UUID: %s", sub_handle, print_bluetooth_uuid(&sub_uuid));
proto_item_append_text(patron_item, ", Characteristic Handle: 0x%04x, UUID: %s", sub_handle, print_bluetooth_uuid(pinfo->pool, &sub_uuid));
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(&sub_uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", print_bluetooth_uuid(pinfo->pool, &sub_uuid));
save_handle(pinfo, sub_uuid, sub_handle, ATTRIBUTE_TYPE_CHARACTERISTIC, bluetooth_data);
} else {
@ -5242,7 +5242,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
characteristic_uuid = get_characteristic_uuid_from_handle(pinfo, handle, bluetooth_data);
characteristic_dissector_name = wmem_strdup_printf(pinfo->pool, "btgatt.uuid0x%s", print_numeric_bluetooth_uuid(&characteristic_uuid));
characteristic_dissector_name = wmem_strdup_printf(pinfo->pool, "btgatt.uuid0x%s", print_numeric_bluetooth_uuid(pinfo->pool, &characteristic_uuid));
characteristic_dissector = find_dissector(characteristic_dissector_name);
sub_item = proto_tree_add_item(tree, hf_btatt_valid_range_lower_inclusive_value, tvb, offset, tvb_reported_length_remaining(tvb, offset) / 2, ENC_NA);
@ -11175,7 +11175,7 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
offset += 2;
proto_item_append_text(sub_item, ", Handle: 0x%04x, UUID: %s",
handle, print_bluetooth_uuid(&uuid));
handle, print_bluetooth_uuid(pinfo->pool, &uuid));
save_handle(pinfo, uuid, handle, ATTRIBUTE_TYPE_OTHER, bluetooth_data);
@ -11195,7 +11195,7 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
offset += 16;
proto_item_append_text(sub_item, ", Handle: 0x%04x, UUID: %s",
handle, print_bluetooth_uuid(&uuid));
handle, print_bluetooth_uuid(pinfo->pool, &uuid));
save_handle(pinfo, uuid, handle, ATTRIBUTE_TYPE_OTHER, bluetooth_data);

View File

@ -180,7 +180,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
uuid.data[0] = pid >> 8;
uuid.data[1] = pid & 0xFF;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
@ -217,7 +217,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
uuid.data[0] = pid >> 8;
uuid.data[1] = pid & 0xFF;
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), next_tvb, pinfo, tree, avctp_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), next_tvb, pinfo, tree, avctp_data)) {
call_data_dissector(next_tvb, pinfo, tree);
}
@ -382,7 +382,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
uuid.data[0] = fragments->pid >> 8;
uuid.data[1] = fragments->pid & 0xFF;
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), next_tvb, pinfo, tree, avctp_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), next_tvb, pinfo, tree, avctp_data)) {
call_data_dissector(next_tvb, pinfo, tree);
}
}

View File

@ -9038,7 +9038,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(uuid.bt_uuid, &bluetooth_uuid_vals_ext, "Unknown"));
} else {
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid_32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(&uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(pinfo->pool, &uuid));
}
offset += 4;
@ -9052,12 +9052,12 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
while (offset < end_offset) {
uuid = get_bluetooth_uuid(tvb, offset, 16);
if (uuid.bt_uuid) {
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(&uuid));
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(uuid.bt_uuid, &bluetooth_uuid_vals_ext, "Unknown"));
}
else {
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_custom_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(&uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(&uuid));
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_custom_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(pinfo->pool, &uuid));
}
offset += 16;
@ -9180,7 +9180,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
if (length - 2 > 0) {
uuid = get_bluetooth_uuid(tvb, offset-2, 2);
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(&uuid),
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(pinfo->pool, &uuid),
tvb_new_subset_length(tvb, offset, length - 2), pinfo, entry_tree, bluetooth_eir_ad_data)) {
proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_service_data, tvb, offset, length - 2, ENC_NA);
}
@ -9189,7 +9189,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
break;
case 0x20: /* Service Data - 32 bit UUID */
uuid = get_bluetooth_uuid(tvb, offset, 4);
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(&uuid),
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(pinfo->pool, &uuid),
tvb_new_subset_length(tvb, offset + 4, length - 4), pinfo, entry_tree, bluetooth_eir_ad_data)) {
if (uuid.bt_uuid) {
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_uuid_32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@ -9197,7 +9197,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
}
else {
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_custom_uuid_32, tvb, offset, 4, ENC_LITTLE_ENDIAN);
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(&uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(pinfo->pool, &uuid));
}
}
offset += 4;
@ -9209,15 +9209,15 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
break;
case 0x21: /* Service Data - 128 bit UUID */
uuid = get_bluetooth_uuid(tvb, offset, 16);
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(&uuid),
if (!dissector_try_string(bluetooth_eir_ad_service_uuid, print_numeric_bluetooth_uuid(pinfo->pool, &uuid),
tvb_new_subset_length(tvb, offset + 16, length - 16), pinfo, entry_tree, bluetooth_eir_ad_data)) {
if (uuid.bt_uuid) {
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(&uuid));
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
proto_item_append_text(sub_item, " (%s)", val_to_str_ext_const(uuid.bt_uuid, &bluetooth_uuid_vals_ext, "Unknown"));
}
else {
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_custom_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(&uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(&uuid));
sub_item = proto_tree_add_bytes_format_value(entry_tree, hf_btcommon_eir_ad_custom_uuid_128, tvb, offset, 16, uuid.data, "%s", print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
proto_item_append_text(sub_item, " (%s)", print_bluetooth_uuid(pinfo->pool, &uuid));
}
}
offset += 16;

View File

@ -1982,7 +1982,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (bt_uuid && p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
gchar *value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
@ -2002,7 +2002,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), next_tvb, pinfo, tree, l2cap_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), next_tvb, pinfo, tree, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
@ -2099,7 +2099,7 @@ dissect_le_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (bt_uuid && p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
gchar *value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
@ -2141,7 +2141,7 @@ dissect_le_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32)cid, new_tvb, pinfo, tree, TRUE, l2cap_data)) {
if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32)psm, new_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), new_tvb, pinfo, tree, l2cap_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), new_tvb, pinfo, tree, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
@ -2307,7 +2307,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (bt_uuid && p_get_proto_data(pinfo->pool, pinfo, proto_btl2cap, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
gchar *value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_btl2cap, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
@ -2325,7 +2325,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* call next dissector */
if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), next_tvb, pinfo, tree, l2cap_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), next_tvb, pinfo, tree, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_reported_length(next_tvb), ENC_NA);
}
@ -2666,12 +2666,12 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (bt_uuid && p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID ) == NULL) {
gchar* value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&uuid), next_tvb, pinfo, tree, l2cap_data)) {
if (!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &uuid), next_tvb, pinfo, tree, l2cap_data)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}

View File

@ -736,7 +736,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
val_to_str_const(frame_type, vs_frame_type_short, "Unknown"), dlci >> 1);
if (dlci && (frame_type == FRAME_TYPE_SABM) && service_info) {
if (service_info->uuid.size==16)
col_append_fstr(pinfo->cinfo, COL_INFO, "(UUID128: %s) ", print_bluetooth_uuid(&service_info->uuid));
col_append_fstr(pinfo->cinfo, COL_INFO, "(UUID128: %s) ", print_bluetooth_uuid(pinfo->pool, &service_info->uuid));
else
col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ",
val_to_str_ext_const(service_info->uuid.bt_uuid, &bluetooth_uuid_vals_ext, "Unknown"));
@ -845,7 +845,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
p_get_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID) == NULL) {
guint8 *value_data;
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(&service_info->uuid));
value_data = wmem_strdup(wmem_file_scope(), print_numeric_bluetooth_uuid(pinfo->pool, &service_info->uuid));
p_add_proto_data(pinfo->pool, pinfo, proto_bluetooth, PROTO_DATA_BLUETOOTH_SERVICE_UUID, value_data);
}
@ -853,7 +853,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
if (!dissector_try_uint_new(rfcomm_dlci_dissector_table, (guint32) dlci,
next_tvb, pinfo, tree, TRUE, rfcomm_data)) {
if (service_info && (service_info->uuid.size == 0 ||
!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(&service_info->uuid),
!dissector_try_string(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pinfo->pool, &service_info->uuid),
next_tvb, pinfo, tree, rfcomm_data))) {
decode_by_dissector = find_proto_by_channel(dlci >> 1);
if (rfcomm_channels_enabled && decode_by_dissector) {

View File

@ -1131,7 +1131,7 @@ service_info_t* btsdp_get_service_info(wmem_tree_key_t* key)
}
static bluetooth_uuid_t
get_specified_uuid(wmem_array_t *uuid_array)
get_specified_uuid(wmem_allocator_t *pool, wmem_array_t *uuid_array)
{
bluetooth_uuid_t uuid;
@ -1151,7 +1151,7 @@ get_specified_uuid(wmem_array_t *uuid_array)
break;
if (p_uuid->size == 0)
continue;
if (dissector_get_string_handle(bluetooth_uuid_table, print_numeric_bluetooth_uuid(p_uuid)))
if (dissector_get_string_handle(bluetooth_uuid_table, print_numeric_bluetooth_uuid(pool, p_uuid)))
break;
}
@ -1376,7 +1376,7 @@ get_int_by_size(tvbuff_t *tvb, gint off, gint size)
}
static gint
dissect_uuid(proto_tree *tree, tvbuff_t *tvb, gint offset, gint size, bluetooth_uuid_t *uuid)
dissect_uuid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, gint size, bluetooth_uuid_t *uuid)
{
proto_item *item;
@ -1398,7 +1398,7 @@ dissect_uuid(proto_tree *tree, tvbuff_t *tvb, gint offset, gint size, bluetooth_
item = proto_tree_add_item(tree, hf_data_element_value_uuid, tvb, offset, size, ENC_NA);
x_uuid = get_bluetooth_uuid(tvb, offset, size);
proto_item_append_text(item, " (%s)", print_bluetooth_uuid(&x_uuid));
proto_item_append_text(item, " (%s)", print_bluetooth_uuid(pinfo->pool, &x_uuid));
uuid->bt_uuid = 0;
}
@ -2011,9 +2011,9 @@ dissect_protocol_descriptor_list(proto_tree *next_tree, tvbuff_t *tvb,
new_offset = get_type_length(tvb, entry_offset, &length);
entry_offset = new_offset;
dissect_uuid(sub_tree, tvb, entry_offset, length, &uuid);
dissect_uuid(sub_tree, pinfo, tvb, entry_offset, length, &uuid);
uuid_str = print_bluetooth_uuid(&uuid);
uuid_str = print_bluetooth_uuid(pinfo->pool, &uuid);
wmem_strbuf_append(info_buf, uuid_str);
proto_item_append_text(feature_item, ": %s", uuid_str);
proto_item_append_text(entry_item, ": %s", uuid_str);
@ -3305,9 +3305,9 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
dissect_data_element(next_tree, &entry_tree, pinfo, tvb, list_offset);
list_offset = get_type_length(tvb, list_offset, &list_length);
dissect_uuid(entry_tree, tvb, list_offset, list_length, &uuid);
dissect_uuid(entry_tree, pinfo, tvb, list_offset, list_length, &uuid);
wmem_strbuf_append(info_buf, print_bluetooth_uuid(&uuid));
wmem_strbuf_append(info_buf, print_bluetooth_uuid(pinfo->pool, &uuid));
list_offset += list_length;
if (list_offset - offset < size)
@ -3320,8 +3320,8 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
wmem_strbuf_append_printf(info_buf, "0x%08x (%u)", value, value);
break;
case 0x003:
dissect_uuid(next_tree, tvb, offset, size, &uuid);
wmem_strbuf_append(info_buf, print_bluetooth_uuid(&uuid));
dissect_uuid(next_tree, pinfo, tvb, offset, size, &uuid);
wmem_strbuf_append(info_buf, print_bluetooth_uuid(pinfo->pool, &uuid));
break;
case 0x004:
protocol_order = 0;
@ -3334,9 +3334,9 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
dissect_data_element(next_tree, &entry_tree, pinfo, tvb, list_offset);
list_offset = get_type_length(tvb, list_offset, &list_length);
dissect_uuid(entry_tree, tvb, list_offset, list_length, &uuid);
dissect_uuid(entry_tree, pinfo, tvb, list_offset, list_length, &uuid);
wmem_strbuf_append(info_buf, print_bluetooth_uuid(&uuid));
wmem_strbuf_append(info_buf, print_bluetooth_uuid(pinfo->pool, &uuid));
list_offset += list_length;
if (list_offset - offset < size)
@ -3403,9 +3403,9 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
dissect_data_element(entry_tree, &sub_tree, pinfo, tvb, entry_offset);
entry_offset = get_type_length(tvb, entry_offset, &entry_length);
dissect_uuid(sub_tree, tvb, entry_offset, entry_length, &uuid);
dissect_uuid(sub_tree, pinfo, tvb, entry_offset, entry_length, &uuid);
uuid_str = print_bluetooth_uuid(&uuid);
uuid_str = print_bluetooth_uuid(pinfo->pool, &uuid);
wmem_strbuf_append(info_buf, uuid_str);
proto_item_append_text(entry_item, ": %s", uuid_str);
@ -3498,8 +3498,8 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
break;
}
case 3:
dissect_uuid(next_tree, tvb, offset, size, &uuid);
wmem_strbuf_append_printf(info_buf, ": %s", print_bluetooth_uuid(&uuid));
dissect_uuid(next_tree, pinfo, tvb, offset, size, &uuid);
wmem_strbuf_append_printf(info_buf, ": %s", print_bluetooth_uuid(pinfo->pool, &uuid));
break;
case 8: /* fall through */
case 4: {
@ -3936,7 +3936,7 @@ dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
new_offset = 0;
while (new_offset <= search_offset) {
new_offset = get_type_length(tvb, search_offset, &element_length);
dissect_uuid(NULL, tvb, new_offset, element_length, &uuid);
dissect_uuid(NULL, pinfo, tvb, new_offset, element_length, &uuid);
wmem_array_append_one(uuid_array, uuid);
new_offset += element_length;
}
@ -3946,7 +3946,7 @@ dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
number_of_attributes += 1;
}
uuid = get_specified_uuid(uuid_array);
uuid = get_specified_uuid(pinfo->pool, uuid_array);
if (uuid.size == 0 && service_uuid)
uuid = *service_uuid;
@ -4020,7 +4020,7 @@ dissect_sdp_service_attribute_list(proto_tree *tree, tvbuff_t *tvb, gint offset,
if (uuid.size)
proto_item_append_text(list_tree, " [count = %2u] (%s%s)",
number_of_attributes, (uuid.bt_uuid) ? "" : "CustomUUID: ", print_bluetooth_uuid(&uuid));
number_of_attributes, (uuid.bt_uuid) ? "" : "CustomUUID: ", print_bluetooth_uuid(pinfo->pool, &uuid));
else
proto_item_append_text(list_tree, " [count = %2u]",
number_of_attributes);
@ -4099,7 +4099,7 @@ dissect_sdp_service_search_request(proto_tree *tree, tvbuff_t *tvb, gint offset,
size = dissect_sdp_type(sub_tree, pinfo, tvb, offset, -1, empty_uuid, 0, 0, -1, NULL, &str);
entry_offset = get_type_length(tvb, offset, &entry_size);
dissect_uuid(NULL, tvb, entry_offset, entry_size, &uuid);
dissect_uuid(NULL, pinfo, tvb, entry_offset, entry_size, &uuid);
if (uuid_array)
wmem_array_append_one(uuid_array, uuid);
@ -4279,7 +4279,7 @@ dissect_sdp_service_attribute_request(proto_tree *tree, tvbuff_t *tvb,
offset += 2;
uuid_array = get_uuids(pinfo, record_handle, l2cap_data);
uuid = get_specified_uuid(uuid_array);
uuid = get_specified_uuid(pinfo->pool, uuid_array);
offset += dissect_attribute_id_list(tree, tvb, offset, pinfo, &uuid);
@ -4317,7 +4317,7 @@ dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
wmem_array_t *uuid_array;
uuid_array = get_uuids(pinfo, record_handle, l2cap_data);
uuid = get_specified_uuid(uuid_array);
uuid = get_specified_uuid(pinfo->pool, uuid_array);
} else {
memset(&uuid, 0, sizeof(bluetooth_uuid_t));
}
@ -4397,7 +4397,7 @@ dissect_sdp_service_search_attribute_request(proto_tree *tree, tvbuff_t *tvb,
col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(info_buf));
entry_offset = get_type_length(tvb, offset, &entry_size);
dissect_uuid(NULL, tvb, entry_offset, entry_size, &a_uuid);
dissect_uuid(NULL, pinfo, tvb, entry_offset, entry_size, &a_uuid);
if (uuid_array)
wmem_array_append_one(uuid_array, a_uuid);
@ -4410,7 +4410,7 @@ dissect_sdp_service_search_attribute_request(proto_tree *tree, tvbuff_t *tvb,
proto_tree_add_item(tree, hf_maximum_attribute_byte_count, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
uuid = get_specified_uuid(uuid_array);
uuid = get_specified_uuid(pinfo->pool, uuid_array);
offset += dissect_attribute_id_list(tree, tvb, offset, pinfo, &uuid);
@ -4444,7 +4444,7 @@ dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
PDU_TYPE_SERVICE_SEARCH_ATTRIBUTE, &new_tvb, &is_first,
&is_continued, &uuid_array, NULL, l2cap_data);
uuid = get_specified_uuid(uuid_array);
uuid = get_specified_uuid(pinfo->pool, uuid_array);
if (is_first && !is_continued) {
dissect_sdp_service_attribute_list_array(tree, tvb, offset, pinfo,

View File

@ -360,7 +360,7 @@ void cose_param_key_free(gpointer ptr) {
* @return True if the pair was dissected (even as opaque CBOR data).
*/
static gboolean dissect_header_pair(dissector_table_t dis_table, cose_header_context_t *ctx, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_label = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_label = wscbor_chunk_read(pinfo->pool, tvb, offset);
proto_item *item_label = NULL;
proto_tree *volatile tree_label = NULL;
@ -372,17 +372,17 @@ static gboolean dissect_header_pair(dissector_table_t dis_table, cose_header_con
switch (chunk_label->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *label = wscbor_require_int64(wmem_packet_scope(), chunk_label);
gint64 *label = wscbor_require_int64(pinfo->pool, chunk_label);
item_label = proto_tree_add_cbor_int64(tree, hf_hdr_label_int, pinfo, tvb, chunk_label, label);
if (label) {
key.label = ctx->label =
g_variant_new_int64(*label);
label_str = wmem_strdup_printf(wmem_packet_scope(), "%" PRId64, *label);
label_str = wmem_strdup_printf(pinfo->pool, "%" PRId64, *label);
}
break;
}
case CBOR_TYPE_STRING: {
const char *label = wscbor_require_tstr(wmem_packet_scope(), chunk_label);
const char *label = wscbor_require_tstr(pinfo->pool, chunk_label);
item_label = proto_tree_add_cbor_tstr(tree, hf_hdr_label_tstr, pinfo, tvb, chunk_label);
if (label) {
key.label = ctx->label =
@ -412,7 +412,7 @@ static gboolean dissect_header_pair(dissector_table_t dis_table, cose_header_con
// Peek into the value as tvb
const gint offset_value = *offset;
if (!wscbor_skip_next_item(wmem_packet_scope(), tvb, offset)) {
if (!wscbor_skip_next_item(pinfo->pool, tvb, offset)) {
return FALSE;
}
tvb_value = tvb_new_subset_length(tvb, offset_value, *offset - offset_value);
@ -447,14 +447,14 @@ static gboolean dissect_header_pair(dissector_table_t dis_table, cose_header_con
* @param[in,out] offset The data offset.
*/
static void dissect_header_map(dissector_table_t dis_table, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_hdr_map = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_hdr_map = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_map(chunk_hdr_map);
proto_item *item_hdr_map = proto_tree_get_parent(tree);
wscbor_chunk_mark_errors(pinfo, item_hdr_map, chunk_hdr_map);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, offset, chunk_hdr_map)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, offset, chunk_hdr_map)) {
proto_tree *tree_hdr_map = proto_item_add_subtree(item_hdr_map, ett_hdr_map);
cose_header_context_t *ctx = wmem_new0(wmem_packet_scope(), cose_header_context_t);
cose_header_context_t *ctx = wmem_new0(pinfo->pool, cose_header_context_t);
for (guint64 ix = 0; ix < chunk_hdr_map->head_value; ++ix) {
if (!dissect_header_pair(dis_table, ctx, tvb, pinfo, tree_hdr_map, offset)) {
@ -465,7 +465,7 @@ static void dissect_header_map(dissector_table_t dis_table, tvbuff_t *tvb, packe
if (ctx->principal) {
g_variant_unref(ctx->principal);
}
wmem_free(wmem_packet_scope(), ctx);
wmem_free(pinfo->pool, ctx);
}
proto_item_set_len(item_hdr_map, *offset - chunk_hdr_map->start);
@ -492,8 +492,8 @@ static void dissect_msg_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
*/
static void dissect_headers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
// Protected in bstr
wscbor_chunk_t *chunk_prot_bstr = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
tvbuff_t *tvb_prot = wscbor_require_bstr(wmem_packet_scope(), chunk_prot_bstr);
wscbor_chunk_t *chunk_prot_bstr = wscbor_chunk_read(pinfo->pool, tvb, offset);
tvbuff_t *tvb_prot = wscbor_require_bstr(pinfo->pool, chunk_prot_bstr);
proto_item *item_prot_bstr = proto_tree_add_cbor_bstr(tree, hf_hdr_prot_bstr, pinfo, tvb, chunk_prot_bstr);
if (tvb_prot) {
proto_tree *tree_prot = proto_item_add_subtree(item_prot_bstr, ett_prot_bstr);
@ -515,25 +515,25 @@ static void dissect_headers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/** Common behavior for payload.
*/
static void dissect_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, offset);
if (chunk->type_major == CBOR_TYPE_FLOAT_CTRL) {
proto_tree_add_cbor_ctrl(tree, hf_payload_null, pinfo, tvb, chunk);
}
else {
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_payload_bstr, pinfo, tvb, chunk);
}
}
static void dissect_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_signature, pinfo, tvb, chunk);
}
static void dissect_cose_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_sig = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_sig = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_array_size(chunk_sig, 3, 3);
proto_item *item_sig = proto_tree_add_cbor_container(tree, hf_cose_signature, pinfo, tvb, chunk_sig);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, offset, chunk_sig)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, offset, chunk_sig)) {
proto_tree *tree_sig = proto_item_add_subtree(item_sig, ett_sig);
dissect_headers(tvb, pinfo, tree_sig, offset);
@ -542,21 +542,21 @@ static void dissect_cose_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_item_set_len(item_sig, *offset - chunk_sig->start);
}
static void dissect_ciphertext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, offset);
if (chunk->type_major == CBOR_TYPE_FLOAT_CTRL) {
proto_tree_add_cbor_ctrl(tree, hf_ciphertext_null, pinfo, tvb, chunk);
}
else {
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_ciphertext_bstr, pinfo, tvb, chunk);
}
}
static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset);
static void dissect_cose_recipient_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_list = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_list = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_array(chunk_list);
proto_item *item_list = proto_tree_add_cbor_container(tree, hf_cose_recipient_list, pinfo, tvb, chunk_list);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, offset, chunk_list)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, offset, chunk_list)) {
proto_tree *tree_recip_list = proto_item_add_subtree(item_list, ett_recip_list);
for (guint64 ix = 0; ix < chunk_list->head_value; ++ix) {
@ -566,10 +566,10 @@ static void dissect_cose_recipient_list(tvbuff_t *tvb, packet_info *pinfo, proto
proto_item_set_len(item_list, *offset - chunk_list->start);
}
static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_recip = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_recip = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_array_size(chunk_recip, 3, 4);
proto_item *item_recip = proto_tree_add_cbor_container(tree, hf_cose_recipient, pinfo, tvb, chunk_recip);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, offset, chunk_recip)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, offset, chunk_recip)) {
proto_tree *tree_recip = proto_item_add_subtree(item_recip, ett_recip);
dissect_headers(tvb, pinfo, tree_recip, offset);
@ -582,8 +582,8 @@ static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
static void dissect_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_tag, pinfo, tvb, chunk);
}
@ -591,21 +591,21 @@ static void dissect_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gin
static int dissect_cose_sign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 4, 4);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Sign");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
dissect_headers(tvb, pinfo, tree_msg, &offset);
dissect_payload(tvb, pinfo, tree_msg, &offset);
wscbor_chunk_t *chunk_sig_list = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_sig_list = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array(chunk_sig_list);
proto_item *item_sig_list = proto_tree_add_cbor_container(tree_msg, hf_cose_signature_list, pinfo, tvb, chunk_sig_list);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_sig_list)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_sig_list)) {
proto_tree *tree_sig_list = proto_item_add_subtree(item_sig_list, ett_sig_list);
for (guint64 ix = 0; ix < chunk_sig_list->head_value; ++ix) {
@ -620,11 +620,11 @@ static int dissect_cose_sign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
static int dissect_cose_sign1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 4, 4);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Sign1");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
@ -638,11 +638,11 @@ static int dissect_cose_sign1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int dissect_cose_encrypt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 4, 4);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Encrypt");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
@ -656,11 +656,11 @@ static int dissect_cose_encrypt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
static int dissect_cose_encrypt0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 3, 3);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Encrypt0");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
@ -673,11 +673,11 @@ static int dissect_cose_encrypt0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
static int dissect_cose_mac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 5, 5);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Mac");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
@ -692,11 +692,11 @@ static int dissect_cose_mac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int dissect_cose_mac0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
gint offset = 0;
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_msg = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_msg, 4, 4);
proto_item *item_msg = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_msg);
proto_item_append_text(item_msg, ": COSE_Mac0");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_msg)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_msg)) {
proto_tree *tree_msg = proto_item_add_subtree(item_msg, ett_msg);
dissect_msg_tag(tvb, pinfo, tree_msg, chunk_msg, data);
@ -714,7 +714,7 @@ static int dissect_cose_msg_tagged(tvbuff_t *tvb, packet_info *pinfo, proto_tree
gint offset = 0;
// All messages have the same base structure, attempt all tags present
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
for (wmem_list_frame_t *it = wmem_list_head(chunk->tags); it;
it = wmem_list_frame_next(it)) {
wscbor_tag_t *tag = (wscbor_tag_t *) wmem_list_frame_data(it);
@ -737,11 +737,11 @@ static int dissect_cose_msg_tagged(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
static void dissect_value_alg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset, GVariant **value) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, offset);
switch (chunk->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *val = wscbor_require_int64(wmem_packet_scope(), chunk);
gint64 *val = wscbor_require_int64(pinfo->pool, chunk);
proto_tree_add_cbor_int64(tree, hf_hdr_alg_int, pinfo, tvb, chunk, val);
if (value && val) {
*value = g_variant_new_int64(*val);
@ -749,7 +749,7 @@ static void dissect_value_alg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
break;
}
case CBOR_TYPE_STRING: {
const char *val = wscbor_require_tstr(wmem_packet_scope(), chunk);
const char *val = wscbor_require_tstr(pinfo->pool, chunk);
proto_tree_add_cbor_tstr(tree, hf_hdr_alg_tstr, pinfo, tvb, chunk);
if (value && val) {
*value = g_variant_new_string(val);
@ -764,8 +764,8 @@ static void dissect_value_alg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int dissect_header_salt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_hdr_salt, pinfo, tvb, chunk);
return offset;
@ -803,18 +803,18 @@ static int dissect_header_alg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int dissect_header_crit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk_list = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_list = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array(chunk_list);
proto_item *item_list = proto_tree_add_cbor_container(tree, hf_hdr_crit_list, pinfo, tvb, chunk_list);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_list)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_list)) {
proto_tree *tree_list = proto_item_add_subtree(item_list, ett_hdr_crit_list);
for (guint64 ix = 0; ix < chunk_list->head_value; ++ix) {
wscbor_chunk_t *chunk_label = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_label = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk_label->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *label = wscbor_require_int64(wmem_packet_scope(), chunk_label);
gint64 *label = wscbor_require_int64(pinfo->pool, chunk_label);
proto_tree_add_cbor_int64(tree_list, hf_hdr_label_int, pinfo, tvb, chunk_label, label);
break;
}
@ -835,10 +835,10 @@ static int dissect_header_crit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
static int dissect_header_ctype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk->type_major) {
case CBOR_TYPE_UINT: {
guint64 *val = wscbor_require_uint64(wmem_packet_scope(), chunk);
guint64 *val = wscbor_require_uint64(pinfo->pool, chunk);
proto_tree_add_cbor_uint64(tree, hf_hdr_ctype_uint, pinfo, tvb, chunk, val);
break;
}
@ -856,8 +856,8 @@ static int dissect_header_ctype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
static int dissect_header_kid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_hdr_kid, pinfo, tvb, chunk);
return offset;
@ -866,8 +866,8 @@ static int dissect_header_kid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int dissect_header_iv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_hdr_iv, pinfo, tvb, chunk);
return offset;
@ -876,20 +876,20 @@ static int dissect_header_iv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
static int dissect_header_piv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_hdr_piv, pinfo, tvb, chunk);
return offset;
}
static void dissect_value_x5cert(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_item = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
tvbuff_t *tvb_item = wscbor_require_bstr(wmem_packet_scope(), chunk_item);
wscbor_chunk_t *chunk_item = wscbor_chunk_read(pinfo->pool, tvb, offset);
tvbuff_t *tvb_item = wscbor_require_bstr(pinfo->pool, chunk_item);
if (tvb_item) {
// disallow column text rewrite
gchar *info_text = wmem_strdup(wmem_packet_scope(), col_get_text(pinfo->cinfo, COL_INFO));
gchar *info_text = wmem_strdup(pinfo->pool, col_get_text(pinfo->cinfo, COL_INFO));
TRY {
dissector_try_string(
@ -912,11 +912,11 @@ static void dissect_value_cosex509(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_item *item_ctr = proto_tree_add_item(tree, hfindex, tvb, 0, -1, ENC_NA);
proto_tree *tree_ctr = proto_item_add_subtree(item_ctr, ett_hdr_x5cert_list);
wscbor_chunk_t *chunk_ctr = wscbor_chunk_read(wmem_packet_scope(), tvb, offset);
wscbor_chunk_t *chunk_ctr = wscbor_chunk_read(pinfo->pool, tvb, offset);
switch (chunk_ctr->type_major) {
case CBOR_TYPE_ARRAY: {
wscbor_require_array(chunk_ctr);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, offset, chunk_ctr)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, offset, chunk_ctr)) {
for (guint64 ix = 0; ix < chunk_ctr->head_value; ++ix) {
dissect_value_x5cert(tvb, pinfo, tree_ctr, offset);
}
@ -948,16 +948,16 @@ static int dissect_header_x5chain(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_header_x5t(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk_list = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_list = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array_size(chunk_list, 2, 2);
proto_item *item_list = proto_tree_add_cbor_container(tree, hf_hdr_x5t, pinfo, tvb, chunk_list);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_list)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_list)) {
proto_tree *tree_list = proto_item_add_subtree(item_list, ett_hdr_x5t_list);
dissect_value_alg(tvb, pinfo, tree_list, &offset, NULL);
wscbor_chunk_t *chunk_hash = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk_hash);
wscbor_chunk_t *chunk_hash = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk_hash);
proto_tree_add_cbor_bstr(tree_list, hf_hdr_x5t_hash, pinfo, tvb, chunk_hash);
}
@ -968,7 +968,7 @@ static int dissect_header_x5t(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
static int dissect_header_x5u(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_major_type(chunk, CBOR_TYPE_STRING);
proto_tree_add_cbor_tstr(tree, hf_hdr_x5u, pinfo, tvb, chunk);
@ -989,11 +989,11 @@ static int dissect_cose_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int dissect_cose_key_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk_set = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_set = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array(chunk_set);
proto_item *item_set = proto_tree_add_cbor_container(tree, proto_cose, pinfo, tvb, chunk_set);
proto_item_append_text(item_set, ": COSE_KeySet");
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_set)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_set)) {
proto_tree *tree_set = proto_item_add_subtree(item_set, ett_key_set);
for (guint64 ix = 0; ix < chunk_set->head_value; ++ix) {
@ -1014,11 +1014,11 @@ static int dissect_keyparam_kty(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
cose_header_context_t *ctx = (cose_header_context_t *)data;
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *val = wscbor_require_int64(wmem_packet_scope(), chunk);
gint64 *val = wscbor_require_int64(pinfo->pool, chunk);
proto_tree_add_cbor_int64(tree, hf_keyparam_kty_int, pinfo, tvb, chunk, val);
if (val) {
ctx->principal = g_variant_new_int64(*val);
@ -1026,7 +1026,7 @@ static int dissect_keyparam_kty(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
break;
}
case CBOR_TYPE_STRING: {
const char *val = wscbor_require_tstr(wmem_packet_scope(), chunk);
const char *val = wscbor_require_tstr(pinfo->pool, chunk);
proto_tree_add_cbor_tstr(tree, hf_keyparam_kty_tstr, pinfo, tvb, chunk);
if (val) {
ctx->principal = g_variant_new_string(val);
@ -1043,18 +1043,18 @@ static int dissect_keyparam_kty(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
static int dissect_keyparam_keyops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk_list = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk_list = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_array(chunk_list);
proto_item *item_list = proto_tree_add_cbor_container(tree, hf_keyparam_keyops_list, pinfo, tvb, chunk_list);
if (!wscbor_skip_if_errors(wmem_packet_scope(), tvb, &offset, chunk_list)) {
if (!wscbor_skip_if_errors(pinfo->pool, tvb, &offset, chunk_list)) {
proto_tree *tree_list = proto_item_add_subtree(item_list, ett_keyops_list);
for (guint64 ix = 0; ix < chunk_list->head_value; ++ix) {
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *val = wscbor_require_int64(wmem_packet_scope(), chunk);
gint64 *val = wscbor_require_int64(pinfo->pool, chunk);
proto_tree_add_cbor_int64(tree_list, hf_keyparam_keyops_int, pinfo, tvb, chunk, val);
break;
}
@ -1075,8 +1075,8 @@ static int dissect_keyparam_keyops(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_keyparam_baseiv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_keyparam_baseiv, pinfo, tvb, chunk);
return offset;
@ -1085,11 +1085,11 @@ static int dissect_keyparam_baseiv(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_keyparam_crv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk->type_major) {
case CBOR_TYPE_UINT:
case CBOR_TYPE_NEGINT: {
gint64 *val = wscbor_require_int64(wmem_packet_scope(), chunk);
gint64 *val = wscbor_require_int64(pinfo->pool, chunk);
proto_tree_add_cbor_int64(tree, hf_keyparam_crv_int, pinfo, tvb, chunk, val);
break;
}
@ -1107,8 +1107,8 @@ static int dissect_keyparam_crv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
static int dissect_keyparam_xcoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_keyparam_xcoord, pinfo, tvb, chunk);
return offset;
@ -1117,7 +1117,7 @@ static int dissect_keyparam_xcoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_keyparam_ycoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
switch (chunk->type_major) {
case CBOR_TYPE_FLOAT_CTRL: {
proto_tree_add_item(tree, hf_keyparam_ycoord, tvb, 0, 0, ENC_NA);
@ -1137,8 +1137,8 @@ static int dissect_keyparam_ycoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_keyparam_dcoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_keyparam_dcoord, pinfo, tvb, chunk);
return offset;
@ -1147,8 +1147,8 @@ static int dissect_keyparam_dcoord(tvbuff_t *tvb, packet_info *pinfo, proto_tree
static int dissect_keyparam_k(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset = 0;
wscbor_chunk_t *chunk = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset);
wscbor_require_bstr(wmem_packet_scope(), chunk);
wscbor_chunk_t *chunk = wscbor_chunk_read(pinfo->pool, tvb, &offset);
wscbor_require_bstr(pinfo->pool, chunk);
proto_tree_add_cbor_bstr(tree, hf_keyparam_k, pinfo, tvb, chunk);
return offset;

View File

@ -215,7 +215,7 @@ dissect_dtpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
static int
dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info *pinfo, int hfindex)
{
guint32 wstring_length;
guint32 wstring_size;
@ -223,7 +223,7 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
guint32 wstring_padding = 0;
wstring_length = tvb_get_letohl(tvb, offset);
wstring_data = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, wstring_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
wstring_data = tvb_get_string_enc(pinfo->pool, tvb, offset+4, wstring_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
wstring_size = wstring_length;
if (wstring_size%4) {
wstring_padding = (4-wstring_size%4);
@ -251,7 +251,7 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
}
static int
dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info *pinfo, int hfindex)
{
guint32 guid_length;
@ -270,10 +270,10 @@ dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
}
dtpt_guid_item = proto_tree_add_guid(tree, hfindex, tvb, offset, 4 + guid_length, &guid);
if (dtpt_guid_item) {
guid_name = guids_get_guid_name(&guid, wmem_packet_scope());
guid_name = guids_get_guid_name(&guid, pinfo->pool);
if (guid_name != NULL)
proto_item_set_text(dtpt_guid_item, "%s: %s (%s)",
proto_registrar_get_name(hfindex), guid_name, guid_to_str(wmem_packet_scope(), &guid));
proto_registrar_get_name(hfindex), guid_name, guid_to_str(pinfo->pool, &guid));
dtpt_guid_tree = proto_item_add_subtree(dtpt_guid_item, ett_dtpt_guid);
}
if (dtpt_guid_tree) {
@ -287,7 +287,7 @@ dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
if (guid_name != NULL && dtpt_guid_data_item != NULL) {
proto_item_set_text(dtpt_guid_data_item, "%s: %s (%s)",
proto_registrar_get_name(hf_dtpt_guid_data),
guid_name, guid_to_str(wmem_packet_scope(), &guid));
guid_name, guid_to_str(pinfo->pool, &guid));
}
}
}
@ -299,7 +299,7 @@ dissect_dtpt_guid(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
}
static int
dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex, int sockaddr_type)
dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, packet_info *pinfo, int hfindex, int sockaddr_type)
{
guint32 sockaddr_length = 0;
proto_item *sockaddr_item = NULL;
@ -350,7 +350,7 @@ dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex
proto_tree_add_item(sockaddr_tree, hf_dtpt_sockaddr_address,
tvb, offset+4,4,ENC_BIG_ENDIAN);
proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+8, 8, ENC_NA);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(wmem_packet_scope(), tvb,offset+4), port);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(pinfo->pool, tvb,offset+4), port);
}
break;
}
@ -373,7 +373,7 @@ dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex
proto_tree_add_item(sockaddr_tree, hf_dtpt_sockaddr_address,
tvb, offset+10,4,ENC_BIG_ENDIAN);
proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+14, 16, ENC_NA);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(wmem_packet_scope(), tvb,offset+10), port);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(pinfo->pool, tvb,offset+10), port);
}
break;
}
@ -481,11 +481,11 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 4;
offset += 60;
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, hf_dtpt_service_instance_name);
offset = dissect_dtpt_guid (tvb, offset, dtpt_tree, hf_dtpt_service_class_id );
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, hf_dtpt_comment );
offset = dissect_dtpt_guid (tvb, offset, dtpt_tree, hf_dtpt_ns_provider_id );
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, hf_dtpt_context );
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, pinfo, hf_dtpt_service_instance_name);
offset = dissect_dtpt_guid (tvb, offset, dtpt_tree, pinfo, hf_dtpt_service_class_id );
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, pinfo, hf_dtpt_comment );
offset = dissect_dtpt_guid (tvb, offset, dtpt_tree, pinfo, hf_dtpt_ns_provider_id );
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, pinfo, hf_dtpt_context );
num_protocols = tvb_get_letohl(tvb, offset);
if (num_protocols>0) {
protocols_length = tvb_get_letohl(tvb, offset+4);
@ -518,7 +518,7 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
offset += 4 + (num_protocols>0?4:0) + num_protocols*8;
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, hf_dtpt_query_string);
offset = dissect_dtpt_wstring(tvb, offset, dtpt_tree, pinfo, hf_dtpt_query_string);
addrs_start = offset;
num_addrs = tvb_get_letohl(tvb, offset);
@ -573,8 +573,8 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset2_start = offset2;
offset2 = dissect_dtpt_sockaddr(tvb, offset2, dtpt_addr2_tree, hf_dtpt_cs_addr_local, SOCKADDR_WITH_LEN);
offset2 = dissect_dtpt_sockaddr(tvb, offset2, dtpt_addr2_tree, hf_dtpt_cs_addr_remote, SOCKADDR_WITH_LEN);
offset2 = dissect_dtpt_sockaddr(tvb, offset2, dtpt_addr2_tree, pinfo, hf_dtpt_cs_addr_local, SOCKADDR_WITH_LEN);
offset2 = dissect_dtpt_sockaddr(tvb, offset2, dtpt_addr2_tree, pinfo, hf_dtpt_cs_addr_remote, SOCKADDR_WITH_LEN);
proto_item_set_len(dtpt_addr2_item,
offset2 - offset2_start);
@ -738,19 +738,19 @@ dissect_dtpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
break;
case ConnectRequest: {
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, pinfo, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
proto_tree_add_item(dtpt_tree, hf_dtpt_error,
tvb, 32, 4, ENC_LITTLE_ENDIAN);
}
break;
case ConnectResponseOK: {
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, pinfo, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
proto_tree_add_item(dtpt_tree, hf_dtpt_error,
tvb, 32, 4, ENC_LITTLE_ENDIAN);
}
break;
case ConnectResponseERR: {
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
dissect_dtpt_sockaddr(tvb, 2, dtpt_tree, pinfo, hf_dtpt_connect_addr, SOCKADDR_CONNECT);
proto_tree_add_item(dtpt_tree, hf_dtpt_error,
tvb, 32, 4, ENC_LITTLE_ENDIAN);
}

View File

@ -98,9 +98,9 @@ static guint64 enrp_total_msgs = 0;
static guint64 enrp_total_bytes = 0;
static void
dissect_parameters(tvbuff_t *, proto_tree *);
dissect_parameters(tvbuff_t *, packet_info *, proto_tree *);
static void
dissect_parameter(tvbuff_t *, proto_tree *);
dissect_parameter(tvbuff_t *, packet_info *, proto_tree *);
static int
dissect_enrp(tvbuff_t *, packet_info *, proto_tree *, void*);
@ -129,7 +129,7 @@ dissect_unknown_cause(tvbuff_t *cause_tvb, proto_tree *cause_tree, proto_item *c
}
static void
dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 code, length, padding_length;
proto_item *cause_item;
@ -149,7 +149,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
switch(code) {
case UNRECOGNIZED_PARAMETER_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
dissect_parameter(parameter_tvb, cause_tree);
dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case UNRECONGNIZED_MESSAGE_CAUSE_CODE:
message_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
@ -157,19 +157,19 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
break;
case INVALID_VALUES:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
dissect_parameter(parameter_tvb, cause_tree);
dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case NON_UNIQUE_PE_IDENTIFIER:
break;
case POOLING_POLICY_INCONSISTENT_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
dissect_parameter(parameter_tvb, cause_tree);
dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case LACK_OF_RESOURCES_CAUSE_CODE:
break;
case INCONSISTENT_TRANSPORT_TYPE_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
dissect_parameter(parameter_tvb, cause_tree);
dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case INCONSISTENT_DATA_CONTROL_CONFIGURATION_CAUSE_CODE:
break;
@ -186,7 +186,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
}
static void
dissect_error_causes(tvbuff_t *error_causes_tvb, proto_tree *parameter_tree)
dissect_error_causes(tvbuff_t *error_causes_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 length, total_length;
gint offset;
@ -197,7 +197,7 @@ dissect_error_causes(tvbuff_t *error_causes_tvb, proto_tree *parameter_tree)
length = tvb_get_ntohs(error_causes_tvb, offset + CAUSE_LENGTH_OFFSET);
total_length = WS_ROUNDUP_4(length);
error_cause_tvb = tvb_new_subset_length(error_causes_tvb, offset, total_length);
dissect_error_cause(error_cause_tvb, parameter_tree);
dissect_error_cause(error_cause_tvb, pinfo, parameter_tree);
offset += total_length;
}
}
@ -205,21 +205,21 @@ dissect_error_causes(tvbuff_t *error_causes_tvb, proto_tree *parameter_tree)
/* Dissectors for parameters. This is common for ASAP and ENRP. */
static void
dissect_ipv4_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_ipv4_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_parameter_ipv4_address, parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH, ENC_BIG_ENDIAN);
proto_item_append_text(parameter_item, " (%s)", tvb_ip_to_str(wmem_packet_scope(), parameter_tvb, IPV4_ADDRESS_OFFSET));
proto_item_append_text(parameter_item, " (%s)", tvb_ip_to_str(pinfo->pool, parameter_tvb, IPV4_ADDRESS_OFFSET));
}
static void
dissect_ipv6_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_ipv6_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
proto_tree_add_item(parameter_tree, hf_parameter_ipv6_address, parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH, ENC_NA);
proto_item_append_text(parameter_item, " (%s)", tvb_ip6_to_str(wmem_packet_scope(), parameter_tvb, IPV6_ADDRESS_OFFSET));
proto_item_append_text(parameter_item, " (%s)", tvb_ip6_to_str(pinfo->pool, parameter_tvb, IPV6_ADDRESS_OFFSET));
}
static void
dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@ -228,11 +228,11 @@ dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
proto_tree_add_item(parameter_tree, hf_dccp_service_code, parameter_tvb, DCCP_SERVICE_CODE_OFFSET, DCCP_SERVICE_CODE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, DCCP_ADDRESS_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@ -240,11 +240,11 @@ dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
proto_tree_add_item(parameter_tree, hf_transport_use, parameter_tvb, SCTP_TRANSPORT_USE_OFFSET, SCTP_TRANSPORT_USE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, SCTP_ADDRESS_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@ -252,11 +252,11 @@ dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_t
proto_tree_add_item(parameter_tree, hf_transport_use, parameter_tvb, TCP_TRANSPORT_USE_OFFSET, TCP_TRANSPORT_USE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, TCP_ADDRESS_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@ -264,11 +264,11 @@ dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_t
proto_tree_add_item(parameter_tree, hf_udp_reserved, parameter_tvb, UDP_RESERVED_OFFSET, UDP_RESERVED_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, UDP_ADDRESS_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@ -276,7 +276,7 @@ dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parame
proto_tree_add_item(parameter_tree, hf_udp_lite_reserved, parameter_tvb, UDP_LITE_RESERVED_OFFSET, UDP_LITE_RESERVED_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, UDP_LITE_ADDRESS_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
@ -339,7 +339,7 @@ dissect_pool_member_selection_policy_parameter(tvbuff_t *parameter_tvb, proto_tr
}
static void
dissect_pool_handle_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_pool_handle_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 handle_length;
proto_item* pi;
@ -348,11 +348,11 @@ dissect_pool_handle_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tre
pi = proto_tree_add_item(parameter_tree, hf_pool_handle, parameter_tvb, POOL_HANDLE_OFFSET, handle_length, ENC_NA);
proto_item_append_text(pi, " (%s)",
tvb_format_text(wmem_packet_scope(), parameter_tvb, POOL_HANDLE_OFFSET, handle_length) );
tvb_format_text(pinfo->pool, parameter_tvb, POOL_HANDLE_OFFSET, handle_length) );
}
static void
dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_pool_element_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t* parameters_tvb;
@ -361,27 +361,27 @@ dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tr
proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, USER_TRANSPORT_PARAMETER_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_server_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_server_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
proto_tree_add_item(parameter_tree, hf_server_identifier, parameter_tvb, SERVER_ID_OFFSET, SERVER_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, SERVER_TRANSPORT_OFFSET);
dissect_parameters(parameters_tvb, parameter_tree);
dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
dissect_operation_error_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
dissect_operation_error_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *error_causes_tvb;
error_causes_tvb = tvb_new_subset_remaining(parameter_tvb, ERROR_CAUSES_OFFSET);
dissect_error_causes(error_causes_tvb, parameter_tree);
dissect_error_causes(error_causes_tvb, pinfo, parameter_tree);
}
static void
@ -424,7 +424,7 @@ dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, p
}
static void
dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *enrp_tree)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *enrp_tree)
{
guint16 type, length, padding_length;
proto_tree *parameter_item;
@ -445,40 +445,40 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *enrp_tree)
switch(type) {
case IPV4_ADDRESS_PARAMETER_TYPE:
dissect_ipv4_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_ipv4_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case IPV6_ADDRESS_PARAMETER_TYPE:
dissect_ipv6_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_ipv6_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case DCCP_TRANSPORT_PARAMETER_TYPE:
dissect_dccp_transport_parameter(parameter_tvb, parameter_tree);
dissect_dccp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case SCTP_TRANSPORT_PARAMETER_TYPE:
dissect_sctp_transport_parameter(parameter_tvb, parameter_tree);
dissect_sctp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case TCP_TRANSPORT_PARAMETER_TYPE:
dissect_tcp_transport_parameter(parameter_tvb, parameter_tree);
dissect_tcp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case UDP_TRANSPORT_PARAMETER_TYPE:
dissect_udp_transport_parameter(parameter_tvb, parameter_tree);
dissect_udp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case UDP_LITE_TRANSPORT_PARAMETER_TYPE:
dissect_udp_lite_transport_parameter(parameter_tvb, parameter_tree);
dissect_udp_lite_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case POOL_MEMBER_SELECTION_POLICY_PARAMETER_TYPE:
dissect_pool_member_selection_policy_parameter(parameter_tvb, parameter_tree);
break;
case POOL_HANDLE_PARAMETER_TYPE:
dissect_pool_handle_parameter(parameter_tvb, parameter_tree);
dissect_pool_handle_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case POOL_ELEMENT_PARAMETER_TYPE:
dissect_pool_element_parameter(parameter_tvb, parameter_tree);
dissect_pool_element_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case SERVER_INFORMATION_PARAMETER_TYPE:
dissect_server_information_parameter(parameter_tvb, parameter_tree);
dissect_server_information_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case OPERATION_ERROR_PARAMETER_TYPE:
dissect_operation_error_parameter(parameter_tvb, parameter_tree);
dissect_operation_error_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case COOKIE_PARAMETER_TYPE:
dissect_cookie_parameter(parameter_tvb, parameter_tree, parameter_item);
@ -499,7 +499,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *enrp_tree)
}
static void
dissect_parameters(tvbuff_t *parameters_tvb, proto_tree *tree)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset, length, total_length, remaining_length;
tvbuff_t *parameter_tvb;
@ -512,7 +512,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, proto_tree *tree)
total_length = MIN(total_length, remaining_length);
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
dissect_parameter(parameter_tvb, tree);
dissect_parameter(parameter_tvb, pinfo, tree);
/* get rid of the handled parameter */
offset += total_length;
}
@ -535,7 +535,7 @@ static const true_false_string reply_required_bit_value = {
};
static void
dissect_enrp_presence_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree)
dissect_enrp_presence_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@ -543,7 +543,7 @@ dissect_enrp_presence_message(tvbuff_t *message_tvb, proto_tree *message_tree, p
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(message_tree, hf_receiver_servers_id, message_tvb, RECEIVER_SERVERS_ID_OFFSET, RECEIVER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(message_tvb, MESSAGE_PARAMETERS_OFFSET);
dissect_parameters(parameters_tvb, message_tree);
dissect_parameters(parameters_tvb, pinfo, message_tree);
}
#define OWN_CHILDREN_ONLY_BIT_MASK 0x01
@ -577,7 +577,7 @@ static const true_false_string more_to_send_bit_value = {
};
static void
dissect_enrp_handle_table_response_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree)
dissect_enrp_handle_table_response_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@ -586,7 +586,7 @@ dissect_enrp_handle_table_response_message(tvbuff_t *message_tvb, proto_tree *me
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(message_tree, hf_receiver_servers_id, message_tvb, RECEIVER_SERVERS_ID_OFFSET, RECEIVER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(message_tvb, MESSAGE_PARAMETERS_OFFSET);
dissect_parameters(parameters_tvb, message_tree);
dissect_parameters(parameters_tvb, pinfo, message_tree);
}
#define UPDATE_ACTION_LENGTH 2
@ -609,7 +609,7 @@ static const true_false_string tos_bit_value = {
};
static void
dissect_enrp_handle_update_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree)
dissect_enrp_handle_update_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@ -619,11 +619,11 @@ dissect_enrp_handle_update_message(tvbuff_t *message_tvb, proto_tree *message_tr
proto_tree_add_item(message_tree, hf_update_action, message_tvb, UPDATE_ACTION_OFFSET, UPDATE_ACTION_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(message_tree, hf_pmu_reserved, message_tvb, PNU_RESERVED_OFFSET, PNU_RESERVED_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(message_tvb, PNU_MESSAGE_PARAMETERS_OFFSET);
dissect_parameters(parameters_tvb, message_tree);
dissect_parameters(parameters_tvb, pinfo, message_tree);
}
static void
dissect_enrp_list_request_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_enrp_list_request_message(tvbuff_t *message_tvb, packet_info *pinfo _U_, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
/* FIXME: ensure that the length is 12 bytes. */
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
@ -631,7 +631,7 @@ dissect_enrp_list_request_message(tvbuff_t *message_tvb, proto_tree *message_tre
}
static void
dissect_enrp_list_response_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree)
dissect_enrp_list_response_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@ -639,14 +639,14 @@ dissect_enrp_list_response_message(tvbuff_t *message_tvb, proto_tree *message_tr
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(message_tree, hf_receiver_servers_id, message_tvb, RECEIVER_SERVERS_ID_OFFSET, RECEIVER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(message_tvb, MESSAGE_PARAMETERS_OFFSET);
dissect_parameters(parameters_tvb, message_tree);
dissect_parameters(parameters_tvb, pinfo, message_tree);
}
#define TARGET_SERVERS_ID_LENGTH 4
#define TARGET_SERVERS_ID_OFFSET (RECEIVER_SERVERS_ID_OFFSET + RECEIVER_SERVERS_ID_LENGTH)
static void
dissect_enrp_init_takeover_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_enrp_init_takeover_message(tvbuff_t *message_tvb, packet_info *pinfo _U_, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
/* FIXME: ensure that the length is 16 bytes. */
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
@ -655,7 +655,7 @@ dissect_enrp_init_takeover_message(tvbuff_t *message_tvb, proto_tree *message_tr
}
static void
dissect_enrp_init_takeover_ack_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_enrp_init_takeover_ack_message(tvbuff_t *message_tvb, packet_info *pinfo _U_, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
/* FIXME: ensure that the length is 16 bytes. */
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
@ -664,7 +664,7 @@ dissect_enrp_init_takeover_ack_message(tvbuff_t *message_tvb, proto_tree *messag
}
static void
dissect_enrp_init_takeover_server_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_enrp_init_takeover_server_message(tvbuff_t *message_tvb, packet_info *pinfo _U_, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
/* FIXME: ensure that the length is 16 bytes. */
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
@ -673,18 +673,18 @@ dissect_enrp_init_takeover_server_message(tvbuff_t *message_tvb, proto_tree *mes
}
static void
dissect_enrp_error_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_enrp_error_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
tvbuff_t *parameters_tvb;
proto_tree_add_item(message_tree, hf_sender_servers_id, message_tvb, SENDER_SERVERS_ID_OFFSET, SENDER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(message_tree, hf_receiver_servers_id, message_tvb, RECEIVER_SERVERS_ID_OFFSET, RECEIVER_SERVERS_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(message_tvb, MESSAGE_PARAMETERS_OFFSET);
dissect_parameters(parameters_tvb, message_tree);
dissect_parameters(parameters_tvb, pinfo, message_tree);
}
static void
dissect_unknown_message(tvbuff_t *message_tvb, proto_tree *message_tree, proto_tree *flags_tree _U_)
dissect_unknown_message(tvbuff_t *message_tvb, packet_info *pinfo _U_, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
proto_tree_add_item(message_tree, hf_message_value, message_tvb, MESSAGE_VALUE_OFFSET, tvb_captured_length(message_tvb) - MESSAGE_HEADER_LENGTH, ENC_NA);
}
@ -740,37 +740,37 @@ dissect_enrp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *enrp
proto_tree_add_item(enrp_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
switch (type) {
case ENRP_PRESENCE_MESSAGE_TYPE:
dissect_enrp_presence_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_presence_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_HANDLE_TABLE_REQUEST_MESSAGE_TYPE:
dissect_enrp_handle_table_request_message(message_tvb, enrp_tree, flags_tree);
break;
case ENRP_HANDLE_TABLE_RESPONSE_MESSAGE_TYPE:
dissect_enrp_handle_table_response_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_handle_table_response_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_HANDLE_UPDATE_MESSAGE_TYPE:
dissect_enrp_handle_update_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_handle_update_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_LIST_REQUEST_MESSAGE_TYPE:
dissect_enrp_list_request_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_list_request_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_LIST_RESPONSE_MESSAGE_TYPE:
dissect_enrp_list_response_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_list_response_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_INIT_TAKEOVER_MESSAGE_TYPE:
dissect_enrp_init_takeover_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_init_takeover_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_INIT_TAKEOVER_ACK_MESSAGE_TYPE:
dissect_enrp_init_takeover_ack_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_init_takeover_ack_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_TAKEOVER_SERVER_MESSAGE_TYPE:
dissect_enrp_init_takeover_server_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_init_takeover_server_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
case ENRP_ERROR_MESSAGE_TYPE:
dissect_enrp_error_message(message_tvb, enrp_tree, flags_tree);
dissect_enrp_error_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
default:
dissect_unknown_message(message_tvb, enrp_tree, flags_tree);
dissect_unknown_message(message_tvb, pinfo, enrp_tree, flags_tree);
break;
}
}

View File

@ -86,7 +86,7 @@ static const value_string protocol_statuses[] = {
};
static void
dissect_nv_pairs(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_nv_pairs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fcgi_tree, gint offset, guint16 len)
{
gint end_offset = offset + len;
@ -113,11 +113,11 @@ dissect_nv_pairs(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
offset += 4;
}
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_ASCII);
name = tvb_get_string_enc(pinfo->pool, tvb, offset, namelen, ENC_ASCII);
offset += namelen;
if (valuelen > 0) {
value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, valuelen, ENC_ASCII);
value = tvb_get_string_enc(pinfo->pool, tvb, offset, valuelen, ENC_ASCII);
offset += valuelen;
proto_tree_add_string_format(fcgi_tree, hf_fcgi_nv_name, tvb, start_offset, offset - start_offset,
@ -130,7 +130,7 @@ dissect_nv_pairs(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
}
static int
dissect_begin_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_begin_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree *br_tree;
@ -149,7 +149,7 @@ dissect_begin_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16
}
static void
dissect_abort_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_abort_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree_add_subtree(fcgi_tree, tvb, offset, len, ett_fcgi_abort_request, NULL, "Abort Request:");
@ -157,7 +157,7 @@ dissect_abort_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16
}
static int
dissect_end_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_end_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree *er_tree;
@ -175,37 +175,37 @@ dissect_end_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 l
}
static void
dissect_params(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree *p_tree;
p_tree = proto_tree_add_subtree(fcgi_tree, tvb, offset, len, ett_fcgi_params, NULL, "Params:");
dissect_nv_pairs(tvb, p_tree, offset, len);
dissect_nv_pairs(tvb, pinfo, p_tree, offset, len);
return;
}
static void
dissect_get_values(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_get_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree *gv_tree;
gv_tree = proto_tree_add_subtree(fcgi_tree, tvb, offset, len, ett_fcgi_params, NULL, "Get Values:");
dissect_nv_pairs(tvb, gv_tree, offset, len);
dissect_nv_pairs(tvb, pinfo, gv_tree, offset, len);
return;
}
static void
dissect_get_values_result(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len)
dissect_get_values_result(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fcgi_tree, gint offset, guint16 len)
{
proto_tree *gvr_tree;
gvr_tree = proto_tree_add_subtree(fcgi_tree, tvb, offset, len, ett_fcgi_params, NULL, "Get Values:");
dissect_nv_pairs(tvb, gvr_tree, offset, len);
dissect_nv_pairs(tvb, pinfo, gvr_tree, offset, len);
return;
}
@ -263,27 +263,27 @@ dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
switch (type)
{
case FCGI_BEGIN_REQUEST:
dissect_begin_request(tvb, fcgi_tree, offset, clen);
dissect_begin_request(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
case FCGI_ABORT_REQUEST:
dissect_abort_request(tvb, fcgi_tree, offset, clen);
dissect_abort_request(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
case FCGI_END_REQUEST:
dissect_end_request(tvb, fcgi_tree, offset, clen);
dissect_end_request(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
case FCGI_PARAMS:
dissect_params(tvb, fcgi_tree, offset, clen);
dissect_params(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
case FCGI_GET_VALUES:
dissect_get_values(tvb, fcgi_tree, offset, clen);
dissect_get_values(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
case FCGI_GET_VALUES_RESULT:
dissect_get_values_result(tvb, fcgi_tree, offset, clen);
dissect_get_values_result(tvb, pinfo, fcgi_tree, offset, clen);
offset += clen;
break;
default:

View File

@ -30,7 +30,7 @@ static gint ett_form_urlencoded = -1;
static gint ett_form_keyvalue = -1;
static int
get_form_key_value(tvbuff_t *tvb, char **ptr, int offset, char stop)
get_form_key_value(wmem_allocator_t *pool, tvbuff_t *tvb, char **ptr, int offset, char stop)
{
const int orig_offset = offset;
char *tmp;
@ -61,7 +61,7 @@ get_form_key_value(tvbuff_t *tvb, char **ptr, int offset, char stop)
offset++;
}
*ptr = tmp = (char*)wmem_alloc(wmem_packet_scope(), len + 1);
*ptr = tmp = (char*)wmem_alloc(pool, len + 1);
tmp[len] = '\0';
len = 0;
@ -146,7 +146,7 @@ dissect_form_urlencoded(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
sub = proto_tree_add_subtree(url_tree, tvb, offset, 0, ett_form_keyvalue, &ti, "Form item");
next_offset = get_form_key_value(tvb, &key, offset, '=');
next_offset = get_form_key_value(pinfo->pool, tvb, &key, offset, '=');
if (next_offset == -1)
break;
/* XXX: Only UTF-8 is conforming according to WHATWG, though we
@ -162,7 +162,7 @@ dissect_form_urlencoded(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
offset = next_offset+1;
next_offset = get_form_key_value(tvb, &value, offset, '&');
next_offset = get_form_key_value(pinfo->pool, tvb, &value, offset, '&');
if (next_offset == -1)
break;
value_decoded = get_utf_8_string(pinfo->pool, value, (int)strlen(value));

View File

@ -1533,7 +1533,7 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
break;
default:
ptr = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, ies_len, ENC_ASCII);
ptr = tvb_get_string_enc(pinfo->pool, tvb, offset + 2, ies_len, ENC_ASCII);
ie_item =
proto_tree_add_string_format(ies_tree, hf_IAX_IE_UNKNOWN_BYTES,
tvb, offset+2, ies_len, ptr,
@ -1555,7 +1555,7 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
proto_item_set_text(ti, "Information Element: %s",
ie_finfo->rep->representation);
else {
guint8 *ie_val = (guint8 *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH);
guint8 *ie_val = (guint8 *)wmem_alloc(pinfo->pool, ITEM_LABEL_LENGTH);
proto_item_fill_label(ie_finfo, ie_val);
proto_item_set_text(ti, "Information Element: %s",
ie_val);
@ -2172,9 +2172,9 @@ typedef struct _call_list {
struct _call_list *next;
} call_list;
static call_list *call_list_append(call_list *list, guint16 scallno)
static call_list *call_list_append(wmem_allocator_t *pool, call_list *list, guint16 scallno)
{
call_list *node = wmem_new0(wmem_packet_scope(), call_list);
call_list *node = wmem_new0(pool, call_list);
node->scallno = scallno;
@ -2255,7 +2255,7 @@ static guint32 dissect_trunkpacket(tvbuff_t *tvb, guint32 offset,
guint16 scallno;
offset = dissect_trunkcall_ts(tvb, offset, iax2_tree, &scallno);
if (!call_list_find(calls, scallno)) {
calls = call_list_append(calls, scallno);
calls = call_list_append(pinfo->pool, calls, scallno);
}
nframes++;
}
@ -2266,7 +2266,7 @@ static guint32 dissect_trunkpacket(tvbuff_t *tvb, guint32 offset,
guint16 scallno;
offset = dissect_trunkcall_nots(tvb, offset, iax2_tree, &scallno);
if (!call_list_find(calls, scallno)) {
calls = call_list_append(calls, scallno);
calls = call_list_append(pinfo->pool, calls, scallno);
}
nframes++;
}

View File

@ -438,7 +438,7 @@ ddp_rdma_packetlist(packet_info *pinfo, gboolean ddp_last_flag,
/* dissects RDMA Read Request and Terminate message header */
static int
dissect_iwarp_rdmap(tvbuff_t *tvb, proto_tree *rdma_tree, guint32 offset,
dissect_iwarp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rdma_tree, guint32 offset,
rdmap_info_t *info)
{
proto_tree *rdma_header_tree = NULL;
@ -452,7 +452,7 @@ dissect_iwarp_rdmap(tvbuff_t *tvb, proto_tree *rdma_tree, guint32 offset,
guint8 layer, etype, hdrct;
if (info->opcode == RDMA_READ_REQUEST) {
info->read_request = wmem_new(wmem_packet_scope(), rdmap_request_t);
info->read_request = wmem_new(pinfo->pool, rdmap_request_t);
rdma_header_subitem = proto_tree_add_item(rdma_tree,
hf_iwarp_rdma_rr_header, tvb, offset, -1, ENC_NA);
@ -846,12 +846,12 @@ dissect_iwarp_ddp_rdmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
/* do further dissection for RDMA messages RDMA Read Request & Terminate */
if (info.opcode == RDMA_READ_REQUEST) {
offset = dissect_iwarp_rdmap(tvb, rdma_tree, offset, &info);
offset = dissect_iwarp_rdmap(tvb, pinfo, rdma_tree, offset, &info);
/* Call upper layer dissector for message reassembly */
next_tvb = tvb_new_subset_remaining(tvb, offset);
dissect_rdmap_payload(next_tvb, pinfo, tree, &info);
} else if (info.opcode == RDMA_TERMINATE) {
dissect_iwarp_rdmap(tvb, rdma_tree, offset, &info);
dissect_iwarp_rdmap(tvb, pinfo, rdma_tree, offset, &info);
}
/* do further dissection for RDMA messages RDMA Atomic Request & Response */

View File

@ -276,7 +276,7 @@ dissect_m2tp_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, prot
/* Interface Identifier */
static void
dissect_m2tp_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_interface_identifier_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint32 parameter_value;
@ -289,7 +289,7 @@ dissect_m2tp_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree
/* Master Slave Indicator */
static void
dissect_m2tp_master_slave_parameter (tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_master_slave_parameter (tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint32 parameter_value;
@ -302,7 +302,7 @@ dissect_m2tp_master_slave_parameter (tvbuff_t *parameter_tvb, proto_tree *parame
/* M2tp User Identifier */
static void
dissect_m2tp_user_identifier_parameter (tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_user_identifier_parameter (tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint32 parameter_value;
@ -315,7 +315,7 @@ dissect_m2tp_user_identifier_parameter (tvbuff_t *parameter_tvb, proto_tree *par
/* Info String */
static void
dissect_m2tp_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_info_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 length, info_string_length;
const guint8 *info_string;
@ -323,14 +323,14 @@ dissect_m2tp_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree,
if (parameter_tree) {
length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
info_string_length = length - PARAMETER_HEADER_LENGTH;
proto_tree_add_item_ret_string(parameter_tree, hf_m2tp_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII, wmem_packet_scope(), &info_string);
proto_tree_add_item_ret_string(parameter_tree, hf_m2tp_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII, pinfo->pool, &info_string);
proto_item_set_text(parameter_item, "Info String (%s)", info_string);
}
}
/* Diagnostic Information */
static void
dissect_m2tp_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_diagnostic_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 length, diagnostic_info_length;
@ -344,7 +344,7 @@ dissect_m2tp_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tre
/* Heartbeat Data */
static void
dissect_m2tp_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_heartbeat_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 length, heartbeat_data_length;
@ -358,7 +358,7 @@ dissect_m2tp_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *param
/* Reason Parameter */
static void
dissect_m2tp_reason_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_reason_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint32 reason;
@ -371,7 +371,7 @@ dissect_m2tp_reason_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tre
/* Error Code */
static void
dissect_m2tp_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_error_code_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint32 error_code;
@ -384,7 +384,7 @@ dissect_m2tp_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter
/* Protocol Data */
static void
dissect_m2tp_protocol_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item, packet_info *pinfo, proto_item *m2tp_item, proto_tree *tree)
dissect_m2tp_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item, proto_item *m2tp_item, proto_tree *tree)
{
guint16 length, protocol_data_length, padding_length;
tvbuff_t *mtp2_tvb;
@ -406,7 +406,7 @@ dissect_m2tp_protocol_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parame
/* Unknown Parameter */
static void
dissect_m2tp_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
dissect_m2tp_unknown_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo _U_, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 tag, length, parameter_value_length;
@ -449,34 +449,34 @@ dissect_m2tp_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *
switch(tag) {
case INTERFACE_IDENTIFIER_PARAMETER_TAG:
dissect_m2tp_interface_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_interface_identifier_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case MASTER_SLAVE_INDICATOR_PARAMETER_TAG:
dissect_m2tp_master_slave_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_master_slave_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case M2TP_USER_IDENTIFIER_PARAMETER_TAG:
dissect_m2tp_user_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_user_identifier_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case INFO_PARAMETER_TAG:
dissect_m2tp_info_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_info_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
dissect_m2tp_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_diagnostic_information_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case HEARTBEAT_DATA_PARAMETER_TAG:
dissect_m2tp_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_heartbeat_data_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case REASON_PARAMETER_TAG:
dissect_m2tp_reason_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_reason_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case ERROR_CODE_PARAMETER_TAG:
dissect_m2tp_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_error_code_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
case PROTOCOL_DATA_PARAMETER_TAG:
dissect_m2tp_protocol_data_parameter(parameter_tvb, parameter_tree, parameter_item, pinfo, m2tp_item, tree);
dissect_m2tp_protocol_data_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item, m2tp_item, tree);
break;
default:
dissect_m2tp_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
dissect_m2tp_unknown_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
break;
};

View File

@ -150,7 +150,7 @@ mcpe_get_session_state(packet_info *pinfo) {
* Packet dissectors
*/
static void
mcpe_dissect_string(proto_tree *tree, int hf, tvbuff_t *tvb, gint *offset, guint encoding) {
mcpe_dissect_string(packet_info *pinfo, proto_tree *tree, int hf, tvbuff_t *tvb, gint *offset, guint encoding) {
proto_item *ti;
proto_tree *string_tree;
guint32 length;
@ -172,7 +172,7 @@ mcpe_dissect_string(proto_tree *tree, int hf, tvbuff_t *tvb, gint *offset, guint
if (encoding & ENC_UTF_8) {
guint8 *string;
string = tvb_get_string_enc(wmem_packet_scope(), tvb, *offset + length_width, length, ENC_UTF_8);
string = tvb_get_string_enc(pinfo->pool, tvb, *offset + length_width, length, ENC_UTF_8);
ti = proto_tree_add_string(tree, hf, tvb, *offset, length + length_width, string);
string_tree = proto_item_add_subtree(ti, ett_mcpe_string);
@ -188,7 +188,7 @@ mcpe_dissect_string(proto_tree *tree, int hf, tvbuff_t *tvb, gint *offset, guint
else {
guint8 *bytes;
bytes = (guint8*)tvb_memdup(wmem_packet_scope(), tvb, *offset + length_width, length);
bytes = (guint8*)tvb_memdup(pinfo->pool, tvb, *offset + length_width, length);
ti = proto_tree_add_bytes_with_length(tree, hf, tvb, *offset, length + length_width, bytes, length);
string_tree = proto_item_add_subtree(ti, ett_mcpe_string);
@ -204,7 +204,7 @@ mcpe_dissect_string(proto_tree *tree, int hf, tvbuff_t *tvb, gint *offset, guint
}
static int
mcpe_dissect_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
mcpe_dissect_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
if (tree) {
gint item_size;
@ -243,8 +243,8 @@ mcpe_dissect_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void
proto_item_append_text(ti, " (%u octets)", decomp_length);
proto_item_set_generated(ti);
mcpe_dissect_string(login_tree, hf_mcpe_chain_JSON , login_tvb, &offset, ENC_LITTLE_ENDIAN | ENC_UTF_8);
mcpe_dissect_string(login_tree, hf_mcpe_client_data_JWT, login_tvb, &offset, ENC_LITTLE_ENDIAN | ENC_UTF_8);
mcpe_dissect_string(pinfo, login_tree, hf_mcpe_chain_JSON , login_tvb, &offset, ENC_LITTLE_ENDIAN | ENC_UTF_8);
mcpe_dissect_string(pinfo, login_tree, hf_mcpe_client_data_JWT, login_tvb, &offset, ENC_LITTLE_ENDIAN | ENC_UTF_8);
}
else {
expert_add_info(pinfo, ti, &ei_mcpe_decompression_failed);
@ -260,8 +260,8 @@ mcpe_dissect_server_to_client_handshake(tvbuff_t *tvb, packet_info *pinfo, proto
gint offset = 1;
mcpe_session_state_t *state;
mcpe_dissect_string(tree, hf_mcpe_public_key, tvb, &offset, ENC_BIG_ENDIAN | ENC_UTF_8);
mcpe_dissect_string(tree, hf_mcpe_server_token, tvb, &offset, ENC_BIG_ENDIAN);
mcpe_dissect_string(pinfo, tree, hf_mcpe_public_key, tvb, &offset, ENC_BIG_ENDIAN | ENC_UTF_8);
mcpe_dissect_string(pinfo, tree, hf_mcpe_server_token, tvb, &offset, ENC_BIG_ENDIAN);
/*
* Everything will be encrypted once the server sends this.

View File

@ -170,7 +170,7 @@ dissect_msrcp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U
}
else if ((!(type == MSRCP_RESPONSE)) && (msrcp_trans->req_frame != pinfo->num))
{
msrcp_transaction_t* retrans_msrcp = wmem_new(wmem_packet_scope(), msrcp_transaction_t);
msrcp_transaction_t* retrans_msrcp = wmem_new(pinfo->pool, msrcp_transaction_t);
retrans_msrcp->req_frame = msrcp_trans->req_frame;
retrans_msrcp->rep_frame = 0;
retrans_msrcp->req_time = pinfo->abs_ts;
@ -180,7 +180,7 @@ dissect_msrcp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U
}
if (!msrcp_trans)
{
msrcp_trans = wmem_new(wmem_packet_scope(), msrcp_transaction_t);
msrcp_trans = wmem_new(pinfo->pool, msrcp_transaction_t);
msrcp_trans->req_frame = 0;
msrcp_trans->rep_frame = 0;
msrcp_trans->req_time = pinfo->abs_ts;

View File

@ -143,12 +143,12 @@ dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, packet_info *pinfo,
/* "NFS Illustrated 14.7.13 */
static char *
pcnfsd_decode_obscure(const char* data, int len)
pcnfsd_decode_obscure(wmem_allocator_t *pool, const char* data, int len)
{
char *decoded_buf;
char *decoded_data;
decoded_buf = (char *)wmem_alloc(wmem_packet_scope(), len);
decoded_buf = (char *)wmem_alloc(pool, len);
decoded_data = decoded_buf;
for ( ; len>0 ; len--, data++, decoded_data++) {
*decoded_data = (*data ^ 0x5b) & 0x7f;
@ -159,7 +159,7 @@ pcnfsd_decode_obscure(const char* data, int len)
/* "NFS Illustrated" 14.7.13 */
static int
dissect_pcnfsd2_auth_call(tvbuff_t *tvb, packet_info *pinfo _U_,
dissect_pcnfsd2_auth_call(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, void* data _U_)
{
int newoffset;
@ -185,7 +185,7 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, packet_info *pinfo _U_,
if (ident) {
/* Only attempt to decode the ident if it has been specified */
if (strcmp(ident, RPC_STRING_EMPTY) != 0)
ident_decoded = pcnfsd_decode_obscure(ident, (int)strlen(ident));
ident_decoded = pcnfsd_decode_obscure(pinfo->pool, ident, (int)strlen(ident));
else
ident_decoded = ident;
@ -214,7 +214,7 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, packet_info *pinfo _U_,
if (password) {
/* Only attempt to decode the password if it has been specified */
if (strcmp(password, RPC_STRING_EMPTY))
pcnfsd_decode_obscure(password, (int)strlen(password));
pcnfsd_decode_obscure(pinfo->pool, password, (int)strlen(password));
if (password_tree)
proto_tree_add_string(password_tree,

View File

@ -502,7 +502,7 @@ static inline int client_to_server(packet_info *pinfo);
static inline int server_to_client(packet_info *pinfo);
static guint8* get_name_from_pmid(guint32 pmid, packet_info *pinfo);
static guint get_pcp_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
static const gchar *get_pcp_features_to_string(guint16 feature_flags);
static const gchar *get_pcp_features_to_string(wmem_allocator_t *pool, guint16 feature_flags);
static int dissect_pcp_message_creds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_message_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_message_start(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
@ -563,19 +563,19 @@ static guint8* get_name_from_pmid(guint32 pmid, packet_info *pinfo) {
name = (guint8*)wmem_map_lookup(pmid_to_name, GINT_TO_POINTER(pmid));
if(!name) {
name = (guint8*)wmem_strdup(wmem_packet_scope(), "Metric name unknown");
name = (guint8*)wmem_strdup(pinfo->pool, "Metric name unknown");
}
return name;
}
static const gchar *get_pcp_features_to_string(guint16 feature_flags)
static const gchar *get_pcp_features_to_string(wmem_allocator_t *pool, guint16 feature_flags)
{
const value_string *flag_under_test;
wmem_strbuf_t *string_buffer;
gsize string_length;
string_buffer = wmem_strbuf_new(wmem_packet_scope(), "");
string_buffer = wmem_strbuf_new(pool, "");
/* Build the comma-separated list of feature flags as a string. EG 'SECURE, COMPRESS, AUTH, ' */
flag_under_test = &pcp_feature_flags[0];
@ -1709,7 +1709,7 @@ static int dissect_pcp_partial_features(tvbuff_t *tvb, packet_info *pinfo, proto
};
feature_flags = tvb_get_ntohs(tvb, offset);
feature_flags_string = get_pcp_features_to_string(feature_flags);
feature_flags_string = get_pcp_features_to_string(pinfo->pool, feature_flags);
col_append_fstr(pinfo->cinfo, COL_INFO, " Features=[%s]", feature_flags_string);
@ -1814,8 +1814,8 @@ static int dissect_pcp_partial_label(tvbuff_t *tvb, packet_info *pinfo, proto_tr
proto_tree_add_item(pcp_label_sets_label_tree, hf_pcp_label_sets_labels_value, tvb, json_start_offset + value_offset, value_length, ENC_ASCII | ENC_NA);
/* Add to subtree */
guint8 *name = tvb_get_string_enc(wmem_packet_scope(), tvb, json_start_offset + name_offset, name_length, ENC_ASCII | ENC_NA);
guint8 *value = tvb_get_string_enc(wmem_packet_scope(), tvb, json_start_offset + value_offset, value_length, ENC_ASCII | ENC_NA);
guint8 *name = tvb_get_string_enc(pinfo->pool, tvb, json_start_offset + name_offset, name_length, ENC_ASCII | ENC_NA);
guint8 *value = tvb_get_string_enc(pinfo->pool, tvb, json_start_offset + value_offset, value_length, ENC_ASCII | ENC_NA);
proto_item_append_text(pcp_label_sets_label_item, " (%s:%s)", name, value);
proto_item_set_end(pcp_label_sets_label_item, tvb, offset);

View File

@ -968,12 +968,12 @@ quic_set_full_packet_number(quic_info_data_t *quic_info, quic_packet_info_t *qui
}
static const char *
cid_to_string(const quic_cid_t *cid)
cid_to_string(wmem_allocator_t *pool, const quic_cid_t *cid)
{
if (cid->len == 0) {
return "(none)";
}
char *str = (char *)wmem_alloc0(wmem_packet_scope(), 2 * cid->len + 1);
char *str = (char *)wmem_alloc0(pool, 2 * cid->len + 1);
bytes_to_hexstr(str, cid->cid, cid->len);
return str;
}
@ -2345,7 +2345,7 @@ dissect_quic_frame_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tree
proto_tree_add_item(ft_tree, hf_quic_stream_data, tvb, offset, (int)length, ENC_NA);
if (have_tap_listener(quic_follow_tap)) {
quic_follow_tap_data_t *follow_data = wmem_new0(wmem_packet_scope(), quic_follow_tap_data_t);
quic_follow_tap_data_t *follow_data = wmem_new0(pinfo->pool, quic_follow_tap_data_t);
follow_data->tvb = tvb_new_subset_remaining(tvb, offset);
follow_data->stream_id = stream_id;
@ -2765,7 +2765,7 @@ quic_pp_cipher_init(quic_pp_cipher *pp_cipher, int hash_algo, guint8 key_length,
*/
static void
quic_decrypt_message(quic_pp_cipher *pp_cipher, tvbuff_t *head, guint header_length,
guint8 first_byte, guint pkn_len, guint64 packet_number, quic_decrypt_result_t *result)
guint8 first_byte, guint pkn_len, guint64 packet_number, quic_decrypt_result_t *result, wmem_allocator_t *pool)
{
gcry_error_t err;
guint8 *header;
@ -2780,7 +2780,7 @@ quic_decrypt_message(quic_pp_cipher *pp_cipher, tvbuff_t *head, guint header_len
DISSECTOR_ASSERT(pkn_len < header_length);
DISSECTOR_ASSERT(1 <= pkn_len && pkn_len <= 4);
// copy header, but replace encrypted first byte and PKN by plaintext.
header = (guint8 *)tvb_memdup(wmem_packet_scope(), head, 0, header_length);
header = (guint8 *)tvb_memdup(pool, head, 0, header_length);
header[0] = first_byte;
for (guint i = 0; i < pkn_len; i++) {
header[header_length - 1 - i] = (guint8)(packet_number >> (8 * i));
@ -3105,7 +3105,7 @@ quic_create_decoders(packet_info *pinfo, quic_info_data_t *quic_info, quic_ciphe
}
guint hash_len = gcry_md_get_algo_dlen(quic_info->hash_algo);
char *secret = (char *)wmem_alloc0(wmem_packet_scope(), hash_len);
char *secret = (char *)wmem_alloc0(pinfo->pool, hash_len);
if (!tls13_get_quic_secret(pinfo, from_server, type, hash_len, hash_len, secret)) {
*error = "Secrets are not available";
@ -3127,7 +3127,7 @@ static gboolean
quic_get_traffic_secret(packet_info *pinfo, int hash_algo, quic_pp_state_t *pp_state, gboolean from_client)
{
guint hash_len = gcry_md_get_algo_dlen(hash_algo);
char *secret = (char *)wmem_alloc0(wmem_packet_scope(), hash_len);
char *secret = (char *)wmem_alloc0(pinfo->pool, hash_len);
if (!tls13_get_quic_secret(pinfo, !from_client, TLS_SECRET_APP, hash_len, hash_len, secret)) {
return FALSE;
}
@ -3353,7 +3353,7 @@ quic_process_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_
*/
if (!PINFO_FD_VISITED(pinfo)) {
if (!quic_packet->decryption.error && quic_is_pp_cipher_initialized(pp_cipher)) {
quic_decrypt_message(pp_cipher, tvb, offset, first_byte, pkn_len, quic_packet->packet_number, &quic_packet->decryption);
quic_decrypt_message(pp_cipher, tvb, offset, first_byte, pkn_len, quic_packet->packet_number, &quic_packet->decryption, pinfo->pool);
}
}
@ -3577,10 +3577,10 @@ quic_add_connection_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, qu
pi = proto_tree_add_uint(ctree, hf_quic_connection_number, tvb, 0, 0, conn->number);
proto_item_set_generated(pi);
#if 0
proto_tree_add_debug_text(ctree, "Client CID: %s", cid_to_string(&conn->client_cids.data));
proto_tree_add_debug_text(ctree, "Server CID: %s", cid_to_string(&conn->server_cids.data));
proto_tree_add_debug_text(ctree, "Client CID: %s", cid_to_string(pinfo->pool, &conn->client_cids.data));
proto_tree_add_debug_text(ctree, "Server CID: %s", cid_to_string(pinfo->pool, &conn->server_cids.data));
// Note: for Retry, this value has been cleared before.
proto_tree_add_debug_text(ctree, "InitialCID: %s", cid_to_string(&conn->client_dcid_initial));
proto_tree_add_debug_text(ctree, "InitialCID: %s", cid_to_string(pinfo->pool, &conn->client_dcid_initial));
#endif
}
@ -3630,10 +3630,10 @@ dissect_quic_long_header_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *q
}
if (dcid->len > 0) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", DCID=%s", cid_to_string(dcid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", DCID=%s", cid_to_string(pinfo->pool, dcid));
}
if (scid->len > 0) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", SCID=%s", cid_to_string(scid));
col_append_fstr(pinfo->cinfo, COL_INFO, ", SCID=%s", cid_to_string(pinfo->pool, scid));
}
return offset;
}
@ -3935,7 +3935,7 @@ dissect_quic_short_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tr
proto_tree_add_item(hdr_tree, hf_quic_dcid, tvb, offset, dcid.len, ENC_NA);
tvb_memcpy(tvb, dcid.cid, offset, dcid.len);
offset += dcid.len;
const char *dcid_str = cid_to_string(&dcid);
const char *dcid_str = cid_to_string(pinfo->pool, &dcid);
col_append_fstr(pinfo->cinfo, COL_INFO, ", DCID=%s", dcid_str);
proto_item_append_text(pi, " DCID=%s", dcid_str);
}
@ -4230,7 +4230,7 @@ dissect_quic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dgram_info->conn = conn;
dgram_info->from_server = from_server;
#if 0
proto_tree_add_debug_text(quic_tree, "Connection: %d %p DCID=%s SCID=%s from_server:%d", pinfo->num, dgram_info->conn, cid_to_string(&dcid), cid_to_string(&scid), dgram_info->from_server);
proto_tree_add_debug_text(quic_tree, "Connection: %d %p DCID=%s SCID=%s from_server:%d", pinfo->num, dgram_info->conn, cid_to_string(pinfo->pool, &dcid), cid_to_string(pinfo->pool, &scid), dgram_info->from_server);
} else {
proto_tree_add_debug_text(quic_tree, "Connection: %d %p from_server:%d", pinfo->num, dgram_info->conn, dgram_info->from_server);
#endif

View File

@ -84,7 +84,8 @@ _(VLIB_NODE_PROTO_HINT_TCP, tcp) \
_(VLIB_NODE_PROTO_HINT_UDP, udp)
static void
add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
gint start,
gint len, int hf)
{
gint next;
@ -95,7 +96,7 @@ add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
line_len = tvb_find_line_end(tvb, start, len, &next, FALSE);
data_len = next - start;
proto_tree_add_string(tree, hf, tvb, start, data_len,
tvb_format_stringzpad(wmem_packet_scope(), tvb, start, line_len));
tvb_format_stringzpad(pinfo->pool, tvb, start, line_len));
start += data_len;
len -= data_len;
}
@ -119,7 +120,7 @@ dissect_vpp_metadata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* How long is the metadata string? */
metadata_string_length = tvb_strsize(tvb, offset);
add_multi_line_string_to_tree(metadata_tree, tvb, 0,
add_multi_line_string_to_tree(metadata_tree, tvb, pinfo, 0,
metadata_string_length,
hf_vpp_metadata);
return tvb_captured_length(tvb);
@ -143,7 +144,7 @@ dissect_vpp_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* How long is the trace string? */
trace_string_length = tvb_strsize(tvb, offset);
add_multi_line_string_to_tree(trace_tree, tvb, 0,
add_multi_line_string_to_tree(trace_tree, tvb, pinfo, 0,
trace_string_length,
hf_vpp_buffer_trace);
return tvb_captured_length(tvb);
@ -166,7 +167,7 @@ dissect_vpp_opaque(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
opaque_tree = proto_item_add_subtree(ti, ett_vpp_opaque);
opaque_string_length = tvb_strsize(tvb, offset);
add_multi_line_string_to_tree(opaque_tree, tvb, 0, opaque_string_length,
add_multi_line_string_to_tree(opaque_tree, tvb, pinfo, 0, opaque_string_length,
hf_vpp_buffer_opaque);
return tvb_captured_length(tvb);
@ -188,7 +189,7 @@ dissect_vpp_opaque2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
opaque2_tree = proto_item_add_subtree(ti, ett_vpp_opaque2);
opaque2_string_length = tvb_strsize(tvb, offset);
add_multi_line_string_to_tree(opaque2_tree, tvb, 0, opaque2_string_length,
add_multi_line_string_to_tree(opaque2_tree, tvb, pinfo, 0, opaque2_string_length,
hf_vpp_buffer_opaque2);
return tvb_captured_length(tvb);

View File

@ -31,6 +31,8 @@ wmem_epan_scope(void);
* @brief Fetch the current packet scope.
*
* Allocated memory is freed when wmem_leave_packet_scope() is called, which is normally at the end of packet dissection.
* N.B. Please use pinfo->pool in new code when possible. See
* <https://www.wireshark.org/lists/wireshark-dev/202107/msg00052.html>
*/
WS_DLL_PUBLIC
wmem_allocator_t *

View File

@ -282,8 +282,8 @@ tap_packet_status BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_pt
}
handle = QString("0x%1").arg(tap_handles->handle, 4, 16, QChar('0'));
uuid = QString(print_numeric_bluetooth_uuid(&tap_handles->uuid));
uuid_name = QString(print_bluetooth_uuid(&tap_handles->uuid));
uuid = QString(print_numeric_bluetooth_uuid(pinfo->pool, &tap_handles->uuid));
uuid_name = QString(print_bluetooth_uuid(pinfo->pool, &tap_handles->uuid));
if (dialog->ui->removeDuplicatesCheckBox->checkState() == Qt::Checked) {
QTreeWidgetItemIterator i_item(dialog->ui->tableTreeWidget);