libosmo-netif 1.6.0.16-c51c Osmocom network interface library

Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
stream.h File Reference
`#include <stdbool.h>`
`#include <stdint.h>`
`#include <unistd.h>`
`#include <osmocom/core/msgb.h>`

Go to the source code of this file.

## Macros
#define | OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION 0x80 /* sctp_recvmsg() flags=MSG_NOTIFICATION, msgb_data() contains "union sctp_notification*" */
| Access SCTP flags from the msgb control buffer.
#define | msgb_sctp_msg_flags(msg) (msg)->cb[2]
#define | msgb_sctp_ppid(msg) (msg)->cb[3]
| Access the SCTP PPID from the msgb control buffer.
#define | msgb_sctp_stream(msg) (msg)->cb[4]
| Access the SCTP Stream ID from the msgb control buffer.

## Typedefs
typedef int(* | osmo_stream_srv_link_accept_cb_t) (struct osmo_stream_srv_link *link, int fd)
typedef int(* | osmo_stream_srv_read_cb_t) (struct osmo_stream_srv *conn)
typedef int(* | osmo_stream_srv_closed_cb_t) (struct osmo_stream_srv *conn)
typedef int(* | osmo_stream_srv_read_cb2_t) (struct osmo_stream_srv *conn, int res, struct msgb *msg)
| Completion call-back function when something was read from from the stream client socket.
typedef int(* | osmo_stream_srv_segmentation_cb_t) (struct msgb *msg)
typedef int(* | osmo_stream_srv_segmentation_cb2_t) (struct osmo_stream_srv *conn, struct msgb *msg)
typedef int(* | osmo_stream_cli_connect_cb_t) (struct osmo_stream_cli *cli)
typedef int(* | osmo_stream_cli_disconnect_cb_t) (struct osmo_stream_cli *cli)
typedef int(* | osmo_stream_cli_read_cb_t) (struct osmo_stream_cli *cli)
typedef int(* | osmo_stream_cli_read_cb2_t) (struct osmo_stream_cli *cli, int res, struct msgb *msg)
| Completion call-back function when something was read from from the stream client socket.
typedef int(* | osmo_stream_cli_segmentation_cb_t) (struct msgb *msg)
typedef int(* | osmo_stream_cli_segmentation_cb2_t) (struct osmo_stream_cli *cli, struct msgb *msg)

## Enumerations
enum | osmo_stream_srv_link_param { OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED , OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED , OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_NUM_OSTREAMS , OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_MAX_INSTREAMS , OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPALIVE = 256 , OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPIDLE , OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPINTVL , OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPCNT , OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_USER_TIMEOUT }
enum | osmo_stream_srv_param { OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPALIVE = 256 , OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPIDLE , OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPINTVL , OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPCNT , OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_USER_TIMEOUT }
enum | osmo_stream_cli_param { OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED , OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED , OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS , OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS , OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS , OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT , OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPALIVE = 256 , OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPIDLE , OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPINTVL , OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPCNT , OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_USER_TIMEOUT }

