0
Files
src/remoting/protocol/stream_packet_processor.h
Avi Drissman d6cdf9b877 Update copyright headers in rlz/, remoting/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: Ia865422057bdda8d25f347a651636f6f7f4d4278
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3900694
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047637}
2022-09-15 19:52:53 +00:00

51 lines
1.6 KiB
C++

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_STREAM_PACKET_PROCESSOR_H_
#define REMOTING_PROTOCOL_STREAM_PACKET_PROCESSOR_H_
#include <stdint.h>
#include "base/memory/scoped_refptr.h"
namespace net {
class IOBufferWithSize;
} // namespace net
namespace rtc {
struct PacketTimeUpdateParams;
} // namespace rtc
namespace remoting::protocol {
// Helper class to process packets from and to the StreamPacketSocket.
class StreamPacketProcessor {
public:
virtual ~StreamPacketProcessor() = default;
// Packs data into packet to be sent over the packet socket. Returns nullptr
// if the data is malformed.
virtual scoped_refptr<net::IOBufferWithSize> Pack(const uint8_t* data,
size_t data_size) const = 0;
// Unpacks a packet from the packet socket's buffer. |bytes_consumed| should
// be updated with number of bytes it consumed from |data|. If the packet
// can't be unpacked (generally because the packet is not fully received),
// nullptr will be returned and |bytes_consumed| will be set to 0.
virtual scoped_refptr<net::IOBufferWithSize> Unpack(
const uint8_t* data,
size_t data_size,
size_t* bytes_consumed) const = 0;
// Applies WebRTC packet options on a packet that has already been packed.
virtual void ApplyPacketOptions(
uint8_t* data,
size_t data_size,
const rtc::PacketTimeUpdateParams& packet_time_params) const = 0;
};
} // namespace remoting::protocol
#endif // REMOTING_PROTOCOL_STREAM_PACKET_PROCESSOR_H_