1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /** \addtogroup  RTP_Stack
18  *  @{
19  */
20 
21 #ifndef __RTCP_RR_PACKET_H__
22 #define __RTCP_RR_PACKET_H__
23 
24 #include <RtpGlobal.h>
25 #include <RtcpHeader.h>
26 #include <RtpBuffer.h>
27 #include <RtcpReportBlock.h>
28 #include <list>
29 
30 /**
31  * @class         rtcp_rr_packet
32  * @brief         It holds RR packet information
33  */
34 class RtcpRrPacket
35 {
36 private:
37     // RTCP header information
38     RtcpHeader m_objRtcpHdr;
39 
40     // List of RtcpReportBlock objects
41     std::list<RtcpReportBlock*> m_objReportBlkList;
42 
43     /**
44      * Extension header buffer. This is encoded and given by app.
45      * After decoding, ExtractExtHeaders, will update this with the extension
46      * header buffer
47      */
48     RtpBuffer* m_pobjExt;
49 
50     /**
51      * It adds RtcpReportBlock object to m_objReportBlkList
52      */
53     RtpDt_Void addReportBlkElm(IN RtcpReportBlock* pobjReptBlk);
54 
55 public:
56     // Constructor
57     RtcpRrPacket();
58     // Destructor
59     ~RtcpRrPacket();
60 
61     /**
62      * Set method for m_objRtcpHdr
63      */
64     RtpDt_Void setRtcpHdrInfo(RtcpHeader& objRtcpHdr);
65 
66     /**
67      * Get method for m_objRtcpHdr
68      */
69     RtcpHeader* getRtcpHdrInfo();
70 
71     /**
72      * get method for m_objReportBlkList
73      */
74     std::list<RtcpReportBlock*>& getReportBlockList();
75 
76     /**
77      * get method for m_pobjExt
78      */
79     RtpBuffer* getExtHdrInfo();
80 
81     /**
82      * set method for m_pobjExt
83      */
84     RtpDt_Void setExtHdrInfo(IN RtpBuffer* pobjExtHdr);
85 
86     /**
87      * Decodes and stores the information of the RTCP RR packet
88      * This function does not allocate memory required for decoding.
89      *
90      * @param pucRrBuf      Rr packet buffer
91      * @param usRrLen       Rr packet length
92      * @param usExtHdrLen   RTCP extension header length
93      *
94      * @return RTP_SUCCESS on successful decoding
95      */
96     eRTP_STATUS_CODE decodeRrPacket(
97             IN RtpDt_UChar* pucRrBuf, IN RtpDt_UInt16& usRrLen, IN RtpDt_UInt16 usProfExtLen);
98 
99     /**
100      * Performs the encoding of the RTCP RR packet.
101      * This function does not allocate memory required for encoding.
102      *
103      * @param pobjRtcpPktBuf    Memory for the buffer is pre-allocated by caller
104      * @param bHdrInfo          tells RTCP header shall be encoded or not.
105      *
106      * @return RTP_SUCCESS on successful encoding
107      */
108     eRTP_STATUS_CODE formRrPacket(OUT RtpBuffer* pobjRtcpPktBuf, IN eRtp_Bool bHdrInfo);
109 
110 };  // end of RtcpRrPacket
111 
112 #endif  //__RTCP_RR_PACKET_H__
113 
114 /** @}*/
115