summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-12-11 13:53:03 +0000
committerErwin Nindl <nine@wirdorange.org>2007-12-11 13:53:03 +0000
commitb49e5993550f6c762b03a8de70ff7bf70a3ad011 (patch)
tree51d5d3d4802dc47c9b82ff1a2577a2042947e3c3 /buffer.cpp
parentdebuging sync buffer (diff)
added pretty buffer print
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