|
ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
|
MoldUDP64 packet parser and message iterator. More...
MoldUDP64 packet parser and message iterator.
Provides safe iteration over messages contained within a MoldUDP64 packet. The class validates packet boundaries and message lengths to prevent buffer overruns when parsing potentially malformed packets.
Each MoldUDP64 packet consists of:
Usage pattern:
#include <nasdaq/moldudp64/Packet.h>
Public Member Functions | |
| UDPPacket (const PacketHeader *header, std::size_t size) | |
| Construct a packet parser. | |
| const PacketHeader * | get_header () const |
| Get the packet header. | |
| UInt16 | get_count () const |
| Get the message count in this packet. | |
| UInt64 | get_sn () const |
| Get the first message sequence number. | |
| StringRef | get_session () const |
| Get the session identifier. | |
| const MessageBlock * | next () |
| Get the next message in the packet. | |
|
inline |
Construct a packet parser.
Initializes the packet parser with a pointer to the packet header and the total size of the received datagram. The constructor sets up internal pointers for safe message iteration.
| header | Pointer to the PacketHeader at the start of the packet |
| size | Total size of the UDP datagram in bytes |
|
inline |
Get the message count in this packet.
Returns the number of messages contained in this packet, or EOS_COUNT (0xFFFF) if this is an end-of-session packet.
References b2bits::nasdaq::moldudp64::PacketHeader::get_count(), and get_header().
Referenced by next().
|
inline |
Get the packet header.
Referenced by get_count(), get_session(), and get_sn().
|
inline |
Get the session identifier.
Returns the session name for this packet, which identifies which MoldUDP64 stream this packet belongs to.
References get_header(), and b2bits::nasdaq::moldudp64::PacketHeader::get_session().
|
inline |
Get the first message sequence number.
Returns the sequence number of the first message in this packet. Subsequent messages have sequential sequence numbers (sn+1, sn+2, ...).
References get_header(), and b2bits::nasdaq::moldudp64::PacketHeader::get_sequence_number().
|
inline |
Get the next message in the packet.
Advances the internal iterator to the next message and returns a pointer to its MessageBlock header. The actual message payload (e.g., ITCH data) follows the MessageBlock header.
This method performs bounds checking and will throw if a message length would exceed the packet boundary, indicating a malformed packet.
| std::runtime_error | if message length exceeds packet boundary |
References get_count(), and next().
Referenced by next().