device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-connectivity.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 (C) 2011 Thomas Bechtold <thomasbechtold@jpberlin.de>
19  */
20
21 #ifndef __NETWORKMANAGER_CONNECTIVITY_H__
22 #define __NETWORKMANAGER_CONNECTIVITY_H__
23
24
25 #include "nm-default.h"
26 #include "nm-dbus-interface.h"
27
28 #define NM_TYPE_CONNECTIVITY            (nm_connectivity_get_type ())
29 #define NM_CONNECTIVITY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTIVITY, NMConnectivity))
30 #define NM_CONNECTIVITY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONNECTIVITY, NMConnectivityClass))
31 #define NM_IS_CONNECTIVITY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTIVITY))
32 #define NM_IS_CONNECTIVITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTIVITY))
33 #define NM_CONNECTIVITY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTIVITY, NMConnectivityClass))
34
35 /* Properties */
36 #define NM_CONNECTIVITY_URI       "uri"
37 #define NM_CONNECTIVITY_INTERVAL  "interval"
38 #define NM_CONNECTIVITY_RESPONSE  "response"
39 #define NM_CONNECTIVITY_STATE     "state"
40
41 struct _NMConnectivity {
42         GObject parent;
43 };
44
45 typedef struct {
46         GObjectClass parent;
47 } NMConnectivityClass;
48
49 GType nm_connectivity_get_type (void);
50
51 const char *nm_connectivity_state_to_string (NMConnectivityState state);
52
53 NMConnectivity      *nm_connectivity_new (const char *uri,
54                                           guint interval,
55                                           const char *response);
56
57 void                 nm_connectivity_set_online   (NMConnectivity       *self,
58                                                    gboolean              online);
59
60 NMConnectivityState  nm_connectivity_get_state    (NMConnectivity       *self);
61
62 void                 nm_connectivity_check_async  (NMConnectivity       *self,
63                                                    GAsyncReadyCallback   callback,
64                                                    gpointer              user_data);
65 NMConnectivityState  nm_connectivity_check_finish (NMConnectivity       *self,
66                                                    GAsyncResult         *result,
67                                                    GError              **error);
68
69 #endif /* __NETWORKMANAGER_CONNECTIVITY_H__ */