1 /** \addtogroup  RTP_Stack
2  *  @{
3  */
4 
5 /**
6  * @brief This represents the RTP stack. This class stores one instance of a the stack.
7  * RTP sessions should be created as part of an RtpStack instance.
8  * Each instance can have any number of unrelated RTP sessions which share only the profile as
9  * defined by RtpStackProfile.
10  */
11 
12 /**
13  * Copyright (C) 2022 The Android Open Source Project
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  *      http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  */
27 
28 #ifndef __RTP_STACK_H__
29 #define __RTP_STACK_H__
30 
31 #include <RtpGlobal.h>
32 #include <RtpStackProfile.h>
33 #include <RtpSession.h>
34 #include <list>
35 
36 class RtpSession;
37 
38 class RtpStack
39 {
40     /**
41      * list of RtpSession currently active in the stack
42      */
43     std::list<RtpSession*> m_objRtpSessionList;
44 
45     /**
46      * Profile for this stack
47      */
48     RtpStackProfile* m_pobjStackProfile;
49 
50 public:
51     /**
52      * @brief Create stack with default profile
53      */
54     RtpStack();
55     /**
56      * @brief Delete stack
57      */
58     ~RtpStack();
59 
60     /**
61      * @brief Create stack with pobjStackProfile. However application can modify
62      * this profile at a later stage by using setStackProfile().
63      * @param pobjStackProfile Configure the stack as per profile.
64      */
65     RtpStack(IN RtpStackProfile* pobjStackProfile);
66 
67     /**
68      * @brief Creates a RTP session, assigns SSRC to it and adds to m_objRtpSessionList.
69      * @return Created RtpSession object pointer
70      */
71     RtpSession* createRtpSession();
72 
73     /**
74      * @brief finds whether pobjSession exists in RtpSessionList or not
75      * @param pobjSession pointer to RtpSession that has to be searched
76      * @return eRTP_SUCCESS if RTP session present in the m_objRtpSessionList
77      */
78     eRtp_Bool isValidRtpSession(IN RtpSession* pobjSession);
79 
80     /**
81      * @brief Finds and deletes the RTP session from m_objRtpSessionList.
82      * Memory of pobjSession will be freed
83      * @param pobjSession pointer to RtpSession that has to be deleted
84      * @return RTP_SUCCESS, if RTP session is deleted from m_objRtpSessionList
85      */
86     eRTP_STATUS_CODE deleteRtpSession(IN RtpSession* pobjSession);
87 
88     /**
89      * @brief Get method for m_pobjStackProfile
90      * @return current RtpStack profile
91      */
92     RtpStackProfile* getStackProfile();
93 
94     /**
95      * @brief Set method for m_pobjStackProfile
96      * @param pobjStackProfile pointer to RtpStack profile
97      */
98     RtpDt_Void setStackProfile(IN RtpStackProfile* pobjStackProfile);
99 };
100 
101 #endif  //__RTP_STACK_H__
102 
103 /** @}*/
104