summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-12 18:02:04 +0200
committerEdoardo La Greca2025-08-12 18:08:23 +0200
commit1e50cf9c224d03896f176f3718ff80ef1659e9c2 (patch)
treea4eff2d5acf5db1780e34f49daba566ed2ce3fa4
parentc03cb8abf4cb48e9816d8f2642e6e60823627689 (diff)
move InMessage, OutMessage, TransportLayer, and TransportLayerJavaNet to net package
-rw-r--r--src/main/kotlin/Connection.kt18
-rw-r--r--src/main/kotlin/QID.kt2
-rw-r--r--src/main/kotlin/Stat.kt2
-rw-r--r--src/main/kotlin/net/InMessage.kt (renamed from src/main/kotlin/InMessage.kt)5
-rw-r--r--src/main/kotlin/net/OutMessage.kt (renamed from src/main/kotlin/OutMessage.kt)3
-rw-r--r--src/main/kotlin/net/TransportLayer.kt (renamed from src/main/kotlin/TransportLayer.kt)2
-rw-r--r--src/main/kotlin/net/TransportLayerJavaNet.kt (renamed from src/main/kotlin/TransportLayerJavaNet.kt)3
7 files changed, 26 insertions, 9 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt
index ff12656..f2cdd15 100644
--- a/src/main/kotlin/Connection.kt
+++ b/src/main/kotlin/Connection.kt
@@ -2,6 +2,9 @@ import except.MsizeValueTooBigException
import except.RErrorException
import except.UnaccessibleFileException
import except.UnknownVersionException
+import net.InMessage
+import net.OutMessage
+import net.TransportLayer
import java.io.IOException
import java.math.BigInteger
@@ -10,12 +13,11 @@ import java.math.BigInteger
* described in [ProtocolTranslator]. Details about methods related to 9P can be found in [ProtocolTranslator]. Remember
* to disconnect using [disconnect] after use.
*
- * Details about network-related topics can be found in [TransportLayer] and the implementation of choice.
+ * Details about network-related topics can be found in [net.TransportLayer] and the implementation of choice.
*
* Details about 9P messages and methods can be found in [ProtocolTranslator].
*
* @param transLay The networking API backend of choice.
- *
* @throws except.UnresolvableHostException if the host resolution made by [transLay] failed.
*/
class Connection(transLay: TransportLayer) : ProtocolTranslator {
@@ -50,15 +52,15 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
}
/**
- * Handy function to create an [InMessage] instance and check for errors. After successfully using this function, it
- * is guaranteed that both no error occurred while reading the incoming message and the message is not of type
- * R-error.
+ * Handy function to create an [net.InMessage] instance and check for errors. After successfully using this
+ * function, it is guaranteed that both no error occurred while reading the incoming message and the message is not
+ * of type R-error.
*
- * It uses [tl] and [maxSize] for instancing the [InMessage] class.
+ * It uses [tl] and [maxSize] for instancing the [net.InMessage] class.
*
* @return A pair of: (1) a nullable string (which can be: `null` if no error occurred, empty if an error occurred
- * with no message, or non-empty with the error message) and (2) the optional [InMessage] instance (null if an error
- * occurred).
+ * with no message, or non-empty with the error message) and (2) the optional [net.InMessage] instance (null if an
+ * error occurred).
* @throws except.InvalidMessageException if the received message is invalid.
* @throws except.RErrorException if the received message is an R-error message.
*/
diff --git a/src/main/kotlin/QID.kt b/src/main/kotlin/QID.kt
index 1e03fe8..4d0bd6a 100644
--- a/src/main/kotlin/QID.kt
+++ b/src/main/kotlin/QID.kt
@@ -1,3 +1,5 @@
+import net.InMessage
+import net.OutMessage
import java.math.BigInteger
/**
diff --git a/src/main/kotlin/Stat.kt b/src/main/kotlin/Stat.kt
index e609b4c..20692c5 100644
--- a/src/main/kotlin/Stat.kt
+++ b/src/main/kotlin/Stat.kt
@@ -1,3 +1,5 @@
+import net.InMessage
+import net.OutMessage
import java.math.BigInteger
// TODO: add time conversion methods
diff --git a/src/main/kotlin/InMessage.kt b/src/main/kotlin/net/InMessage.kt
index bf76ef9..771c670 100644
--- a/src/main/kotlin/InMessage.kt
+++ b/src/main/kotlin/net/InMessage.kt
@@ -1,3 +1,6 @@
+package net
+
+import NinePMessageType
import except.InvalidMessageException
import java.math.BigInteger
@@ -8,7 +11,7 @@ import java.math.BigInteger
* @param tl The transport layer API.
* @param maxSize The maximum message size negotiated with the remote part.
* @param reqTag The required tag.
- * @throws except.InvalidMessageException if the message that is currently being read is invalid.
+ * @throws InvalidMessageException if the message that is currently being read is invalid.
*/
class InMessage(val tl: TransportLayer, maxSize: UInt, val reqTag: UShort) {
/**
diff --git a/src/main/kotlin/OutMessage.kt b/src/main/kotlin/net/OutMessage.kt
index dc16016..c9ae879 100644
--- a/src/main/kotlin/OutMessage.kt
+++ b/src/main/kotlin/net/OutMessage.kt
@@ -1,3 +1,6 @@
+package net
+
+import NinePMessageType
import java.math.BigInteger
import kotlin.math.pow
diff --git a/src/main/kotlin/TransportLayer.kt b/src/main/kotlin/net/TransportLayer.kt
index 8b31d20..90dcd11 100644
--- a/src/main/kotlin/TransportLayer.kt
+++ b/src/main/kotlin/net/TransportLayer.kt
@@ -1,3 +1,5 @@
+package net
+
import java.io.Closeable
/**
diff --git a/src/main/kotlin/TransportLayerJavaNet.kt b/src/main/kotlin/net/TransportLayerJavaNet.kt
index ee1c9f9..3d2867a 100644
--- a/src/main/kotlin/TransportLayerJavaNet.kt
+++ b/src/main/kotlin/net/TransportLayerJavaNet.kt
@@ -1,3 +1,6 @@
+package net
+
+import nineAddressToValues
import java.io.InputStream
import java.io.OutputStream
import java.net.Socket