laylink/src/Protocol/FrameType.php
2026-05-28 20:19:28 +08:00

45 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace LayLink\Protocol;
final class FrameType
{
public const AUTH = 'AUTH';
public const AUTH_OK = 'AUTH_OK';
public const AUTH_FAIL = 'AUTH_FAIL';
public const PING = 'PING';
public const PONG = 'PONG';
public const OPEN = 'OPEN';
public const OPEN_OK = 'OPEN_OK';
public const OPEN_FAIL = 'OPEN_FAIL';
public const DATA = 'DATA';
public const UDP_DATA = 'UDP_DATA';
public const CLOSE = 'CLOSE';
public const ERROR = 'ERROR';
public const WINDOW = 'WINDOW';
/**
* @return array<string, string>
*/
public static function descriptions(): array
{
return [
self::AUTH => 'Agent authenticates to POP Server.',
self::AUTH_OK => 'POP Server accepts Agent authentication.',
self::AUTH_FAIL => 'POP Server rejects Agent authentication.',
self::PING => 'Agent heartbeat to POP Server.',
self::PONG => 'POP Server heartbeat response.',
self::OPEN => 'Client Agent asks POP Server to open an authorized target stream.',
self::OPEN_OK => 'POP Server confirms target stream is open.',
self::OPEN_FAIL => 'POP Server rejects or fails target stream opening.',
self::DATA => 'Bidirectional stream bytes, base64 encoded in MVP.',
self::UDP_DATA => 'Bidirectional UDP datagram relay, base64 encoded in MVP.',
self::CLOSE => 'Either side closes a stream session.',
self::ERROR => 'Explicit protocol or session error.',
self::WINDOW => 'Flow-control window update, reserved for backpressure.',
];
}
}