summaryrefslogtreecommitdiff
path: root/src/main/kotlin/NinePConnection.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/NinePConnection.kt')
-rw-r--r--src/main/kotlin/NinePConnection.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/kotlin/NinePConnection.kt b/src/main/kotlin/NinePConnection.kt
new file mode 100644
index 0000000..8514ffd
--- /dev/null
+++ b/src/main/kotlin/NinePConnection.kt
@@ -0,0 +1,32 @@
+import java.io.IOException
+
+/**
+ * This class represents a 9P connection. It provides a practical implementation with networking to the 9P methods
+ * described in [NinePTranslator]. Details about methods related to 9P can be found in [NinePTranslator]. Remember to
+ * disconnect using [disconnect] after use.
+ *
+ * Details about network-related topics can be found in [NetworkPacketTransporter] and the implementation of choice.
+ *
+ * Details about 9P messages and methods can be found in [NinePTranslator].
+ *
+ * @param netPackTrans The networking API backend of choice.
+ *
+ * @throws UnresolvableHostException if the host resolution made by [netPackTrans] failed.
+ */
+class NinePConnection(netPackTrans: NetworkPacketTransporter) : NinePTranslator {
+ /**
+ * Networking API.
+ */
+ val npt: NetworkPacketTransporter = netPackTrans
+
+ /**
+ * Disconnect from the remote host,
+ *
+ * @throws IOException if an I/O error occurred while closing the socket.
+ */
+ fun disconnect() {
+ this.npt.close()
+ }
+
+ // TODO: implement methods from NinePTranslator
+} \ No newline at end of file