summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-09-12 11:21:31 +0000
committerErwin Nindl <nine@wirdorange.org>2007-09-12 11:21:31 +0000
commit8dcc3682dab0d4ed77700f4d30cecc31898adeb8 (patch)
tree9c61363f6a4aec5235cfc1798628effc14181dbe /buffer.cpp
parentseqwindow with 0 windows-size deactivates replay protection (diff)
overloaded std::ostream& operator<< for Buffer
Diffstat (limited to 'buffer.cpp')
-rw-r--r--buffer.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/buffer.cpp b/buffer.cpp
index 1b194bd..808f639 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -30,6 +30,8 @@
#include <stdexcept>
#include <string>
+#include <iostream>
+#include <cstdio>
#include "datatypes.h"
#include "buffer.h"
@@ -163,3 +165,15 @@ Buffer::operator u_int8_t*() // just for write/read tun
return buf_;
}
+std::ostream& operator<<(std::ostream& output, const Buffer &src)
+{
+ char buf[10];
+
+ for( u_int32_t index = 0; index < src.getLength(); index++ )
+ {
+ std::sprintf(buf, "%#x", src[index]);
+ output << buf << " ";
+ }
+
+ return output;
+}