sd-bus.h revision 392d5b378ceae5e1fd7c91ca545fcf4cd105744a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foosdbushfoo
#define foosdbushfoo
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
#include <sd-id128.h>
#include "sd-bus-protocol.h"
#ifdef __cplusplus
extern "C" {
#endif
/* TODO:
* - sd_message_handler_t needs to be renamed to sd_bus_message_handler_t
*
* Later:
* - add page donation logic
* - merge busctl into systemctl or so?
* - default policy (allow uid == 0 and our own uid)
*/
typedef struct sd_bus_message sd_bus_message;
typedef struct {
const char *name;
const char *message;
int need_free;
} sd_bus_error;
/* Connections */
int sd_bus_send_with_reply(sd_bus *bus, sd_bus_message *m, sd_message_handler_t callback, void *userdata, uint64_t usec, uint64_t *serial);
int sd_bus_send_with_reply_and_block(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *error, sd_bus_message **r);
int sd_bus_add_object(sd_bus *bus, const char *path, sd_message_handler_t callback, void *userdata);
int sd_bus_remove_object(sd_bus *bus, const char *path, sd_message_handler_t callback, void *userdata);
int sd_bus_add_fallback(sd_bus *bus, const char *prefix, sd_message_handler_t callback, void *userdata);
int sd_bus_remove_fallback(sd_bus *bus, const char *prefix, sd_message_handler_t callback, void *userdata);
int sd_bus_add_match(sd_bus *bus, const char *match, sd_message_handler_t callback, void *userdata);
int sd_bus_remove_match(sd_bus *bus, const char *match, sd_message_handler_t callback, void *userdata);
/* Message object */
int sd_bus_message_new_signal(sd_bus *bus, const char *path, const char *interface, const char *member, sd_bus_message **m);
int sd_bus_message_new_method_call(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_message **m);
int sd_bus_message_new_method_error(sd_bus *bus, sd_bus_message *call, const sd_bus_error *e, sd_bus_message **m);
const char *sd_bus_message_get_path(sd_bus_message *m);
const char *sd_bus_message_get_interface(sd_bus_message *m);
const char *sd_bus_message_get_member(sd_bus_message *m);
const char *sd_bus_message_get_destination(sd_bus_message *m);
const char *sd_bus_message_get_sender(sd_bus_message *m);
const char *sd_bus_message_get_label(sd_bus_message *m);
int sd_bus_message_set_no_reply(sd_bus_message *m, int b);
/* Bus management */
/* Error structures */
void sd_bus_error_free(sd_bus_error *e);
int sd_bus_error_is_set(const sd_bus_error *e);
#ifdef __cplusplus
}
#endif
#endif