2018-01-02 18:12:05 +01:00
|
|
|
// Copyright (c) 2015-2017 The Bitcoin Core developers
|
2014-11-18 18:06:32 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_H
|
|
|
|
#define BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_H
|
|
|
|
|
2017-11-10 01:57:53 +01:00
|
|
|
#include <zmq/zmqabstractnotifier.h>
|
2014-11-18 18:06:32 +01:00
|
|
|
|
2015-09-16 16:42:23 +02:00
|
|
|
class CBlockIndex;
|
|
|
|
|
2014-11-18 18:06:32 +01:00
|
|
|
class CZMQAbstractPublishNotifier : public CZMQAbstractNotifier
|
|
|
|
{
|
2016-03-29 14:30:02 +02:00
|
|
|
private:
|
2016-06-29 11:48:51 +02:00
|
|
|
uint32_t nSequence; //!< upcounting per message sequence number
|
2016-03-29 14:30:02 +02:00
|
|
|
|
2014-11-18 18:06:32 +01:00
|
|
|
public:
|
2016-03-29 14:30:02 +02:00
|
|
|
|
|
|
|
/* send zmq multipart message
|
|
|
|
parts:
|
|
|
|
* command
|
|
|
|
* data
|
|
|
|
* message sequence number
|
|
|
|
*/
|
|
|
|
bool SendMessage(const char *command, const void* data, size_t size);
|
|
|
|
|
2017-06-20 21:58:56 +02:00
|
|
|
bool Initialize(void *pcontext) override;
|
|
|
|
void Shutdown() override;
|
2014-11-18 18:06:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CZMQPublishHashBlockNotifier : public CZMQAbstractPublishNotifier
|
|
|
|
{
|
|
|
|
public:
|
2017-06-20 21:58:56 +02:00
|
|
|
bool NotifyBlock(const CBlockIndex *pindex) override;
|
2014-11-18 18:06:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CZMQPublishHashTransactionNotifier : public CZMQAbstractPublishNotifier
|
|
|
|
{
|
|
|
|
public:
|
2017-06-20 21:58:56 +02:00
|
|
|
bool NotifyTransaction(const CTransaction &transaction) override;
|
2014-11-18 18:06:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CZMQPublishRawBlockNotifier : public CZMQAbstractPublishNotifier
|
|
|
|
{
|
|
|
|
public:
|
2017-06-20 21:58:56 +02:00
|
|
|
bool NotifyBlock(const CBlockIndex *pindex) override;
|
2014-11-18 18:06:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CZMQPublishRawTransactionNotifier : public CZMQAbstractPublishNotifier
|
|
|
|
{
|
|
|
|
public:
|
2017-06-20 21:58:56 +02:00
|
|
|
bool NotifyTransaction(const CTransaction &transaction) override;
|
2014-11-18 18:06:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_H
|