liblazy
liblazy.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * liblazy *
4  * *
5  * Copyright (C) 2006 Holger Macht <holger@homac.de> *
6  * *
7  * Author(s): Holger Macht <holger@homac.de> *
8  * *
9  * This library is free software; you can redistribute it and/or modify it *
10  * under the terms of the GNU Lesser General Public License as published *
11  * by the Free Software Foundation; either version 2.1 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This library is distributed in the hope that it will be useful, but *
15  * WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17  * Lesser General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU Lesser General Public *
20  * License along with this library; if not, write to the Free Software *
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
22  * 02110-1301 USA *
23  * *
24  ***************************************************************************/
25 
26 #ifndef LIBLAZY_H
27 #define LIBLAZY_H
28 
29 #define DBUS_API_SUBJECT_TO_CHANGE 1
30 #include <dbus/dbus.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
39 #define LIBLAZY_ERROR_GENERAL -1
40 #define LIBLAZY_ERROR_INVALID_ARGUMENT -2
41 #define LIBLAZY_ERROR_HAL_NOT_READY -10
42 #define LIBLAZY_ERROR_HAL_NO_SUCH_PROPERTY -11
43 
44 #define LIBLAZY_ERROR_DBUS_NOT_READY -20
45 #define LIBLAZY_ERROR_DBUS_NO_REPLY -21
46 #define LIBLAZY_ERROR_DBUS_ERROR_IS_SET -22
47 
52 void liblazy_free_string(char *string);
53 
58 void liblazy_free_strlist(char **strlist);
59 
76 int liblazy_dbus_system_send_method_call(const char *destination, const char *path,
77  const char *interface, const char *method,
78  DBusMessage **reply,
79  int first_arg_type, ...);
80 
98 int liblazy_dbus_session_send_method_call(const char *destination, const char *path,
99  const char *interface, const char *method,
100  DBusMessage **reply,
101  int first_arg_type, ...);
102 
116 int liblazy_dbus_system_send_signal(const char *path, const char *interface,
117  const char *name, int first_arg_type, ...);
118 
132 int liblazy_dbus_session_send_signal(const char *path, const char *interface,
133  const char *name, int first_arg_type, ...);
134 
144 int liblazy_dbus_message_get_basic_arg(DBusMessage *message, int type, void *arg, int no);
145 
156 int liblazy_dbus_message_get_strlist_arg(DBusMessage *message, char ***strlist, int no);
157 
172 void liblazy_dbus_system_use_private_connection(int use_private);
173 
184 int liblazy_hal_get_property_int(const char *udi, const char *property, int *value);
185 
196 int liblazy_hal_get_property_bool(const char *udi, const char *property, int *value);
197 
208 int liblazy_hal_get_property_string(const char *udi, const char *property, char **value);
209 
221 int liblazy_hal_get_property_strlist(const char *udi, const char *property, char ***strlist);
222 
231 int liblazy_hal_query_capability(const char *udi, const char *capability);
232 
241 int liblazy_hal_find_device_by_capability(const char *capability, char ***strlist);
242 
252 int liblazy_hal_find_device_by_string_match(const char *key, const char *value, char ***strlist);
253 
263 int liblazy_hal_is_caller_privileged(const char *privilege);
264 
265 #ifdef __cplusplus
266 }
267 #endif /* __cplusplus */
268 
269 #endif /* LIBLAZY_H */
270 // end of liblazy group
int liblazy_hal_find_device_by_string_match(const char *key, const char *value, char ***strlist)
find devices with given key and value
Definition: liblazy_hal.c:271
int liblazy_hal_get_property_string(const char *udi, const char *property, char **value)
get string property from HAL
Definition: liblazy_hal.c:132
void liblazy_free_strlist(char **strlist)
free a null terminated array of strings
Definition: liblazy.c:38
int liblazy_dbus_session_send_signal(const char *path, const char *interface, const char *name, int first_arg_type,...)
send a signal over the session bus
Definition: liblazy_dbus.c:203
int liblazy_hal_get_property_int(const char *udi, const char *property, int *value)
get integer property from HAL
Definition: liblazy_hal.c:157
int liblazy_dbus_system_send_method_call(const char *destination, const char *path, const char *interface, const char *method, DBusMessage **reply, int first_arg_type,...)
send a method call to the system bus
Definition: liblazy_dbus.c:112
int liblazy_hal_find_device_by_capability(const char *capability, char ***strlist)
find devices with a given capability
Definition: liblazy_hal.c:257
int liblazy_hal_query_capability(const char *udi, const char *capability)
check if a device has a capability
Definition: liblazy_hal.c:233
void liblazy_free_string(char *string)
free a string
Definition: liblazy.c:30
int liblazy_dbus_session_send_method_call(const char *destination, const char *path, const char *interface, const char *method, DBusMessage **reply, int first_arg_type,...)
send a method call to the session bus
Definition: liblazy_dbus.c:133
int liblazy_dbus_system_send_signal(const char *path, const char *interface, const char *name, int first_arg_type,...)
send a signal over the system bus
Definition: liblazy_dbus.c:190
int liblazy_dbus_message_get_strlist_arg(DBusMessage *message, char ***strlist, int no)
get a array argument from a DBusMessage as a string list
Definition: liblazy_dbus.c:277
int liblazy_hal_is_caller_privileged(const char *privilege)
check if a user possesses a privilege
Definition: liblazy_hal.c:285
int liblazy_dbus_message_get_basic_arg(DBusMessage *message, int type, void *arg, int no)
get an argument from a DBusMessage
Definition: liblazy_dbus.c:217
void liblazy_dbus_system_use_private_connection(int use_private)
use a private connection for system bus messages
Definition: liblazy_dbus.c:37
int liblazy_hal_get_property_strlist(const char *udi, const char *property, char ***strlist)
get string list property from HAL
Definition: liblazy_hal.c:191
int liblazy_hal_get_property_bool(const char *udi, const char *property, int *value)
get boolean property from HAL
Definition: liblazy_hal.c:174