styx2000.extrautil.styxmessage

This module contains a set of various useful functions for more convenient work with 9P / Styx messages. Note: This module contains helpers for building all types of messages (and some other stuff), except stat (R-message) and wstat (T-message), since these messages have a complex structure and must be processed directly in the code that forms them.

Members

Aliases

StyxMail
alias StyxMail = StyxMessage[]

Convenient alias for array of styx messages (not described in 9P / Styx protocol)

StyxMessage
alias StyxMessage = StyxObject[]

Convenient aliases

Functions

calculateMessageSize
auto calculateMessageSize(StyxMessage msg)

Calculate real (!) message size (in bytes)

createHeader
auto createHeader(uint size, STYX_MESSAGE_TYPE type, ushort tag)

Create base header for 9P / Styx messages

createRmsgAttach
auto createRmsgAttach(ushort tag, STYX_QID_TYPE type, uint vers, ulong path)

Create attach message from server

createRmsgAuth
auto createRmsgAuth(ushort tag, STYX_QID_TYPE type, uint vers, ulong path)

Create auth message from server

createRmsgClunk
auto createRmsgClunk(ushort tag)

Create clunk message from server

createRmsgCreate
auto createRmsgCreate(ushort tag, STYX_QID_TYPE type, uint vers, ulong path, uint iounit)

Create create message from server

createRmsgError
auto createRmsgError(ushort tag, string ename)

Create error message from server (for client this type of message does not exists)

createRmsgFlush
auto createRmsgFlush(ushort tag)

Create flush message from server

createRmsgOpen
auto createRmsgOpen(ushort tag, STYX_QID_TYPE type, uint vers, ulong path, uint iounit)

Create open message from server

createRmsgRead
auto createRmsgRead(ushort tag, uint count, ubyte[] data)

Create read message from server

createRmsgRemove
auto createRmsgRemove(ushort tag)

Create remove message from server

createRmsgVersion
auto createRmsgVersion(ushort tag, uint maximalSize, string vers)

Create version message from server

createRmsgWalk
auto createRmsgWalk(ushort tag, Qid[] nwqid)

Create walk message from server

createRmsgWrite
auto createRmsgWrite(ushort tag, uint count)

Create write message from server

createRmsgWstat
auto createRmsgWstat(ushort tag)

Create wstat message from server

createTmsgAttach
auto createTmsgAttach(ushort tag, uint fid, uint afid, string uname, string aname)

Create attach message from client

createTmsgAuth
auto createTmsgAuth(ushort tag, uint afid, string uname, string aname)

Create auth message from client

createTmsgClunk
auto createTmsgClunk(ushort tag, uint fid)

Create clunk message from client

createTmsgCreate
auto createTmsgCreate(ushort tag, uint fid, STYX_FILE_MODE mode, STYX_FILE_PERMISSION[] perms)

Create create message from client

createTmsgFlush
auto createTmsgFlush(ushort tag, ushort oldTag)

Create flush message from client

createTmsgOpen
auto createTmsgOpen(ushort tag, uint fid, STYX_FILE_MODE mode)

Create open message from client

createTmsgRead
auto createTmsgRead(ushort tag, uint fid, ulong offset, uint count)

Create read message from client

createTmsgRemove
auto createTmsgRemove(ushort tag, uint fid)

Create remove message from client

createTmsgStat
auto createTmsgStat(ushort tag, uint fid)

Create stat message from client

createTmsgVersion
auto createTmsgVersion(ushort tag, uint maximalSize, string vers)

Create version message from client

createTmsgWalk
auto createTmsgWalk(ushort tag, uint fid, uint newFid, string[] nwname)

Create walk message from client

createTmsgWrite
auto createTmsgWrite(ushort tag, uint fid, ulong offset, uint count, ubyte[] data)

Create write message from client

extractHeader
auto extractHeader(StyxMessage msg)

Parse header of Styx message. Returns anonymous struct that contains size, type and tag fields.

fixMessageSize
auto fixMessageSize(StyxMessage msg)

Fix incorrect size in some messages which generated by helpers (fix zero sizes)

isErrorMessage
bool isErrorMessage(StyxMessage msg)

StyxMessage is error message ?

isRmessage
bool isRmessage(StyxMessage msg)

StyxMessage is server message ?

isTmessage
bool isTmessage(StyxMessage msg)

StyxMessage is client message ?

Meta

Authors

Oleg Bakharev, Ilya Pertsev