libosmo-netif: src/stream_srv.c File Reference

libosmo-netif 1.7.0.15-fe2d Osmocom network interface library

Macros | Functions
stream_srv.c File Reference
`#include <stdio.h>`
`#include <unistd.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <string.h>`
`#include <time.h>`
`#include <sys/fcntl.h>`
`#include <sys/socket.h>`
`#include <sys/un.h>`
`#include <sys/ioctl.h>`
`#include <arpa/inet.h>`
`#include <netinet/in.h>`
`#include <netinet/tcp.h>`
`#include <osmocom/core/timer.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/gsm/tlv.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/osmo_io.h>`
`#include <osmocom/core/panic.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/core/socket.h>`
`#include <osmocom/netif/stream.h>`
`#include <osmocom/netif/stream_private.h>`
`#include "config.h"`

## Macros
#define | LOGSLNK(link, level, fmt, args...)
#define | LOGSSRV(srv, level, fmt, args...)
#define | OSMO_STREAM_SRV_F_RECONF (1 << 0)
#define | OSMO_STREAM_SRV_F_NODELAY (1 << 1)
#define | OSMO_STREAM_SRV_F_FLUSH_DESTROY (1 << 0)

## Functions
struct osmo_stream_srv_link * | osmo_stream_srv_link_create (void *ctx)
| Create an Osmocom Stream Server Link. More...
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). More...
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()). More...
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. More...
int | osmo_stream_srv_link_set_priority (struct osmo_stream_srv_link *link, int sk_prio)
| Set the priority value of the stream socket. More...
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. More...
void | osmo_stream_srv_link_set_addr (struct osmo_stream_srv_link *link, const char *addr)
| Set the local address to which we bind. More...
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. More...
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. More...
void | osmo_stream_srv_link_set_proto (struct osmo_stream_srv_link *link, uint16_t proto)
| Set the protocol for the stream server link. More...
int | osmo_stream_srv_link_set_type (struct osmo_stream_srv_link *link, int type)
| Set the socket type for the stream server link. More...
int | osmo_stream_srv_link_set_domain (struct osmo_stream_srv_link *link, int domain)
| Set the socket domain for the stream server link. More...
void | osmo_stream_srv_link_set_data (struct osmo_stream_srv_link *link, void *data)
| Set application private data of the stream server link. More...
void * | osmo_stream_srv_link_get_data (struct osmo_stream_srv_link *link)
| Retrieve application private data of the stream server link. More...
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. More...
char * | osmo_stream_srv_link_get_sockname (const struct osmo_stream_srv_link *link)
| Retrieve description of the stream server link e. More...
struct osmo_fd * | osmo_stream_srv_link_get_ofd (struct osmo_stream_srv_link *link)
| Retrieve Osmocom File Descriptor of the stream server link. More...
int | osmo_stream_srv_link_get_fd (const struct osmo_stream_srv_link *link)
| Retrieve File Descriptor of the stream server link. More...
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. More...
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. More...
void | osmo_stream_srv_link_destroy (struct osmo_stream_srv_link *link)
| Destroy the stream server link. More...
int | osmo_stream_srv_link_open (struct osmo_stream_srv_link *link)
| Open the stream server link. More...
bool | osmo_stream_srv_link_is_opened (const struct osmo_stream_srv_link *link)
| Check whether the stream server link is opened. More...
void | osmo_stream_srv_link_close (struct osmo_stream_srv_link *link)
| Close the stream server link and unregister from select loop. More...
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. More...
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. More...
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. More...
void | osmo_stream_srv_set_name (struct osmo_stream_srv *conn, const char *name)
| Set a name on the srv object (used during logging). More...
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). More...
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()). More...
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. More...
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. More...
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. More...
void | osmo_stream_srv_set_data (struct osmo_stream_srv *conn, void *data)
| Set application private data of the stream server. More...
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. More...
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. More...
void * | osmo_stream_srv_get_data (struct osmo_stream_srv *conn)
| Retrieve application private data of the stream server. More...
int | osmo_stream_srv_set_tx_queue_max_length (struct osmo_stream_srv *conn, unsigned int size)
| Set the maximum length queue of the stream server connection. More...
const char * | osmo_stream_srv_get_sockname (const struct osmo_stream_srv *conn)
| Retrieve the stream server socket description. More...
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. More...
int | osmo_stream_srv_get_fd (const struct osmo_stream_srv *conn)
| Retrieve File Descriptor of the stream server. More...
struct osmo_io_fd * | osmo_stream_srv_get_iofd (const struct osmo_stream_srv *srv)
| Retrieve osmo_io descriptor of the stream server socket. More...
struct osmo_stream_srv_link * | osmo_stream_srv_get_master (struct osmo_stream_srv *conn)
| Retrieve the master (Link) from a Stream Server. More...
void | osmo_stream_srv_destroy (struct osmo_stream_srv *conn)
| Destroy given Stream Server. More...
void | osmo_stream_srv_send (struct osmo_stream_srv *conn, struct msgb *msg)
| Enqueue data to be sent via an Osmocom stream server. More...
int | osmo_stream_srv_recv (struct osmo_stream_srv *conn, struct msgb *msg)
| Receive data via an Osmocom stream server in osmo_fd mode. More...
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. More...

## Macro Definition Documentation

## ◆ LOGSLNK

#define LOGSLNK | ( |  | link,
|  |  | level,
|  |  | fmt,
|  |  | args...
| ) |  |

Value:
LOGP(DLINP, level, "SRV(%s,%s) " fmt, \
link->name ? : "", \
link->sockname, \
## args)

## ◆ LOGSSRV

#define LOGSSRV | ( |  | srv,
|  |  | level,
|  |  | fmt,
|  |  | args...
| ) |  |

Value:
LOGP(DLINP, level, "SRVCONN(%s,%s) " fmt, \
srv->name ? : "", \
srv->sockname, \
## args)