summaryrefslogtreecommitdiff
path: root/cmd/srv9p/gnet.h
blob: 3e8a0f4cff196282beab11570bb1e0d03d674d8d (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
/* srv9p/gnet.h - libmisc/net.h implementation for libcr + GNU libc
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-Licence-Identifier: AGPL-3.0-or-later
 */

#ifndef _SRV9P_GNET_H_
#define _SRV9P_GNET_H_

#include <stdint.h> /* for uint16_6 */

#include <libmisc/net.h>

struct _gnet_tcp_conn {
	implements_net_stream_conn;

	int                              fd;
};

struct gnet_tcp_listener {
	implements_net_stream_listener;

	int                              fd;
	struct _gnet_tcp_conn            active_conn;
};

void gnet_tcp_listener_init(struct gnet_tcp_listener *self, uint16_t port);

struct gnet_udp_conn {
	implements_net_packet_conn;

	int                              fd;
};

void gnet_udp_conn_init(struct gnet_udp_conn *self, uint16_t port);

#endif /* _SRV9P_GNET_H_ */