summaryrefslogtreecommitdiff
path: root/src/main/kotlin/Connection.kt
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-07 18:40:35 +0200
committerEdoardo La Greca2025-08-07 19:03:36 +0200
commitf7113c94abce7deec8bece794a3748cbee8a9a08 (patch)
tree0c007821b57585bec59534c70e57b2a79886de4b /src/main/kotlin/Connection.kt
parent39fb93f4d6601f046ac3678fa9a994b0d60bc163 (diff)
implement attach
Diffstat (limited to 'src/main/kotlin/Connection.kt')
-rw-r--r--src/main/kotlin/Connection.kt24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt
index 13b928d..a7de8cc 100644
--- a/src/main/kotlin/Connection.kt
+++ b/src/main/kotlin/Connection.kt
@@ -114,8 +114,30 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
TODO("Not yet implemented")
}
- override fun attach() {
+ override fun attach(fid: UInt, afid: UInt, uname: String, aname: String): String? {
+ val omsg = OutMessage(NinePMessageType.TATTACH, this.tagGen.generate(), listOf("fid", "afid", "uname", "aname"),
+ mapOf(
+ "fid" to BigInteger(fid.toString()),
+ "afid" to BigInteger(afid.toString())
+ ),
+ mapOf(
+ "uname" to uname,
+ "aname" to aname
+ ),
+ emptyMap(),
+ this.maxSize
+ )
+ omsg.write(this.tl)
+ val checkErr = checkedInMessage(omsg.tag)
+ if (checkErr.first != null) {
+ return checkErr.first
+ }
+ val imsg = checkErr.second!!
+ imsg.applyField(InMessage.Field("qid", InMessage.Field.Type.RAW, 13u))
+ val qid = QID(imsg.fieldsRaw["qid"]!!.toList())
+ this.pathInfo.addPath(PathInfo.Path(aname.split("/"), fid, qid))
+ return null
}
override fun walk(fid: UInt, newfid: UInt, wname: List<String>): String? {