|
Open Model Railroad Network (OpenMRN)
|
Abstract base class for segmenting a byte stream typed input into meaningful packet sized chunks. More...
#include <DirectHub.hxx>
Public Member Functions | |
| virtual ssize_t | segment_message (const void *data, size_t size)=0 |
| Makes a segmenting decision given more input data. | |
| virtual void | clear ()=0 |
| Resets internal state machine. | |
Abstract base class for segmenting a byte stream typed input into meaningful packet sized chunks.
Implementations have to be stateful and are instantiated per specific input port. Implementations have to be thread-compatible.
Definition at line 126 of file DirectHub.hxx.
|
pure virtual |
Resets internal state machine.
The next call to segment_message() assumes no previous data present.
Implemented in DirectHubGcSegmenter, and DirectHubTrivialSegmenter.
|
pure virtual |
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. |
Implemented in DirectHubGcSegmenter, and DirectHubTrivialSegmenter.