83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina/*
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Authors:
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Pavel Březina <pbrezina@redhat.com>
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina Copyright (C) 2016 Red Hat
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina This program is free software; you can redistribute it and/or modify
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina it under the terms of the GNU General Public License as published by
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina the Free Software Foundation; either version 3 of the License, or
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina (at your option) any later version.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina This program is distributed in the hope that it will be useful,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina GNU General Public License for more details.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina You should have received a copy of the GNU General Public License
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina*/
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#ifndef _RDP_H_
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#define _RDP_H_
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "responder/common/responder.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "providers/data_provider/dp_iface_generated.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "providers/data_provider/dp_iface.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "sbus/sssd_dbus.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#include "util/util.h"
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinastruct be_conn;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinastruct resp_ctx;
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinastruct tevent_req *_rdp_message_send(TALLOC_CTX *mem_ctx,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina struct resp_ctx *rctx,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina struct sss_domain_info *domain,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina const char *path,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina const char *iface,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina const char *method,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina int first_arg_type,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina ...);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#define rdp_message_send(mem_ctx, rctx, domain, path, iface, \
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina method, ...) \
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina _rdp_message_send(mem_ctx, rctx, domain, path, iface, method, \
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina ##__VA_ARGS__, DBUS_TYPE_INVALID)
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina/* D-Bus reply message is freed with tevent request. Since all output data
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina * point inside D-Bus reply do not call talloc_free(req) unless
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina * you are not accessing the data any longer. */
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinaerrno_t _rdp_message_recv(struct tevent_req *req,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina int first_arg_type,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina ...);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#define rdp_message_recv(req, ...) \
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina _rdp_message_recv(req, ##__VA_ARGS__, DBUS_TYPE_INVALID)
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina/**
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina * Send D-Bus message to Data Provider but instead of returning the reply
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina * to the caller it forwards the reply to the client request. No further
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina * processing is required by the caller. In case of a failure the client
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina * request is freed since there is nothing we can do.
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina */
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březinavoid _rdp_message_send_and_reply(struct sbus_request *sbus_req,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina struct resp_ctx *rctx,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina struct sss_domain_info *domain,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina const char *path,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina const char *iface,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina const char *method,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina int first_arg_type,
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina ...);
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina#define rdp_message_send_and_reply(sbus_req, rctx, domain, path, iface, \
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina method, ...) \
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina _rdp_message_send_and_reply(sbus_req, rctx, domain, path, iface, method, \
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina ##__VA_ARGS__, DBUS_TYPE_INVALID)
a40d9cc11d17d9c3c22a0462cd8c419d1e79ffb8Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březinaerrno_t rdp_register_client(struct be_conn *be_conn,
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina const char *client_name);
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina
83a79d93035c2d75a1941f3b54426119174044a0Pavel Březina#endif /* _RDP_CALLS_H_ */