Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
DirectHubTrivialSegmenter Class Reference

Message segmenter that keeps each packet as-is. More...

Inheritance diagram for DirectHubTrivialSegmenter:
MessageSegmenter Destructable

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.
 

Public Attributes

size_t total_ {0}
 

Detailed Description

Message segmenter that keeps each packet as-is.

Definition at line 128 of file DirectHubGc.cxx.

Member Function Documentation

◆ clear()

void DirectHubTrivialSegmenter::clear ( )
inlineoverridevirtual

Resets internal state machine.

The next call to segment_message() assumes no previous data present.

Implements MessageSegmenter.

Definition at line 138 of file DirectHubGc.cxx.

◆ segment_message()

ssize_t DirectHubTrivialSegmenter::segment_message ( const void *  data,
size_t  size 
)
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.

Parameters
databeginning of the buffer pointing to the next unsegmented data array.
sizehow many bytes of data are available at this address. Must be >0.
Returns
0 if no complete packet was yet seen; positive value N if the packet that starts in the first segment_message call is N bytes long. Negative return are reserved (shall not be returned at this point).

Implements MessageSegmenter.

Definition at line 131 of file DirectHubGc.cxx.

Member Data Documentation

◆ total_

size_t DirectHubTrivialSegmenter::total_ {0}

Definition at line 142 of file DirectHubGc.cxx.


The documentation for this class was generated from the following file: