Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (67 sloc) 3.26 KB
package styxproto
// Based on
// http://plan9.bell-labs.com/sources/plan9/sys/include/fcall.h
const (
msgTversion = iota + 100 // size[4] Tversion tag[2] msize[4] version[s]
msgRversion // size[4] Rversion tag[2] msize[4] version[s]
msgTauth // size[4] Tauth tag[2] afid[4] uname[s] aname[s]
msgRauth // size[4] Rauth tag[2] aqid[13]
msgTattach // size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s]
msgRattach // size[4] Rattach tag[2] qid[13]
msgTerror // illegal
msgRerror // size[4] Rerror tag[2] ename[s]
msgTflush // size[4] Tflush tag[2] oldtag[2]
msgRflush // size[4] Rflush tag[2]
msgTwalk // size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s])
msgRwalk // size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13])
msgTopen // size[4] Topen tag[2] fid[4] mode[1]
msgRopen // size[4] Ropen tag[2] qid[13] iounit[4]
msgTcreate // size[4] Tcreate tag[2] fid[4] name[s] perm[4] mode[1]
msgRcreate // size[4] Rcreate tag[2] qid[13] iounit[4]
msgTread // size[4] Tread tag[2] fid[4] offset[8] count[4]
msgRread // size[4] Rread tag[2] count[4] data[count]
msgTwrite // size[4] Twrite tag[2] fid[4] offset[8] count[4] data[count]
msgRwrite // size[4] Rwrite tag[2] count[4]
msgTclunk // size[4] Tclunk tag[2] fid[4]
msgRclunk // size[4] Rclunk tag[2]
msgTremove // size[4] Tremove tag[2] fid[4]
msgRremove // size[4] Rremove tag[2]
msgTstat // size[4] Tstat tag[2] fid[4]
msgRstat // size[4] Rstat tag[2] stat[n]
msgTwstat // size[4] Twstat tag[2] fid[4] stat[n]
msgRwstat // size[4] Rwstat tag[2]
)
// QidLen is the length of a Qid in bytes.
const QidLen = 13
// NoTag is the tag for Tversion and Rversion requests.
const NoTag = ^uint16(0)
// NoFid is a reserved fid used in a Tattach request for the
// afid field, that indicates that the client does not wish
// to authenticate his session.
const NoFid = ^uint32(0)
// Flags for the mode field in Topen and Tcreate messages
const (
OREAD = 0 // open read-only
OWRITE = 1 // open write-only
ORDWR = 2 // open read-write
OEXEC = 3 // execute (== read but check execute permission)
OTRUNC = 16 // or'ed in (except for exec), truncate file first
OCEXEC = 32 // or'ed in, close on exec
ORCLOSE = 64 // or'ed in, remove on close
)
// File modes
const (
DMDIR = 0x80000000 // mode bit for directories
DMAPPEND = 0x40000000 // mode bit for append only files
DMEXCL = 0x20000000 // mode bit for exclusive use files
DMMOUNT = 0x10000000 // mode bit for mounted channel
DMAUTH = 0x08000000 // mode bit for authentication file
DMTMP = 0x04000000 // mode bit for non-backed-up file
DMREAD = 0x4 // mode bit for read permission
DMWRITE = 0x2 // mode bit for write permission
DMEXEC = 0x1 // mode bit for execute permission
// Mask for the type bits
DMTYPE = DMDIR | DMAPPEND | DMEXCL | DMMOUNT | DMTMP
// Mask for the permissions bits
DMPERM = DMREAD | DMWRITE | DMEXEC
)