2 #include "hmbdc/Copyright.hpp" 5 #include "hmbdc/app/Message.hpp" 6 #include "hmbdc/Config.hpp" 7 #include "hmbdc/Compile.hpp" 16 namespace hmbdc {
namespace tips {
namespace rnetmap {
20 static size_t maxPayloadSize() {
27 copyTo(
void* addrIn, M&& m) {
28 using Message =
typename std::decay<M>::type;
29 auto addr = (
char*)addrIn;
38 copyTo(
void* addrIn, uint16_t tag,
void const* bytes,
size_t len) {
39 auto addr = (
char*)addrIn;
42 h->messagePayloadLen =
47 template <
typename Message,
typename ... Args>
49 copyToInPlace(
void* addrIn, Args&&... args) {
50 char* addr = (
char*)addrIn;
57 void const* payload()
const {
58 return reinterpret_cast<const char*
>(
this)
63 return reinterpret_cast<char*
>(
this)
67 uint16_t typeTag()
const {
72 template <
typename Message>
78 template <
typename Message>
79 Message
const& wrapped()
const {
84 size_t wireSize()
const {
88 void const* wireBytes()
const {
89 return reinterpret_cast<const char*
>(
this);
93 return reinterpret_cast<char*
>(
this);
96 void const* wireBytesMemorySeg()
const {
97 return wrapped<app::MemorySeg>().seg;
100 size_t wireSizeMemorySeg()
const {
101 return wrapped<app::MemorySeg>().len;
104 HMBDC_SEQ_TYPE getSeq()
const {
105 auto res = (HMBDC_SEQ_TYPE)static_cast<app::MessageHead const*>(payload())->scratchpad().seq;
106 if (hmbdc_unlikely(res == 0xfffffffffffful))
return std::numeric_limits<HMBDC_SEQ_TYPE>::max();
110 void setSeq(HMBDC_SEQ_TYPE seq) {
114 } __attribute__((packed));
123 , recvReportDelay(recvReportDelayIn)
124 , loopback(loopbackIn) {
126 snprintf(ip,
sizeof(ip),
"%s", ipIn.c_str());
131 bool addTypeTag(uint16_t tag) {
132 auto c = uint16_t{typeTagCountContained};
135 typeTagCountContained = c;
149 os <<
"TypeTagBackupSource:" << m.ip <<
':' << m.port;
150 for (
auto i = 0u; i < m.typeTagCountContained; i++) {
151 os <<
' ' << m.typeTags[i];
166 std::ostream& operator << (std::ostream& os,
SessionStarted const & m) {
167 return os <<
"Session to type tag source started " << m.ip;
180 std::ostream& operator << (std::ostream& os,
SessionDropped const & m) {
181 return os <<
"Session to tag tag source dropped " << m.ip;
187 HMBDC_SEQ_TYPE expectSeq;
189 std::ostream& operator << (std::ostream& os,
SeqAlert const & m) {
190 return os <<
"SeqAlert " << m.expectSeq;
194 static_assert(
sizeof(
SeqAlert) ==
sizeof(HMBDC_SEQ_TYPE)
195 ,
"do you have a pack pragma unclosed that influencs the above struct packing unexpectedly?");
Definition: Messages.hpp:185
this message appears in the receiver's buffer indicating a previously connected source is dropped ...
Definition: Messages.hpp:176
each message type has 16 bit tag
Definition: Message.hpp:62
Definition: Message.hpp:212
Definition: Messages.hpp:116
this message appears in the receiver's buffer indicating a new source is connected ...
Definition: Messages.hpp:162
Definition: Message.hpp:263