libosmo-trx 1.8.0.50-7f5e
Osmocom TRX protocol (TRXC/TRXD) library
ep.h File Reference

TRX protocol socket endpoint management (clock/ctrl/data UDP sockets). More...

#include <stdint.h>
#include <stdbool.h>
#include <osmocom/trx/trxc.h>
#include <osmocom/trx/trxd.h>

Go to the source code of this file.

Typedefs

typedef void(* osmo_trx_ep_closed_cb_t) (struct osmo_trx_ep *ep)
 Called once osmo_trx_ep_close() has fully completed (see osmo_trx_ep_set_closed_cb()) More...
 

Enumerations

enum  osmo_trx_ep_mode {
  OSMO_TRX_EP_MODE_L1 ,
  OSMO_TRX_EP_MODE_TRX
}
 Endpoint mode: which side of the TRX protocol this endpoint implements. More...
 

Functions

void osmo_trx_ep_rx_clck_ind (struct osmo_trx_ep *ep, uint32_t fn)
 Handle a received clock indication ("IND CLOCK <fn>"). More...
 
void osmo_trx_ep_rx_ctrl_msg (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxc_msg *msg)
 Handle a received TRXC message (CMD on the TRX side, RSP on the L1 side). More...
 
void osmo_trx_ep_rx_burst_ind (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_ind *bi)
 Handle a received burst indication (OSMO_TRX_EP_MODE_L1 only). More...
 
void osmo_trx_ep_rx_burst_req (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_req *br)
 Handle a received burst transmit request (OSMO_TRX_EP_MODE_TRX only). More...
 
struct osmo_trx_ep * osmo_trx_ep_alloc (void *ctx, unsigned int num_chans)
 Allocate a TRX endpoint instance. More...
 
int osmo_trx_ep_open (struct osmo_trx_ep *ep)
 Open the clock/ctrl/data sockets of the given endpoint. More...
 
void osmo_trx_ep_close (struct osmo_trx_ep *ep)
 Close all sockets of the given endpoint. More...
 
void osmo_trx_ep_free (struct osmo_trx_ep *ep)
 Free the given endpoint instance (closes all sockets). More...
 
bool osmo_trx_ep_is_open (const struct osmo_trx_ep *ep)
 Whether the endpoint's sockets are currently open. More...
 
bool osmo_trx_ep_is_closing (const struct osmo_trx_ep *ep)
 Whether a ctrl socket from a previous osmo_trx_ep_close() is still flushing a queued TRXC message in the background (see trx_ep_ctrl_close()). More...
 
void osmo_trx_ep_set_closed_cb (struct osmo_trx_ep *ep, osmo_trx_ep_closed_cb_t closed_cb)
 Set the call-back invoked once osmo_trx_ep_close() has fully completed: immediately if no ctrl chan needed flushing, or once the last async flush finishes (see osmo_trx_ep_is_closing()) otherwise. More...
 
void osmo_trx_ep_set_priv (struct osmo_trx_ep *ep, void *priv)
 Set the application-private data. More...
 
void * osmo_trx_ep_get_priv (const struct osmo_trx_ep *ep)
 Obtain the application-private data. More...
 
int osmo_trx_ep_set_name (struct osmo_trx_ep *ep, const char *fmt,...)
 Set the name (log prefix) of the given instance, e.g. More...
 
const char * osmo_trx_ep_get_name (const struct osmo_trx_ep *ep)
 Obtain the name (log prefix) of the given instance. More...
 
