mirror of https://gerrit.osmocom.org/libosmocore
libosmocore: Deprecate APIs telnet_init(_dynip)()
Related: OS#5809 Change-Id: Ibd05d3bc2736256aa45e9e7ec15a98bd14a10454
This commit is contained in:
parent
179dec096f
commit
ee7b8c5273
|
@ -18,6 +18,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <osmocom/core/defs.h>
|
||||
#include <osmocom/core/logging.h>
|
||||
#include <osmocom/core/select.h>
|
||||
|
||||
|
@ -41,10 +42,13 @@ struct telnet_connection {
|
|||
struct log_target *dbg;
|
||||
};
|
||||
|
||||
int telnet_init(void *tall_ctx, void *priv, int port);
|
||||
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port);
|
||||
int telnet_init_default(void *tall_ctx, void *priv, int default_port);
|
||||
|
||||
int telnet_init(void *tall_ctx, void *priv, int port)
|
||||
OSMO_DEPRECATED("This function ignores dynamic port configuration. Use telnet_init_default() instead");
|
||||
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
||||
OSMO_DEPRECATED("This function ignores dynamic port configuration. Use telnet_init_default() instead");
|
||||
|
||||
void telnet_exit(void);
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* process in order to enable interactive command-line introspection,
|
||||
* interaction and configuration.
|
||||
*
|
||||
* You typically call \ref telnet_init or \ref telnet_init_dynif once
|
||||
* You typically call telnet_init_default once
|
||||
* from your application code to enable this.
|
||||
*/
|
||||
|
||||
|
@ -60,23 +60,8 @@ static struct osmo_fd server_socket = {
|
|||
.priv_nr = 0,
|
||||
};
|
||||
|
||||
/*! Initialize telnet based VTY interface listening to 127.0.0.1
|
||||
* \param[in] tall_ctx \ref talloc context
|
||||
* \param[in] priv private data to be passed to callback
|
||||
* \param[in] port TCP port number to bind to
|
||||
*/
|
||||
int telnet_init(void *tall_ctx, void *priv, int port)
|
||||
{
|
||||
return telnet_init_dynif(tall_ctx, priv, "127.0.0.1", port);
|
||||
}
|
||||
|
||||
/*! Initialize telnet based VTY interface
|
||||
* \param[in] tall_ctx \ref talloc context
|
||||
* \param[in] priv private data to be passed to callback
|
||||
* \param[in] ip IP to listen to ('::1' for localhost, '::0' for all, ...)
|
||||
* \param[in] port TCP port number to bind to
|
||||
*/
|
||||
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
||||
/* Helper for deprecating telnet_init_dynif(), which previously held this code */
|
||||
static int _telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
@ -104,6 +89,29 @@ int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Initialize telnet based VTY interface listening to 127.0.0.1
|
||||
* \param[in] tall_ctx \ref talloc context
|
||||
* \param[in] priv private data to be passed to callback
|
||||
* \param[in] port TCP port number to bind to
|
||||
* \deprecated use telnet_init_default() instead
|
||||
*/
|
||||
int telnet_init(void *tall_ctx, void *priv, int port)
|
||||
{
|
||||
return _telnet_init_dynif(tall_ctx, priv, "127.0.0.1", port);
|
||||
}
|
||||
|
||||
/*! Initialize telnet based VTY interface
|
||||
* \param[in] tall_ctx \ref talloc context
|
||||
* \param[in] priv private data to be passed to callback
|
||||
* \param[in] ip IP to listen to ('::1' for localhost, '::0' for all, ...)
|
||||
* \param[in] port TCP port number to bind to
|
||||
* \deprecated use telnet_init_default() instead
|
||||
*/
|
||||
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
||||
{
|
||||
return _telnet_init_dynif(tall_ctx, priv, ip, port);
|
||||
}
|
||||
|
||||
/*! Initializes telnet based VTY interface using the configured bind addr/port.
|
||||
* \param[in] tall_ctx \ref talloc context
|
||||
* \param[in] priv private data to be passed to callback
|
||||
|
@ -111,8 +119,8 @@ int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
|
|||
*/
|
||||
int telnet_init_default(void *tall_ctx, void *priv, int default_port)
|
||||
{
|
||||
return telnet_init_dynif(tall_ctx, priv, vty_get_bind_addr(),
|
||||
vty_get_bind_port(default_port));
|
||||
return _telnet_init_dynif(tall_ctx, priv, vty_get_bind_addr(),
|
||||
vty_get_bind_port(default_port));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue