DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
s7comm.h File Reference

Siemens S7comm PDU codec (DETWS_ENABLE_S7COMM) - zero-heap builder + parser for the S7-300/400 communication PDUs, carried inside a COTP Data TPDU (services/cotp) over ISO-on-TCP (port 102). More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Siemens S7comm PDU codec (DETWS_ENABLE_S7COMM) - zero-heap builder + parser for the S7-300/400 communication PDUs, carried inside a COTP Data TPDU (services/cotp) over ISO-on-TCP (port 102).

An S7comm PDU starts with a header then a parameter section then an optional data section:

0x32 ROSCTR redundancy(2) pdu-ref(2) param-len(2) data-len(2) [err-class err-code]
<parameter ...> <data ...>

The header is 10 octets, or 12 for an Ack_Data response (which adds a 2-octet error code). A Read Var job (function 0x04) carries one or more S7-ANY request items (area / DB / byte address / element count); the Ack_Data response carries, per item, a return code + a data transport size + a length + the value bytes. Per the protocol, the response length is in BITS for the bit/byte/int transport sizes (3/4/5) and in BYTES otherwise, and each item is padded to an even length except the last.

Constants and the length rule are verified against the Wireshark S7comm dissector. This codec produces / consumes the S7 PDU; wrap it with cotp_build_dt + tpkt_build.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file s7comm.h.