Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: webrtc/p2p/base/stun.h

Issue 1821083002: Split ByteBuffer into writer/reader objects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/relayserver_unittest.cc ('k') | webrtc/p2p/base/stun.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/stun.h
diff --git a/webrtc/p2p/base/stun.h b/webrtc/p2p/base/stun.h
index 9c8471304b48aeadce058f608ad34337acef57e7..597be2f9465bd0db07fc0a249b1a58f1194b48b2 100644
--- a/webrtc/p2p/base/stun.h
+++ b/webrtc/p2p/base/stun.h
@@ -180,11 +180,11 @@ class StunMessage {
// Parses the STUN packet in the given buffer and records it here. The
// return value indicates whether this was successful.
- bool Read(rtc::ByteBuffer* buf);
+ bool Read(rtc::ByteBufferReader* buf);
// Writes this object into a STUN packet. The return value indicates whether
// this was successful.
- bool Write(rtc::ByteBuffer* buf) const;
+ bool Write(rtc::ByteBufferWriter* buf) const;
// Creates an empty message. Overridable by derived classes.
virtual StunMessage* CreateNew() const { return new StunMessage(); }
@@ -221,11 +221,11 @@ class StunAttribute {
// Reads the body (not the type or length) for this type of attribute from
// the given buffer. Return value is true if successful.
- virtual bool Read(rtc::ByteBuffer* buf) = 0;
+ virtual bool Read(rtc::ByteBufferReader* buf) = 0;
// Writes the body (not the type or length) to the given buffer. Return
// value is true if successful.
- virtual bool Write(rtc::ByteBuffer* buf) const = 0;
+ virtual bool Write(rtc::ByteBufferWriter* buf) const = 0;
// Creates an attribute object with the given type and smallest length.
static StunAttribute* Create(StunAttributeValueType value_type,
@@ -245,8 +245,8 @@ class StunAttribute {
protected:
StunAttribute(uint16_t type, uint16_t length);
void SetLength(uint16_t length) { length_ = length; }
- void WritePadding(rtc::ByteBuffer* buf) const;
- void ConsumePadding(rtc::ByteBuffer* buf) const;
+ void WritePadding(rtc::ByteBufferWriter* buf) const;
+ void ConsumePadding(rtc::ByteBufferReader* buf) const;
private:
uint16_t type_;
@@ -290,8 +290,8 @@ class StunAddressAttribute : public StunAttribute {
}
void SetPort(uint16_t port) { address_.SetPort(port); }
- virtual bool Read(rtc::ByteBuffer* buf);
- virtual bool Write(rtc::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBufferReader* buf);
+ virtual bool Write(rtc::ByteBufferWriter* buf) const;
private:
void EnsureAddressLength() {
@@ -327,8 +327,8 @@ class StunXorAddressAttribute : public StunAddressAttribute {
virtual void SetOwner(StunMessage* owner) {
owner_ = owner;
}
- virtual bool Read(rtc::ByteBuffer* buf);
- virtual bool Write(rtc::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBufferReader* buf);
+ virtual bool Write(rtc::ByteBufferWriter* buf) const;
private:
rtc::IPAddress GetXoredIP() const;
@@ -352,8 +352,8 @@ class StunUInt32Attribute : public StunAttribute {
bool GetBit(size_t index) const;
void SetBit(size_t index, bool value);
- virtual bool Read(rtc::ByteBuffer* buf);
- virtual bool Write(rtc::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBufferReader* buf);
+ virtual bool Write(rtc::ByteBufferWriter* buf) const;
private:
uint32_t bits_;
@@ -372,8 +372,8 @@ class StunUInt64Attribute : public StunAttribute {
uint64_t value() const { return bits_; }
void SetValue(uint64_t bits) { bits_ = bits; }
- virtual bool Read(rtc::ByteBuffer* buf);
- virtual bool Write(rtc::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBufferReader* buf);
+ virtual bool Write(rtc::ByteBufferWriter* buf) const;
private:
uint64_t bits_;
@@ -401,8 +401,8 @@ class StunByteStringAttribute : public StunAttribute {
uint8_t GetByte(size_t index) const;
void SetByte(size_t index, uint8_t value);
- virtual bool Read(rtc::ByteBuffer* buf);
- virtual bool Write(rtc::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBufferReader* buf);
+ virtual bool Write(rtc::ByteBufferWriter* buf) const;
private:
void SetBytes(char* bytes, size_t length);
@@ -434,8 +434,8 @@ class StunErrorCodeAttribute : public StunAttribute {
void SetNumber(uint8_t number) { number_ = number; }
void SetReason(const std::string& reason);
- bool Read(rtc::ByteBuffer* buf);
- bool Write(rtc::ByteBuffer* buf) const;
+ bool Read(rtc::ByteBufferReader* buf);
+ bool Write(rtc::ByteBufferWriter* buf) const;
private:
uint8_t class_;
@@ -458,8 +458,8 @@ class StunUInt16ListAttribute : public StunAttribute {
void SetType(int index, uint16_t value);
void AddType(uint16_t value);
- bool Read(rtc::ByteBuffer* buf);
- bool Write(rtc::ByteBuffer* buf) const;
+ bool Read(rtc::ByteBufferReader* buf);
+ bool Write(rtc::ByteBufferWriter* buf) const;
private:
std::vector<uint16_t>* attr_types_;
« no previous file with comments | « webrtc/p2p/base/relayserver_unittest.cc ('k') | webrtc/p2p/base/stun.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698