aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/codec/ecu.h63
-rw-r--r--include/osmocom/core/fsm.h1
-rw-r--r--include/osmocom/core/logging.h17
-rw-r--r--include/osmocom/core/logging_internal.h3
-rw-r--r--include/osmocom/core/msgb.h4
-rw-r--r--include/osmocom/core/select.h2
-rw-r--r--include/osmocom/core/sockaddr_str.h9
-rw-r--r--include/osmocom/core/socket.h7
-rw-r--r--include/osmocom/core/talloc.h28
-rw-r--r--include/osmocom/core/tdef.h7
-rw-r--r--include/osmocom/gprs/gprs_bssgp.h2
-rw-r--r--include/osmocom/gsm/bts_features.h1
-rw-r--r--include/osmocom/gsm/gsm0502.h12
-rw-r--r--include/osmocom/gsm/gsm0808_utils.h1
-rw-r--r--include/osmocom/gsm/gsm_utils.h4
-rw-r--r--include/osmocom/gsm/gsup.h7
-rw-r--r--include/osmocom/gsm/l1sap.h10
-rw-r--r--include/osmocom/gsm/mncc.h8
-rw-r--r--include/osmocom/gsm/protocol/gsm_04_08.h43
-rw-r--r--include/osmocom/gsm/protocol/gsm_08_08.h4
-rw-r--r--include/osmocom/gsm/protocol/gsm_08_58.h2
-rw-r--r--include/osmocom/vty/tdef_vty.h3
22 files changed, 204 insertions, 34 deletions
diff --git a/include/osmocom/codec/ecu.h b/include/osmocom/codec/ecu.h
index ec0a2f8d..99b1430f 100644
--- a/include/osmocom/codec/ecu.h
+++ b/include/osmocom/codec/ecu.h
@@ -5,11 +5,68 @@
#include <osmocom/codec/codec.h>
-/* Codec independent ECU state */
+/* ECU state for GSM-FR */
struct osmo_ecu_fr_state {
bool subsequent_lost_frame;
uint8_t frame_backup[GSM_FR_BYTES];
};
-void osmo_ecu_fr_reset(struct osmo_ecu_fr_state *state, const uint8_t *frame);
-int osmo_ecu_fr_conceal(struct osmo_ecu_fr_state *state, uint8_t *frame);
+void osmo_ecu_fr_reset(struct osmo_ecu_fr_state *state, const uint8_t *frame)
+ OSMO_DEPRECATED("Use generic ECU abstraction layer instead");
+int osmo_ecu_fr_conceal(struct osmo_ecu_fr_state *state, uint8_t *frame)
+ OSMO_DEPRECATED("Use generic ECU abstraction layer instead");
+
+enum osmo_ecu_codec {
+ OSMO_ECU_CODEC_HR,
+ OSMO_ECU_CODEC_FR,
+ OSMO_ECU_CODEC_EFR,
+ OSMO_ECU_CODEC_AMR,
+ _NUM_OSMO_ECU_CODECS
+};
+
+/***********************************************************************
+ * Generic ECU abstraction layer below
+ ***********************************************************************/
+
+/* As the developer and copyright holder of the related code, I hereby
+ * state that any ECU implementation using 'struct osmo_ecu_ops' and
+ * registering with the 'osmo_ecu_register()' function shall not be
+ * considered as a derivative work under any applicable copyright law;
+ * the copyleft terms of GPLv2 shall hence not apply to any such ECU
+ * implementation.
+ *
+ * The intent of the above exception is to allow anyone to combine third
+ * party Error Concealment Unit implementations with libosmocodec.
+ * including but not limited to such published by ETSI.
+ *
+ * -- Harald Welte <laforge@gnumonks.org> on August 1, 2019.
+ */
+
+/* Codec independent ECU state */
+struct osmo_ecu_state {
+ enum osmo_ecu_codec codec;
+ uint8_t data[0];
+};
+
+/* initialize an ECU instance */
+struct osmo_ecu_state *osmo_ecu_init(void *ctx, enum osmo_ecu_codec codec);
+
+/* destroy an ECU instance */
+void osmo_ecu_destroy(struct osmo_ecu_state *st);
+
+/* process a received frame a substitute/erroneous frame */
+int osmo_ecu_frame_in(struct osmo_ecu_state *st, bool bfi,
+ const uint8_t *frame, unsigned int frame_bytes);
+
+/* generate output data for a substitute/erroneous frame */
+int osmo_ecu_frame_out(struct osmo_ecu_state *st, uint8_t *frame_out);
+
+struct osmo_ecu_ops {
+ struct osmo_ecu_state * (*init)(void *ctx, enum osmo_ecu_codec codec);
+ void (*destroy)(struct osmo_ecu_state *);
+ int (*frame_in)(struct osmo_ecu_state *st, bool bfi,
+ const uint8_t *frame, unsigned int frame_bytes);
+ int (*frame_out)(struct osmo_ecu_state *st, uint8_t *frame_out);
+};
+
+int osmo_ecu_register(const struct osmo_ecu_ops *ops, enum osmo_ecu_codec codec);
diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index 1701c45e..269befa5 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -122,6 +122,7 @@ struct osmo_fsm_inst {
void osmo_fsm_log_addr(bool log_addr);
void osmo_fsm_log_timeouts(bool log_timeouts);
void osmo_fsm_term_safely(bool term_safely);
+void osmo_fsm_set_dealloc_ctx(void *ctx);
/*! Log using FSM instance's context, on explicit logging subsystem and level.
* \param fi An osmo_fsm_inst.
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 803b4a94..139d2916 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -154,6 +154,7 @@ enum log_ctx_index {
LOG_CTX_GB_BVC,
LOG_CTX_BSC_SUBSCR,
LOG_CTX_VLR_SUBSCR,
+ LOG_CTX_L1_SAPI,
_LOG_CTX_COUNT
};
@@ -166,6 +167,7 @@ enum log_filter_index {
LOG_FLT_GB_BVC,
LOG_FLT_BSC_SUBSCR,
LOG_FLT_VLR_SUBSCR,
+ LOG_FLT_L1_SAPI,
_LOG_FLT_COUNT
};
@@ -377,6 +379,19 @@ void log_add_target(struct log_target *target);
void log_del_target(struct log_target *target);
struct log_target *log_target_find(int type, const char *fname);
-extern struct llist_head osmo_log_target_list;
+
+void log_enable_multithread(void);
+
+void log_tgt_mutex_lock_impl(void);
+void log_tgt_mutex_unlock_impl(void);
+#define LOG_MTX_DEBUG 0
+#if LOG_MTX_DEBUG
+ #include <pthread.h>
+ #define log_tgt_mutex_lock() do { fprintf(stderr, "[%lu] %s:%d [%s] lock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_lock_impl(); } while (0)
+ #define log_tgt_mutex_unlock() do { fprintf(stderr, "[%lu] %s:%d [%s] unlock\n", pthread_self(), __FILE__, __LINE__, __func__); log_tgt_mutex_unlock_impl(); } while (0)
+#else
+ #define log_tgt_mutex_lock() log_tgt_mutex_lock_impl()
+ #define log_tgt_mutex_unlock() log_tgt_mutex_unlock_impl()
+#endif
/*! @} */
diff --git a/include/osmocom/core/logging_internal.h b/include/osmocom/core/logging_internal.h
index a510f83e..2e656603 100644
--- a/include/osmocom/core/logging_internal.h
+++ b/include/osmocom/core/logging_internal.h
@@ -7,8 +7,9 @@
#include <osmocom/core/utils.h>
extern void *tall_log_ctx;
-extern const struct log_info *osmo_log_info;
+extern struct log_info *osmo_log_info;
extern const struct value_string loglevel_strs[];
+extern struct llist_head osmo_log_target_list;
void assert_loginfo(const char *src);
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index e05d37f0..1833a6c1 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -518,7 +518,7 @@ static inline int msgb_l3trim(struct msgb *msg, int l3len)
static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, int size, int headroom,
const char *name)
{
- osmo_static_assert(size > headroom, headroom_bigger);
+ osmo_static_assert(size >= headroom, headroom_bigger);
struct msgb *msg = msgb_alloc_c(ctx, size, name);
if (msg)
@@ -540,7 +540,7 @@ static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, int size, int
static inline struct msgb *msgb_alloc_headroom(int size, int headroom,
const char *name)
{
- osmo_static_assert(size > headroom, headroom_bigger);
+ osmo_static_assert(size >= headroom, headroom_bigger);
struct msgb *msg = msgb_alloc(size, name);
if (msg)
diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h
index e4787b09..92904e2f 100644
--- a/include/osmocom/core/select.h
+++ b/include/osmocom/core/select.h
@@ -51,6 +51,8 @@ int osmo_fd_register(struct osmo_fd *fd);
void osmo_fd_unregister(struct osmo_fd *fd);
void osmo_fd_close(struct osmo_fd *fd);
int osmo_select_main(int polling);
+int osmo_select_main_ctx(int polling);
+void osmo_select_init(void);
struct osmo_fd *osmo_fd_get_by_fd(int fd);
diff --git a/include/osmocom/core/sockaddr_str.h b/include/osmocom/core/sockaddr_str.h
index 253b755f..6dd428c7 100644
--- a/include/osmocom/core/sockaddr_str.h
+++ b/include/osmocom/core/sockaddr_str.h
@@ -61,10 +61,15 @@ struct osmo_sockaddr_str {
* struct osmo_sockaddr_str *my_sockaddr_str = ...;
* printf("got " OSMO_SOCKADDR_STR_FMT "\n", OSMO_SOCKADDR_STR_FMT_ARGS(my_sockaddr_str));
*/
-#define OSMO_SOCKADDR_STR_FMT "%s:%u"
-#define OSMO_SOCKADDR_STR_FMT_ARGS(R) ((R)->ip ? : ""), (R)->port
+#define OSMO_SOCKADDR_STR_FMT "%s%s%s:%u"
+#define OSMO_SOCKADDR_STR_FMT_ARGS(R) \
+ ((R) && (R)->af == AF_INET6)? "[" : "", \
+ (R)? (R)->ip : "NULL", \
+ ((R) && (R)->af == AF_INET6)? "]" : "", \
+ (R)? (R)->port : 0
bool osmo_sockaddr_str_is_set(const struct osmo_sockaddr_str *sockaddr_str);
+bool osmo_sockaddr_str_is_nonzero(const struct osmo_sockaddr_str *sockaddr_str);
int osmo_sockaddr_str_from_str(struct osmo_sockaddr_str *sockaddr_str, const char *ip, uint16_t port);
diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h
index 37b1eaef..e26ca0d3 100644
--- a/include/osmocom/core/socket.h
+++ b/include/osmocom/core/socket.h
@@ -36,6 +36,9 @@ struct osmo_fd;
/*! use SO_REUSEADDR on UDP ports (required for multicast) */
#define OSMO_SOCK_F_UDP_REUSEADDR (1 << 5)
+/*! maximum number of local or remote addresses supported by an osmo_sock instance */
+#define OSMO_SOCK_MAX_ADDRS 32
+
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
const char *host, uint16_t port, unsigned int flags);
@@ -43,6 +46,10 @@ int osmo_sock_init2(uint16_t family, uint16_t type, uint8_t proto,
const char *local_host, uint16_t local_port,
const char *remote_host, uint16_t remote_port, unsigned int flags);
+int osmo_sock_init2_multiaddr(uint16_t family, uint16_t type, uint8_t proto,
+ const char **local_hosts, size_t local_hosts_cnt, uint16_t local_port,
+ const char **remote_hosts, size_t remote_hosts_cnt, uint16_t remote_port, unsigned int flags);
+
int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto,
const char *host, uint16_t port, unsigned int flags);
diff --git a/include/osmocom/core/talloc.h b/include/osmocom/core/talloc.h
index 191a463f..c68a56cf 100644
--- a/include/osmocom/core/talloc.h
+++ b/include/osmocom/core/talloc.h
@@ -1,5 +1,27 @@
-/*! \file talloc.h
- * Convenience wrapper. libosmocore used to ship its own internal copy of
- * talloc, before libtalloc became a standard component on most systems */
+/*! \file talloc.h */
#pragma once
#include <talloc.h>
+
+/*! per-thread talloc contexts. This works around the problem that talloc is not
+ * thread-safe. However, one can simply have a different set of talloc contexts for each
+ * thread, and ensure that allocations made on one thread are always only free'd on that
+ * very same thread.
+ * WARNING: Users must make sure they free() on the same thread as they allocate!! */
+struct osmo_talloc_contexts {
+ /*! global per-thread talloc context. */
+ void *global;
+ /*! volatile select-dispatch context. This context is completely free'd and
+ * re-created every time the main select loop in osmo_select_main() returns from
+ * select(2) and calls per-fd callback functions. This allows users of this
+ * facility to allocate temporary objects like string buffers, message buffers
+ * and the like which are automatically free'd when going into the next select()
+ * system call */
+ void *select;
+};
+
+extern __thread struct osmo_talloc_contexts *osmo_ctx;
+
+/* short-hand #defines for the osmo talloc contexts (OTC) that can be used to pass
+ * to the various _c functions like msgb_alloc_c() */
+#define OTC_GLOBAL (osmo_ctx->global)
+#define OTC_SELECT (osmo_ctx->select)
diff --git a/include/osmocom/core/tdef.h b/include/osmocom/core/tdef.h
index 566f5dd3..54819d95 100644
--- a/include/osmocom/core/tdef.h
+++ b/include/osmocom/core/tdef.h
@@ -77,6 +77,10 @@ struct osmo_tdef {
/*! Currently active timeout value, e.g. set by user config. This is the only mutable member: a user may
* configure the timeout value, but neither unit nor any other field. */
unsigned long val;
+ /*! Minimum timer value (in this tdef unit), checked if set (not zero). */
+ unsigned long min_val;
+ /*! Maximum timer value (in this tdef unit), checked if set (not zero). */
+ unsigned long max_val;
};
/*! Iterate an array of struct osmo_tdef, the last item should be fully zero, i.e. "{}".
@@ -97,6 +101,9 @@ void osmo_tdefs_reset(struct osmo_tdef *tdefs);
unsigned long osmo_tdef_get(const struct osmo_tdef *tdefs, int T, enum osmo_tdef_unit as_unit,
long val_if_not_present);
struct osmo_tdef *osmo_tdef_get_entry(struct osmo_tdef *tdefs, int T);
+int osmo_tdef_set(struct osmo_tdef *tdefs, int T, unsigned long val, enum osmo_tdef_unit val_unit);
+bool osmo_tdef_val_in_range(struct osmo_tdef *tdef, unsigned long new_val);
+int osmo_tdef_range_str_buf(char *buf, size_t buf_len, struct osmo_tdef *t);
/*! Using osmo_tdef for osmo_fsm_inst: array entry for a mapping of state numbers to timeout definitions.
* For a usage example, see osmo_tdef_get_state_timeout() and test_tdef_state_timeout() in tdef_test.c. */
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 400c3e00..0f87333a 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -112,6 +112,8 @@ extern struct llist_head bssgp_bvc_ctxts;
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);
+/* Free a given BTS context */
+void bssgp_bvc_ctx_free(struct bssgp_bvc_ctx *ctx);
#define BVC_F_BLOCKED 0x0001
diff --git a/include/osmocom/gsm/bts_features.h b/include/osmocom/gsm/bts_features.h
index e84f95b6..7ead0203 100644
--- a/include/osmocom/gsm/bts_features.h
+++ b/include/osmocom/gsm/bts_features.h
@@ -23,6 +23,7 @@ enum osmo_bts_features {
BTS_FEAT_SPEECH_F_EFR,
BTS_FEAT_SPEECH_F_AMR,
BTS_FEAT_SPEECH_H_AMR,
+ BTS_FEAT_ETWS_PN,
_NUM_BTS_FEAT
};
diff --git a/include/osmocom/gsm/gsm0502.h b/include/osmocom/gsm/gsm0502.h
index fe5cf7e1..c9901dfd 100644
--- a/include/osmocom/gsm/gsm0502.h
+++ b/include/osmocom/gsm/gsm0502.h
@@ -35,3 +35,15 @@ gsm0502_get_paging_group(uint64_t imsi, unsigned int bs_cc_chans,
unsigned int
gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi);
+
+enum gsm0502_fn_remap_channel {
+ FN_REMAP_TCH_F,
+ FN_REMAP_TCH_H0,
+ FN_REMAP_TCH_H1,
+ FN_REMAP_FACCH_F,
+ FN_REMAP_FACCH_H0,
+ FN_REMAP_FACCH_H1,
+ FN_REMAP_MAX,
+};
+
+uint32_t gsm0502_fn_remap(uint32_t fn, enum gsm0502_fn_remap_channel channel);
diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index 76db2b6d..ccdf5ed9 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -95,6 +95,7 @@ void gsm0808_cell_id_from_cgi(struct gsm0808_cell_id *cid, enum CELL_IDENT id_di
int gsm0808_cell_id_to_cgi(struct osmo_cell_global_id *cgi, const struct gsm0808_cell_id *cid);
void gsm0808_msgb_put_cell_id_u(struct msgb *msg, enum CELL_IDENT id_discr, const union gsm0808_cell_id_u *u);
int gsm0808_decode_cell_id_u(union gsm0808_cell_id_u *out, enum CELL_IDENT discr, const uint8_t *buf, unsigned int len);
+int gsm0808_cell_id_size(enum CELL_IDENT discr);
uint8_t gsm0808_enc_cause(struct msgb *msg, uint16_t cause);
uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg,
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h
index 7a5da9a6..de634348 100644
--- a/include/osmocom/gsm/gsm_utils.h
+++ b/include/osmocom/gsm/gsm_utils.h
@@ -30,7 +30,6 @@
#include <osmocom/core/defs.h>
#include <osmocom/core/utils.h>
-#include <osmocom/gsm/protocol/gsm_04_08.h>
#define ADD_MODULO(sum, delta, modulo) do { \
if ((sum += delta) >= modulo) \
@@ -116,8 +115,7 @@ int gsm_septet_encode(uint8_t *result, const char *data);
uint8_t gsm_get_octet_len(const uint8_t sept_len);
int gsm_7bit_decode_n_hdr(char *decoded, size_t n, const uint8_t *user_data, uint8_t length, uint8_t ud_hdr_ind);
-unsigned int ms_class_gmsk_dbm(enum gsm_band band, int ms_class);
-
+int ms_class_gmsk_dbm(enum gsm_band band, int ms_class);
int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm);
int ms_pwr_dbm(enum gsm_band band, uint8_t lvl);
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index be856620..49ddb742 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -45,6 +45,7 @@
#include <osmocom/gsm/protocol/gsm_03_40.h>
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/crypt/auth.h>
#define OSMO_GSUP_PORT 4222
@@ -86,6 +87,8 @@ enum osmo_gsup_iei {
OSMO_GSUP_AUTS_IE = 0x26,
OSMO_GSUP_RES_IE = 0x27,
OSMO_GSUP_CN_DOMAIN_IE = 0x28,
+ OSMO_GSUP_SUPPORTED_RAT_TYPES_IE = 0x29, /* supported RAT types */
+ OSMO_GSUP_CURRENT_RAT_TYPE_IE = 0x2a, /* currently used RAT type */
OSMO_GSUP_SESSION_ID_IE = 0x30,
OSMO_GSUP_SESSION_STATE_IE = 0x31,
@@ -373,6 +376,10 @@ struct osmo_gsup_message {
/*! Session Management cause as of 3GPP TS 24.008 10.5.6.6 / Table 10.5.157. */
enum gsm48_gsm_cause cause_sm;
+
+ enum osmo_rat_type current_rat_type;
+ enum osmo_rat_type supported_rat_types[8]; /*!< arbitrary choice */
+ size_t supported_rat_types_len;
};
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 19cc87a3..3d2ad253 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -67,8 +67,8 @@ struct ph_rach_ind_param {
/* elements added on 2018-02-26 */
int8_t rssi; /*!< RSSI of RACH indication */
uint16_t ber10k; /*!< BER in units of 0.01% */
- int16_t acc_delay_256bits;/* !< Burst TA Offset in 1/256th bits */
- int16_t lqual_cb; /* !< Link quality in centiBel */
+ int16_t acc_delay_256bits;/*!< Burst TA Offset in 1/256th bits */
+ int16_t lqual_cb; /*!< Link quality in centiBel */
};
/*! for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */
@@ -79,10 +79,10 @@ struct ph_data_param {
int8_t rssi; /*!< RSSI of receivedindication */
uint16_t ber10k; /*!< BER in units of 0.01% */
union {
- int16_t ta_offs_qbits; /* !< Burst TA Offset in quarter bits */
+ int16_t ta_offs_qbits; /*!< Burst TA Offset in quarter bits */
int16_t ta_offs_256bits;/*!< timing advance offset (in 1/256th bits) */
};
- int16_t lqual_cb; /* !< Link quality in centiBel */
+ int16_t lqual_cb; /*!< Link quality in centiBel */
enum osmo_ph_pres_info_type pdch_presence_info; /*!< Info regarding presence/validity of header and data parts */
};
@@ -93,7 +93,7 @@ struct ph_tch_param {
int8_t rssi; /*!< RSSI of received indication */
uint8_t marker; /*!< RTP Marker bit (speech onset indicator) */
uint16_t ber10k; /*!< BER in units of 0.01% */
- int16_t lqual_cb; /* !< Link quality in centiBel */
+ int16_t lqual_cb; /*!< Link quality in centiBel */
};
/*! for PH-CONN.ind */
diff --git a/include/osmocom/gsm/mncc.h b/include/osmocom/gsm/mncc.h
index e5e96074..db70235c 100644
--- a/include/osmocom/gsm/mncc.h
+++ b/include/osmocom/gsm/mncc.h
@@ -10,10 +10,10 @@
/* Expanded fields from GSM TS 04.08, Table 10.5.102 */
struct gsm_mncc_bearer_cap {
- int transfer; /* Information Transfer Capability */
- int mode; /* Transfer Mode */
- int coding; /* Coding Standard */
- int radio; /* Radio Channel Requirement */
+ int transfer; /* Information Transfer Capability, see enum gsm48_bcap_itcap. */
+ int mode; /* Transfer Mode, see enum gsm48_bcap_tmod. */
+ int coding; /* Coding Standard, see enum gsm48_bcap_coding.*/
+ int radio; /* Radio Channel Requirement, see enum gsm48_bcap_rrq. */
int speech_ctm; /* CTM text telephony indication */
int speech_ver[8]; /* Speech version indication, see enum gsm48_bcap_speech_ver; -1 marks end */
struct {
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 2be6ed34..8370eca1 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -9,6 +9,8 @@
#include <osmocom/core/utils.h>
#include <osmocom/core/endian.h>
+#include <osmocom/gsm/gsm_utils.h>
+
struct gsm_lchan;
/* Chapter 10.5.1.5 */
@@ -73,7 +75,7 @@ const char *osmo_gsm48_classmark_a5_name(const struct osmo_gsm48_classmark *cm);
char *osmo_gsm48_classmark_a5_name_buf(char *buf, size_t buf_len, const struct osmo_gsm48_classmark *cm);
char *osmo_gsm48_classmark_a5_name_c(const void *ctx, const struct osmo_gsm48_classmark *cm);
void osmo_gsm48_classmark_update(struct osmo_gsm48_classmark *dst, const struct osmo_gsm48_classmark *src);
-
+int8_t osmo_gsm48_rfpowercap2powerclass(enum gsm_band band, uint8_t rf_power_cap);
/* Chapter 10.5.2.1b.3 */
#if OSMO_IS_LITTLE_ENDIAN == 1
struct gsm48_range_1024 {
@@ -887,13 +889,25 @@ struct gsm48_pag_resp {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t spare:4,
key_seq:4;
- uint32_t classmark2;
+ union {
+ uint32_t classmark2; /* Backward compatibility */
+ struct {
+ uint8_t cm2_len;
+ struct gsm48_classmark2 cm2;
+ };
+ };
uint8_t mi_len;
uint8_t mi[0];
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t key_seq:4, spare:4;
- uint32_t classmark2;
+ union {
+ uint32_t classmark2; /* Backward compatibility */
+ struct {
+ uint8_t cm2_len;
+ struct gsm48_classmark2 cm2;
+ };
+ };
uint8_t mi_len;
uint8_t mi[0];
#endif
@@ -954,7 +968,7 @@ struct gsm48_system_information_type_header {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t l2_plen;
uint8_t rr_protocol_discriminator :4,
- skip_indicator:4;
+ skip_indicator:4;
uint8_t system_information;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
@@ -1025,15 +1039,26 @@ struct gsm48_service_request {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t cm_service_type : 4,
cipher_key_seq : 4;
- /* length + 3 bytes */
- uint32_t classmark;
+ union {
+ uint32_t classmark; /* Backward compatibility */
+ struct {
+ uint8_t cm2_len;
+ struct gsm48_classmark2 classmark2;
+ };
+ };
uint8_t mi_len;
uint8_t mi[0];
/* optional priority level */
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t cipher_key_seq:4, cm_service_type:4;
- uint32_t classmark;
+ union {
+ uint32_t classmark; /* Backward compatibility */
+ struct {
+ uint8_t cm2_len;
+ struct gsm48_classmark2 classmark2;
+ };
+ };
uint8_t mi_len;
uint8_t mi[0];
#endif
@@ -1104,7 +1129,7 @@ struct gsm48_system_information_type_4 {
struct gsm48_system_information_type_5 {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
- skip_indicator:4;
+ skip_indicator:4;
uint8_t system_information;
uint8_t bcch_frequency_list[16];
#elif OSMO_IS_BIG_ENDIAN
@@ -1149,7 +1174,7 @@ struct gsm48_system_information_type_5ter {
struct gsm48_system_information_type_6 {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
- skip_indicator:4;
+ skip_indicator:4;
uint8_t system_information;
uint16_t cell_identity;
struct gsm48_loc_area_id lai;
diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h
index 9806e083..a5406095 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -512,13 +512,15 @@ enum gsm0808_paging_info {
GSM0808_PAGINF_FOR_USSD = 0x02,
};
-/* 3GPP TS 48.008 3.2.2.104 Speech Codec */
+/*! 3GPP TS 48.008 3.2.2.104 Speech Codec */
struct gsm0808_speech_codec {
bool fi;
bool pi;
bool pt;
bool tf;
+ /*! See enum gsm0808_speech_codec_type. */
uint8_t type;
+ /*! For examples, see enum gsm0808_speech_codec_defaults. */
uint16_t cfg;
};
diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h
index 1d4530d1..da55a8d9 100644
--- a/include/osmocom/gsm/protocol/gsm_08_58.h
+++ b/include/osmocom/gsm/protocol/gsm_08_58.h
@@ -236,6 +236,8 @@ enum abis_rsl_msgtype {
RSL_MT_IPAC_DLCX = 0x77,
RSL_MT_IPAC_DLCX_ACK,
RSL_MT_IPAC_DLCX_NACK,
+
+ RSL_MT_OSMO_ETWS_CMD = 0x7f,
};
/*! Siemens vendor-specific RSL message types */
diff --git a/include/osmocom/vty/tdef_vty.h b/include/osmocom/vty/tdef_vty.h
index 3027913d..6334d5ba 100644
--- a/include/osmocom/vty/tdef_vty.h
+++ b/include/osmocom/vty/tdef_vty.h
@@ -25,6 +25,9 @@
#pragma once
#include <stdint.h>
+#include <stdarg.h>
+
+#include <osmocom/vty/command.h>
struct vty;