/* add a single binding to the Show list */ static void decode_dcerpc_add_show_list_single(gpointer data, gpointer user_data) { gchar string1[20]; decode_dcerpc_bind_values_t *binding = data; g_snprintf(string1, sizeof(string1), "ctx_id: %u", binding->ctx_id); decode_add_to_show_list ( user_data, "DCE-RPC", string1, "-", binding->ifname->str); }
/* * This routine creates one entry in the list of protocol dissector * that have been changed. It is called by the g_hash_foreach routine * once for each changed entry in a dissector table. * * @param table_name The table name in which this dissector is found. * * @param key A pointer to the key for this entry in the dissector * hash table. This is generally the numeric selector of the * protocol, i.e. the ethernet type code, IP port number, TCP port * number, etc. * * @param value A pointer to the value for this entry in the dissector * hash table. This is an opaque pointer that can only be handed back * to routine in the file packet.c * * @param user_data A pointer to the list in which this information * should be stored. */ static void decode_build_show_list (const gchar *table_name, ftenum_t selector_type, gpointer key, gpointer value, gpointer user_data) { dissector_handle_t current, initial; const gchar *current_proto_name, *initial_proto_name; gchar *selector_name; gchar string1[20]; da_entry_t *entry; entry = g_new(da_entry_t,1); g_assert(user_data); g_assert(value); current = dtbl_entry_get_handle((dtbl_entry_t *)value); if (current == NULL) current_proto_name = DECODE_AS_NONE; else current_proto_name = dissector_handle_get_short_name(current); initial = dtbl_entry_get_initial_handle((dtbl_entry_t *)value); if (initial == NULL) initial_proto_name = DECODE_AS_NONE; else initial_proto_name = dissector_handle_get_short_name(initial); switch (selector_type) { case FT_UINT8: case FT_UINT16: case FT_UINT24: case FT_UINT32: switch (get_dissector_table_param(table_name)) { case BASE_DEC: g_snprintf(string1, sizeof(string1), "%u", GPOINTER_TO_UINT(key)); break; case BASE_HEX: switch (get_dissector_table_selector_type(table_name)) { case FT_UINT8: g_snprintf(string1, sizeof(string1), "0x%02x", GPOINTER_TO_UINT(key)); break; case FT_UINT16: g_snprintf(string1, sizeof(string1), "0x%04x", GPOINTER_TO_UINT(key)); break; case FT_UINT24: g_snprintf(string1, sizeof(string1), "0x%06x", GPOINTER_TO_UINT(key)); break; case FT_UINT32: g_snprintf(string1, sizeof(string1), "0x%08x", GPOINTER_TO_UINT(key)); break; default: g_assert_not_reached(); break; } break; case BASE_OCT: g_snprintf(string1, sizeof(string1), "%#o", GPOINTER_TO_UINT(key)); break; } selector_name = string1; break; case FT_STRING: case FT_STRINGZ: case FT_UINT_STRING: case FT_STRINGZPAD: selector_name = (gchar *)key; break; default: g_assert_not_reached(); selector_name = NULL; break; } decode_add_to_show_list ( user_data, get_dissector_table_ui_name(table_name), selector_name, initial_proto_name, current_proto_name); entry->table = g_strdup(table_name); entry->selector = GPOINTER_TO_UINT(key); entry->initial = g_strdup(initial_proto_name); entry->current = g_strdup(current_proto_name); da_entries = g_slist_append(da_entries, entry); }