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 (boost::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 (boost::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... | |
| boost::mutex | mPreamblesMutex |
| Mutex to be used when accessing mPreambles. More... | |
Transport protocol to transfer an IPbus buffer via ControlHub.
Definition at line 86 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 146 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 290 of file ProtocolControlHub.cpp.
References uhal::Info, uhal::ControlHub< InnerProtocol >::mPreambles, uhal::ControlHub< InnerProtocol >::mPreamblesMutex, and ThisLocation.
|
inlineprotectedvirtual |
Returns the maximum number of buffers that should be in-flight from the uHAL client at any given time.
Definition at line 143 of file ProtocolControlHub.hpp.
|
protectedvirtual |
Get the size of the preamble added by this protocol layer.
Definition at line 201 of file ProtocolControlHub.cpp.
|
protectedvirtual |
Add a preamble to an IPbus buffer.
| aBuffers | a buffer to which to add the preamble |
Definition at line 166 of file ProtocolControlHub.cpp.
References uhal::ControlHub< InnerProtocol >::mDeviceIPaddress, uhal::ControlHub< InnerProtocol >::mDevicePort, uhal::ControlHub< InnerProtocol >::mPreambles, uhal::ControlHub< InnerProtocol >::mPreamblesMutex, 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 208 of file ProtocolControlHub.cpp.
References uhal::ControlHub< InnerProtocol >::mPreambles, uhal::ControlHub< InnerProtocol >::mPreamblesMutex, and uhal::ControlHub< InnerProtocol >::tpreamble::mSendWordCountPtr.
|
staticprivate |
Definition at line 302 of file ProtocolControlHub.cpp.
Referenced by uhal::ControlHub< InnerProtocol >::validate().
|
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 221 of file ProtocolControlHub.cpp.
References uhal::Integer(), uhal::ControlHub< InnerProtocol >::mDeviceIPaddress, uhal::ControlHub< InnerProtocol >::mDevicePort, uhal::ControlHub< InnerProtocol >::mPreambles, uhal::ControlHub< InnerProtocol >::mPreamblesMutex, uhal::Quote(), uhal::ControlHub< InnerProtocol >::translateErrorCode(), and uhal::tests::uri.
|
private |
The IP address of the target device that is connected to the Control Hub.
Definition at line 158 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::ControlHub(), uhal::ControlHub< InnerProtocol >::preamble(), and uhal::ControlHub< InnerProtocol >::validate().
|
private |
The port number of the target device that is connected to the Control Hub.
Definition at line 161 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::ControlHub(), uhal::ControlHub< InnerProtocol >::preamble(), and uhal::ControlHub< InnerProtocol >::validate().
|
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 184 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::dispatchExceptionHandler(), uhal::ControlHub< InnerProtocol >::preamble(), uhal::ControlHub< InnerProtocol >::predispatch(), and uhal::ControlHub< InnerProtocol >::validate().
|
private |
Mutex to be used when accessing mPreambles.
Definition at line 186 of file ProtocolControlHub.hpp.
Referenced by uhal::ControlHub< InnerProtocol >::dispatchExceptionHandler(), uhal::ControlHub< InnerProtocol >::preamble(), uhal::ControlHub< InnerProtocol >::predispatch(), and uhal::ControlHub< InnerProtocol >::validate().
1.8.13