diff --git a/include/of_util.h b/include/of_util.h index 8d97fa5..701d815 100644 --- a/include/of_util.h +++ b/include/of_util.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ public: void push(const char* data, int len); int index_of(const char* data, int len, int start_pos = 0); const char* get_data() const; + int get_len() const; void remove_of(int start_pos, int len); void clear(); private: diff --git a/src/of_util.cpp b/src/of_util.cpp index 843afcc..5ca54ad 100644 --- a/src/of_util.cpp +++ b/src/of_util.cpp @@ -33,6 +33,11 @@ const char* CMutBuffer::get_data() const return buffer_.data(); } +int CMutBuffer::get_len() const +{ + return static_cast(buffer_.size()); +} + void CMutBuffer::clear() { std::lock_guard lock(mutex_);