summaryrefslogtreecommitdiffstats
path: root/Src/osmolib/src/shared/libosmocore/include
diff options
context:
space:
mode:
authorroot2012-02-28 14:15:19 +0100
committerroot2012-02-28 14:15:19 +0100
commit1116885d96725ce064db04604e4d197a136b163c (patch)
tree22ba472d309f1ac66918f09cc63bb9be057cf579 /Src/osmolib/src/shared/libosmocore/include
parentcompiled version added (diff)
downloadimsi-catcher-detection-1116885d96725ce064db04604e4d197a136b163c.tar.gz
imsi-catcher-detection-1116885d96725ce064db04604e4d197a136b163c.tar.xz
imsi-catcher-detection-1116885d96725ce064db04604e4d197a136b163c.zip
updated codebase to latest version of osmocombb
Diffstat (limited to 'Src/osmolib/src/shared/libosmocore/include')
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/Makefile.am11
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/conv.h67
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl59
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap.h62
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap_util.h9
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h160
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/logging.h5
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/msgb.h26
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/prim.h3
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer.h6
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer_compat.h79
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/core/utils.h3
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/Makefile.am2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/auth.h90
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/Makefile.am3
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/a5.h20
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/comp128.h2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smc.h62
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smr.h45
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_utils.h36
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0808.h3
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm48_ie.h2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapd_core.h171
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapdm.h60
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h6
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_11.h8
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h153
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/sysinfo.h2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/tlv.h42
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h2
-rw-r--r--Src/osmolib/src/shared/libosmocore/include/osmocom/vty/vty.h4
32 files changed, 1098 insertions, 107 deletions
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/Makefile.am b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/Makefile.am
index f131269..1df111a 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/Makefile.am
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/Makefile.am
@@ -2,8 +2,11 @@ osmocore_HEADERS = signal.h linuxlist.h timer.h select.h msgb.h bits.h \
bitvec.h statistics.h utils.h socket.h \
gsmtap.h write_queue.h prim.h \
logging.h rate_ctr.h gsmtap_util.h \
- crc16.h panic.h process.h \
- backtrace.h conv.h application.h
+ crc16.h panic.h process.h linuxrbtree.h \
+ backtrace.h conv.h application.h \
+ crcgen.h crc8gen.h crc16gen.h crc32gen.h crc64gen.h
+
+noinst_HEADERS = timer_compat.h
if ENABLE_PLUGIN
osmocore_HEADERS += plugin.h
@@ -22,3 +25,7 @@ osmocore_HEADERS += serial.h
endif
osmocoredir = $(includedir)/osmocom/core
+
+crc%gen.h: crcXXgen.h.tpl
+ @echo " SED $< -> $@"
+ @sed -e's/XX/$*/g' $< > $@
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/conv.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/conv.h
index db3058c..e76a5c6 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/conv.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/conv.h
@@ -35,25 +35,52 @@
#include <osmocom/core/bits.h>
-/*! \brief structure describing a given convolutional code */
+/*! \brief possibe termination types
+ *
+ * The termination type will determine which state the encoder/decoder
+ * can start/end with. This is mostly taken care of in the high level API
+ * call. So if you use the low level API, you must take care of making the
+ * proper calls yourself.
+ */
+enum osmo_conv_term {
+ CONV_TERM_FLUSH = 0, /*!< \brief Flush encoder state */
+ CONV_TERM_TRUNCATION, /*!< \brief Direct truncation */
+ CONV_TERM_TAIL_BITING, /*!< \brief Tail biting */
+};
+
+/*! \brief structure describing a given convolutional code
+ *
+ * The only required fields are N,K and the next_output/next_state arrays. The
+ * other can be left to default value of zero depending on what the code does.
+ * If 'len' is left at 0 then only the low level API can be used.
+ */
struct osmo_conv_code {
- int N;
- int K;
- int len;
+ int N; /*!< \brief Inverse of code rate */
+ int K; /*!< \brief Constraint length */
+ int len; /*!< \brief # of data bits */
+
+ enum osmo_conv_term term; /*!< \brief Termination type */
- const uint8_t (*next_output)[2];
- const uint8_t (*next_state)[2];
+ const uint8_t (*next_output)[2];/*!< \brief Next output array */
+ const uint8_t (*next_state)[2]; /*!< \brief Next state array */
- const uint8_t *next_term_output;
- const uint8_t *next_term_state;
+ const uint8_t *next_term_output;/*!< \brief Flush termination output */
+ const uint8_t *next_term_state; /*!< \brief Flush termination state */
- const int *puncture;
+ const int *puncture; /*!< \brief Punctured bits indexes */
};
+/* Common */
+
+int osmo_conv_get_input_length(const struct osmo_conv_code *code, int len);
+int osmo_conv_get_output_length(const struct osmo_conv_code *code, int len);
+
+
/* Encoding */
/* Low level API */
+
/*! \brief convolutional encoder state */
struct osmo_conv_encoder {
const struct osmo_conv_code *code; /*!< \brief for which code? */
@@ -64,9 +91,11 @@ struct osmo_conv_encoder {
void osmo_conv_encode_init(struct osmo_conv_encoder *encoder,
const struct osmo_conv_code *code);
+void osmo_conv_encode_load_state(struct osmo_conv_encoder *encoder,
+ const ubit_t *input);
int osmo_conv_encode_raw(struct osmo_conv_encoder *encoder,
const ubit_t *input, ubit_t *output, int n);
-int osmo_conv_encode_finish(struct osmo_conv_encoder *encoder, ubit_t *output);
+int osmo_conv_encode_flush(struct osmo_conv_encoder *encoder, ubit_t *output);
/* All-in-one */
int osmo_conv_encode(const struct osmo_conv_code *code,
@@ -76,10 +105,10 @@ int osmo_conv_encode(const struct osmo_conv_code *code,
/* Decoding */
/* Low level API */
+
/*! \brief convolutional decoder state */
struct osmo_conv_decoder {
- /*! \brief description of convolutional code */
- const struct osmo_conv_code *code;
+ const struct osmo_conv_code *code; /*!< \brief for which code? */
int n_states; /*!< \brief number of states */
@@ -88,22 +117,24 @@ struct osmo_conv_decoder {
int o_idx; /*!< \brief output index */
int p_idx; /*!< \brief puncture index */
- unsigned int *ae; /*!< \brief accumulater error */
+ unsigned int *ae; /*!< \brief accumulated error */
unsigned int *ae_next; /*!< \brief next accumulated error (tmp in scan) */
uint8_t *state_history; /*!< \brief state history [len][n_states] */
};
void osmo_conv_decode_init(struct osmo_conv_decoder *decoder,
- const struct osmo_conv_code *code, int len);
-void osmo_conv_decode_reset(struct osmo_conv_decoder *decoder);
+ const struct osmo_conv_code *code,
+ int len, int start_state);
+void osmo_conv_decode_reset(struct osmo_conv_decoder *decoder, int start_state);
+void osmo_conv_decode_rewind(struct osmo_conv_decoder *decoder);
void osmo_conv_decode_deinit(struct osmo_conv_decoder *decoder);
int osmo_conv_decode_scan(struct osmo_conv_decoder *decoder,
const sbit_t *input, int n);
-int osmo_conv_decode_finish(struct osmo_conv_decoder *decoder,
- const sbit_t *input);
+int osmo_conv_decode_flush(struct osmo_conv_decoder *decoder,
+ const sbit_t *input);
int osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder,
- ubit_t *output, int has_finish);
+ ubit_t *output, int has_flush, int end_state);
/* All-in-one */
int osmo_conv_decode(const struct osmo_conv_code *code,
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl
new file mode 100644
index 0000000..b411276
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl
@@ -0,0 +1,59 @@
+/*
+ * crcXXgen.h
+ *
+ * Copyright (C) 2011 Sylvain Munaut <tnt@246tNt.com>
+ *
+ * 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __OSMO_CRCXXGEN_H__
+#define __OSMO_CRCXXGEN_H__
+
+/*! \addtogroup crcgen
+ * @{
+ */
+
+/*! \file crcXXgen.h
+ * \file Osmocom generic CRC routines (for max XX bits poly) header
+ */
+
+
+#include <stdint.h>
+#include <osmocom/core/bits.h>
+
+
+/*! \brief structure describing a given CRC code of max XX bits */
+struct osmo_crcXXgen_code {
+ int bits; /*!< \brief Actual number of bits of the CRC */
+ uintXX_t poly; /*!< \brief Polynom (normal representation, MSB omitted */
+ uintXX_t init; /*!< \brief Initialization value of the CRC state */
+ uintXX_t remainder; /*!< \brief Remainder of the CRC (final XOR) */
+};
+
+uintXX_t osmo_crcXXgen_compute_bits(const struct osmo_crcXXgen_code *code,
+ const ubit_t *in, int len);
+int osmo_crcXXgen_check_bits(const struct osmo_crcXXgen_code *code,
+ const ubit_t *in, int len, const ubit_t *crc_bits);
+void osmo_crcXXgen_set_bits(const struct osmo_crcXXgen_code *code,
+ const ubit_t *in, int len, ubit_t *crc_bits);
+
+
+/*! }@ */
+
+#endif /* __OSMO_CRCXXGEN_H__ */
+
+/* vim: set syntax=c: */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap.h
index 236b25a..5dc869d 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap.h
@@ -14,6 +14,21 @@
#include <stdint.h>
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
+
+/* The GSMTAP format definition is maintained in libosmocore,
+ * specifically the latest version can always be obtained from
+ * http://cgit.osmocom.org/cgit/libosmocore/tree/include/osmocom/core/gsmtap.h
+ *
+ * If you want to introduce new protocol/burst/channel types or extend
+ * GSMTAP in any way, please contact the GSMTAP maintainer at either the
+ * public openbsc@lists.osmocom.org mailing list, or privately at
+ * Harald Welte <laforge@gnumonks.org>.
+ *
+ * Your cooperation ensures that all projects will use the same GSMTAP
+ * definitions and remain compatible with each other.
+ */
+
#define GSMTAP_VERSION 0x02
#define GSMTAP_TYPE_UM 0x01
@@ -22,6 +37,12 @@
#define GSMTAP_TYPE_SIM 0x04
#define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */
#define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */
+#define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */
+#define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */
+#define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */
+#define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */
+
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_UM_BURST */
#define GSMTAP_BURST_UNKNOWN 0x00
@@ -34,6 +55,15 @@
#define GSMTAP_BURST_DUMMY 0x07
#define GSMTAP_BURST_ACCESS 0x08
#define GSMTAP_BURST_NONE 0x09
+/* WiMAX bursts */
+#define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */
+#define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */
+#define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */
+#define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */
+#define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */
+#define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */
+
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_UM */
#define GSMTAP_CHANNEL_UNKNOWN 0x00
@@ -47,8 +77,15 @@
#define GSMTAP_CHANNEL_SDCCH8 0x08
#define GSMTAP_CHANNEL_TCH_F 0x09
#define GSMTAP_CHANNEL_TCH_H 0x0a
+#define GSMTAP_CHANNEL_PACCH 0x0b
+#define GSMTAP_CHANNEL_CBCH52 0x0c
+#define GSMTAP_CHANNEL_PDCH 0x0d
+#define GSMTAP_CHANNEL_PTCCH 0x0e
+#define GSMTAP_CHANNEL_CBCH51 0x0f
#define GSMTAP_CHANNEL_ACCH 0x80
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
+
/* sub-types for TYPE_TETRA_AIR */
#define GSMTAP_TETRA_BSCH 0x01
#define GSMTAP_TETRA_AACH 0x02
@@ -59,6 +96,30 @@
#define GSMTAP_TETRA_STCH 0x07
#define GSMTAP_TETRA_TCH_F 0x08
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
+
+/* sub-types for TYPE_GMR1_UM */
+#define GSMTAP_GMR1_UNKNOWN 0x00
+#define GSMTAP_GMR1_BCCH 0x01
+#define GSMTAP_GMR1_CCCH 0x02 /* either AGCH or PCH */
+#define GSMTAP_GMR1_PCH 0x03
+#define GSMTAP_GMR1_AGCH 0x04
+#define GSMTAP_GMR1_BACH 0x05
+#define GSMTAP_GMR1_RACH 0x06
+#define GSMTAP_GMR1_CBCH 0x07
+#define GSMTAP_GMR1_SDCCH 0x08
+#define GSMTAP_GMR1_TACCH 0x09
+#define GSMTAP_GMR1_GBCH 0x0a
+
+#define GSMTAP_GMR1_SACCH 0x01 /* to be combined with _TCH{6,9} */
+#define GSMTAP_GMR1_FACCH 0x02 /* to be combines with _TCH{3,6,9} */
+#define GSMTAP_GMR1_DKAB 0x03 /* to be combined with _TCH3 */
+#define GSMTAP_GMR1_TCH3 0x10
+#define GSMTAP_GMR1_TCH6 0x14
+#define GSMTAP_GMR1_TCH9 0x18
+
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
+
/* flags for the ARFCN */
#define GSMTAP_ARFCN_F_PCS 0x8000
#define GSMTAP_ARFCN_F_UPLINK 0x4000
@@ -67,6 +128,7 @@
/* IANA-assigned well-known UDP port for GSMTAP messages */
#define GSMTAP_UDP_PORT 4729
+/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
struct gsmtap_hdr {
uint8_t version; /* version, set to 0x01 currently */
uint8_t hdr_len; /* length in number of 32bit words */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap_util.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap_util.h
index 36cbf53..5609381 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap_util.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/gsmtap_util.h
@@ -12,6 +12,10 @@
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id);
+struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type,
+ uint8_t ss, uint32_t fn, int8_t signal_dbm,
+ uint8_t snr, const uint8_t *data, unsigned int len);
+
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
uint8_t ss, uint32_t fn, int8_t signal_dbm,
uint8_t snr, const uint8_t *data, unsigned int len);
@@ -40,6 +44,11 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti);
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg);
+int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts,
+ uint8_t chan_type, uint8_t ss, uint32_t fn,
+ int8_t signal_dbm, uint8_t snr, const uint8_t *data,
+ unsigned int len);
+
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
uint8_t chan_type, uint8_t ss, uint32_t fn,
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h
new file mode 100644
index 0000000..44e00a1
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h
@@ -0,0 +1,160 @@
+/*
+ Red Black Trees
+ (C) 1999 Andrea Arcangeli <andrea@suse.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
+
+ linux/include/linux/rbtree.h
+
+ To use rbtrees you'll have to implement your own insert and search cores.
+ This will avoid us to use callbacks and to drop drammatically performances.
+ I know it's not the cleaner way, but in C (not in C++) to get
+ performances and genericity...
+
+ Some example of insert and search follows here. The search is a plain
+ normal search over an ordered tree. The insert instead must be implemented
+ int two steps: as first thing the code must insert the element in
+ order as a red leaf in the tree, then the support library function
+ rb_insert_color() must be called. Such function will do the
+ not trivial work to rebalance the rbtree if necessary.
+
+-----------------------------------------------------------------------
+static inline struct page * rb_search_page_cache(struct inode * inode,
+ unsigned long offset)
+{
+ struct rb_node * n = inode->i_rb_page_cache.rb_node;
+ struct page * page;
+
+ while (n)
+ {
+ page = rb_entry(n, struct page, rb_page_cache);
+
+ if (offset < page->offset)
+ n = n->rb_left;
+ else if (offset > page->offset)
+ n = n->rb_right;
+ else
+ return page;
+ }
+ return NULL;
+}
+
+static inline struct page * __rb_insert_page_cache(struct inode * inode,
+ unsigned long offset,
+ struct rb_node * node)
+{
+ struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
+ struct rb_node * parent = NULL;
+ struct page * page;
+
+ while (*p)
+ {
+ parent = *p;
+ page = rb_entry(parent, struct page, rb_page_cache);
+
+ if (offset < page->offset)
+ p = &(*p)->rb_left;
+ else if (offset > page->offset)
+ p = &(*p)->rb_right;
+ else
+ return page;
+ }
+
+ rb_link_node(node, parent, p);
+
+ return NULL;
+}
+
+static inline struct page * rb_insert_page_cache(struct inode * inode,
+ unsigned long offset,
+ struct rb_node * node)
+{
+ struct page * ret;
+ if ((ret = __rb_insert_page_cache(inode, offset, node)))
+ goto out;
+ rb_insert_color(node, &inode->i_rb_page_cache);
+ out:
+ return ret;
+}
+-----------------------------------------------------------------------
+*/
+
+#ifndef _LINUX_RBTREE_H
+#define _LINUX_RBTREE_H
+
+#include <stdlib.h>
+
+struct rb_node
+{
+ unsigned long rb_parent_color;
+#define RB_RED 0
+#define RB_BLACK 1
+ struct rb_node *rb_right;
+ struct rb_node *rb_left;
+} __attribute__((aligned(sizeof(long))));
+ /* The alignment might seem pointless, but allegedly CRIS needs it */
+
+struct rb_root
+{
+ struct rb_node *rb_node;
+};
+
+
+#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3))
+#define rb_color(r) ((r)->rb_parent_color & 1)
+#define rb_is_red(r) (!rb_color(r))
+#define rb_is_black(r) rb_color(r)
+#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
+#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
+
+static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
+{
+ rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
+}
+static inline void rb_set_color(struct rb_node *rb, int color)
+{
+ rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
+}
+
+#define RB_ROOT { NULL, }
+#define rb_entry(ptr, type, member) container_of(ptr, type, member)
+
+#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
+#define RB_EMPTY_NODE(node) (rb_parent(node) == node)
+#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
+
+extern void rb_insert_color(struct rb_node *, struct rb_root *);
+extern void rb_erase(struct rb_node *, struct rb_root *);
+
+/* Find logical next and previous nodes in a tree */
+extern struct rb_node *rb_next(const struct rb_node *);
+extern struct rb_node *rb_prev(const struct rb_node *);
+extern struct rb_node *rb_first(const struct rb_root *);
+extern struct rb_node *rb_last(const struct rb_root *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+ struct rb_root *root);
+
+static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
+ struct rb_node ** rb_link)
+{
+ node->rb_parent_color = (unsigned long )parent;
+ node->rb_left = node->rb_right = NULL;
+
+ *rb_link = node;
+}
+
+#endif /* _LINUX_RBTREE_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/logging.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/logging.h
index 72e4c93..043a850 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/logging.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/logging.h
@@ -62,12 +62,13 @@ void logp(int subsys, char *file, int line, int cont, const char *format, ...) _
/* logging levels defined by the library itself */
#define DLGLOBAL -1
-#define DLLAPDM -2
+#define DLLAPD -2
#define DLINP -3
#define DLMUX -4
#define DLMI -5
#define DLMIB -6
-#define OSMO_NUM_DLIB 6
+#define DLSMS -7
+#define OSMO_NUM_DLIB 7
struct log_category {
uint8_t loglevel;
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/msgb.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/msgb.h
index 9f46e6c..e465ec2 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/msgb.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/msgb.h
@@ -312,6 +312,32 @@ static inline void msgb_reserve(struct msgb *msg, int len)
msg->tail += len;
}
+/*! \brief Trim the msgb to a given absolute length
+ * \param[in] msg message buffer
+ * \param[in] len new total length of buffer
+ * \returns 0 in case of success, negative in case of error
+ */
+static inline int msgb_trim(struct msgb *msg, int len)
+{
+ if (len > msg->data_len)
+ return -1;
+
+ msg->len = len;
+ msg->tail = msg->data + len;
+
+ return 0;
+}
+
+/*! \brief Trim the msgb to a given layer3 length
+ * \pram[in] msg message buffer
+ * \param[in] l3len new layer3 length
+ * \returns 0 in case of success, negative in case of error
+ */
+static inline int msgb_l3trim(struct msgb *msg, int l3len)
+{
+ return msgb_trim(msg, (msg->l3h - msg->data) + l3len);
+}
+
/*! \brief Allocate message buffer with specified headroom
* \param[in] size size in bytes, including headroom
* \param[in] headroom headroom in bytes
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/prim.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/prim.h
index 2e60c46..b1026fe 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/prim.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/prim.h
@@ -10,6 +10,9 @@
#include <stdint.h>
#include <osmocom/core/msgb.h>
+#define OSMO_PRIM(prim, op) ((prim << 8) | (op & 0xFF))
+#define OSMO_PRIM_HDR(oph) OSMO_PRIM((oph)->primitive, (oph)->operation)
+
/*! \brief primitive operation */
enum osmo_prim_operation {
PRIM_OP_REQUEST, /*!< \brief request */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer.h
index 8f8c826..30f558b 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer.h
@@ -32,6 +32,7 @@
#include <sys/time.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/linuxrbtree.h>
/**
* Timer management:
@@ -51,11 +52,10 @@
*/
/*! \brief A structure representing a single instance of a timer */
struct osmo_timer_list {
- struct llist_head entry; /*!< \brief linked list header */
+ struct rb_node node; /*!< \brief rb-tree node header */
+ struct llist_head list; /*!< \brief internal list header */
struct timeval timeout; /*!< \brief expiration time */
unsigned int active : 1; /*!< \brief is it active? */
- unsigned int handled : 1; /*!< \brief did we already handle it */
- unsigned int in_list : 1; /*!< \brief is it in the global list? */
void (*cb)(void*); /*!< \brief call-back called at timeout */
void *data; /*!< \brief user data for callback */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer_compat.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer_compat.h
new file mode 100644
index 0000000..209e84a
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/timer_compat.h
@@ -0,0 +1,79 @@
+/*
+ * (C) 2011 Sylvain Munaut <tnt@246tNt.com>
+ * 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+/*! \defgroup timer Osmocom timers
+ * @{
+ */
+
+/*! \file timer_compat.h
+ * \brief Compatibility header with some helpers
+ */
+
+#ifndef TIMER_COMPAT_H
+#define TIMER_COMPAT_H
+
+
+/* Convenience macros for operations on timevals.
+ NOTE: `timercmp' does not work for >= or <=. */
+
+#ifndef timerisset
+# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#endif
+
+#ifndef timerclear
+# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+#endif
+
+#ifndef timercmp
+# define timercmp(a, b, CMP) \
+ (((a)->tv_sec == (b)->tv_sec) ? \
+ ((a)->tv_usec CMP (b)->tv_usec) : \
+ ((a)->tv_sec CMP (b)->tv_sec))
+#endif
+
+#ifndef timeradd
+# define timeradd(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
+ if ((result)->tv_usec >= 1000000) \
+ { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#endif
+
+#ifndef timersub
+# define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
+
+
+/*! }@ */
+
+#endif /* TIMER_COMPAT_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/utils.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/utils.h
index 940c25f..f1843d9 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/core/utils.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/core/utils.h
@@ -34,7 +34,8 @@ int osmo_hexparse(const char *str, uint8_t *b, int max_len);
char *osmo_ubit_dump(const uint8_t *bits, unsigned int len);
char *osmo_hexdump(const unsigned char *buf, int len);
-char *osmo_osmo_hexdump_nospc(const unsigned char *buf, int len);
+char *osmo_hexdump_nospc(const unsigned char *buf, int len);
+char *osmo_osmo_hexdump_nospc(const unsigned char *buf, int len) __attribute__((__deprecated__));
#define osmo_static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/Makefile.am b/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/Makefile.am
index 7ce69fd..e4a6e53 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/Makefile.am
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/Makefile.am
@@ -1,3 +1,3 @@
-osmocrypt_HEADERS = gprs_cipher.h
+osmocrypt_HEADERS = gprs_cipher.h auth.h
osmocryptdir = $(includedir)/osmocom/crypt
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/auth.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/auth.h
new file mode 100644
index 0000000..30e16e8
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/crypt/auth.h
@@ -0,0 +1,90 @@
+#ifndef _OSMOCRYPTO_AUTH_H
+#define _OSMOCRYPTO_AUTH_H
+
+#include <stdint.h>
+
+#include <osmocom/core/linuxlist.h>
+
+/*! \brief Authentication Type */
+enum osmo_sub_auth_type {
+ OSMO_AUTH_TYPE_NONE = 0x00,
+ OSMO_AUTH_TYPE_GSM = 0x01,
+ OSMO_AUTH_TYPE_UMTS = 0x02,
+};
+
+/*! \brief Authentication Algorithm */
+enum osmo_auth_algo {
+ OSMO_AUTH_ALG_NONE,
+ OSMO_AUTH_ALG_COMP128v1,
+ OSMO_AUTH_ALG_COMP128v2,
+ OSMO_AUTH_ALG_COMP128v3,
+ OSMO_AUTH_ALG_XOR,
+ OSMO_AUTH_ALG_MILENAGE,
+ _OSMO_AUTH_ALG_NUM,
+};
+
+/*! \brief permanent (secret) subscriber auth data */
+struct osmo_sub_auth_data {
+ enum osmo_sub_auth_type type;
+ enum osmo_auth_algo algo;
+ union {
+ struct {
+ uint8_t opc[16];
+ uint8_t k[16];
+ uint8_t amf[2];
+ uint64_t sqn;
+ } umts;
+ struct {
+ uint8_t ki[16];
+ } gsm;
+ } u;
+};
+
+/* data structure describing a computed auth vector, generated by AuC */
+struct osmo_auth_vector {
+ uint8_t rand[16];
+ uint8_t autn[16];
+ uint8_t ck[16];
+ uint8_t ik[16];
+ uint8_t res[16];
+ uint8_t res_len;
+ uint8_t kc[8];
+ uint8_t sres[4];
+ uint32_t auth_types; /*!< bitmask of OSMO_AUTH_TYPE_* */
+};
+
+/* \brief An implementation of an authentication algorithm */
+struct osmo_auth_impl {
+ struct llist_head list;
+ enum osmo_auth_algo algo;
+ const char *name;
+ unsigned int priority;
+
+ int (*gen_vec)(struct osmo_auth_vector *vec,
+ struct osmo_sub_auth_data *aud,
+ const uint8_t *_rand);
+
+ int (*gen_vec_auts)(struct osmo_auth_vector *vec,
+ struct osmo_sub_auth_data *aud,
+ const uint8_t *rand_auts, const uint8_t *auts,
+ const uint8_t *_rand);
+};
+
+int osmo_auth_gen_vec(struct osmo_auth_vector *vec,
+ struct osmo_sub_auth_data *aud, const uint8_t *_rand);
+
+int osmo_auth_gen_vec_auts(struct osmo_auth_vector *vec,
+ struct osmo_sub_auth_data *aud,
+ const uint8_t *rand_auts, const uint8_t *auts,
+ const uint8_t *_rand);
+
+int osmo_auth_register(struct osmo_auth_impl *impl);
+
+int osmo_auth_load(const char *path);
+
+int osmo_auth_supported(enum osmo_auth_algo algo);
+
+const char *osmo_auth_alg_name(enum osmo_auth_algo alg);
+enum osmo_auth_algo osmo_auth_alg_parse(const char *name);
+
+#endif /* _OSMOCRYPTO_AUTH_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/Makefile.am b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/Makefile.am
index 90f19bc..fc1abfe 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/Makefile.am
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/Makefile.am
@@ -1,6 +1,7 @@
osmogsm_HEADERS = a5.h comp128.h gsm0808.h gsm48_ie.h mncc.h rxlev_stat.h \
gsm0480.h gsm48.h gsm_utils.h rsl.h tlv.h abis_nm.h \
- sysinfo.h prim.h gsm0502.h lapdm.h
+ sysinfo.h prim.h gsm0502.h lapd_core.h lapdm.h \
+ gsm0411_utils.h gsm0411_smc.h gsm0411_smr.h
SUBDIRS = protocol
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/a5.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/a5.h
index 2c630e5..7e6a17c 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/a5.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/a5.h
@@ -27,6 +27,18 @@
#include <osmocom/core/bits.h>
+/*! \defgroup a5 GSM A5 ciphering algorithm
+ * @{
+ */
+
+/*! \file gsm/a5.h
+ * \brief Osmocom GSM A5 ciphering algorithm header
+ */
+
+/*! \brief Converts a frame number into the 22 bit number used in A5/x
+ * \param[in] fn The true framenumber
+ * \return 22 bit word
+ */
static inline uint32_t
osmo_a5_fn_count(uint32_t fn)
{
@@ -42,8 +54,10 @@ osmo_a5_fn_count(uint32_t fn)
* - fn is the _real_ GSM frame number.
* (converted internally to fn_count)
*/
-void osmo_a5(int n, uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
-void osmo_a5_1(uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
-void osmo_a5_2(uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
+void osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
+void osmo_a5_1(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
+void osmo_a5_2(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
+
+/*! }@ */
#endif /* __OSMO_A5_H__ */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/comp128.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/comp128.h
index c37808f..e4587d4 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/comp128.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/comp128.h
@@ -16,7 +16,7 @@
* sres : uint8_t [4]
* kc : uint8_t [8]
*/
-void comp128(uint8_t *ki, uint8_t *srand, uint8_t *sres, uint8_t *kc);
+void comp128(const uint8_t *ki, const uint8_t *srand, uint8_t *sres, uint8_t *kc);
#endif /* __COMP128_H__ */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smc.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smc.h
new file mode 100644
index 0000000..e1508a2
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smc.h
@@ -0,0 +1,62 @@
+#ifndef _GSM0411_SMC_H
+#define _GSM0411_SMC_H
+
+#include <osmocom/gsm/protocol/gsm_04_11.h>
+
+#define GSM411_MMSMS_EST_REQ 0x310
+#define GSM411_MMSMS_EST_IND 0x312
+#define GSM411_MMSMS_EST_CNF 0x311
+#define GSM411_MMSMS_REL_REQ 0x320
+#define GSM411_MMSMS_REL_IND 0x322
+#define GSM411_MMSMS_DATA_REQ 0x330
+#define GSM411_MMSMS_DATA_IND 0x332
+#define GSM411_MMSMS_UNIT_DATA_REQ 0x340
+#define GSM411_MMSMS_UNIT_DATA_IND 0x342
+#define GSM411_MMSMS_ERR_IND 0x372
+
+#define GSM411_MNSMS_ABORT_REQ 0x101
+#define GSM411_MNSMS_DATA_REQ 0x102
+#define GSM411_MNSMS_DATA_IND 0x103
+#define GSM411_MNSMS_EST_REQ 0x104
+#define GSM411_MNSMS_EST_IND 0x105
+#define GSM411_MNSMS_ERROR_IND 0x106
+#define GSM411_MNSMS_REL_REQ 0x107
+
+struct gsm411_smc_inst {
+ int network; /* is this a MO (0) or MT (1) transfer */
+ int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg);
+ int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg, int cp_msg_type);
+
+ enum gsm411_cp_state cp_state;
+ struct osmo_timer_list cp_timer;
+ struct msgb *cp_msg; /* store pending message */
+ int cp_rel; /* store pending release */
+ int cp_retx; /* retry counter */
+ int cp_max_retr; /* maximum retry */
+ int cp_tc1; /* timer value TC1* */
+
+};
+
+extern const struct value_string gsm411_cp_cause_strs[];
+
+/* init a new instance */
+void gsm411_smc_init(struct gsm411_smc_inst *inst, int network,
+ int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg),
+ int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg, int cp_msg_type));
+
+/* clear instance */
+void gsm411_smc_clear(struct gsm411_smc_inst *inst);
+
+/* message from upper layer */
+int gsm411_smc_send(struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg);
+
+/* message from lower layer */
+int gsm411_smc_recv(struct gsm411_smc_inst *inst, int msg_type,
+ struct msgb *msg, int cp_msg_type);
+
+#endif /* _GSM0411_SMC_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smr.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smr.h
new file mode 100644
index 0000000..5ea8584
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_smr.h
@@ -0,0 +1,45 @@
+#ifndef _GSM0411_SMR_H
+#define _GSM0411_SMR_H
+
+#include <osmocom/gsm/protocol/gsm_04_11.h>
+
+#define GSM411_SM_RL_DATA_REQ 0x401
+#define GSM411_SM_RL_DATA_IND 0x402
+#define GSM411_SM_RL_MEM_AVAIL_REQ 0x403
+#define GSM411_SM_RL_MEM_AVAIL_IND 0x404
+#define GSM411_SM_RL_REPORT_REQ 0x405
+#define GSM411_SM_RL_REPORT_IND 0x406
+
+struct gsm411_smr_inst {
+ int network; /* is this a MO (0) or MT (1) transfer */
+ int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg);
+ int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg);
+
+ enum gsm411_rp_state rp_state;
+ struct osmo_timer_list rp_timer;
+};
+
+extern const struct value_string gsm411_rp_cause_strs[];
+
+/* init a new instance */
+void gsm411_smr_init(struct gsm411_smr_inst *inst, int network,
+ int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg),
+ int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg));
+
+/* clear instance */
+void gsm411_smr_clear(struct gsm411_smr_inst *inst);
+
+/* message from upper layer */
+int gsm411_smr_send(struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg);
+
+/* message from lower layer */
+int gsm411_smr_recv(struct gsm411_smr_inst *inst, int msg_type,
+ struct msgb *msg);
+
+#endif /* _GSM0411_SMR_H */
+
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_utils.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_utils.h
new file mode 100644
index 0000000..d29ca63
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0411_utils.h
@@ -0,0 +1,36 @@
+#ifndef _GSM0411_UTILS_H
+#define _GSM0411_UTILS_H
+
+/* Turn int into semi-octet representation: 98 => 0x89 */
+uint8_t gsm411_bcdify(uint8_t value);
+
+/* Turn semi-octet representation into int: 0x89 => 98 */
+uint8_t gsm411_unbcdify(uint8_t value);
+
+struct msgb *gsm411_msgb_alloc(void);
+
+/* Generate 03.40 TP-SCTS */
+void gsm340_gen_scts(uint8_t *scts, time_t time);
+
+/* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
+time_t gsm340_scts(uint8_t *scts);
+
+/* decode validity period. return minutes */
+unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp);
+
+/* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */
+enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs);
+
+/* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */
+int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type,
+ uint8_t plan, const char *number);
+
+/* Prefix msg with a RP header */
+int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type,
+ uint8_t rp_msg_ref);
+
+/* Prefix msg with a 04.08/04.11 CP header */
+int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans,
+ uint8_t msg_type);
+
+#endif /* _GSM0411_UTILS_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0808.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0808.h
index 38d88ef..5380dd9 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0808.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm0808.h
@@ -30,7 +30,8 @@ struct msgb *gsm0808_create_clear_command(uint8_t reason);
struct msgb *gsm0808_create_clear_complete(void);
struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id);
struct msgb *gsm0808_create_cipher_reject(uint8_t cause);
-struct msgb *gsm0808_create_classmark_update(const uint8_t *classmark, uint8_t length);
+struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len,
+ const uint8_t *cm3, uint8_t cm3_len);
struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
uint8_t chosen_channel, uint8_t encr_alg_id,
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm48_ie.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm48_ie.h
index f4fce25..2e57642 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm48_ie.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/gsm48_ie.h
@@ -108,7 +108,7 @@ int gsm48_encode_more(struct msgb *msg);
struct gsm_sysinfo_freq {
/* if the frequency included in the sysinfo */
uint8_t mask;
-};
+} __attribute__ ((packed));
/* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */
int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd,
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapd_core.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapd_core.h
new file mode 100644
index 0000000..0f4e889
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapd_core.h
@@ -0,0 +1,171 @@
+#ifndef _OSMOCOM_LAPD_H
+#define _OSMOCOM_LAPD_H
+
+#include <stdint.h>
+
+#include <osmocom/core/timer.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/prim.h>
+
+/*! \defgroup lapd LAPD implementation common part
+ * @{
+ */
+
+/*! \file lapd.h */
+
+/* primitive related sutff */
+
+/*! \brief LAPD related primitives (L2<->L3 SAP)*/
+enum osmo_dl_prim {
+ PRIM_DL_UNIT_DATA, /*!< \brief DL-UNIT-DATA */
+ PRIM_DL_DATA, /*!< \brief DL-DATA */
+ PRIM_DL_EST, /*!< \brief DL-ESTABLISH */
+ PRIM_DL_REL, /*!< \brief DL-RLEEASE */
+ PRIM_DL_SUSP, /*!< \brief DL-SUSPEND */
+ PRIM_DL_RES, /*!< \brief DL-RESUME */
+ PRIM_DL_RECON, /*!< \brief DL-RECONNECT */
+ PRIM_MDL_ERROR, /*!< \brief MDL-ERROR */
+};
+
+/* Uses the same values as RLL, so no conversion for GSM is required. */
+#define MDL_CAUSE_T200_EXPIRED 0x01
+#define MDL_CAUSE_REEST_REQ 0x02
+#define MDL_CAUSE_UNSOL_UA_RESP 0x03
+#define MDL_CAUSE_UNSOL_DM_RESP 0x04
+#define MDL_CAUSE_UNSOL_DM_RESP_MF 0x05
+#define MDL_CAUSE_UNSOL_SPRV_RESP 0x06
+#define MDL_CAUSE_SEQ_ERR 0x07
+#define MDL_CAUSE_UFRM_INC_PARAM 0x08
+#define MDL_CAUSE_SFRM_INC_PARAM 0x09
+#define MDL_CAUSE_IFRM_INC_MBITS 0x0a
+#define MDL_CAUSE_IFRM_INC_LEN 0x0b
+#define MDL_CAUSE_FRM_UNIMPL 0x0c
+#define MDL_CAUSE_SABM_MF 0x0d
+#define MDL_CAUSE_SABM_INFO_NOTALL 0x0e
+#define MDL_CAUSE_FRMR 0x0f
+
+/*! \brief for MDL-ERROR.ind */
+struct mdl_error_ind_param {
+ uint8_t cause; /*!< \brief generic cause value */
+};
+
+/*! \brief for DL-REL.req */
+struct dl_rel_req_param {
+ uint8_t mode; /*!< \brief release mode */
+};
+
+/*! \brief primitive header for LAPD DL-SAP primitives */
+struct osmo_dlsap_prim {
+ struct osmo_prim_hdr oph; /*!< \brief generic primitive header */
+ union {
+ struct mdl_error_ind_param error_ind;
+ struct dl_rel_req_param rel_req;
+ } u; /*!< \brief request-specific data */
+};
+
+/*! \brief LAPD mode/role */
+enum lapd_mode {
+ LAPD_MODE_USER, /*!< \brief behave like user */
+ LAPD_MODE_NETWORK, /*!< \brief behave like network */
+};
+
+/*! \brief LAPD state (Figure B.2/Q.921)*/
+enum lapd_state {
+ LAPD_STATE_NULL = 0,
+ LAPD_STATE_TEI_UNASS,
+ LAPD_STATE_ASS_TEI_WAIT,
+ LAPD_STATE_EST_TEI_WAIT,
+ LAPD_STATE_IDLE,
+ LAPD_STATE_SABM_SENT,
+ LAPD_STATE_DISC_SENT,
+ LAPD_STATE_MF_EST,
+ LAPD_STATE_TIMER_RECOV,
+};
+
+/*! \brief LAPD message format (I / S / U) */
+enum lapd_format {
+ LAPD_FORM_UKN = 0,
+ LAPD_FORM_I,
+ LAPD_FORM_S,
+ LAPD_FORM_U,
+};
+
+/*! \brief LAPD message context */
+struct lapd_msg_ctx {
+ struct lapd_datalink *dl;
+ int n201;
+ /* address */
+ uint8_t cr;
+ uint8_t sapi;
+ uint8_t tei;
+ uint8_t lpd;
+ /* control */
+ uint8_t format;
+ uint8_t p_f; /* poll / final bit */
+ uint8_t n_send;
+ uint8_t n_recv;
+ uint8_t s_u; /* S or repectivly U function bits */
+ /* length */
+ int length;
+ uint8_t more;
+};
+
+struct lapd_cr_ent {
+ uint8_t cmd;
+ uint8_t resp;
+};
+
+struct lapd_history {
+ struct msgb *msg; /* message to be sent / NULL, if histoy is empty */
+ int more; /* if message is fragmented */
+};
+
+/*! \brief LAPD datalink */
+struct lapd_datalink {
+ int (*send_dlsap)(struct osmo_dlsap_prim *dp,
+ struct lapd_msg_ctx *lctx);
+ int (*send_ph_data_req)(struct lapd_msg_ctx *lctx, struct msgb *msg);
+ struct {
+ /*! \brief filled-in once we set the lapd_mode above */
+ struct lapd_cr_ent loc2rem;
+ struct lapd_cr_ent rem2loc;
+ } cr;
+ enum lapd_mode mode; /*!< \brief current mode of link */
+ int use_sabme; /*!< \brief use SABME instead of SABM */
+ int reestablish; /*!< \brief enable reestablish support */
+ int n200, n200_est_rel; /*!< \brief number of retranmissions */
+ struct lapd_msg_ctx lctx; /*!< \brief LAPD context */
+ int maxf; /*!< \brief maximum frame size (after defragmentation) */
+ uint8_t k; /*!< \brief maximum number of unacknowledged frames */
+ uint8_t v_range; /*!< \brief range of sequence numbers */
+ uint8_t v_send; /*!< \brief seq nr of next I frame to be transmitted */
+ uint8_t v_ack; /*!< \brief last frame ACKed by peer */
+ uint8_t v_recv; /*!< \brief seq nr of next I frame expected to be received */
+ uint32_t state; /*!< \brief LAPD state (\ref lapd_state) */
+ int seq_err_cond; /*!< \brief condition of sequence error */
+ uint8_t own_busy; /*!< \brief receiver busy on our side */
+ uint8_t peer_busy; /*!< \brief receiver busy on remote side */
+ int t200_sec, t200_usec; /*!< \brief retry timer (default 1 sec) */
+ int t203_sec, t203_usec; /*!< \brief retry timer (default 10 secs) */
+ struct osmo_timer_list t200; /*!< \brief T200 timer */
+ struct osmo_timer_list t203; /*!< \brief T203 timer */
+ uint8_t retrans_ctr; /*!< \brief re-transmission counter */
+ struct llist_head tx_queue; /*!< \brief frames to L1 */
+ struct llist_head send_queue; /*!< \brief frames from L3 */
+ struct msgb *send_buffer; /*!< \brief current frame transmitting */
+ int send_out; /*!< \brief how much was sent from send_buffer */
+ struct lapd_history *tx_hist; /*!< \brief tx history structure array */
+ uint8_t range_hist; /*!< \brief range of history buffer 2..2^n */
+ struct msgb *rcv_buffer; /*!< \brief buffer to assemble the received message */
+ struct msgb *cont_res; /*!< \brief buffer to store content resolution data on network side, to detect multiple phones on same channel */
+};
+
+void lapd_dl_init(struct lapd_datalink *dl, uint8_t k, uint8_t v_range,
+ int maxf);
+void lapd_dl_exit(struct lapd_datalink *dl);
+void lapd_dl_reset(struct lapd_datalink *dl);
+int lapd_set_mode(struct lapd_datalink *dl, enum lapd_mode mode);
+int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx);
+int lapd_recv_dlsap(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx);
+
+#endif /* _OSMOCOM_LAPD_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapdm.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
index b71feef..52e8fc5 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
@@ -1,11 +1,7 @@
#ifndef _OSMOCOM_LAPDM_H
#define _OSMOCOM_LAPDM_H
-#include <stdint.h>
-
-#include <osmocom/core/timer.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/gsm/prim.h>
+#include <osmocom/gsm/lapd_core.h>
/*! \defgroup lapdm LAPDm implementation according to GSM TS 04.06
* @{
@@ -15,7 +11,7 @@
/* primitive related sutff */
-/*! \brief LAPDm related primitives */
+/*! \brief LAPDm related primitives (L1<->L2 SAP) */
enum osmo_ph_prim {
PRIM_PH_DATA, /*!< \brief PH-DATA */
PRIM_PH_RACH, /*!< \brief PH-RANDOM_ACCESS */
@@ -68,52 +64,22 @@ enum lapdm_mode {
LAPDM_MODE_BTS, /*!< \brief behave like a BTS (network) */
};
-/*! \brief LAPDm state */
-enum lapdm_state {
- LAPDm_STATE_NULL = 0,
- LAPDm_STATE_IDLE,
- LAPDm_STATE_SABM_SENT,
- LAPDm_STATE_MF_EST,
- LAPDm_STATE_TIMER_RECOV,
- LAPDm_STATE_DISC_SENT,
-};
-
struct lapdm_entity;
/*! \brief LAPDm message context */
struct lapdm_msg_ctx {
struct lapdm_datalink *dl;
int lapdm_fmt;
- uint8_t n201;
uint8_t chan_nr;
uint8_t link_id;
- uint8_t addr;
- uint8_t ctrl;
- uint8_t ta_ind;
- uint8_t tx_power_ind;
+ uint8_t ta_ind; /* TA indicated by network */
+ uint8_t tx_power_ind; /* MS power indicated by network */
};
/*! \brief LAPDm datalink like TS 04.06 / Section 3.5.2 */
struct lapdm_datalink {
- uint8_t V_send; /*!< \brief seq nr of next I frame to be transmitted */
- uint8_t V_ack; /*!< \brief last frame ACKed by peer */
- uint8_t N_send; /*!< \brief ? set to V_send at Tx time*/
- uint8_t V_recv; /*!< \brief seq nr of next I frame expected to be received */
- uint8_t N_recv; /*!< \brief expected send seq nr of the next received I frame */
- uint32_t state; /*!< \brief LAPDm state (\ref lapdm_state) */
- int seq_err_cond; /*!< \brief condition of sequence error */
- uint8_t own_busy; /*!< \brief receiver busy on our side */
- uint8_t peer_busy; /*!< \brief receiver busy on remote side */
- struct osmo_timer_list t200; /*!< \brief T200 timer */
- uint8_t retrans_ctr; /*!< \brief re-transmission counter */
- struct llist_head send_queue; /*!< \brief frames from L3 */
- struct msgb *send_buffer; /*!< \brief current frame transmitting */
- int send_out; /*!< \brief how much was sent from send_buffer */
- uint8_t tx_hist[8][200]; /*!< \brief tx history buffer */
- int tx_length[8]; /*!< \brief length in history buffer */
- struct llist_head tx_queue; /*!< \brief frames to L1 */
+ struct lapd_datalink dl; /* \brief common LAPD */
struct lapdm_msg_ctx mctx; /*!< \brief context of established connection */
- struct msgb *rcv_buffer; /*!< \brief buffer to assemble the received message */
struct lapdm_entity *entity; /*!< \brief LAPDm entity we are part of */
};
@@ -127,11 +93,6 @@ enum lapdm_dl_sapi {
typedef int (*lapdm_cb_t)(struct msgb *msg, struct lapdm_entity *le, void *ctx);
-struct lapdm_cr_ent {
- uint8_t cmd;
- uint8_t resp;
-};
-
#define LAPDM_ENT_F_EMPTY_FRAME 0x0001
#define LAPDM_ENT_F_POLLING_ONLY 0x0002
@@ -144,12 +105,6 @@ struct lapdm_entity {
enum lapdm_mode mode; /*!< \brief are we in BTS mode or MS mode */
unsigned int flags;
- struct {
- /*! \brief filled-in once we set the lapdm_mode above */
- struct lapdm_cr_ent loc2rem;
- struct lapdm_cr_ent rem2loc;
- } cr;
-
void *l1_ctx; /*!< \brief context for layer1 instance */
void *l3_ctx; /*!< \brief context for layer3 instance */
@@ -158,6 +113,9 @@ struct lapdm_entity {
/*! \brief pointer to \ref lapdm_channel of which we're part */
struct lapdm_channel *lapdm_ch;
+
+ uint8_t ta; /* TA used and indicated to network */
+ uint8_t tx_power; /* MS power used and indicated to network */
};
/*! \brief the two lapdm_entities that form a GSM logical channel (ACCH + DCCH) */
@@ -172,7 +130,7 @@ const char *get_rsl_name(int value);
extern const char *lapdm_state_names[];
/* initialize a LAPDm entity */
-void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode);
+void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode, int t200);
void lapdm_channel_init(struct lapdm_channel *lc, enum lapdm_mode mode);
/* deinitialize a LAPDm entity */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am
index 7f6de63..6ed55e4 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am
@@ -1,6 +1,6 @@
osmogsm_proto_HEADERS = gsm_03_41.h \
gsm_04_08.h gsm_04_11.h gsm_04_12.h gsm_04_80.h \
- gsm_08_08.h gsm_08_58.h \
+ gsm_08_08.h gsm_08_58.h gsm_44_318.h \
gsm_12_21.h ipaccess.h
osmogsm_protodir = $(includedir)/osmocom/gsm/protocol
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
index 39470e7..5057ada 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -213,15 +213,15 @@ struct gsm48_chan_desc {
tsc:3;
uint8_t hsn:6,
maio_low:2;
- } h1;
+ } __attribute__ ((packed)) h1;
struct {
uint8_t arfcn_high:2,
spare:2,
h:1,
tsc:3;
uint8_t arfcn_low;
- } h0;
- };
+ } __attribute__ ((packed)) h0;
+ } __attribute__ ((packed));
} __attribute__ ((packed));
/* Chapter 10.5.2.20 */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_11.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_11.h
index c6a2b19..f37152f 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_11.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_11.h
@@ -5,7 +5,7 @@
/* GSM TS 04.11 definitions */
-/* Chapter 5.2.3: SMC-CS states at the network side */
+/* Chapter 5.2.3: SMC-CS states at the user/network side */
enum gsm411_cp_state {
GSM411_CPS_IDLE = 0,
GSM411_CPS_MM_CONN_PENDING = 1, /* only MT ! */
@@ -13,11 +13,12 @@ enum gsm411_cp_state {
GSM411_CPS_MM_ESTABLISHED = 3,
};
-/* Chapter 6.2.2: SMR states at the network side */
+/* Chapter 6.2.2: SMR states at the user/network side */
enum gsm411_rp_state {
GSM411_RPS_IDLE = 0,
GSM411_RPS_WAIT_FOR_RP_ACK = 1,
GSM411_RPS_WAIT_TO_TX_RP_ACK = 3,
+ GSM411_RPS_WAIT_FOR_RETRANS_T = 4,
};
/* Chapter 8.1.2 (refers to GSM 04.07 Chapter 11.2.3.1.1 */
@@ -95,7 +96,8 @@ enum gsm411_rp_cause {
#define GSM411_TMR_TRAM 30, 0 /* 25 < x < 35 seconds */
#define GSM411_TMR_TR2M 15, 0 /* 12 < x < 20 seconds */
-#define GSM411_TMR_TC1A 30, 0
+#define GSM411_TMR_TC1A 30, 0 /* TR1M - 10 */
+#define GSM411_TMR_TC1A_SEC 30 /* TR1M - 10 */
/* Chapter 8.2.1 */
struct gsm411_rp_hdr {
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
new file mode 100644
index 0000000..31c0ea7
--- /dev/null
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
@@ -0,0 +1,153 @@
+#ifndef PROTO_GSM_44_318_H
+#define PROTO_GSM_44_318_H
+
+#include <stdint.h>
+
+/* Definitions according to 3GPP TS 44.318 6.8.0 Release 6 */
+
+/* Table 11.1.1.4.1: Message types for URR */
+
+enum gan_msg_type {
+ GA_MT_RC_DISCOVERY_REQUEST = 0x01,
+ GA_MT_RC_DISCOVERY_ACCEPT = 0x02,
+ GA_MT_RC_DISCOVERY_REJECT = 0x03,
+
+ GA_MT_RC_REGISTER_REQUEST = 0x10,
+ GA_MT_RC_REGISTER_ACCEPT = 0x11,
+ GA_MT_RC_REGISTER_REDIRECT = 0x12,
+ GA_MT_RC_REGISTER_REJECT = 0x13,
+ GA_MT_RC_DEREGISTER = 0x14,
+ GA_MT_RC_REGISTER_UPDATE_UL = 0x15,
+ GA_MT_RC_REGISTER_UPDATE_DL = 0x16,
+ GA_MT_RC_CELL_BCAST_INFO = 0x17,
+
+ GA_MT_CSR_CIPH_MODE_CMD = 0x20,
+ GA_MT_CSR_CIPH_MODE_COMPL = 0x21,
+
+ GA_MT_CSR_ACT_CHAN = 0x30,
+ GA_MT_CSR_ACT_CHAN_ACK = 0x31,
+ GA_MT_CSR_ACT_CHAN_COMPL = 0x32,
+ GA_MT_CSR_ACT_CHAN_FAIL = 0x33,
+ GA_MT_CSR_CHAN_MODE_MOD = 0x34,
+ GA_MT_CSR_CHAN_MODE_MOD_ACK = 0x35,
+
+ GA_MT_CSR_RELEASE = 0x40,
+ GA_MT_CSR_RELEASE_COMPL = 0x41,
+ GA_MT_CSR_CLEAR_REQ = 0x42,
+
+ GA_MT_CSR_HO_ACCESS = 0x50,
+ GA_MT_CSR_HO_COMPL = 0x51,
+ GA_MT_CSR_UL_QUAL_IND = 0x52,
+ GA_MT_CSR_HO_INFO = 0x53,
+ GA_MT_CSR_HO_CMD = 0x54,
+ GA_MT_CSR_HO_FAIL = 0x55,
+
+ GA_MT_CSR_PAGING_REQ = 0x60,
+ GA_MT_CSR_PAGING_RESP = 0x61,
+
+ GA_MT_CSR_UL_DIRECT_XFER = 0x70,
+ GA_MT_CSR_DL_DIRECT_XFER = 0x72,
+ GA_MT_CSR_STATUS = 0x73,
+ GA_MT_RC_KEEPALIVE = 0x74,
+ GA_MT_CSR_CM_ENQ = 0x75,
+ GA_MT_CSR_CM_CHANGE = 0x76,
+
+ GA_MT_CSR_REQUEST = 0x80,
+ GA_MT_CSR_REQUEST_ACCEPT = 0x81,
+ GA_MT_CSR_REQUEST_REJECT = 0x82,
+};
+
+/* All tables in 10.1.x and 10.2.x / Table 11.2.1 */
+enum gan_iei {
+ GA_IE_MI = 1,
+ GA_IE_GAN_RELEASE_IND = 2,
+ GA_IE_RADIO_IE = 3,
+ GA_IE_GERAN_CELL_ID = 4,
+ GA_IE_LAC = 5,
+ GA_IE_GERAN_COV_IND = 6,
+ GA_IE_GAN_CM = 7,
+ GA_IE_GEO_LOC = 8,
+ GA_IE_DEF_SEGW_IP = 9,
+ GA_IE_DEF_SEGW_FQDN = 10,
+ GA_IE_REDIR_CTR = 11,
+ GA_IE_DISCOV_REJ_CAUSE = 12,
+ GA_IE_GANC_CELL_DESC = 13,
+ GA_IE_GANC_CTRL_CH_DESC = 14,
+ GA_IE_GERAN_CELL_ID_LIST= 15,
+ GA_IE_TU3907_TIMER = 16,
+ GA_IE_RR_STATE = 17,
+ GA_IE_RAI = 18,
+ GA_IE_GAN_BAND = 19,
+ GA_IE_GARC_GACSR_STATE = 20,
+ GA_IE_REG_REJ_CAUSE = 21,
+ GA_IE_TU3906_TIMER = 22,
+ GA_IE_TU3910_TIMER = 23,
+ GA_IE_TU3902_TIMER = 24,
+ GA_IE_L3_MSG = 26,
+ GA_IE_CHAN_MODE = 27,
+ GA_IE_MS_CLASSMARK2 = 28,
+ GA_IE_RR_CAUSE = 29,
+ GA_EI_CIPH_MODE_SET = 30,
+ GA_IE_GPRS_RESUMPTION = 31,
+ GA_IE_HO_FROM_GAN_CMD = 32,
+ GA_IE_UL_QUAL_IND = 33,
+ GA_IE_TLLI = 34,
+ GA_IE_PFI = 35,
+ GA_IE_SUSP_CAUSE = 36,
+ GA_IE_TU3820_TIMER = 37,
+ GA_IE_REQD_QOS = 38,
+ GA_IE_P_DEACT_CAUSE = 39
+ GA_IE_REQD_UL_RATE = 40,
+ GA_IE_RAC = 41,
+ GA_IE_AP_LOCATION = 42,
+ GA_IE_TU4001_TIMER = 43,
+ GA_IE_LOC_STATUS = 44,
+ GA_IE_CIPH_RESP = 45,
+ GA_IE_CIPH_RAND = 46,
+ GA_IE_CIPH_MAC = 47,
+ GA_IE_CKSN = 48,
+ GA_IE_SAPI_ID = 49,
+ GA_IE_EST_CAUSE = 50,
+ GA_IE_CHAN_NEEDED = 51,
+ GA_IE_PDU_IN_ERROR = 52,
+ GA_IE_SAMPLE_SIZE = 53,
+ GA_IE_PAYLOAD_TYPE = 54,
+ GA_IE_MULTIRATE_CONF = 55,
+ GA_IE_MS_CLASSMARK3 = 56,
+ GA_IE_LLC_PDU = 57,
+ GA_IE_LOC_BLACKL_IND = 58,
+ GA_IE_RESET_IND = 59,
+ GA_IE_TU4003_TIMER = 60,
+ GA_IE_AP_SERV_NAME = 61,
+ GA_IE_SERV_ZONE_INFO = 62,
+ GA_IE_RTP_RED_CONF = 63,
+ GA_IE_UTRAN_CLASSMARK = 64,
+ GA_IE_CM_ENQ_MASK = 65,
+ GA_IE_UTRAN_CELLID_LIST = 66,
+ GA_IE_SERV_GANC_TBL_IND = 67,
+ GA_IE_AP_REG_IND = 68,
+ GA_IE_GAN_PLMN_LIST = 69,
+ GA_IE_REQD_GAN_SERV = 71,
+ GA_IE_BCAST_CONTAINER = 72,
+ GA_IE_3G_CELL_ID = 73,
+ GA_IE_MS_RADIO_ID = 96,
+ GA_IE_DEF_GANC_IP = 97,
+ GA_IE_DEF_GANC_FQDN = 98,
+ GA_IE_GPRS_IP_ADDR = 99,
+ GA_IE_GPRS_UDP_PORT = 100
+ GA_IE_GANC_TCP_PORT = 103,
+ GA_IE_RTP_UDP_PORT = 104,
+ GA_IE_RTCP_UDP_PORT = 105,
+ GA_IE_GERAN_RCV_SIGL_LIST = 106,
+ GA_IE_UTRAN_RCV_SIGL_LIST = 107,
+};
+
+/* 11.1.1 GA-RC and GA-CSR Message header IE */
+struct gan_rc_csr_hdr {
+ uint16_t len;
+ uint8_t pdisc:4,
+ skip_ind:4;
+ uint8_t msg_type;
+} __attribute__((packed));
+
+#endif /* PROTO_GSM_44_318_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/sysinfo.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/sysinfo.h
index b808d6f..06feb1d 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/sysinfo.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/sysinfo.h
@@ -37,7 +37,7 @@ typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
-uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type);
+uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type);
enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si);
#endif /* _OSMO_GSM_SYSINFO_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/tlv.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/tlv.h
index 7b41d2d..d2936d6 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/tlv.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/gsm/tlv.h
@@ -178,28 +178,32 @@ static inline uint8_t *tv16_put(uint8_t *buf, uint8_t tag,
return buf;
}
-/*! \brief put (append) a LV field to a \ref msgb */
+/*! \brief put (append) a LV field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_lv_put(struct msgb *msg, uint8_t len, const uint8_t *val)
{
uint8_t *buf = msgb_put(msg, LV_GROSS_LEN(len));
return lv_put(buf, len, val);
}
-/*! \brief put (append) a TLV field to a \ref msgb */
+/*! \brief put (append) a TLV field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_tlv_put(struct msgb *msg, uint8_t tag, uint8_t len, const uint8_t *val)
{
uint8_t *buf = msgb_put(msg, TLV_GROSS_LEN(len));
return tlv_put(buf, tag, len, val);
}
-/*! \brief put (append) a TV field to a \ref msgb */
+/*! \brief put (append) a TV field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_tv_put(struct msgb *msg, uint8_t tag, uint8_t val)
{
uint8_t *buf = msgb_put(msg, 2);
return tv_put(buf, tag, val);
}
-/*! \brief put (append) a TVfixed field to a \ref msgb */
+/*! \brief put (append) a TVfixed field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_tv_fixed_put(struct msgb *msg, uint8_t tag,
unsigned int len, const uint8_t *val)
{
@@ -207,47 +211,57 @@ static inline uint8_t *msgb_tv_fixed_put(struct msgb *msg, uint8_t tag,
return tv_fixed_put(buf, tag, len, val);
}
-/*! \brief put (append) a V field to a \ref msgb */
+/*! \brief put (append) a V field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_v_put(struct msgb *msg, uint8_t val)
{
uint8_t *buf = msgb_put(msg, 1);
return v_put(buf, val);
}
-/*! \brief put (append) a TV16 field to a \ref msgb */
+/*! \brief put (append) a TV16 field to a \ref msgb
+ * \returns pointer to first byte after newly-put information */
static inline uint8_t *msgb_tv16_put(struct msgb *msg, uint8_t tag, uint16_t val)
{
uint8_t *buf = msgb_put(msg, 3);
return tv16_put(buf, tag, val);
}
-/*! \brief push (prepend) a TLV field to a \ref msgb */
+/*! \brief push (prepend) a TLV field to a \ref msgb
+ * \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tlv_push(struct msgb *msg, uint8_t tag, uint8_t len, const uint8_t *val)
{
uint8_t *buf = msgb_push(msg, TLV_GROSS_LEN(len));
- return tlv_put(buf, tag, len, val);
+ tlv_put(buf, tag, len, val);
+ return buf;
}
-/*! \brief push (prepend) a TV field to a \ref msgb */
+/*! \brief push (prepend) a TV field to a \ref msgb
+ * \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tv_push(struct msgb *msg, uint8_t tag, uint8_t val)
{
uint8_t *buf = msgb_push(msg, 2);
- return tv_put(buf, tag, val);
+ tv_put(buf, tag, val);
+ return buf;
}
-/*! \brief push (prepend) a TV16 field to a \ref msgb */
+/*! \brief push (prepend) a TV16 field to a \ref msgb
+ * \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tv16_push(struct msgb *msg, uint8_t tag, uint16_t val)
{
uint8_t *buf = msgb_push(msg, 3);
- return tv16_put(buf, tag, val);
+ tv16_put(buf, tag, val);
+ return buf;
}
-/*! \brief push (prepend) a TvLV field to a \ref msgb */
+/*! \brief push (prepend) a TvLV field to a \ref msgb
+ * \returns pointer to first byte of newly-pushed information */
static inline uint8_t *msgb_tvlv_push(struct msgb *msg, uint8_t tag, uint16_t len,
const uint8_t *val)
{
uint8_t *buf = msgb_push(msg, TVLV_GROSS_LEN(len));
- return tvlv_put(buf, tag, len, val);
+ tvlv_put(buf, tag, len, val);
+ return buf;
}
/* TLV parsing */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
index 9a7c9e5..2de4f19 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
@@ -48,6 +48,8 @@ struct telnet_connection {
int telnet_init(void *tall_ctx, void *priv, int port);
+void telnet_exit(void);
+
/*! }@ */
#endif /* TELNET_INTERFACE_H */
diff --git a/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/vty.h b/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/vty.h
index d1f6f44..83506c5 100644
--- a/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/vty.h
+++ b/Src/osmolib/src/shared/libosmocore/include/osmocom/vty/vty.h
@@ -176,9 +176,13 @@ int vty_shell_serv (struct vty *);
void vty_hello (struct vty *);
void *vty_current_index(struct vty *);
int vty_current_node(struct vty *vty);
+enum node_type vty_go_parent(struct vty *vty);
extern void *tall_vty_ctx;
+extern struct cmd_element cfg_description_cmd;
+extern struct cmd_element cfg_no_description_cmd;
+
/*! }@ */
#endif