Transport protocol to transfer an IPbus buffer via ControlHub. More...
#include <uhal/ProtocolControlHub.hpp>
Classes | |
| struct | tpreamble |
| A struct representing the preamble which will be prepended to an IPbus buffer for the benefit of the Control Hub. More... | |
Public Member Functions | |
| ControlHub (const std::string &aId, const URI &aUri) | |
| Constructor. More... | |
| virtual | ~ControlHub () |
| Destructor. More... | |
Protected Member Functions | |
| virtual void | preamble (std::shared_ptr< Buffers > aBuffers) |
| Add a preamble to an IPbus buffer. More... | |
| virtual uint32_t | getPreambleSize () |
| Get the size of the preamble added by this protocol layer. More... | |
| virtual void | predispatch (std::shared_ptr< Buffers > aBuffers) |
| Finalize an IPbus buffer before it is transmitted. More... | |
| virtual exception::exception * | validate (uint8_t *aSendBufferStart, uint8_t *aSendBufferEnd, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyStartIt, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyEndIt) |
| Function which the dispatch calls when the reply is received to check that the headers are as expected. More... | |
| virtual uint32_t | getMaxNumberOfBuffers () |
| Returns the maximum number of buffers that should be in-flight from the uHAL client at any given time. More... | |
| virtual void | dispatchExceptionHandler () |
| Function which tidies up this protocol layer in the event of an exception. More... | |
Static Private Member Functions | |
| static void | translateErrorCode (std::ostream &aStream, const uint16_t &aErrorCode) |
Private Attributes | |
| uint32_t | mDeviceIPaddress |
| The IP address of the target device that is connected to the Control Hub. More... | |
| uint16_t | mDevicePort |
| The port number of the target device that is connected to the Control Hub. More... | |
| std::deque< tpreamble > | mPreambles |
| A queue of preample structs making the memory used by the preambles persistent during the dispatch. Must lock mPreamblesMutex when accessing this deque. More... | |
| std::mutex | mPreamblesMutex |
| Mutex to be used when accessing mPreambles. More... | |
Transport protocol to transfer an IPbus buffer via ControlHub.
Definition at line 85 of file ProtocolControlHub.hpp.
| uhal::ControlHub< InnerProtocol >::ControlHub | ( | const std::string & | aId, |
| const URI & | aUri | ||
| ) |
Constructor.
| aId | the uinique identifier that the client will be given. |
| aUri | a struct containing the full URI of the target. |
Definition at line 147 of file ProtocolControlHub.cpp.
References uhal::ExtractTargetID(), uhal::ControlHub< InnerProtocol >::mDeviceIPaddress, and uhal::ControlHub< InnerProtocol >::mDevicePort.
|
virtual |
Destructor.
Definition at line 159 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Function which tidies up this protocol layer in the event of an exception.
Definition at line 289 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Returns the maximum number of buffers that should be in-flight from the uHAL client at any given time.
Definition at line 282 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Get the size of the preamble added by this protocol layer.
Definition at line 199 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Add a preamble to an IPbus buffer.
| aBuffers | a buffer to which to add the preamble |
Definition at line 165 of file ProtocolControlHub.cpp.
References uhal::ControlHub< InnerProtocol >::tpreamble::mReplyChunkByteCounter, uhal::ControlHub< InnerProtocol >::tpreamble::mReplyDeviceIPaddress, uhal::ControlHub< InnerProtocol >::tpreamble::mReplyDevicePort, uhal::ControlHub< InnerProtocol >::tpreamble::mReplyErrorCode, and uhal::ControlHub< InnerProtocol >::tpreamble::mSendWordCountPtr.
|
protectedvirtual |
Finalize an IPbus buffer before it is transmitted.
| aBuffers | a buffer on which to do the predispatch operation |
Definition at line 206 of file ProtocolControlHub.cpp.
References uhal::ControlHub< InnerProtocol >::tpreamble::mSendWordCountPtr.
|
staticprivate |
Definition at line 300 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Function which the dispatch calls when the reply is received to check that the headers are as expected.
| aSendBufferStart | a pointer to the start of the first word of IPbus data which was sent (i.e. with no preamble) |
| aSendBufferEnd | a pointer to the end of the last word of IPbus data which was sent |
| aReplyStartIt | an iterator to the start of the list of memory locations in to which the reply was written |
| aReplyEndIt | an iterator to the end (one past last valid entry) of the list of memory locations in to which the reply was written |
Definition at line 217 of file ProtocolControlHub.cpp.
References uhal::Integer(), uhal::log(), and uhal::Quote().
|
private |
The IP address of the target device that is connected to the Control Hub.
Definition at line 148 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::ControlHub().
|
private |
The port number of the target device that is connected to the Control Hub.
Definition at line 151 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::ControlHub().
|
private |
A queue of preample structs making the memory used by the preambles persistent during the dispatch. Must lock mPreamblesMutex when accessing this deque.
Definition at line 170 of file ProtocolControlHub.hpp.
|
private |
Mutex to be used when accessing mPreambles.
Definition at line 172 of file ProtocolControlHub.hpp.