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

error: passing argument 1 of ‘new_create_dissector_handle’ from incompatible pointer type

0

I wrote a plugin for wireshark 1.7.1 which was working fine then. When i tried same source with 1.9.0 , it gives me following error while make install.

packet-extl2.c: In function 'proto_reg_handoff_extl2':
packet-extl2.c:265: error: passing argument 1 of 'new_create_dissector_handle' from incompatible pointer type
packet-extl2.c:266: error: implicit declaration of function 'dissector_add'
make[3]: [packet-extl2.lo] Error 1
make[3]: Leaving directory /root/wireshark/wireshark-1.9.0/plugins/extl2' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory/root/wireshark/wireshark-1.9.0/plugins'
make[1]:
[install-recursive] Error 1
make[1]: Leaving directory `/root/wireshark/wireshark-1.9.0'
make: *** [install] Error 2
[[email protected] wireshark-1.9.0]$

Here is my function which is creating problems:

void
proto_reg_handoff_extl2(void)
{
dissector_handle_t extl2_handle;
ip_handle = find_dissector("ip");
extl2_handle = new_create_dissector_handle(dissect_extl2,proto_extl2);
dissector_add("ethertype", 0x0800,extl2_handle);
dissector_add("ethertype",0x86DD,extl2_handle);
}

I am not sure what's wrong. dissect_extl2 returns "tvb_length" and has return type of static int. And also what header i am missing to get "implicit declaration of dissector_add" . Any help appreciated.

Thanks for your time.

asked 28 Feb '13, 06:00

yogeshg's gravatar image

yogeshg
41222326
accept rate: 0%

edited 28 Feb '13, 06:11


2 Answers:

1

I think the problem you're experiencing is that the prototype for the dissectors' top-level dissection routine has changed. Here's how I get around it with my (private) dissector (which I compile on into Wireshark versions before and after this change):

static int
#if defined(VERSION_MAJOR) && (VERSION_MAJOR > 1 || (VERSION_MAJOR == 1 && VERSION_MINOR > 8))
dissect_XXX(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
#else
dissect_XXX(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
#endif

answered 28 Feb '13, 06:40

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

at least error is not coming now , thank you.

(28 Feb '13, 07:34) yogeshg

1

Try changing dissector_add() to dissector_add_uint().

answered 28 Feb '13, 06:33

Anders's gravatar image

Anders ♦
4.6k952
accept rate: 17%