5 // Message represents the target of an fcall.
6 type Message interface {
7 // Type returns the type of call for the target message.
11 // newMessage returns a new instance of the message based on the Fcall type.
12 func newMessage(typ FcallType) (Message, error) {
15 return MessageTversion{}, nil
17 return MessageRversion{}, nil
19 return MessageTauth{}, nil
21 return MessageRauth{}, nil
23 return MessageTattach{}, nil
25 return MessageRattach{}, nil
27 return MessageRerror{}, nil
29 return MessageTflush{}, nil
31 return MessageRflush{}, nil // No message body for this response.
33 return MessageTwalk{}, nil
35 return MessageRwalk{}, nil
37 return MessageTopen{}, nil
39 return MessageRopen{}, nil
41 return MessageTcreate{}, nil
43 return MessageRcreate{}, nil
45 return MessageTread{}, nil
47 return MessageRread{}, nil
49 return MessageTwrite{}, nil
51 return MessageRwrite{}, nil
53 return MessageTclunk{}, nil
55 return MessageRclunk{}, nil // no response body
57 return MessageTremove{}, nil
59 return MessageRremove{}, nil
61 return MessageTstat{}, nil
63 return MessageRstat{}, nil
65 return MessageTwstat{}, nil
67 return MessageRwstat{}, nil
70 return nil, fmt.Errorf("unknown message type")
73 // MessageVersion encodes the message body for Tversion and Rversion RPC
74 // calls. The body is identical in both directions.
75 type MessageTversion struct {
80 type MessageRversion struct {
85 type MessageTauth struct {
91 type MessageRauth struct {
95 type MessageTflush struct {
99 type MessageRflush struct{}
101 type MessageTattach struct {
108 type MessageRattach struct {
112 type MessageTwalk struct {
118 type MessageRwalk struct {
122 type MessageTopen struct {
127 type MessageRopen struct {
132 type MessageTcreate struct {
139 type MessageRcreate struct {
144 type MessageTread struct {
150 type MessageRread struct {
154 type MessageTwrite struct {
160 type MessageRwrite struct {
164 type MessageTclunk struct {
168 type MessageRclunk struct{}
170 type MessageTremove struct {
174 type MessageRremove struct{}
176 type MessageTstat struct {
180 type MessageRstat struct {
184 type MessageTwstat struct {
189 type MessageRwstat struct{}
191 func (MessageTversion) Type() FcallType { return Tversion }
192 func (MessageRversion) Type() FcallType { return Rversion }
193 func (MessageTauth) Type() FcallType { return Tauth }
194 func (MessageRauth) Type() FcallType { return Rauth }
195 func (MessageTflush) Type() FcallType { return Tflush }
196 func (MessageRflush) Type() FcallType { return Rflush }
197 func (MessageTattach) Type() FcallType { return Tattach }
198 func (MessageRattach) Type() FcallType { return Rattach }
199 func (MessageTwalk) Type() FcallType { return Twalk }
200 func (MessageRwalk) Type() FcallType { return Rwalk }
201 func (MessageTopen) Type() FcallType { return Topen }
202 func (MessageRopen) Type() FcallType { return Ropen }
203 func (MessageTcreate) Type() FcallType { return Tcreate }
204 func (MessageRcreate) Type() FcallType { return Rcreate }
205 func (MessageTread) Type() FcallType { return Tread }
206 func (MessageRread) Type() FcallType { return Rread }
207 func (MessageTwrite) Type() FcallType { return Twrite }
208 func (MessageRwrite) Type() FcallType { return Rwrite }
209 func (MessageTclunk) Type() FcallType { return Tclunk }
210 func (MessageRclunk) Type() FcallType { return Rclunk }
211 func (MessageTremove) Type() FcallType { return Tremove }
212 func (MessageRremove) Type() FcallType { return Rremove }
213 func (MessageTstat) Type() FcallType { return Tstat }
214 func (MessageRstat) Type() FcallType { return Rstat }
215 func (MessageTwstat) Type() FcallType { return Twstat }
216 func (MessageRwstat) Type() FcallType { return Rwstat }