libosmo-netif 1.7.0.10-3a9e Osmocom network interface library

stream.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdbool.h>
4#include <stdint.h>
5#include <unistd.h>
6
7#include <osmocom/core/msgb.h>
8
12#define OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION 0x80 /* sctp_recvmsg() flags=MSG_NOTIFICATION, msgb_data() contains "union sctp_notification*" */
13#define msgb_sctp_msg_flags(msg) (msg)->cb[2]
14
16#define msgb_sctp_ppid(msg) (msg)->cb[3]
18#define msgb_sctp_stream(msg) (msg)->cb[4]
19
66struct osmo_stream_srv_link;
67
68typedef int (*osmo_stream_srv_link_accept_cb_t)(struct osmo_stream_srv_link *link, int fd);
69
70struct osmo_stream_srv_link *osmo_stream_srv_link_create(void *ctx);
71void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link);
72
73void osmo_stream_srv_link_set_name(struct osmo_stream_srv_link *link, const char *name);
74const char *osmo_stream_srv_link_get_name(const struct osmo_stream_srv_link *link);
75void osmo_stream_srv_link_set_nodelay(struct osmo_stream_srv_link *link, bool nodelay);
76int osmo_stream_srv_link_set_priority(struct osmo_stream_srv_link *link, int sk_prio);
77int osmo_stream_srv_link_set_ip_dscp(struct osmo_stream_srv_link *link, uint8_t ip_dscp);
78void osmo_stream_srv_link_set_addr(struct osmo_stream_srv_link *link, const char *addr);
79int osmo_stream_srv_link_set_addrs(struct osmo_stream_srv_link *link, const char **addr, size_t addrcnt);
80void osmo_stream_srv_link_set_port(struct osmo_stream_srv_link *link, uint16_t port);
81void osmo_stream_srv_link_set_proto(struct osmo_stream_srv_link *link, uint16_t proto);
82int osmo_stream_srv_link_set_type(struct osmo_stream_srv_link *link, int type);
83int osmo_stream_srv_link_set_domain(struct osmo_stream_srv_link *link, int domain);
84void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, osmo_stream_srv_link_accept_cb_t accept_cb);
85void osmo_stream_srv_link_set_data(struct osmo_stream_srv_link *link, void *data);
86void *osmo_stream_srv_link_get_data(struct osmo_stream_srv_link *link);
87int osmo_stream_srv_link_set_tx_queue_max_length(struct osmo_stream_srv_link *link, unsigned int size);
88char *osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link);
89struct osmo_fd *osmo_stream_srv_link_get_ofd(struct osmo_stream_srv_link *link);
90int osmo_stream_srv_link_get_fd(const struct osmo_stream_srv_link *link);
91int osmo_stream_srv_link_set_msgb_alloc_info(struct osmo_stream_srv_link *link, unsigned int size, unsigned int headroom);
92bool osmo_stream_srv_link_is_opened(const struct osmo_stream_srv_link *link);
93int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link);
94void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link);
95
96enum osmo_stream_srv_link_param {
97 OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */
98 OSMO_STREAM_SRV_LINK_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */
99 OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_NUM_OSTREAMS, /* uint16_t: amount of streams */
100 OSMO_STREAM_SRV_LINK_PAR_SCTP_INIT_MAX_INSTREAMS, /* uint16_t: amount of streams */
101
102 OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPALIVE = 256, /* uint8_t: 0 disable, 1 enable */
103 OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPIDLE, /* int: seconds */
104 OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPINTVL, /* int: seconds */
105 OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_KEEPCNT, /* int: Number of probes */
106 OSMO_STREAM_SRV_LINK_PAR_TCP_SOCKOPT_USER_TIMEOUT, /* unsigned int: 0 "system default", >0 see sockopt TCP_USER_TIMEOUT */
107};
108
109int osmo_stream_srv_link_set_param(struct osmo_stream_srv_link *link, enum osmo_stream_srv_link_param par,
110 void *val, size_t val_len);
111
114struct osmo_stream_srv;
115
116typedef int (*osmo_stream_srv_read_cb_t)(struct osmo_stream_srv *conn);
117typedef int (*osmo_stream_srv_closed_cb_t)(struct osmo_stream_srv *conn);
118
124 typedef int (*osmo_stream_srv_read_cb2_t)(struct osmo_stream_srv *conn, int res, struct msgb *msg);
125
126typedef int (*osmo_stream_srv_segmentation_cb_t)(struct msgb *msg);
127typedef int (*osmo_stream_srv_segmentation_cb2_t)(struct osmo_stream_srv *conn, struct msgb *msg);
128
129struct osmo_stream_srv *osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd,
130 osmo_stream_srv_read_cb_t read_cb,
131 osmo_stream_srv_closed_cb_t closed_cb,
132 void *data);
133struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data);
134void osmo_stream_srv_set_name(struct osmo_stream_srv *conn, const char *name);
135void osmo_stream_srv_set_name_f(struct osmo_stream_srv *conn, const char *fmt, ...);
136const char *osmo_stream_srv_get_name(const struct osmo_stream_srv *conn);
137void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, osmo_stream_srv_read_cb2_t read_cb);
138void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, osmo_stream_srv_closed_cb_t close_cb);
139void *osmo_stream_srv_get_data(struct osmo_stream_srv *conn);
140int osmo_stream_srv_set_tx_queue_max_length(struct osmo_stream_srv *conn, unsigned int size);
141struct osmo_stream_srv_link *osmo_stream_srv_get_master(struct osmo_stream_srv *conn);
142const char *osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn);
143struct osmo_fd *osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv);
144int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv);
145struct osmo_io_fd *osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv);
146void osmo_stream_srv_destroy(struct osmo_stream_srv *conn);
147
148void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn);
149void osmo_stream_srv_set_data(struct osmo_stream_srv *conn, void *data);
150
151void osmo_stream_srv_set_segmentation_cb(struct osmo_stream_srv *conn, osmo_stream_srv_segmentation_cb_t segmentation_cb);
152void osmo_stream_srv_set_segmentation_cb2(struct osmo_stream_srv *conn, osmo_stream_srv_segmentation_cb2_t segmentation_cb2);
153
154void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg);
155int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg);
156
157void osmo_stream_srv_clear_tx_queue(struct osmo_stream_srv *conn);
158
159enum osmo_stream_srv_param {
160 OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPALIVE = 256, /* uint8_t: 0 disable, 1 enable */
161 OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPIDLE, /* int: seconds */
162 OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPINTVL, /* int: seconds */
163 OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_KEEPCNT, /* int: Number of probes */
164 OSMO_STREAM_SRV_PAR_TCP_SOCKOPT_USER_TIMEOUT, /* unsigned int: 0 "system default", >0 see sockopt TCP_USER_TIMEOUT */
165};
166int osmo_stream_srv_set_param(struct osmo_stream_srv *conn, enum osmo_stream_srv_param par,
167 void *val, size_t val_len);
168
207struct osmo_stream_cli;
208
209typedef int (*osmo_stream_cli_connect_cb_t)(struct osmo_stream_cli *cli);
210typedef int (*osmo_stream_cli_disconnect_cb_t)(struct osmo_stream_cli *cli);
211typedef int (*osmo_stream_cli_read_cb_t)(struct osmo_stream_cli *cli);
212
218 typedef int (*osmo_stream_cli_read_cb2_t)(struct osmo_stream_cli *cli, int res, struct msgb *msg);
219
220typedef int (*osmo_stream_cli_segmentation_cb_t)(struct msgb *msg);
221typedef int (*osmo_stream_cli_segmentation_cb2_t)(struct osmo_stream_cli *cli, struct msgb *msg);
222
223void osmo_stream_cli_set_name(struct osmo_stream_cli *cli, const char *name);
224void osmo_stream_cli_set_name_f(struct osmo_stream_cli *cli, const char *fmt, ...);
225const char *osmo_stream_cli_get_name(const struct osmo_stream_cli *cli);
226void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay);
227int osmo_stream_cli_set_priority(struct osmo_stream_cli *cli, int sk_prio);
228int osmo_stream_cli_set_ip_dscp(struct osmo_stream_cli *cli, uint8_t ip_dscp);
229void osmo_stream_cli_set_addr(struct osmo_stream_cli *cli, const char *addr);
230int osmo_stream_cli_set_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt);
231void osmo_stream_cli_set_port(struct osmo_stream_cli *cli, uint16_t port);
232int osmo_stream_cli_set_type(struct osmo_stream_cli *cli, int type);
233int osmo_stream_cli_set_domain(struct osmo_stream_cli *cli, int domain);
234void osmo_stream_cli_set_proto(struct osmo_stream_cli *cli, uint16_t proto);
235void osmo_stream_cli_set_local_addr(struct osmo_stream_cli *cli, const char *addr);
236int osmo_stream_cli_set_local_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt);
237void osmo_stream_cli_set_local_port(struct osmo_stream_cli *cli, uint16_t port);
238void osmo_stream_cli_set_data(struct osmo_stream_cli *cli, void *data);
239void osmo_stream_cli_set_reconnect_timeout(struct osmo_stream_cli *cli, int timeout);
240void *osmo_stream_cli_get_data(struct osmo_stream_cli *cli);
241int osmo_stream_cli_set_tx_queue_max_length(struct osmo_stream_cli *cli, unsigned int size);
242char *osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli);
243struct osmo_fd *osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli);
244int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli);
245struct osmo_io_fd *osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli);
246void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, osmo_stream_cli_connect_cb_t connect_cb);
247void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, osmo_stream_cli_disconnect_cb_t disconnect_cb);
248void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, osmo_stream_cli_read_cb_t read_cb);
249void osmo_stream_cli_set_read_cb2(struct osmo_stream_cli *cli, osmo_stream_cli_read_cb2_t read_cb);
250void osmo_stream_cli_set_segmentation_cb(struct osmo_stream_cli *cli, osmo_stream_cli_segmentation_cb_t segmentation_cb);
251void osmo_stream_cli_set_segmentation_cb2(struct osmo_stream_cli *cli, osmo_stream_cli_segmentation_cb2_t segmentation_cb2);
252void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli);
253bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli);
254
255struct osmo_stream_cli *osmo_stream_cli_create(void *ctx);
256void osmo_stream_cli_destroy(struct osmo_stream_cli *cli);
257
258int osmo_stream_cli_open(struct osmo_stream_cli *cli);
259int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect) \
260 OSMO_DEPRECATED("Use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead");
261void osmo_stream_cli_close(struct osmo_stream_cli *cli);
262
263void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg);
264int osmo_stream_cli_recv(struct osmo_stream_cli *cli, struct msgb *msg);
265
266void osmo_stream_cli_clear_tx_queue(struct osmo_stream_cli *cli);
267
268enum osmo_stream_cli_param {
269 OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_AUTH_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */
270 OSMO_STREAM_CLI_PAR_SCTP_SOCKOPT_ASCONF_SUPPORTED, /* uint8_t: 0 disable, 1 enable, 2 force disable, 3 force enable */
271 OSMO_STREAM_CLI_PAR_SCTP_INIT_NUM_OSTREAMS, /* uint16_t: amount of streams */
272 OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_INSTREAMS, /* uint16_t: amount of streams */
273 OSMO_STREAM_CLI_PAR_SCTP_INIT_MAX_ATTEMPTS, /* uint16_t: amount of attempts */
274 OSMO_STREAM_CLI_PAR_SCTP_INIT_TIMEOUT, /* uint16_t: milliseconds */
275
276 OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPALIVE = 256, /* uint8_t: 0 disable, 1 enable */
277 OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPIDLE, /* int: seconds */
278 OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPINTVL, /* int: seconds */
279 OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_KEEPCNT, /* int: Number of probes */
280 OSMO_STREAM_CLI_PAR_TCP_SOCKOPT_USER_TIMEOUT, /* unsigned int: 0 "system default", >0 see sockopt TCP_USER_TIMEOUT */
281};
282
283int osmo_stream_cli_set_param(struct osmo_stream_cli *cli, enum osmo_stream_cli_param par,
284 void *val, size_t val_len);
285
osmo_stream_cli_set_addr
void osmo_stream_cli_set_addr(struct osmo_stream_cli *cli, const char *addr)
Set the remote address to which we connect.
Definition: stream_cli.c:736
osmo_stream_cli_get_ofd
struct osmo_fd * osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli)
Retrieve Osmocom File Descriptor of the stream client socket.
Definition: stream_cli.c:1008
osmo_stream_cli_set_param
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.
Definition: stream_cli.c:1525
osmo_stream_cli_recv
int osmo_stream_cli_recv(struct osmo_stream_cli *cli, struct msgb *msg)
Receive data via an Osmocom stream client in osmo_fd mode.
Definition: stream_cli.c:1443
osmo_stream_cli_set_local_addrs
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.
Definition: stream_cli.c:809
osmo_stream_cli_get_name
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()).
Definition: stream_cli.c:725
osmo_stream_cli_read_cb2_t
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.
Definition: stream.h:218
osmo_stream_cli_reconnect
void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli)
Re-connect an Osmocom Stream Client.
Definition: stream_cli.c:256
osmo_stream_cli_open2
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_cli.c:1094
osmo_stream_cli_create
struct osmo_stream_cli * osmo_stream_cli_create(void *ctx)
Create an Osmocom stream client.
Definition: stream_cli.c:521
osmo_stream_cli_set_ip_dscp
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.
Definition: stream_cli.c:1219
osmo_stream_cli_set_domain
int osmo_stream_cli_set_domain(struct osmo_stream_cli *cli, int domain)
Set the socket domain for the stream client.
Definition: stream_cli.c:928
osmo_stream_cli_set_local_port
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_cli.c:785
osmo_stream_cli_set_type
int osmo_stream_cli_set_type(struct osmo_stream_cli *cli, int type)
Set the socket type for the stream client.
Definition: stream_cli.c:908
osmo_stream_cli_set_data
void osmo_stream_cli_set_data(struct osmo_stream_cli *cli, void *data)
Set application private data of the stream client socket.
Definition: stream_cli.c:957
osmo_stream_cli_get_data
void * osmo_stream_cli_get_data(struct osmo_stream_cli *cli)
Retrieve application private data of the stream client socket.
Definition: stream_cli.c:965
osmo_stream_cli_set_disconnect_cb
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.
Definition: stream_cli.c:1029
osmo_stream_cli_set_connect_cb
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.
Definition: stream_cli.c:1020
osmo_stream_cli_set_local_addr
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_cli.c:797
osmo_stream_cli_set_read_cb2
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.
Definition: stream_cli.c:1053
osmo_stream_cli_set_read_cb
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.
Definition: stream_cli.c:1040
osmo_stream_cli_is_connected
bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli)
Check if Osmocom Stream Client is in connected state.
Definition: stream_cli.c:265
osmo_stream_cli_open
int osmo_stream_cli_open(struct osmo_stream_cli *cli)
Open connection of an Osmocom stream client.
Definition: stream_cli.c:1248
osmo_stream_cli_set_tx_queue_max_length
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.
Definition: stream_cli.c:976
osmo_stream_cli_set_proto
void osmo_stream_cli_set_proto(struct osmo_stream_cli *cli, uint16_t proto)
Set the protocol for the stream client socket.
Definition: stream_cli.c:834
osmo_stream_cli_destroy
void osmo_stream_cli_destroy(struct osmo_stream_cli *cli)
Destroy a Osmocom stream client (includes close).
Definition: stream_cli.c:1063
osmo_stream_cli_set_nodelay
void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay)
Set the NODELAY socket option to avoid Nagle-like behavior.
Definition: stream_cli.c:1159
osmo_stream_cli_set_addrs
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.
Definition: stream_cli.c:748
osmo_stream_cli_send
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_cli.c:1384
osmo_stream_cli_set_segmentation_cb
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.
Definition: stream_cli.c:876
osmo_stream_cli_set_port
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_cli.c:773
osmo_stream_cli_get_iofd
struct osmo_io_fd * osmo_stream_cli_get_iofd(const struct osmo_stream_cli *cli)
Retrieve osmo_io descriptor of the stream client socket.
Definition: stream_cli.c:305
osmo_stream_cli_set_priority
int osmo_stream_cli_set_priority(struct osmo_stream_cli *cli, int sk_prio)
Set the priority value of the stream socket.
Definition: stream_cli.c:1188
osmo_stream_cli_set_name_f
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).
Definition: stream_cli.c:701
osmo_stream_cli_close
void osmo_stream_cli_close(struct osmo_stream_cli *cli)
Close an Osmocom Stream Client.
Definition: stream_cli.c:224
osmo_stream_cli_set_reconnect_timeout
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_cli.c:948
osmo_stream_cli_set_name
void osmo_stream_cli_set_name(struct osmo_stream_cli *cli, const char *name)
Set a name on the cli object (used during logging).
Definition: stream_cli.c:692
osmo_stream_cli_get_sockname
char * osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli)
Retrieve the stream client socket description.
Definition: stream_cli.c:993
osmo_stream_cli_set_segmentation_cb2
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.
Definition: stream_cli.c:893
osmo_stream_cli_clear_tx_queue
void osmo_stream_cli_clear_tx_queue(struct osmo_stream_cli *cli)
Clear the transmit queue of the stream client.
Definition: stream_cli.c:1500
osmo_stream_cli_get_fd
int osmo_stream_cli_get_fd(const struct osmo_stream_cli *cli)
Retrieve file descriptor of the stream client socket.
Definition: stream_cli.c:285
osmo_stream_srv_set_param
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.
Definition: stream_srv.c:1500
osmo_stream_srv_create
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.
Definition: stream_srv.c:989
osmo_stream_srv_link_set_type
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_srv.c:375
osmo_stream_srv_set_name
void osmo_stream_srv_set_name(struct osmo_stream_srv *conn, const char *name)
Set a name on the srv object (used during logging).
Definition: stream_srv.c:1089
osmo_stream_srv_link_set_accept_cb
void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, osmo_stream_srv_link_accept_cb_t accept_cb)
Set the accept() call-back of the stream server link.
Definition: stream_srv.c:532
osmo_stream_srv_link_set_proto
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_srv.c:361
osmo_stream_srv_link_is_opened
bool osmo_stream_srv_link_is_opened(const struct osmo_stream_srv_link *link)
Check whether the stream server link is opened.
Definition: stream_srv.c:630
osmo_stream_srv_set_segmentation_cb2
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.
Definition: stream_srv.c:1239
osmo_stream_srv_link_set_priority
int osmo_stream_srv_link_set_priority(struct osmo_stream_srv_link *link, int sk_prio)
Set the priority value of the stream socket.
Definition: stream_srv.c:287
osmo_stream_srv_link_set_nodelay
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.
Definition: stream_srv.c:271
osmo_stream_srv_get_ofd
struct osmo_fd * osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv)
Retrieve Osmocom File Descriptor of a stream server in osmo_fd mode.
Definition: stream_srv.c:1291
osmo_stream_srv_destroy
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn)
Destroy given Stream Server.
Definition: stream_srv.c:1339
osmo_stream_srv_get_sockname
const char * osmo_stream_srv_get_sockname(const struct osmo_stream_srv *conn)
Retrieve the stream server socket description.
Definition: stream_srv.c:1277
osmo_stream_srv_link_set_ip_dscp
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.
Definition: stream_srv.c:300
osmo_stream_srv_set_segmentation_cb
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.
Definition: stream_srv.c:1220
osmo_stream_srv_read_cb2_t
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.
Definition: stream.h:124
osmo_stream_srv_link_set_data
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_srv.c:415
osmo_stream_srv_link_open
int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
Open the stream server link.
Definition: stream_srv.c:573
osmo_stream_srv_set_tx_queue_max_length
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.
Definition: stream_srv.c:1265
osmo_stream_srv_link_get_name
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()).
Definition: stream_srv.c:259
osmo_stream_srv_link_set_param
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.
Definition: stream_srv.c:660
osmo_stream_srv_link_set_port
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_srv.c:348
osmo_stream_srv_set_name_f
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).
Definition: stream_srv.c:1098
osmo_stream_srv_link_get_ofd
struct osmo_fd * osmo_stream_srv_link_get_ofd(struct osmo_stream_srv_link *link)
Retrieve Osmocom File Descriptor of the stream server link.
Definition: stream_srv.c:513
osmo_stream_srv_link_get_sockname
char * osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link)
Retrieve description of the stream server link e.
Definition: stream_srv.c:500
osmo_stream_srv_get_fd
int osmo_stream_srv_get_fd(const struct osmo_stream_srv *srv)
Retrieve File Descriptor of the stream server.
Definition: stream_srv.c:1301
osmo_stream_srv_set_flush_and_destroy
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.
Definition: stream_srv.c:1164
osmo_stream_srv_link_destroy
void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link)
Destroy the stream server link.
Definition: stream_srv.c:561
osmo_stream_srv_create2
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.
Definition: stream_srv.c:1037
osmo_stream_srv_link_set_msgb_alloc_info
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.
Definition: stream_srv.c:547
osmo_stream_srv_link_set_domain
int osmo_stream_srv_link_set_domain(struct osmo_stream_srv_link *link, int domain)
Set the socket domain for the stream server link.
Definition: stream_srv.c:395
osmo_stream_srv_set_data
void osmo_stream_srv_set_data(struct osmo_stream_srv *conn, void *data)
Set application private data of the stream server.
Definition: stream_srv.c:1173
osmo_stream_srv_get_master
struct osmo_stream_srv_link * osmo_stream_srv_get_master(struct osmo_stream_srv *conn)
Retrieve the master (Link) from a Stream Server.
Definition: stream_srv.c:1329
osmo_stream_srv_get_iofd
struct osmo_io_fd * osmo_stream_srv_get_iofd(const struct osmo_stream_srv *srv)
Retrieve osmo_io descriptor of the stream server socket.
Definition: stream_srv.c:1320
osmo_stream_srv_send
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_srv.c:1367
osmo_stream_srv_link_create
struct osmo_stream_srv_link * osmo_stream_srv_link_create(void *ctx)
Create an Osmocom Stream Server Link.
Definition: stream_srv.c:226
osmo_stream_srv_link_set_addrs
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.
Definition: stream_srv.c:324
osmo_stream_srv_recv
int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
Receive data via an Osmocom stream server in osmo_fd mode.
Definition: stream_srv.c:1423
osmo_stream_srv_link_get_data
void * osmo_stream_srv_link_get_data(struct osmo_stream_srv_link *link)
Retrieve application private data of the stream server link.
Definition: stream_srv.c:424
osmo_stream_srv_link_set_addr
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_srv.c:311
osmo_stream_srv_set_read_cb
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.
Definition: stream_srv.c:1139
osmo_stream_srv_link_close
void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link)
Close the stream server link and unregister from select loop.
Definition: stream_srv.c:644
osmo_stream_srv_get_name
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()).
Definition: stream_srv.c:1125
osmo_stream_srv_link_set_tx_queue_max_length
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.
Definition: stream_srv.c:435
osmo_stream_srv_link_set_name
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).
Definition: stream_srv.c:250
osmo_stream_srv_get_data
void * osmo_stream_srv_get_data(struct osmo_stream_srv *conn)
Retrieve application private data of the stream server.
Definition: stream_srv.c:1253
osmo_stream_srv_link_get_fd
int osmo_stream_srv_link_get_fd(const struct osmo_stream_srv_link *link)
Retrieve File Descriptor of the stream server link.
Definition: stream_srv.c:521
osmo_stream_srv_set_closed_cb
void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, osmo_stream_srv_closed_cb_t close_cb)
Set the call-back function called when the stream server socket was closed.
Definition: stream_srv.c:1152