void osmo_trx_ep_set_log_cat (struct osmo_trx_ep *ep, int log_cat)
 Set the logging category (e.g. More...
 
int osmo_trx_ep_set_num_chans (struct osmo_trx_ep *ep, unsigned int num_chans)
 Change the number of channels; only valid before osmo_trx_ep_open(). More...
 
unsigned int osmo_trx_ep_get_num_chans (const struct osmo_trx_ep *ep)
 Obtain the number of channels. More...
 
int osmo_trx_ep_set_mode (struct osmo_trx_ep *ep, enum osmo_trx_ep_mode mode)
 Set the endpoint mode (default: OSMO_TRX_EP_MODE_L1) More...
 
enum osmo_trx_ep_mode osmo_trx_ep_get_mode (const struct osmo_trx_ep *ep)
 Obtain the endpoint mode. More...
 
int osmo_trx_ep_set_laddr (struct osmo_trx_ep *ep, const char *addr)
 Local/remote IP address (copied); must be set before osmo_trx_ep_open() More...
 
const char * osmo_trx_ep_get_laddr (const struct osmo_trx_ep *ep)
 Obtain the local IP address. More...
 
int osmo_trx_ep_set_raddr (struct osmo_trx_ep *ep, const char *addr)
 Set the remote IP address (copied) More...
 
const char * osmo_trx_ep_get_raddr (const struct osmo_trx_ep *ep)
 Obtain the remote IP address. More...
 
int osmo_trx_ep_set_base_port (struct osmo_trx_ep *ep, uint16_t base_port)
 Base UDP port (default: 5700). More...
 
uint16_t osmo_trx_ep_get_base_port (const struct osmo_trx_ep *ep)
 Obtain the base UDP port. More...
 
int osmo_trx_ep_set_clock_socket (struct osmo_trx_ep *ep, bool enable)
 Open the clock socket (base port + 0); default: false. More...
 
bool osmo_trx_ep_get_clock_socket (const struct osmo_trx_ep *ep)
 Whether the clock socket is enabled. More...
 
int osmo_trx_ep_set_ctrl_promisc (struct osmo_trx_ep *ep, bool enable)
 Unconnected ctrl socket accepting/replying to any peer; default: false. More...
 
bool osmo_trx_ep_get_ctrl_promisc (const struct osmo_trx_ep *ep)
 Whether promiscuous ctrl socket mode is enabled. More...
 
void osmo_trx_ep_set_pdu_batch (struct osmo_trx_ep *ep, bool enable)
 Enable/disable batching BURST.ind/req PDUs on the data sockets (default: true): when enabled and TRXDv2 (or higher) is negotiated on a channel, a TDMA frame's worth of PDUs is accumulated and sent in a single datagram (see osmo_trx_ep_send_burst_ind()/_req()); when disabled, every PDU is sent in its own datagram regardless of the negotiated TRXD PDU version, trading datagram count for latency. More...
 
bool osmo_trx_ep_get_pdu_batch (const struct osmo_trx_ep *ep)
 Whether batching BURST.ind/req PDUs on the data sockets is enabled. More...
 
int osmo_trx_ep_set_pdu_ver (struct osmo_trx_ep *ep, unsigned int chan, uint8_t ver)
 Per-channel TRXD PDU version in use (set after SETFORMAT negotiation) More...
 
int osmo_trx_ep_get_pdu_ver (const struct osmo_trx_ep *ep, unsigned int chan)
 Get the TRXD PDU version in use for the given channel. More...
 
int osmo_trx_ep_send_clck_ind (struct osmo_trx_ep *ep, uint32_t fn)
 Send a clock indication ("IND CLOCK <fn>") on the clock socket. More...
 
int osmo_trx_ep_send_ctrl_msg (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxc_msg *msg)
 Send a TRXC message on the ctrl socket of the given channel. More...
 
int osmo_trx_ep_send_burst_ind (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_ind *bi)
 Send a burst indication on the data socket of the given channel (OSMO_TRX_EP_MODE_TRX only). More...
 
int osmo_trx_ep_send_burst_req (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_req *br)
 Send a burst transmit request on the data socket of the given channel (OSMO_TRX_EP_MODE_L1 only). More...
 
int osmo_trx_ep_send_burst_fin (struct osmo_trx_ep *ep, unsigned int chan)
 Flush the TRXDv2 batching buffer accumulated by osmo_trx_ep_send_burst_ind() or osmo_trx_ep_send_burst_req() (whichever applies to this endpoint's mode), transmitting it in a single datagram; no-op (returns -ENOMSG) if nothing was accumulated, and for TRXDv0/v1 (each PDU is already sent immediately by osmo_trx_ep_send_burst_ind()/_req()). More...
 

Detailed Description

TRX protocol socket endpoint management (clock/ctrl/data UDP sockets).

Typedef Documentation

◆ osmo_trx_ep_closed_cb_t

typedef void(* osmo_trx_ep_closed_cb_t) (struct osmo_trx_ep *ep)

Called once osmo_trx_ep_close() has fully completed (see osmo_trx_ep_set_closed_cb())

Enumeration Type Documentation

◆ osmo_trx_ep_mode

Endpoint mode: which side of the TRX protocol this endpoint implements.

The mode determines how datagrams received on the data sockets are parsed: the wire format alone does not identify the direction.

Enumerator
OSMO_TRX_EP_MODE_L1 

L1 side (e.g.

osmo-bts): Rx BURST.ind, Tx BURST.req

OSMO_TRX_EP_MODE_TRX 

TRX side (e.g.

osmo-trx): Rx BURST.req, Tx BURST.ind

Function Documentation

◆ osmo_trx_ep_alloc()

struct osmo_trx_ep * osmo_trx_ep_alloc ( void *  ctx,
unsigned int  num_chans 
)

Allocate a TRX endpoint instance.

The mode, addresses and base port default to zero/unset and must be configured via the osmo_trx_ep_set_*() accessors before osmo_trx_ep_open(); num_chans may be changed later via osmo_trx_ep_set_num_chans(), but before osmo_trx_ep_open().

Parameters
[in]ctxtalloc context to allocate from
[in]num_chansnumber of channels (> 0)
Returns
pointer to the allocated instance; NULL on error

References osmo_trx_ep::base_port, osmo_trx_ep::log_cat, osmo_trx_ep::name, osmo_trx_ep::num_chans, osmo_trx_ep_set_num_chans(), and TRX_EP_DEFAULT_BASE_PORT.

◆ osmo_trx_ep_close()

void osmo_trx_ep_close ( struct osmo_trx_ep *  ep)

Close all sockets of the given endpoint.

No-op if not opened. Any TRXC message still queued on a ctrl socket (e.g. a 'goodbye' "CMD POWEROFF" sent right before teardown) is flushed asynchronously (best-effort) instead of being dropped; pending Tx data batches are dropped.

References osmo_trx_ep::chans, osmo_trx_ep::clck_iofd, osmo_trx_ep::closed_cb, osmo_trx_ep::flags, osmo_trx_ep::laddr, LOGEP, osmo_trx_ep::num_chans, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), osmo_trx_ep::raddr, trx_ep_chan_close(), and trx_ep_port().

Referenced by osmo_trx_ep_free(), and osmo_trx_ep_open().

◆ osmo_trx_ep_free()

void osmo_trx_ep_free ( struct osmo_trx_ep *  ep)

Free the given endpoint instance (closes all sockets).

If a ctrl socket is still flushing (see osmo_trx_ep_is_closing()), the endpoint itself is kept alive until the flush completes (see trx_ep_ctrl_close_sendto_cb()), which then finishes this deferred free.

References osmo_trx_ep::flags, osmo_trx_ep_close(), OSMO_TRX_EP_F_PENDING_FREE, and osmo_trx_ep_is_closing().

◆ osmo_trx_ep_get_base_port()

uint16_t osmo_trx_ep_get_base_port ( const struct osmo_trx_ep *  ep)

Obtain the base UDP port.

References osmo_trx_ep::base_port.

◆ osmo_trx_ep_get_clock_socket()

bool osmo_trx_ep_get_clock_socket ( const struct osmo_trx_ep *  ep)

Whether the clock socket is enabled.

References osmo_trx_ep::flags, and OSMO_TRX_EP_F_CLOCK_SOCKET.

◆ osmo_trx_ep_get_ctrl_promisc()

bool osmo_trx_ep_get_ctrl_promisc ( const struct osmo_trx_ep *  ep)

Whether promiscuous ctrl socket mode is enabled.

References osmo_trx_ep::flags, and OSMO_TRX_EP_F_CTRL_PROMISC.

◆ osmo_trx_ep_get_laddr()

const char * osmo_trx_ep_get_laddr ( const struct osmo_trx_ep *  ep)

Obtain the local IP address.

References osmo_trx_ep::laddr.

◆ osmo_trx_ep_get_mode()

enum osmo_trx_ep_mode osmo_trx_ep_get_mode ( const struct osmo_trx_ep *  ep)

Obtain the endpoint mode.

References osmo_trx_ep::mode.

◆ osmo_trx_ep_get_name()

const char * osmo_trx_ep_get_name ( const struct osmo_trx_ep *  ep)

Obtain the name (log prefix) of the given instance.

References osmo_trx_ep::name.

◆ osmo_trx_ep_get_num_chans()

unsigned int osmo_trx_ep_get_num_chans ( const struct osmo_trx_ep *  ep)

Obtain the number of channels.

References osmo_trx_ep::num_chans.

◆ osmo_trx_ep_get_pdu_batch()

bool osmo_trx_ep_get_pdu_batch ( const struct osmo_trx_ep *  ep)

Whether batching BURST.ind/req PDUs on the data sockets is enabled.

References osmo_trx_ep::flags, and OSMO_TRX_EP_F_NO_PDU_BATCH.

◆ osmo_trx_ep_get_pdu_ver()

int osmo_trx_ep_get_pdu_ver ( const struct osmo_trx_ep *  ep,
unsigned int  chan 
)

Get the TRXD PDU version in use for the given channel.

References osmo_trx_ep::chans, osmo_trx_ep::num_chans, and osmo_trx_ep_chan::pdu_ver.

◆ osmo_trx_ep_get_priv()

void * osmo_trx_ep_get_priv ( const struct osmo_trx_ep *  ep)

Obtain the application-private data.

References osmo_trx_ep::priv.

◆ osmo_trx_ep_get_raddr()

const char * osmo_trx_ep_get_raddr ( const struct osmo_trx_ep *  ep)

Obtain the remote IP address.

References osmo_trx_ep::raddr.

◆ osmo_trx_ep_is_closing()

bool osmo_trx_ep_is_closing ( const struct osmo_trx_ep *  ep)

Whether a ctrl socket from a previous osmo_trx_ep_close() is still flushing a queued TRXC message in the background (see trx_ep_ctrl_close()).

References osmo_trx_ep::chans, osmo_trx_ep_chan::ctrl_wr_pending, and osmo_trx_ep::num_chans.

Referenced by osmo_trx_ep_close(), osmo_trx_ep_free(), osmo_trx_ep_open(), osmo_trx_ep_set_num_chans(), and trx_ep_ctrl_close_sendto_cb().

◆ osmo_trx_ep_is_open()

bool osmo_trx_ep_is_open ( const struct osmo_trx_ep *  ep)

Whether the endpoint's sockets are currently open.

References osmo_trx_ep::flags, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_open()

int osmo_trx_ep_open ( struct osmo_trx_ep *  ep)

Open the clock/ctrl/data sockets of the given endpoint.

Returns
0 on success; -EALREADY if already open; -EBUSY if a previous osmo_trx_ep_close() is still flushing a ctrl socket (see osmo_trx_ep_is_closing()); other negative values on error (all sockets closed)

References osmo_trx_ep::chans, osmo_trx_ep::clck_iofd, osmo_trx_ep::flags, osmo_trx_ep::laddr, LOGEP, osmo_trx_ep::num_chans, osmo_trx_ep_close(), OSMO_TRX_EP_F_CLOCK_SOCKET, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), OSMO_TRXC_MSG_BUF_SIZE, osmo_trx_ep::raddr, trx_ep_chan_open(), trx_ep_clck_ioops, trx_ep_open_iofd(), and trx_ep_port().

◆ osmo_trx_ep_rx_burst_ind()

void osmo_trx_ep_rx_burst_ind ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxd_burst_ind *  bi 
)

Handle a received burst indication (OSMO_TRX_EP_MODE_L1 only).

Called for each PDU parsed from a datagram received on the per-channel data socket, also for each PDU of a TRXDv2 batch.

Parameters
[in]epTRX endpoint instance
[in]chanchannel index (0 .. num_chans - 1)
[in]biparsed burst indication

Referenced by trx_ep_data_read_cb().

◆ osmo_trx_ep_rx_burst_req()

void osmo_trx_ep_rx_burst_req ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxd_burst_req *  br 
)

Handle a received burst transmit request (OSMO_TRX_EP_MODE_TRX only).

Called for each PDU parsed from a datagram received on the per-channel data socket, also for each PDU of a TRXDv2 batch.

Parameters
[in]epTRX endpoint instance
[in]chanchannel index (0 .. num_chans - 1)
[in]brparsed burst transmit request

Referenced by trx_ep_data_read_cb().

◆ osmo_trx_ep_rx_clck_ind()

void osmo_trx_ep_rx_clck_ind ( struct osmo_trx_ep *  ep,
uint32_t  fn 
)

Handle a received clock indication ("IND CLOCK <fn>").

