test_client.c revision 8b8210c79b297b87e56d068e8839f7fe6755ab15
#include <stdlib.h>
#include <stdio.h>
#include "events.h"
#include "dbus/sssd_dbus.h"
/* TODO: get this value from LDB */
/* Identity */
#define TEST_CLIENT_NAME "testclient"
#define TEST_CLIENT_VERSION 1
/* Monitor Interface */
#define MONITOR_DBUS_INTERFACE "org.freeipa.sssd.monitor"
#define MONITOR_DBUS_PATH "/org/freeipa/sssd/monitor"
#define MONITOR_METHOD_VERSION "getVersion"
/* Service Interface */
#define SERVICE_PATH "/org/freeipa/sssd/service"
#define SERVICE_INTERFACE "org.freeipa.sssd.service"
#define SERVICE_METHOD_IDENTITY "getIdentity"
struct test_cli_ctx {
struct sbus_method_ctx *sd_ctx;
/*DBusConnection *conn;*/
struct event_context *ev;
struct sbus_conn_ctx *dct_ctx;
};
struct sbus_method monitor_service_methods [] = {
};
{
const char *version_string;
int type;
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid. If reply is NULL here, something is seriously
* wrong and we should bail out.
*/
DEBUG(0, ("Serious error. A reply callback was called but no reply was received"));
exit(3);
}
switch (type) {
} else {
DEBUG(0, ("Error getting arguments in print_version"));
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
DEBUG(0, ("Received error. Timeout"));
}
else {
}
break;
default:
DEBUG(0, ("Received unexpected message\n"));
exit(4);
}
}
struct timed_event *te,
{
struct test_cli_ctx *test_ctx;
struct sbus_method_ctx *ctx;
&pending_reply, -1);
if (!dbret) {
/* Critical failure */
DEBUG(0,("Failed to send version_request"));
exit(2);
}
}
{
DEBUG(0, ("failed to add event!\n"));
exit(1);
}
}
{
struct event_context *event_ctx;
struct sbus_method_ctx *ctx;
struct test_cli_ctx *test_ctx;
struct sbus_method_ctx *service_methods;
int ret;
if (!event_ctx) {
printf("Out of memory!?\n");
exit(1);
}
if (!ctx) {
printf("Out of memory!?\n");
exit(1);
}
if (!test_ctx) {
printf("Out of memory!?\n");
exit(1);
}
printf("Out of memory!?\n");
exit(1);
}
exit(1);
}
/* Set up a timed event to request the server version every
* five seconds and print it to the screen.
*/
/* Set up handler for service methods */
/* Enter the main loop (and hopefully never return) */
return EXIT_SUCCESS;
}
const char *name = TEST_CLIENT_NAME;
if (!ret) {
return EIO;
}
*r = reply;
return EOK;
}