diff options
Diffstat (limited to 'include/osmocom/vty')
-rw-r--r-- | include/osmocom/vty/Makefile.am | 17 | ||||
-rw-r--r-- | include/osmocom/vty/command.h | 19 | ||||
-rw-r--r-- | include/osmocom/vty/logging.h | 6 | ||||
-rw-r--r-- | include/osmocom/vty/misc.h | 14 | ||||
-rw-r--r-- | include/osmocom/vty/ports.h | 54 | ||||
-rw-r--r-- | include/osmocom/vty/telnet_interface.h | 12 | ||||
-rw-r--r-- | include/osmocom/vty/vector.h | 5 | ||||
-rw-r--r-- | include/osmocom/vty/vty.h | 20 |
8 files changed, 93 insertions, 54 deletions
diff --git a/include/osmocom/vty/Makefile.am b/include/osmocom/vty/Makefile.am new file mode 100644 index 00000000..adb05dcb --- /dev/null +++ b/include/osmocom/vty/Makefile.am @@ -0,0 +1,17 @@ +if ENABLE_VTY +osmovty_HEADERS = \ + buffer.h \ + command.h \ + logging.h \ + stats.h \ + misc.h \ + telnet_interface.h \ + vector.h \ + vty.h \ + ports.h \ + cpu_sched_vty.h \ + tdef_vty.h \ + $(NULL) +endif + +osmovtydir = $(includedir)/osmocom/vty diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index add57e22..61b58815 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -99,12 +99,21 @@ enum node_type { L_CS7_SCCPADDR_NODE, /*!< SS7 SCCP Address */ L_CS7_SCCPADDR_GT_NODE, /*!< SS7 SCCP Global Title */ - L_CPU_SCHED_NODE, /*!< CPU Sched related options node */ + L_CPU_SCHED_NODE, /*!< CPU Sched related options node */ + L_NS_BIND_NODE, /*!< NS bind node */ + L_NS_NSE_NODE, /*!< NS NSE node */ /* * When adding new nodes to the libosmocore project, these nodes can be * used to avoid ABI changes for unrelated projects. */ + RESERVED1_NODE, /*!< Reserved for later extensions */ + RESERVED2_NODE, /*!< Reserved for later extensions */ RESERVED3_NODE, /*!< Reserved for later extensions */ + RESERVED4_NODE, /*!< Reserved for later extensions */ + RESERVED5_NODE, /*!< Reserved for later extensions */ + RESERVED6_NODE, /*!< Reserved for later extensions */ + RESERVED7_NODE, /*!< Reserved for later extensions */ + RESERVED8_NODE, /*!< Reserved for later extensions */ _LAST_OSMOVTY_NODE }; @@ -433,8 +442,8 @@ char *argv_concat(const char **argv, int argc, int shift); vector cmd_make_strvec(const char *); int cmd_make_strvec2(const char *string, char **indent, vector *strvec_p); void cmd_free_strvec(vector); -vector cmd_describe_command(); -char **cmd_complete_command(); +vector cmd_describe_command(vector vline, struct vty *vty, int *status); +char **cmd_complete_command(vector vline, struct vty *vty, int *status); const char *cmd_prompt(enum node_type); int config_from_file(struct vty *, FILE *); enum node_type node_parent(enum node_type); @@ -448,7 +457,7 @@ extern struct cmd_element config_exit_cmd; extern struct cmd_element config_help_cmd; extern struct cmd_element config_list_cmd; extern struct cmd_element config_end_cmd; -char *host_config_file(); +const char *host_config_file(void); void host_config_set(const char *); char *osmo_asciidoc_escape(const char *inp); @@ -474,4 +483,6 @@ extern const struct value_string vty_ref_gen_mode_desc[]; int vty_dump_xml_ref_mode(FILE *stream, enum vty_ref_gen_mode mode); int vty_dump_xml_ref(FILE *stream) OSMO_DEPRECATED("Use vty_dump_xml_ref_mode() instead"); +int vty_cmd_range_match(const char *range, const char *str); + /*! @} */ diff --git a/include/osmocom/vty/logging.h b/include/osmocom/vty/logging.h index 90c8fa17..b3ce92c7 100644 --- a/include/osmocom/vty/logging.h +++ b/include/osmocom/vty/logging.h @@ -6,7 +6,13 @@ #define FILTER_STR "Filter log messages\n" struct log_info; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +/* note this undefined argument declaration is intentional. There used + * to be an argument until 2017 which we no longer need .*/ void logging_vty_add_cmds(); +#pragma GCC diagnostic pop void logging_vty_add_deprecated_subsys(void *ctx, const char *name); struct vty; struct log_target *osmo_log_vty2tgt(struct vty *vty); diff --git a/include/osmocom/vty/misc.h b/include/osmocom/vty/misc.h index 2ad96508..f031c4ab 100644 --- a/include/osmocom/vty/misc.h +++ b/include/osmocom/vty/misc.h @@ -14,21 +14,31 @@ char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals, void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg); +void vty_out_rate_ctr_group2(struct vty *vty, const char *prefix, + struct rate_ctr_group *ctrg, bool skip_zero); void vty_out_rate_ctr_group_fmt(struct vty *vty, const char *fmt, struct rate_ctr_group *ctrg); +void vty_out_rate_ctr_group_fmt2(struct vty *vty, const char *fmt, + struct rate_ctr_group *ctrg, bool skip_zero); + void vty_out_stat_item_group(struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg); +void vty_out_stat_item_group2(struct vty *vty, const char *prefix, + struct osmo_stat_item_group *statg, bool skip_zero); void vty_out_statistics_full(struct vty *vty, const char *prefix); -void vty_out_statistics_partial(struct vty *vty, const char *prefix, - int max_level); +void vty_out_statistics_full2(struct vty *vty, const char *prefix, bool skip_zero); +void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level); +void vty_out_statistics_partial2(struct vty *vty, const char *prefix, int max_level, bool skip_zero); struct osmo_fsm; struct osmo_fsm_inst; void vty_out_fsm(struct vty *vty, struct osmo_fsm *fsm); +void vty_out_fsm2(struct vty *vty, const char *prefix, struct osmo_fsm *fsm); void vty_out_fsm_inst(struct vty *vty, struct osmo_fsm_inst *fsmi); +void vty_out_fsm_inst2(struct vty *vty, const char *prefix, struct osmo_fsm_inst *fsmi); void osmo_fsm_vty_add_cmds(void); void osmo_talloc_vty_add_cmds(void); diff --git a/include/osmocom/vty/ports.h b/include/osmocom/vty/ports.h index b3550d15..bc001282 100644 --- a/include/osmocom/vty/ports.h +++ b/include/osmocom/vty/ports.h @@ -8,33 +8,43 @@ #pragma once +#define OSMO_VTY_PORT_PCAP_CLIENT 4227 +#define OSMO_VTY_PORT_PCAP_SERVER 4228 /* 4236 used by control interface */ -#define OSMO_VTY_PORT_TRX 4237 +#define OSMO_VTY_PORT_TRX 4237 /* 4238 used by osmo-bts control interface */ -#define OSMO_VTY_PORT_STP 4239 -#define OSMO_VTY_PORT_PCU 4240 /* also: osmo_pcap_client */ -#define OSMO_VTY_PORT_BTS 4241 /* also: osmo_pcap_server */ -#define OSMO_VTY_PORT_NITB_BSC 4242 -#define OSMO_VTY_PORT_BSC_MGCP 4243 -#define OSMO_VTY_PORT_MGW OSMO_VTY_PORT_BSC_MGCP -#define OSMO_VTY_PORT_BSC_NAT 4244 -#define OSMO_VTY_PORT_SGSN 4245 -#define OSMO_VTY_PORT_GBPROXY 4246 -#define OSMO_VTY_PORT_BB 4247 +#define OSMO_VTY_PORT_STP 4239 +#define OSMO_VTY_PORT_PCU 4240 +#define OSMO_VTY_PORT_BTS 4241 +#define OSMO_VTY_PORT_NITB_BSC 4242 +#define OSMO_VTY_PORT_BSC_MGCP 4243 +#define OSMO_VTY_PORT_MGW OSMO_VTY_PORT_BSC_MGCP +#define OSMO_VTY_PORT_BSC_NAT 4244 +#define OSMO_VTY_PORT_SGSN 4245 +#define OSMO_VTY_PORT_GBPROXY 4246 +#define OSMO_VTY_PORT_BB 4247 /* 4249-4251 used by control interface */ -#define OSMO_VTY_PORT_BTSMGR 4252 -#define OSMO_VTY_PORT_GTPHUB 4253 -#define OSMO_VTY_PORT_MSC 4254 +#define OSMO_VTY_PORT_BTSMGR 4252 +#define OSMO_VTY_PORT_GTPHUB 4253 +#define OSMO_VTY_PORT_MSC 4254 /* 4255 used by control interface */ -#define OSMO_VTY_PORT_MNCC_SIP 4256 +#define OSMO_VTY_PORT_MNCC_SIP 4256 /* 4257 used by control interface */ -#define OSMO_VTY_PORT_HLR 4258 +#define OSMO_VTY_PORT_HLR 4258 /* 4259 used by control interface */ -#define OSMO_VTY_PORT_GGSN 4260 -#define OSMO_VTY_PORT_HNBGW 4261 +#define OSMO_VTY_PORT_GGSN 4260 +#define OSMO_VTY_PORT_HNBGW 4261 /* 4262-4263 used by control interface */ -#define OSMO_VTY_PORT_CBC 4264 -#define OSMO_VTY_PORT_UECUPS 4268 -#define OSMO_VTY_PORT_E1D 4269 -#define OSMO_VTY_PORT_SMLC 4271 +#define OSMO_VTY_PORT_CBC 4264 +#define OSMO_VTY_PORT_UECUPS 4268 +#define OSMO_VTY_PORT_E1D 4269 +#define OSMO_VTY_PORT_ISDNTAP 4270 +#define OSMO_VTY_PORT_SMLC 4271 +/* 4272 used by control interface */ +#define OSMO_VTY_PORT_HNODEB 4273 +/* 4274 used by control interface */ +#define OSMO_VTY_PORT_UPF 4275 +/* 4276: OSMO_CTRL_PORT_UPF */ +#define OSMO_VTY_PORT_PFCP_TOOL 4277 +/* 4278: OSMO_CTRL_PORT_UPF */ /* When adding/changing port numbers, keep docs and wiki in sync. See above. */ diff --git a/include/osmocom/vty/telnet_interface.h b/include/osmocom/vty/telnet_interface.h index da7cf839..73b79df1 100644 --- a/include/osmocom/vty/telnet_interface.h +++ b/include/osmocom/vty/telnet_interface.h @@ -14,14 +14,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #pragma once +#include <osmocom/core/defs.h> #include <osmocom/core/logging.h> #include <osmocom/core/select.h> @@ -45,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); /*! @} */ diff --git a/include/osmocom/vty/vector.h b/include/osmocom/vty/vector.h index 0a639ad9..ac524bc3 100644 --- a/include/osmocom/vty/vector.h +++ b/include/osmocom/vty/vector.h @@ -14,11 +14,6 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ #pragma once diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index d34433fa..3a2ec6f6 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -3,6 +3,7 @@ #include <stdio.h> #include <stdarg.h> #include <stdbool.h> +#include <time.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/defs.h> @@ -55,20 +56,6 @@ enum vty_type { VTY_SHELL_SERV }; -struct vty_parent_node { - struct llist_head entry; - - /*! private data, specified by creator */ - void *priv; - - /*! Node status of this vty */ - int node; - - /*! When reading from a config file, these are the indenting characters expected for children of - * this VTY node. */ - char *indent; -}; - /*! Internal representation of a single VTY */ struct vty { /*! underlying file (if any) */ @@ -141,7 +128,7 @@ struct vty { #define TELNET_NAWS_SB_LEN 5 /*! sub-negotiation buffer */ unsigned char sb_buf[TELNET_NAWS_SB_LEN]; - /*! How many subnegotiation characters have we received? + /*! How many subnegotiation characters have we received? * * We just drop those that do not fit in the buffer. */ size_t sb_len; @@ -210,6 +197,7 @@ struct vty_app_info { /* Prototypes. */ void vty_init(struct vty_app_info *app_info); int vty_read_config_file(const char *file_name, void *priv); +int vty_read_config_filep(FILE *confp, void *priv); void vty_init_vtysh (void); void vty_reset (void); struct vty *vty_new (void); @@ -218,9 +206,11 @@ bool vty_is_active(struct vty *vty); int vty_out (struct vty *, const char *, ...) VTY_PRINTF_ATTRIBUTE(2, 3); int vty_out_va(struct vty *vty, const char *format, va_list ap); int vty_out_newline(struct vty *); +int vty_out_uptime(struct vty *vty, const struct timespec *starttime); int vty_read(struct vty *vty); //void vty_time_print (struct vty *, int); void vty_close (struct vty *); +void vty_flush(struct vty *vty); char *vty_get_cwd (void); void vty_log (const char *level, const char *proto, const char *fmt, va_list); int vty_config_lock (struct vty *); |