diff options
-rw-r--r-- | include/osmocom/netif/stream.h | 1 | ||||
-rw-r--r-- | src/stream.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index f1c160c..3427df5 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -67,6 +67,7 @@ void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int (*connect_c void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int (*disconnect_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int (*read_cb)(struct osmo_stream_cli *cli)); void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli); +bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli); struct osmo_stream_cli *osmo_stream_cli_create(void *ctx); void osmo_stream_cli_destroy(struct osmo_stream_cli *cli); diff --git a/src/stream.c b/src/stream.c index 3d0b665..74fe8b6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -184,6 +184,14 @@ void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli) cli->state = STREAM_CLI_STATE_CONNECTING; } +/*! \brief Check if Osmocom Stream Client is in connected state + * \param[in] cli Osmocom Stream Client + */ +bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli) +{ + return cli->state == STREAM_CLI_STATE_CONNECTED; +} + /*! \brief Close an Osmocom Stream Client * \param[in] cli Osmocom Stream Client to be closed * We unregister the socket fd from the osmocom select() loop |