Lots of frame stubs

This commit is contained in:
2024-02-25 00:18:33 +01:00
parent fb1ce8cbc1
commit ff824cdaba
14 changed files with 401 additions and 1 deletions

View File

@ -0,0 +1,51 @@
<?php
namespace NoccyLabs\React\Http2\Frame;
class SettingsFrame extends Frame
{
const SETTINGS_HEADER_TABLE_SIZE = 0x1;
const SETTINGS_ENABLE_PUSH = 0x2;
const SETTINGS_MAX_CONCURRENT_STREAMS = 0x3;
const SETTINGS_INITIAL_WINDOW_SIZE = 0x4;
const SETTINGS_MAX_FRAME_SIZE = 0x5;
const SETTINGS_MAX_HEADER_LIST_SIZE = 0x6;
protected int $frameType = self::FRAME_SETTINGS;
protected array $settings = [];
/**
* Set a setting to a specific value. This method intentionally does not do any bounds
* checking on the setting id to allow for extensions.
*
* @param int $setting
* @param int $value
* @return self
*/
public function set(int $setting, int $value): self
{
$this->settings[$setting] = $value;
return $this;
}
public function get(int $setting): ?int
{
return $this->settings[$setting]??null;
}
public function toBinary(): string
{
$packed = '';
foreach ($this->settings as $setting=>$value) {
$packed .= pack('vV', $setting, $value);
}
return $packed;
}
protected function fromBinary(string $data): void
{
}
}