summaryrefslogtreecommitdiff
path: root/protocol.h
diff options
context:
space:
mode:
authormukesh agrawal <quiche@google.com>2016-10-07 15:45:37 -0700
committermukesh agrawal <quiche@google.com>2016-10-17 12:15:22 -0700
commitfd08064ec7ca120b3501c341c8dfde9fdd757316 (patch)
tree7d510d60d99f62b4936a1fc9df6d23f87e942075 /protocol.h
parentcc8458a847dafc8be2ce5de5a0e39a292780e6d5 (diff)
downloadwifilogd-fd08064ec7ca120b3501c341c8dfde9fdd757316.tar.gz
CommandProcessor: start dump implementation
Update CommandProcessor, to support dumping existing logs. In order to keep the CL size reasonable, this CL only implements dumping of the timestamps of each message. Dumping the payload will be added in a follow-on CL. Note that the new unit tests use ::testing::Invoke(), in a way that mixes the mocking and faking test strategies in a single object. The GMock documentation discourages this kind of mixing, in favor of splitting a class into one piece that is to be mocked, and another that is to be faked [1]. The reason we mix the strategies, despite the recommendation to the contrary, is that we don't always want to fake Os::Write(). Some times, we just want to mock that method. Along the way: - add a ScopedRewinder to MessageBuffer - add the kDumpBuffers command to protocol::Opcode. This command is numbered 0x20, to leave room for addition kWrite<MessageType> commands. [1] https://github.com/google/googletest/blob/master/googlemock/docs/v1_6/CookBook.md Specifically, "Having to mix a mock and a fake..." Bug: 32098312 Test: ./runtests.sh Change-Id: If221b47ae5615bbc114db5755ce9eb46b9934b6e
Diffstat (limited to 'protocol.h')
-rw-r--r--protocol.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/protocol.h b/protocol.h
index 61c3627..369a9e5 100644
--- a/protocol.h
+++ b/protocol.h
@@ -39,6 +39,7 @@ constexpr size_t kMaxMessageSize = 4096;
enum class Opcode : uint16_t {
kWriteAsciiMessage,
+ kDumpBuffers = 0x20,
};
enum class MessageSeverity : uint8_t {