A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-ue-rrc.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef LTE_UE_RRC_H
22 #define LTE_UE_RRC_H
23 
24 #include <ns3/object.h>
25 #include <ns3/packet.h>
26 #include <ns3/lte-ue-cmac-sap.h>
27 #include <ns3/lte-pdcp-sap.h>
28 #include <ns3/lte-as-sap.h>
29 #include <ns3/lte-ue-cphy-sap.h>
30 #include <ns3/lte-rrc-sap.h>
31 #include <ns3/traced-callback.h>
32 
33 #include <map>
34 
35 namespace ns3 {
36 
37 class LteRlc;
38 class LteMacSapProvider;
39 class LteUeCmacSapUser;
40 class LteUeCmacSapProvider;
41 class LteDataRadioBearerInfo;
42 class LteSignalingRadioBearerInfo;
43 class LteEnbRrc;
44 
49 class LteUeRrc : public Object
50 {
51 
52  friend class UeMemberLteUeCmacSapUser;
53  friend class UeRrcMemberLteEnbCmacSapUser;
54  friend class LtePdcpSpecificLtePdcpSapUser<LteUeRrc>;
55  friend class MemberLteAsSapProvider<LteUeRrc>;
56  friend class MemberLteUeCphySapUser<LteUeRrc>;
57  friend class MemberLteUeRrcSapProvider<LteUeRrc>;
58 
59 public:
60 
65  enum State
66  {
67  IDLE_CELL_SELECTION = 0,
68  IDLE_WAIT_SYSTEM_INFO,
69  IDLE_CAMPED_NORMALLY,
70  IDLE_RANDOM_ACCESS,
71  IDLE_CONNECTING,
72  CONNECTED_NORMALLY,
73  CONNECTED_REESTABLISHING,
74  CONNECTED_HANDOVER,
75  NUM_STATES
76  };
77 
78 
83  LteUeRrc ();
84 
85 
89  virtual ~LteUeRrc ();
90 
91 
92  // inherited from Object
93 private:
94  virtual void DoInitialize (void);
95  virtual void DoDispose (void);
96 public:
97  static TypeId GetTypeId (void);
98 
99 
106 
113 
120 
127 
128 
135 
142 
151 
157  void SetAsSapUser (LteAsSapUser* s);
158 
165 
170  void SetImsi (uint64_t imsi);
171 
176  uint64_t GetImsi (void);
177 
178 
183  uint16_t GetRnti () const;
184 
185 
190  uint16_t GetCellId () const;
191 
192 
196  uint8_t GetUlBandwidth () const;
197 
201  uint8_t GetDlBandwidth () const;
202 
206  uint16_t GetDlEarfcn () const;
207 
211  uint16_t GetUlEarfcn () const;
212 
217  State GetState ();
218 
224  void SetUseRlcSm (bool val);
225 
226 
227 private:
228 
229 
230  // PDCP SAP methods
231  void DoReceivePdcpSdu (LtePdcpSapUser::ReceivePdcpSduParameters params);
232 
233  // CMAC SAP methods
234  void DoSetTemporaryCellRnti (uint16_t rnti);
235  void DoNotifyRandomAccessSuccessful ();
236  void DoNotifyRandomAccessFailed ();
237 
238  // LTE AS SAP methods
239  void DoForceCampedOnEnb (uint16_t cellId, uint16_t earfcn);
240  void DoConnect ();
241  void DoSendData (Ptr<Packet> packet, uint8_t bid);
242  void DoDisconnect ();
243 
244  // CPHY SAP methods
245  void DoRecvMasterInformationBlock (LteRrcSap::MasterInformationBlock msg);
246 
247  // RRC SAP methods
248  void DoCompleteSetup (LteUeRrcSapProvider::CompleteSetupParameters params);
249  void DoRecvSystemInformationBlockType1 (LteRrcSap::SystemInformationBlockType1 msg);
250  void DoRecvSystemInformation (LteRrcSap::SystemInformation msg);
251  void DoRecvRrcConnectionSetup (LteRrcSap::RrcConnectionSetup msg);
252  void DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfiguration msg);
253  void DoRecvRrcConnectionReestablishment (LteRrcSap::RrcConnectionReestablishment msg);
254  void DoRecvRrcConnectionReestablishmentReject (LteRrcSap::RrcConnectionReestablishmentReject msg);
255  void DoRecvRrcConnectionRelease (LteRrcSap::RrcConnectionRelease msg);
256  void DoRecvRrcConnectionReject (LteRrcSap::RrcConnectionReject msg);
257 
258 
259  // internal methods
260  void ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedicated rrcd);
261  void StartConnection ();
262  void LeaveConnectedMode ();
263  void DisposeOldSrb1 ();
264  uint8_t Bid2Drbid (uint8_t bid);
265  void SwitchToState (State s);
266 
267  std::map<uint8_t, uint8_t> m_bid2DrbidMap;
268 
269  LteUeCphySapUser* m_cphySapUser;
270  LteUeCphySapProvider* m_cphySapProvider;
271 
272  LteUeCmacSapUser* m_cmacSapUser;
273  LteUeCmacSapProvider* m_cmacSapProvider;
274 
275  LteUeRrcSapUser* m_rrcSapUser;
276  LteUeRrcSapProvider* m_rrcSapProvider;
277 
278  LteMacSapProvider* m_macSapProvider;
279  LtePdcpSapUser* m_drbPdcpSapUser;
280 
281  LteAsSapProvider* m_asSapProvider;
282  LteAsSapUser* m_asSapUser;
283 
284  State m_state;
285 
286  uint64_t m_imsi;
287  uint16_t m_rnti;
288  uint16_t m_cellId;
289 
293  std::map <uint8_t, Ptr<LteDataRadioBearerInfo> > m_drbMap;
294 
295  bool m_useRlcSm;
296 
297  uint8_t m_lastRrcTransactionIdentifier;
298 
299  uint8_t m_dlBandwidth;
300  uint8_t m_ulBandwidth;
302  uint16_t m_dlEarfcn;
303  uint16_t m_ulEarfcn;
305  // imsi cellid rnti
307  // imsi cellid rnti
308  TracedCallback<uint64_t, uint16_t, uint16_t> m_randomAccessSuccessfulTrace;
309  // imsi cellid rnti
310  TracedCallback<uint64_t, uint16_t, uint16_t> m_connectionEstablishedTrace;
311  // imsi cellid rnti
312  TracedCallback<uint64_t, uint16_t, uint16_t> m_connectionReconfigurationTrace;
313  // imsi cellid rnti targetCellId
315  // imsi cellid rnti
317 
322 };
323 
324 
325 } // namespace ns3
326 
327 #endif // LTE_UE_RRC_H
void SetAsSapUser(LteAsSapUser *s)
Definition: lte-ue-rrc.cc:262
virtual void DoDispose(void)
Definition: lte-ue-rrc.cc:150
void SetUseRlcSm(bool val)
Definition: lte-ue-rrc.cc:337
virtual ~LteUeRrc()
Definition: lte-ue-rrc.cc:144
uint16_t GetUlEarfcn() const
Definition: lte-ue-rrc.cc:322
bool m_connectionPending
Definition: lte-ue-rrc.h:318
uint64_t GetImsi(void)
Definition: lte-ue-rrc.cc:281
LteUeCmacSapUser * GetLteUeCmacSapUser()
Definition: lte-ue-rrc.cc:234
void SetLteUeRrcSapUser(LteUeRrcSapUser *s)
Definition: lte-ue-rrc.cc:241
uint16_t m_dlEarfcn
Definition: lte-ue-rrc.h:302
uint8_t m_dlBandwidth
Definition: lte-ue-rrc.h:299
virtual void DoInitialize(void)
Definition: lte-ue-rrc.cc:345
uint8_t GetUlBandwidth() const
Definition: lte-ue-rrc.cc:302
void SetLteUeCmacSapProvider(LteUeCmacSapProvider *s)
Definition: lte-ue-rrc.cc:227
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-ue-rrc.cc:255
void SetLteUeCphySapProvider(LteUeCphySapProvider *s)
Definition: lte-ue-rrc.cc:213
uint8_t GetDlBandwidth() const
Definition: lte-ue-rrc.cc:309
uint16_t GetDlEarfcn() const
Definition: lte-ue-rrc.cc:316
uint16_t m_ulEarfcn
Definition: lte-ue-rrc.h:303
uint8_t m_ulBandwidth
Definition: lte-ue-rrc.h:300
LteUeCphySapUser * GetLteUeCphySapUser()
Definition: lte-ue-rrc.cc:220
uint16_t GetRnti() const
Definition: lte-ue-rrc.cc:287
uint16_t GetCellId() const
Definition: lte-ue-rrc.cc:294
LteAsSapProvider * GetAsSapProvider()
Definition: lte-ue-rrc.cc:268
bool m_receivedSib2
Definition: lte-ue-rrc.h:320
a base class which provides memory management and object aggregation
Definition: object.h:63
LteUeRrcSapProvider * GetLteUeRrcSapProvider()
Definition: lte-ue-rrc.cc:248
a unique identifier for an interface.
Definition: type-id.h:44
void SetImsi(uint64_t imsi)
Definition: lte-ue-rrc.cc:274
bool m_receivedMib
Definition: lte-ue-rrc.h:319
State GetState()
Definition: lte-ue-rrc.cc:330