libosmo-netif
1.2.0
Osmocom network interface library
|
Osmocom Jitter Buffer helpers.
More...
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include <osmocom/core/timer.h>
Go to the source code of this file.
|
struct | osmo_jibuf |
| A structure representing a single instance of a jitter buffer. More...
|
|
|
typedef void(* | osmo_jibuf_dequeue_cb) (struct msgb *msg, void *data) |
|
Osmocom Jitter Buffer helpers.
void osmo_dgram_destroy(struct osmo_dgram *conn)
Destroy a Osmocom datagram transceiver.
Definition: datagram.c:445
void osmo_dgram_tx_set_local_port(struct osmo_dgram_tx *conn, uint16_t port)
Set the local port from which we transmit.
Definition: datagram.c:181
void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int(*connect_cb)(struct osmo_stream_cli *cli))
Set the call-back function called on connect of the stream client socket.
Definition: stream.c:685
#define msgb_sctp_stream(msg)
Access the SCTP Stream ID from the msgb control buffer.
Definition: stream.h:15
void osmo_stream_cli_set_addr(struct osmo_stream_cli *cli, const char *addr)
Set the remote address to which we connect.
Definition: stream.c:496
void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int(*disconnect_cb)(struct osmo_stream_cli *cli))
Set the call-back function called on disconnect of the stream client socket.
Definition: stream.c:694
void osmo_stream_cli_set_proto(struct osmo_stream_cli *cli, uint16_t proto)
Set the protocol for the stream client socket.
Definition: stream.c:588
void osmo_stream_srv_link_set_data(struct osmo_stream_srv_link *link, void *data)
Set application private data of the stream server link.
Definition: stream.c:1130
int osmo_dgram_rx_recv(struct osmo_dgram_rx *conn, struct msgb *msg)
Receive data via Osmocom datagram receiver.
Definition: datagram.c:261
void * osmo_stream_srv_get_data(struct osmo_stream_srv *conn)
Get application private data of the stream server.
Definition: stream.c:1408
void osmo_dgram_tx_set_port(struct osmo_dgram_tx *conn, uint16_t port)
Set the remote port to which we transmit.
Definition: datagram.c:160
void osmo_dgram_set_remote_addr(struct osmo_dgram *conn, const char *addr)
Set the remote address to which we transmit/connect.
Definition: datagram.c:464
void osmo_dgram_rx_destroy(struct osmo_dgram_rx *conn)
Destroy the datagram receiver. Releases Memory.
Definition: datagram.c:344
void osmo_dgram_tx_set_addr(struct osmo_dgram_tx *conn, const char *addr)
Set the remote address to which we transmit.
Definition: datagram.c:149
void osmo_jibuf_delete(struct osmo_jibuf *jb)
Destroy a previously allocated jitter buffer instance.
Definition: jibuf.c:320
int osmo_stream_cli_recv(struct osmo_stream_cli *conn, struct msgb *msg)
Receive data via an Osmocom stream client.
Definition: stream.c:881
#define msgb_sctp_ppid(msg)
Access the SCTP PPID from the msgb control buffer.
Definition: stream.h:13
Definition: stream.c:1257
void osmo_dgram_tx_close(struct osmo_dgram_tx *conn)
Close an Osmocom Datagram Transmitter.
Definition: datagram.c:80
void osmo_dgram_rx_set_read_cb(struct osmo_dgram_rx *conn, int(*read_cb)(struct osmo_dgram_rx *conn))
Set the read() call-back of the datagram receiver.
Definition: datagram.c:336
void osmo_stream_srv_link_set_port(struct osmo_stream_srv_link *link, uint16_t port)
Set the local port number to which we bind.
Definition: stream.c:1066
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void(*tx_cb)(struct msgb *msg, void *data), void *data)
Set transmission callback to call when a generated RTP packet is to be transmitted.
Definition: osmux.c:882
struct osmo_fd * osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli)
Get Osmocom File Descriptor of the stream client socket.
Definition: stream.c:676
void osmo_dgram_rx_close(struct osmo_dgram_rx *conn)
Close the datagram receiver and unregister from select loop Does not destroy the datagram receiver,...
Definition: datagram.c:381
void * osmo_stream_cli_get_data(struct osmo_stream_cli *cli)
Get application private data of the stream client socket.
Definition: stream.c:655
void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn)
Prepare to send out all pending messages on the connection's Tx queue and then automatically destroy ...
Definition: stream.c:1390
struct osmo_fd * osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv)
Get Osmocom File Descriptor of the stream server.
Definition: stream.c:1417
void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link)
Close the stream server link and unregister from select loop Does not destroy the server link,...
Definition: stream.c:1246
void osmo_dgram_set_read_cb(struct osmo_dgram *conn, int(*read_cb)(struct osmo_dgram *conn))
Set the read() call-back of the datagram receiver.
Definition: datagram.c:490
void osmo_jibuf_enable_skew_compensation(struct osmo_jibuf *jb, bool enable)
Toggle use of skew detection and compensation mechanism.
Definition: jibuf.c:449
void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, int(*accept_cb)(struct osmo_stream_srv_link *link, int fd))
Set the accept() call-back of the stream server link.
Definition: stream.c:1175
void osmo_dgram_set_local_addr(struct osmo_dgram *conn, const char *addr)
Set the local address to which we bind.
Definition: datagram.c:455
struct osmo_jibuf * osmo_jibuf_alloc(void *talloc_ctx)
Allocate a new jitter buffer instance.
Definition: jibuf.c:298
void osmo_dgram_send(struct osmo_dgram *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom datagram transceiver.
Definition: datagram.c:544
Definition: ipa_unit.c:27
void osmo_stream_cli_set_port(struct osmo_stream_cli *cli, uint16_t port)
Set the remote port number to which we connect.
Definition: stream.c:531
int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
Open the stream server link. This actually initializes the underlying socket and binds it to the conf...
Definition: stream.c:1194
void osmux_xfrm_output_flush(struct osmux_out_handle *h)
Flush all scheduled RTP packets still pending to be transmitted.
Definition: osmux.c:322
void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli)
Re-connect an Osmocom Stream Client If re-connection is enabled for this client (which is the case un...
Definition: stream.c:277
void osmo_dgram_rx_set_addr(struct osmo_dgram_rx *conn, const char *addr)
Set the local address to which we bind.
Definition: datagram.c:316
Definition: datagram.c:394
int osmux_snprintf(char *buf, size_t size, struct msgb *msg)
Definition: osmux.c:1074
int osmo_stream_cli_set_type(struct osmo_stream_cli *cli, int type)
Set the socket type for the stream server link.
Definition: stream.c:599
int osmo_stream_srv_link_set_type(struct osmo_stream_srv_link *link, int type)
Set the socket type for the stream server link.
Definition: stream.c:1091
Osmocom Jitter Buffer helpers.
void osmo_dgram_set_data(struct osmo_dgram *conn, void *data)
Set application private data of the datagram transmitter.
Definition: datagram.c:499
void * osmo_stream_srv_link_get_data(struct osmo_stream_srv_link *link)
Get application private data of the stream server link.
Definition: stream.c:1139
struct osmo_stream_cli * osmo_stream_cli_create(void *ctx)
Create an Osmocom stream client.
Definition: stream.c:468
void osmo_dgram_set_local_port(struct osmo_dgram *conn, uint16_t port)
Set the local port to which we bind.
Definition: datagram.c:473
void osmo_dgram_tx_set_local_addr(struct osmo_dgram_tx *conn, const char *addr)
Set the local address from which we transmit.
Definition: datagram.c:171
void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom stream server.
Definition: stream.c:1449
int osmo_stream_srv_link_set_addrs(struct osmo_stream_srv_link *link, const char **addr, size_t addrcnt)
Set the local address set to which we bind. Useful for protocols allowing bind on more than one addre...
Definition: stream.c:1043
char * osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli)
Get the stream client socket description.
Definition: stream.c:663
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh)
Generate RTP packets from osmux frame AMR payload set and schedule them for transmission at appropiat...
Definition: osmux.c:270
bool osmo_jibuf_empty(struct osmo_jibuf *jb)
Check whether the jitter buffer instance has packets queued or not.
Definition: jibuf.c:418
void osmo_dgram_set_remote_port(struct osmo_dgram *conn, uint16_t port)
Set the remote port to which we transmit.
Definition: datagram.c:482
struct osmo_stream_srv * osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, int(*cb)(struct osmo_stream_srv *conn), int(*closed_cb)(struct osmo_stream_srv *conn), void *data)
Create a Stream Server inside the specified link.
Definition: stream.c:1357
int osmo_jibuf_enqueue(struct osmo_jibuf *jb, struct msgb *msg)
Try to enqueue a packet into the jitter buffer.
Definition: jibuf.c:342
int osmo_stream_cli_set_domain(struct osmo_stream_cli *cli, int domain)
Set the socket type for the stream server link.
Definition: stream.c:618
int osmo_stream_cli_open(struct osmo_stream_cli *cli)
Open connection of an Osmocom stream client By default the client will automatically reconnect after ...
Definition: stream.c:798
void osmo_stream_srv_link_set_addr(struct osmo_stream_srv_link *link, const char *addr)
Set the local address to which we bind.
Definition: stream.c:1031
bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli)
Check if Osmocom Stream Client is in connected state.
Definition: stream.c:296
void osmo_jibuf_set_dequeue_cb(struct osmo_jibuf *jb, osmo_jibuf_dequeue_cb dequeue_cb, void *cb_data)
Set dequeue callback for the jitter buffer.
Definition: jibuf.c:460
void osmo_dgram_tx_set_data(struct osmo_dgram_tx *conn, void *data)
Set application private data of the datagram transmitter.
Definition: datagram.c:191
void osmo_stream_srv_link_set_nodelay(struct osmo_stream_srv_link *link, bool nodelay)
Set the NODELAY socket option to avoid Nagle-like behavior Setting this to nodelay=true will automati...
Definition: stream.c:1019
void osmo_stream_cli_close(struct osmo_stream_cli *cli)
Close an Osmocom Stream Client.
Definition: stream.c:305
int osmo_dgram_recv(struct osmo_dgram *conn, struct msgb *msg)
Receive data via Osmocom datagram transceiver.
Definition: datagram.c:553
void * osmo_dgram_get_data(struct osmo_dgram *conn)
Get application private data of the datagram transceiver.
Definition: datagram.c:507
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn)
Destroy given Stream Server This function closes the Stream Server socket, unregisters from select lo...
Definition: stream.c:1436
int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect) OSMO_DEPRECATED("Use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead")
DEPRECATED: use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead!...
Definition: stream.c:726
int osmo_stream_cli_set_local_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt)
Set the local address set to which we connect. Useful for protocols allowing bind to more than one ad...
Definition: stream.c:564
void osmo_dgram_rx_set_port(struct osmo_dgram_rx *conn, uint16_t port)
Set the local port to which we bind.
Definition: datagram.c:326
Definition: datagram.c:248
void osmo_stream_srv_link_set_proto(struct osmo_stream_srv_link *link, uint16_t proto)
Set the protocol for the stream server link.
Definition: stream.c:1078
void osmo_dgram_close(struct osmo_dgram *conn)
Close an Osmocom Datagram Transceiver.
Definition: datagram.c:535
void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay)
Set the NODELAY socket option to avoid Nagle-like behavior Setting this to nodelay=true will automati...
Definition: stream.c:785
void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int(*read_cb)(struct osmo_stream_cli *cli))
Set the call-back function called to read from the stream client socket.
Definition: stream.c:704
Definition: datagram.c:64
void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg)
Enqueue data to be sent via an Osmocom stream client.
Definition: stream.c:871
struct osmo_dgram_rx * osmo_dgram_rx_create(void *ctx)
Create an Osmocom datagram receiver.
Definition: datagram.c:300
int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
Receive data via Osmocom stream server.
Definition: stream.c:1515
void osmo_jibuf_set_min_delay(struct osmo_jibuf *jb, uint32_t min_delay)
Set minimum buffer size for the jitter buffer.
Definition: jibuf.c:427
void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link)
Destroy the stream server link. Closes + Releases Memory.
Definition: stream.c:1184
void osmo_stream_cli_set_local_port(struct osmo_stream_cli *cli, uint16_t port)
Set the local port number for the socket (to be bound to)
Definition: stream.c:542
char * osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link)
Get description of the stream server link e. g. 127.0.0.1:1234.
Definition: stream.c:1147
void osmo_dgram_tx_send(struct osmo_dgram_tx *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom datagram transmitter.
Definition: datagram.c:235
struct osmo_dgram * osmo_dgram_create(void *ctx)
Create an Osmocom datagram transceiver (bidirectional)
Definition: datagram.c:419
uint32_t sap
Definition: prim.c:41
int osmo_dgram_open(struct osmo_dgram *conn)
Open the datagram transceiver. This actually initializes the underlying sockets and binds/connects th...
Definition: datagram.c:515
void osmo_stream_cli_set_data(struct osmo_stream_cli *cli, void *data)
Set application private data of the stream client socket.
Definition: stream.c:647
uint16_t primitive
Definition: prim.c:42
struct osmo_fd * osmo_stream_srv_link_get_ofd(struct osmo_stream_srv_link *link)
Get Osmocom File Descriptor of the stream server link.
Definition: stream.c:1167
struct osmo_stream_srv_link * osmo_stream_srv_link_create(void *ctx)
Create an Osmocom Stream Server Link A Stream Server Link is the listen()+accept() "parent" to indivi...
Definition: stream.c:996
int osmo_dgram_tx_open(struct osmo_dgram_tx *conn)
Open connection of an Osmocom datagram transmitter.
Definition: datagram.c:207
struct osmo_stream_srv_link * osmo_stream_srv_get_master(struct osmo_stream_srv *conn)
Get the master (Link) from a Stream Server.
Definition: stream.c:1425
A structure representing a single instance of a jitter buffer.
Definition: jibuf.h:20
void osmo_dgram_tx_destroy(struct osmo_dgram_tx *conn)
Destroy a Osmocom datagram transmitter.
Definition: datagram.c:198
void osmo_stream_cli_set_reconnect_timeout(struct osmo_stream_cli *cli, int timeout)
Set the reconnect time of the stream client socket.
Definition: stream.c:638
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
Definition: osmux.c:804
int osmo_stream_cli_set_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt)
Set the remote address set to which we connect. Useful for protocols allowing connecting to more than...
Definition: stream.c:507
void osmo_stream_cli_set_local_addr(struct osmo_stream_cli *cli, const char *addr)
Set the local address for the socket (to be bound to)
Definition: stream.c:553
struct osmo_dgram_tx * osmo_dgram_tx_create(void *ctx)
Create an Osmocom datagram transmitter.
Definition: datagram.c:130
void osmo_stream_srv_set_data(struct osmo_stream_srv *conn, void *data)
Set application private data of the stream server.
Definition: stream.c:1399
int osmo_dgram_rx_open(struct osmo_dgram_rx *conn)
Open the datagram receiver. This actually initializes the underlying socket and binds it to the confi...
Definition: datagram.c:353
void osmo_jibuf_set_max_delay(struct osmo_jibuf *jb, uint32_t max_delay)
Set maximum buffer size for the jitter buffer.
Definition: jibuf.c:437
void osmo_stream_cli_destroy(struct osmo_stream_cli *cli)
Destroy a Osmocom stream client (includes close)
Definition: stream.c:712
int osmo_stream_srv_link_set_domain(struct osmo_stream_srv_link *link, int domain)
Set the socket type for the stream server link.
Definition: stream.c:1110