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

How to extract parsed keys related to UAT?

0

I need to work with a hash table keys of type struct (something similar to the defined struct below). These keys are related to number of parsed values from a UAT in my protocol dissector. I used g_hash_table_get_keys_as_array () but I'm getting several errors and warnings

: warning: old-style function definition [-Wold-style-definition]
   : warning: implicit declaration of function 'g_hash_table_get_keys_as_array' [-Wimplicit-function-declaration]
   : error: incompatible types when assigning to type 'struct key[]' from type 'int'
   : warning: variable 'keys_array' set but not used [-Wunused-but-set-variable]

I'm not sure why I'm getting these errors and not sure how to solve them. my guess that I'm not using the function in the proper way but again I'm not sure what I'm missing. I'd appreciate any hints that help me to better understand or solve the problem. my related code looks like the following:

typedef struct _key {
  guint32 num;
  address address;
  guint id;
} key;

static void Working_with_hash_table_keys() { key keys_array[] = NULL; keys_array= (*key ) g_hash_table_get_keys_as_array(my_key_hash);

}

Thank you. Flora

asked 13 Jan ‘15, 18:50

flora's gravatar image

flora
156313338
accept rate: 100%

edited 13 Jan ‘15, 18:52


One Answer:

1

g_hash_table_get_keys_as_array is only available starting from GLib 2.40. Given the warnings you get, I guess you have an older GLib release. So you should look at alternative methods.

answered 13 Jan '15, 23:13

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%