summaryrefslogtreecommitdiff
path: root/minecproxy/misc.h
blob: fe3a9474e868e7acb7d6dc021cd5d46ac9239bb6 (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
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef foomischfoo
#define foomischfoo

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <linux/if_packet.h>

#include "shared/utils.h"

void debug_resource_usage();

struct connection;

typedef void (*connection_cb_t)(struct connection *, bool);

struct connection {
	struct saddr remote;
	struct saddr local;

	struct list_head *addrs;
	unsigned next_addr;

	connection_cb_t cb;
};

void connection_set_local(struct connection *conn, int fd);

void connection_set_remote(struct connection *conn, struct saddr *remote);

void connect_any(struct uring_task *task, struct list_head *addrs,
		 struct connection *conn, connection_cb_t cb);

#endif