sbus_client.c revision 11c621b5ee1a0cdc27610f8b172017764acc285e
388N/A/*
388N/A SSSD
388N/A
388N/A Data Provider Helpers
388N/A
388N/A Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
388N/A
388N/A This program is free software; you can redistribute it and/or modify
388N/A it under the terms of the GNU General Public License as published by
388N/A the Free Software Foundation; either version 3 of the License, or
388N/A (at your option) any later version.
388N/A
388N/A This program is distributed in the hope that it will be useful,
388N/A but WITHOUT ANY WARRANTY; without even the implied warranty of
388N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
388N/A GNU General Public License for more details.
388N/A
873N/A You should have received a copy of the GNU General Public License
388N/A along with this program. If not, see <http://www.gnu.org/licenses/>.
388N/A*/
388N/A
388N/A#include "util/util.h"
3215N/A#include "talloc.h"
388N/A#include "sbus_client.h"
388N/A
388N/Aint sbus_client_init(TALLOC_CTX *mem_ctx,
388N/A struct tevent_context *ev,
388N/A const char *server_address,
388N/A struct sbus_interface *intf,
388N/A struct sbus_connection **_conn,
388N/A sbus_conn_destructor_fn destructor,
388N/A void *conn_pvt_data)
388N/A{
388N/A struct sbus_connection *conn = NULL;
388N/A int ret;
388N/A
388N/A /* Validate input */
388N/A if (server_address == NULL) {
388N/A return EINVAL;
388N/A }
388N/A
388N/A ret = sbus_new_connection(mem_ctx, ev, server_address, intf, &conn);
388N/A if (ret != EOK) {
388N/A goto fail;
388N/A }
388N/A
388N/A /* Set connection destructor and private data */
388N/A sbus_conn_set_destructor(conn, destructor);
388N/A sbus_conn_set_private_data(conn, conn_pvt_data);
388N/A
388N/A *_conn = conn;
388N/A return EOK;
388N/A
388N/Afail:
388N/A talloc_free(conn);
388N/A return ret;
388N/A}
388N/A