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" 14 #include <arpa/inet.h> 16 namespace hmbdc {
namespace app {
namespace tcpcast {
23 std::pair<char const*, char const*> topic()
const {
24 char const* b =
reinterpret_cast<const char*
>(
this)
26 return std::make_pair(b, b + topicLen);
29 void const* payload()
const {
30 return reinterpret_cast<const char*
>(
this)
35 return reinterpret_cast<char*
>(
this)
39 uint16_t typeTag()
const {
44 template <
typename Message>
50 template <
typename Message>
51 Message
const& wrapped()
const {
56 size_t wireSize()
const {
61 size_t wireSizeContainsTopic()
const {
64 } __attribute__((packed));
80 ,
"do you have a pack pragma unclosed that influencs the above struct packing unexpectedly?");
91 , std::string
const& ipIn
96 , loopback(loopbackIn) {
97 strncpy(ip, ipIn.c_str(),
sizeof(ip));
98 strncpy(topicRegex, topicRegexIn.c_str(),
sizeof(topicRegex));
99 topicRegex[
sizeof(topicRegex) - 1] = 0;
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:73
each message type has 16 bit tag
Definition: Message.hpp:60
Definition: Messages.hpp:66
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:82
this message appears in the receiver's buffer indicating a new source is connected ...
Definition: Messages.hpp:131