Class: Baykit::BayServer::Docker::Http::H2::Command::CmdSettings

Inherits:
H2Command
  • Object
show all
Includes:
Baykit::BayServer::Docker::Http::H2, Protocol
Defined in:
lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb

Defined Under Namespace

Classes: Item

Constant Summary collapse

HEADER_TABLE_SIZE =
0x1
ENABLE_PUSH =
0x2
MAX_CONCURRENT_STREAMS =
0x3
INITIAL_WINDOW_SIZE =
0x4
MAX_FRAME_SIZE =
0x5
MAX_HEADER_LIST_SIZE =
0x6
INIT_HEADER_TABLE_SIZE =
4096
INIT_ENABLE_PUSH =
1
INIT_MAX_CONCURRENT_STREAMS =
-1
INIT_INITIAL_WINDOW_SIZE =
65535
INIT_MAX_FRAME_SIZE =
16384
INIT_MAX_HEADER_LIST_SIZE =
-1

Instance Attribute Summary collapse

Attributes inherited from H2Command

#flags, #stream_id

Instance Method Summary collapse

Constructor Details

#initialize(stream_id, flags = nil) ⇒ CmdSettings

Returns a new instance of CmdSettings.



52
53
54
55
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb', line 52

def initialize(stream_id, flags=nil)
  super(H2Type::SETTINGS, stream_id, flags)
  @items = []
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



50
51
52
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb', line 50

def items
  @items
end

Instance Method Details

#handle(cmd_handler) ⇒ Object



86
87
88
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb', line 86

def handle(cmd_handler)
  return cmd_handler.handle_settings(self)
end

#pack(pkt) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb', line 73

def pack(pkt)
  if @flags.ack?
    # do not pack payload
  else
    acc = pkt.new_data_accessor()
    @items.each do |item|
      acc.put_short(item.id)
      acc.put_int(item.value)
    end
  end
  super
end

#unpack(pkt) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_settings.rb', line 57

def unpack(pkt)
  super
  if @flags.ack?
    return
  end

  acc = pkt.new_data_accessor()
  pos = 0
  while pos < pkt.data_len()
    id = acc.get_short()
    value = acc.get_int()
    @items.append(Item.new(id, value))
    pos += 6
  end
end