-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathipc.h
43 lines (31 loc) · 905 Bytes
/
ipc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include "rogue_enemy.h"
#define MAX_CONNECTED_CLIENTS 8
typedef struct ipc_strategy_socket {
struct sockaddr_un serveraddr;
int fd;
} ipc_strategy_socket_t;
typedef struct ipc_strategy_ssocket {
pthread_mutex_t mutex;
int clients[MAX_CONNECTED_CLIENTS];
} ipc_strategy_ssocket_t;
typedef struct ipc_strategy_pipe {
// this pipe is reserved for reporting in_message_t
int in_message_pipe_fd;
// this messages is reserved for receiving out_message_t
int out_message_pipe_fd;
} ipc_strategy_pipe_t;
typedef enum ipc_strategy {
ipc_unix_pipe,
ipc_server_sockets,
ipc_client_socket,
} ipc_strategy_t;
typedef struct ipc {
ipc_strategy_t type;
union {
ipc_strategy_pipe_t pipe;
ipc_strategy_ssocket_t ssocket;
ipc_strategy_socket_t socket;
} endpoint;
} ipc_t;
#define SERVER_PATH "/home/rogue-enemy.sock"