device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / NetworkManagerUtils.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Copyright 2004 - 2016 Red Hat, Inc.
19  * Copyright 2005 - 2008 Novell, Inc.
20  */
21
22 #ifndef __NETWORKMANAGER_UTILS_H__
23 #define __NETWORKMANAGER_UTILS_H__
24
25 #include "nm-core-utils.h"
26
27 /*****************************************************************************/
28
29 const char *nm_utils_get_shared_wifi_permission (NMConnection *connection);
30
31 void nm_utils_complete_generic (NMPlatform *platform,
32                                 NMConnection *connection,
33                                 const char *ctype,
34                                 const GSList *existing,
35                                 const char *preferred_id,
36                                 const char *fallback_id_prefix,
37                                 const char *ifname_prefix,
38                                 gboolean default_enable_ipv6);
39
40 typedef gboolean (NMUtilsMatchFilterFunc) (NMConnection *connection, gpointer user_data);
41
42 NMConnection *nm_utils_match_connection (GSList *connections,
43                                          NMConnection *original,
44                                          gboolean device_has_carrier,
45                                          gint64 default_v4_metric,
46                                          gint64 default_v6_metric,
47                                          NMUtilsMatchFilterFunc match_filter_func,
48                                          gpointer match_filter_data);
49
50 void nm_utils_g_value_set_object_path (GValue *value, gpointer object);
51
52 /**
53  * NMUtilsObjectFunc:
54  * @object: the object to filter on
55  * @user_data: data passed to the function from the caller
56  *
57  * Returns: %TRUE if the object should be used, %FALSE if not
58  */
59 typedef gboolean (*NMUtilsObjectFunc) (GObject *object, gpointer user_data);
60
61 void nm_utils_g_value_set_object_path_array (GValue *value,
62                                              GSList *objects,
63                                              NMUtilsObjectFunc filter_func,
64                                              gpointer user_data);
65
66 /*****************************************************************************/
67
68 #endif /* __NETWORKMANAGER_UTILS_H__ */