Class: Baykit::BayServer::Docker::Http::H2::Command::CmdPreface
- Inherits:
-
H2Command
- Object
- Protocol::Command
- H2Command
- Baykit::BayServer::Docker::Http::H2::Command::CmdPreface
- Includes:
- Baykit::BayServer::Docker::Http::H2, Util
- Defined in:
- lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb
Constant Summary collapse
- PREFACE_BYTES =
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
Instance Attribute Summary collapse
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Attributes inherited from H2Command
Instance Method Summary collapse
- #handle(cmd_handler) ⇒ Object
-
#initialize(stream_id, flags = nil) ⇒ CmdPreface
constructor
A new instance of CmdPreface.
- #pack(pkt) ⇒ Object
- #unpack(pkt) ⇒ Object
Constructor Details
#initialize(stream_id, flags = nil) ⇒ CmdPreface
Returns a new instance of CmdPreface.
24 25 26 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb', line 24 def initialize(stream_id, flags=nil) super(H2Type::PREFACE, stream_id, flags) end |
Instance Attribute Details
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
22 23 24 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb', line 22 def protocol @protocol end |
Instance Method Details
#handle(cmd_handler) ⇒ Object
40 41 42 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb', line 40 def handle(cmd_handler) return cmd_handler.handle_preface(self) end |
#pack(pkt) ⇒ Object
35 36 37 38 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb', line 35 def pack(pkt) acc = pkt.new_h2_data_accessor() acc.put_bytes(PREFACE_BYTES) end |
#unpack(pkt) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_preface.rb', line 28 def unpack(pkt) acc = pkt.new_data_accessor() preface_data = StringUtil.alloc(24) acc.get_bytes(preface_data, 0, 24) @protocol = preface_data[6, 8] end |