summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-12-08 17:57:31 +0000
committerErwin Nindl <nine@wirdorange.org>2007-12-08 17:57:31 +0000
commit62d31032352f8d857f31d89872fd42b98501e1c3 (patch)
tree8caaa3f1ff16281e45ff0d3c9357708b5efbe74c /buffer.cpp
parentremoved doxygen folders from svn (diff)
* added AuthTag class
* bugfixes in keyderivation, aesicmcypher * removed authtag functins temorarly from anytun.cpp
Diffstat (limited to 'buffer.cpp')
-rw-r--r--buffer.cpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/buffer.cpp b/buffer.cpp
index a21ebb3..e85500d 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -88,43 +88,20 @@ void Buffer::operator=(const Buffer &src)
length_ = 0;
}
-void Buffer::operator=(const seq_nr_t &src)
-{
- if(buf_)
- delete[] buf_;
-
- length_ = sizeof(src);
-
- buf_ = new u_int8_t[length_];
- if( buf_ )
- {
- for( u_int32_t index = 0; index <= length_; index++ )
- buf_[index] = (src>>index) & 0xFF;
- }
- else
- length_ = 0;
-}
-
-void Buffer::operator=(const sender_id_t &src)
+bool Buffer::operator==(const Buffer &cmp) const
{
- if(buf_)
- delete[] buf_;
+ if(length_ != cmp.length_)
+ return false;
- length_ = sizeof(src);
-
- buf_ = new u_int8_t[length_];
+ if(!std::memcmp(buf_, cmp.buf_, length_))
+ return true;
- if( buf_ )
- {
- for( u_int32_t index = 0; index <= length_; index++ )
- buf_[index] = (src>>index) & 0xFF;
- }
- else
- length_ = 0;
+ return false;
}
+
u_int32_t Buffer::resizeFront(u_int32_t new_length)
{
if(length_ == new_length)