device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-dispatcher.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) 2004 - 2012 Red Hat, Inc.
19  * Copyright (C) 2005 - 2008 Novell, Inc.
20  */
21
22 #ifndef __NETWORKMANAGER_DISPATCHER_H__
23 #define __NETWORKMANAGER_DISPATCHER_H__
24
25 #include <stdio.h>
26
27 #include "nm-default.h"
28 #include "nm-connection.h"
29
30 typedef enum {
31         DISPATCHER_ACTION_HOSTNAME,
32         DISPATCHER_ACTION_PRE_UP,
33         DISPATCHER_ACTION_UP,
34         DISPATCHER_ACTION_PRE_DOWN,
35         DISPATCHER_ACTION_DOWN,
36         DISPATCHER_ACTION_VPN_PRE_UP,
37         DISPATCHER_ACTION_VPN_UP,
38         DISPATCHER_ACTION_VPN_PRE_DOWN,
39         DISPATCHER_ACTION_VPN_DOWN,
40         DISPATCHER_ACTION_DHCP4_CHANGE,
41         DISPATCHER_ACTION_DHCP6_CHANGE
42 } DispatcherAction;
43
44 typedef void (*DispatcherFunc) (guint call_id, gpointer user_data);
45
46 gboolean nm_dispatcher_call (DispatcherAction action,
47                              NMSettingsConnection *settings_connection,
48                              NMConnection *applied_connection,
49                              NMDevice *device,
50                              DispatcherFunc callback,
51                              gpointer user_data,
52                              guint *out_call_id);
53
54 gboolean nm_dispatcher_call_sync (DispatcherAction action,
55                                   NMSettingsConnection *settings_connection,
56                                   NMConnection *applied_connection,
57                                   NMDevice *device);
58
59 gboolean nm_dispatcher_call_vpn (DispatcherAction action,
60                                  NMSettingsConnection *settings_connection,
61                                  NMConnection *applied_connection,
62                                  NMDevice *parent_device,
63                                  const char *vpn_iface,
64                                  NMIP4Config *vpn_ip4_config,
65                                  NMIP6Config *vpn_ip6_config,
66                                  DispatcherFunc callback,
67                                  gpointer user_data,
68                                  guint *out_call_id);
69
70 gboolean nm_dispatcher_call_vpn_sync (DispatcherAction action,
71                                       NMSettingsConnection *settings_connection,
72                                       NMConnection *applied_connection,
73                                       NMDevice *parent_device,
74                                       const char *vpn_iface,
75                                       NMIP4Config *vpn_ip4_config,
76                                       NMIP6Config *vpn_ip6_config);
77
78 void nm_dispatcher_call_cancel (guint call_id);
79
80 void nm_dispatcher_init (void);
81
82 #endif /* __NETWORKMANAGER_DISPATCHER_H__ */