|
libosmo-trx 1.8.0.50-7f5e
Osmocom TRX protocol (TRXC/TRXD) library
|
TRXC (control) protocol and clock indications: I/O-free message codec. More...
#include <stdint.h>#include <stddef.h>#include <stdbool.h>#include <osmocom/core/utils.h>Go to the source code of this file.
Data Structures | |
| struct | osmo_trxc_msg |
| A single de-/serialized TRXC message. More... | |
| struct | osmo_trxc_setslot_tsc |
| One "C<tsc>/S<tsc_set>" override, as used by SETSLOT for (VAMOS) sub-channels that don't use the endpoint-wide TSC (SETTSC). More... | |
| struct | osmo_trxc_setslot |
| Parsed SETSLOT parameters. More... | |
Macros | |
| #define | OSMO_TRXC_CMD_LEN_MAX 32 |
| Maximum length of a command verb (incl. More... | |
| #define | OSMO_TRXC_MSG_BUF_SIZE 1500 |
| Recommended TRXC socket read/send buffer size. More... | |
| #define | OSMO_TRXC_PARAMS_LEN_MAX (OSMO_TRXC_MSG_BUF_SIZE - OSMO_TRXC_CMD_LEN_MAX - 32) |
| Maximum length of the parameters string (incl. More... | |
| #define | OSMO_TRXC_CMD_POWERON "POWERON" |
| #define | OSMO_TRXC_CMD_POWEROFF "POWEROFF" |
| #define | OSMO_TRXC_CMD_RXTUNE "RXTUNE" |
| #define | OSMO_TRXC_CMD_TXTUNE "TXTUNE" |
| #define | OSMO_TRXC_CMD_SETSLOT "SETSLOT" |
| #define | OSMO_TRXC_CMD_SETTSC "SETTSC" |
| #define | OSMO_TRXC_CMD_SETBSIC "SETBSIC" |
| #define | OSMO_TRXC_CMD_SETPOWER "SETPOWER" |
| #define | OSMO_TRXC_CMD_ADJPOWER "ADJPOWER" |
| #define | OSMO_TRXC_CMD_NOMTXPOWER "NOMTXPOWER" |
| #define | OSMO_TRXC_CMD_SETRXGAIN "SETRXGAIN" |
| #define | OSMO_TRXC_CMD_SETMAXDLY "SETMAXDLY" |
| #define | OSMO_TRXC_CMD_SETMAXDLYNB "SETMAXDLYNB" |
| #define | OSMO_TRXC_CMD_SETFORMAT "SETFORMAT" |
| #define | OSMO_TRXC_CMD_HANDOVER "HANDOVER" |
| #define | OSMO_TRXC_CMD_NOHANDOVER "NOHANDOVER" |
| #define | OSMO_TRXC_CMD_RFMUTE "RFMUTE" |
| #define | OSMO_TRXC_CMD_NOISELEV "NOISELEV" |
| #define | OSMO_TRXC_CMD_SETFH "SETFH" |
| #define | OSMO_TRXC_CMD_ERR "ERR" |
| verb of a reject response More... | |
| #define | OSMO_TRXC_SETSLOT_TSC_MAX 3 |
| up to 3 sub-channels (VAMOS "HVHH") More... | |
Enumerations | |
| enum | osmo_trxc_msg_type { OSMO_TRXC_MT_CMD , OSMO_TRXC_MT_RSP , OSMO_TRXC_MT_IND } |
| enum | osmo_trxc_chan_comb { OSMO_TRXC_CHAN_COMB_UNUSED = 0 , OSMO_TRXC_CHAN_COMB_TCHF = 1 , OSMO_TRXC_CHAN_COMB_TCHH_IDLE = 2 , OSMO_TRXC_CHAN_COMB_TCHH = 3 , OSMO_TRXC_CHAN_COMB_BCCH = 4 , OSMO_TRXC_CHAN_COMB_BCCH_SDCCH4 = 5 , OSMO_TRXC_CHAN_COMB_CCCH = 6 , OSMO_TRXC_CHAN_COMB_SDCCH8 = 7 , OSMO_TRXC_CHAN_COMB_TCHF_FACCH_SACCHM = 8 , OSMO_TRXC_CHAN_COMB_TCHF_SACCHM = 9 , OSMO_TRXC_CHAN_COMB_TCHFD_SACCHMD = 10 , OSMO_TRXC_CHAN_COMB_PBCCH = 11 , OSMO_TRXC_CHAN_COMB_PCCCH = 12 , OSMO_TRXC_CHAN_COMB_PDTCH = 13 } |
Classic (non-VAMOS) GSM TS 05.02 channel combinations, as used by the chan_comb parameter of SETSLOT. More... | |
| enum | osmo_trxc_vamos_comb { OSMO_TRXC_VAMOS_COMB_VFF = 1 , OSMO_TRXC_VAMOS_COMB_VHH , OSMO_TRXC_VAMOS_COMB_VFH , OSMO_TRXC_VAMOS_COMB_HVHH } |
VAMOS-enabled channel combinations: the chan_comb parameter of SETSLOT is symbolic (not numeric) for these. More... | |
Functions | |
| int | osmo_trxc_msg_parse (struct osmo_trxc_msg *msg, const char *buf, size_t len) |
| Parse a TRXC message ("CMD <verb> [<params>]", "RSP <verb> <status>
[<params>]" or "IND <verb> <params>") from a zero-terminated buffer. More... | |
| int | osmo_trxc_msg_build (char *buf, size_t buf_size, const struct osmo_trxc_msg *msg) |
| Serialize a TRXC message into the given buffer (zero-terminated). More... | |
| int | osmo_trxc_msg_params_scan (const struct osmo_trxc_msg *msg, const char *fmt,...) |
| Parse the parameters string of a TRXC message, sscanf() style. More... | |
| const char * | osmo_trxc_msg_name (const struct osmo_trxc_msg *msg) |
| Compose a human-readable representation of the given message (for logging), store into a thread-local static buffer. More... | |
| char * | osmo_trxc_msg_name_buf (char *buf, size_t buf_size, const struct osmo_trxc_msg *msg) |
| Compose a human-readable representation of the given message (for logging), store into the given buffer. More... | |
| static const char * | osmo_trxc_chan_comb_name (enum osmo_trxc_chan_comb comb) |
| static const char * | osmo_trxc_vamos_comb_name (enum osmo_trxc_vamos_comb comb) |
| int | osmo_trxc_setslot_parse (struct osmo_trxc_setslot *ss, const struct osmo_trxc_msg *msg) |
| Parse SETSLOT parameters ("<tn> <chan_comb> [C<tsc>/S<tsc_set> ...]") from an already-parsed TRXC message's msg->params. More... | |
| int | osmo_trxc_setslot_build (char *buf, size_t buf_size, const struct osmo_trxc_setslot *ss) |
| Serialize SETSLOT parameters ("<tn> <chan_comb> [C<tsc>/S<tsc_set> ...]") into the given buffer (zero-terminated), for use as msg->params. More... | |
| int | osmo_trxc_clock_ind_parse (uint32_t *fn, const char *buf, size_t len) |
| Parse a clock indication ("IND CLOCK <fn>"). More... | |
| int | osmo_trxc_clock_ind_build (char *buf, size_t buf_size, uint32_t fn) |
| Serialize a clock indication ("IND CLOCK <fn>") into the given buffer. More... | |
Variables | |
| const struct value_string | osmo_trxc_chan_comb_names [] |
| const struct value_string | osmo_trxc_vamos_comb_names [] |
TRXC (control) protocol and clock indications: I/O-free message codec.
| #define OSMO_TRXC_CMD_ADJPOWER "ADJPOWER" |
| #define OSMO_TRXC_CMD_ERR "ERR" |
verb of a reject response
| #define OSMO_TRXC_CMD_HANDOVER "HANDOVER" |
| #define OSMO_TRXC_CMD_LEN_MAX 32 |
Maximum length of a command verb (incl.
'\0')
| #define OSMO_TRXC_CMD_NOHANDOVER "NOHANDOVER" |
| #define OSMO_TRXC_CMD_NOISELEV "NOISELEV" |
| #define OSMO_TRXC_CMD_NOMTXPOWER "NOMTXPOWER" |
| #define OSMO_TRXC_CMD_POWEROFF "POWEROFF" |
| #define OSMO_TRXC_CMD_POWERON "POWERON" |
| #define OSMO_TRXC_CMD_RFMUTE "RFMUTE" |
| #define OSMO_TRXC_CMD_RXTUNE "RXTUNE" |
| #define OSMO_TRXC_CMD_SETBSIC "SETBSIC" |
| #define OSMO_TRXC_CMD_SETFH "SETFH" |
| #define OSMO_TRXC_CMD_SETFORMAT "SETFORMAT" |
| #define OSMO_TRXC_CMD_SETMAXDLY "SETMAXDLY" |
| #define OSMO_TRXC_CMD_SETMAXDLYNB "SETMAXDLYNB" |
| #define OSMO_TRXC_CMD_SETPOWER "SETPOWER" |
| #define OSMO_TRXC_CMD_SETRXGAIN "SETRXGAIN" |
| #define OSMO_TRXC_CMD_SETSLOT "SETSLOT" |
| #define OSMO_TRXC_CMD_SETTSC "SETTSC" |
| #define OSMO_TRXC_CMD_TXTUNE "TXTUNE" |
| #define OSMO_TRXC_MSG_BUF_SIZE 1500 |
Recommended TRXC socket read/send buffer size.
| #define OSMO_TRXC_PARAMS_LEN_MAX (OSMO_TRXC_MSG_BUF_SIZE - OSMO_TRXC_CMD_LEN_MAX - 32) |
Maximum length of the parameters string (incl.
'\0'). Must be large enough for SETFH, which carries the whole Mobile Allocation as pairs of Rx/Tx frequencies in kHz (over 1000 characters for 64 ARFCNs). Sized so that any message ("RSP " + verb + status) still fits the buffer above; the extra -32 is a rounded-up safety margin for that fixed overhead.
| #define OSMO_TRXC_SETSLOT_TSC_MAX 3 |
up to 3 sub-channels (VAMOS "HVHH")
| enum osmo_trxc_chan_comb |
Classic (non-VAMOS) GSM TS 05.02 channel combinations, as used by the chan_comb parameter of SETSLOT.
Numeric values match the wire format.
| enum osmo_trxc_msg_type |
| enum osmo_trxc_vamos_comb |
VAMOS-enabled channel combinations: the chan_comb parameter of SETSLOT is symbolic (not numeric) for these.
|
inlinestatic |
References osmo_trxc_chan_comb_names.
| int osmo_trxc_clock_ind_build | ( | char * | buf, |
| size_t | buf_size, | ||
| uint32_t | fn | ||
| ) |
Serialize a clock indication ("IND CLOCK <fn>") into the given buffer.
| [out] | buf | message buffer to store the result |
| [in] | buf_size | size of the message buffer |
| [in] | fn | TDMA frame number (validated to be < GSM_TDMA_HYPERFRAME) |
Referenced by osmo_trx_ep_send_clck_ind().
| int osmo_trxc_clock_ind_parse | ( | uint32_t * | fn, |
| const char * | buf, | ||
| size_t | len | ||
| ) |
Parse a clock indication ("IND CLOCK <fn>").
| [out] | fn | TDMA frame number (validated to be < GSM_TDMA_HYPERFRAME) |
| [in] | buf | message buffer (not necessarily zero-terminated) |
| [in] | len | length of the message in the buffer |
References osmo_trxc_msg::cmd, osmo_trxc_msg_params_scan(), osmo_trxc_msg_parse(), OSMO_TRXC_MT_IND, and osmo_trxc_msg::type.
Referenced by trx_ep_clck_read_cb().
| int osmo_trxc_msg_build | ( | char * | buf, |
| size_t | buf_size, | ||
| const struct osmo_trxc_msg * | msg | ||
| ) |
Serialize a TRXC message into the given buffer (zero-terminated).
References osmo_trxc_msg::cmd, OSMO_TRXC_MT_CMD, OSMO_TRXC_MT_IND, OSMO_TRXC_MT_RSP, osmo_trxc_msg::params, osmo_trxc_msg::status, trxc_msg_type_names, and osmo_trxc_msg::type.
Referenced by osmo_trx_ep_send_ctrl_msg(), and osmo_trxc_msg_name_buf().
| const char * osmo_trxc_msg_name | ( | const struct osmo_trxc_msg * | msg | ) |
Compose a human-readable representation of the given message (for logging), store into a thread-local static buffer.
| [in] | msg | parsed TRXC message to get a human-readable representation of |
References OSMO_TRXC_MSG_BUF_SIZE, and osmo_trxc_msg_name_buf().
Referenced by osmo_trxc_client_rx_msg(), trxc_client_default_rsp_cb(), trxc_client_fatal(), and trxc_client_send_next().
| char * osmo_trxc_msg_name_buf | ( | char * | buf, |
| size_t | buf_size, | ||
| const struct osmo_trxc_msg * | msg | ||
| ) |
Compose a human-readable representation of the given message (for logging), store into the given buffer.
| [out] | buf | output buffer to store the result |
| [in] | buf_size | size of the output buffer |
| [in] | msg | parsed TRXC message to get a human-readable representation of |
References osmo_trxc_msg_build().
Referenced by osmo_trxc_msg_name().
| int osmo_trxc_msg_params_scan | ( | const struct osmo_trxc_msg * | msg, |
| const char * | fmt, | ||
| ... | |||
| ) |
Parse the parameters string of a TRXC message, sscanf() style.
References osmo_trxc_msg::params.
Referenced by osmo_trxc_clock_ind_parse().
| int osmo_trxc_msg_parse | ( | struct osmo_trxc_msg * | msg, |
| const char * | buf, | ||
| size_t | len | ||
| ) |
Parse a TRXC message ("CMD <verb> [<params>]", "RSP <verb> <status> [<params>]" or "IND <verb> <params>") from a zero-terminated buffer.
| [out] | msg | parsed message |
| [in] | buf | message buffer (not necessarily zero-terminated) |
| [in] | len | length of the message in the buffer |
References osmo_trxc_msg::cmd, OSMO_TRXC_MSG_BUF_SIZE, OSMO_TRXC_MT_CMD, OSMO_TRXC_MT_IND, OSMO_TRXC_MT_RSP, osmo_trxc_msg::params, osmo_trxc_msg::status, and osmo_trxc_msg::type.
Referenced by osmo_trxc_client_rx(), osmo_trxc_clock_ind_parse(), and trx_ep_ctrl_recvfrom_cb().
| int osmo_trxc_setslot_build | ( | char * | buf, |
| size_t | buf_size, | ||
| const struct osmo_trxc_setslot * | ss | ||
| ) |
Serialize SETSLOT parameters ("<tn> <chan_comb> [C<tsc>/S<tsc_set> ...]") into the given buffer (zero-terminated), for use as msg->params.
References osmo_trxc_setslot::chan_comb, osmo_trxc_setslot::num_tsc, osmo_trxc_vamos_comb_name(), osmo_trxc_setslot::tn, osmo_trxc_setslot_tsc::tsc, osmo_trxc_setslot::tsc, osmo_trxc_setslot_tsc::tsc_set, osmo_trxc_setslot::vamos, and osmo_trxc_setslot::vamos_comb.
| int osmo_trxc_setslot_parse | ( | struct osmo_trxc_setslot * | ss, |
| const struct osmo_trxc_msg * | msg | ||
| ) |
Parse SETSLOT parameters ("<tn> <chan_comb> [C<tsc>/S<tsc_set> ...]") from an already-parsed TRXC message's msg->params.
References osmo_trxc_setslot::chan_comb, osmo_trxc_setslot::num_tsc, OSMO_TRXC_CHAN_COMB_PDTCH, OSMO_TRXC_PARAMS_LEN_MAX, OSMO_TRXC_SETSLOT_TSC_MAX, osmo_trxc_vamos_comb_names, osmo_trxc_msg::params, osmo_trxc_setslot::tn, osmo_trxc_setslot_tsc::tsc, osmo_trxc_setslot::tsc, osmo_trxc_setslot_tsc::tsc_set, osmo_trxc_setslot::vamos, and osmo_trxc_setslot::vamos_comb.
|
inlinestatic |
References osmo_trxc_vamos_comb_names.
Referenced by osmo_trxc_setslot_build().
|
extern |
Referenced by osmo_trxc_chan_comb_name().
|
extern |
Referenced by osmo_trxc_setslot_parse(), and osmo_trxc_vamos_comb_name().