## Functions
struct osmo_stream_srv_link * | osmo_stream_srv_link_create (void *ctx)
| Create an Osmocom Stream Server Link.
void | osmo_stream_srv_link_destroy (struct osmo_stream_srv_link *link)
| Destroy the stream server link.
void | osmo_stream_srv_link_set_name (struct osmo_stream_srv_link *link, const char *name)
| Set a name on the srv_link object (used during logging).
const char * | osmo_stream_srv_link_get_name (const struct osmo_stream_srv_link *link)
| Retrieve name previously set on the srv_link object (see osmo_stream_srv_link_set_name()).
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.
int | osmo_stream_srv_link_set_priority (struct osmo_stream_srv_link *link, int sk_prio)
| Set the priority value of the stream socket.
int | osmo_stream_srv_link_set_ip_dscp (struct osmo_stream_srv_link *link, uint8_t ip_dscp)
| Set the DSCP (differentiated services code point) of the stream socket.
void | osmo_stream_srv_link_set_addr (struct osmo_stream_srv_link *link, const char *addr)
| Set the local address to which we bind.
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.
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.
void | osmo_stream_srv_link_set_proto (struct osmo_stream_srv_link *link, uint16_t proto)
| Set the protocol for the stream server link.
int | osmo_stream_srv_link_set_type (struct osmo_stream_srv_link *link, int type)
| Set the socket type for the stream server link.
int | osmo_stream_srv_link_set_domain (struct osmo_stream_srv_link *link, int domain)
| Set the socket domain for the stream server link.
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.
void | osmo_stream_srv_link_set_data (struct osmo_stream_srv_link *link, void *data)
| Set application private data of the stream server link.
void * | osmo_stream_srv_link_get_data (struct osmo_stream_srv_link *link)
| Retrieve application private data of the stream server link.
int | osmo_stream_srv_link_set_tx_queue_max_length (struct osmo_stream_srv_link *link, unsigned int size)
| Set the maximum length queue of the stream servers accepted and allocated from this server link.
char * | osmo_stream_srv_link_get_sockname (const struct osmo_stream_srv_link *link)
| Retrieve description of the stream server link e.
struct osmo_fd * | osmo_stream_srv_link_get_ofd (struct osmo_stream_srv_link *link)
| Retrieve Osmocom File Descriptor of the stream server link.
int | osmo_stream_srv_link_get_fd (const struct osmo_stream_srv_link *link)
| Retrieve File Descriptor of the stream server link.
int | osmo_stream_srv_link_set_msgb_alloc_info (struct osmo_stream_srv_link *link, unsigned int size, unsigned int headroom)
| Set the msgb allocation parameters on child osmo_stream_srv objects.
bool | osmo_stream_srv_link_is_opened (const struct osmo_stream_srv_link *link)
| Check whether the stream server link is opened.
int | osmo_stream_srv_link_open (struct osmo_stream_srv_link *link)
| Open the stream server link.
void | osmo_stream_srv_link_close (struct osmo_stream_srv_link *link)
| Close the stream server link and unregister from select loop.
int | osmo_stream_srv_link_set_param (struct osmo_stream_srv_link *link, enum osmo_stream_srv_link_param par, void *val, size_t val_len)
| Set given parameter of stream_srv_link to given value.
struct osmo_stream_srv * | osmo_stream_srv_create (void *ctx, struct osmo_stream_srv_link *link, int fd, osmo_stream_srv_read_cb_t read_cb, osmo_stream_srv_closed_cb_t closed_cb, void *data)
| Create a legacy osmo_fd mode Stream Server inside the specified link.
struct osmo_stream_srv * | osmo_stream_srv_create2 (void *ctx, struct osmo_stream_srv_link *link, int fd, void *data)
| Create an osmo_iofd mode Stream Server inside the specified link.
void | osmo_stream_srv_set_name (struct osmo_stream_srv *conn, const char *name)
| Set a name on the srv object (used during logging).
void | osmo_stream_srv_set_name_f (struct osmo_stream_srv *conn, const char *fmt,...)
| Set a name on the srv object using arguments like printf() (used during logging).
const char * | osmo_stream_srv_get_name (const struct osmo_stream_srv *conn)
| Retrieve name previously set on the srv object (see osmo_stream_srv_set_name()).
void | osmo_stream_srv_set_read_cb (struct osmo_stream_srv *conn, osmo_stream_srv_read_cb2_t read_cb)
| Set the call-back function for incoming data on an osmo_io stream_srv.
void | osmo_stream_srv_set_closed_cb (struct osmo_stream_srv *conn, osmo_stream_srv_closed_cb_t closed_cb)
| Set the call-back function called when the stream server socket was closed.
void * | osmo_stream_srv_get_data (struct osmo_stream_srv *conn)
| Retrieve application private data of the stream server.
struct osmo_stream_srv_link * | osmo_stream_srv_get_master (struct osmo_stream_srv *conn)
| Retrieve the master (Link) from a Stream Server.
const char * | osmo_stream_srv_get_sockname (const struct osmo_stream_srv *conn)
| Retrieve the stream server socket description.
struct osmo_fd * | osmo_stream_srv_get_ofd (struct osmo_stream_srv *conn)
| Retrieve Osmocom File Descriptor of a stream server in osmo_fd mode.
int | osmo_stream_srv_get_fd (const struct osmo_stream_srv *conn)
| Retrieve File Descriptor of the stream server.
struct osmo_io_fd * | osmo_stream_srv_get_iofd (const struct osmo_stream_srv *srv)
| Retrieve osmo_io descriptor of the stream server socket.
void | osmo_stream_srv_destroy (struct osmo_stream_srv *conn)
| Destroy given Stream Server.
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.
void | osmo_stream_srv_set_data (struct osmo_stream_srv *conn, void *data)
| Set application private data of the stream server.
void | osmo_stream_srv_set_segmentation_cb (struct osmo_stream_srv *conn, osmo_stream_srv_segmentation_cb_t segmentation_cb)
| Set the segmentation callback for target osmo_stream_srv structure.
void | osmo_stream_srv_set_segmentation_cb2 (struct osmo_stream_srv *conn, osmo_stream_srv_segmentation_cb2_t segmentation_cb2)
| Set the segmentation callback for target osmo_stream_srv structure.
void | osmo_stream_srv_send (struct osmo_stream_srv *conn, struct msgb *msg)
| Enqueue data to be sent via an Osmocom stream server.
int | osmo_stream_srv_recv (struct osmo_stream_srv *conn, struct msgb *msg)
| Receive data via an Osmocom stream server in osmo_fd mode.
void | osmo_stream_srv_clear_tx_queue (struct osmo_stream_srv *conn)
int | osmo_stream_srv_set_param (struct osmo_stream_srv *conn, enum osmo_stream_srv_param par, void *val, size_t val_len)
| Set given parameter of stream_srv to given value.
void | osmo_stream_cli_set_name (struct osmo_stream_cli *cli, const char *name)
| Set a name on the cli object (used during logging).
void | osmo_stream_cli_set_name_f (struct osmo_stream_cli *cli, const char *fmt,...)
| Set a name on the cli object using arguments like printf() (used during logging).
const char * | osmo_stream_cli_get_name (const struct osmo_stream_cli *cli)
| Retrieve name previously set on the cli object (see osmo_stream_cli_set_name()).
void | osmo_stream_cli_set_nodelay (struct osmo_stream_cli *cli, bool nodelay)
| Set the NODELAY socket option to avoid Nagle-like behavior.
int | osmo_stream_cli_set_priority (struct osmo_stream_cli *cli, int sk_prio)
| Set the priority value of the stream socket.
int | osmo_stream_cli_set_ip_dscp (struct osmo_stream_cli *cli, uint8_t ip_dscp)
| Set the DSCP (differentiated services code point) of the stream socket.
void | osmo_stream_cli_set_addr (struct osmo_stream_cli *cli, const char *addr)
| Set the remote address to which we connect.
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.
void | osmo_stream_cli_set_port (struct osmo_stream_cli *cli, uint16_t port)
| Set the remote port number to which we connect.
int | osmo_stream_cli_set_type (struct osmo_stream_cli *cli, int type)
| Set the socket type for the stream server link.
int | osmo_stream_cli_set_domain (struct osmo_stream_cli *cli, int domain)
| Set the socket domain for the stream client link.
void | osmo_stream_cli_set_proto (struct osmo_stream_cli *cli, uint16_t proto)
| Set the protocol for the stream client socket.
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).
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 bind.
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).
void | osmo_stream_cli_set_data (struct osmo_stream_cli *cli, void *data)
| Set application private data of the stream client socket.
void | osmo_stream_cli_set_reconnect_timeout (struct osmo_stream_cli *cli, int timeout)
| Set the reconnect time of the stream client socket.
void * | osmo_stream_cli_get_data (struct osmo_stream_cli *cli)
| Retrieve application private data of the stream client socket.
int | osmo_stream_cli_set_tx_queue_max_length (struct osmo_stream_cli *cli, unsigned int size)
| Set the maximum length queue of the stream client.
char * | osmo_stream_cli_get_sockname (const struct osmo_stream_cli *cli)
| Retrieve the stream client socket description.
struct osmo_fd * | osmo_stream_cli_get_ofd (struct osmo_stream_cli *cli)
| Retrieve Osmocom File Descriptor of the stream client socket.
int | osmo_stream_cli_get_fd (const struct osmo_stream_cli *cli)
| Retrieve file descriptor of the stream client socket.
struct osmo_io_fd * | osmo_stream_cli_get_iofd (const struct osmo_stream_cli *cli)
| Retrieve osmo_io descriptor of the stream client socket.
void | osmo_stream_cli_set_connect_cb (struct osmo_stream_cli *cli, osmo_stream_cli_connect_cb_t connect_cb)
| Set the call-back function called on connect of the stream client socket.
void | osmo_stream_cli_set_disconnect_cb (struct osmo_stream_cli *cli, osmo_stream_cli_disconnect_cb_t disconnect_cb)
| Set the call-back function called on disconnect of the stream client socket.
void | osmo_stream_cli_set_read_cb (struct osmo_stream_cli *cli, osmo_stream_cli_read_cb_t read_cb)
| Set the call-back function called to read from the stream client socket.
void | osmo_stream_cli_set_read_cb2 (struct osmo_stream_cli *cli, osmo_stream_cli_read_cb2_t read_cb)
| Set the call-back function called to read from the stream client socket.
void | osmo_stream_cli_set_segmentation_cb (struct osmo_stream_cli *cli, osmo_stream_cli_segmentation_cb_t segmentation_cb)
| Set the segmentation callback for the client.
void | osmo_stream_cli_set_segmentation_cb2 (struct osmo_stream_cli *cli, osmo_stream_cli_segmentation_cb2_t segmentation_cb2)
| Set the segmentation callback for the client.
void | osmo_stream_cli_reconnect (struct osmo_stream_cli *cli)
| Re-connect an Osmocom Stream Client.
bool | osmo_stream_cli_is_connected (struct osmo_stream_cli *cli)
| Check if Osmocom Stream Client is in connected state.
struct osmo_stream_cli * | osmo_stream_cli_create (void *ctx)
| Create an Osmocom stream client.
void | osmo_stream_cli_destroy (struct osmo_stream_cli *cli)
| Destroy a Osmocom stream client (includes close).
int | osmo_stream_cli_open (struct osmo_stream_cli *cli)
| Open connection of an Osmocom stream client.
int | osmo_stream_cli_open2 (struct osmo_stream_cli *cli, int reconnect)
| DEPRECATED: use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead! Open connection of an Osmocom stream client.
void | osmo_stream_cli_close (struct osmo_stream_cli *cli)
| Close an Osmocom Stream Client.
void | osmo_stream_cli_send (struct osmo_stream_cli *cli, struct msgb *msg)
| Enqueue data to be sent via an Osmocom stream client.
int | osmo_stream_cli_recv (struct osmo_stream_cli *cli, struct msgb *msg)
| Receive data via an Osmocom stream client in osmo_fd mode.
void | osmo_stream_cli_clear_tx_queue (struct osmo_stream_cli *cli)
| Clear the transmit queue of the stream client.
int | osmo_stream_cli_set_param (struct osmo_stream_cli *cli, enum osmo_stream_cli_param par, void *val, size_t val_len)
| Set given parameter of stream client to given value.