commit f993443f32b94acf4f6ac5428acb66cf89c434c6
parent e866fb189a99f3d9b45449bc436f7fa5453d8a8c
Author: Matsuda Kenji <info@mtkn.jp>
Date: Thu, 26 Oct 2023 07:56:06 +0900
add comments
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fcall.go b/fcall.go
@@ -52,13 +52,21 @@ const NOTAG = ^uint16(0)
// Msg represents any kind of message of 9P.
// It defines methods for common fields.
+// For each message type <T>, new<T>([]byte) function parses the byte array
+// of 9P message into the corresponding message struct.
+// For detailed information on each message, consult the documentation
+// of 9P protocol.
type Msg interface {
// Size returns the size field of message.
+ // Size field holds the size of the message in bytes
+ // including the 4-byte size field itself.
Size() uint32
// Type returns the type field of message.
Type() MsgType
// Tag returns the tag of message.
+ // Tag is the identifier of each message.
Tag() uint16
+ // SetTag sets the tag field of the message.
SetTag(uint16)
// Marshal convert Msg to byte array to be transmitted.
@@ -67,6 +75,7 @@ type Msg interface {
}
// bufMsg is Msg with just an array of bytes.
+// TODO: rename.
type bufMsg []byte
func (msg bufMsg) Size() uint32 { return gbit32(msg[0:4]) }
@@ -135,7 +144,6 @@ func (msg bufMsg) String() string {
}
}
-// TVersion represents Tversion message of 9P.
type TVersion struct {
tag uint16
mSize uint32