1#include <stdlib.h>
2#include <string.h>
3
4#include "ulepipe.h"
5
6#define sockpath "/tmp/ulepipe_test.sock"
7#define ssame(a, b) (!strcmp(a, b))
8
9enum type {
10 TEST_STOP,
11 TEST_NAME_CHANGE,
12} type;
13
14typedef struct {
15 int x, y;
16 char name[64];
17 enum type type;
18} some_data_layout;
19
20int main(int argc, char* argv[])
21{
22 const char* cmd = argv[1];
23
24 if (argc < 2)
25 return EXIT_FAILURE;
26
27 if (ssame(cmd, "stop")) {
28 some_data_layout stop_data = {0, 0, "die", TEST_STOP};
29 ulepipe_send(sockpath, &stop_data, sizeof(stop_data));
30 }
31
32 if (ssame(cmd, "name_change")) {
33 some_data_layout name_change_data = {0, 0, "tester123", TEST_NAME_CHANGE};
34 ulepipe_send(sockpath, &name_change_data, sizeof(name_change_data));
35 }
36
37 return EXIT_SUCCESS;
38}
39