Called for datagrams received on the clock socket (if configured).

Parameters
[in]epTRX endpoint instance
[in]fnindicated TDMA frame number (< GSM_TDMA_HYPERFRAME)

Referenced by trx_ep_clck_read_cb().

◆ osmo_trx_ep_rx_ctrl_msg()

void osmo_trx_ep_rx_ctrl_msg ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxc_msg *  msg 
)

Handle a received TRXC message (CMD on the TRX side, RSP on the L1 side).

Called for datagrams received on the per-channel ctrl socket. An L1 side application would typically feed responses into the TRXC client engine (see osmo_trxc_client_rx()).

Parameters
[in]epTRX endpoint instance
[in]chanchannel index (0 .. num_chans - 1)
[in]msgparsed TRXC message

Referenced by trx_ep_ctrl_recvfrom_cb().

◆ osmo_trx_ep_send_burst_fin()

int osmo_trx_ep_send_burst_fin ( struct osmo_trx_ep *  ep,
unsigned int  chan 
)

Flush the TRXDv2 batching buffer accumulated by osmo_trx_ep_send_burst_ind() or osmo_trx_ep_send_burst_req() (whichever applies to this endpoint's mode), transmitting it in a single datagram; no-op (returns -ENOMSG) if nothing was accumulated, and for TRXDv0/v1 (each PDU is already sent immediately by osmo_trx_ep_send_burst_ind()/_req()).

Returns
0 on success; -ENOMSG if there was nothing to flush; other negative on error

References osmo_trx_ep::chans, osmo_trx_ep_chan::ep, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.

◆ osmo_trx_ep_send_burst_ind()

int osmo_trx_ep_send_burst_ind ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxd_burst_ind *  bi 
)

