[Yunq] Accept a message view on message parsing.
This commit is contained in:
parent
75d84a0fa5
commit
0135d8d844
19 changed files with 94 additions and 107 deletions
|
|
@ -15,16 +15,14 @@ struct ExtPointer {
|
|||
};
|
||||
|
||||
} // namespace
|
||||
glcr::Status KeyboardListener::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
|
||||
yunq::MessageView message(bytes, offset);
|
||||
glcr::Status KeyboardListener::ParseFromBytes(const yunq::MessageView& message) {
|
||||
RETURN_ERROR(ParseFromBytesInternal(message));
|
||||
// Parse port_capability.
|
||||
ASSIGN_OR_RETURN(port_capability_, message.ReadCapability(0));
|
||||
return glcr::Status::Ok();
|
||||
}
|
||||
|
||||
glcr::Status KeyboardListener::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
|
||||
yunq::MessageView message(bytes, offset);
|
||||
glcr::Status KeyboardListener::ParseFromBytes(const yunq::MessageView& message, const glcr::CapBuffer& caps) {
|
||||
RETURN_ERROR(ParseFromBytesInternal(message));
|
||||
// Parse port_capability.
|
||||
ASSIGN_OR_RETURN(port_capability_, message.ReadCapability(0, caps));
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class KeyboardListener {
|
|||
KeyboardListener(const KeyboardListener&) = delete;
|
||||
KeyboardListener(KeyboardListener&&) = delete;
|
||||
|
||||
[[nodiscard]] glcr::Status ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
|
||||
[[nodiscard]] glcr::Status ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
|
||||
[[nodiscard]] glcr::Status ParseFromBytes(const yunq::MessageView& message);
|
||||
[[nodiscard]] glcr::Status ParseFromBytes(const yunq::MessageView& message, const glcr::CapBuffer&);
|
||||
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
|
||||
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
|
||||
const z_cap_t& port_capability() const { return port_capability_; }
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ glcr::Status VoyageursServerBase::HandleRequest(const glcr::ByteBuffer& request,
|
|||
|
||||
|
||||
KeyboardListener yunq_request;
|
||||
RETURN_ERROR(yunq_request.ParseFromBytes(request, kHeaderSize, req_caps));
|
||||
yunq::MessageView request_view(request, kHeaderSize);
|
||||
RETURN_ERROR(yunq_request.ParseFromBytes(request_view, req_caps));
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue