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 _RTP_BUFFER_H_
22 #define _RTP_BUFFER_H_
23 
24 #include <RtpGlobal.h>
25 
26 /**
27  * @class    RtpBuffer
28  * @brief    It contains buffer with length
29  */
30 class RtpBuffer
31 {
32 private:
33     // It holds the length of the buffer
34     RtpDt_UInt32 m_uiLength;
35     // It holds the actual data
36     RtpDt_UChar* m_pBuffer;
37 
38 public:
39     // Constructor
40     RtpBuffer();
41 
42     /**
43      * Constructor
44      *
45      * @param uiLength Length of the buffer
46      *
47      * @param pBuffer value of the buffer.
48      */
49     RtpBuffer(IN RtpDt_UInt32 uiLength, IN RtpDt_UChar* pBuffer);
50 
51     // Destructor
52     ~RtpBuffer();
53 
54     /**
55      * It sets length to the RtpBuffer
56      * @param uiLen     Length of the buffer
57      */
58     RtpDt_Void setLength(IN RtpDt_UInt32 uiLen);
59 
60     /**
61      * It gets length from the RtpBuffer
62      *
63      * @return It returns the length
64      */
65     RtpDt_UInt32 getLength();
66 
67     /**
68      * It creates the buffer and cp input data to it
69      *
70      * @param   pBuff   Input buffer pointer.
71      */
72     RtpDt_Void setBuffer(IN RtpDt_UChar* pBuff);
73 
74     /**
75      * It gets the value from the RtpBuffer
76      *
77      * @return  It returns the buffer value pointer.
78      */
79     RtpDt_UChar* getBuffer();
80 
81     /**
82      * Utility function to set buffer information.
83      *
84      * @param uiLength  Length of the buffer
85      *
86      * @param pBuffer   Buffer pointer.
87      */
88     RtpDt_Void setBufferInfo(IN RtpDt_UInt32 uiLength, IN RtpDt_UChar* pBuffer);
89 };
90 
91 #endif /* _RTP_BUFFER_H_ */
92 /** @}*/
93