aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-26 14:47:16 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-26 14:47:16 +0200
commitea19c978160af32e4fee8001f5308518bcf4fd4c (patch)
tree67f0f61122510016788e5eec0acc8ee33edd9d24
parent94df39e905b9de424ecb40e9c54ddae0e7b6d4e3 (diff)
import gsm0502_calc_paging_group() from openbsc0.3.2
-rw-r--r--include/osmocom/gsm/gsm0502.h3
-rw-r--r--include/osmocom/gsm/rsl.h1
-rw-r--r--src/gsm/Makefile.am2
-rw-r--r--src/gsm/gsm0502.c43
4 files changed, 48 insertions, 1 deletions
diff --git a/include/osmocom/gsm/gsm0502.h b/include/osmocom/gsm/gsm0502.h
index de92c636..46b629e4 100644
--- a/include/osmocom/gsm/gsm0502.h
+++ b/include/osmocom/gsm/gsm0502.h
@@ -32,4 +32,7 @@ gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
return (imsi % 1000) % (bs_cc_chans * n_pag_blocks) % n_pag_blocks;
}
+unsigned int
+gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi);
+
#endif
diff --git a/include/osmocom/gsm/rsl.h b/include/osmocom/gsm/rsl.h
index 2eb045f2..44ded1b1 100644
--- a/include/osmocom/gsm/rsl.h
+++ b/include/osmocom/gsm/rsl.h
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <osmocom/core/utils.h>
+#include <osmocom/core/msgb.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type);
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 55b772f1..74893270 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -9,6 +9,6 @@ lib_LTLIBRARIES = libosmogsm.la
libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c gsm_utils.c \
rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \
- gprs_cipher_core.c gsm0480.c abis_nm.c
+ gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c
libosmogsm_la_LDFLAGS = -version-info $(LIBVERSION)
libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la
diff --git a/src/gsm/gsm0502.c b/src/gsm/gsm0502.c
new file mode 100644
index 00000000..df1d8e9e
--- /dev/null
+++ b/src/gsm/gsm0502.c
@@ -0,0 +1,43 @@
+/* Paging helper code */
+
+/* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * All Rights Reserved
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdint.h>
+
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+#include <osmocom/gsm/gsm0502.h>
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/gsm/rsl.h>
+
+unsigned int
+gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi)
+{
+ int ccch_conf;
+ int bs_cc_chans;
+ int blocks;
+ unsigned int group;
+
+ ccch_conf = chan_desc->ccch_conf;
+ bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
+ /* code word + 2, as 2 channels equals 0x0 */
+ blocks = gsm48_number_of_paging_subchannels(chan_desc);
+ group = gsm0502_get_paging_group(imsi, bs_cc_chans, blocks);
+
+ return group;
+}