summaryrefslogtreecommitdiff
path: root/wifi/1.6/default/ringbuffer.h
diff options
context:
space:
mode:
authorSunil Ravi <sunilravi@google.com>2022-05-17 18:01:06 -0700
committerSunil Ravi <sunilravi@google.com>2022-05-23 11:20:57 -0700
commit07ef191b5a16f08cef8518827c3cd7a66f387b51 (patch)
tree75095e57fbf75b6d7cff973aa9d9c75cbd0d29b8 /wifi/1.6/default/ringbuffer.h
parentaff537b777f4ce0f0d41fef30981d7424b285a83 (diff)
wifi: Clear ring bufffers on detecting buffer corruption
While appending the newly received buffer to ring buffer list, check the size of the first buffer in the ring buffer list. If it is invalid(zero size or exceeding the max allowed size), return failure & clear all the ring buffers. Bug: 232477451 Test: vts test - 1.6/default/tests/runtests.sh Test: Manual - Ran basic wifi tests & checked bugreports Change-Id: Iaa41262f534914b971fe178053f1974248a46e70
Diffstat (limited to 'wifi/1.6/default/ringbuffer.h')
-rw-r--r--wifi/1.6/default/ringbuffer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/wifi/1.6/default/ringbuffer.h b/wifi/1.6/default/ringbuffer.h
index 8571a9f3d4..c6a1e4c52d 100644
--- a/wifi/1.6/default/ringbuffer.h
+++ b/wifi/1.6/default/ringbuffer.h
@@ -31,11 +31,19 @@ namespace implementation {
*/
class Ringbuffer {
public:
+ // Error codes for the append ring buffer operation
+ enum AppendStatus {
+ SUCCESS,
+ FAIL_GENERIC,
+ FAIL_IP_BUFFER_ZERO,
+ FAIL_IP_BUFFER_EXCEEDED_MAXSIZE,
+ FAIL_RING_BUFFER_CORRUPTED
+ };
explicit Ringbuffer(size_t maxSize);
// Appends the data buffer and deletes from the front until buffer is
// within |maxSize_|.
- void append(const std::vector<uint8_t>& input);
+ enum AppendStatus append(const std::vector<uint8_t>& input);
const std::list<std::vector<uint8_t>>& getData() const;
void clear();