diff options
author | Erwin Nindl <nine@wirdorange.org> | 2007-12-08 17:57:31 +0000 |
---|---|---|
committer | Erwin Nindl <nine@wirdorange.org> | 2007-12-08 17:57:31 +0000 |
commit | 62d31032352f8d857f31d89872fd42b98501e1c3 (patch) | |
tree | 8caaa3f1ff16281e45ff0d3c9357708b5efbe74c /buffer.cpp | |
parent | removed 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.cpp | 37 |
1 files changed, 7 insertions, 30 deletions
@@ -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) |