|
|
@ -59,11 +59,15 @@ enum WhisperPacket |
|
|
|
PacketCount |
|
|
|
}; |
|
|
|
|
|
|
|
using TopicPart = FixedHash<4>; |
|
|
|
using CollapsedTopicPart = FixedHash<4>; |
|
|
|
using FullTopicPart = h256; |
|
|
|
|
|
|
|
using Topic = std::vector<TopicPart>; |
|
|
|
using CollapsedTopic = std::vector<CollapsedTopicPart>; |
|
|
|
using FullTopic = h256s; |
|
|
|
|
|
|
|
CollapsedTopicPart collapse(FullTopicPart const& _fullTopicPart); |
|
|
|
CollapsedTopic collapse(FullTopic const& _fullTopic); |
|
|
|
|
|
|
|
class BuildTopic |
|
|
|
{ |
|
|
|
public: |
|
|
@ -75,9 +79,9 @@ public: |
|
|
|
|
|
|
|
BuildTopic& shiftRaw(h256 const& _part) { m_parts.push_back(_part); return *this; } |
|
|
|
|
|
|
|
operator Topic() const { return toTopic(); } |
|
|
|
operator CollapsedTopic() const { return toTopic(); } |
|
|
|
operator FullTopic() const { return toFullTopic(); } |
|
|
|
Topic toTopic() const; |
|
|
|
CollapsedTopic toTopic() const; |
|
|
|
FullTopic toFullTopic() const { return m_parts; } |
|
|
|
|
|
|
|
protected: |
|
|
@ -86,14 +90,14 @@ protected: |
|
|
|
h256s m_parts; |
|
|
|
}; |
|
|
|
|
|
|
|
using TopicMask = std::vector<std::pair<TopicPart, TopicPart>>; |
|
|
|
using TopicMask = std::vector<std::pair<CollapsedTopicPart, CollapsedTopicPart>>; |
|
|
|
using TopicMasks = std::vector<TopicMask>; |
|
|
|
|
|
|
|
class TopicFilter |
|
|
|
{ |
|
|
|
public: |
|
|
|
TopicFilter() {} |
|
|
|
TopicFilter(FullTopic const& _m) { m_topicMasks.push_back(TopicMask()); for (auto const& h: _m) m_topicMasks.back().push_back(std::make_pair(TopicPart(h), h ? ~TopicPart() : TopicPart())); } |
|
|
|
TopicFilter(FullTopic const& _m) { m_topicMasks.push_back(TopicMask()); for (auto const& h: _m) m_topicMasks.back().push_back(std::make_pair(collapse(h), h ? ~CollapsedTopicPart() : CollapsedTopicPart())); } |
|
|
|
TopicFilter(TopicMask const& _m): m_topicMasks(1, _m) {} |
|
|
|
TopicFilter(TopicMasks const& _m): m_topicMasks(_m) {} |
|
|
|
TopicFilter(RLP const& _r)//: m_topicMasks(_r.toVector<std::vector<>>())
|
|
|
|