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_FB_PACKET_H__
22 #define __RTCP_FB_PACKET_H__
23 
24 #include <RtpGlobal.h>
25 #include <RtpBuffer.h>
26 #include <RtcpHeader.h>
27 
28 /**
29  * @class    RtcpFbPacket
30  * @brief    It holds RTCP Feedback Message information
31  *
32  */
33 class RtcpFbPacket
34 {
35 private:
36     // RTCP Fb header information
37     RtcpHeader m_objRtcpHdr;
38 
39     // Fb payload type
40     eRTCP_TYPE m_ePayloadType;
41 
42     // Media SSRC
43     RtpDt_UInt32 m_uiMediaSsrc;
44 
45     // Feedback Control Information
46     RtpBuffer* m_pFCI;
47 
48 public:
49     RtcpFbPacket();
50 
51     ~RtcpFbPacket();
52 
53     /**
54      * Set method for m_objRtcpHdr
55      */
56     RtpDt_Void setRtcpHdrInfo(RtcpHeader& objHeader);
57 
58     /**
59      * get method for m_objRtcpHdr
60      */
61     RtcpHeader* getRtcpHdrInfo();
62 
63     /**
64      * set method for SSRC
65      */
66     RtpDt_Void setSsrc(RtpDt_UInt32);
67 
68     /**
69      * set method for Media SSRC
70      */
71     RtpDt_Void setMediaSsrc(RtpDt_UInt32);
72 
73     /**
74      * get method for SSRC
75      */
76     RtpDt_UInt32 getSsrc();
77 
78     /**
79      * get method for Media SSRC
80      */
81     RtpDt_UInt32 getMediaSsrc();
82 
83     /**
84      * get method for FCI info from the RTCP packet
85      */
86     RtpBuffer* getFCI();
87 
88     /**
89      * set method for  FCI info from the RTCP packet
90      */
91     RtpDt_Void setFCI(IN RtpBuffer* m_pFCI);
92 
93     /**
94      * get method for Feedback payload type info from the RTCP packet
95      */
96     eRTCP_TYPE getPayloadType();
97 
98     /**
99      * set method for  Feedback payload type info from the RTCP packet
100      */
101     RtpDt_Void setPayloadType(IN eRTCP_TYPE ePayloadType);
102 
103     /**
104      * Decodes and stores the information of the RTCP FB packet
105      * This function does not allocate memory required for decoding.
106      *
107      * @param pucByeBuf received RTCP FB packet
108      * @param usByeLen length of the RTCP FB packet
109      */
110     eRTP_STATUS_CODE decodeRtcpFbPacket(IN RtpDt_UChar*, IN RtpDt_UInt16);
111 
112     /**
113      * Performs the encoding of the RTCP FB packet.
114      * This function does not allocate memory required for encoding.
115      * @param[out] pobjRtcpPktBuf Memory for the buffer is pre-allocated by caller
116      * @return RTP_SUCCESS on successful encoding
117      */
118     eRTP_STATUS_CODE formRtcpFbPacket(OUT RtpBuffer* pobjRtcpPktBuf);
119 
120 };  // end of RtcpFbPacket
121 
122 #endif  //__RTCP_FB_PACKET_H__
123 
124 /** @}*/
125