2019-07-27 15:48:56 +02:00
|
|
|
#include "../src/ipc.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define SERVICE_NAME "pong"
|
|
|
|
|
2020-07-13 14:12:08 +02:00
|
|
|
int main(int argc, char * argv[])
|
2019-07-27 15:48:56 +02:00
|
|
|
{
|
2020-01-01 12:11:34 +01:00
|
|
|
argc = (int) argc;
|
|
|
|
argv = (char **) argv;
|
|
|
|
|
|
|
|
SECURE_DECLARATION(struct ipc_error, ret);
|
2020-07-13 14:12:08 +02:00
|
|
|
SECURE_DECLARATION(struct ipc_ctx, ctx);
|
2019-07-27 15:48:56 +02:00
|
|
|
SECURE_DECLARATION(struct ipc_event, event);
|
2020-07-13 14:12:08 +02:00
|
|
|
|
2020-07-15 16:06:54 +02:00
|
|
|
ret = ipc_connection (&ctx, SERVICE_NAME, NULL);
|
2020-01-01 12:11:34 +01:00
|
|
|
if (ret.error_code != IPC_ERROR_NONE) {
|
2020-07-13 14:12:08 +02:00
|
|
|
printf ("error: %s\n", ipc_errors_get(ret.error_code));
|
2019-07-27 15:48:56 +02:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2020-07-13 14:12:08 +02:00
|
|
|
// int timer = 10000; // 10 seconds
|
2020-01-01 12:11:34 +01:00
|
|
|
// ret = ipc_wait_event (services, struct ipc_event *event, &timer);
|
|
|
|
// if (ret.error_code != IPC_ERROR_NONE) {
|
2019-07-27 15:48:56 +02:00
|
|
|
// return EXIT_FAILURE;
|
|
|
|
// }
|
|
|
|
|
2020-07-13 14:12:08 +02:00
|
|
|
ret = ipc_close_all (&ctx);
|
2020-01-01 12:11:34 +01:00
|
|
|
if (ret.error_code != IPC_ERROR_NONE) {
|
2020-07-13 14:12:08 +02:00
|
|
|
printf ("error: %s\n", ipc_errors_get(ret.error_code));
|
2019-07-27 15:48:56 +02:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2022-02-04 00:53:22 +01:00
|
|
|
ipc_ctx_free (&ctx);
|
2019-07-27 15:48:56 +02:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|