1 /*
2  *  Copyright (c) 2014 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 
12 #ifndef WEBRTC_TEST_RTCP_PACKET_PARSER_H_
13 #define WEBRTC_TEST_RTCP_PACKET_PARSER_H_
14 
15 #include <map>
16 #include <string>
17 #include <vector>
18 
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
20 #include "webrtc/typedefs.h"
21 
22 namespace webrtc {
23 namespace test {
24 
25 class RtcpPacketParser;
26 
27 class PacketType {
28  public:
~PacketType()29   virtual ~PacketType() {}
30 
num_packets()31   int num_packets() const { return num_packets_; }
32 
33  protected:
PacketType()34   PacketType() : num_packets_(0) {}
35 
36   int num_packets_;
37 };
38 
39 class SenderReport : public PacketType {
40  public:
SenderReport()41   SenderReport() {}
~SenderReport()42   virtual ~SenderReport() {}
43 
Ssrc()44   uint32_t Ssrc() const { return sr_.SenderSSRC; }
NtpSec()45   uint32_t NtpSec() const { return sr_.NTPMostSignificant; }
NtpFrac()46   uint32_t NtpFrac() const { return sr_.NTPLeastSignificant; }
RtpTimestamp()47   uint32_t RtpTimestamp() const { return sr_.RTPTimestamp; }
PacketCount()48   uint32_t PacketCount() const { return sr_.SenderPacketCount; }
OctetCount()49   uint32_t OctetCount() const { return sr_.SenderOctetCount; }
50 
51  private:
52   friend class RtcpPacketParser;
53 
Set(const RTCPUtility::RTCPPacketSR & sr)54   void Set(const RTCPUtility::RTCPPacketSR& sr) {
55     sr_ = sr;
56     ++num_packets_;
57   }
58 
59   RTCPUtility::RTCPPacketSR sr_;
60 };
61 
62 class ReceiverReport : public PacketType {
63  public:
ReceiverReport()64   ReceiverReport() {}
~ReceiverReport()65   virtual ~ReceiverReport() {}
66 
Ssrc()67   uint32_t Ssrc() const { return rr_.SenderSSRC; }
68 
69  private:
70   friend class RtcpPacketParser;
71 
Set(const RTCPUtility::RTCPPacketRR & rr)72   void Set(const RTCPUtility::RTCPPacketRR& rr) {
73     rr_ = rr;
74     ++num_packets_;
75   }
76 
77   RTCPUtility::RTCPPacketRR rr_;
78 };
79 
80 class ReportBlock : public PacketType {
81  public:
ReportBlock()82   ReportBlock() {}
~ReportBlock()83   virtual ~ReportBlock() {}
84 
Ssrc()85   uint32_t Ssrc() const { return rb_.SSRC; }
FractionLost()86   uint8_t FractionLost() const { return rb_.FractionLost; }
CumPacketLost()87   uint32_t CumPacketLost() const { return rb_.CumulativeNumOfPacketsLost; }
ExtHighestSeqNum()88   uint32_t ExtHighestSeqNum() const { return rb_.ExtendedHighestSequenceNumber;}
Jitter()89   uint32_t Jitter() const { return rb_.Jitter; }
LastSr()90   uint32_t LastSr() const { return rb_.LastSR; }
DelayLastSr()91   uint32_t DelayLastSr()const  { return rb_.DelayLastSR; }
92 
93  private:
94   friend class RtcpPacketParser;
95 
Set(const RTCPUtility::RTCPPacketReportBlockItem & rb)96   void Set(const RTCPUtility::RTCPPacketReportBlockItem& rb) {
97     rb_ = rb;
98     ++num_packets_;
99   }
100 
101   RTCPUtility::RTCPPacketReportBlockItem rb_;
102 };
103 
104 class Ij : public PacketType {
105  public:
Ij()106   Ij() {}
~Ij()107   virtual ~Ij() {}
108 
109  private:
110   friend class RtcpPacketParser;
111 
Set()112   void Set() { ++num_packets_; }
113 };
114 
115 class IjItem : public PacketType {
116  public:
IjItem()117   IjItem() {}
~IjItem()118   virtual ~IjItem() {}
119 
Jitter()120   uint32_t Jitter() const { return ij_item_.Jitter; }
121 
122  private:
123   friend class RtcpPacketParser;
124 
Set(const RTCPUtility::RTCPPacketExtendedJitterReportItem & ij_item)125   void Set(const RTCPUtility::RTCPPacketExtendedJitterReportItem& ij_item) {
126     ij_item_ = ij_item;
127     ++num_packets_;
128   }
129 
130   RTCPUtility::RTCPPacketExtendedJitterReportItem ij_item_;
131 };
132 
133 class Sdes : public PacketType {
134  public:
Sdes()135   Sdes() {}
~Sdes()136   virtual ~Sdes() {}
137 
138  private:
139   friend class RtcpPacketParser;
140 
Set()141   void Set() { ++num_packets_; }
142 };
143 
144 class SdesChunk : public PacketType {
145  public:
SdesChunk()146   SdesChunk() {}
~SdesChunk()147   virtual ~SdesChunk() {}
148 
Ssrc()149   uint32_t Ssrc() const { return cname_.SenderSSRC; }
Cname()150   std::string Cname() const { return cname_.CName; }
151 
152  private:
153   friend class RtcpPacketParser;
154 
Set(const RTCPUtility::RTCPPacketSDESCName & cname)155   void Set(const RTCPUtility::RTCPPacketSDESCName& cname) {
156     cname_ = cname;
157     ++num_packets_;
158   }
159 
160   RTCPUtility::RTCPPacketSDESCName cname_;
161 };
162 
163 class Bye : public PacketType {
164  public:
Bye()165   Bye() {}
~Bye()166   virtual ~Bye() {}
167 
Ssrc()168   uint32_t Ssrc() const { return bye_.SenderSSRC; }
169 
170  private:
171   friend class RtcpPacketParser;
172 
Set(const RTCPUtility::RTCPPacketBYE & bye)173   void Set(const RTCPUtility::RTCPPacketBYE& bye) {
174     bye_ = bye;
175     ++num_packets_;
176   }
177 
178   RTCPUtility::RTCPPacketBYE bye_;
179 };
180 
181 class Rpsi : public PacketType {
182  public:
Rpsi()183   Rpsi() {}
~Rpsi()184   virtual ~Rpsi() {}
185 
Ssrc()186   uint32_t Ssrc() const { return rpsi_.SenderSSRC; }
MediaSsrc()187   uint32_t MediaSsrc() const { return rpsi_.MediaSSRC; }
PayloadType()188   uint8_t PayloadType() const { return rpsi_.PayloadType; }
NumberOfValidBits()189   uint16_t NumberOfValidBits() const { return rpsi_.NumberOfValidBits; }
190   uint64_t PictureId() const;
191 
192  private:
193   friend class RtcpPacketParser;
194 
Set(const RTCPUtility::RTCPPacketPSFBRPSI & rpsi)195   void Set(const RTCPUtility::RTCPPacketPSFBRPSI& rpsi) {
196     rpsi_ = rpsi;
197     ++num_packets_;
198   }
199 
200   RTCPUtility::RTCPPacketPSFBRPSI rpsi_;
201 };
202 
203 class App : public PacketType {
204  public:
App()205   App() {}
~App()206   virtual ~App() {}
207 
SubType()208   uint8_t SubType() const { return app_.SubType; }
Name()209   uint32_t Name() const { return app_.Name; }
210 
211  private:
212   friend class RtcpPacketParser;
213 
Set(const RTCPUtility::RTCPPacketAPP & app)214   void Set(const RTCPUtility::RTCPPacketAPP& app) {
215     app_ = app;
216     ++num_packets_;
217   }
218 
219   RTCPUtility::RTCPPacketAPP app_;
220 };
221 
222 class AppItem : public PacketType {
223  public:
AppItem()224   AppItem() {}
~AppItem()225   virtual ~AppItem() {}
226 
Data()227   uint8_t* Data() { return app_item_.Data; }
DataLength()228   uint16_t DataLength() const { return app_item_.Size; }
229 
230  private:
231   friend class RtcpPacketParser;
232 
Set(const RTCPUtility::RTCPPacketAPP & app)233   void Set(const RTCPUtility::RTCPPacketAPP& app) {
234     app_item_ = app;
235     ++num_packets_;
236   }
237 
238   RTCPUtility::RTCPPacketAPP app_item_;
239 };
240 
241 class Pli : public PacketType {
242  public:
Pli()243   Pli() {}
~Pli()244   virtual ~Pli() {}
245 
Ssrc()246   uint32_t Ssrc() const { return pli_.SenderSSRC; }
MediaSsrc()247   uint32_t MediaSsrc() const { return pli_.MediaSSRC; }
248 
249  private:
250   friend class RtcpPacketParser;
251 
Set(const RTCPUtility::RTCPPacketPSFBPLI & pli)252   void Set(const RTCPUtility::RTCPPacketPSFBPLI& pli) {
253     pli_ = pli;
254     ++num_packets_;
255   }
256 
257   RTCPUtility::RTCPPacketPSFBPLI pli_;
258 };
259 
260 class Sli : public PacketType {
261  public:
Sli()262   Sli() {}
~Sli()263   virtual ~Sli() {}
264 
Ssrc()265   uint32_t Ssrc() const { return sli_.SenderSSRC; }
MediaSsrc()266   uint32_t MediaSsrc() const { return sli_.MediaSSRC; }
267 
268  private:
269   friend class RtcpPacketParser;
270 
Set(const RTCPUtility::RTCPPacketPSFBSLI & sli)271   void Set(const RTCPUtility::RTCPPacketPSFBSLI& sli) {
272     sli_ = sli;
273     ++num_packets_;
274   }
275 
276   RTCPUtility::RTCPPacketPSFBSLI sli_;
277 };
278 
279 class SliItem : public PacketType {
280  public:
SliItem()281   SliItem() {}
~SliItem()282   virtual ~SliItem() {}
283 
FirstMb()284   uint16_t FirstMb() const { return sli_item_.FirstMB; }
NumberOfMb()285   uint16_t NumberOfMb() const { return sli_item_.NumberOfMB; }
PictureId()286   uint8_t PictureId() const { return sli_item_.PictureId; }
287 
288  private:
289   friend class RtcpPacketParser;
290 
Set(const RTCPUtility::RTCPPacketPSFBSLIItem & sli_item)291   void Set(const RTCPUtility::RTCPPacketPSFBSLIItem& sli_item) {
292     sli_item_ = sli_item;
293     ++num_packets_;
294   }
295 
296   RTCPUtility::RTCPPacketPSFBSLIItem sli_item_;
297 };
298 
299 class Fir : public PacketType {
300  public:
Fir()301   Fir() {}
~Fir()302   virtual ~Fir() {}
303 
Ssrc()304   uint32_t Ssrc() const { return fir_.SenderSSRC; }
305 
306  private:
307   friend class RtcpPacketParser;
308 
Set(const RTCPUtility::RTCPPacketPSFBFIR & fir)309   void Set(const RTCPUtility::RTCPPacketPSFBFIR& fir) {
310     fir_ = fir;
311     ++num_packets_;
312   }
313 
314   RTCPUtility::RTCPPacketPSFBFIR fir_;
315 };
316 
317 class FirItem : public PacketType {
318  public:
FirItem()319   FirItem() {}
~FirItem()320   virtual ~FirItem() {}
321 
Ssrc()322   uint32_t Ssrc() const { return fir_item_.SSRC; }
SeqNum()323   uint8_t SeqNum() const { return fir_item_.CommandSequenceNumber; }
324 
325  private:
326   friend class RtcpPacketParser;
327 
Set(const RTCPUtility::RTCPPacketPSFBFIRItem & fir_item)328   void Set(const RTCPUtility::RTCPPacketPSFBFIRItem& fir_item) {
329     fir_item_ = fir_item;
330     ++num_packets_;
331   }
332 
333   RTCPUtility::RTCPPacketPSFBFIRItem fir_item_;
334 };
335 
336 class Nack : public PacketType {
337  public:
Nack()338   Nack() {}
~Nack()339   virtual ~Nack() {}
340 
Ssrc()341   uint32_t Ssrc() const { return nack_.SenderSSRC; }
MediaSsrc()342   uint32_t MediaSsrc() const { return nack_.MediaSSRC; }
343 
344  private:
345   friend class RtcpPacketParser;
346 
Set(const RTCPUtility::RTCPPacketRTPFBNACK & nack)347   void Set(const RTCPUtility::RTCPPacketRTPFBNACK& nack) {
348     nack_ = nack;
349     ++num_packets_;
350   }
351 
352   RTCPUtility::RTCPPacketRTPFBNACK nack_;
353 };
354 
355 class NackItem : public PacketType {
356  public:
NackItem()357   NackItem() {}
~NackItem()358   virtual ~NackItem() {}
359 
last_nack_list()360   std::vector<uint16_t> last_nack_list() const {
361     return last_nack_list_;
362   }
363 
364  private:
365   friend class RtcpPacketParser;
366 
Set(const RTCPUtility::RTCPPacketRTPFBNACKItem & nack_item)367   void Set(const RTCPUtility::RTCPPacketRTPFBNACKItem& nack_item) {
368     last_nack_list_.push_back(nack_item.PacketID);
369     for (int i = 0; i < 16; ++i) {
370       if (nack_item.BitMask & (1 << i)) {
371         last_nack_list_.push_back(nack_item.PacketID + i + 1);
372       }
373     }
374     ++num_packets_;
375   }
Clear()376   void Clear() { last_nack_list_.clear(); }
377 
378   std::vector<uint16_t> last_nack_list_;
379 };
380 
381 class PsfbApp : public PacketType {
382  public:
PsfbApp()383   PsfbApp() {}
~PsfbApp()384   virtual ~PsfbApp() {}
385 
Ssrc()386   uint32_t Ssrc() const { return psfb_app_.SenderSSRC; }
387 
388  private:
389   friend class RtcpPacketParser;
390 
Set(const RTCPUtility::RTCPPacketPSFBAPP & psfb_app)391   void Set(const RTCPUtility::RTCPPacketPSFBAPP& psfb_app) {
392     psfb_app_ = psfb_app;
393     ++num_packets_;
394   }
395 
396   RTCPUtility::RTCPPacketPSFBAPP psfb_app_;
397 };
398 
399 class RembItem : public PacketType {
400  public:
RembItem()401   RembItem() : last_bitrate_bps_(0) {}
~RembItem()402   virtual ~RembItem() {}
403 
last_bitrate_bps()404   int last_bitrate_bps() const { return last_bitrate_bps_; }
last_ssrc_list()405   std::vector<uint32_t> last_ssrc_list() {
406     return last_ssrc_list_;
407   }
408 
409  private:
410   friend class RtcpPacketParser;
411 
Set(const RTCPUtility::RTCPPacketPSFBREMBItem & remb_item)412   void Set(const RTCPUtility::RTCPPacketPSFBREMBItem& remb_item) {
413     last_bitrate_bps_ = remb_item.BitRate;
414     last_ssrc_list_.clear();
415     last_ssrc_list_.insert(
416         last_ssrc_list_.end(),
417         remb_item.SSRCs,
418         remb_item.SSRCs + remb_item.NumberOfSSRCs);
419     ++num_packets_;
420   }
421 
422   uint32_t last_bitrate_bps_;
423   std::vector<uint32_t> last_ssrc_list_;
424 };
425 
426 class Tmmbr : public PacketType {
427  public:
Tmmbr()428   Tmmbr() {}
~Tmmbr()429   virtual ~Tmmbr() {}
430 
Ssrc()431   uint32_t Ssrc() const { return tmmbr_.SenderSSRC; }
432 
433  private:
434   friend class RtcpPacketParser;
435 
Set(const RTCPUtility::RTCPPacketRTPFBTMMBR & tmmbr)436   void Set(const RTCPUtility::RTCPPacketRTPFBTMMBR& tmmbr) {
437     tmmbr_ = tmmbr;
438     ++num_packets_;
439   }
440 
441   RTCPUtility::RTCPPacketRTPFBTMMBR tmmbr_;
442 };
443 
444 class TmmbrItem : public PacketType {
445  public:
TmmbrItem()446   TmmbrItem() {}
~TmmbrItem()447   virtual ~TmmbrItem() {}
448 
Ssrc()449   uint32_t Ssrc() const { return tmmbr_item_.SSRC; }
BitrateKbps()450   uint32_t BitrateKbps() const { return tmmbr_item_.MaxTotalMediaBitRate; }
Overhead()451   uint32_t Overhead() const { return tmmbr_item_.MeasuredOverhead; }
452 
453  private:
454   friend class RtcpPacketParser;
455 
Set(const RTCPUtility::RTCPPacketRTPFBTMMBRItem & tmmbr_item)456   void Set(const RTCPUtility::RTCPPacketRTPFBTMMBRItem& tmmbr_item) {
457     tmmbr_item_ = tmmbr_item;
458     ++num_packets_;
459   }
460 
461   RTCPUtility::RTCPPacketRTPFBTMMBRItem tmmbr_item_;
462 };
463 
464 
465 class Tmmbn : public PacketType {
466  public:
Tmmbn()467   Tmmbn() {}
~Tmmbn()468   virtual ~Tmmbn() {}
469 
Ssrc()470   uint32_t Ssrc() const { return tmmbn_.SenderSSRC; }
471 
472  private:
473   friend class RtcpPacketParser;
474 
Set(const RTCPUtility::RTCPPacketRTPFBTMMBN & tmmbn)475   void Set(const RTCPUtility::RTCPPacketRTPFBTMMBN& tmmbn) {
476     tmmbn_ = tmmbn;
477     ++num_packets_;
478   }
479 
480   RTCPUtility::RTCPPacketRTPFBTMMBN tmmbn_;
481 };
482 
483 class TmmbnItems : public PacketType {
484  public:
TmmbnItems()485   TmmbnItems() {}
~TmmbnItems()486   virtual ~TmmbnItems() {}
487 
Ssrc(uint8_t num)488   uint32_t Ssrc(uint8_t num) const {
489     assert(num < tmmbns_.size());
490     return tmmbns_[num].SSRC;
491   }
BitrateKbps(uint8_t num)492   uint32_t BitrateKbps(uint8_t num) const {
493     assert(num < tmmbns_.size());
494     return tmmbns_[num].MaxTotalMediaBitRate;
495   }
Overhead(uint8_t num)496   uint32_t Overhead(uint8_t num) const {
497     assert(num < tmmbns_.size());
498     return tmmbns_[num].MeasuredOverhead;
499   }
500 
501  private:
502   friend class RtcpPacketParser;
503 
Set(const RTCPUtility::RTCPPacketRTPFBTMMBNItem & tmmbn_item)504   void Set(const RTCPUtility::RTCPPacketRTPFBTMMBNItem& tmmbn_item) {
505     tmmbns_.push_back(tmmbn_item);
506     ++num_packets_;
507   }
Clear()508   void Clear() { tmmbns_.clear(); }
509 
510   std::vector<RTCPUtility::RTCPPacketRTPFBTMMBNItem> tmmbns_;
511 };
512 
513 class XrHeader : public PacketType {
514  public:
XrHeader()515   XrHeader() {}
~XrHeader()516   virtual ~XrHeader() {}
517 
Ssrc()518   uint32_t Ssrc() const { return xr_header_.OriginatorSSRC; }
519 
520  private:
521   friend class RtcpPacketParser;
522 
Set(const RTCPUtility::RTCPPacketXR & xr_header)523   void Set(const RTCPUtility::RTCPPacketXR& xr_header) {
524     xr_header_ = xr_header;
525     ++num_packets_;
526   }
527 
528   RTCPUtility::RTCPPacketXR xr_header_;
529 };
530 
531 class Rrtr : public PacketType {
532  public:
Rrtr()533   Rrtr() {}
~Rrtr()534   virtual ~Rrtr() {}
535 
NtpSec()536   uint32_t NtpSec() const { return rrtr_.NTPMostSignificant; }
NtpFrac()537   uint32_t NtpFrac() const { return rrtr_.NTPLeastSignificant; }
538 
539  private:
540   friend class RtcpPacketParser;
541 
Set(const RTCPUtility::RTCPPacketXRReceiverReferenceTimeItem & rrtr)542   void Set(const RTCPUtility::RTCPPacketXRReceiverReferenceTimeItem& rrtr) {
543     rrtr_ = rrtr;
544     ++num_packets_;
545   }
546 
547   RTCPUtility::RTCPPacketXRReceiverReferenceTimeItem rrtr_;
548 };
549 
550 class Dlrr : public PacketType {
551  public:
Dlrr()552   Dlrr() {}
~Dlrr()553   virtual ~Dlrr() {}
554 
555  private:
556   friend class RtcpPacketParser;
557 
Set()558   void Set() { ++num_packets_; }
559 };
560 
561 class DlrrItems : public PacketType {
562  public:
DlrrItems()563   DlrrItems() {}
~DlrrItems()564   virtual ~DlrrItems() {}
565 
Ssrc(uint8_t num)566   uint32_t Ssrc(uint8_t num) const {
567     assert(num < dlrrs_.size());
568     return dlrrs_[num].SSRC;
569   }
LastRr(uint8_t num)570   uint32_t LastRr(uint8_t num) const {
571     assert(num < dlrrs_.size());
572     return dlrrs_[num].LastRR;
573   }
DelayLastRr(uint8_t num)574   uint32_t DelayLastRr(uint8_t num) const {
575     assert(num < dlrrs_.size());
576     return dlrrs_[num].DelayLastRR;
577   }
578 
579  private:
580   friend class RtcpPacketParser;
581 
Set(const RTCPUtility::RTCPPacketXRDLRRReportBlockItem & dlrr)582   void Set(const RTCPUtility::RTCPPacketXRDLRRReportBlockItem& dlrr) {
583     dlrrs_.push_back(dlrr);
584     ++num_packets_;
585   }
Clear()586   void Clear() { dlrrs_.clear(); }
587 
588   std::vector<RTCPUtility::RTCPPacketXRDLRRReportBlockItem> dlrrs_;
589 };
590 
591 class VoipMetric : public PacketType {
592  public:
VoipMetric()593   VoipMetric() {}
~VoipMetric()594   virtual ~VoipMetric() {}
595 
Ssrc()596   uint32_t Ssrc() const { return voip_metric_.SSRC; }
LossRate()597   uint8_t LossRate() { return voip_metric_.lossRate; }
DiscardRate()598   uint8_t DiscardRate() { return voip_metric_.discardRate; }
BurstDensity()599   uint8_t BurstDensity() { return voip_metric_.burstDensity; }
GapDensity()600   uint8_t GapDensity() { return voip_metric_.gapDensity; }
BurstDuration()601   uint16_t BurstDuration() { return voip_metric_.burstDuration; }
GapDuration()602   uint16_t GapDuration() { return voip_metric_.gapDuration; }
RoundTripDelay()603   uint16_t RoundTripDelay() { return voip_metric_.roundTripDelay; }
EndSystemDelay()604   uint16_t EndSystemDelay() { return voip_metric_.endSystemDelay; }
SignalLevel()605   uint8_t SignalLevel() { return voip_metric_.signalLevel; }
NoiseLevel()606   uint8_t NoiseLevel() { return voip_metric_.noiseLevel; }
Rerl()607   uint8_t Rerl() { return voip_metric_.RERL; }
Gmin()608   uint8_t Gmin() { return voip_metric_.Gmin; }
Rfactor()609   uint8_t Rfactor() { return voip_metric_.Rfactor; }
ExtRfactor()610   uint8_t ExtRfactor() { return voip_metric_.extRfactor; }
MosLq()611   uint8_t MosLq() { return voip_metric_.MOSLQ; }
MosCq()612   uint8_t MosCq() { return voip_metric_.MOSCQ; }
RxConfig()613   uint8_t RxConfig() { return voip_metric_.RXconfig; }
JbNominal()614   uint16_t JbNominal() { return voip_metric_.JBnominal; }
JbMax()615   uint16_t JbMax() { return voip_metric_.JBmax; }
JbAbsMax()616   uint16_t JbAbsMax() { return voip_metric_.JBabsMax; }
617 
618  private:
619   friend class RtcpPacketParser;
620 
Set(const RTCPUtility::RTCPPacketXRVOIPMetricItem & voip_metric)621   void Set(const RTCPUtility::RTCPPacketXRVOIPMetricItem& voip_metric) {
622     voip_metric_ = voip_metric;
623     ++num_packets_;
624   }
625 
626   RTCPUtility::RTCPPacketXRVOIPMetricItem voip_metric_;
627 };
628 
629 class RtcpPacketParser {
630  public:
631   RtcpPacketParser();
632   ~RtcpPacketParser();
633 
634   void Parse(const void *packet, size_t packet_len);
635 
sender_report()636   SenderReport* sender_report() { return &sender_report_; }
receiver_report()637   ReceiverReport* receiver_report() { return &receiver_report_; }
report_block()638   ReportBlock* report_block() { return &report_block_; }
sdes()639   Sdes* sdes() { return &sdes_; }
sdes_chunk()640   SdesChunk* sdes_chunk() { return &sdes_chunk_; }
bye()641   Bye* bye() { return &bye_; }
app()642   App* app() { return &app_; }
app_item()643   AppItem* app_item() { return &app_item_; }
ij()644   Ij* ij() { return &ij_; }
ij_item()645   IjItem* ij_item() { return &ij_item_; }
pli()646   Pli* pli() { return &pli_; }
sli()647   Sli* sli() { return &sli_; }
sli_item()648   SliItem* sli_item() { return &sli_item_; }
rpsi()649   Rpsi* rpsi() { return &rpsi_; }
fir()650   Fir* fir() { return &fir_; }
fir_item()651   FirItem* fir_item() { return &fir_item_; }
nack()652   Nack* nack() { return &nack_; }
nack_item()653   NackItem* nack_item() { return &nack_item_; }
psfb_app()654   PsfbApp* psfb_app() { return &psfb_app_; }
remb_item()655   RembItem* remb_item() { return &remb_item_; }
tmmbr()656   Tmmbr* tmmbr() { return &tmmbr_; }
tmmbr_item()657   TmmbrItem* tmmbr_item() { return &tmmbr_item_; }
tmmbn()658   Tmmbn* tmmbn() { return &tmmbn_; }
tmmbn_items()659   TmmbnItems* tmmbn_items() { return &tmmbn_items_; }
xr_header()660   XrHeader* xr_header() { return &xr_header_; }
rrtr()661   Rrtr* rrtr() { return &rrtr_; }
dlrr()662   Dlrr* dlrr() { return &dlrr_; }
dlrr_items()663   DlrrItems* dlrr_items() { return &dlrr_items_; }
voip_metric()664   VoipMetric* voip_metric() { return &voip_metric_; }
665 
report_blocks_per_ssrc(uint32_t ssrc)666   int report_blocks_per_ssrc(uint32_t ssrc) {
667     return report_blocks_per_ssrc_[ssrc];
668   }
669 
670  private:
671   SenderReport sender_report_;
672   ReceiverReport receiver_report_;
673   ReportBlock report_block_;
674   Sdes sdes_;
675   SdesChunk sdes_chunk_;
676   Bye bye_;
677   App app_;
678   AppItem app_item_;
679   Ij ij_;
680   IjItem ij_item_;
681   Pli pli_;
682   Sli sli_;
683   SliItem sli_item_;
684   Rpsi rpsi_;
685   Fir fir_;
686   FirItem fir_item_;
687   Nack nack_;
688   NackItem nack_item_;
689   PsfbApp psfb_app_;
690   RembItem remb_item_;
691   Tmmbr tmmbr_;
692   TmmbrItem tmmbr_item_;
693   Tmmbn tmmbn_;
694   TmmbnItems tmmbn_items_;
695   XrHeader xr_header_;
696   Rrtr rrtr_;
697   Dlrr dlrr_;
698   DlrrItems dlrr_items_;
699   VoipMetric voip_metric_;
700 
701   std::map<uint32_t, int> report_blocks_per_ssrc_;
702 };
703 }  // namespace test
704 }  // namespace webrtc
705 #endif  // WEBRTC_TEST_RTCP_PACKET_PARSER_H_
706