1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
* Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#ifndef NM_DEVICE_INTERFACE_H
#define NM_DEVICE_INTERFACE_H
#include <glib-object.h>
#include "NetworkManager.h"
#include "nm-connection.h"
#include "nm-activation-request.h"
#define NM_TYPE_DEVICE_INTERFACE (nm_device_interface_get_type ())
#define NM_DEVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_INTERFACE, NMDeviceInterface))
#define NM_IS_DEVICE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_INTERFACE))
#define NM_DEVICE_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_DEVICE_INTERFACE, NMDeviceInterface))
#define IS_ACTIVATING_STATE(state) \
(state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_ACTIVATED)
typedef enum
{
NM_DEVICE_INTERFACE_ERROR_CONNECTION_ACTIVATING = 0,
NM_DEVICE_INTERFACE_ERROR_CONNECTION_INVALID,
NM_DEVICE_INTERFACE_ERROR_NOT_ACTIVE,
} NMDeviceInterfaceError;
#define NM_DEVICE_INTERFACE_ERROR (nm_device_interface_error_quark ())
#define NM_TYPE_DEVICE_INTERFACE_ERROR (nm_device_interface_error_get_type ())
#define NM_DEVICE_INTERFACE_DISCONNECT_REQUEST "disconnect-request"
#define NM_DEVICE_INTERFACE_UDI "udi"
#define NM_DEVICE_INTERFACE_IFACE "interface"
#define NM_DEVICE_INTERFACE_IP_IFACE "ip-interface"
#define NM_DEVICE_INTERFACE_DRIVER "driver"
#define NM_DEVICE_INTERFACE_CAPABILITIES "capabilities"
#define NM_DEVICE_INTERFACE_IP4_ADDRESS "ip4-address"
#define NM_DEVICE_INTERFACE_IP4_CONFIG "ip4-config"
#define NM_DEVICE_INTERFACE_DHCP4_CONFIG "dhcp4-config"
#define NM_DEVICE_INTERFACE_IP6_CONFIG "ip6-config"
#define NM_DEVICE_INTERFACE_DHCP6_CONFIG "dhcp6-config"
#define NM_DEVICE_INTERFACE_STATE "state"
#define NM_DEVICE_INTERFACE_ACTIVE_CONNECTION "active-connection"
#define NM_DEVICE_INTERFACE_DEVICE_TYPE "device-type" /* ugh */
#define NM_DEVICE_INTERFACE_MANAGED "managed"
#define NM_DEVICE_INTERFACE_FIRMWARE_MISSING "firmware-missing"
#define NM_DEVICE_INTERFACE_TYPE_DESC "type-desc" /* Internal only */
#define NM_DEVICE_INTERFACE_RFKILL_TYPE "rfkill-type" /* Internal only */
#define NM_DEVICE_INTERFACE_IFINDEX "ifindex" /* Internal only */
typedef enum {
NM_DEVICE_INTERFACE_PROP_FIRST = 0x1000,
NM_DEVICE_INTERFACE_PROP_UDI = NM_DEVICE_INTERFACE_PROP_FIRST,
NM_DEVICE_INTERFACE_PROP_IFACE,
NM_DEVICE_INTERFACE_PROP_IP_IFACE,
NM_DEVICE_INTERFACE_PROP_DRIVER,
NM_DEVICE_INTERFACE_PROP_CAPABILITIES,
NM_DEVICE_INTERFACE_PROP_IP4_ADDRESS,
NM_DEVICE_INTERFACE_PROP_IP4_CONFIG,
NM_DEVICE_INTERFACE_PROP_DHCP4_CONFIG,
NM_DEVICE_INTERFACE_PROP_IP6_CONFIG,
NM_DEVICE_INTERFACE_PROP_DHCP6_CONFIG,
NM_DEVICE_INTERFACE_PROP_STATE,
NM_DEVICE_INTERFACE_PROP_ACTIVE_CONNECTION,
NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE,
NM_DEVICE_INTERFACE_PROP_MANAGED,
NM_DEVICE_INTERFACE_PROP_FIRMWARE_MISSING,
NM_DEVICE_INTERFACE_PROP_TYPE_DESC,
NM_DEVICE_INTERFACE_PROP_RFKILL_TYPE,
NM_DEVICE_INTERFACE_PROP_IFINDEX,
} NMDeviceInterfaceProp;
typedef struct _NMDeviceInterface NMDeviceInterface;
struct _NMDeviceInterface {
GTypeInterface g_iface;
/* Methods */
gboolean (*check_connection_compatible) (NMDeviceInterface *device,
NMConnection *connection,
GError **error);
gboolean (*activate) (NMDeviceInterface *device,
NMActRequest *req,
GError **error);
void (*deactivate) (NMDeviceInterface *device, NMDeviceStateReason reason);
gboolean (*disconnect) (NMDeviceInterface *device, GError **error);
gboolean (*spec_match_list) (NMDeviceInterface *device, const GSList *specs);
NMConnection * (*connection_match_config) (NMDeviceInterface *device, const GSList *specs);
gboolean (*can_assume_connections) (NMDeviceInterface *device);
void (*set_enabled) (NMDeviceInterface *device, gboolean enabled);
gboolean (*get_enabled) (NMDeviceInterface *device);
/* Signals */
void (*state_changed) (NMDeviceInterface *device,
NMDeviceState new_state,
NMDeviceState old_state,
NMDeviceStateReason reason);
};
GQuark nm_device_interface_error_quark (void);
GType nm_device_interface_error_get_type (void);
gboolean nm_device_interface_disconnect (NMDeviceInterface *device, GError **error);
GType nm_device_interface_get_type (void);
gboolean nm_device_interface_check_connection_compatible (NMDeviceInterface *device,
NMConnection *connection,
GError **error);
gboolean nm_device_interface_activate (NMDeviceInterface *device,
NMActRequest *req,
GError **error);
void nm_device_interface_deactivate (NMDeviceInterface *device, NMDeviceStateReason reason);
NMDeviceState nm_device_interface_get_state (NMDeviceInterface *device);
gboolean nm_device_interface_spec_match_list (NMDeviceInterface *device,
const GSList *specs);
NMConnection * nm_device_interface_connection_match_config (NMDeviceInterface *device,
const GSList *connections);
gboolean nm_device_interface_can_assume_connections (NMDeviceInterface *device);
gboolean nm_device_interface_get_enabled (NMDeviceInterface *device);
void nm_device_interface_set_enabled (NMDeviceInterface *device, gboolean enabled);
#endif /* NM_DEVICE_INTERFACE_H */
|