The declaration of type ENIPMessage in file enipmessage.h contains PC_OPENER_ETHERNET_BUFFER_SIZE as buffer size for the message buffer inside of that struct:
typedef struct enip_message {
CipOctet message_buffer[PC_OPENER_ETHERNET_BUFFER_SIZE];
CipOctet *current_message_position;
size_t used_message_length;
} ENIPMessage;
It is part of libUtils and used by other parts of the stack. The file enipmessage.h is included by other headers and installed, so can be considered part of the public API of the stack. The value PC_OPENER_ETHERNET_BUFFER_SIZE however is not only referenced in that header but used in various places of the stack's code. It is passed as preprocessor option at build time of the stack and comes from the CMake files through an add_definition() statement which takes the CMake option OPENER_ETHERNET_BUFFER_SIZE as input.
This leads to the following situation: there is this build time option (OPENER_ETHERNET_BUFFER_SIZE) which results in hardcoded array sizes of the built stack. When later building against the stack as external library the same value is required as preprocessor definition but it's defined nowhere and you don't get it from public API headers. So it is essentially impossible to know its value at build time of an app. You need to guess.
An app using a different value for PC_OPENER_ETHERNET_BUFFER_SIZE as the stack used will probably crash?!
The declaration of type
ENIPMessagein file enipmessage.h containsPC_OPENER_ETHERNET_BUFFER_SIZEas buffer size for the message buffer inside of that struct:It is part of libUtils and used by other parts of the stack. The file enipmessage.h is included by other headers and installed, so can be considered part of the public API of the stack. The value PC_OPENER_ETHERNET_BUFFER_SIZE however is not only referenced in that header but used in various places of the stack's code. It is passed as preprocessor option at build time of the stack and comes from the CMake files through an
add_definition()statement which takes the CMake optionOPENER_ETHERNET_BUFFER_SIZEas input.This leads to the following situation: there is this build time option (OPENER_ETHERNET_BUFFER_SIZE) which results in hardcoded array sizes of the built stack. When later building against the stack as external library the same value is required as preprocessor definition but it's defined nowhere and you don't get it from public API headers. So it is essentially impossible to know its value at build time of an app. You need to guess.
An app using a different value for
PC_OPENER_ETHERNET_BUFFER_SIZEas the stack used will probably crash?!