Send a burst indication on the data socket of the given channel (OSMO_TRX_EP_MODE_TRX only).

For TRXDv2, the PDUs are batched: they get accumulated until osmo_trx_ep_send_burst_fin() is called, which transmits all accumulated PDUs in a single datagram. For TRXDv0/v1, each PDU is transmitted immediately.

Returns
0 on success; negative on error

References osmo_trx_ep::chans, osmo_trx_ep::flags, OSMO_TRX_EP_F_NO_PDU_BATCH, osmo_trxd_burst_ind_build(), osmo_trx_ep_chan::pdu_ver, TRX_EP_DATA_BUF_SIZE, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.

◆ osmo_trx_ep_send_burst_req()

int osmo_trx_ep_send_burst_req ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxd_burst_req *  br 
)

Send a burst transmit request on the data socket of the given channel (OSMO_TRX_EP_MODE_L1 only).

For TRXDv2, the PDUs are batched: they get accumulated until osmo_trx_ep_send_burst_fin() is called, which transmits all accumulated PDUs in a single datagram. For TRXDv0/v1, each PDU is transmitted immediately.

Returns
0 on success; negative on error

References osmo_trx_ep::chans, osmo_trx_ep::flags, OSMO_TRX_EP_F_NO_PDU_BATCH, osmo_trxd_burst_req_build(), osmo_trx_ep_chan::pdu_ver, TRX_EP_DATA_BUF_SIZE, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.

