This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Replacing se_new() with wmem_new()

0
1

I have a dissector that was working fine in the 1.10 series and made use of se_new() and <epan emem.h="">.

This didn't build in 1.12.0, I switched all calls to wmem_new(wmem_file_scope(), ). It build fine but blows up when I try to capture things. Examples below.

check_key = se_new(gint) -> check_key = wmem_new(wmem_file_scope(), gint)

p_add_proto_data(pinfo->fd, proto_frame, 0, request_info) -> p_add_proto_data(wmem_file_scope(), pinfo->fd, proto_frame, 0, request_info);

p_remove_proto_data(pinfo->fd, proto_frame, 0) -> p_remove_proto_data(wmem_file_scope(), pinfo->fd, proto_frame, 0)

I can't seem to find any documentation on wmwm_new(). I also have no idea when to use wmem_file_scope() vs wmem_packet_scope().

Thanks, Brian

asked 26 Aug '14, 10:58

brwiese's gravatar image

brwiese
26111211
accept rate: 50%


One Answer:

1

It looks like you are passing pinfo->fd to p_add_proto_data() and p_remove_proto_data(), when you should be simply passing pinfo. See epan/frame_data.h.

Also, wmem_new() is a macro defined in epan/wmem/wmem_core.h.

For help with wmem and memory pools, start with doc/README.wmem, and then have a look at the other README files where wmem is used, as well as Wireshark dissectors for more examples on its usage.

answered 26 Aug '14, 12:33

cmaynard's gravatar image

cmaynard ♦♦
9.4k1038142
accept rate: 20%

Thank you, the pinfo->fd seems to be the problem.

Sincerely, Brian

(26 Aug '14, 13:37) brwiese