summaryrefslogtreecommitdiffstats
path: root/include/osmocom/vty
Commit message (Collapse)AuthorAgeFilesLines
* logging vty: tweak general 'logging' command docNeels Hofmeyr2017-12-201-1/+1
| | | | | | 'logging' is not only for terminals, also for stderr and other log targets. Change-Id: If1ee59c7d1073502259b7d60008206ac3d8e87a3
* ports: define proper VTY and CTRL ports for OsmoHNBGWNeels Hofmeyr2017-12-201-0/+2
| | | | | | | | | So far it uses 2323, a development default. Instead, assign new ports, appending to the common range of VTY and CTRL ports: 4261 and 4262. Related: https://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers Related: I28bd7a97d24455f88fadc6724d45c3264ba2fce4 (osmo-gsm-manuals) Change-Id: Ife52a968a41cb286f640006587877971ff66c1a4
* ports.h: Use same VTY port number for osmo-mgw and osmo-bsc_mgcpHarald Welte2017-11-201-1/+1
| | | | | | | | It was decided that osmo-mgw as direct successor of osmo-bsc_mgcp will use the same VTY port number (similar to osmo-nitb, osmo-bsc and osmo-bsc-sccplite all using the same VTY port number) Change-Id: Iec1da9f3b4d170416279f05876d9e1ae2970c577
* vty: add port number for osmo-mgwPhilipp Maier2017-11-101-0/+1
| | | | Change-Id: Ied224fe94b5152fd19e259396fbc0eaf69be4b96
* vty: deprecate now empty node commandsNeels Hofmeyr2017-11-081-2/+2
| | | | | | | | | | | Following I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b a deprecation of vty_install_default() and install_default() commands is indicated. However, compiler warnings may clutter build output or even fail strict builds, hence I am submitting the deprecation in a separate patch. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: Icf5d83f641e838cebcccc635a043e94ba352abff
* vty: install 'exit', 'end',... commands on *all* nodesNeels Hofmeyr2017-09-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many callers of the VTY API, we are lacking the vty_install_default() step at certain node levels. This creates nodes that lack the 'exit' command, and hence the only way to exit such a node is to restart the telnet session. Historically, the VTY looked for missing commands on the immediate parent node, and hence possibly found the parent's 'exit' command when the local node was missing it. That is why we so far did not notice the missing default commands. Furthermore, some callers call install_default() instead of vty_install_default(). Only vty_install_default() also includes the 'exit' and 'end' commands. There is no reason why there are two sets of default commands. To end this confusion, to catch all missing 'exit' commands and to prevent this from re-appearing in the future, simply *always* install all default commands implicitly when calling install_node(). In cmd_init(), there are some top-level nodes that apparently do not want the default commands installed. Keep those the way they are, by changing the invocation to new install_node_bare() ({VIEW,AUTH,AUTH_ENABLE}_NODE). Make both install_default() and vty_install_default() no-ops so that users of the API may still call them without harm. Do not yet deprecate yet, which follows in Icf5d83f641e838cebcccc635a043e94ba352abff. Drop all invocations to these two functions found in libosmocore. Change-Id: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
* VTY: implement talloc context introspection commandVadim Yanitskiy2017-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a new command, which could be used to inspect the application's talloc context directly from VTY. To enable this feature, an application need to provide it's context via the 'vty_app_info' struct, and register the VTY command by calling the osmo_talloc_vty_add_cmds(). The new command is a sub-command of 'show': show talloc-context <context> <depth> [filter] Currently the following contexts may be inspected: - application - a context provided by an application; - null - all contexts, if NULL-context tracking is enabled. A report depth is defined by the next parameter, and could be: - full - full tree report, as the talloc_report_full() does; - brief - brief tree report, as the talloc_report() does; - DEPTH - user defined maximal report depth. Also, there are two optional report filters: - regexp - print only contexts, matching a regular expression; - tree - print a specific context, pointed by specified address. The command output is formatted the same way as in case of calling the talloc_report() or talloc_report_full(). Change-Id: I43fc42880b22294d83c565ae600ac65e4f38b30d
* vty: derive node name from prompt, use as XML idsNeels Hofmeyr2017-09-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'show online-help' produces XML output with <node id="..."> ids. We reference those from the osmo-gsm-manuals. Instead of numeric IDs coming from internal code, rather use a human-readable node ID -- referencing id='config-msc' is much easier than referencing id='23'. Add a char name[] to struct cmd_node, to hold this name. This may be provided upon struct definition. Since callers of the VTY API so far don't have a name yet, we would need to add names everywhere to get meaningful node IDs. There is a way to get node ID names without touching dependent code: My first idea was to find out which command entered the node, i.e. command 'msc' enters the MSC_NODE. But it is impossible to derive which command entered which node from data structs, it's hidden in the vty command definition. But in fact all (TM) known API callers indeed provide a prompt string that contains a logical and human readable string name. Thus, if the name is unset in the struct, parse the prompt string and strip all "weird" characters to obtain a node name from that. We can still set names later on, but for now will have meaningful node IDs (e.g. 'config-msc' from '%s(config-msc)# ') without touching any dependent code. When VTY nodes get identical node names, which is quite possible, the XML export de-dups these by appending _2, _3,... suffixes. The first occurence is called e.g. 'name', the second 'name_2', then 'name_3', and so forth. If a node has no name (even after parsing the prompt), it will be named merely by the suffix. The first empty node will become id='_1', then '_2', '_3', and so forth. This happens for nodes like VIEW_NODE or AUTH_NODE. If this is merged, we need to adjust the references in osmo-gsm-manuals.git. This can happen in our own time though, because we manually create the vty reference xml and copy it to the osmo-gsm-manuals.git and then update the references from the vty_additions.xml. This anyway has to happen because currently the references tend to be hopelessly out of sync anyway, placing comments at wildly unrelated VTY commands. Change-Id: I8fa555570268b231c5e01727c661da92fad265de
* VTY: implicit node exit by de-indenting, not parent lookupNeels Hofmeyr2017-09-192-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This will break users' config files if they do not use consistent indenting. (see below for a definition of "consistent".) When reading VTY commands from a file, use indenting as means to implicitly exit child nodes. Do not look for commands in the parent node implicitly. The VTY so far implies 'exit' commands if a VTY line cannot be parsed on the current node, but succeeds on the parent node. That is the mechanism by which our VTY config files do not need 'exit' at the end of each child node. We've hit problems with this in the following scenarios, which will show improved user experience after this patch: *) When both a parent and its child node have commands with identical names: cs7 instace 0 point-code 1.2.3 sccp-address osmo-msc point-code 0.0.1 If I put the parent's command below the child, it is still interpreted in the context of the child node: cs7 instace 0 sccp-address osmo-msc point-code 0.0.1 point-code 1.2.3 Though the indenting lets me assume I am setting the cs7 instance's global PC to 1.2.3, I'm actually overwriting osmo-msc's PC with 1.2.3 and discarding the 0.0.1. *) When a software change moves a VTY command from a child to a parent. Say 'timezone' moved from 'bts' to 'network' level: network timezone 1 2 Say a user still has an old config file with 'timezone' on the child level: network bts 0 timezone 1 2 trx 0 The user would expect an error message that 'timezone' is invalid on the 'bts' level. Instead, the VTY finds the parent node's 'timezone', steps out of 'bts' to the 'network' level, and instead says that the 'trx' command does not exist. Format: Consistent means that two adjacent indenting lines have the exact same indenting characters for the common length: Weird mix if you ask me, but correct and consistent: ROOT <space>PARENT <space><tab><space>CHILD <space><tab><space><tab><tab>GRANDCHILD <space><tab><space><tab><tab>GRANDCHILD2 <space>SIBLING Inconsistent: ROOT <space>PARENT <tab><space>CHILD <space><space><tab>GRANDCHILD <space><tab><tab>GRANDCHILD2 <tab>SIBLING Also, when going back to a parent level, the exact same indenting must be used as before in that node: Incorrect: ROOT <tab>PARENT <tab><tab><tab>CHILD <tab><tab>SIBLING As not really intended side effect, it is also permitted to indent the entire file starting from the root level. We could guard against it but there's no harm: Correct and consistent: <tab>ROOT <tab><tab>PARENT <tab><tab><tab><tab>CHILD <tab><tab>SIBLING Implementation: Track parent nodes state: whenever a command enters a child node, push a parent node onto an llist to remember the exact indentation characters used for that level. As soon as the first line on a child node is parsed, remember this new indentation (which must have a longer strlen() than its parent level) to apply to all remaining child siblings and grandchildren. If the amount of spaces that indent a following VTY command are less than this expected indentation, call vty_go_parent() until it matches up. At any level, if the common length of indentation characters mismatch, abort parsing in error. Transitions to child node are spread across VTY implementations and are hard to change. But transitions to the parent node are all handled by vty_go_parent(). By popping a parent from the list of parents in vty_go_parent(), we can also detect that a command has changed the node without changing the parent, hence it must have stepped into a child node, and we can push a parent frame. The behavior on the interactive telnet VTY remains unchanged. Change-Id: I24cbb3f6de111f2d31110c3c484c066f1153aac9
* ports.h: Add VTY port for GGSNHarald Welte2017-08-161-0/+2
| | | | Change-Id: I5bd49fbc19e88db96b4adbd56c82e7936059551c
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-239-15/+22
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-233-100/+100
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* vty: additional nodes for sccp-address configurationPhilipp Maier2017-06-211-2/+2
| | | | | | | | | | The planned sccp-addressbook implementation in libosmo-sccp requires two additional VTY nodes. See also in libosmo-sccp.git: Change-Id I068ed7f7d113dab88424a9d47bab7fc703bb7942 Change-Id: I42aa29c0cccc97f284b85801c5329b015b189640
* vty: cleanup logging functionsMax2017-05-091-1/+1
| | | | | | | | | | | | * remove unused parameter from logging_vty_add_cmds() * mark log level descriptors static * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * deprecate log_vty_command_*() from public API as it should only be used by logging_vty_add_cmds() Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Related: OS#71
* vty/command.h: Introduce VTY nodes for libosmo-sigtranHarald Welte2017-04-141-0/+8
| | | | | | | This adds several VTY nodes required by the libosmo-sigtran VTY interface. Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
* add VTY port number for osmo-stpHarald Welte2017-04-081-0/+1
| | | | Change-Id: I978e1b73aa8097a7db6318d78f9f93457e6ce2af
* ports.h: rename CSCN to MSCNeels Hofmeyr2017-02-241-1/+1
| | | | | | See OS#1958 Change-Id: I85aee0f8fdfc9c69d0ba9240988c633d3e707f2d
* comment: ports.h: more visibly remind to keep docs+wiki syncedNeels Hofmeyr2017-01-301-0/+1
| | | | | | | It is still too easy to forget syncing, so add another reminder at the end of the list. Change-Id: I95191906afa8e6ada31310d0e36de33e3fccf268
* vty/ports.h: reserve port 4258 for OsmoHLR VTYNeels Hofmeyr2017-01-281-0/+1
| | | | Change-Id: I08cb52d9399a27e6876e45da36f434708c4fddef
* fsm: Add VTY introspection of osmo_fsm and their instancesHarald Welte2017-01-071-0/+8
| | | | Change-Id: I89212e4f149f019099115a85bab353c04170df90
* fix GGSN Ctrl port to 4257Neels Hofmeyr2016-09-091-0/+1
| | | | | | | 4253 used to collide with the sysmobts-mgr VTY port. Note, openggsn does not actually have a Ctrl interface yet. Change-Id: If0fa0e606dabd5bc89907a56ef18cdbbbdedb4b7
* comment: */ports.h: link to wiki + manuals, indicate used portsNeels Hofmeyr2016-09-091-1/+7
| | | | Change-Id: I6a7bf04e589ccfaea98f20900a9bfe9dd4808dce
* add vty call show asciidoc: generate a documentation for countersAlexander Couzens2016-06-141-0/+2
| | | | | | | | | | | For each counter group a ascii doc table is generated containing all single counter with a reference to a section to add additional information to the counter Change-Id: Ia8af883167e5ee631059299b107ea83c8bbffdfb Reviewed-on: https://gerrit.osmocom.org/70 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Harald Welte <laforge@gnumonks.org>
* vty: Make a reservation for the osmo-sip-connectorHolger Hans Peter Freyther2016-03-311-0/+1
| | | | | The osmo-sip-connector is a new application and is a MNCC to SIP bridge. It is not implementing transcoding or RTP proxying at all.
* vty: add ctrl section for Control interface bind addressNeels Hofmeyr2016-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This may seem like overkill for a mere const char * config item, but it makes the Control interface VTY commands reusable in any main() scope (inspired by libosmo-abis' VTY config). Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or installed dependent on ENABLE_VTY. Using these functions allows configuring a static const char* with the VTY commands ctrl bind A.B.C.D which callers shall subsequently use to bind the Control interface to a specific local interface address, by passing the return value of ctrl_vty_get_bind_addr() to control_interface_setup(). Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment on avoiding ABI changes.
* vty: add bind command for telnet vty lineNeels Hofmeyr2016-02-251-0/+3
| | | | | | | | | | | | | | | | | | | | Add VTY command line vty bind A.B.C.D The command merely stores the configured IP-address, which can then be used by the calling main program to set the telnet port of the VTY line. (Commits in openbsc and osmo-iuh will follow up on this.) Add function vty_get_bind_addr() to publish the address in the vty.h API. Add static vty_bind_addr to store. For allocation/freeing reasons, a NULL address defaults to 127.0.0.1. BTW, I decided against allowing keywords 'any' and 'localhost' in place of an actual IP address to make sure a written config is always identical to the parsed config.
* Add CSCN ctrl port defsNeels Hofmeyr2016-02-151-0/+1
|
* add vty port nr for osmo-cscnNeels Hofmeyr2016-02-101-0/+1
|
* fix FSF address in sources/headersJaroslav Škarvada2015-11-123-6/+6
| | | | Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
* stats/vty: Add selective show stats commandJacob Erlbeck2015-08-221-0/+2
| | | | | | | | | | | | | | | | Currently there is only the 'show stats' command which shows all counter and stat_item values. This can lead to many lines of output if there are per-subscriber rate counters. The new command added by this commit allows it to only show groups of a certain level (class_id), similar to the 'level' configuration command for stats reporter. The new command is show stats level (global|peer|subscriber) Sponsored-by: On-Waves ehf
* gtphub: add OSMO_VTY_PORT_GTPHUB.Neels Hofmeyr2015-11-021-0/+1
| | | | | | This is for gtphub, being developed in openbsc.git. Sponsored-by: On-Waves ehi
* fix some typosNeels Hofmeyr2015-11-021-1/+1
| | | | Sponsored-by: On-Waves ehi
* vty: Add reserved nodes to enum node_typeJacob Erlbeck2015-11-021-0/+9
| | | | | | | | | | | | | Currently every time a node is added to enum node_type, this constitutes an ABI change, since _LAST_OSMOVTY_NODE will get incremented accordingly. In this case, every project that adds new node type based on that value will have to be recompiled. This commit adds 4 spare node type values, which can be replaced one-by-one by new real types until they are exhausted to avoid this kind of ABI change. Sponsored-by: On-Waves ehf
* stats: Add osmo_ name prefix to identifiersJacob Erlbeck2015-11-022-2/+2
| | | | | | | | | | Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
* stats/vty: Add stats configurationJacob Erlbeck2015-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This commit provides stats configuration similar to the log configuration. The following vty commands are added to the config node: stats reporter statsd Create/Modify a statsd reporter no stats reporter statsd Remove a statsd reporter To actually configure a reporter, the config-stats node is entered when the "stats reporter" command has succeeded. The following new vty commands are available there: local-ip ADDR Set the IP address to which we bind locally no local-ip Do not bind to a certain IP address remote-ip ADDR Set the remote IP address to which we connect remote-port <1-65535> Set the remote port to which we connect prefix PREFIX Set the item/counter name prefix no prefix Do not use a prefix enable Enable the reporter disable Disable the reporter Sponsored-by: On-Waves ehf
* stats/vty: Add stats_vty.cJacob Erlbeck2015-10-291-0/+3
| | | | | | | | | | | | | This file will contain the VTY code related to statistics. This commit adds a minimal file with just as single VTY command: - show stats This command shows all statistical values To enable this and future commands, the main program needs to call stats_vty_add_cmds(). Sponsored-by: On-Waves ehf
* stat/vty: Add vty_out_statistics_full to show all statisticsJacob Erlbeck2015-10-281-0/+2
| | | | | | | This functions shows the state of all osmo_counters, stat_item groups, and counter groups. Sponsored-by: On-Waves ehf
* stats: Add vty_out_stat_item_groupJacob Erlbeck2015-10-281-1/+5
| | | | | | This functions dumps a whole stat item group to the VTY. Sponsored-by: On-Waves ehf
* vty: Change API to have node installation be done by intHolger Hans Peter Freyther2015-08-052-6/+6
| | | | | | | | | | | | | | | | 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, ^~~~~~~~~
* vty: Check with the application before writing the configHolger Hans Peter Freyther2014-12-041-0/+2
| | | | | | | | | For the BSC/NITB application we see that people modify the band without modifying the ARFCN. This creates an unbootable config. Using the new hook the BSC/NITB can check if the config is consistent and prevent the config file being written. Related: SYS#739
* remove references to u_char type, use 'unsigned char' insteadHarald Welte2014-11-142-2/+2
| | | | ... u_char not being defined on Nuttx.
* add port number 4238 for BTS control interfaceHarald Welte2014-08-241-0/+1
|
* new <osmocom/vty/ports.h> file listing VTY tcp portsHarald Welte2014-08-211-0/+14
| | | | imported from http://openbsc.osmocom.org/trac/wiki/PortNumbers
* include: Switch to #pragma once patternSylvain Munaut2014-06-167-27/+7
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* vty: Make vty_event dispatch signals and use it in the testcaseHolger Hans Peter Freyther2013-10-101-0/+14
| | | | | | | | | The testcase didn't work on Ubuntu 12.04 because vty_create will directly call vty_event (e.g. not through the plt). This means that the approach to override vty_event in the testcase failed. Use the signal interface of libosmocore and make the testcase use it. The signals can be generally useful as well.
* vty: Add vty_install_default() and use for the vty nodesJacob Erlbeck2013-09-081-0/+5
| | | | | | | | | | | This adds the vty_install_default() function that is basically the install_default() function plus the registration of the commands 'exit' and 'end'. The latter is only provided in subnodes of ENABLED_NODE and CONFIG_NONE. The VTY test program is extended to check these commands. Ticket: OW#952
* logging: Make sure to install standard "end" command in VTY nodeHarald Welte2012-10-221-0/+1
| | | | | When you are in the config-log VTY node, you expect "end" to work like in any other sub-node of config.
*