tor-browser

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

ParsingResultComparer.h (1822B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef _PARSINGRESULTCOMPARER_H_
      8 #define _PARSINGRESULTCOMPARER_H_
      9 
     10 #include <string>
     11 
     12 #include "sdp/SdpParser.h"
     13 #include "sdp/SdpPref.h"
     14 
     15 namespace mozilla {
     16 
     17 class Sdp;
     18 class SdpMediaSection;
     19 class SdpAttributeList;
     20 
     21 enum class SdpComparisonResult {
     22  Inequal = false,
     23  Equal = true,
     24 };
     25 
     26 class ParsingResultComparer {
     27 public:
     28  using Results = UniquePtr<SdpParser::Results>;
     29 
     30  ParsingResultComparer() = default;
     31 
     32  static bool Compare(const Results& aResA, const Results& aResB,
     33                      const std::string& aOrignalSdp,
     34                      const SdpPref::AlternateParseModes& aMode);
     35  bool Compare(const Sdp& rsdparsaSdp, const Sdp& sipccSdp,
     36               const std::string& aOriginalSdp,
     37               const SdpComparisonResult expect = SdpComparisonResult::Equal);
     38  bool CompareMediaSections(
     39      const SdpMediaSection& rustMediaSection,
     40      const SdpMediaSection& sipccMediaSection,
     41      const SdpComparisonResult expect = SdpComparisonResult::Equal) const;
     42  bool CompareAttrLists(
     43      const SdpAttributeList& rustAttrlist,
     44      const SdpAttributeList& sipccAttrlist, int level,
     45      const SdpComparisonResult expect = SdpComparisonResult::Equal) const;
     46  void TrackRustParsingFailed(size_t sipccErrorCount) const;
     47  void TrackSipccParsingFailed(size_t rustErrorCount) const;
     48 
     49 private:
     50  std::string mOriginalSdp;
     51 
     52  std::string GetAttributeLines(const std::string& attrType, int level) const;
     53 };
     54 
     55 }  // namespace mozilla
     56 
     57 #endif  // _PARSINGRESULTCOMPARER_H_