device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-glib / nm-object.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 2007 - 2008 Novell, Inc.
19  * Copyright 2007 - 2012 Red Hat, Inc.
20  */
21
22 #ifndef NM_OBJECT_H
23 #define NM_OBJECT_H
24
25 #include <glib.h>
26 #include <glib-object.h>
27 #include <dbus/dbus-glib.h>
28
29 #include <nm-version.h>
30
31 G_BEGIN_DECLS
32
33 #define NM_TYPE_OBJECT            (nm_object_get_type ())
34 #define NM_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_OBJECT, NMObject))
35 #define NM_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_OBJECT, NMObjectClass))
36 #define NM_IS_OBJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_OBJECT))
37 #define NM_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_OBJECT))
38 #define NM_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_OBJECT, NMObjectClass))
39
40 /**
41  * NMObjectError:
42  * @NM_OBJECT_ERROR_UNKNOWN: unknown or unclassified error
43  * @NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE: an error ocured while creating an #NMObject
44  *
45  * Describes errors that may result from operations involving a #NMObject.
46  *
47  **/
48 typedef enum {
49         NM_OBJECT_ERROR_UNKNOWN = 0,
50         NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE,
51 } NMObjectError;
52
53 #define NM_OBJECT_ERROR nm_object_error_quark ()
54 GQuark nm_object_error_quark (void);
55
56 #define NM_OBJECT_DBUS_CONNECTION "dbus-connection"
57 #define NM_OBJECT_DBUS_PATH "dbus-path"
58
59 typedef struct {
60         GObject parent;
61 } NMObject;
62
63 typedef struct {
64         GObjectClass parent;
65
66         /* Signals */
67         /* The "object-creation-failed" signal is PRIVATE for libnm-glib and
68          * is not meant for any external usage.  It indicates that an error
69          * occured during creation of an object.
70          */
71         void (*object_creation_failed) (NMObject *master_object,
72                                         GError *error,
73                                         char *failed_path);
74
75         /* Padding for future expansion */
76         void (*_reserved1) (void);
77         void (*_reserved2) (void);
78         void (*_reserved3) (void);
79         void (*_reserved4) (void);
80         void (*_reserved5) (void);
81         void (*_reserved6) (void);
82 } NMObjectClass;
83
84 GType nm_object_get_type (void);
85
86 DBusGConnection *nm_object_get_connection (NMObject *object);
87 const char      *nm_object_get_path       (NMObject *object);
88
89 G_END_DECLS
90
91 #endif /* NM_OBJECT_H */