device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-glib / nm-device-vlan.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301 USA.
17  *
18  * Copyright 2012 - 2014 Red Hat, Inc.
19  */
20
21 #ifndef NM_DEVICE_VLAN_H
22 #define NM_DEVICE_VLAN_H
23
24 #include "nm-device.h"
25
26 G_BEGIN_DECLS
27
28 #define NM_TYPE_DEVICE_VLAN            (nm_device_vlan_get_type ())
29 #define NM_DEVICE_VLAN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_VLAN, NMDeviceVlan))
30 #define NM_DEVICE_VLAN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_VLAN, NMDeviceVlanClass))
31 #define NM_IS_DEVICE_VLAN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_VLAN))
32 #define NM_IS_DEVICE_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_VLAN))
33 #define NM_DEVICE_VLAN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_VLAN, NMDeviceVlanClass))
34
35 /**
36  * NMDeviceVlanError:
37  * @NM_DEVICE_VLAN_ERROR_UNKNOWN: unknown or unclassified error
38  * @NM_DEVICE_VLAN_ERROR_NOT_VLAN_CONNECTION: the connection was not of VLAN type
39  * @NM_DEVICE_VLAN_ERROR_INVALID_VLAN_CONNECTION: the VLAN connection was invalid
40  * @NM_DEVICE_VLAN_ERROR_ID_MISMATCH: the VLAN identifiers of the connection and the device mismatched
41  * @NM_DEVICE_VLAN_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
42  * @NM_DEVICE_VLAN_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
43  */
44 typedef enum {
45         NM_DEVICE_VLAN_ERROR_UNKNOWN = 0,             /*< nick=UnknownError >*/
46         NM_DEVICE_VLAN_ERROR_NOT_VLAN_CONNECTION,     /*< nick=NotVlanConnection >*/
47         NM_DEVICE_VLAN_ERROR_INVALID_VLAN_CONNECTION, /*< nick=InvalidVlanConnection >*/
48         NM_DEVICE_VLAN_ERROR_ID_MISMATCH,             /*< nick=IdMismatch >*/
49         NM_DEVICE_VLAN_ERROR_INTERFACE_MISMATCH,      /*< nick=InterfaceMismatch >*/
50         NM_DEVICE_VLAN_ERROR_MAC_MISMATCH,            /*< nick=MacMismatch >*/
51 } NMDeviceVlanError;
52
53 #define NM_DEVICE_VLAN_ERROR nm_device_vlan_error_quark ()
54 GQuark nm_device_vlan_error_quark (void);
55
56 #define NM_DEVICE_VLAN_HW_ADDRESS  "hw-address"
57 #define NM_DEVICE_VLAN_CARRIER     "carrier"
58 #define NM_DEVICE_VLAN_PARENT      "parent"
59 #define NM_DEVICE_VLAN_VLAN_ID     "vlan-id"
60
61 typedef struct {
62         NMDevice parent;
63 } NMDeviceVlan;
64
65 typedef struct {
66         NMDeviceClass parent;
67
68         /* Padding for future expansion */
69         void (*_reserved1) (void);
70         void (*_reserved2) (void);
71         void (*_reserved3) (void);
72         void (*_reserved4) (void);
73         void (*_reserved5) (void);
74         void (*_reserved6) (void);
75 } NMDeviceVlanClass;
76
77 GType nm_device_vlan_get_type (void);
78
79 GObject *nm_device_vlan_new (DBusGConnection *connection, const char *path);
80
81 const char * nm_device_vlan_get_hw_address (NMDeviceVlan *device);
82 gboolean     nm_device_vlan_get_carrier (NMDeviceVlan *device);
83 NM_AVAILABLE_IN_1_0
84 NMDevice *   nm_device_vlan_get_parent  (NMDeviceVlan *device);
85 guint        nm_device_vlan_get_vlan_id (NMDeviceVlan *device);
86
87 G_END_DECLS
88
89 #endif /* NM_DEVICE_VLAN_H */