# protocol_cli A development tool for testing the protocol layer in isolation. Runs a server that decodes and prints all incoming control messages, or a client that connects and sends a sample STREAM_OPEN request. --- ## Build From the repository root: ```sh make cli ``` The binary is placed in `build/cli/`. --- ## Usage ### Server mode ```sh ./protocol_cli --server [port] ``` Default port: `8000`. Listens for connections and prints a decoded description of every received frame. Example output on an incoming STREAM_OPEN: ``` CONTROL_REQUEST request_id=1 STREAM_OPEN stream_id=1 format=0x0001 pixel_format=0x0000 origin=0x0001 ``` Recognised message types and commands: | Type | Description | |---|---| | `VIDEO_FRAME` | stream_id + compressed payload | | `STREAM_EVENT` | stream_id + event code (INTERRUPTED / RESUMED) | | `CONTROL_REQUEST` | request_id + command (STREAM_OPEN, STREAM_CLOSE, ENUM_DEVICES, ENUM_CONTROLS, GET_CONTROL, SET_CONTROL, ENUM_MONITORS) | | `CONTROL_RESPONSE` | request_id + status (OK, ERROR, UNKNOWN_CMD, INVALID_PARAMS, NOT_FOUND) | ### Client mode ```sh ./protocol_cli --client ``` Connects to the server and sends a single STREAM_OPEN request, then waits for the response. Example: ```sh ./protocol_cli --client 127.0.0.1 8000 ``` --- ## Relationship to the Video Routing System `protocol_cli` exercises the `protocol` module that all nodes use to encode and decode wire messages. Pairing the server with a running node lets you inspect raw control traffic; pairing the client with a running node lets you inject individual commands for debugging. See also: [`transport_cli.md`](transport_cli.md) for raw frame-level testing without protocol parsing.