libosmo-netif: src/stream_cli.c File Reference

libosmo-netif 1.7.0.15-fe2d Osmocom network interface library

Macros | Enumerations | Functions
stream_cli.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/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 | LOGSCLI(cli, level, fmt, args...)
#define | OSMO_STREAM_CLI_F_RECONF (1 << 0)
#define | OSMO_STREAM_CLI_F_NODELAY (1 << 1)
#define | IN_CB_MASK_CONNECT_CB (1 << 0)
#define | IN_CB_MASK_DISCONNECT_CB (1 << 1)
#define | IN_CB_MASK_READ_CB (1 << 2)

## Enumerations
enum | osmo_stream_cli_state { STREAM_CLI_STATE_CLOSED , STREAM_CLI_STATE_WAIT_RECONNECT , STREAM_CLI_STATE_CONNECTING , STREAM_CLI_STATE_CONNECTED , STREAM_CLI_STATE_MAX }

## Functions
void | osmo_stream_cli_close (struct osmo_stream_cli *cli)
| Close an Osmocom Stream Client. More...
void | osmo_stream_cli_reconnect (struct osmo_stream_cli *cli)
| Re-connect an Osmocom Stream Client. More...
bool | osmo_stream_cli_is_connected (struct osmo_stream_cli *cli)
| Check if Osmocom Stream Client is in connected state. More...
int | osmo_stream_cli_get_fd (const struct osmo_stream_cli *cli)
| Retrieve file descriptor of the stream client socket. More...
struct osmo_io_fd * | osmo_stream_cli_get_iofd (const struct osmo_stream_cli *cli)
| Retrieve osmo_io descriptor of the stream client socket. More...
struct osmo_stream_cli * | osmo_stream_cli_create (void *ctx)
| Create an Osmocom stream client. More...
void | osmo_stream_cli_set_name (struct osmo_stream_cli *cli, const char *name)
| Set a name on the cli object (used during logging). More...
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). More...
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()). More...
void | osmo_stream_cli_set_addr (struct osmo_stream_cli *cli, const char *addr)
| Set the remote address to which we connect. More...
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. More...
void | osmo_stream_cli_set_port (struct osmo_stream_cli *cli, uint16_t port)
| Set the remote port number to which we connect. More...
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). More...
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). More...
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. More...
void | osmo_stream_cli_set_proto (struct osmo_stream_cli *cli, uint16_t proto)
| Set the protocol for the stream client socket. More...
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. More...
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. More...
int | osmo_stream_cli_set_type (struct osmo_stream_cli *cli, int type)
| Set the socket type for the stream client. More...
int | osmo_stream_cli_set_domain (struct osmo_stream_cli *cli, int domain)
| Set the socket domain for the stream client. More...
void | osmo_stream_cli_set_reconnect_timeout (struct osmo_stream_cli *cli, int timeout)
| Set the reconnect time of the stream client socket. More...
void | osmo_stream_cli_set_data (struct osmo_stream_cli *cli, void *data)
| Set application private data of the stream client socket. More...
void * | osmo_stream_cli_get_data (struct osmo_stream_cli *cli)
| Retrieve application private data of the stream client socket. More...
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. More...
char * | osmo_stream_cli_get_sockname (const struct osmo_stream_cli *cli)
| Retrieve the stream client socket description. More...
struct osmo_fd * | osmo_stream_cli_get_ofd (struct osmo_stream_cli *cli)
| Retrieve Osmocom File Descriptor of the stream client socket. More...
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. More...
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. More...
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. More...
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. More...
void | osmo_stream_cli_destroy (struct osmo_stream_cli *cli)
| Destroy a Osmocom stream client (includes close). More...
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. More...
void | osmo_stream_cli_set_nodelay (struct osmo_stream_cli *cli, bool nodelay)
| Set the NODELAY socket option to avoid Nagle-like behavior. More...
int | osmo_stream_cli_set_priority (struct osmo_stream_cli *cli, int sk_prio)
| Set the priority value of the stream socket. More...
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. More...
int | osmo_stream_cli_open (struct osmo_stream_cli *cli)
| Open connection of an Osmocom stream client. More...
void | osmo_stream_cli_send (struct osmo_stream_cli *cli, struct msgb *msg)
| Enqueue data to be sent via an Osmocom stream client. More...
int | osmo_stream_cli_recv (struct osmo_stream_cli *cli, struct msgb *msg)
| Receive data via an Osmocom stream client in osmo_fd mode. More...
void | osmo_stream_cli_clear_tx_queue (struct osmo_stream_cli *cli)
| Clear the transmit queue of the stream client. More...
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. More...

## Macro Definition Documentation

## ◆ LOGSCLI

#define LOGSCLI | ( |  | cli,
|  |  | level,
|  |  | fmt,
|  |  | args...
| ) |  |

Value:
LOGP(DLINP, level, "CLICONN(%s,%s){%s} " fmt, \
cli->name ? : "", \
cli->sockname, \
get_value_string(stream_cli_state_names, (cli)->state), \
## args)