1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/comm/Topic.hpp" 5 #include "hmbdc/comm/inet/Endpoint.hpp" 6 #include "hmbdc/time/Time.hpp" 7 #include "hmbdc/app/Message.hpp" 8 #include "hmbdc/Endian.hpp" 15 #include <arpa/inet.h> 17 namespace hmbdc {
namespace app {
namespace tcpcast {
24 std::pair<char const*, char const*> topic()
const {
25 char const* b =
reinterpret_cast<const char*
>(
this)
27 return std::make_pair(b, b + topicLen);
30 void const* payload()
const {
31 return reinterpret_cast<const char*
>(
this)
36 return reinterpret_cast<char*
>(
this)
40 uint16_t typeTag()
const {
45 template <
typename Message>
51 template <
typename Message>
52 Message
const& wrapped()
const {
57 size_t wireSize()
const {
62 size_t wireSizeContainsTopic()
const {
65 } __attribute__((packed));
81 ,
"do you have a pack pragma unclosed that influencs the above struct packing unexpectedly?");
92 , std::string
const& ipIn
97 , loopback(loopbackIn) {
98 strncpy(ip, ipIn.c_str(),
sizeof(ip));
99 snprintf(topicRegex,
sizeof(topicRegex),
"%s", topicRegexIn.c_str());
102 char topicRegex[128];
109 std::ostream& operator << (std::ostream& os,
TopicSource const& m) {
110 return os << m.ip <<
' ' 116 std::istream& operator >> (std::istream& is,
TopicSource& m) {
124 } __attribute__((packed));
135 std::ostream& operator << (std::ostream& os,
SessionStarted const & m) {
136 return os <<
"Session to topic source started " << m.ip;
149 std::ostream& operator << (std::ostream& os,
SessionDropped const & m) {
150 return os <<
"Session to topic source dropped " << m.ip;
164 sockaddr_in sinkAddr;
165 } __attribute__((aligned (8)));
topic as in the publish / subscribe communication paradigm
Definition: Topic.hpp:14
Definition: Endpoint.hpp:16
Definition: Messages.hpp:74
each message type has 16 bit tag
Definition: Message.hpp:60
Definition: Messages.hpp:67
this message appears in the receiver's buffer indicating a previously connected source is dropped ...
Definition: Messages.hpp:145
Definition: Message.hpp:78
Definition: Messages.hpp:154
Definition: Message.hpp:112
Definition: Messages.hpp:83
this message appears in the receiver's buffer indicating a new source is connected ...
Definition: Messages.hpp:131