summaryrefslogtreecommitdiff
path: root/minecproxy/server-proxy.h
blob: be37a3cb6d8a7b28d0bf6bc465b3f1a22ec3b24b (plain)
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
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef fooserverproxyhfoo
#define fooserverproxyhfoo

struct server_proxy {
	struct connection client_conn;
	struct uring_task_buf clientbuf;
	struct uring_task clienttask;
	uint64_t client_bytes;
	int cpipe[2];
	int cfd;

	struct connection server_conn;
	struct uring_task_buf serverbuf;
	struct uring_task servertask;
	uint64_t server_bytes;
	int spipe[2];
	int sfd;

	bool connecting;
	time_t begin;
	struct ptimer_task ptask;
	struct uring_task task;
	struct server *server;
	struct list_head list;
};

void proxy_refdump(struct server_proxy *proxy);

void proxy_delete(struct server_proxy *proxy);

struct server_proxy *proxy_new(struct server *server, struct saddr *client,
			       int fd);

struct server_local {
	struct saddr local;
	struct saddr client;
	struct uring_task task;

	struct server *server;
	struct list_head list;
};

bool local_open(struct server_local *local);

void local_refdump(struct server_local *local);

void local_delete(struct server_local *local);

struct server_local *local_new(struct server *server, struct saddr *saddr);

#endif