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_PACKET_H__ 22 #define __RTCP_PACKET_H__ 23 24 #include <RtpGlobal.h> 25 #include <RtcpSrPacket.h> 26 #include <RtcpRrPacket.h> 27 #include <RtcpAppPacket.h> 28 #include <RtcpSdesPacket.h> 29 #include <RtcpByePacket.h> 30 #include <RtcpConfigInfo.h> 31 #include <RtcpXrPacket.h> 32 #include <RtcpFbPacket.h> 33 34 /** 35 * @class RtcpPacket.h 36 * @brief It holds RTCP information. Encodes and decodes RTCP packets. 37 */ 38 class RtcpPacket 39 { 40 private: 41 // Common header 42 RtcpHeader m_objHeader; 43 44 // list of RtcpSrPacket 45 std::list<RtcpSrPacket*> m_objSrPktList; 46 47 // list of RtcpRrPacket 48 std::list<RtcpRrPacket*> m_objRrPktList; 49 50 // list of RtcpFbPacket 51 std::list<RtcpFbPacket*> m_objFbPktList; 52 53 // SDES packet information 54 RtcpSdesPacket* m_pobjSdesPkt; 55 56 // Bye packet information 57 RtcpByePacket* m_pobjByePkt; 58 59 // App packet information 60 RtcpAppPacket* m_pobjAppPkt; 61 62 // XR packet information 63 RtcpXrPacket* m_pobjRtcpXrPkt; 64 65 public: 66 RtcpPacket(); 67 ~RtcpPacket(); 68 69 /** 70 * Get RTCP common header. 71 */ 72 RtcpHeader getHeader(); 73 74 /** 75 * Get method for m_objSrPktList 76 */ 77 std::list<RtcpSrPacket*>& getSrPacketList(); 78 79 /** 80 * Get method for m_objRrPktList 81 */ 82 std::list<RtcpRrPacket*>& getRrPacketList(); 83 84 /** 85 * Get method for m_objFbPktList 86 */ 87 std::list<RtcpFbPacket*>& getFbPacketList(); 88 89 /** 90 * Get method for m_pobjSdesPkt 91 */ 92 RtcpSdesPacket* getSdesPacket(); 93 94 /** 95 * Get method for m_pobjByePkt 96 */ 97 RtcpByePacket* getByePacket(); 98 99 /** 100 * Get method for m_pobjAppPkt 101 */ 102 RtcpAppPacket* getAppPacket(); 103 104 /** 105 * Get method for m_pobjRtcpXrPkt 106 */ 107 RtcpXrPacket* getXrPacket(); 108 109 /** 110 * It adds RtcpSrPacket pointer to m_objSrPktList 111 */ 112 eRTP_STATUS_CODE addSrPacketData(IN RtcpSrPacket* pobjSrPkt); 113 114 /** 115 * It adds RtcpRrPacket pointer to m_objRrPktList 116 */ 117 eRTP_STATUS_CODE addRrPacketData(IN RtcpRrPacket* pobjRrPkt); 118 119 /** 120 * It adds RtcpFbPacket pointer to m_objFbPktList 121 */ 122 eRTP_STATUS_CODE addFbPacketData(IN RtcpFbPacket* pobjFbPkt); 123 124 /** 125 * Set method for m_pobjSdesPkt 126 */ 127 RtpDt_Void setSdesPacketData(IN RtcpSdesPacket* pobjSdesData); 128 129 /** 130 * Set method for m_pobjByePkt 131 */ 132 RtpDt_Void setByePacketData(IN RtcpByePacket* pobjByePktData); 133 134 /** 135 * Set method for m_pobjAppPkt 136 */ 137 RtpDt_Void setAppPktData(IN RtcpAppPacket* pobjAppData); 138 139 /** 140 * Set method for m_pobjRtcpXrPkt 141 */ 142 RtpDt_Void setXrPacket(IN RtcpXrPacket* pobjRtcpXrData); 143 144 /** 145 * Decodes and stores the information of the RTCP packet 146 * This function does not allocate memory required for decoding. 147 * 148 * @param pobjRtcpPktBuf Memory for the buffer is pre-allocated by caller 149 * @param usExtHdrLen RTCP extension header length 150 * 151 * @return RTP_SUCCESS on successful decoding 152 */ 153 eRTP_STATUS_CODE decodeRtcpPacket(IN RtpBuffer* pobjRtcpPktBuf, IN RtpDt_UInt16 usExtHdrLen, 154 IN RtcpConfigInfo* pobjRtcpCfgInfo); 155 156 /** 157 * Performs the encoding of the RTCP packet. 158 * This function does not allocate memory required for encoding. 159 * 160 * @param pobjRtcpPktBuf Memory for the buffer is pre-allocated by caller 161 * 162 * @return RTP_SUCCESS on successful encoding 163 */ 164 eRTP_STATUS_CODE formRtcpPacket(OUT RtpBuffer* pobjRtcpPktBuf); 165 166 }; // end of RtcpPacket 167 168 #endif //__RTCP_PACKET_H__ 169 170 /** @}*/ 171