diff options
Diffstat (limited to 'src/main/kotlin/Connection.kt')
-rw-r--r-- | src/main/kotlin/Connection.kt | 24 |
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? { |