\doxysection{stream.\+h} \label{stream_8h_source}\index{include/osmocom/netif/stream.h@{include/osmocom/netif/stream.h}} \begin{DoxyCode}{0} \DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}} \DoxyCodeLine{2 } \DoxyCodeLine{3 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{4 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{5 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{6 } \DoxyCodeLine{7 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{8 } \DoxyCodeLine{14 \textcolor{preprocessor}{\#define OSMO\_STREAM\_SCTP\_MSG\_FLAGS\_NOTIFICATION 0x80 }\textcolor{comment}{/* sctp\_recvmsg() flags=MSG\_NOTIFICATION, msgb\_data() contains "{}union sctp\_notification*"{} */}\textcolor{preprocessor}{}} \DoxyCodeLine{15 \textcolor{preprocessor}{\#define msgb\_sctp\_msg\_flags(msg) (msg)-\/>cb[2]}} \DoxyCodeLine{16 } \DoxyCodeLine{18 \textcolor{preprocessor}{\#define msgb\_sctp\_ppid(msg) (msg)-\/>cb[3]}} \DoxyCodeLine{20 \textcolor{preprocessor}{\#define msgb\_sctp\_stream(msg) (msg)-\/>cb[4]}} \DoxyCodeLine{21 } \DoxyCodeLine{23 \textcolor{keyword}{struct }osmo\_stream\_srv\_link;} \DoxyCodeLine{24 } \DoxyCodeLine{25 \textcolor{keyword}{struct }osmo\_stream\_srv\_link *osmo\_stream\_srv\_link\_create(\textcolor{keywordtype}{void} *ctx);} \DoxyCodeLine{26 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_destroy(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{27 } \DoxyCodeLine{28 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_name(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name);} \DoxyCodeLine{29 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_nodelay(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{bool} nodelay);} \DoxyCodeLine{30 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_addr(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *addr);} \DoxyCodeLine{31 \textcolor{keywordtype}{int} osmo\_stream\_srv\_link\_set\_addrs(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keyword}{const} \textcolor{keywordtype}{char} **addr, \textcolor{keywordtype}{size\_t} addrcnt);} \DoxyCodeLine{32 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_port(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, uint16\_t port);} \DoxyCodeLine{33 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_proto(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, uint16\_t proto);} \DoxyCodeLine{34 \textcolor{keywordtype}{int} osmo\_stream\_srv\_link\_set\_type(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} type);} \DoxyCodeLine{35 \textcolor{keywordtype}{int} osmo\_stream\_srv\_link\_set\_domain(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} domain);} \DoxyCodeLine{36 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_accept\_cb(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} (*accept\_cb)(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} fd));} \DoxyCodeLine{37 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_set\_data(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{void} *data);} \DoxyCodeLine{38 \textcolor{keywordtype}{void} *osmo\_stream\_srv\_link\_get\_data(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{39 \textcolor{keywordtype}{char} *osmo\_stream\_srv\_link\_get\_sockname(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{40 \textcolor{keyword}{struct }osmo\_fd *osmo\_stream\_srv\_link\_get\_ofd(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{41 \textcolor{keywordtype}{bool} osmo\_stream\_srv\_link\_is\_opened(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{42 \textcolor{keywordtype}{int} osmo\_stream\_srv\_link\_open(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{43 \textcolor{keywordtype}{void} osmo\_stream\_srv\_link\_close(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link);} \DoxyCodeLine{44 } \DoxyCodeLine{45 \textcolor{keyword}{enum} osmo\_stream\_srv\_link\_param \{} \DoxyCodeLine{46 OSMO\_STREAM\_SRV\_LINK\_PAR\_SCTP\_SOCKOPT\_AUTH\_SUPPORTED, \textcolor{comment}{/* uint8\_t: 0 disable, 1 enable, 2 force disable, 3 force enable */}} \DoxyCodeLine{47 OSMO\_STREAM\_SRV\_LINK\_PAR\_SCTP\_SOCKOPT\_ASCONF\_SUPPORTED, \textcolor{comment}{/* uint8\_t: 0 disable, 1 enable, 2 force disable, 3 force enable */}} \DoxyCodeLine{48 OSMO\_STREAM\_SRV\_LINK\_PAR\_SCTP\_INIT\_NUM\_OSTREAMS, \textcolor{comment}{/* uint16\_t: amount of streams */}} \DoxyCodeLine{49 OSMO\_STREAM\_SRV\_LINK\_PAR\_SCTP\_INIT\_MAX\_INSTREAMS, \textcolor{comment}{/* uint16\_t: amount of streams */}} \DoxyCodeLine{50 \};} \DoxyCodeLine{51 } \DoxyCodeLine{52 \textcolor{keywordtype}{int} osmo\_stream\_srv\_link\_set\_param(\textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keyword}{enum} osmo\_stream\_srv\_link\_param par,} \DoxyCodeLine{53 \textcolor{keywordtype}{void} *val, \textcolor{keywordtype}{size\_t} val\_len);} \DoxyCodeLine{54 } \DoxyCodeLine{57 \textcolor{keyword}{struct }osmo\_stream\_srv;} \DoxyCodeLine{58 } \DoxyCodeLine{59 \textcolor{keyword}{struct }osmo\_stream\_srv *osmo\_stream\_srv\_create(\textcolor{keywordtype}{void} *ctx, \textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} fd, \textcolor{keywordtype}{int} (*read\_cb)(\textcolor{keyword}{struct} osmo\_stream\_srv *conn), \textcolor{keywordtype}{int} (*closed\_cb)(\textcolor{keyword}{struct} osmo\_stream\_srv *conn), \textcolor{keywordtype}{void} *data);} \DoxyCodeLine{60 \textcolor{keyword}{struct }osmo\_stream\_srv *osmo\_stream\_srv\_create2(\textcolor{keywordtype}{void} *ctx, \textcolor{keyword}{struct} osmo\_stream\_srv\_link *link, \textcolor{keywordtype}{int} fd, \textcolor{keywordtype}{void} *data);} \DoxyCodeLine{61 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_name(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name);} \DoxyCodeLine{62 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_read\_cb(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keywordtype}{int} (*read\_cb)(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keyword}{struct} msgb *msg));} \DoxyCodeLine{63 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_closed\_cb(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keywordtype}{int} (*closed\_cb)(\textcolor{keyword}{struct} osmo\_stream\_srv *conn));} \DoxyCodeLine{64 \textcolor{keywordtype}{void} *osmo\_stream\_srv\_get\_data(\textcolor{keyword}{struct} osmo\_stream\_srv *conn);} \DoxyCodeLine{65 \textcolor{keyword}{struct }osmo\_stream\_srv\_link *osmo\_stream\_srv\_get\_master(\textcolor{keyword}{struct} osmo\_stream\_srv *conn);} \DoxyCodeLine{66 \textcolor{keyword}{struct }osmo\_fd *osmo\_stream\_srv\_get\_ofd(\textcolor{keyword}{struct} osmo\_stream\_srv *srv);} \DoxyCodeLine{67 \textcolor{keywordtype}{void} osmo\_stream\_srv\_destroy(\textcolor{keyword}{struct} osmo\_stream\_srv *conn);} \DoxyCodeLine{68 } \DoxyCodeLine{69 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_flush\_and\_destroy(\textcolor{keyword}{struct} osmo\_stream\_srv *conn);} \DoxyCodeLine{70 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_data(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keywordtype}{void} *data);} \DoxyCodeLine{71 } \DoxyCodeLine{72 \textcolor{keywordtype}{void} osmo\_stream\_srv\_set\_segmentation\_cb(\textcolor{keyword}{struct} osmo\_stream\_srv *conn,} \DoxyCodeLine{73 \textcolor{keywordtype}{int} (*segmentation\_cb)(\textcolor{keyword}{struct} msgb *msg));} \DoxyCodeLine{74 } \DoxyCodeLine{75 \textcolor{keywordtype}{void} osmo\_stream\_srv\_send(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keyword}{struct} msgb *msg);} \DoxyCodeLine{76 \textcolor{keywordtype}{int} osmo\_stream\_srv\_recv(\textcolor{keyword}{struct} osmo\_stream\_srv *conn, \textcolor{keyword}{struct} msgb *msg);} \DoxyCodeLine{77 } \DoxyCodeLine{78 \textcolor{keywordtype}{void} osmo\_stream\_srv\_clear\_tx\_queue(\textcolor{keyword}{struct} osmo\_stream\_srv *conn);} \DoxyCodeLine{79 } \DoxyCodeLine{81 \textcolor{keyword}{struct }osmo\_stream\_cli;} \DoxyCodeLine{82 } \DoxyCodeLine{83 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_name(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name);} \DoxyCodeLine{84 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_nodelay(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{bool} nodelay);} \DoxyCodeLine{85 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_addr(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *addr);} \DoxyCodeLine{86 \textcolor{keywordtype}{int} osmo\_stream\_cli\_set\_addrs(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{const} \textcolor{keywordtype}{char} **addr, \textcolor{keywordtype}{size\_t} addrcnt);} \DoxyCodeLine{87 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_port(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, uint16\_t port);} \DoxyCodeLine{88 \textcolor{keywordtype}{int} osmo\_stream\_cli\_set\_type(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} type);} \DoxyCodeLine{89 \textcolor{keywordtype}{int} osmo\_stream\_cli\_set\_domain(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} domain);} \DoxyCodeLine{90 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_proto(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, uint16\_t proto);} \DoxyCodeLine{91 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_local\_addr(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *addr);} \DoxyCodeLine{92 \textcolor{keywordtype}{int} osmo\_stream\_cli\_set\_local\_addrs(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{const} \textcolor{keywordtype}{char} **addr, \textcolor{keywordtype}{size\_t} addrcnt);} \DoxyCodeLine{93 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_local\_port(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, uint16\_t port);} \DoxyCodeLine{94 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_data(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{void} *data);} \DoxyCodeLine{95 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_reconnect\_timeout(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} timeout);} \DoxyCodeLine{96 \textcolor{keywordtype}{void} *osmo\_stream\_cli\_get\_data(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{97 \textcolor{keywordtype}{char} *osmo\_stream\_cli\_get\_sockname(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{98 \textcolor{keyword}{struct }osmo\_fd *osmo\_stream\_cli\_get\_ofd(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{99 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_connect\_cb(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} (*connect\_cb)(\textcolor{keyword}{struct} osmo\_stream\_cli *cli));} \DoxyCodeLine{100 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_disconnect\_cb(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} (*disconnect\_cb)(\textcolor{keyword}{struct} osmo\_stream\_cli *cli));} \DoxyCodeLine{101 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_read\_cb(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} (*read\_cb)(\textcolor{keyword}{struct} osmo\_stream\_cli *cli));} \DoxyCodeLine{102 \textcolor{keywordtype}{void} osmo\_stream\_cli\_set\_read\_cb2(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} (*read\_cb)(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{struct} msgb *msg));} \DoxyCodeLine{103 \textcolor{keywordtype}{void} osmo\_stream\_cli\_reconnect(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{104 \textcolor{keywordtype}{bool} osmo\_stream\_cli\_is\_connected(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{105 } \DoxyCodeLine{106 \textcolor{keyword}{struct }osmo\_stream\_cli *osmo\_stream\_cli\_create(\textcolor{keywordtype}{void} *ctx);} \DoxyCodeLine{107 \textcolor{keywordtype}{void} osmo\_stream\_cli\_destroy(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{108 } \DoxyCodeLine{109 \textcolor{keywordtype}{int} osmo\_stream\_cli\_open(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{110 \textcolor{keywordtype}{int} osmo\_stream\_cli\_open2(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keywordtype}{int} reconnect) \(\backslash\)} \DoxyCodeLine{111 OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use osmo\_stream\_cli\_set\_reconnect\_timeout() or osmo\_stream\_cli\_reconnect() instead"{}});} \DoxyCodeLine{112 \textcolor{keywordtype}{void} osmo\_stream\_cli\_close(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{113 } \DoxyCodeLine{114 \textcolor{keywordtype}{void} osmo\_stream\_cli\_send(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{struct} msgb *msg);} \DoxyCodeLine{115 \textcolor{keywordtype}{int} osmo\_stream\_cli\_recv(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{struct} msgb *msg);} \DoxyCodeLine{116 } \DoxyCodeLine{117 \textcolor{keywordtype}{void} osmo\_stream\_cli\_clear\_tx\_queue(\textcolor{keyword}{struct} osmo\_stream\_cli *cli);} \DoxyCodeLine{118 } \DoxyCodeLine{119 \textcolor{keyword}{enum} osmo\_stream\_cli\_param \{} \DoxyCodeLine{120 OSMO\_STREAM\_CLI\_PAR\_SCTP\_SOCKOPT\_AUTH\_SUPPORTED, \textcolor{comment}{/* uint8\_t: 0 disable, 1 enable, 2 force disable, 3 force enable */}} \DoxyCodeLine{121 OSMO\_STREAM\_CLI\_PAR\_SCTP\_SOCKOPT\_ASCONF\_SUPPORTED, \textcolor{comment}{/* uint8\_t: 0 disable, 1 enable, 2 force disable, 3 force enable */}} \DoxyCodeLine{122 OSMO\_STREAM\_CLI\_PAR\_SCTP\_INIT\_NUM\_OSTREAMS, \textcolor{comment}{/* uint16\_t: amount of streams */}} \DoxyCodeLine{123 OSMO\_STREAM\_CLI\_PAR\_SCTP\_INIT\_MAX\_INSTREAMS, \textcolor{comment}{/* uint16\_t: amount of streams */}} \DoxyCodeLine{124 OSMO\_STREAM\_CLI\_PAR\_SCTP\_INIT\_MAX\_ATTEMPTS, \textcolor{comment}{/* uint16\_t: amount of attempts */}} \DoxyCodeLine{125 OSMO\_STREAM\_CLI\_PAR\_SCTP\_INIT\_TIMEOUT, \textcolor{comment}{/* uint16\_t: milliseconds */}} \DoxyCodeLine{126 \};} \DoxyCodeLine{127 } \DoxyCodeLine{128 \textcolor{keywordtype}{int} osmo\_stream\_cli\_set\_param(\textcolor{keyword}{struct} osmo\_stream\_cli *cli, \textcolor{keyword}{enum} osmo\_stream\_cli\_param par,} \DoxyCodeLine{129 \textcolor{keywordtype}{void} *val, \textcolor{keywordtype}{size\_t} val\_len);} \DoxyCodeLine{130 } \end{DoxyCode}