forked from project-repo/cagebreak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipc_server.h
56 lines (48 loc) · 1.43 KB
/
ipc_server.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
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2020 - 2023, project-repo and the cagebreak contributors
// SPDX -License-Identifier: MIT
#ifndef CG_IPC_SERVER_H
#define CG_IPC_SERVER_H
#include "config.h"
#include <stdint.h>
#include <stdlib.h>
#include <wayland-server-core.h>
struct cg_server;
struct cg_ipc_client {
struct wl_event_source *event_source;
struct wl_event_source *writable_event_source;
struct cg_server *server;
struct wl_list link;
int fd;
uint32_t security_policy;
size_t write_buffer_len;
size_t write_buffer_size;
char *write_buffer;
// The following is for storing data between event_loop calls
uint16_t read_buf_len;
size_t read_buf_cap;
uint8_t read_discard; // 1 if the current line is to be discarded
char *read_buffer;
};
struct cg_ipc_handle {
int socket;
struct wl_event_source *event_source;
struct wl_list client_list;
struct wl_listener display_destroy;
struct sockaddr_un *sockaddr;
};
void
ipc_send_event(struct cg_server *server, const char *fmt, ...);
int
ipc_init(struct cg_server *server);
int
ipc_handle_connection(int fd, uint32_t mask, void *data);
int
ipc_client_handle_readable(int client_fd, uint32_t mask, void *data);
// int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data);
void
ipc_client_disconnect(struct cg_ipc_client *client);
void
ipc_client_handle_command(struct cg_ipc_client *client);
// bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t
// payload_length);
#endif