2014-01-04 19:45:04 +08:00
|
|
|
/**
|
|
|
|
|
* Class describing an AMQP Heartbeat Frame
|
|
|
|
|
*
|
|
|
|
|
* @copyright 2014 Copernica BV
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set up namespace
|
|
|
|
|
*/
|
|
|
|
|
namespace AMQP {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class implementation
|
|
|
|
|
*/
|
|
|
|
|
class HeartbeatFrame : public ExtFrame
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Construct a heartbeat frame
|
|
|
|
|
*
|
|
|
|
|
* @param channel channel identifier
|
|
|
|
|
* @param payload payload of the body
|
|
|
|
|
*/
|
|
|
|
|
HeartbeatFrame() :
|
|
|
|
|
ExtFrame(0, 0)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Decode a received frame to a frame
|
|
|
|
|
*
|
|
|
|
|
* @param frame received frame to decode
|
|
|
|
|
* @return shared pointer to newly created frame
|
|
|
|
|
*/
|
|
|
|
|
HeartbeatFrame(ReceivedFrame& frame) :
|
|
|
|
|
ExtFrame(frame)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor
|
|
|
|
|
*/
|
|
|
|
|
virtual ~HeartbeatFrame() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the type of frame
|
|
|
|
|
* @return uint8_t
|
|
|
|
|
*/
|
2015-11-28 18:38:15 +08:00
|
|
|
virtual uint8_t type() const override
|
2014-01-04 19:45:04 +08:00
|
|
|
{
|
|
|
|
|
// the documentation says 4, rabbitMQ sends 8
|
|
|
|
|
return 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Process the frame
|
|
|
|
|
* @param connection The connection over which it was received
|
|
|
|
|
* @return bool Was it succesfully processed?
|
|
|
|
|
*/
|
2014-01-06 01:50:41 +08:00
|
|
|
virtual bool process(ConnectionImpl *connection) override
|
|
|
|
|
{
|
|
|
|
|
// send back the same frame
|
|
|
|
|
connection->send(*this);
|
2014-01-04 19:45:04 +08:00
|
|
|
|
2014-01-06 01:50:41 +08:00
|
|
|
// done
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2014-01-04 19:45:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* end namespace
|
|
|
|
|
*/
|
|
|
|
|
}
|