tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sdes.h (1600B)


      1 /*
      2 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
     12 #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
     13 
     14 #include <cstddef>
     15 #include <cstdint>
     16 #include <string>
     17 #include <vector>
     18 
     19 #include "absl/strings/string_view.h"
     20 #include "modules/rtp_rtcp/source/rtcp_packet.h"
     21 
     22 namespace webrtc {
     23 namespace rtcp {
     24 class CommonHeader;
     25 // Source Description (SDES) (RFC 3550).
     26 class Sdes : public RtcpPacket {
     27 public:
     28  struct Chunk {
     29    uint32_t ssrc;
     30    std::string cname;
     31  };
     32  static constexpr uint8_t kPacketType = 202;
     33  static constexpr size_t kMaxNumberOfChunks = 0x1f;
     34 
     35  Sdes();
     36  ~Sdes() override;
     37 
     38  // Parse assumes header is already parsed and validated.
     39  bool Parse(const CommonHeader& packet);
     40 
     41  bool AddCName(uint32_t ssrc, absl::string_view cname);
     42 
     43  const std::vector<Chunk>& chunks() const { return chunks_; }
     44 
     45  size_t BlockLength() const override;
     46 
     47  bool Create(uint8_t* packet,
     48              size_t* index,
     49              size_t max_length,
     50              PacketReadyCallback callback) const override;
     51 
     52 private:
     53  std::vector<Chunk> chunks_;
     54  size_t block_length_;
     55 };
     56 }  // namespace rtcp
     57 }  // namespace webrtc
     58 #endif  // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_