summaryrefslogtreecommitdiff
path: root/minecproxy/misc.h
blob: 6627913a90847f0371e1b2c485ac0fc74f34aee4 (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
#ifndef foomischfoo
#define foomischfoo

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

#include "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