> I am working on a protocol dissector for a protocol which can encapsulate
> HTTP requests and replies.  Obviously, I'd like to take advantage of the
> existing http dissector, but am unsure of the proper way to do so.
> 
> I figured I should just create a new tvb and pass it on to the dissector
> method, but dissect_http is a static function.  I took away the static
> keyword and call the code like this:
> 
>         tvbuff_t *sub_tvb;
>         sub_tvb = tvb_new_subset(tvb, offset + 12, -1, -1);
>         dissect_http(sub_tvb, pinfo, tree);
> 
> Is this the correct way to take advantage of existing dissectors?  I would
> think so, except that the dissect_http function must have been declared
> static for a reason, right?
Right.
Dissectors should rarely, if ever, be called directly; they should be
called through a handoff table, a heuristic dissector handoff table, or
through a handle, as that allows the Ethereal core to do things such as
checking whether the protocol for the called dissector has been disabled
and setting the "current_protocol" string (and, in the future, possibly
doing other things as well).
So the right way to do that would be to change the
"proto_register_http()" routine to do
	register_dissector("http", dissect_http, proto_http);
and to have your dissector:
	declare a static "dissector_handle_t" variable "http_handle":
		static dissector_handle_t http_handle;
	have its "proto_reg_handoff" routine do
		/*
		 * Get a handle for the HTTP dissector.
		 */
		http_handle = find_dissector("http");
	call the HTTP dissector with
		tvbuff_t *sub_tvb;
		sub_tvb = tvb_new_subset(tvb, offset + 12, -1, -1);
		call_dissector(http_handle, sub_tvb, pinfo, tree);