◆ osmo_trx_ep_send_clck_ind()

int osmo_trx_ep_send_clck_ind ( struct osmo_trx_ep *  ep,
uint32_t  fn 
)

Send a clock indication ("IND CLOCK <fn>") on the clock socket.

Returns
0 on success; negative on error

References osmo_trx_ep::clck_iofd, osmo_trxc_clock_ind_build(), and OSMO_TRXC_MSG_BUF_SIZE.

◆ osmo_trx_ep_send_ctrl_msg()

int osmo_trx_ep_send_ctrl_msg ( struct osmo_trx_ep *  ep,
unsigned int  chan,
const struct osmo_trxc_msg *  tmsg 
)

Send a TRXC message on the ctrl socket of the given channel.

Returns
0 on success; negative on error

References osmo_trx_ep::chans, osmo_trx_ep_chan::ctrl_iofd, osmo_trx_ep_chan::ctrl_peer, osmo_trx_ep_chan::ctrl_wr_pending, OSMO_TRXC_MSG_BUF_SIZE, and osmo_trxc_msg_build().

◆ osmo_trx_ep_set_base_port()

int osmo_trx_ep_set_base_port ( struct osmo_trx_ep *  ep,
uint16_t  base_port 
)

Base UDP port (default: 5700).

All local and remote ports are derived from it, given that the L1 side uses a fixed offset of +100: the TRX side binds base + ofs and sends to base + 100 + ofs, while the L1 side binds base + 100 + ofs and sends to base + ofs, where ofs = 0 for the clock socket, and for each channel N: ofs = 2 * N + 1 (ctrl), ofs = 2 * N + 2 (data).

Base UDP port (default: 5700).

References osmo_trx_ep::base_port, osmo_trx_ep::flags, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_set_clock_socket()

int osmo_trx_ep_set_clock_socket ( struct osmo_trx_ep *  ep,
bool  enable 
)

Open the clock socket (base port + 0); default: false.

Open the clock socket (base port + 0); default: false.

References osmo_trx_ep::flags, OSMO_TRX_EP_F_CLOCK_SOCKET, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_set_closed_cb()

void osmo_trx_ep_set_closed_cb ( struct osmo_trx_ep *  ep,
osmo_trx_ep_closed_cb_t  closed_cb 
)

Set the call-back invoked once osmo_trx_ep_close() has fully completed: immediately if no ctrl chan needed flushing, or once the last async flush finishes (see osmo_trx_ep_is_closing()) otherwise.

References osmo_trx_ep::closed_cb.

◆ osmo_trx_ep_set_ctrl_promisc()

int osmo_trx_ep_set_ctrl_promisc ( struct osmo_trx_ep *  ep,
bool  enable 
)

Unconnected ctrl socket accepting/replying to any peer; default: false.

Unconnected ctrl socket accepting/replying to any peer; default: false.

a test tool injecting extra TRXC commands from its own socket. The RSP always goes back to whoever actually sent the CMD, promiscuous or not (see trx_ep_ctrl_recvfrom_cb() and chan->ctrl_peer).

