39 #ifndef _uhal_ProtocolIPbus_hpp_
40 #define _uhal_ProtocolIPbus_hpp_
49 #include <boost/function.hpp>
50 #include <boost/thread/mutex.hpp>
58 namespace boost {
template <
class Y>
class shared_ptr; }
68 template< u
int8_t IPbus_major , u
int8_t IPbus_minor >
73 template< u
int8_t IPbus_minor >
83 IPbus (
const std::string& aId,
const URI& aUri );
93 virtual uint32_t getPreambleSize();
107 static uint32_t CalculateHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode = 0 );
117 static uint32_t ExpectedHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode = 0 );
128 static bool ExtractHeader (
const uint32_t& aHeader ,
IPbusTransactionType& aType , uint32_t& aWordCount , uint32_t& aTransactionId , uint8_t& aInfoCode );
141 uint32_t implementCalculateHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode );
152 bool implementExtractHeader (
const uint32_t& aHeader ,
IPbusTransactionType& aType , uint32_t& aWordCount , uint32_t& aTransactionId , uint8_t& aInfoCode );
171 virtual void dispatchExceptionHandler();
176 static void translateInfoCode(std::ostream& aStream,
const uint8_t& aErrorCode);
184 UHAL_DEFINE_DERIVED_EXCEPTION_CLASS ( IPbus2PacketHeaderMismatch, PacketLevelError,
"Exception class to handle the case where the IPbus 2.0 packet header does not match that sent." )
189 template< u
int8_t IPbus_minor >
199 IPbus (
const std::string& aId,
const URI& aUri );
209 virtual uint32_t getPreambleSize();
223 static uint32_t CalculateHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode = 0 );
233 static uint32_t ExpectedHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode = 0 );
244 static bool ExtractHeader (
const uint32_t& aHeader ,
IPbusTransactionType& aType , uint32_t& aWordCount , uint32_t& aTransactionId , uint8_t& aInfoCode );
258 uint8_t* aSendBufferEnd ,
259 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyStartIt ,
260 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyEndIt );
270 uint32_t implementCalculateHeader (
const IPbusTransactionType& aType ,
const uint32_t& aWordCount ,
const uint32_t& aTransactionId ,
const uint8_t& aInfoCode );
281 bool implementExtractHeader (
const uint32_t& aHeader ,
IPbusTransactionType& aType , uint32_t& aWordCount , uint32_t& aTransactionId , uint8_t& aInfoCode );
300 virtual void dispatchExceptionHandler();
305 static void translateInfoCode(std::ostream& aStream,
const uint8_t& aErrorCode);