E2SAR 0.2.0
Loading...
Searching...
No Matches
e2sar::Segmenter Class Reference

Data Structures

struct  ReportedStats
 
struct  SegmenterFlags
 

Public Member Functions

 Segmenter (const EjfatURI &uri, u_int16_t dataId, u_int32_t eventSrcId, std::vector< int > cpuCoreList, const SegmenterFlags &sflags=SegmenterFlags())
 
 Segmenter (const EjfatURI &uri, u_int16_t dataId, u_int32_t eventSrcId, const SegmenterFlags &sflags=SegmenterFlags())
 
 Segmenter (const Segmenter &s)=delete
 
Segmenteroperator= (const Segmenter &o)=delete
 
 ~Segmenter ()
 
result< int > openAndStart () noexcept
 
result< int > sendEvent (u_int8_t *event, size_t bytes, EventNum_t _eventNumber=0LL, u_int16_t _dataId=0, u_int16_t _entropy=0) noexcept
 
result< int > addToSendQueue (u_int8_t *event, size_t bytes, EventNum_t _eventNum=0LL, u_int16_t _dataId=0, u_int16_t entropy=0, void(*callback)(boost::any)=nullptr, boost::any cbArg=nullptr) noexcept
 
const ReportedStats getSyncStats () const noexcept
 
const ReportedStats getSendStats () const noexcept
 
const std::string getIntf () const noexcept
 
const u_int16_t getMTU () const noexcept
 
const size_t getMaxPldLen () const noexcept
 
void stopThreads ()
 

Friends

class Reassembler
 
struct SyncThreadState
 
struct SendThreadState
 

Constructor & Destructor Documentation

◆ Segmenter() [1/3]

e2sar::Segmenter::Segmenter ( const EjfatURI & uri,
u_int16_t dataId,
u_int32_t eventSrcId,
std::vector< int > cpuCoreList,
const SegmenterFlags & sflags = SegmenterFlags() )

Initialize segmenter state. Call openAndStart() to begin operation.

Parameters
uri- EjfatURI initialized for sender with sync address and data address(es)
dataId- unique identifier of the originating segmentation point (e.g. a DAQ), carried in SAR header
eventSrcId- unique identifier of an individual LB packet transmitting host/daq, 32-bit to accommodate IP addresses more easily, carried in Sync header
cpuCoreList- list of cores that can be used by sending threads
sflags- SegmenterFlags

◆ Segmenter() [2/3]

e2sar::Segmenter::Segmenter ( const EjfatURI & uri,
u_int16_t dataId,
u_int32_t eventSrcId,
const SegmenterFlags & sflags = SegmenterFlags() )

Initialize segmenter state. Call openAndStart() to begin operation.

Parameters
uri- EjfatURI initialized for sender with sync address and data address(es)
dataId- unique identifier of the originating segmentation point (e.g. a DAQ), carried in SAR header
eventSrcId- unique identifier of an individual LB packet transmitting host/daq, 32-bit to accommodate IP addresses more easily, carried in Sync header
sflags- SegmenterFlags

◆ Segmenter() [3/3]

e2sar::Segmenter::Segmenter ( const Segmenter & s)
delete

Don't want to be able to copy these objects normally

◆ ~Segmenter()

e2sar::Segmenter::~Segmenter ( )
inline

Close the sockets, free/purge memory pools and stop the threads.

Member Function Documentation

◆ addToSendQueue()

result< int > e2sar::Segmenter::addToSendQueue ( u_int8_t * event,
size_t bytes,
EventNum_t _eventNum = 0LL,
u_int16_t _dataId = 0,
u_int16_t entropy = 0,
void(* callback )(boost::any) = nullptr,
boost::any cbArg = nullptr )
noexcept

Add to send queue in a nonblocking fashion, overriding internal event number

Parameters
event- event buffer
bytes- bytes length of the buffer
eventNum- optionally override the internal event number
dataId- optionally override the dataId
entropy- optional event entropy value (random will be generated otherwise)
callback- optional callback function to call after event is sent
cbArg- optional parameter for callback
Returns
- 0 on success, otherwise error condition

◆ getIntf()

const std::string e2sar::Segmenter::getIntf ( ) const
inlinenoexcept

Get the outgoing interface (if available)

◆ getMaxPldLen()

const size_t e2sar::Segmenter::getMaxPldLen ( ) const
inlinenoexcept

get the maximum payload length used by the segmenter

◆ getMTU()

const u_int16_t e2sar::Segmenter::getMTU ( ) const
inlinenoexcept

Get the MTU currently in use by segmenter

◆ getSendStats()

const ReportedStats e2sar::Segmenter::getSendStats ( ) const
inlinenoexcept

Get a ReportedStats structure of send statistics.

◆ getSyncStats()

const ReportedStats e2sar::Segmenter::getSyncStats ( ) const
inlinenoexcept

Get a ReportedStats structure of sync statistics.

◆ openAndStart()

result< int > e2sar::Segmenter::openAndStart ( )
noexcept

Open sockets and start the threads - this marks the moment from which sync packets start being sent.

Returns
- 0 on success, otherwise error condition

◆ operator=()

Segmenter & e2sar::Segmenter::operator= ( const Segmenter & o)
delete

Don't want to be able to copy these objects normally

◆ sendEvent()

result< int > e2sar::Segmenter::sendEvent ( u_int8_t * event,
size_t bytes,
EventNum_t _eventNumber = 0LL,
u_int16_t _dataId = 0,
u_int16_t _entropy = 0 )
noexcept

Send immediately overriding event number.

Parameters
event- event buffer
bytes- bytes length of the buffer
eventNumber- optionally override the internal event number
dataId- optionally override the dataId
entropy- optional event entropy value (random will be generated otherwise)
Returns
- 0 on success, otherwise error condition

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