Class: Baykit::BayServer::Docker::Http::H2::Command::CmdHeaders
- Inherits:
-
H2Command
- Object
- Protocol::Command
- H2Command
- Baykit::BayServer::Docker::Http::H2::Command::CmdHeaders
- Includes:
- Baykit::BayServer::Docker::Http::H2
- Defined in:
- lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#excluded ⇒ Object
Returns the value of attribute excluded.
-
#header_blocks ⇒ Object
readonly
Returns the value of attribute header_blocks.
-
#length ⇒ Object
Returns the value of attribute length.
-
#pad_length ⇒ Object
readonly
Returns the value of attribute pad_length.
-
#start ⇒ Object
This class refers external byte array, so this IS NOT mutable.
-
#stream_dependency ⇒ Object
readonly
Returns the value of attribute stream_dependency.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Attributes inherited from H2Command
Instance Method Summary collapse
- #handle(cmd_handler) ⇒ Object
-
#initialize(stream_id, flags = nil) ⇒ CmdHeaders
constructor
A new instance of CmdHeaders.
- #pack(pkt) ⇒ Object
- #unpack(pkt) ⇒ Object
Constructor Details
#initialize(stream_id, flags = nil) ⇒ CmdHeaders
Returns a new instance of CmdHeaders.
41 42 43 44 45 46 47 48 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 41 def initialize(stream_id, flags=nil) super(H2Type::HEADERS, stream_id, flags) @pad_length = 0 @excluded = false @stream_dependency = 0 @weight = 0 @header_blocks = [] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
33 34 35 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 33 def data @data end |
#excluded ⇒ Object
Returns the value of attribute excluded.
36 37 38 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 36 def excluded @excluded end |
#header_blocks ⇒ Object (readonly)
Returns the value of attribute header_blocks.
39 40 41 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 39 def header_blocks @header_blocks end |
#length ⇒ Object
Returns the value of attribute length.
32 33 34 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 32 def length @length end |
#pad_length ⇒ Object (readonly)
Returns the value of attribute pad_length.
35 36 37 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 35 def pad_length @pad_length end |
#start ⇒ Object
This class refers external byte array, so this IS NOT mutable
31 32 33 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 31 def start @start end |
#stream_dependency ⇒ Object (readonly)
Returns the value of attribute stream_dependency.
37 38 39 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 37 def stream_dependency @stream_dependency end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
38 39 40 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 38 def weight @weight end |
Instance Method Details
#handle(cmd_handler) ⇒ Object
84 85 86 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 84 def handle(cmd_handler) return cmd_handler.handle_headers(self) end |
#pack(pkt) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 68 def pack(pkt) acc = pkt.new_data_accessor if @flags.padded? acc.put_byte(@pad_length) end if @flags.priority? acc.put_int(H2Packet.make_stream_dependency32(@excluded, @stream_dependency)) acc.put_byte(@weight) end acc.put_bytes(@data, @start, @length) super end |
#unpack(pkt) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_headers.rb', line 50 def unpack(pkt) super acc = pkt.new_data_accessor if pkt.flags.padded? @pad_length = acc.get_byte end if pkt.flags.priority? val = acc.get_int @excluded = H2Packet.extract_flag(val) == 1 @stream_dependency = H2Packet.extract_int31(val) @weight = acc.get_byte end @data = pkt.buf @start = pkt.header_len + acc.pos @length = pkt.data_len - acc.pos end |