summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/api/transport/stun.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/api/transport/stun.h
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/api/transport/stun.h')
-rw-r--r--third_party/libwebrtc/api/transport/stun.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/third_party/libwebrtc/api/transport/stun.h b/third_party/libwebrtc/api/transport/stun.h
index 4a04db33cf..62d98f71e0 100644
--- a/third_party/libwebrtc/api/transport/stun.h
+++ b/third_party/libwebrtc/api/transport/stun.h
@@ -519,13 +519,22 @@ class StunByteStringAttribute : public StunAttribute {
StunAttributeValueType value_type() const override;
- const char* bytes() const { return bytes_; }
+ [[deprecated("Use array_view")]] const char* bytes() const {
+ return reinterpret_cast<const char*>(bytes_);
+ }
+ // Returns the attribute value as a string.
+ // Use this for attributes that are text or text-compatible.
absl::string_view string_view() const {
- return absl::string_view(bytes_, length());
+ return absl::string_view(reinterpret_cast<const char*>(bytes_), length());
+ }
+ // Returns the attribute value as an uint8_t view.
+ // Use this function for values that are not text.
+ rtc::ArrayView<uint8_t> array_view() const {
+ return rtc::MakeArrayView(bytes_, length());
}
[[deprecated]] std::string GetString() const {
- return std::string(bytes_, length());
+ return std::string(reinterpret_cast<const char*>(bytes_), length());
}
void CopyBytes(const void* bytes, size_t length);
@@ -538,9 +547,9 @@ class StunByteStringAttribute : public StunAttribute {
bool Write(rtc::ByteBufferWriter* buf) const override;
private:
- void SetBytes(char* bytes, size_t length);
+ void SetBytes(uint8_t* bytes, size_t length);
- char* bytes_;
+ uint8_t* bytes_;
};
// Implements STUN attributes that record an error code.