bus-convenience.c revision df2d202e6ed4001a21c6512c244acad5d4706c87
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
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 "bus-internal.h"
#include "bus-message.h"
#include "bus-signature.h"
#include "bus-util.h"
#include "bus-type.h"
const char *path,
const char *interface,
const char *member,
const char *types, ...) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
}
}
const char *destination,
const char *path,
const char *interface,
const char *member,
const char *types, ...) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
}
}
const char *types, ...) {
int r;
return 0;
r = sd_bus_message_new_method_return(call, &m);
if (r < 0)
return r;
if (r < 0)
return r;
}
}
const sd_bus_error *e) {
int r;
return 0;
r = sd_bus_message_new_method_error(call, e, &m);
if (r < 0)
return r;
}
const char *name,
const char *format,
...) {
int r;
return 0;
if (r < 0)
return r;
}
int error,
const sd_bus_error *p) {
return 0;
if (sd_bus_error_is_set(p))
return sd_bus_reply_method_error(call, p);
}
int error,
const char *format,
...) {
return 0;
}
const char *destination,
const char *path,
const char *interface,
const char *member,
const char *type) {
int r;
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &rep, "ss", strempty(interface), member);
if (r < 0)
return r;
if (r < 0) {
return r;
}
return 0;
}
const char *destination,
const char *path,
const char *interface,
const char *member,
int r;
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
return 0;
}
const char *destination,
const char *path,
const char *interface,
const char *member,
char **ret) {
const char *s;
char *n;
int r;
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
n = strdup(s);
if (!n)
return -ENOMEM;
*ret = n;
return 0;
}
const char *destination,
const char *path,
const char *interface,
const char *member,
char ***ret) {
int r;
r = sd_bus_call_method(bus, destination, path, "org.freedesktop.DBus.Properties", "Get", error, &reply, "ss", strempty(interface), member);
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
return 0;
}
const char *destination,
const char *path,
const char *interface,
const char *member,
const char *type, ...) {
int r;
r = sd_bus_message_new_method_call(bus, destination, path, "org.freedesktop.DBus.Properties", "Set", &m);
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
if (r < 0)
return r;
r = sd_bus_message_close_container(m);
if (r < 0)
return r;
}