Wireshark-dev: Re: [Wireshark-dev] Dissector Development; _init function for inizilizing GHashT

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Mon, 26 Jan 2015 11:27:31 +0100
2015-01-26 8:58 GMT+01:00 leonardocito@xxxxxxxxx <leonardocito@xxxxxxxxx>:
I am working on the FTP dissector at the moment.

I have introduced a GHashTable for the purpose of storing seq and lastackseq numbers and pinfo data.

I have introduced a static void ftp_init(void) function in the same fashion as in other protocols - ie. packet-acse.c -
in which I call g_hash_table_new.

The relevant hashtble_oid_hash and 
hashtble_oid_equal are not called, presumably because they are not registered by the

g_hash_table_new  function.

My debugger indicates note of these funcion code is reachable.

What do I need to fix this?

Hi,

did you register the init function with a line
register_init_routine(ftp_init);
in proto_register_ftp() function?
You took as example some dead code (as seen with the #if NOT NEEDED compilation flag in packet-acse.c) which is not the best reference :)

Regards,
Pascal.