summaryrefslogtreecommitdiff
path: root/src/user/app/netstack/proto.h
diff options
context:
space:
mode:
authordzwdz2022-08-23 17:58:42 +0200
committerdzwdz2022-08-23 17:58:42 +0200
commit03c5dd9462492e291c6a49b88e1cd9ab34d86b6f (patch)
tree8c8d8e73c8c07b83f5aede18d83671369d0f7589 /src/user/app/netstack/proto.h
parentfcdadf5df39e1d72f9ac79fa384fc6b98be0b1aa (diff)
user/netstack: TCP listen and close
Diffstat (limited to 'src/user/app/netstack/proto.h')
-rw-r--r--src/user/app/netstack/proto.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/user/app/netstack/proto.h b/src/user/app/netstack/proto.h
index 68dccad..0c4338b 100644
--- a/src/user/app/netstack/proto.h
+++ b/src/user/app/netstack/proto.h
@@ -31,6 +31,11 @@ struct ipv4 {
const uint8_t *header; size_t hlen;
};
+struct tcp {
+ struct ipv4 ip;
+ uint16_t src, dst;
+};
+
struct udp {
struct ipv4 ip;
uint16_t src, dst;
@@ -81,3 +86,12 @@ struct udp_conn *udpc_new(
void udpc_send(struct udp_conn *, const void *buf, size_t len);
/* frees */
void udpc_close(struct udp_conn *);
+
+struct tcp_conn;
+void tcp_parse(const uint8_t *buf, size_t len, struct ipv4 ip);
+void tcp_listen(
+ uint16_t port,
+ void (*on_conn)(struct tcp_conn *, void *carg),
+ void (*on_close)(void *carg),
+ void *carg);
+void tcpc_close(struct tcp_conn *);