Class: Rumai::IXP::Fcall
- Inherits:
-
Object
- Object
- Rumai::IXP::Fcall
- Includes:
- Struct
- Defined in:
- lib/rumai/ixp/message.rb,
lib/rumai/ixp/message.rb
Overview
A remote function call (fcall).
Direct Known Subclasses
Rattach, Rauth, Rclunk, Rcreate, Rerror, Rflush, Ropen, Rread, Rremove, Rstat, Rversion, Rwalk, Rwrite, Rwstat, Tattach, Tauth, Tclunk, Tcreate, Terror, Tflush, Topen, Tread, Tremove, Tstat, Tversion, Twalk, Twrite, Twstat
Constant Summary
- NOTAG =
BYTE2_MASK
- NOFID =
(ushort) (uint32)
BYTE4_MASK
- CLASS_TO_TYPE =
{ Tversion => 100, Rversion => 101, Tauth => 102, Rauth => 103, Tattach => 104, Rattach => 105, Terror => 106, Rerror => 107, Tflush => 108, Rflush => 109, Twalk => 110, Rwalk => 111, Topen => 112, Ropen => 113, Tcreate => 114, Rcreate => 115, Tread => 116, Rread => 117, Twrite => 118, Rwrite => 119, Tclunk => 120, Rclunk => 121, Tremove => 122, Rremove => 123, Tstat => 124, Rstat => 125, Twstat => 126, Rwstat => 127, }.freeze
- TYPE_TO_CLASS =
CLASS_TO_TYPE.invert.freeze
Class Method Summary
-
+ (Object) from_9p(stream)
(also: __from_9p__)
Creates a new instance of this class from the given 9P2000 byte stream and returns the instance.
-
+ (Object) type
Returns the value of the ‘type’ field for this fcall.
Instance Method Summary
-
- (Object) to_9p
Transforms this object into a string of 9P2000 bytes.
-
- (Object) type
Returns the value of the ‘type’ field for this fcall.
Methods included from Struct
included, #initialize, #load_9p
Constructor Details
This class inherits a constructor from Rumai::IXP::Struct
Class Method Details
+ (Object) from_9p(stream) Also known as: __from_9p__
Creates a new instance of this class from the given 9P2000 byte stream and returns the instance.
416 417 418 419 420 421 422 423 424 425 |
# File 'lib/rumai/ixp/message.rb', line 416 def from_9p stream size = stream.read_9p(4) type = stream.read_9p(1) unless fcall = TYPE_TO_CLASS[type] raise Error, "illegal fcall type: #{type}" end __from_9p__ stream, fcall end |
+ (Object) type
Returns the value of the ‘type’ field for this fcall.
657 658 659 |
# File 'lib/rumai/ixp/message.rb', line 657 def self.type CLASS_TO_TYPE[self] end |
Instance Method Details
- (Object) to_9p
Transforms this object into a string of 9P2000 bytes.
402 403 404 405 406 |
# File 'lib/rumai/ixp/message.rb', line 402 def to_9p data = type.to_9p(1) << super size = (data.length + 4).to_9p(4) size << data end |
- (Object) type
Returns the value of the ‘type’ field for this fcall.
664 665 666 |
# File 'lib/rumai/ixp/message.rb', line 664 def type self.class.type end |