summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.cpp')
-rw-r--r--buffer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/buffer.cpp b/buffer.cpp
index 11387da..f0d7940 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -180,17 +180,20 @@ Buffer::operator u_int8_t*() // just for write/read tun
return buf_;
}
-void Buffer::printHexDump() const
+std::string Buffer::getHexDump() const
{
char text[10];
+ std::string ret = "";
for( u_int32_t index = 0; index < length_; index++ )
{
std::sprintf(text, "%#4x", buf_[index]);
- std::cout << text << " ";
+ ret += text;
+ ret += "";
if( ((index+1) % 10) == 0 )
- std::cout << std::endl;
+ ret += '\n';
}
+ return ret;
}
Buffer Buffer::operator^(const Buffer &xor_by) const