chickadee » 9p » make-message

make-message type tag contentsprocedure

The type is a symbol, one of

 Tversion Rversion
 Tauth Rauth
 Tattach Rattach
 Rerror
 Tflush Rflush
 Twalk Rwalk
 Topen Ropen
 Tcreate Rcreate
 Tread Rread
 Twrite Rwrite
 Tclunk Rclunk
 Tremove Rremove
 Tstat Rstat
 Twstat Rwstat

As you can see, all messages (except Rerror) come in pairs: there is a transmit message (that starts with a T) and a response message (that starts with an R). The client sends transmit messages and the server sends response message in return. It must either send the matching response message or Rerror. It is not allowed to return a different message, nor is it allowed for the client to send a response message or the server to send a transmit message.

The tag is a unique identifier that allows the client to keep track of what it sent and what responses belong to what transmissions. The client sends a message with a given tag and the server will respond with the matching response message bearing the same tag. This allows a client to send messages asynchronously, as long as they all have a different tag. Then the responses can come in any order and be handled at any time and still be understood if the client keeps a list of sent tags and what transmissions belonged to them. The 9p-client library always sends messages synchronously, waiting for replies before sending new transmissions. This allows it to use a constant tag all the time.

The contents are a list whose contents differ per message type. For instance, a Tversion message's contents consist of an msize (a maximum message size) and a string which indicates the protocol version. Currently the 9p-lolevel implicitly assumes the 9P2000 version of the protocol because of the way it is constructed. If it turns out to be useful to support different versions, the egg's API will most likely change in order to allow for more flexibility.

You can of course query and modify the message objects with the following procedures: