From: Christian Herdtweck Date: Wed, 18 Mar 2015 14:57:22 +0000 (+0100) Subject: added option to print raw message data in text form for debugging X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=df7d5b24c3f9cfe1bf39f64dd6f2d2110bd15904;p=pingcheck added option to print raw message data in text form for debugging --- diff --git a/src/host/messagepayload.cpp b/src/host/messagepayload.cpp index 4e931ce..a1be197 100644 --- a/src/host/messagepayload.cpp +++ b/src/host/messagepayload.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -476,3 +477,11 @@ uint32_t MessagePayload::calc_checksum_part() const return sum; } + +void MessagePayload::debug_dump(std::ostream &os) const +{ + std::vector::const_iterator iter = Payload.begin(); + std::vector::const_iterator end = Payload.end(); + while ( iter != end ) + os << setw(5) << static_cast(*iter++); +} diff --git a/src/host/messagepayload.h b/src/host/messagepayload.h index 74fb41c..c1eb8a1 100644 --- a/src/host/messagepayload.h +++ b/src/host/messagepayload.h @@ -80,6 +80,8 @@ public: uint32_t calc_checksum_part() const; + void debug_dump(std::ostream &os) const; + private: /// The size of the payload buffer std::size_t PayloadSizeInBytes;