1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Danilo Abrignani
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  * Author: Danilo Abrignani <danilo.abrignani@unibo.it>
19  *
20  */
21 
22 #ifndef LTE_UE_COMPONENT_CARRIER_MANAGER_H
23 #define LTE_UE_COMPONENT_CARRIER_MANAGER_H
24 
25 #include <ns3/object.h>
26 #include <ns3/lte-rrc-sap.h>
27 #include <ns3/lte-ue-ccm-rrc-sap.h>
28 #include <ns3/lte-mac-sap.h>
29 #include <map>
30 #include <vector>
31 
32 #define MIN_NO_CC 1
33 #define MAX_NO_CC 5 // this is the maximum number of carrier components allowed by 3GPP up to R13
34 
35 namespace ns3 {
36 
37 
38 class LteUeCcmRrcSapUser;
39 class LteUeCcmRrcSapProvider;
40 
41 class LteMacSapUser;
42 class LteMacSapProvider;
43 
44 
45 /**
46  * \brief The abstract base class of a Component Carrier Manager* for UE
47   that operates using the component carrier manager SAP interface.
48  *
49  */
50 class LteUeComponentCarrierManager : public Object
51 {
52 
53 public:
54   LteUeComponentCarrierManager ();
55   virtual ~LteUeComponentCarrierManager ();
56 
57   /**
58    * \brief Get the type ID.
59    * \return the object TypeId
60    */
61   static TypeId GetTypeId ();
62 
63   /**
64    * \brief Set the "user" part of the ComponentCarrier Management SAP interface
65    * that this UE component carrier manager will interact with.
66    * \param s a reference to the "user" part of the interface, typically a
67    *          member of an LteEnbRrc instance
68    */
69   virtual void SetLteCcmRrcSapUser (LteUeCcmRrcSapUser* s);
70 
71   /**
72    * \brief Exports the "provider" part of the ComponentCarrier Management SAP interface.
73    * \return the reference to the "provider" part of the interface, typically to
74    *         be kept by an LteUeRrc instance
75    */
76   virtual LteUeCcmRrcSapProvider* GetLteCcmRrcSapProvider ();
77 
78   /**
79    * \brief Returns the MAC sap provider interface that if forwarding calls to the
80    * instance of the LteUeComponentCarrierManager.
81    * \return the reference to the "provider" part of the interface
82    */
83   virtual LteMacSapProvider* GetLteMacSapProvider () = 0;
84 
85   /**
86    * \brief Sets a pointer to SAP interface of MAC instance for the specified carrier.
87    * \param componentCarrierId the component carrier id
88    * \param sap the pointer to the sap interface
89    * \return whether the settings of the sap provider was successful
90    */
91   bool SetComponentCarrierMacSapProviders (uint8_t componentCarrierId, LteMacSapProvider* sap);
92 
93   /**
94    * \brief Sets number of component carriers that are supported by this UE.
95    * \param noOfComponentCarriers number of component carriers
96    */
97   void SetNumberOfComponentCarriers (uint8_t noOfComponentCarriers);
98 
99 protected:
100 
101   // inherited from Object
102   virtual void DoDispose ();
103 
104   LteUeCcmRrcSapUser* m_ccmRrcSapUser;//!< Interface to the UE RRC instance.
105   LteUeCcmRrcSapProvider* m_ccmRrcSapProvider; //!< Receive API calls from the UE RRC instance.
106 
107   std::map<uint8_t, LteMacSapUser*> m_lcAttached; //!< Map of pointers to SAP interfaces of the RLC instance of the flows of this UE.
108   std::map<uint8_t, std::map<uint8_t, LteMacSapProvider*> > m_componentCarrierLcMap; //!< Flow configuration per flow Id of this UE.
109   uint16_t m_noOfComponentCarriers; //!<// The number of component carriers that this UE can support.
110   std::map <uint8_t, LteMacSapProvider*> m_macSapProvidersMap; //!< Map of pointers to SAP to interfaces of the MAC instance if the flows of this UE.
111 
112 }; // end of class LteUeComponentCarrierManager
113 
114 
115 } // end of namespace ns3
116 
117 
118 #endif /* LTE_UE_COMPONENT_CARRIER_MANAGER_H */
119