summaryrefslogtreecommitdiffstats
path: root/src/shared/libosmocore/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/libosmocore/include')
-rw-r--r--src/shared/libosmocore/include/Makefile.am104
-rw-r--r--src/shared/libosmocore/include/osmocom/Makefile.am5
-rw-r--r--src/shared/libosmocore/include/osmocom/codec/Makefile.am3
-rw-r--r--src/shared/libosmocore/include/osmocom/codec/codec.h24
-rw-r--r--src/shared/libosmocore/include/osmocom/core/Makefile.am31
-rw-r--r--src/shared/libosmocore/include/osmocom/core/backtrace.h1
-rw-r--r--src/shared/libosmocore/include/osmocom/core/bits.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/bitvec.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/conv.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/crcgen.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/gsmtap.h7
-rw-r--r--src/shared/libosmocore/include/osmocom/core/linuxrbtree.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/logging.h8
-rw-r--r--src/shared/libosmocore/include/osmocom/core/msgb.h39
-rw-r--r--src/shared/libosmocore/include/osmocom/core/rate_ctr.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/select.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/serial.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/signal.h3
-rw-r--r--src/shared/libosmocore/include/osmocom/core/socket.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/timer.h6
-rw-r--r--src/shared/libosmocore/include/osmocom/core/timer_compat.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/core/utils.h6
-rw-r--r--src/shared/libosmocore/include/osmocom/core/write_queue.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/crypt/Makefile.am3
-rw-r--r--src/shared/libosmocore/include/osmocom/crypt/auth.h44
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/gprs_bssgp.h211
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/gprs_msgb.h37
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/gprs_ns.h189
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/gprs_ns_frgre.h6
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_16.h85
-rw-r--r--src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_18.h144
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/Makefile.am8
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/a5.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/abis_nm.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/gan.h9
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/gsm0480.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/gsm48.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/gsm_utils.h1
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/lapdm.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/mncc.h14
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/prim.h5
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am6
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h74
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h26
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_12_21.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h53
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/rsl.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/gsm/tlv.h100
-rw-r--r--src/shared/libosmocore/include/osmocom/vty/Makefile.am4
-rw-r--r--src/shared/libosmocore/include/osmocom/vty/command.h7
-rw-r--r--src/shared/libosmocore/include/osmocom/vty/misc.h5
-rw-r--r--src/shared/libosmocore/include/osmocom/vty/telnet_interface.h2
-rw-r--r--src/shared/libosmocore/include/osmocom/vty/vty.h13
54 files changed, 1183 insertions, 138 deletions
diff --git a/src/shared/libosmocore/include/Makefile.am b/src/shared/libosmocore/include/Makefile.am
index 3578a80e..dec8eac8 100644
--- a/src/shared/libosmocore/include/Makefile.am
+++ b/src/shared/libosmocore/include/Makefile.am
@@ -1 +1,103 @@
-SUBDIRS = osmocom
+nobase_include_HEADERS = \
+ osmocom/codec/codec.h \
+ osmocom/core/application.h \
+ osmocom/core/backtrace.h \
+ osmocom/core/bits.h \
+ osmocom/core/bitvec.h \
+ osmocom/core/conv.h \
+ osmocom/core/crc16.h \
+ osmocom/core/crc16gen.h \
+ osmocom/core/crc32gen.h \
+ osmocom/core/crc64gen.h \
+ osmocom/core/crc8gen.h \
+ osmocom/core/crcgen.h \
+ osmocom/core/gsmtap.h \
+ osmocom/core/gsmtap_util.h \
+ osmocom/core/linuxlist.h \
+ osmocom/core/linuxrbtree.h \
+ osmocom/core/logging.h \
+ osmocom/core/msgb.h \
+ osmocom/core/panic.h \
+ osmocom/core/prim.h \
+ osmocom/core/process.h \
+ osmocom/core/rate_ctr.h \
+ osmocom/core/select.h \
+ osmocom/core/signal.h \
+ osmocom/core/socket.h \
+ osmocom/core/statistics.h \
+ osmocom/core/timer.h \
+ osmocom/core/utils.h \
+ osmocom/core/write_queue.h \
+ osmocom/crypt/auth.h \
+ osmocom/crypt/gprs_cipher.h \
+ osmocom/gprs/gprs_bssgp.h \
+ osmocom/gprs/gprs_msgb.h \
+ osmocom/gprs/gprs_ns.h \
+ osmocom/gprs/gprs_ns_frgre.h \
+ osmocom/gprs/protocol/gsm_08_16.h \
+ osmocom/gprs/protocol/gsm_08_18.h \
+ osmocom/gsm/a5.h \
+ osmocom/gsm/abis_nm.h \
+ osmocom/gsm/comp128.h \
+ osmocom/gsm/gan.h \
+ osmocom/gsm/gsm0411_smc.h \
+ osmocom/gsm/gsm0411_smr.h \
+ osmocom/gsm/gsm0411_utils.h \
+ osmocom/gsm/gsm0480.h \
+ osmocom/gsm/gsm0502.h \
+ osmocom/gsm/gsm0808.h \
+ osmocom/gsm/gsm48.h \
+ osmocom/gsm/gsm48_ie.h \
+ osmocom/gsm/gsm_utils.h \
+ osmocom/gsm/lapd_core.h \
+ osmocom/gsm/lapdm.h \
+ osmocom/gsm/mncc.h \
+ osmocom/gsm/prim.h \
+ osmocom/gsm/protocol/gsm_03_41.h \
+ osmocom/gsm/protocol/gsm_04_08.h \
+ osmocom/gsm/protocol/gsm_04_11.h \
+ osmocom/gsm/protocol/gsm_04_12.h \
+ osmocom/gsm/protocol/gsm_04_80.h \
+ osmocom/gsm/protocol/gsm_08_08.h \
+ osmocom/gsm/protocol/gsm_08_58.h \
+ osmocom/gsm/protocol/gsm_12_21.h \
+ osmocom/gsm/protocol/gsm_44_318.h \
+ osmocom/gsm/protocol/ipaccess.h \
+ osmocom/gsm/rsl.h \
+ osmocom/gsm/rxlev_stat.h \
+ osmocom/gsm/sysinfo.h \
+ osmocom/gsm/tlv.h
+
+if ENABLE_PLUGIN
+nobase_include_HEADERS += osmocom/core/plugin.h
+endif
+
+if ENABLE_TALLOC
+nobase_include_HEADERS += osmocom/core/talloc.h
+endif
+
+if ENABLE_MSGFILE
+nobase_include_HEADERS += osmocom/core/msgfile.h
+endif
+
+if ENABLE_SERIAL
+nobase_include_HEADERS += osmocom/core/serial.h
+endif
+
+
+if ENABLE_VTY
+nobase_include_HEADERS += \
+ osmocom/vty/buffer.h \
+ osmocom/vty/command.h \
+ osmocom/vty/logging.h \
+ osmocom/vty/misc.h \
+ osmocom/vty/telnet_interface.h \
+ osmocom/vty/vector.h \
+ osmocom/vty/vty.h
+endif
+
+noinst_HEADERS = osmocom/core/timer_compat.h
+
+osmocom/core/crc%gen.h: osmocom/core/crcXXgen.h.tpl
+ $(AM_V_GEN)$(MKDIR_P) $(notdir $@)
+ $(AM_V_GEN)sed -e's/XX/$*/g' $< > $@
diff --git a/src/shared/libosmocore/include/osmocom/Makefile.am b/src/shared/libosmocore/include/osmocom/Makefile.am
deleted file mode 100644
index 21f4f2d0..00000000
--- a/src/shared/libosmocore/include/osmocom/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-if ENABLE_VTY
-SUBDIRS = vty codec crypt gsm core
-else
-SUBDIRS = codec crypt gsm core
-endif
diff --git a/src/shared/libosmocore/include/osmocom/codec/Makefile.am b/src/shared/libosmocore/include/osmocom/codec/Makefile.am
deleted file mode 100644
index c2136023..00000000
--- a/src/shared/libosmocore/include/osmocom/codec/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-osmocodec_HEADERS = codec.h
-
-osmocodecdir = $(includedir)/osmocom/codec
diff --git a/src/shared/libosmocore/include/osmocom/codec/codec.h b/src/shared/libosmocore/include/osmocom/codec/codec.h
index 6f9ffea5..81f5d4ba 100644
--- a/src/shared/libosmocore/include/osmocom/codec/codec.h
+++ b/src/shared/libosmocore/include/osmocom/codec/codec.h
@@ -3,18 +3,18 @@
#include <stdint.h>
-extern uint16_t gsm610_bitorder[]; /* FR */
-extern uint16_t gsm620_unvoiced_bitorder[]; /* HR unvoiced */
-extern uint16_t gsm620_voiced_bitorder[]; /* HR voiced */
-extern uint16_t gsm660_bitorder[]; /* EFR */
+extern const uint16_t gsm610_bitorder[]; /* FR */
+extern const uint16_t gsm620_unvoiced_bitorder[]; /* HR unvoiced */
+extern const uint16_t gsm620_voiced_bitorder[]; /* HR voiced */
+extern const uint16_t gsm660_bitorder[]; /* EFR */
-extern uint16_t gsm690_12_2_bitorder[]; /* AMR 12.2 kbits */
-extern uint16_t gsm690_10_2_bitorder[]; /* AMR 10.2 kbits */
-extern uint16_t gsm690_7_95_bitorder[]; /* AMR 7.95 kbits */
-extern uint16_t gsm690_7_4_bitorder[]; /* AMR 7.4 kbits */
-extern uint16_t gsm690_6_7_bitorder[]; /* AMR 6.7 kbits */
-extern uint16_t gsm690_5_9_bitorder[]; /* AMR 5.9 kbits */
-extern uint16_t gsm690_5_15_bitorder[]; /* AMR 5.15 kbits */
-extern uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */
+extern const uint16_t gsm690_12_2_bitorder[]; /* AMR 12.2 kbits */
+extern const uint16_t gsm690_10_2_bitorder[]; /* AMR 10.2 kbits */
+extern const uint16_t gsm690_7_95_bitorder[]; /* AMR 7.95 kbits */
+extern const uint16_t gsm690_7_4_bitorder[]; /* AMR 7.4 kbits */
+extern const uint16_t gsm690_6_7_bitorder[]; /* AMR 6.7 kbits */
+extern const uint16_t gsm690_5_9_bitorder[]; /* AMR 5.9 kbits */
+extern const uint16_t gsm690_5_15_bitorder[]; /* AMR 5.15 kbits */
+extern const uint16_t gsm690_4_75_bitorder[]; /* AMR 4.75 kbits */
#endif /* _OSMOCOM_CODEC_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/Makefile.am b/src/shared/libosmocore/include/osmocom/core/Makefile.am
deleted file mode 100644
index 1df111af..00000000
--- a/src/shared/libosmocore/include/osmocom/core/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-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 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
-endif
-
-if ENABLE_TALLOC
-osmocore_HEADERS += talloc.h
-endif
-
-if ENABLE_MSGFILE
-osmocore_HEADERS += msgfile.h
-endif
-
-if ENABLE_SERIAL
-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/shared/libosmocore/include/osmocom/core/backtrace.h b/src/shared/libosmocore/include/osmocom/core/backtrace.h
index 1ed089ad..a24290c5 100644
--- a/src/shared/libosmocore/include/osmocom/core/backtrace.h
+++ b/src/shared/libosmocore/include/osmocom/core/backtrace.h
@@ -2,5 +2,6 @@
#define _OSMO_BACKTRACE_H_
void osmo_generate_backtrace(void);
+void osmo_log_backtrace(int subsys, int level);
#endif
diff --git a/src/shared/libosmocore/include/osmocom/core/bits.h b/src/shared/libosmocore/include/osmocom/core/bits.h
index b541b9ce..4c685321 100644
--- a/src/shared/libosmocore/include/osmocom/core/bits.h
+++ b/src/shared/libosmocore/include/osmocom/core/bits.h
@@ -73,6 +73,6 @@ uint32_t osmo_revbytebits_8(uint8_t x);
/* \brief reverse the bits of each byte in a given buffer */
void osmo_revbytebits_buf(uint8_t *buf, int len);
-/*! }@ */
+/*! @} */
#endif /* _OSMO_BITS_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/bitvec.h b/src/shared/libosmocore/include/osmocom/core/bitvec.h
index c2422e6d..9c000d02 100644
--- a/src/shared/libosmocore/include/osmocom/core/bitvec.h
+++ b/src/shared/libosmocore/include/osmocom/core/bitvec.h
@@ -65,6 +65,6 @@ int bitvec_get_uint(struct bitvec *bv, int num_bits);
int bitvec_find_bit_pos(const struct bitvec *bv, unsigned int n, enum bit_value val);
int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit);
-/*! }@ */
+/*! @} */
#endif /* _BITVEC_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/conv.h b/src/shared/libosmocore/include/osmocom/core/conv.h
index e76a5c61..e5b2a975 100644
--- a/src/shared/libosmocore/include/osmocom/core/conv.h
+++ b/src/shared/libosmocore/include/osmocom/core/conv.h
@@ -141,6 +141,6 @@ int osmo_conv_decode(const struct osmo_conv_code *code,
const sbit_t *input, ubit_t *output);
-/*! }@ */
+/*! @} */
#endif /* __OSMO_CONV_H__ */
diff --git a/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl b/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl
index b411276e..89d083ae 100644
--- a/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl
+++ b/src/shared/libosmocore/include/osmocom/core/crcXXgen.h.tpl
@@ -52,7 +52,7 @@ 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__ */
diff --git a/src/shared/libosmocore/include/osmocom/core/crcgen.h b/src/shared/libosmocore/include/osmocom/core/crcgen.h
index cd916c76..8e208a74 100644
--- a/src/shared/libosmocore/include/osmocom/core/crcgen.h
+++ b/src/shared/libosmocore/include/osmocom/core/crcgen.h
@@ -36,6 +36,6 @@
#include <osmocom/core/crc32gen.h>
#include <osmocom/core/crc64gen.h>
-/*! }@ */
+/*! @} */
#endif /* __OSMO_CRCGEN_H__ */
diff --git a/src/shared/libosmocore/include/osmocom/core/gsmtap.h b/src/shared/libosmocore/include/osmocom/core/gsmtap.h
index a4e5d420..0b647b28 100644
--- a/src/shared/libosmocore/include/osmocom/core/gsmtap.h
+++ b/src/shared/libosmocore/include/osmocom/core/gsmtap.h
@@ -41,6 +41,9 @@
#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 */
+#define GSMTAP_TYPE_UMTS_RLC_MAC 0x0b
+#define GSMTAP_TYPE_UMTS_RRC 0x0c
+
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
@@ -128,6 +131,10 @@
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
+#define GSMTAP_UMTS_CH_PCCH 0x01
+#define GSMTAP_UMTS_CH_CCCH 0x02
+#define GSMTAP_UMTS_CH_DCCH 0x03
+
/* flags for the ARFCN */
#define GSMTAP_ARFCN_F_PCS 0x8000
#define GSMTAP_ARFCN_F_UPLINK 0x4000
diff --git a/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h b/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h
index 44e00a16..079f440d 100644
--- a/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h
+++ b/src/shared/libosmocore/include/osmocom/core/linuxrbtree.h
@@ -145,7 +145,7 @@ 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,
+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,
diff --git a/src/shared/libosmocore/include/osmocom/core/logging.h b/src/shared/libosmocore/include/osmocom/core/logging.h
index 043a8509..989228b9 100644
--- a/src/shared/libosmocore/include/osmocom/core/logging.h
+++ b/src/shared/libosmocore/include/osmocom/core/logging.h
@@ -28,10 +28,10 @@
#endif
-void osmo_vlogp(int subsys, int level, char *file, int line,
+void osmo_vlogp(int subsys, int level, const char *file, int line,
int cont, const char *format, va_list ap);
-void logp(int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
+void logp(int subsys, const char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
/*! \brief Log a new message through the Osmocom logging framework
* \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)
@@ -165,7 +165,7 @@ struct log_target {
};
/* use the above macros */
-void logp2(int subsys, unsigned int level, char *file,
+void logp2(int subsys, unsigned int level, const char *file,
int line, int cont, const char *format, ...)
__attribute__ ((format (printf, 6, 7)));
int log_init(const struct log_info *inf, void *talloc_ctx);
@@ -206,6 +206,6 @@ const char *log_vty_command_description(const struct log_info *info);
struct log_target *log_target_find(int type, const char *fname);
extern struct llist_head osmo_log_target_list;
-/*! }@ */
+/*! @} */
#endif /* _OSMOCORE_LOGGING_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/msgb.h b/src/shared/libosmocore/include/osmocom/core/msgb.h
index e465ec2b..36c7c0f9 100644
--- a/src/shared/libosmocore/include/osmocom/core/msgb.h
+++ b/src/shared/libosmocore/include/osmocom/core/msgb.h
@@ -72,6 +72,7 @@ extern void msgb_free(struct msgb *m);
extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg);
extern struct msgb *msgb_dequeue(struct llist_head *queue);
extern void msgb_reset(struct msgb *m);
+uint16_t msgb_length(const struct msgb *msg);
#ifdef MSGB_DEBUG
#include <osmocom/core/panic.h>
@@ -226,8 +227,11 @@ static inline void msgb_put_u32(struct msgb *msgb, uint32_t word)
*/
static inline unsigned char *msgb_get(struct msgb *msgb, unsigned int len)
{
- unsigned char *tmp = msgb->data;
- msgb->data += len;
+ unsigned char *tmp = msgb->data - len;
+ if (msgb_length(msgb) < len)
+ MSGB_ABORT(msgb, "msgb too small to get %u (len %u)\n",
+ len, msgb_length(msgb));
+ msgb->tail -= len;
msgb->len -= len;
return tmp;
}
@@ -295,6 +299,34 @@ static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len)
return msgb->data += len;
}
+/*! \brief remove uint8 from front of message
+ * \param[in] msgb message buffer
+ * \returns 8bit value taken from end of msgb
+ */
+static inline uint8_t msgb_pull_u8(struct msgb *msgb)
+{
+ uint8_t *space = msgb_pull(msgb, 1);
+ return space[0];
+}
+/*! \brief remove uint16 from front of message
+ * \param[in] msgb message buffer
+ * \returns 16bit value taken from end of msgb
+ */
+static inline uint16_t msgb_pull_u16(struct msgb *msgb)
+{
+ uint8_t *space = msgb_pull(msgb, 2);
+ return space[0] << 8 | space[1];
+}
+/*! \brief remove uint32 from front of message
+ * \param[in] msgb message buffer
+ * \returns 32bit value taken from end of msgb
+ */
+static inline uint32_t msgb_pull_u32(struct msgb *msgb)
+{
+ uint8_t *space = msgb_pull(msgb, 4);
+ return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3];
+}
+
/*! \brief Increase headroom of empty msgb, reducing the tailroom
* \param[in] msg message buffer
* \param[in] len amount of extra octets to be reserved as headroom
@@ -362,9 +394,8 @@ static inline struct msgb *msgb_alloc_headroom(int size, int headroom,
/* non inline functions to ease binding */
uint8_t *msgb_data(const struct msgb *msg);
-uint16_t msgb_length(const struct msgb *msg);
void msgb_set_talloc_ctx(void *ctx);
-/*! }@ */
+/*! @} */
#endif /* _MSGB_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/rate_ctr.h b/src/shared/libosmocore/include/osmocom/core/rate_ctr.h
index c38e5f9b..24577fdf 100644
--- a/src/shared/libosmocore/include/osmocom/core/rate_ctr.h
+++ b/src/shared/libosmocore/include/osmocom/core/rate_ctr.h
@@ -84,5 +84,5 @@ int rate_ctr_init(void *tall_ctx);
struct rate_ctr_group *rate_ctr_get_group_by_name_idx(const char *name, const unsigned int idx);
const struct rate_ctr *rate_ctr_get_by_name(const struct rate_ctr_group *ctrg, const char *name);
-/*! }@ */
+/*! @} */
#endif /* RATE_CTR_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/select.h b/src/shared/libosmocore/include/osmocom/core/select.h
index 18aad35f..efdd716f 100644
--- a/src/shared/libosmocore/include/osmocom/core/select.h
+++ b/src/shared/libosmocore/include/osmocom/core/select.h
@@ -40,6 +40,6 @@ int osmo_fd_register(struct osmo_fd *fd);
void osmo_fd_unregister(struct osmo_fd *fd);
int osmo_select_main(int polling);
-/*! }@ */
+/*! @} */
#endif /* _BSC_SELECT_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/serial.h b/src/shared/libosmocore/include/osmocom/core/serial.h
index 73854251..889bd8a1 100644
--- a/src/shared/libosmocore/include/osmocom/core/serial.h
+++ b/src/shared/libosmocore/include/osmocom/core/serial.h
@@ -38,6 +38,6 @@ int osmo_serial_set_baudrate(int fd, speed_t baudrate);
int osmo_serial_set_custom_baudrate(int fd, int baudrate);
int osmo_serial_clear_custom_baudrate(int fd);
-/*! }@ */
+/*! @} */
#endif /* __OSMO_SERIAL_H__ */
diff --git a/src/shared/libosmocore/include/osmocom/core/signal.h b/src/shared/libosmocore/include/osmocom/core/signal.h
index 07d0e6fb..b3a5aaee 100644
--- a/src/shared/libosmocore/include/osmocom/core/signal.h
+++ b/src/shared/libosmocore/include/osmocom/core/signal.h
@@ -18,6 +18,7 @@
enum {
SS_L_GLOBAL = OSMO_SIGNAL_SS_RESERVED,
SS_L_INPUT,
+ SS_L_NS,
};
/* application-defined signal types. */
@@ -40,6 +41,6 @@ void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn,
/* Dispatch */
void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data);
-/*! }@ */
+/*! @} */
#endif /* OSMO_SIGNAL_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/socket.h b/src/shared/libosmocore/include/osmocom/core/socket.h
index 88214632..f15a03a9 100644
--- a/src/shared/libosmocore/include/osmocom/core/socket.h
+++ b/src/shared/libosmocore/include/osmocom/core/socket.h
@@ -30,6 +30,6 @@ int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
-/*! }@ */
+/*! @} */
#endif /* _OSMOCORE_SOCKET_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/timer.h b/src/shared/libosmocore/include/osmocom/core/timer.h
index 30f558b4..d37af806 100644
--- a/src/shared/libosmocore/include/osmocom/core/timer.h
+++ b/src/shared/libosmocore/include/osmocom/core/timer.h
@@ -73,7 +73,9 @@ void osmo_timer_del(struct osmo_timer_list *timer);
int osmo_timer_pending(struct osmo_timer_list *timer);
-
+int osmo_timer_remaining(const struct osmo_timer_list *timer,
+ const struct timeval *now,
+ struct timeval *remaining);
/*
* internal timer list management
*/
@@ -82,6 +84,6 @@ void osmo_timers_prepare(void);
int osmo_timers_update(void);
int osmo_timers_check(void);
-/*! }@ */
+/*! @} */
#endif
diff --git a/src/shared/libosmocore/include/osmocom/core/timer_compat.h b/src/shared/libosmocore/include/osmocom/core/timer_compat.h
index 209e84a3..d86c109e 100644
--- a/src/shared/libosmocore/include/osmocom/core/timer_compat.h
+++ b/src/shared/libosmocore/include/osmocom/core/timer_compat.h
@@ -74,6 +74,6 @@
#endif
-/*! }@ */
+/*! @} */
#endif /* TIMER_COMPAT_H */
diff --git a/src/shared/libosmocore/include/osmocom/core/utils.h b/src/shared/libosmocore/include/osmocom/core/utils.h
index f1843d9d..03861d78 100644
--- a/src/shared/libosmocore/include/osmocom/core/utils.h
+++ b/src/shared/libosmocore/include/osmocom/core/utils.h
@@ -10,9 +10,9 @@
/*! \brief Determine number of elements in an array of static size */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/*! \brief Return the maximum of two specified values */
-#define OSMO_MAX(a, b) (a) >= (b) ? (a) : (b)
+#define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b))
/*! \brief Return the minimum of two specified values */
-#define OSMO_MIN(a, b) (a) >= (b) ? (b) : (a)
+#define OSMO_MIN(a, b) ((a) >= (b) ? (b) : (a))
#include <stdint.h>
@@ -51,6 +51,6 @@ do { \
rem -= ret; \
} while (0)
-/*! }@ */
+/*! @} */
#endif
diff --git a/src/shared/libosmocore/include/osmocom/core/write_queue.h b/src/shared/libosmocore/include/osmocom/core/write_queue.h
index 8b896d15..816c0364 100644
--- a/src/shared/libosmocore/include/osmocom/core/write_queue.h
+++ b/src/shared/libosmocore/include/osmocom/core/write_queue.h
@@ -58,6 +58,6 @@ void osmo_wqueue_clear(struct osmo_wqueue *queue);
int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data);
int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what);
-/*! }@ */
+/*! @} */
#endif
diff --git a/src/shared/libosmocore/include/osmocom/crypt/Makefile.am b/src/shared/libosmocore/include/osmocom/crypt/Makefile.am
deleted file mode 100644
index e4a6e538..00000000
--- a/src/shared/libosmocore/include/osmocom/crypt/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-osmocrypt_HEADERS = gprs_cipher.h auth.h
-
-osmocryptdir = $(includedir)/osmocom/crypt
diff --git a/src/shared/libosmocore/include/osmocom/crypt/auth.h b/src/shared/libosmocore/include/osmocom/crypt/auth.h
index 67b32009..871e7c87 100644
--- a/src/shared/libosmocore/include/osmocom/crypt/auth.h
+++ b/src/shared/libosmocore/include/osmocom/crypt/auth.h
@@ -1,11 +1,17 @@
#ifndef _OSMOCRYPTO_AUTH_H
#define _OSMOCRYPTO_AUTH_H
+/*! \addtogroup auth
+ * @{
+ */
+
+/*! \file auth.h */
+
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
-/*! \brief Authentication Type */
+/*! \brief Authentication Type (GSM/UMTS) */
enum osmo_sub_auth_type {
OSMO_AUTH_TYPE_NONE = 0x00,
OSMO_AUTH_TYPE_GSM = 0x01,
@@ -29,42 +35,44 @@ struct osmo_sub_auth_data {
enum osmo_auth_algo algo;
union {
struct {
- uint8_t opc[16];
- uint8_t k[16];
+ uint8_t opc[16]; /*!< operator invariant value */
+ uint8_t k[16]; /*!< secret key of the subscriber */
uint8_t amf[2];
- uint64_t sqn;
- int opc_is_op;
+ uint64_t sqn; /*!< sequence number */
+ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */
} umts;
struct {
- uint8_t ki[16];
+ uint8_t ki[16]; /*!< secret key */
} 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];
+ uint8_t rand[16]; /*!< random challenge */
+ uint8_t autn[16]; /*!< authentication nonce */
+ uint8_t ck[16]; /*!< ciphering key */
+ uint8_t ik[16]; /*!< integrity key */
+ uint8_t res[16]; /*!< authentication result */
+ uint8_t res_len; /*!< length (in bytes) of res */
+ uint8_t kc[8]; /*!< Kc for GSM encryption (A5) */
+ uint8_t sres[4]; /*!< authentication result for GSM */
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;
+ enum osmo_auth_algo algo; /*!< algorithm we implement */
+ const char *name; /*!< name of the implementation */
+ unsigned int priority; /*!< priority value (resp. othe implementations */
+ /*! \brief callback for generate authentication vectors */
int (*gen_vec)(struct osmo_auth_vector *vec,
struct osmo_sub_auth_data *aud,
const uint8_t *_rand);
+ /* \brief callback for generationg auth vectors + re-sync */
int (*gen_vec_auts)(struct osmo_auth_vector *vec,
struct osmo_sub_auth_data *aud,
const uint8_t *rand_auts, const uint8_t *auts,
@@ -89,3 +97,5 @@ 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/shared/libosmocore/include/osmocom/gprs/gprs_bssgp.h b/src/shared/libosmocore/include/osmocom/gprs/gprs_bssgp.h
new file mode 100644
index 00000000..eb4e7219
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/gprs_bssgp.h
@@ -0,0 +1,211 @@
+#ifndef _GPRS_BSSGP_H
+#define _GPRS_BSSGP_H
+
+#include <stdint.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/linuxlist.h>
+
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/gsm/prim.h>
+
+#include <osmocom/gprs/protocol/gsm_08_18.h>
+
+/* gprs_bssgp_util.c */
+extern struct gprs_ns_inst *bssgp_nsi;
+struct msgb *bssgp_msgb_alloc(void);
+const char *bssgp_cause_str(enum gprs_bssgp_cause cause);
+/* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */
+int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei,
+ uint16_t bvci, uint16_t ns_bvci);
+/* Chapter 10.4.14: Status */
+int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg);
+
+enum bssgp_prim {
+ PRIM_BSSGP_DL_UD,
+ PRIM_BSSGP_UL_UD,
+ PRIM_BSSGP_PTM_UD,
+
+ PRIM_BSSGP_GMM_SUSPEND,
+ PRIM_BSSGP_GMM_RESUME,
+ PRIM_BSSGP_GMM_PAGING,
+
+ PRIM_NM_FLUSH_LL,
+ PRIM_NM_LLC_DISCARDED,
+ PRIM_NM_BVC_RESET,
+ PRIM_NM_BVC_BLOCK,
+ PRIM_NM_BVC_UNBLOCK,
+};
+
+struct osmo_bssgp_prim {
+ struct osmo_prim_hdr oph;
+
+ /* common fields */
+ uint16_t nsei;
+ uint16_t bvci;
+ uint32_t tlli;
+ struct tlv_parsed *tp;
+ struct gprs_ra_id *ra_id;
+
+ /* specific fields */
+ union {
+ struct {
+ uint8_t suspend_ref;
+ } resume;
+ } u;
+};
+
+/* gprs_bssgp.c */
+
+/*! \brief BSSGP flow control (SGSN side) According to Section 8.2 */
+struct bssgp_flow_control {
+ uint32_t bucket_size_max; /*!< maximum size of the bucket (octets) */
+ uint32_t bucket_leak_rate; /*!< leak rate of the bucket (octets/sec) */
+
+ uint32_t bucket_counter; /*!< number of tokens in the bucket */
+ struct timeval time_last_pdu; /*!< timestamp of last PDU sent */
+
+ /* the built-in queue */
+ uint32_t max_queue_depth; /*!< how many packets to queue (mgs) */
+ uint32_t queue_depth; /*!< current length of queue (msgs) */
+ struct llist_head queue; /*!< linked list of msgb's */
+ struct osmo_timer_list timer; /*!< timer-based dequeueing */
+
+ /*! callback to be called at output of flow control */
+ int (*out_cb)(struct bssgp_flow_control *fc, struct msgb *msg,
+ uint32_t llc_pdu_len, void *priv);
+};
+
+#define BVC_S_BLOCKED 0x0001
+
+/* The per-BTS context that we keep on the SGSN side of the BSSGP link */
+struct bssgp_bvc_ctx {
+ struct llist_head list;
+
+ struct gprs_ra_id ra_id; /*!< parsed RA ID of the remote BTS */
+ uint16_t cell_id; /*!< Cell ID of the remote BTS */
+
+ /* NSEI and BVCI of underlying Gb link. Together they
+ * uniquely identify a link to a BTS (5.4.4) */
+ uint16_t bvci;
+ uint16_t nsei;
+
+ uint32_t state;
+
+ struct rate_ctr_group *ctrg;
+
+ struct bssgp_flow_control *fc;
+ /*! default maximum size of per-MS bucket in octets */
+ uint32_t bmax_default_ms;
+ /*! default bucket leak rate of per-MS bucket in octests/s */
+ uint32_t r_default_ms;
+
+ /* we might want to add this as a shortcut later, avoiding the NSVC
+ * lookup for every packet, similar to a routing cache */
+ //struct gprs_nsvc *nsvc;
+};
+extern struct llist_head bssgp_bvc_ctxts;
+/* Find a BTS Context based on parsed RA ID and Cell ID */
+struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid);
+/* Find a BTS context based on BVCI+NSEI tuple */
+struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei);
+
+#define BVC_F_BLOCKED 0x0001
+
+enum bssgp_ctr {
+ BSSGP_CTR_PKTS_IN,
+ BSSGP_CTR_PKTS_OUT,
+ BSSGP_CTR_BYTES_IN,
+ BSSGP_CTR_BYTES_OUT,
+ BSSGP_CTR_BLOCKED,
+ BSSGP_CTR_DISCARDED,
+};
+
+
+#include <osmocom/gsm/tlv.h>
+#include <osmocom/gprs/gprs_msgb.h>
+
+/* BSSGP-UL-UNITDATA.ind */
+int bssgp_rcvmsg(struct msgb *msg);
+
+/* BSSGP-DL-UNITDATA.req */
+struct bssgp_lv {
+ uint16_t len;
+ uint8_t *v;
+};
+/* parameters for BSSGP downlink userdata transmission */
+struct bssgp_dl_ud_par {
+ uint32_t *tlli;
+ char *imsi;
+ struct bssgp_flow_control *fc;
+ uint16_t drx_parms;
+ /* FIXME: priority */
+ struct bssgp_lv ms_ra_cap;
+ uint8_t qos_profile[3];
+};
+int bssgp_tx_dl_ud(struct msgb *msg, uint16_t pdu_lifetime,
+ struct bssgp_dl_ud_par *dup);
+
+uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf);
+int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
+ uint16_t cid);
+
+/* Wrapper around TLV parser to parse BSSGP IEs */
+static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len)
+{
+ return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0);
+}
+
+/*! \brief BSSGP Paging mode */
+enum bssgp_paging_mode {
+ BSSGP_PAGING_PS,
+ BSSGP_PAGING_CS,
+};
+
+/*! \brief BSSGP Paging scope */
+enum bssgp_paging_scope {
+ BSSGP_PAGING_BSS_AREA, /*!< all cells in BSS */
+ BSSGP_PAGING_LOCATION_AREA, /*!< all cells in LA */
+ BSSGP_PAGING_ROUTEING_AREA, /*!< all cells in RA */
+ BSSGP_PAGING_BVCI, /*!< one cell */
+};
+
+/*! \brief BSSGP paging information */
+struct bssgp_paging_info {
+ enum bssgp_paging_mode mode; /*!< CS or PS paging */
+ enum bssgp_paging_scope scope; /*!< bssgp_paging_scope */
+ struct gprs_ra_id raid; /*!< RA Identifier */
+ uint16_t bvci; /*!< BVCI */
+ char *imsi; /*!< IMSI, if any */
+ uint32_t *ptmsi; /*!< P-TMSI, if any */
+ uint16_t drx_params; /*!< DRX parameters */
+ uint8_t qos[3]; /*!< QoS parameters */
+};
+
+/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */
+int bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci,
+ struct bssgp_paging_info *pinfo);
+
+void bssgp_fc_init(struct bssgp_flow_control *fc,
+ uint32_t bucket_size_max, uint32_t bucket_leak_rate,
+ uint32_t max_queue_depth,
+ int (*out_cb)(struct bssgp_flow_control *fc, struct msgb *msg,
+ uint32_t llc_pdu_len, void *priv));
+
+/* input function of the flow control implementation, called first
+ * for the MM flow control, and then as the MM flow control output
+ * callback in order to perform BVC flow control */
+int bssgp_fc_in(struct bssgp_flow_control *fc, struct msgb *msg,
+ uint32_t llc_pdu_len, void *priv);
+
+/* Initialize the Flow Control parameters for a new MS according to
+ * default values for the BVC specified by BVCI and NSEI */
+int bssgp_fc_ms_init(struct bssgp_flow_control *fc_ms, uint16_t bvci,
+ uint16_t nsei, uint32_t max_queue_depth);
+
+/* gprs_bssgp_vty.c */
+int bssgp_vty_init(void);
+void bssgp_set_log_ss(int ss);
+
+int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
+
+#endif /* _GPRS_BSSGP_H */
diff --git a/src/shared/libosmocore/include/osmocom/gprs/gprs_msgb.h b/src/shared/libosmocore/include/osmocom/gprs/gprs_msgb.h
new file mode 100644
index 00000000..f4c85547
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/gprs_msgb.h
@@ -0,0 +1,37 @@
+#ifndef _LIBGB_MSGB_H
+#define _LIBGB_MSGB_H
+
+#include <stdint.h>
+/* the data structure stored in msgb->cb for libgb apps */
+struct libgb_msgb_cb {
+ unsigned char *bssgph;
+ unsigned char *llch;
+
+ /* Cell Identifier */
+ unsigned char *bssgp_cell_id;
+
+ /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
+ uint16_t nsei;
+ uint16_t bvci;
+
+ /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
+ uint32_t tlli;
+} __attribute__((packed));
+#define LIBGB_MSGB_CB(__msgb) ((struct libgb_msgb_cb *)&((__msgb)->cb[0]))
+#define msgb_tlli(__x) LIBGB_MSGB_CB(__x)->tlli
+#define msgb_nsei(__x) LIBGB_MSGB_CB(__x)->nsei
+#define msgb_bvci(__x) LIBGB_MSGB_CB(__x)->bvci
+#define msgb_gmmh(__x) (__x)->l3h
+#define msgb_bssgph(__x) LIBGB_MSGB_CB(__x)->bssgph
+#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x))
+#define msgb_bcid(__x) LIBGB_MSGB_CB(__x)->bssgp_cell_id
+#define msgb_llch(__x) LIBGB_MSGB_CB(__x)->llch
+
+/* logging contexts */
+#define GPRS_CTX_NSVC 0
+#define GPRS_CTX_BVC 1
+
+#include <osmocom/core/logging.h>
+int gprs_log_filter_fn(const struct log_context *ctx,
+ struct log_target *tar);
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gprs/gprs_ns.h b/src/shared/libosmocore/include/osmocom/gprs/gprs_ns.h
new file mode 100644
index 00000000..a7f32b25
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/gprs_ns.h
@@ -0,0 +1,189 @@
+#ifndef _GPRS_NS_H
+#define _GPRS_NS_H
+
+#include <stdint.h>
+
+/* Our Implementation */
+#include <netinet/in.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/timer.h>
+#include <osmocom/core/select.h>
+#include <osmocom/gprs/gprs_msgb.h>
+
+#include <osmocom/gprs/protocol/gsm_08_16.h>
+
+#define NS_TIMERS_COUNT 7
+#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)"
+#define NS_TIMERS_HELP \
+ "(un)blocking Timer (Tns-block) timeout\n" \
+ "(un)blocking Timer (Tns-block) number of retries\n" \
+ "Reset Timer (Tns-reset) timeout\n" \
+ "Reset Timer (Tns-reset) number of retries\n" \
+ "Test Timer (Tns-test) timeout\n" \
+ "Alive Timer (Tns-alive) timeout\n" \
+ "Alive Timer (Tns-alive) number of retries\n"
+
+enum ns_timeout {
+ NS_TOUT_TNS_BLOCK,
+ NS_TOUT_TNS_BLOCK_RETRIES,
+ NS_TOUT_TNS_RESET,
+ NS_TOUT_TNS_RESET_RETRIES,
+ NS_TOUT_TNS_TEST,
+ NS_TOUT_TNS_ALIVE,
+ NS_TOUT_TNS_ALIVE_RETRIES,
+};
+
+#define NSE_S_BLOCKED 0x0001
+#define NSE_S_ALIVE 0x0002
+
+/*! \brief Osmocom NS link layer types */
+enum gprs_ns_ll {
+ GPRS_NS_LL_UDP, /*!< NS/UDP/IP */
+ GPRS_NS_LL_E1, /*!< NS/E1 */
+ GPRS_NS_LL_FR_GRE, /*!< NS/FR/GRE/IP */
+};
+
+/*! \brief Osmoco NS events */
+enum gprs_ns_evt {
+ GPRS_NS_EVT_UNIT_DATA,
+};
+
+struct gprs_nsvc;
+/*! \brief Osmocom GPRS callback function type */
+typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
+ struct msgb *msg, uint16_t bvci);
+
+/*! \brief An instance of the NS protocol stack */
+struct gprs_ns_inst {
+ /*! \brief callback to the user for incoming UNIT DATA IND */
+ gprs_ns_cb_t *cb;
+
+ /*! \brief linked lists of all NSVC in this instance */
+ struct llist_head gprs_nsvcs;
+
+ /*! \brief a NSVC object that's needed to deal with packets for
+ * unknown NSVC */
+ struct gprs_nsvc *unknown_nsvc;
+
+ uint16_t timeout[NS_TIMERS_COUNT];
+
+ /*! \brief NS-over-IP specific bits */
+ struct {
+ struct osmo_fd fd;
+ uint32_t local_ip;
+ uint16_t local_port;
+ } nsip;
+ /*! \brief NS-over-FR-over-GRE-over-IP specific bits */
+ struct {
+ struct osmo_fd fd;
+ uint32_t local_ip;
+ unsigned int enabled:1;
+ } frgre;
+};
+
+enum nsvc_timer_mode {
+ /* standard timers */
+ NSVC_TIMER_TNS_TEST,
+ NSVC_TIMER_TNS_ALIVE,
+ NSVC_TIMER_TNS_RESET,
+ _NSVC_TIMER_NR,
+};
+
+/*! \brief Structure representing a single NS-VC */
+struct gprs_nsvc {
+ /*! \brief list of NS-VCs within NS Instance */
+ struct llist_head list;
+ /*! \brief pointer to NS Instance */
+ struct gprs_ns_inst *nsi;
+
+ uint16_t nsei; /*! \brief end-to-end significance */
+ uint16_t nsvci; /*! \brief uniquely identifies NS-VC at SGSN */
+
+ uint32_t state;
+ uint32_t remote_state;
+
+ struct osmo_timer_list timer;
+ enum nsvc_timer_mode timer_mode;
+ int alive_retries;
+
+ unsigned int remote_end_is_sgsn:1;
+ unsigned int persistent:1;
+
+ struct rate_ctr_group *ctrg;
+
+ /*! \brief which link-layer are we based on? */
+ enum gprs_ns_ll ll;
+
+ union {
+ struct {
+ struct sockaddr_in bts_addr;
+ } ip;
+ struct {
+ struct sockaddr_in bts_addr;
+ } frgre;
+ };
+};
+
+/* Create a new NS protocol instance */
+struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb, void *ctx);
+
+/* Destroy a NS protocol instance */
+void gprs_ns_destroy(struct gprs_ns_inst *nsi);
+
+/* Listen for incoming GPRS packets via NS/UDP */
+int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi);
+
+/* Establish a connection (from the BSS) to the SGSN */
+struct gprs_nsvc *gprs_ns_nsip_connect(struct gprs_ns_inst *nsi,
+ struct sockaddr_in *dest,
+ uint16_t nsei, uint16_t nsvci);
+
+
+struct sockaddr_in;
+
+/* main function for higher layers (BSSGP) to send NS messages */
+int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg);
+
+int gprs_ns_tx_reset(struct gprs_nsvc *nsvc, uint8_t cause);
+int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause);
+int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc);
+
+/* Listen for incoming GPRS packets via NS/FR/GRE */
+int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi);
+
+struct gprs_nsvc *gprs_nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci);
+void gprs_nsvc_delete(struct gprs_nsvc *nsvc);
+struct gprs_nsvc *gprs_nsvc_by_nsei(struct gprs_ns_inst *nsi, uint16_t nsei);
+struct gprs_nsvc *gprs_nsvc_by_nsvci(struct gprs_ns_inst *nsi, uint16_t nsvci);
+
+/* Initiate a RESET procedure (including timer start, ...)*/
+void gprs_nsvc_reset(struct gprs_nsvc *nsvc, uint8_t cause);
+
+/* Add NS-specific VTY stuff */
+int gprs_ns_vty_init(struct gprs_ns_inst *nsi);
+
+#define NS_ALLOC_SIZE 2048
+#define NS_ALLOC_HEADROOM 20
+static inline struct msgb *gprs_ns_msgb_alloc(void)
+{
+ return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS");
+}
+
+enum signal_ns {
+ S_NS_RESET,
+ S_NS_BLOCK,
+ S_NS_UNBLOCK,
+ S_NS_ALIVE_EXP, /* Tns-alive expired more than N times */
+};
+
+struct ns_signal_data {
+ struct gprs_nsvc *nsvc;
+ uint8_t cause;
+};
+
+void gprs_ns_set_log_ss(int ss);
+
+/*! }@ */
+
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gprs/gprs_ns_frgre.h b/src/shared/libosmocore/include/osmocom/gprs/gprs_ns_frgre.h
new file mode 100644
index 00000000..abcd43ff
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/gprs_ns_frgre.h
@@ -0,0 +1,6 @@
+#ifndef _GPRS_NS_FRGRE_H
+#define _GPRS_NS_FRGRE_H
+
+int gprs_ns_frgre_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg);
+
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_16.h b/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_16.h
new file mode 100644
index 00000000..4c3eda32
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_16.h
@@ -0,0 +1,85 @@
+#ifndef _OSMO_08_16_H
+#define _OSMO_08_16_H
+
+/* GPRS Networks Service (NS) messages on the Gb interface
+ * 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)
+ * 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */
+
+#include <stdint.h>
+
+/*! \addtogroup libgb
+ * @{
+ */
+
+/*! \file gprs_ns.h */
+
+/*! \brief Common header of GPRS NS */
+struct gprs_ns_hdr {
+ uint8_t pdu_type; /*!< NS PDU type */
+ uint8_t data[0]; /*!< variable-length payload */
+} __attribute__((packed));
+
+/*! \brief NS PDU Type (TS 08.16, Section 10.3.7, Table 14) */
+enum ns_pdu_type {
+ NS_PDUT_UNITDATA = 0x00,
+ NS_PDUT_RESET = 0x02,
+ NS_PDUT_RESET_ACK = 0x03,
+ NS_PDUT_BLOCK = 0x04,
+ NS_PDUT_BLOCK_ACK = 0x05,
+ NS_PDUT_UNBLOCK = 0x06,
+ NS_PDUT_UNBLOCK_ACK = 0x07,
+ NS_PDUT_STATUS = 0x08,
+ NS_PDUT_ALIVE = 0x0a,
+ NS_PDUT_ALIVE_ACK = 0x0b,
+ /* TS 48.016 Section 10.3.7, Table 10.3.7.1 */
+ SNS_PDUT_ACK = 0x0c,
+ SNS_PDUT_ADD = 0x0d,
+ SNS_PDUT_CHANGE_WEIGHT = 0x0e,
+ SNS_PDUT_CONFIG = 0x0f,
+ SNS_PDUT_CONFIG_ACK = 0x10,
+ SNS_PDUT_DELETE = 0x11,
+ SNS_PDUT_SIZE = 0x12,
+ SNS_PDUT_SIZE_ACK = 0x13,
+};
+
+/*! \brief NS Control IE (TS 08.16, Section 10.3, Table 12) */
+enum ns_ctrl_ie {
+ NS_IE_CAUSE = 0x00,
+ NS_IE_VCI = 0x01,
+ NS_IE_PDU = 0x02,
+ NS_IE_BVCI = 0x03,
+ NS_IE_NSEI = 0x04,
+ /* TS 48.016 Section 10.3, Table 10.3.1 */
+ NS_IE_IPv4_LIST = 0x05,
+ NS_IE_IPv6_LIST = 0x06,
+ NS_IE_MAX_NR_NSVC = 0x07,
+ NS_IE_IPv4_EP_NR = 0x08,
+ NS_IE_IPv6_EP_NR = 0x09,
+ NS_IE_RESET_FLAG = 0x0a,
+ NS_IE_IP_ADDR = 0x0b,
+};
+
+/*! \brief NS Cause (TS 08.16, Section 10.3.2, Table 13) */
+enum ns_cause {
+ NS_CAUSE_TRANSIT_FAIL = 0x00,
+ NS_CAUSE_OM_INTERVENTION = 0x01,
+ NS_CAUSE_EQUIP_FAIL = 0x02,
+ NS_CAUSE_NSVC_BLOCKED = 0x03,
+ NS_CAUSE_NSVC_UNKNOWN = 0x04,
+ NS_CAUSE_BVCI_UNKNOWN = 0x05,
+ NS_CAUSE_SEM_INCORR_PDU = 0x08,
+ NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a,
+ NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b,
+ NS_CAUSE_INVAL_ESSENT_IE = 0x0c,
+ NS_CAUSE_MISSING_ESSENT_IE = 0x0d,
+ /* TS 48.016 Section 10.3.2, Table 10.3.2.1 */
+ NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e,
+ NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f,
+ NS_CAUSE_INVAL_NR_NS_VC = 0x10,
+ NS_CAUSE_INVAL_WEIGH = 0x11,
+ NS_CAUSE_UNKN_IP_EP = 0x12,
+ NS_CAUSE_UNKN_IP_ADDR = 0x13,
+ NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14,
+};
+
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_18.h b/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_18.h
new file mode 100644
index 00000000..3a351eaa
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gprs/protocol/gsm_08_18.h
@@ -0,0 +1,144 @@
+#ifndef _OSMO_08_18_H
+#define _OSMO_08_18_H
+
+#include <stdint.h>
+
+/*! \brief Fixed BVCI definitions (Section 5.4.1) */
+#define BVCI_SIGNALLING 0x0000
+#define BVCI_PTM 0x0001
+
+/*! \brief BSSGP PDU types (Section 11.3.26 / Table 11.27) */
+enum bssgp_pdu_type {
+ /* PDUs between RL and BSSGP SAPs */
+ BSSGP_PDUT_DL_UNITDATA = 0x00,
+ BSSGP_PDUT_UL_UNITDATA = 0x01,
+ BSSGP_PDUT_RA_CAPABILITY = 0x02,
+ BSSGP_PDUT_PTM_UNITDATA = 0x03,
+ /* PDUs between GMM SAPs */
+ BSSGP_PDUT_PAGING_PS = 0x06,
+ BSSGP_PDUT_PAGING_CS = 0x07,
+ BSSGP_PDUT_RA_CAPA_UDPATE = 0x08,
+ BSSGP_PDUT_RA_CAPA_UPDATE_ACK = 0x09,
+ BSSGP_PDUT_RADIO_STATUS = 0x0a,
+ BSSGP_PDUT_SUSPEND = 0x0b,
+ BSSGP_PDUT_SUSPEND_ACK = 0x0c,
+ BSSGP_PDUT_SUSPEND_NACK = 0x0d,
+ BSSGP_PDUT_RESUME = 0x0e,
+ BSSGP_PDUT_RESUME_ACK = 0x0f,
+ BSSGP_PDUT_RESUME_NACK = 0x10,
+ /* PDus between NM SAPs */
+ BSSGP_PDUT_BVC_BLOCK = 0x20,
+ BSSGP_PDUT_BVC_BLOCK_ACK = 0x21,
+ BSSGP_PDUT_BVC_RESET = 0x22,
+ BSSGP_PDUT_BVC_RESET_ACK = 0x23,
+ BSSGP_PDUT_BVC_UNBLOCK = 0x24,
+ BSSGP_PDUT_BVC_UNBLOCK_ACK = 0x25,
+ BSSGP_PDUT_FLOW_CONTROL_BVC = 0x26,
+ BSSGP_PDUT_FLOW_CONTROL_BVC_ACK = 0x27,
+ BSSGP_PDUT_FLOW_CONTROL_MS = 0x28,
+ BSSGP_PDUT_FLOW_CONTROL_MS_ACK = 0x29,
+ BSSGP_PDUT_FLUSH_LL = 0x2a,
+ BSSGP_PDUT_FLUSH_LL_ACK = 0x2b,
+ BSSGP_PDUT_LLC_DISCARD = 0x2c,
+ BSSGP_PDUT_SGSN_INVOKE_TRACE = 0x40,
+ BSSGP_PDUT_STATUS = 0x41,
+ /* PDUs between PFM SAP's */
+ BSSGP_PDUT_DOWNLOAD_BSS_PFC = 0x50,
+ BSSGP_PDUT_CREATE_BSS_PFC = 0x51,
+ BSSGP_PDUT_CREATE_BSS_PFC_ACK = 0x52,
+ BSSGP_PDUT_CREATE_BSS_PFC_NACK = 0x53,
+ BSSGP_PDUT_MODIFY_BSS_PFC = 0x54,
+ BSSGP_PDUT_MODIFY_BSS_PFC_ACK = 0x55,
+ BSSGP_PDUT_DELETE_BSS_PFC = 0x56,
+ BSSGP_PDUT_DELETE_BSS_PFC_ACK = 0x57,
+};
+
+/*! \brief BSSGP User-Data header (Section 10.2.1 and 10.2.2) */
+struct bssgp_ud_hdr {
+ uint8_t pdu_type; /*!< BSSGP PDU type */
+ uint32_t tlli; /*!< Temporary Link-Local Identifier */
+ uint8_t qos_profile[3]; /*!< QoS profile */
+ uint8_t data[0]; /* optional/conditional IEs as TLVs */
+} __attribute__((packed));
+
+/*! \brief BSSGP normal header */
+struct bssgp_normal_hdr {
+ uint8_t pdu_type; /*!< BSSGP PDU type */
+ uint8_t data[0]; /*!< optional/conditional IEs as TLVs */
+};
+
+/*! \brief BSSGP Information Element Identifiers */
+enum bssgp_iei_type {
+ BSSGP_IE_ALIGNMENT = 0x00,
+ BSSGP_IE_BMAX_DEFAULT_MS = 0x01,
+ BSSGP_IE_BSS_AREA_ID = 0x02,
+ BSSGP_IE_BUCKET_LEAK_RATE = 0x03,
+ BSSGP_IE_BVCI = 0x04,
+ BSSGP_IE_BVC_BUCKET_SIZE = 0x05,
+ BSSGP_IE_BVC_MEASUREMENT = 0x06,
+ BSSGP_IE_CAUSE = 0x07,
+ BSSGP_IE_CELL_ID = 0x08,
+ BSSGP_IE_CHAN_NEEDED = 0x09,
+ BSSGP_IE_DRX_PARAMS = 0x0a,
+ BSSGP_IE_EMLPP_PRIO = 0x0b,
+ BSSGP_IE_FLUSH_ACTION = 0x0c,
+ BSSGP_IE_IMSI = 0x0d,
+ BSSGP_IE_LLC_PDU = 0x0e,
+ BSSGP_IE_LLC_FRAMES_DISCARDED = 0x0f,
+ BSSGP_IE_LOCATION_AREA = 0x10,
+ BSSGP_IE_MOBILE_ID = 0x11,
+ BSSGP_IE_MS_BUCKET_SIZE = 0x12,
+ BSSGP_IE_MS_RADIO_ACCESS_CAP = 0x13,
+ BSSGP_IE_OMC_ID = 0x14,
+ BSSGP_IE_PDU_IN_ERROR = 0x15,
+ BSSGP_IE_PDU_LIFETIME = 0x16,
+ BSSGP_IE_PRIORITY = 0x17,
+ BSSGP_IE_QOS_PROFILE = 0x18,
+ BSSGP_IE_RADIO_CAUSE = 0x19,
+ BSSGP_IE_RA_CAP_UPD_CAUSE = 0x1a,
+ BSSGP_IE_ROUTEING_AREA = 0x1b,
+ BSSGP_IE_R_DEFAULT_MS = 0x1c,
+ BSSGP_IE_SUSPEND_REF_NR = 0x1d,
+ BSSGP_IE_TAG = 0x1e,
+ BSSGP_IE_TLLI = 0x1f,
+ BSSGP_IE_TMSI = 0x20,
+ BSSGP_IE_TRACE_REFERENC = 0x21,
+ BSSGP_IE_TRACE_TYPE = 0x22,
+ BSSGP_IE_TRANSACTION_ID = 0x23,
+ BSSGP_IE_TRIGGER_ID = 0x24,
+ BSSGP_IE_NUM_OCT_AFF = 0x25,
+ BSSGP_IE_LSA_ID_LIST = 0x26,
+ BSSGP_IE_LSA_INFORMATION = 0x27,
+ BSSGP_IE_PACKET_FLOW_ID = 0x28,
+ BSSGP_IE_PACKET_FLOW_TIMER = 0x29,
+ BSSGP_IE_AGG_BSS_QOS_PROFILE = 0x3a,
+ BSSGP_IE_FEATURE_BITMAP = 0x3b,
+ BSSGP_IE_BUCKET_FULL_RATIO = 0x3c,
+ BSSGP_IE_SERVICE_UTRAN_CCO = 0x3d,
+};
+
+/*! \brief Cause coding (Section 11.3.8 / Table 11.10) */
+enum gprs_bssgp_cause {
+ BSSGP_CAUSE_PROC_OVERLOAD = 0x00,
+ BSSGP_CAUSE_EQUIP_FAIL = 0x01,
+ BSSGP_CAUSE_TRASIT_NET_FAIL = 0x02,
+ BSSGP_CAUSE_CAPA_GREATER_0KPBS = 0x03,
+ BSSGP_CAUSE_UNKNOWN_MS = 0x04,
+ BSSGP_CAUSE_UNKNOWN_BVCI = 0x05,
+ BSSGP_CAUSE_CELL_TRAF_CONG = 0x06,
+ BSSGP_CAUSE_SGSN_CONG = 0x07,
+ BSSGP_CAUSE_OML_INTERV = 0x08,
+ BSSGP_CAUSE_BVCI_BLOCKED = 0x09,
+ BSSGP_CAUSE_PFC_CREATE_FAIL = 0x0a,
+ BSSGP_CAUSE_SEM_INCORR_PDU = 0x20,
+ BSSGP_CAUSE_INV_MAND_INF = 0x21,
+ BSSGP_CAUSE_MISSING_MAND_IE = 0x22,
+ BSSGP_CAUSE_MISSING_COND_IE = 0x23,
+ BSSGP_CAUSE_UNEXP_COND_IE = 0x24,
+ BSSGP_CAUSE_COND_IE_ERR = 0x25,
+ BSSGP_CAUSE_PDU_INCOMP_STATE = 0x26,
+ BSSGP_CAUSE_PROTO_ERR_UNSPEC = 0x27,
+ BSSGP_CAUSE_PDU_INCOMP_FEAT = 0x28,
+};
+
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gsm/Makefile.am b/src/shared/libosmocore/include/osmocom/gsm/Makefile.am
deleted file mode 100644
index fc1abfe8..00000000
--- a/src/shared/libosmocore/include/osmocom/gsm/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-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 lapd_core.h lapdm.h \
- gsm0411_utils.h gsm0411_smc.h gsm0411_smr.h
-
-SUBDIRS = protocol
-
-osmogsmdir = $(includedir)/osmocom/gsm
diff --git a/src/shared/libosmocore/include/osmocom/gsm/a5.h b/src/shared/libosmocore/include/osmocom/gsm/a5.h
index 7e6a17c4..649dbab1 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/a5.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/a5.h
@@ -58,6 +58,6 @@ 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/shared/libosmocore/include/osmocom/gsm/abis_nm.h b/src/shared/libosmocore/include/osmocom/gsm/abis_nm.h
index 5b5bff0e..cc017650 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/abis_nm.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/abis_nm.h
@@ -35,6 +35,6 @@ void abis_nm_debugp_foh(int ss, struct abis_om_fom_hdr *foh);
int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan);
enum abis_nm_chan_comb abis_nm_pchan4chcomb(uint8_t chcomb);
-/*! }@ */
+/*! @} */
#endif /* _OSMO_GSM_ABIS_NM_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/gan.h b/src/shared/libosmocore/include/osmocom/gsm/gan.h
new file mode 100644
index 00000000..ab4c1e4e
--- /dev/null
+++ b/src/shared/libosmocore/include/osmocom/gsm/gan.h
@@ -0,0 +1,9 @@
+#ifndef _OSMO_GSM_GAN_H
+#define _OSMO_GSM_GAN_H
+
+#include <osmocom/core/utils.h>
+
+extern const struct value_string gan_msgt_vals[];
+static const struct value_string gan_pdisc_vals[];
+
+#endif
diff --git a/src/shared/libosmocore/include/osmocom/gsm/gsm0480.h b/src/shared/libosmocore/include/osmocom/gsm/gsm0480.h
index f6c37340..d6626d60 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/gsm0480.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/gsm0480.h
@@ -8,7 +8,7 @@
#define MAX_LEN_USSD_STRING 31
struct ussd_request {
- uint8_t text[MAX_LEN_USSD_STRING + 1];
+ char text[MAX_LEN_USSD_STRING + 1];
uint8_t transaction_id;
uint8_t invoke_id;
};
diff --git a/src/shared/libosmocore/include/osmocom/gsm/gsm48.h b/src/shared/libosmocore/include/osmocom/gsm/gsm48.h
index 16a625aa..1e7498a9 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/gsm48.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/gsm48.h
@@ -20,6 +20,8 @@ const char *gsm48_cc_state_name(uint8_t state);
const char *gsm48_cc_msg_name(uint8_t msgtype);
const char *rr_cause_name(uint8_t cause);
+int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc,
+ uint16_t *mnc, uint16_t *lac);
void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc,
uint16_t mnc, uint16_t lac);
int gsm48_generate_mid_from_tmsi(uint8_t *buf, uint32_t tmsi);
diff --git a/src/shared/libosmocore/include/osmocom/gsm/gsm_utils.h b/src/shared/libosmocore/include/osmocom/gsm/gsm_utils.h
index c9a31016..6d316727 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/gsm_utils.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/gsm_utils.h
@@ -143,6 +143,7 @@ enum gsm_chan_t {
GSM_LCHAN_TCH_H,
GSM_LCHAN_UNKNOWN,
GSM_LCHAN_CCCH,
+ GSM_LCHAN_PDTCH,
_GSM_LCHAN_MAX
};
diff --git a/src/shared/libosmocore/include/osmocom/gsm/lapdm.h b/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
index 52e8fc52..571fd460 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/lapdm.h
@@ -157,6 +157,6 @@ void lapdm_channel_set_flags(struct lapdm_channel *lc, unsigned int flags);
int lapdm_phsap_dequeue_prim(struct lapdm_entity *le, struct osmo_phsap_prim *pp);
-/*! }@ */
+/*! @} */
#endif /* _OSMOCOM_LAPDM_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/mncc.h b/src/shared/libosmocore/include/osmocom/gsm/mncc.h
index a094bb9b..a51267e0 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/mncc.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/mncc.h
@@ -1,6 +1,8 @@
#ifndef _OSMOCORE_MNCC_H
#define _OSMOCORE_MNCC_H
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
#define GSM_MAX_FACILITY 128
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
@@ -13,6 +15,18 @@ struct gsm_mncc_bearer_cap {
int radio; /* Radio Channel Requirement */
int speech_ctm; /* CTM text telephony indication */
int speech_ver[8]; /* Speech version indication */
+ struct {
+ enum gsm48_bcap_ra rate_adaption;
+ enum gsm48_bcap_sig_access sig_access;
+ int async;
+ int nr_stop_bits;
+ int nr_data_bits;
+ enum gsm48_bcap_user_rate user_rate;
+ enum gsm48_bcap_parity parity;
+ enum gsm48_bcap_interm_rate interm_rate;
+ enum gsm48_bcap_transp transp;
+ enum gsm48_bcap_modem_type modem_type;
+ } data;
};
struct gsm_mncc_number {
diff --git a/src/shared/libosmocore/include/osmocom/gsm/prim.h b/src/shared/libosmocore/include/osmocom/gsm/prim.h
index 95cbb120..5beb2007 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/prim.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/prim.h
@@ -8,6 +8,11 @@ enum osmo_gsm_sap {
SAP_GSM_PH = _SAP_GSM_BASE,
SAP_GSM_DL,
SAP_GSM_MDL,
+
+ SAP_BSSGP_GMM,
+ SAP_BSSGP_LL,
+ SAP_BSSGP_NM,
+ SAP_BSSGP_PFM,
};
#endif
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am b/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am
deleted file mode 100644
index 6ed55e46..00000000
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-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_44_318.h \
- gsm_12_21.h ipaccess.h
-
-osmogsm_protodir = $(includedir)/osmocom/gsm/protocol
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
index 5057ada8..172ef678 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -1246,6 +1246,80 @@ enum gsm48_bcap_rrq {
GSM48_BCAP_RRQ_DUAL_FR = 3,
};
+/* GSM 04.08 Bearer Capability: Rate Adaption */
+enum gsm48_bcap_ra {
+ GSM48_BCAP_RA_NONE = 0,
+ GSM48_BCAP_RA_V110_X30 = 1,
+ GSM48_BCAP_RA_X31 = 2,
+ GSM48_BCAP_RA_OTHER = 3,
+};
+
+/* GSM 04.08 Bearer Capability: Signalling access protocol */
+enum gsm48_bcap_sig_access {
+ GSM48_BCAP_SA_I440_I450 = 1,
+ GSM48_BCAP_SA_X21 = 2,
+ GSM48_BCAP_SA_X28_DP_IN = 3,
+ GSM48_BCAP_SA_X28_DP_UN = 4,
+ GSM48_BCAP_SA_X28_NDP = 5,
+ GSM48_BCAP_SA_X32 = 6,
+};
+
+/* GSM 04.08 Bearer Capability: User Rate */
+enum gsm48_bcap_user_rate {
+ GSM48_BCAP_UR_300 = 1,
+ GSM48_BCAP_UR_1200 = 2,
+ GSM48_BCAP_UR_2400 = 3,
+ GSM48_BCAP_UR_4800 = 4,
+ GSM48_BCAP_UR_9600 = 5,
+ GSM48_BCAP_UR_12000 = 6,
+ GSM48_BCAP_UR_1200_75 = 7,
+};
+
+/* GSM 04.08 Bearer Capability: Parity */
+enum gsm48_bcap_parity {
+ GSM48_BCAP_PAR_ODD = 0,
+ GSM48_BCAP_PAR_EVEN = 2,
+ GSM48_BCAP_PAR_NONE = 3,
+ GSM48_BCAP_PAR_ZERO = 4,
+ GSM48_BCAP_PAR_ONE = 5,
+};
+
+/* GSM 04.08 Bearer Capability: Intermediate Rate */
+enum gsm48_bcap_interm_rate {
+ GSM48_BCAP_IR_8k = 2,
+ GSM48_BCAP_IR_16k = 3,
+};
+
+/* GSM 04.08 Bearer Capability: Transparency */
+enum gsm48_bcap_transp {
+ GSM48_BCAP_TR_TRANSP = 0,
+ GSM48_BCAP_TR_RLP = 1,
+ GSM48_BCAP_TR_TR_PREF = 2,
+ GSM48_BCAP_TR_RLP_PREF = 3,
+};
+
+/* GSM 04.08 Bearer Capability: Modem Type */
+enum gsm48_bcap_modem_type {
+ GSM48_BCAP_MT_NONE = 0,
+ GSM48_BCAP_MT_V21 = 1,
+ GSM48_BCAP_MT_V22 = 2,
+ GSM48_BCAP_MT_V22bis = 3,
+ GSM48_BCAP_MT_V23 = 4,
+ GSM48_BCAP_MT_V26ter = 5,
+ GSM48_BCAP_MT_V32 = 6,
+ GSM48_BCAP_MT_UNDEF = 7,
+ GSM48_BCAP_MT_AUTO_1 = 8,
+};
+
+/* GSM 04.08 Bearer Capability: Speech Version Indication */
+enum gsm48_bcap_speech_ver {
+ GSM48_BCAP_SV_FR = 0,
+ GSM48_BCAP_SV_HR = 1,
+ GSM48_BCAP_SV_EFR = 2,
+ GSM48_BCAP_SV_AMR_F = 4,
+ GSM48_BCAP_SV_AMR_H = 5,
+};
+
#define GSM48_TMSI_LEN 5
#define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2)
#define GSM48_MI_SIZE 32
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
index b6a5dd83..57a8f687 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
@@ -338,10 +338,26 @@ enum rsl_cmod_spd {
#define RSL_CMOD_SP_GSM1 0x01
#define RSL_CMOD_SP_GSM2 0x11
#define RSL_CMOD_SP_GSM3 0x21
-/* Data */
-#define RSL_CMOD_SP_NT_14k5 0x58
-#define RSL_CMOD_SP_NT_12k0 0x50
-#define RSL_CMOD_SP_NT_6k0 0x51
+/* non-transparent data */
+#define RSL_CMOD_CSD_NT_43k5 0x74
+#define RSL_CMOD_CSD_NT_28k8 0x71
+#define RSL_CMOD_CSD_NT_14k5 0x58
+#define RSL_CMOD_CSD_NT_12k0 0x50
+#define RSL_CMOD_CSD_NT_6k0 0x51
+/* legacy #defines with wrong name */
+#define RSL_CMOD_SP_NT_14k5 RSL_CMOD_CSD_NT_14k5
+#define RSL_CMOD_SP_NT_12k0 RSL_CMOD_CSD_NT_12k0
+#define RSL_CMOD_SP_NT_6k0 RSL_CMOD_CSD_NT_6k0
+/* transparent data */
+#define RSL_CMOD_CSD_T_32000 0x38
+#define RSL_CMOD_CSD_T_29000 0x39
+#define RSL_CMOD_CSD_T_14400 0x18
+#define RSL_CMOD_CSD_T_9600 0x10
+#define RSL_CMOD_CSD_T_4800 0x11
+#define RSL_CMOD_CSD_T_2400 0x12
+#define RSL_CMOD_CSD_T_1200 0x13
+#define RSL_CMOD_CSD_T_600 0x14
+#define RSL_CMOD_CSD_T_1200_75 0x15
/*! \brief RSL Channel Identification IE (Chapter 9.3.5) */
struct rsl_ie_chan_ident {
@@ -556,6 +572,6 @@ enum rsl_mrpci_phase {
RSL_MRPCI_PHASE_2PLUS = 3,
};
-/*! }@ */
+/*! @} */
#endif /* PROTO_GSM_08_58_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_12_21.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_12_21.h
index 061dcb63..694df938 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_12_21.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_12_21.h
@@ -743,6 +743,6 @@ enum ipac_bcch_info_type {
IPAC_BINF_CELL_ALLOC = (1 << 2),
};
-/*! }@ */
+/*! @} */
#endif /* PROTO_GSM_12_21_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
index 31c0ea7c..cd5ec05a 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
@@ -5,6 +5,13 @@
/* Definitions according to 3GPP TS 44.318 6.8.0 Release 6 */
+/* Table 11.1.1.2.1: Protocol Discriminator */
+enum gan_pdisc {
+ GA_PDISC_RC = 0,
+ GA_PDISC_CSR = 1,
+ GA_PDISC_PSR = 2,
+};
+
/* Table 11.1.1.4.1: Message types for URR */
enum gan_msg_type {
@@ -51,6 +58,9 @@ enum gan_msg_type {
GA_MT_RC_KEEPALIVE = 0x74,
GA_MT_CSR_CM_ENQ = 0x75,
GA_MT_CSR_CM_CHANGE = 0x76,
+ GA_MT_PSR_GPRS_SUSPEND_REQ = 0x77,
+ GA_RC_SYNC_INFO = 0x78,
+ GA_CSR_UTRAN_CM_CHG = 0x79,
GA_MT_CSR_REQUEST = 0x80,
GA_MT_CSR_REQUEST_ACCEPT = 0x81,
@@ -94,9 +104,9 @@ enum gan_iei {
GA_IE_TLLI = 34,
GA_IE_PFI = 35,
GA_IE_SUSP_CAUSE = 36,
- GA_IE_TU3820_TIMER = 37,
+ GA_IE_TU3920_TIMER = 37,
GA_IE_REQD_QOS = 38,
- GA_IE_P_DEACT_CAUSE = 39
+ GA_IE_P_DEACT_CAUSE = 39,
GA_IE_REQD_UL_RATE = 40,
GA_IE_RAC = 41,
GA_IE_AP_LOCATION = 42,
@@ -134,7 +144,7 @@ enum gan_iei {
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_GPRS_UDP_PORT = 100,
GA_IE_GANC_TCP_PORT = 103,
GA_IE_RTP_UDP_PORT = 104,
GA_IE_RTCP_UDP_PORT = 105,
@@ -148,6 +158,43 @@ struct gan_rc_csr_hdr {
uint8_t pdisc:4,
skip_ind:4;
uint8_t msg_type;
+ uint8_t data[0];
} __attribute__((packed));
+/* 11.2.14.1: GAN Control Channel Description IE */
+struct gan_cch_desc_ie {
+ uint8_t spare:1,
+ ecmc:1,
+ nmo:2,
+ gprs:1,
+ dtm:1,
+ att:1,
+ mscr:1;
+#if 0
+ uint8_t mscr:1,
+ att:1,
+ dtm:1,
+ gprs:1,
+ nmo:2,
+ ecmc:1,
+ spare:1;
+#endif
+ uint8_t t3212;
+ uint8_t rac;
+ uint8_t sgsnr:1,
+ ecmp:1,
+ re:1,
+ pfcfm:1,
+ tgecs:2,
+ spare2:2;
+#if 0
+ uint8_t spare2:2,
+ tgecs:2,
+ pfcfm:1,
+ re:1,
+ ecmp:1,
+ sgsnr:1;
+#endif
+ uint8_t access_class[2];
+} __attribute__((packed));
#endif /* PROTO_GSM_44_318_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/rsl.h b/src/shared/libosmocore/include/osmocom/gsm/rsl.h
index 712d17b1..b8e4157a 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/rsl.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/rsl.h
@@ -50,6 +50,6 @@ void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
struct msgb *rsl_rll_simple(uint8_t msg_type, uint8_t chan_nr,
uint8_t link_id, int transparent);
-/*! }@ */
+/*! @} */
#endif /* _OSMOCORE_RSL_H */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/tlv.h b/src/shared/libosmocore/include/osmocom/gsm/tlv.h
index d2936d6d..9c0319d9 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/tlv.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/tlv.h
@@ -20,6 +20,7 @@
TL16V 8 16 N * 8
TLV16 8 8 N * 16
TvLV 8 8/16 N * 8
+ vTvLV 8/16 8/16 N * 8
*/
@@ -46,6 +47,36 @@ static inline uint16_t TVLV_GROSS_LEN(uint16_t len)
return TL16V_GROSS_LEN(len);
}
+/*! \brief gross length of vTvL header (tag+len) */
+static inline uint16_t VTVL_GAN_GROSS_LEN(uint16_t tag, uint16_t len)
+{
+ uint16_t ret = 2;
+
+ if (tag > TVLV_MAX_ONEBYTE)
+ ret++;
+
+ if (len > TVLV_MAX_ONEBYTE)
+ ret++;
+
+ return ret;
+}
+
+/*! \brief gross length of vTvLV (tag+len+val) */
+static inline uint16_t VTVLV_GAN_GROSS_LEN(uint16_t tag, uint16_t len)
+{
+ uint16_t ret;
+
+ if (len <= TVLV_MAX_ONEBYTE)
+ return TLV_GROSS_LEN(len);
+ else
+ return TL16V_GROSS_LEN(len);
+
+ if (tag > TVLV_MAX_ONEBYTE)
+ ret += 1;
+
+ return ret;
+}
+
/* TLV generation */
/*! \brief put (append) a LV field */
@@ -103,6 +134,42 @@ static inline uint8_t *tvlv_put(uint8_t *buf, uint8_t tag, uint16_t len,
return ret;
}
+/*! \brief put (append) a variable-length tag or variable-length length * */
+static inline uint8_t *vt_gan_put(uint8_t *buf, uint16_t tag)
+{
+ if (tag > TVLV_MAX_ONEBYTE) {
+ /* two-byte TAG */
+ *buf++ = 0x80 | (tag >> 8);
+ *buf++ = (tag & 0xff);
+ } else
+ *buf++ = tag;
+
+ return buf;
+}
+
+/* \brief put (append) vTvL (GAN) field (tag + length)*/
+static inline uint8_t *vtvl_gan_put(uint8_t *buf, uint16_t tag, uint16_t len)
+{
+ uint8_t *ret;
+
+ ret = vt_gan_put(buf, tag);
+ return vt_gan_put(ret, len);
+}
+
+/* \brief put (append) vTvLV (GAN) field (tag + length + val) */
+static inline uint8_t *vtvlv_gan_put(uint8_t *buf, uint16_t tag, uint16_t len,
+ const uint8_t *val)
+{
+ uint8_t *ret;
+
+ ret = vtvl_gan_put(buf, tag, len );
+
+ memcpy(ret, val, len);
+ ret = buf + len;
+
+ return ret;
+}
+
/*! \brief put (append) a TLV16 field to \ref msgb */
static inline uint8_t *msgb_tlv16_put(struct msgb *msg, uint8_t tag, uint8_t len, const uint16_t *val)
{
@@ -126,6 +193,14 @@ static inline uint8_t *msgb_tvlv_put(struct msgb *msg, uint8_t tag, uint16_t len
return tvlv_put(buf, tag, len, val);
}
+/*! \brief put (append) a vTvLV field to \ref msgb */
+static inline uint8_t *msgb_vtvlv_gan_put(struct msgb *msg, uint16_t tag,
+ uint16_t len, const uint8_t *val)
+{
+ uint8_t *buf = msgb_put(msg, VTVLV_GAN_GROSS_LEN(tag, len));
+ return vtvlv_gan_put(buf, tag, len, val);
+}
+
/*! \brief put (append) a L16TV field to \ref msgb */
static inline uint8_t *msgb_l16tv_put(struct msgb *msg, uint16_t len, uint8_t tag,
const uint8_t *val)
@@ -264,6 +339,25 @@ static inline uint8_t *msgb_tvlv_push(struct msgb *msg, uint8_t tag, uint16_t le
return buf;
}
+/* \brief push (prepend) a vTvL header to a \ref msgb
+ */
+static inline uint8_t *msgb_vtvl_gan_push(struct msgb *msg, uint16_t tag,
+ uint16_t len)
+{
+ uint8_t *buf = msgb_push(msg, VTVL_GAN_GROSS_LEN(tag, len));
+ vtvl_gan_put(buf, tag, len);
+ return buf;
+}
+
+
+static inline uint8_t *msgb_vtvlv_gan_push(struct msgb *msg, uint16_t tag,
+ uint16_t len, const uint8_t *val)
+{
+ uint8_t *buf = msgb_push(msg, VTVLV_GAN_GROSS_LEN(tag, len));
+ vtvlv_gan_put(buf, tag, len, val);
+ return buf;
+}
+
/* TLV parsing */
/*! \brief Entry in a TLV parser array */
@@ -281,7 +375,8 @@ enum tlv_type {
TLV_TYPE_TLV, /*!< \brief tag-length-value */
TLV_TYPE_TL16V, /*!< \brief tag, 16 bit length, value */
TLV_TYPE_TvLV, /*!< \brief tag, variable length, value */
- TLV_TYPE_SINGLE_TV /*!< \brief tag and value (both 4 bit) in 1 byte */
+ TLV_TYPE_SINGLE_TV, /*!< \brief tag and value (both 4 bit) in 1 byte */
+ TLV_TYPE_vTvLV_GAN, /*!< \brief variable-length tag, variable-length length */
};
/*! \brief Definition of a single IE (Information Element) */
@@ -301,6 +396,7 @@ struct tlv_parsed {
};
extern struct tlv_definition tvlv_att_def;
+extern struct tlv_definition vtvlv_gan_att_def;
int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val,
const struct tlv_definition *def,
@@ -314,6 +410,6 @@ void tlv_def_patch(struct tlv_definition *dst, const struct tlv_definition *src)
#define TLVP_LEN(x, y) (x)->lv[y].len
#define TLVP_VAL(x, y) (x)->lv[y].val
-/*! }@ */
+/*! @} */
#endif /* _TLV_H */
diff --git a/src/shared/libosmocore/include/osmocom/vty/Makefile.am b/src/shared/libosmocore/include/osmocom/vty/Makefile.am
deleted file mode 100644
index 83d00107..00000000
--- a/src/shared/libosmocore/include/osmocom/vty/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-osmovty_HEADERS = buffer.h command.h vector.h vty.h \
- telnet_interface.h logging.h misc.h
-
-osmovtydir = $(includedir)/osmocom/vty
diff --git a/src/shared/libosmocore/include/osmocom/vty/command.h b/src/shared/libosmocore/include/osmocom/vty/command.h
index 79d0aecf..caafdeb5 100644
--- a/src/shared/libosmocore/include/osmocom/vty/command.h
+++ b/src/shared/libosmocore/include/osmocom/vty/command.h
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <sys/types.h>
#include "vector.h"
-#include "vty.h"
/*! \defgroup command VTY Command
* @{
@@ -82,10 +81,14 @@ enum node_type {
L_E1INP_NODE, /*!< \brief E1 line in libosmo-abis. */
L_IPA_NODE, /*!< \brief IPA proxying commands in libosmo-abis. */
+ L_NS_NODE, /*!< \brief NS node in libosmo-gb. */
+ L_BSSGP_NODE, /*!< \brief BSSGP node in libosmo-gb. */
_LAST_OSMOVTY_NODE
};
+#include "vty.h"
+
/*! \brief Node which has some commands and prompt string and
* configuration function pointer . */
struct cmd_node {
@@ -366,5 +369,5 @@ void print_version(int print_copyright);
extern void *tall_vty_cmd_ctx;
-/*! }@ */
+/*! @} */
#endif /* _ZEBRA_COMMAND_H */
diff --git a/src/shared/libosmocore/include/osmocom/vty/misc.h b/src/shared/libosmocore/include/osmocom/vty/misc.h
index 89234733..e64aec79 100644
--- a/src/shared/libosmocore/include/osmocom/vty/misc.h
+++ b/src/shared/libosmocore/include/osmocom/vty/misc.h
@@ -4,6 +4,11 @@
#include <osmocom/vty/vty.h>
#include <osmocom/core/rate_ctr.h>
+#define VTY_DO_LOWER 1
+char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals,
+ const char *prefix, const char *sep,
+ const char *end, int do_lower);
+
void vty_out_rate_ctr_group(struct vty *vty, const char *prefix,
struct rate_ctr_group *ctrg);
diff --git a/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h b/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
index 65a1dd90..3c222014 100644
--- a/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
+++ b/src/shared/libosmocore/include/osmocom/vty/telnet_interface.h
@@ -51,6 +51,6 @@ int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port);
void telnet_exit(void);
-/*! }@ */
+/*! @} */
#endif /* TELNET_INTERFACE_H */
diff --git a/src/shared/libosmocore/include/osmocom/vty/vty.h b/src/shared/libosmocore/include/osmocom/vty/vty.h
index 83506c5e..e656abf6 100644
--- a/src/shared/libosmocore/include/osmocom/vty/vty.h
+++ b/src/shared/libosmocore/include/osmocom/vty/vty.h
@@ -40,6 +40,13 @@ enum event {
#endif /* VTYSH */
};
+enum vty_type {
+ VTY_TERM,
+ VTY_FILE,
+ VTY_SHELL,
+ VTY_SHELL_SERV
+};
+
/*! Internal representation of a single VTY */
struct vty {
/*! \brief underlying file (if any) */
@@ -52,7 +59,7 @@ struct vty {
int fd;
/*! \brief Is this vty connect to file or not */
- enum { VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV } type;
+ enum vty_type type;
/*! \brief Node status of this vty */
int node;
@@ -134,7 +141,7 @@ struct vty {
/* Small macro to determine newline is newline only or linefeed needed. */
#define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n")
-static inline char *vty_newline(struct vty *vty)
+static inline const char *vty_newline(struct vty *vty)
{
return VTY_NEWLINE;
}
@@ -183,6 +190,6 @@ extern void *tall_vty_ctx;
extern struct cmd_element cfg_description_cmd;
extern struct cmd_element cfg_no_description_cmd;
-/*! }@ */
+/*! @} */
#endif