Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Protocol GClasses

Message framing and protocol parsing. Protocol GClasses sit between a transport (C_TCP) and the application logic, translating raw bytes into structured events.

Source: kernel/c/root-linux/src/c_prot_http_cl.c, c_prot_http_sr.c, c_prot_tcp4h.c, c_prot_raw.c, c_websocket.c


C_PROT_HTTP_CL

HTTP client protocol — sends requests and parses responses. Can deliver the body incrementally (raw_body_data) or as a complete message.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_WAIT_CONNECTED, ST_CONNECTED
Input eventsEV_SEND_MESSAGE, EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY, EV_TIMEOUT
Output eventsEV_ON_MESSAGE, EV_ON_HEADER, EV_ON_OPEN, EV_ON_CLOSE

Key attributes

AttributeTypeDescription
urlstringHTTP endpoint URL.
timeout_inactivityintegerInactivity timeout in seconds.
cert_pemstringTLS certificate (PEM).
raw_body_databoolTRUE to deliver body chunks incrementally.
subscriberpointerGobj receiving output events.

C_PROT_HTTP_SR

HTTP server protocol — parses incoming HTTP requests and produces structured events for the application.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_CONNECTED
Input eventsEV_SEND_MESSAGE, EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY
Output eventsEV_ON_MESSAGE, EV_ON_HEADER, EV_ON_OPEN, EV_ON_CLOSE

Key attributes

AttributeTypeDescription
timeout_inactivityintegerInactivity timeout in seconds.
subscriberpointerGobj receiving output events.

C_PROT_TCP4H

Frame protocol with a 4-byte binary header containing the payload length. Works in both client and server modes.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_WAIT_CONNECTED, ST_WAIT_HANDSHAKE, ST_CONNECTED
Input eventsEV_SEND_MESSAGE, EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY, EV_DROP, EV_TIMEOUT
Output eventsEV_ON_MESSAGE, EV_ON_OPEN, EV_ON_CLOSE

Key attributes

AttributeTypeDescription
urlstringConnection URL.
iamServerboolTRUE for server mode.
max_pkt_sizeintegerMaximum allowed packet size.
timeout_handshakeintegerHandshake timeout in seconds.
timeout_payloadintegerPayload reception timeout.
cert_pemstringTLS certificate (PEM).

C_PROT_RAW

Raw pass-through protocol — forwards data without adding or removing headers. Useful for transparent proxying.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_CONNECTED
Input eventsEV_SEND_MESSAGE, EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY
Output eventsEV_ON_MESSAGE, EV_ON_OPEN, EV_ON_CLOSE

Key attributes

AttributeTypeDescription
subscriberpointerGobj receiving output events.

C_WEBSOCKET

WebSocket protocol (RFC 6455) — supports both client and server roles with frame masking, ping/pong, and graceful close handshake.

PropertyValue
StatesST_STOPPED, ST_DISCONNECTED, ST_WAIT_CONNECTED, ST_WAIT_HANDSHAKE, ST_CONNECTED
Input eventsEV_SEND_MESSAGE, EV_CONNECTED, EV_DISCONNECTED, EV_RX_DATA, EV_TX_READY, EV_DROP, EV_TIMEOUT
Output eventsEV_ON_MESSAGE, EV_ON_OPEN, EV_ON_CLOSE

Key attributes

AttributeTypeDescription
urlstringWebSocket URL (ws:// or wss://).
iamServerboolTRUE for server mode.
cert_pemstringTLS certificate (PEM).
timeout_handshakeintegerHandshake timeout in seconds.
timeout_payloadintegerPayload reception timeout.
pingTintegerPing interval in seconds (0 = disabled).