Module buffer

Module buffer 

Source
Expand description

Buffer management for FIX message creation and manipulation.

This module provides high-performance buffer initialization and management specifically designed for FIX protocol message generation. The core concept is pre-initializing buffers with the fixed header structure that appears in every FIX message.

Constants§

BODY_LENGTH_VALUE_POS
Position where BodyLength value starts (the “0000” part). For all FIX 4.x versions: “8=FIX.4.x\x01” (10 bytes) + “9=” (2 bytes) = position 12
FORGE_BUFFER_SIZE
Default buffer size for FIX message writing operations. 1024 bytes should accommodate most FIX messages in practice.
FORGE_HEADER_LEN
Length of the complete pre-initialized header for FIX 4.x versions. Layout: “8=FIX.4.4\x019=0000\x0135=” (20 bytes) Layout: “8=FIX.4.2\x019=0000\x0135=” (20 bytes) All FIX 4.x versions have the same header length.
FORGE_WRITE_START
Starting position for writing MsgType value after the pre-initialized header. This is where MsgType value writing should begin for all FIX 4.x versions.

Functions§

forge_out_buffer
Create a pre-initialized buffer for FIX message writing with specified version.
forge_write_start
Get the starting position for writing MsgType value for FIX 4.x versions. All FIX 4.x versions have the same header length, so this returns the constant.
update_body_length
Update the BodyLength field in a forge buffer with the actual message length.