summaryrefslogtreecommitdiff
path: root/buffer.h
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-02-23 23:05:43 +0000
committerChristian Pointner <equinox@anytun.org>2008-02-23 23:05:43 +0000
commitb8766a2041d57a3aa49c3855902953f8de0b0ec1 (patch)
treece3fd0496bbcc9c71b8a16ec1333f574e3fe51a5 /buffer.h
parentadded routing table basic structure (diff)
- keyderivation and cipher should work now
however it needs further testing - rewrite of Buffer and Packets
Diffstat (limited to 'buffer.h')
-rw-r--r--buffer.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/buffer.h b/buffer.h
index 1a426e1..063be91 100644
--- a/buffer.h
+++ b/buffer.h
@@ -40,32 +40,33 @@ class UDPPacketSource;
class Buffer
{
public:
- Buffer();
- Buffer(u_int32_t length);
- Buffer(u_int8_t* data, u_int32_t length);
+ Buffer(bool allow_realloc = true);
+ Buffer(u_int32_t length, bool allow_realloc = true);
+ Buffer(u_int8_t* data, u_int32_t length, bool allow_realloc = true);
virtual ~Buffer();
Buffer(const Buffer &src);
void operator=(const Buffer &src);
bool operator==(const Buffer &cmp) const;
+ Buffer operator^(const Buffer &xor_by) const;
- // math operations to calculate IVs and keys
- virtual Buffer operator^(const Buffer &xor_by) const;
- virtual Buffer leftByteShift(u_int32_t width) const;
- virtual Buffer rightByteShift(u_int32_t width) const;
-
- u_int32_t resizeFront(u_int32_t new_length);
- u_int32_t resizeBack(u_int32_t new_length);
u_int32_t getLength() const;
+ virtual void setLength(u_int32_t new_length);
u_int8_t* getBuf();
u_int8_t& operator[](u_int32_t index);
u_int8_t operator[](u_int32_t index) const;
std::string getHexDump() const;
+ bool isReallocAllowed() const;
+
operator u_int8_t*();
protected:
u_int8_t *buf_;
u_int32_t length_;
+ u_int32_t real_length_;
+ bool allow_realloc_;
+
+ static const u_int32_t OVER_SIZE_ = 100;
};
#endif