|
Open Model Railroad Network (OpenMRN)
|
Message segmenter that chops incoming byte stream into gridconnect packets. More...
Public Member Functions | |
| ssize_t | segment_message (const void *d, size_t size) override |
| Makes a segmenting decision given more input data. | |
| void | clear () override |
| Resets internal state machine. | |
Private Attributes | |
| uint32_t | isGcPacket_: 1 |
| True if the current packet is a gridconnect packet; false if it is garbage. | |
| uint32_t | packetLen_: 30 |
| How many bytes long this packet is. | |
Message segmenter that chops incoming byte stream into gridconnect packets.
Definition at line 38 of file DirectHubGc.cxx.
|
inline |
Definition at line 41 of file DirectHubGc.cxx.
|
inlineoverridevirtual |
Resets internal state machine.
The next call to segment_message() assumes no previous data present.
Implements MessageSegmenter.
Definition at line 107 of file DirectHubGc.cxx.
|
inlineoverridevirtual |
Makes a segmenting decision given more input data.
This function will be called by the input routine repeatedly with the additional payload (non-overlapping) until the function returns a non-zero response.
That response tells how many bytes long the last packet was, which must be <= the sum of the size arguments passed in. Thereafter the read flow will call clear() and call segment_message() again with the remaining partial buffer.
| data | beginning of the buffer pointing to the next unsegmented data array. |
| size | how many bytes of data are available at this address. Must be >0. |
Implements MessageSegmenter.
Definition at line 46 of file DirectHubGc.cxx.
|
private |
True if the current packet is a gridconnect packet; false if it is garbage.
Definition at line 116 of file DirectHubGc.cxx.
|
private |
How many bytes long this packet is.
Definition at line 119 of file DirectHubGc.cxx.