Witness: fix notify change
[metze/wireshark/wip.git] / ui / decode_as_utils.h
1 /* decode_as_utils.h
2  *
3  * $Id$
4  *
5  * "Decode As" UI utility routines.
6  *
7  * By David Hampton <dhampton@mac.com>
8  * Copyright 2001 David Hampton
9  *
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.
14  *
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.
19  *
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.
23  *
24  */
25
26 #ifndef __DECODE_AS_UTILS_H__
27 #define __DECODE_AS_UTILS_H__
28
29 #include "ws_symbol_export.h"
30
31 /** @file
32  *  "Decode As" / "User Specified Decodes" dialog box.
33  *  @ingroup main_ui_group
34  */
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 /** Reset the "decode as" entries and reload ones of the current profile.
41  */
42 void load_decode_as_entries(void);
43
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.
50  *
51  * @param table_name The table name in which this dissector is found.
52  *
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
56  * number, etc.
57  *
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.
61  *
62  * @param user_data Unused.
63  */
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_);
67
68 /** Clear all "decode as" settings.
69  */
70 void decode_clear_all(void);
71
72 /** Open the "decode_as_entries" configuration file and write its header.
73  *
74  * Entries should be written with decode_as_write_entry(). The file should
75  * be closed with fclose().
76  *
77  * @return A valid FILE pointer on success, NULL on failure.
78  */
79 FILE *decode_as_open(void);
80
81 /** Write an entry to the "decode_as_entries" file.
82  *
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.
88  */
89 void decode_as_write_entry(FILE *da_file, const char *table_name, const char *selector, const char *default_proto, const char *current_proto);
90
91 #ifdef __cplusplus
92 }
93 #endif /* __cplusplus */
94
95 #endif /* __DECODE_AS_UTILS_H__ */