aboutsummaryrefslogtreecommitdiff
path: root/private_include
diff options
context:
space:
mode:
Diffstat (limited to 'private_include')
-rw-r--r--private_include/wip/prv/icmp.h21
-rw-r--r--private_include/wip/prv/icmp/routines.h20
-rw-r--r--private_include/wip/prv/icmp/types.h34
-rw-r--r--private_include/wip/prv/io.h22
-rw-r--r--private_include/wip/prv/log.h15
-rw-r--r--private_include/wip/prv/routines.h17
-rw-r--r--private_include/wip/prv/tcp.h21
-rw-r--r--private_include/wip/prv/tcp/types.h20
-rw-r--r--private_include/wip/prv/udp.h21
-rw-r--r--private_include/wip/prv/udp/types.h20
10 files changed, 211 insertions, 0 deletions
diff --git a/private_include/wip/prv/icmp.h b/private_include/wip/prv/icmp.h
new file mode 100644
index 0000000..bc7dbe1
--- /dev/null
+++ b/private_include/wip/prv/icmp.h
@@ -0,0 +1,21 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_ICMP_H
+#define WIP_PRV_ICMP_H
+
+#include <wip/wip.h>
+#include <stddef.h>
+
+void *wip_icmp_alloc(struct wip *const w);
+enum wip_state wip_icmp_rx(struct wip *w, const void *buf, size_t n, void *args);
+int wip_icmp_tx(struct wip *w, void *buf, size_t n, void *args);
+void wip_icmp_free(struct wip *w, void *args);
+
+#endif
diff --git a/private_include/wip/prv/icmp/routines.h b/private_include/wip/prv/icmp/routines.h
new file mode 100644
index 0000000..508efce
--- /dev/null
+++ b/private_include/wip/prv/icmp/routines.h
@@ -0,0 +1,20 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_ICMP_ROUTINES_H
+#define WIP_PRV_ICMP_ROUTINES_H
+
+#include <wip/wip.h>
+#include <wip/prv/icmp/types.h>
+#include <stddef.h>
+
+enum wip_state wip_icmp_rx_start(struct wip *w, const void *buf, size_t n,
+ struct wip_icmp *icmp, size_t *r);
+
+#endif
diff --git a/private_include/wip/prv/icmp/types.h b/private_include/wip/prv/icmp/types.h
new file mode 100644
index 0000000..c9355dd
--- /dev/null
+++ b/private_include/wip/prv/icmp/types.h
@@ -0,0 +1,34 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_ICMP_TYPES_H
+#define WIP_PRV_ICMP_TYPES_H
+
+#include <wip/wip.h>
+#include <stddef.h>
+
+enum icmp_type
+{
+ ICMP_ECHO_REPLY,
+ ICMP_ECHO_REQUEST = 8
+};
+
+struct wip_icmp
+{
+ enum icmp_type type;
+ struct wip_sm_io io;
+ struct wip_be16 exp_checksum, id, seqnum;
+ unsigned short checksum;
+ void *buf;
+ size_t read;
+ enum wip_state (*next)(struct wip *, const void *, size_t,
+ struct wip_icmp *, size_t *);
+};
+
+#endif
diff --git a/private_include/wip/prv/io.h b/private_include/wip/prv/io.h
new file mode 100644
index 0000000..cece6b3
--- /dev/null
+++ b/private_include/wip/prv/io.h
@@ -0,0 +1,22 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_IO_H
+#define WIP_IO_H
+
+#include <wip/wip.h>
+
+enum wip_state wip_io_read(struct wip *w, struct wip_sm_io *io);
+enum wip_state wip_io_read_c(struct wip_cfg *cfg, struct wip_sm_io *io);
+unsigned short wip_be16(const struct wip_be16 *v);
+unsigned long wip_be32(const struct wip_be32 *v);
+void wip_tobe16(unsigned long v, struct wip_be16 *out);
+void wip_tobe32(unsigned long v, struct wip_be32 *out);
+
+#endif
diff --git a/private_include/wip/prv/log.h b/private_include/wip/prv/log.h
new file mode 100644
index 0000000..438b569
--- /dev/null
+++ b/private_include/wip/prv/log.h
@@ -0,0 +1,15 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_LOG_H
+#define WIP_LOG_H
+
+int wip_log(const char *fmt, ...);
+
+#endif
diff --git a/private_include/wip/prv/routines.h b/private_include/wip/prv/routines.h
new file mode 100644
index 0000000..e8e919b
--- /dev/null
+++ b/private_include/wip/prv/routines.h
@@ -0,0 +1,17 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_ROUTINES_H
+#define WIP_PRV_ROUTINES_H
+
+#include <wip/wip.h>
+
+void wip_rx(struct wip *w);
+
+#endif
diff --git a/private_include/wip/prv/tcp.h b/private_include/wip/prv/tcp.h
new file mode 100644
index 0000000..8919ba2
--- /dev/null
+++ b/private_include/wip/prv/tcp.h
@@ -0,0 +1,21 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_TCP_H
+#define WIP_PRV_TCP_H
+
+#include <wip/wip.h>
+#include <stddef.h>
+
+void *wip_tcp_alloc(struct wip *const w);
+enum wip_state wip_tcp_rx(struct wip *w, const void *buf, size_t n, void *args);
+int wip_tcp_tx(struct wip *w, void *buf, size_t n, void *args);
+void wip_tcp_free(struct wip *w, void *args);
+
+#endif
diff --git a/private_include/wip/prv/tcp/types.h b/private_include/wip/prv/tcp/types.h
new file mode 100644
index 0000000..66dfdb4
--- /dev/null
+++ b/private_include/wip/prv/tcp/types.h
@@ -0,0 +1,20 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_TCP_TYPES_H
+#define WIP_PRV_TCP_TYPES_H
+
+#include <stddef.h>
+
+struct wip_tcp
+{
+ int dummy;
+};
+
+#endif
diff --git a/private_include/wip/prv/udp.h b/private_include/wip/prv/udp.h
new file mode 100644
index 0000000..48422fe
--- /dev/null
+++ b/private_include/wip/prv/udp.h
@@ -0,0 +1,21 @@
+/*
+ * wip, a small TCP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_UDP_H
+#define WIP_PRV_UDP_H
+
+#include <wip/wip.h>
+#include <stddef.h>
+
+void *wip_udp_alloc(struct wip *const w);
+enum wip_state wip_udp_rx(struct wip *w, const void *buf, size_t n, void *args);
+int wip_udp_tx(struct wip *w, void *buf, size_t n, void *args);
+void wip_udp_free(struct wip *w, void *args);
+
+#endif
diff --git a/private_include/wip/prv/udp/types.h b/private_include/wip/prv/udp/types.h
new file mode 100644
index 0000000..c807430
--- /dev/null
+++ b/private_include/wip/prv/udp/types.h
@@ -0,0 +1,20 @@
+/*
+ * wip, a small UDP/IP stack.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef WIP_PRV_UDP_TYPES_H
+#define WIP_PRV_UDP_TYPES_H
+
+#include <stddef.h>
+
+struct wip_udp
+{
+ int dummy;
+};
+
+#endif