Wireshark-dev: [Wireshark-dev] Registering header fields later/in other functions?
From: Thomas Wiens <th.wiens@xxxxxx>
Date: Sat, 12 Feb 2011 22:32:13 +0100
Hi,

I am developing a custom dissector in C.
For clearness I want to put parts of the dissector in different source files.

The problem I have, is that the header fields have to be registered directly after the proto_register_protocol() call. It would be nice if it would be possible to declare and register the header fields only in the sourcefile where they are used.
Is there a way to do this?

Example (the main hf struct-array was registered before):
gint hf_pr = -1;
hf_register_info hf = { &hf_pr,
{ "index", "s7comm.szl_0131_2", FT_UINT16, BASE_HEX, NULL, 0x0, "SZL ID 0x0131 Index 2: index", HFILL }
};
// is it possible to register header field here?
proto_tree_add_uint(tree, hf_pr, tvb, offset, 2, tvb_get_ntohs(tvb, offset));

I don't need to filter on these entries, but I want to use the nicer display features I have with the header fields (e.g. comments in status bar). At this time I'm using the proto_tree_add_text() in my 'outsourced' functions to display the dissected items.

Thanks!

--
Regards

Thomas Wiens