summaryrefslogtreecommitdiff
path: root/libnet
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-17 14:31:03 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-17 14:31:03 -0600
commitf132dab76a07473d41e14f5f4fb1857a3229ec6a (patch)
tree621a8f1ae6cb15d360cd47c0bccd08a1c2226f4e /libnet
parenta1fb6a6103cc7d38d54270bcdb9779982d329c9e (diff)
libmisc
Diffstat (limited to 'libnet')
-rw-r--r--libnet/CMakeLists.txt7
-rw-r--r--libnet/include/libnet/libnet.h70
2 files changed, 0 insertions, 77 deletions
diff --git a/libnet/CMakeLists.txt b/libnet/CMakeLists.txt
deleted file mode 100644
index 32047f0..0000000
--- a/libnet/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# libnet/CMakeLists.txt - Build script for libnet support library
-#
-# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
-# SPDX-Licence-Identifier: AGPL-3.0-or-later
-
-add_library(libnet INTERFACE)
-target_include_directories(libnet SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
diff --git a/libnet/include/libnet/libnet.h b/libnet/include/libnet/libnet.h
deleted file mode 100644
index 022e922..0000000
--- a/libnet/include/libnet/libnet.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* libnet/libnet.h - Base definitions for network interfaces
- *
- * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
- * SPDX-Licence-Identifier: AGPL-3.0-or-later
- */
-
-#ifndef _NETIO_H_
-#define _NETIO_H_
-
-#include <stdbool.h> /* for bool */
-#include <stddef.h> /* for size_t */
-#include <sys/types.h> /* for ssize_t */
-
-struct ip4_addr {
- unsigned char bytes[4];
-};
-
-struct eth_addr {
- unsigned char bytes[6];
-};
-
-struct libnet_conn;
-struct libnet_listener;
-
-struct libnet_listener_vtable {
- /**
- * It is invalid to accept() a new connection if an existing
- * connection is still open.
- */
- struct libnet_conn *(*accept)(struct libnet_listener *self);
-};
-
-struct libnet_conn_vtable {
- /**
- * Return bytes-read on success, 0 on EOF, -errno on error; a
- * short read is *not* an error.
- */
- ssize_t (*read)(struct libnet_conn *self, void *buf, size_t count);
-
- /**
- * Return `count` on success, -errno on error; a short write *is* an
- * error.
- *
- * Writes are *not* guaranteed to be atomic (as this would be
- * expensive to implement), so if you have concurrent writers then you
- * should arrange for a mutex to protect the connection.
- */
- ssize_t (*write)(struct libnet_conn *self, void *buf, size_t count);
-
- /**
- * Return 0 on success, -errno on error.
- */
- int (*close)(struct libnet_conn *self, bool rd, bool wr);
-};
-
-struct libnet_listener {
- struct libnet_listener_vtable *vtable;
-
- /* This is where your implementation data goes. */
- char data[0];
-};
-
-struct libnet_conn {
- struct libnet_conn_vtable *vtable;
-
- /* This is where your implementation data goes. */
- char data[0];
-};
-
-#endif /* _NETIO_H_ */