mirror of https://gerrit.osmocom.org/libosmocore
vty: Change API to have node installation be done by int
We are mixing enums and hope that no short-enums are used. This is leading to a lot compiler warnings generated by clang. Change the API to work with integers. Porting: The go_parent_cb implementations in the applications need to be fixed. The API change leads to a compile time warning. Fixes: abis_om2000_vty.c:46:2: warning: implicit conversion from enumeration type 'enum bsc_vty_node' to different enumeration type 'enum node_type' [-Wenum-conversion] OM2K_NODE, ^~~~~~~~~
This commit is contained in:
parent
c136da587f
commit
a9e5252128
|
@ -1 +1,2 @@
|
||||||
#library what description / commit summary line
|
#library what description / commit summary line
|
||||||
|
libosmovty abi-change vty: Change API to have node installation be done by int
|
||||||
|
|
|
@ -92,7 +92,7 @@ enum node_type {
|
||||||
* configuration function pointer . */
|
* configuration function pointer . */
|
||||||
struct cmd_node {
|
struct cmd_node {
|
||||||
/*! \brief Node index */
|
/*! \brief Node index */
|
||||||
enum node_type node;
|
int node;
|
||||||
|
|
||||||
/*! \brief Prompt character at vty interface. */
|
/*! \brief Prompt character at vty interface. */
|
||||||
const char *prompt;
|
const char *prompt;
|
||||||
|
@ -334,15 +334,15 @@ struct desc {
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void install_node(struct cmd_node *, int (*)(struct vty *));
|
void install_node(struct cmd_node *, int (*)(struct vty *));
|
||||||
void install_default(enum node_type);
|
void install_default(int node_type);
|
||||||
void install_element(enum node_type, struct cmd_element *);
|
void install_element(int node_type, struct cmd_element *);
|
||||||
void install_element_ve(struct cmd_element *cmd);
|
void install_element_ve(struct cmd_element *cmd);
|
||||||
void sort_node(void);
|
void sort_node(void);
|
||||||
|
|
||||||
/* This is similar to install_default() but it also creates
|
/* This is similar to install_default() but it also creates
|
||||||
* 'exit' and 'end' commands.
|
* 'exit' and 'end' commands.
|
||||||
*/
|
*/
|
||||||
void vty_install_default(enum node_type);
|
void vty_install_default(int node_type);
|
||||||
|
|
||||||
/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
|
/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
|
||||||
string with a space between each element (allocated using
|
string with a space between each element (allocated using
|
||||||
|
|
|
@ -156,7 +156,7 @@ struct vty_app_info {
|
||||||
/*! \brief \ref talloc context */
|
/*! \brief \ref talloc context */
|
||||||
void *tall_ctx;
|
void *tall_ctx;
|
||||||
/*! \brief call-back for returning to parent n ode */
|
/*! \brief call-back for returning to parent n ode */
|
||||||
enum node_type (*go_parent_cb)(struct vty *vty);
|
int (*go_parent_cb)(struct vty *vty);
|
||||||
/*! \brief call-back to determine if node is config node */
|
/*! \brief call-back to determine if node is config node */
|
||||||
int (*is_config_node)(struct vty *vty, int node);
|
int (*is_config_node)(struct vty *vty, int node);
|
||||||
/*! \brief Check if the config is consistent before write */
|
/*! \brief Check if the config is consistent before write */
|
||||||
|
@ -184,7 +184,7 @@ int vty_shell_serv (struct vty *);
|
||||||
void vty_hello (struct vty *);
|
void vty_hello (struct vty *);
|
||||||
void *vty_current_index(struct vty *);
|
void *vty_current_index(struct vty *);
|
||||||
int vty_current_node(struct vty *vty);
|
int vty_current_node(struct vty *vty);
|
||||||
enum node_type vty_go_parent(struct vty *vty);
|
int vty_go_parent(struct vty *vty);
|
||||||
|
|
||||||
extern void *tall_vty_ctx;
|
extern void *tall_vty_ctx;
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ static int vty_dump_nodes(struct vty *vty)
|
||||||
* \param[in] ntype Node Type
|
* \param[in] ntype Node Type
|
||||||
* \param[cmd] element to be installed
|
* \param[cmd] element to be installed
|
||||||
*/
|
*/
|
||||||
void install_element(enum node_type ntype, struct cmd_element *cmd)
|
void install_element(int ntype, struct cmd_element *cmd)
|
||||||
{
|
{
|
||||||
struct cmd_node *cnode;
|
struct cmd_node *cnode;
|
||||||
|
|
||||||
|
@ -1897,7 +1897,7 @@ char **cmd_complete_command(vector vline, struct vty *vty, int *status)
|
||||||
* Note also that this function relies on the is_config_child callback to
|
* Note also that this function relies on the is_config_child callback to
|
||||||
* recognize non-config nodes if go_parent_cb is not set.
|
* recognize non-config nodes if go_parent_cb is not set.
|
||||||
*/
|
*/
|
||||||
enum node_type vty_go_parent(struct vty *vty)
|
int vty_go_parent(struct vty *vty)
|
||||||
{
|
{
|
||||||
switch (vty->node) {
|
switch (vty->node) {
|
||||||
case AUTH_NODE:
|
case AUTH_NODE:
|
||||||
|
@ -3319,7 +3319,7 @@ void host_config_set(const char *filename)
|
||||||
host.config = talloc_strdup(tall_vty_cmd_ctx, filename);
|
host.config = talloc_strdup(tall_vty_cmd_ctx, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void install_default(enum node_type node)
|
void install_default(int node)
|
||||||
{
|
{
|
||||||
install_element(node, &config_help_cmd);
|
install_element(node, &config_help_cmd);
|
||||||
install_element(node, &config_list_cmd);
|
install_element(node, &config_list_cmd);
|
||||||
|
@ -3331,7 +3331,7 @@ void install_default(enum node_type node)
|
||||||
install_element(node, &show_running_config_cmd);
|
install_element(node, &show_running_config_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vty_install_default(enum node_type node)
|
void vty_install_default(int node)
|
||||||
{
|
{
|
||||||
install_default(node);
|
install_default(node);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue