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_BYE_PACKET_H__
22 #define __RTCP_BYE_PACKET_H__
23 
24 #include <RtpGlobal.h>
25 #include <RtpBuffer.h>
26 #include <RtcpHeader.h>
27 #include <list>
28 
29 /**
30  * @class    RtcpByePacket
31  * @brief    It holds RTCP BYE information. Provides rtcp BYE packet packing and parsing function.
32  */
33 class RtcpByePacket
34 {
35 private:
36     RtcpHeader m_objRtcpHdr;
37     std::list<RtpDt_UInt32*> m_uiSsrcList;
38     RtpBuffer* m_pReason;
39 
40 public:
41     RtcpByePacket();
42     ~RtcpByePacket();
43 
44     /**
45      *  Set method for m_objRtcpHdr
46      */
47     RtpDt_Void setRtcpHdrInfo(RtcpHeader& objRtcpHeader);
48 
49     /**
50      *  Get method for m_objRtcpHdr
51      */
52     RtcpHeader* getRtcpHdrInfo();
53 
54     /**
55      * Get method for m_uiSsrcList
56      */
57     std::list<RtpDt_UInt32*>& getSsrcList();
58 
59     /**
60      * Get method for m_pReason
61      */
62     RtpBuffer* getReason();
63 
64     /**
65      * Set method for m_pAppData
66      */
67     RtpDt_Void setReason(IN RtpBuffer* pobjReason);
68 
69     /**
70      * Decodes and stores the information of the RTCP BYE packet
71      * This function does not allocate memory required for decoding.
72      * @param pucByeBuf received RTCP BYE packet
73      * @param usByeLen length of the RTCP BYE packet
74      */
75     eRTP_STATUS_CODE decodeByePacket(IN RtpDt_UChar* pucByeBuf, IN RtpDt_UInt16 usByeLen);
76 
77     /**
78      * Performs the encoding of the RTCP BYE packet.
79      * This function does not allocate memory required for encoding.
80      * @param pobjRtcpPktBuf Memory for the buffer is pre-allocated by caller
81      */
82     eRTP_STATUS_CODE formByePacket(OUT RtpBuffer* pobjRtcpPktBuf);
83 
84 };  // end of RtcpByePacket
85 
86 #endif  //__RTCP_BYE_PACKET_H__
87 
88 /** @}*/
89