PdcommTcpOptions
Struct
Configuration for pdcomm_tcp_create().
typedef struct PdcommTcpOptions { ... } PdcommTcpOptionsEvery timer and limit is application policy; zero is invalid unless a field says otherwise. The endpoint copies the structure, so you can release it after pdcomm_tcp_create() returns.
Members
connect_timeout_ms
Field
Active-mode TCP connect timeout in milliseconds; must be nonzero.
uint64_t connect_timeout_msThe connect call runs inside pdcomm_tcp_poll() and can block it for up to this long.
initial_system_bytes
Field
First system bytes value of each connection generation.
uint32_t initial_system_bytesEach new outgoing message uses the next value. The counter restarts at this value for every generation and does not wrap: after 0xFFFFFFFF, submissions fail with #PDCOMM_LIMIT_EXCEEDED.
item_limits
Field
SECS-II limits for message bodies.
PdcommSecsLimits item_limitsApplied to bodies passed to pdcomm_tcp_request() and pdcomm_tcp_reply() and to received data message bodies. item_limits.struct_size must be at least sizeof(PdcommSecsLimits).
max_application_bytes
Field
Largest total body size of the events in the queue read by pdcomm_tcp_next_event(), in bytes; must be at least PdcommTcpOptions::max_frame_bytes minus 14.
size_t max_application_bytesmax_application_events
Field
Capacity of the queue read by pdcomm_tcp_next_event(); must be nonzero.
size_t max_application_eventsWhen the queue is full, the endpoint holds further events back until you drain it.
max_events
Field
Capacity of the internal session event queue; must be at least 2 * #PDCOMM_TCP_MAX_TRANSACTIONS + 8 (72).
size_t max_eventsmax_frame_bytes
Field
Largest HSMS frame in bytes, including the 4-byte length field and the 10-byte header; must be at least 14.
size_t max_frame_bytesThe largest message body is this value minus 14. A larger outgoing body is rejected with #PDCOMM_LIMIT_EXCEEDED; a larger incoming frame closes the connection.
max_io_chunk
Field
Largest number of bytes passed to one socket read or write call; must be nonzero.
size_t max_io_chunkmax_queued_bytes
Field
Largest total size of message bodies held in the internal session queue, in bytes.
size_t max_queued_bytesSubmissions that would exceed it return #PDCOMM_BACKPRESSURE. A body that does not fit in a frame returns #PDCOMM_LIMIT_EXCEEDED first. Zero allows only messages without a body.
max_write_bytes
Field
Largest total size of the socket write queue in bytes; must be at least 14 and at least PdcommTcpOptions::max_frame_bytes.
size_t max_write_bytesmax_write_frames
Field
Largest number of frames in the socket write queue; must be nonzero.
size_t max_write_framesmode
Field
Connection mode: #PDCOMM_TCP_ACTIVE or #PDCOMM_TCP_PASSIVE.
uint32_t modepoll_budget
Field
Largest number of internal actions one pdcomm_tcp_poll() call performs; must be nonzero.
size_t poll_budgetreserved
Field
Reserved; must be 0.
uint16_t reservedsession_id
Field
HSMS session ID (device ID) for data messages.
uint16_t session_idOutgoing data messages carry it, and received data messages with a different value are reported as #PDCOMM_TCP_WRONG_SESSION. Control messages always use 0xFFFF.
shutdown_timeout_ms
Field
Graceful shutdown limit in milliseconds; must be nonzero.
uint64_t shutdown_timeout_msAfter pdcomm_tcp_stop(), the connection stays open for at most this long to write queued frames such as Separate.req, and is then closed.
struct_size
Field
Size of this structure in bytes; set to sizeof(PdcommTcpOptions) or larger.
size_t struct_sizet3_ms
Field
T3 reply timeout in milliseconds; must be nonzero.
uint64_t t3_msThe timer starts when a W-bit data request has been completely written to the socket. Expiry fails the request with #PDCOMM_TCP_T3_TIMEOUT.
t5_ms
Field
T5 connect separation timeout in milliseconds; must be nonzero.
uint64_t t5_msIn active mode, the delay between the end of a connection (or a failed attempt) and the next attempt, spent in #PDCOMM_TCP_RETRY_WAIT.
t6_ms
Field
T6 control transaction timeout in milliseconds; must be nonzero.
uint64_t t6_msLimits the wait for Select.rsp, Deselect.rsp, and Linktest.rsp after the request is written. Expiry fails the transaction with #PDCOMM_TCP_T6_TIMEOUT and closes the connection.
t7_ms
Field
T7 not-selected timeout in milliseconds; must be nonzero.
uint64_t t7_msA connection that stays NOT SELECTED for this long after it is established, or after a Deselect, is closed.
t8_ms
Field
T8 network intercharacter timeout in milliseconds; must be nonzero.
uint64_t t8_msThe connection is closed when a partially received frame makes no progress for this long.
version
Field
Options layout version; must be #PDCOMM_TCP_OPTIONS_VERSION.
uint32_t versionwrite_timeout_ms
Field
Write timeout in milliseconds; must be nonzero.
uint64_t write_timeout_msWhen the frame at the head of the write queue is not completely written within this time, the connection fails with a #PDCOMM_TCP_OP_WRITE transport error of kind #PDCOMM_TCP_IO_TIMED_OUT.