aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_ms.h
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-06 18:30:48 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-05-20 11:30:41 +0200
commite04e0b0a20fb2b93855de0106873c90a88c53052 (patch)
treeec910e66d9fa4a16bfe5f97a86e29c027dd5f71f /src/gprs_ms.h
parent6eeb7c7e74ed8cc1e23b19453012f43563055e12 (diff)
ms: Add GprsMs class to hold per-MS information
Currently only TBF objects are used to handle the data flow between the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI) is copied between successive TBFs. If all TBFs (uplink and downlink) are idle for some time, all information about the MS is discarded in the PCU. This makes the implementation of some features more difficult, e.g. proper TLLI and timing advance handling, connection based CS selection, and proper management of multiple TBF. This commit adds the GprsMs class that is intended to hold information directly related to the MS and to keep references to the active TBFs. The class is not yet integrated with the other PCU code. A GprsMs object container and MS specific fields (TA, CS) will be added in later commits. Note that calling detach_tbf() can possibly delete the MS object depending on the callback implementation. Ticket: #1674 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_ms.h')
-rw-r--r--src/gprs_ms.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
new file mode 100644
index 00000000..a59fc5be
--- /dev/null
+++ b/src/gprs_ms.h
@@ -0,0 +1,79 @@
+/* gprs_ms.h
+ *
+ * Copyright (C) 2015 by Sysmocom s.f.m.c. GmbH
+ * Author: Jacob Erlbeck <jerlbeck@sysmocom.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+struct gprs_rlcmac_tbf;
+struct gprs_rlcmac_dl_tbf;
+struct gprs_rlcmac_ul_tbf;
+
+#include <stdint.h>
+#include <stddef.h>
+
+class GprsMs {
+public:
+ struct Callback {
+ virtual void ms_idle(class GprsMs *) = 0;
+ virtual void ms_active(class GprsMs *) = 0;
+ };
+
+ class Guard {
+ public:
+ Guard(GprsMs *ms);
+ ~Guard();
+
+ private:
+ GprsMs * const m_ms;
+ };
+
+ GprsMs(uint32_t tlli);
+ ~GprsMs();
+
+ void set_callback(Callback *cb) {m_cb = cb;}
+
+ gprs_rlcmac_ul_tbf *ul_tbf() const {return m_ul_tbf;}
+ gprs_rlcmac_dl_tbf *dl_tbf() const {return m_dl_tbf;}
+ uint32_t tlli() const {return m_tlli;}
+ void set_tlli(uint32_t tlli);
+
+ void attach_tbf(gprs_rlcmac_tbf *tbf);
+ void attach_ul_tbf(gprs_rlcmac_ul_tbf *tbf);
+ void attach_dl_tbf(gprs_rlcmac_dl_tbf *tbf);
+
+ void detach_tbf(gprs_rlcmac_tbf *tbf);
+
+ bool is_idle() const {return !m_ul_tbf && !m_dl_tbf && !m_ref;}
+
+ void* operator new(size_t num);
+ void operator delete(void* p);
+
+protected:
+ void update_status();
+ void ref();
+ void unref();
+
+private:
+ Callback * m_cb;
+ gprs_rlcmac_ul_tbf *m_ul_tbf;
+ gprs_rlcmac_dl_tbf *m_dl_tbf;
+ uint32_t m_tlli;
+ bool m_is_idle;
+ int m_ref;
+};