1 /* profile.h
2  * Definitions for dialog box for profiles editing.
3  * Stig Bjorlykke <stig@bjorlykke.org>, 2008
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __PROFILE_H__
13 #define __PROFILE_H__
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */
18 
19 /** @file
20  * "Configuration Profiles" dialog box
21  * @ingroup dialog_group
22  */
23 
24 #define PROF_STAT_DEFAULT  1
25 #define PROF_STAT_EXISTS   2
26 #define PROF_STAT_NEW      3
27 #define PROF_STAT_CHANGED  4
28 #define PROF_STAT_COPY     5
29 #define PROF_STAT_IMPORT   6
30 
31 typedef struct {
32     char     *name;             /* profile name */
33     char     *reference;        /* profile reference */
34     int       status;
35     gboolean  is_global;
36     gboolean  from_global;
37     gboolean  is_import;
38 } profile_def;
39 
40 /** @file
41  * "Configuration Profiles" utility routines
42  * @ingroup utility_group
43  */
44 
45 /** Initialize the profile list. Can be called more than once.
46  */
47 void init_profile_list(void);
48 
49 /** User requested the "Configuration Profiles" popup menu.
50  *
51  * @param name Profile name
52  * @param parent Parent profile name
53  * @param status Current status
54  * @param is_global Profile is in the global configuration directory
55  * @param from_global Profile is copied from the global configuration directory
56  * @param is_import Profile has been imported and no directory has to be created
57  *
58  * @return A pointer to the new profile list
59  */
60 GList *add_to_profile_list(const char *name, const char *parent, int status,
61                            gboolean is_global, gboolean from_global, gboolean is_import);
62 
63 /** Refresh the current (non-edited) profile list.
64  */
65 void copy_profile_list(void);
66 
67 /** Clear out the profile list
68  *
69  * @param edit_list Remove edited entries
70  */
71 void empty_profile_list(gboolean edit_list);
72 
73 /** Remove an entry from the profile list.
74  *
75  * @param fl_entry Profile list entry
76  */
77 void remove_from_profile_list(GList *fl_entry);
78 
79 /** Current profile list
80  *
81  * @return The head of the current profile list
82  */
83 GList *current_profile_list(void);
84 
85 /** Edited profile list
86  *
87  * @return The head of the edited profile list
88  */
89 GList * edited_profile_list(void);
90 
91 /** Apply the changes in the edited profile list
92  * @return NULL if the operation was successful or an error message otherwise.
93  * The error message must be freed by the caller.
94  */
95 gchar *apply_profile_changes(void);
96 
97 /** Given a profile name, return the name of its parent profile.
98  *
99  * @param profilename Child profile name
100  *
101  * @return Parent profile name
102  */
103 const gchar *get_profile_parent (const gchar *profilename);
104 
105 /** Check the validity of a profile name.
106  *
107  * @param name Profile name
108  * @return NULL if the name is valid or an error message otherwise.
109  */
110 gchar *profile_name_is_valid(const gchar *name);
111 
112 /** Remove the current profile.
113  *
114  * @return TRUE if the current profile exists and was successfully deleted
115  * or FALSE otherwise.
116  */
117 gboolean delete_current_profile(void);
118 
119 #ifdef __cplusplus
120 }
121 #endif /* __cplusplus */
122 
123 #endif /* __PROFILE_H__ */
124