1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/time/Time.hpp" 5 #include "hmbdc/app/Message.hpp" 6 #include "hmbdc/Config.hpp" 7 #include "hmbdc/Compile.hpp" 13 #include <netinet/in.h> 18 namespace hmbdc {
namespace tips {
namespace rmcast {
23 static size_t maxPayloadSize() {
27 void const* payload()
const {
28 return reinterpret_cast<const char*
>(
this)
33 return reinterpret_cast<char*
>(
this)
45 uint16_t typeTag()
const {
50 template <
typename Message>
56 template <
typename Message>
57 Message
const& wrapped()
const {
62 size_t wireSize()
const {
66 void const* wireBytes()
const {
67 return reinterpret_cast<const char*
>(
this);
70 void const* wireBytesMemorySeg()
const {
71 return wrapped<app::MemorySeg>().seg;
74 size_t wireSizeMemorySeg()
const {
75 return wrapped<app::MemorySeg>().len;
78 HMBDC_SEQ_TYPE getSeq()
const {
79 auto res = (HMBDC_SEQ_TYPE)static_cast<app::MessageHead const*>(payload())->scratchpad().seq;
80 if (hmbdc_unlikely(res == 0xfffffffffffful))
return std::numeric_limits<HMBDC_SEQ_TYPE>::max();
84 void setSeq(HMBDC_SEQ_TYPE seq) {
88 } __attribute__((packed));
98 , recvReportDelay(recvReportDelayIn)
99 , timestamp(time::SysTime::now())
100 , loopback(loopbackIn) {
101 snprintf(ip,
sizeof(ip),
"%s", ipIn.c_str());
108 bool addTypeTag(uint16_t tag) {
109 auto c = uint16_t{typeTagCountContained};
112 typeTagCountContained = c;
121 sockaddr_in sendFrom;
127 os <<
"TypeTagBackupSource:" << m.ip <<
':' << m.port;
128 for (
auto i = 0u; i < m.typeTagCountContained; i++) {
129 os <<
' ' << m.typeTags[i];
144 std::ostream& operator << (std::ostream& os,
SessionStarted const & m) {
145 return os <<
"Session to topic source started " << m.ip;
158 std::ostream& operator << (std::ostream& os,
SessionDropped const & m) {
159 return os <<
"Session to topic source dropped " << m.ip;
165 HMBDC_SEQ_TYPE expectSeq;
167 std::ostream& operator << (std::ostream& os,
SeqAlert const & m) {
168 return os <<
"SeqAlert " << m.expectSeq;
172 static_assert(
sizeof(
SeqAlert) ==
sizeof(HMBDC_SEQ_TYPE)
173 ,
"do you have a pack pragma unclosed that influencs the above struct packing unexpectedly?");
Definition: Messages.hpp:90
each message type has 16 bit tag
Definition: Message.hpp:62
this message appears in the receiver's buffer indicating a new source is connected ...
Definition: Messages.hpp:140
Definition: Message.hpp:212
Definition: Messages.hpp:163
Definition: Message.hpp:263
this message appears in the receiver's buffer indicating a previously connected source is dropped ...
Definition: Messages.hpp:154