device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-manager.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) 2007 - 2008 Novell, Inc.
19  * Copyright (C) 2007 - 2010 Red Hat, Inc.
20  */
21
22 #ifndef __NETWORKMANAGER_MANAGER_H__
23 #define __NETWORKMANAGER_MANAGER_H__
24
25 #include "nm-exported-object.h"
26 #include "nm-settings-connection.h"
27
28 #define NM_TYPE_MANAGER            (nm_manager_get_type ())
29 #define NM_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MANAGER, NMManager))
30 #define NM_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MANAGER, NMManagerClass))
31 #define NM_IS_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MANAGER))
32 #define NM_IS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MANAGER))
33 #define NM_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MANAGER, NMManagerClass))
34
35 #define NM_MANAGER_VERSION "version"
36 #define NM_MANAGER_STATE "state"
37 #define NM_MANAGER_STARTUP "startup"
38 #define NM_MANAGER_NETWORKING_ENABLED "networking-enabled"
39 #define NM_MANAGER_WIRELESS_ENABLED "wireless-enabled"
40 #define NM_MANAGER_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
41 #define NM_MANAGER_WWAN_ENABLED "wwan-enabled"
42 #define NM_MANAGER_WWAN_HARDWARE_ENABLED "wwan-hardware-enabled"
43 #define NM_MANAGER_WIMAX_ENABLED "wimax-enabled"
44 #define NM_MANAGER_WIMAX_HARDWARE_ENABLED "wimax-hardware-enabled"
45 #define NM_MANAGER_ACTIVE_CONNECTIONS "active-connections"
46 #define NM_MANAGER_CONNECTIVITY "connectivity"
47 #define NM_MANAGER_PRIMARY_CONNECTION "primary-connection"
48 #define NM_MANAGER_PRIMARY_CONNECTION_TYPE "primary-connection-type"
49 #define NM_MANAGER_ACTIVATING_CONNECTION "activating-connection"
50 #define NM_MANAGER_DEVICES "devices"
51 #define NM_MANAGER_METERED "metered"
52 #define NM_MANAGER_GLOBAL_DNS_CONFIGURATION "global-dns-configuration"
53 #define NM_MANAGER_ALL_DEVICES "all-devices"
54
55 /* Not exported */
56 #define NM_MANAGER_HOSTNAME "hostname"
57 #define NM_MANAGER_SLEEPING "sleeping"
58 #define NM_MANAGER_STATE_FILE "state-file"
59
60 /* Internal signals */
61 #define NM_MANAGER_ACTIVE_CONNECTION_ADDED   "active-connection-added"
62 #define NM_MANAGER_ACTIVE_CONNECTION_REMOVED "active-connection-removed"
63 #define NM_MANAGER_CONFIGURE_QUIT            "configure-quit"
64 #define NM_MANAGER_STATE_CHANGED             "state-changed"
65
66
67 struct _NMManager {
68         NMExportedObject parent;
69 };
70
71 typedef struct {
72         NMExportedObjectClass parent;
73
74         /* Signals */
75         void (*device_added) (NMManager *manager, NMDevice *device);
76         void (*device_removed) (NMManager *manager, NMDevice *device);
77         void (*state_changed) (NMManager *manager, guint state);
78 } NMManagerClass;
79
80 GType nm_manager_get_type (void);
81
82 /* nm_manager_setup() should only be used by main.c */
83 NMManager *   nm_manager_setup                         (const char *state_file,
84                                                         gboolean initial_net_enabled,
85                                                         gboolean initial_wifi_enabled,
86                                                         gboolean initial_wwan_enabled);
87
88 NMManager *   nm_manager_get                           (void);
89
90 gboolean      nm_manager_start                         (NMManager *manager,
91                                                         GError **error);
92 void          nm_manager_stop                          (NMManager *manager);
93 NMState       nm_manager_get_state                     (NMManager *manager);
94 const GSList *nm_manager_get_active_connections        (NMManager *manager);
95 GSList *      nm_manager_get_activatable_connections   (NMManager *manager);
96
97 /* Device handling */
98
99 const GSList *      nm_manager_get_devices             (NMManager *manager);
100
101 NMDevice *          nm_manager_get_device_by_ifindex   (NMManager *manager,
102                                                         int ifindex);
103
104 char *              nm_manager_get_connection_iface (NMManager *self,
105                                                      NMConnection *connection,
106                                                      NMDevice **out_parent,
107                                                      GError **error);
108
109 NMActiveConnection *nm_manager_activate_connection     (NMManager *manager,
110                                                         NMSettingsConnection *connection,
111                                                         const char *specific_object,
112                                                         NMDevice *device,
113                                                         NMAuthSubject *subject,
114                                                         GError **error);
115
116 gboolean            nm_manager_deactivate_connection   (NMManager *manager,
117                                                         const char *connection_path,
118                                                         NMDeviceStateReason reason,
119                                                         GError **error);
120
121
122 #endif /* __NETWORKMANAGER_MANAGER_H__ */