aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edi/common.hpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-01-16 08:06:09 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-01-16 08:06:09 +0100
commitd14814a92377084177753c7a60d83a9307ad0672 (patch)
tree3b901eed7eaacc07341d16dbcd0db0d60951a5e0 /lib/edi/common.hpp
parent0efb3830dcd441ffdb53ebe69f2dc2886614fb8b (diff)
downloaddabmod-d14814a92377084177753c7a60d83a9307ad0672.tar.gz
dabmod-d14814a92377084177753c7a60d83a9307ad0672.tar.bz2
dabmod-d14814a92377084177753c7a60d83a9307ad0672.zip
Update common code to latest, update zmq.hpp and adapt
Diffstat (limited to 'lib/edi/common.hpp')
-rw-r--r--lib/edi/common.hpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/edi/common.hpp b/lib/edi/common.hpp
index c8c4bb3..14b91ba 100644
--- a/lib/edi/common.hpp
+++ b/lib/edi/common.hpp
@@ -60,6 +60,14 @@ using tag_name_t = std::array<uint8_t, 4>;
std::string tag_name_to_human_readable(const tag_name_t& name);
+struct Packet {
+ std::vector<uint8_t> buf;
+ int received_on_port;
+
+ Packet(std::vector<uint8_t>&& b) : buf(b), received_on_port(0) { }
+ Packet() {}
+};
+
/* The TagDispatcher takes care of decoding EDI, with or without PFT, and
* will call functions when TAGs are encountered.
*
@@ -72,17 +80,17 @@ class TagDispatcher {
void set_verbose(bool verbose);
-
/* Push bytes into the decoder. The buf can contain more
* than a single packet. This is useful when reading from streams
- * (files, TCP)
+ * (files, TCP). Pushing an empty buf will clear the internal decoder
+ * state to ensure realignment (e.g. on stream reconnection)
*/
void push_bytes(const std::vector<uint8_t> &buf);
/* Push a complete packet into the decoder. Useful for UDP and other
* datagram-oriented protocols.
*/
- void push_packet(const std::vector<uint8_t> &buf);
+ void push_packet(const Packet &packet);
/* Set the maximum delay in number of AF Packets before we
* abandon decoding a given pseq.
@@ -113,6 +121,8 @@ class TagDispatcher {
std::map<std::string, tag_handler> m_handlers;
std::function<void()> m_af_packet_completed;
tagpacket_handler m_tagpacket_handler;
+
+ std::vector<std::string> m_ignored_tags;
};
// Data carried inside the ODRv EDI TAG