|
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 <errno.h>#include <stdio.h>#include <string.h>#include <stdarg.h>#include <stdlib.h>#include <osmocom/core/utils.h>#include <osmocom/gsm/gsm0502.h>#include <osmocom/trx/trxc.h>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... | |
| 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 | |
| static const struct value_string | trxc_msg_type_names [] |
| 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.
Based on the TRXC implementation in osmo-bts-trx and osmo-trx.
| 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.
| const struct value_string osmo_trxc_chan_comb_names[] |
Referenced by osmo_trxc_chan_comb_name().
| const struct value_string osmo_trxc_vamos_comb_names[] |
Referenced by osmo_trxc_setslot_parse(), and osmo_trxc_vamos_comb_name().
|
static |
Referenced by osmo_trxc_msg_build().