5 * "Decode As" UI utility routines.
7 * By David Hampton <dhampton@mac.com>
8 * Copyright 2001 David Hampton
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __DECODE_AS_UTILS_H__
27 #define __DECODE_AS_UTILS_H__
29 #include "ws_symbol_export.h"
32 * "Decode As" / "User Specified Decodes" dialog box.
33 * @ingroup main_ui_group
38 #endif /* __cplusplus */
40 /** Reset the "decode as" entries and reload ones of the current profile.
42 void load_decode_as_entries(void);
44 /** This routine creates one entry in the list of protocol dissector
45 * that need to be reset. It is called by the g_hash_table_foreach
46 * routine once for each changed entry in a dissector table.
47 * Unfortunately it cannot delete the entry immediately as this screws
48 * up the foreach function, so it builds a list of dissectors to be
49 * reset once the foreach routine finishes.
51 * @param table_name The table name in which this dissector is found.
53 * @param key A pointer to the key for this entry in the dissector
54 * hash table. This is generally the numeric selector of the
55 * protocol, i.e. the ethernet type code, IP port number, TCP port
58 * @param value A pointer to the value for this entry in the dissector
59 * hash table. This is an opaque pointer that can only be handed back
60 * to routine in the file packet.c - but it's unused.
62 * @param user_data Unused.
64 void decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
65 gpointer key, gpointer value _U_,
66 gpointer user_data _U_);
68 /** Clear all "decode as" settings.
70 void decode_clear_all(void);
72 /** Open the "decode_as_entries" configuration file and write its header.
74 * Entries should be written with decode_as_write_entry(). The file should
75 * be closed with fclose().
77 * @return A valid FILE pointer on success, NULL on failure.
79 FILE *decode_as_open(void);
81 /** Write an entry to the "decode_as_entries" file.
83 * @param[in] da_file FILE pointer returned by decode_as_open().
84 * @param[in] table_name A short decode_as table name.
85 * @param[in] selector Integer or string selector, e.g. 80 for TCP port 80.
86 * @param[in] default_proto The default protocol for the selector, or "(none)".
87 * @param[in] current_proto The desired protocol for the selector, or "(none)" to disable.
89 void decode_as_write_entry(FILE *da_file, const char *table_name, const char *selector, const char *default_proto, const char *current_proto);
93 #endif /* __cplusplus */
95 #endif /* __DECODE_AS_UTILS_H__ */