References osmo_trx_ep::flags, OSMO_TRX_EP_F_CTRL_PROMISC, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_set_laddr()

int osmo_trx_ep_set_laddr ( struct osmo_trx_ep *  ep,
const char *  addr 
)

Local/remote IP address (copied); must be set before osmo_trx_ep_open()

Local/remote IP address (copied); must be set before osmo_trx_ep_open()

References osmo_trx_ep::flags, osmo_trx_ep::laddr, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_set_log_cat()

void osmo_trx_ep_set_log_cat ( struct osmo_trx_ep *  ep,
int  log_cat 
)

Set the logging category (e.g.

DTRX in osmo-bts; default: DLGLOBAL)

References osmo_trx_ep::log_cat.

◆ osmo_trx_ep_set_mode()

int osmo_trx_ep_set_mode ( struct osmo_trx_ep *  ep,
enum osmo_trx_ep_mode  mode 
)

Set the endpoint mode (default: OSMO_TRX_EP_MODE_L1)

References osmo_trx_ep::flags, osmo_trx_ep::mode, and OSMO_TRX_EP_F_OPEN.

◆ osmo_trx_ep_set_name()

int osmo_trx_ep_set_name ( struct osmo_trx_ep *  ep,
const char *  fmt,
  ... 
)

Set the name (log prefix) of the given instance, e.g.

"phy0"

References osmo_trx_ep::name.

◆ osmo_trx_ep_set_num_chans()

int osmo_trx_ep_set_num_chans ( struct osmo_trx_ep *  ep,
unsigned int  num_chans 
)

Change the number of channels; only valid before osmo_trx_ep_open().

Returns
0 on success; -EBUSY if the endpoint is already open or a ctrl socket from a previous osmo_trx_ep_close() is still flushing (see osmo_trx_ep_is_closing()); -EINVAL if num_chans is 0; -ENOMEM on allocation failure

References osmo_trx_ep::chans, osmo_trx_ep::flags, osmo_trx_ep::num_chans, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), and trx_ep_chan_init().

Referenced by osmo_trx_ep_alloc().

◆ osmo_trx_ep_set_pdu_batch()

void osmo_trx_ep_set_pdu_batch ( struct osmo_trx_ep *  ep,
bool  enable 
)

Enable/disable batching BURST.ind/req PDUs on the data sockets (default: true): when enabled and TRXDv2 (or higher) is negotiated on a channel, a TDMA frame's worth of PDUs is accumulated and sent in a single datagram (see osmo_trx_ep_send_burst_ind()/_req()); when disabled, every PDU is sent in its own datagram regardless of the negotiated TRXD PDU version, trading datagram count for latency.

May be changed at any time.

References osmo_trx_ep::flags, and OSMO_TRX_EP_F_NO_PDU_BATCH.

◆ osmo_trx_ep_set_pdu_ver()

int osmo_trx_ep_set_pdu_ver ( struct osmo_trx_ep *  ep,
unsigned int  chan,
uint8_t  ver 
)

Per-channel TRXD PDU version in use (set after SETFORMAT negotiation)

Per-channel TRXD PDU version in use (set after SETFORMAT negotiation)

References osmo_trx_ep::chans, LOGEPCH, osmo_trx_ep::num_chans, OSMO_TRXD_PDU_VER_MAX, and osmo_trx_ep_chan::pdu_ver.

◆ osmo_trx_ep_set_priv()

void osmo_trx_ep_set_priv ( struct osmo_trx_ep *  ep,
void *  priv 
)

Set the application-private data.

References osmo_trx_ep::priv.

◆ osmo_trx_ep_set_raddr()

int osmo_trx_ep_set_raddr ( struct osmo_trx_ep *  ep,
const char *  addr 
)

Set the remote IP address (copied)

References osmo_trx_ep::flags, OSMO_TRX_EP_F_OPEN, and osmo_trx_ep::raddr.