device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-glib / nm-object-private.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 2008 - 2011 Red Hat, Inc.
19  */
20
21 #ifndef NM_OBJECT_PRIVATE_H
22 #define NM_OBJECT_PRIVATE_H
23
24 #include "nm-default.h"
25 #include "nm-object.h"
26
27 void _nm_object_ensure_inited (NMObject *object);
28
29 typedef gboolean (*PropertyMarshalFunc) (NMObject *, GParamSpec *, GValue *, gpointer);
30
31 typedef GObject * (*NMObjectCreatorFunc) (DBusGConnection *, const char *);
32
33 typedef struct {
34         const char *name;
35         gpointer field;
36         PropertyMarshalFunc func;
37         GType object_type;
38         const char *signal_prefix;
39 } NMPropertiesInfo;
40
41 DBusGProxy *_nm_object_new_proxy (NMObject *self,
42                                   const char *path,
43                                   const char *interface);
44
45 void _nm_object_register_properties (NMObject *object,
46                                      DBusGProxy *proxy,
47                                      const NMPropertiesInfo *info);
48
49 gboolean _nm_object_reload_properties (NMObject *object, GError **error);
50
51 void     _nm_object_reload_properties_async  (NMObject *object,
52                                               GAsyncReadyCallback callback,
53                                               gpointer user_data);
54 gboolean _nm_object_reload_properties_finish (NMObject *object,
55                                               GAsyncResult *result,
56                                               GError **error);
57
58 void _nm_object_queue_notify (NMObject *object, const char *property);
59
60 void _nm_object_suppress_property_updates (NMObject *object, gboolean suppress);
61
62 /* DBus property accessors */
63
64 void _nm_object_reload_property (NMObject *object,
65                                  const char *interface,
66                                  const char *prop_name);
67
68 void _nm_object_set_property (NMObject *object,
69                               const char *interface,
70                               const char *prop_name,
71                               GValue *value);
72
73 static inline const GPtrArray *
74 handle_ptr_array_return (GPtrArray *array)
75 {
76         /* zero-length is special-case; return NULL */
77         if (!array || !array->len)
78                 return NULL;
79         return array;
80 }
81
82 /* object demarshalling support */
83 typedef GType (*NMObjectTypeFunc) (DBusGConnection *, const char *);
84 typedef void (*NMObjectTypeCallbackFunc) (GType, gpointer);
85 typedef void (*NMObjectTypeAsyncFunc) (DBusGConnection *, const char *, NMObjectTypeCallbackFunc, gpointer);
86
87 void _nm_object_register_type_func (GType base_type, NMObjectTypeFunc type_func,
88                                     NMObjectTypeAsyncFunc type_async_func);
89
90 #endif /* NM_OBJECT_PRIVATE_H */