Commit Graph

3025 Commits

Author SHA1 Message Date
Philipp Maier 3713af8655 gsm0808_utils: fix gsm48 multirate configuration generator
The function gsm0808_sc_cfg_from_gsm48_mr_cfg() takes an S15 to S0
bitmask and converts that bitmask into an AMR multirate configuration
struct.

Unfortunately the current implementation implements 3GPP TS 28.062,
Table 7.11.3.1.3-2 wrongly in some aspects. Lets fix this.

- Fix wrong interpretation of the bitpatterns
- 5,15K is invalid and must never be selected
- Make sure that no more than 4 rates are selected in the active set
- Extend unit-test

Change-Id: I6fd7f4073b84093742c322752f2fd878d1071e15
Related: SYS#4470
2019-03-11 09:08:31 +01:00
Neels Hofmeyr 3a5045302f add gsm0808_cell_id_from_cgi(), gsm0808_cell_id_to_cgi()
CGI to Cell ID: for example, for Paging, osmo-msc has a CGI for a subscriber
and needs to send out a Cell Identifier IE. Makes sense to add this conversion
here.

Cell ID to CGI: for a Layer 3 Complete, a subscriber sends the current cell in
the form of a Cell Identifier, which we store as a CGI, if necessary enriched
with the local PLMN.

Add enum with bitmask values to identify parts of a CGI, for the return value
of gsm0808_cell_id_to_cgi(). Can't use enum CELL_IDENT for that, because it
doesn't have a value for just a PLMN (and is not a bitmask).

Change-Id: Ib9af67b100c4583342a2103669732dab2e577b04
2019-03-08 05:25:07 +01:00
Neels Hofmeyr d4b79c8772 fsm: add osmo_fsm_inst_state_chg_keep_or_start_timer()
During FSM design for osmo-msc, I noticed that the current behavior that
keep_timer=true doesn't guarantee a running timer can make FSM design a bit
complex, especially when using osmo_tdef for timeout definitions.

A desirable keep_timer=true behavior is one that keeps the previous timer
running, but starts a timer if no timer is running yet.

The simplest example is: a given state repeatedly transitions back to itself,
but wants to set a timeout only on first entering, avoiding to restart the
timeout on re-entering.

Another example is a repeated transition between two or more states, where the
first time we enter this group a timeout should start, but it should not
restart from scratch on every transition.

When using osmo_tdef timeout definitions for this, so far separate meaningless
states have to be introduced that merely set a fixed timeout.

To simplify, add osmo_fsm_inst_state_chg_keep_or_start_timer(), and use this in
osmo_tdef_fsm_inst_state_chg() when both keep_timer == true *and* T != 0.

In tdef_test.ok, the changes show that on first entering state L, the previous
T=1 is now kept with a large remaining timeout. When entering state L from O,
where no timer was running, this time L's T123 is started.

Change-Id: Id647511a4b18e0c4de0e66fb1f35dc9adb9177db
2019-03-07 23:10:21 +01:00
Neels Hofmeyr 4ea698233a fix tdef_test.c: do call the function-to-test in all cases
Always call osmo_tdef_fsm_inst_state_chg(), also when no timeout is defined.

When there is no timeout defined for a state, tdef_test.c tries to be smart and
print different output. In that mess, I missed the fact that
osmo_tdef_fsm_inst_state_chg() isn't always called as it should. In the same
mess, the resulting state was never printed until the preceding patch, which
helped to hide this bug.

Change-Id: I1d953d99854422bff8eb32f051e9c6147bc836b6
2019-03-06 07:00:30 +01:00
Neels Hofmeyr 4f54c6c48d tdef_test: tweak output to prepare for a fix
- Always print the state after a state transition.
  This shows that actually state transitions are missing for states that have
  no timer defined. This is a bug in tdef_test.c, to be fixed subsequently.

- Instead of total time passed since start, print the individual fake time
  intervals. Omit initial useless zero fake time advance.

- Add two more state transitions, back out from and into a state that has no
  timeout set.

Change-Id: Icb31af96d37741e256ff07868f3d4f5c48cdda74
2019-03-06 06:59:47 +01:00
Neels Hofmeyr 5734bff3b0 represent negative T-timers as Osmocom-specific X-timers
fi->T values are int, i.e. can be negative. Do not log them as unsigned, but
define a distinct timer class "Xnnnn" for negative T values: i.e. for T == -1,
print "Timeout of X1" instead of "Timeout of T4294967295".

The negative T timer number space is useful to distinguish freely invented
timers from proper 3GPP defined T numbers. So far I was using numbers like
T993210 or T9999 for invented T, but X1, X2 etc. is a better solution. This way
we can make sure to not accidentally define an invented timer number that
actually collides with a proper 3GPP specified timer number that the author was
not aware of at the time of writing.

Add OSMO_T_FMT and OSMO_T_FMT_ARGS() macros as standardized timer number print
format. Use that in fsm.c, tdef_vty.c, and adjust vty tests accordingly.

Mention the two timer classes in various API docs and VTY online-docs.

Change-Id: I3a59457623da9309fbbda235fe18fadd1636bff6
2019-03-06 00:51:15 +01:00
Neels Hofmeyr 8aa691f30b api doc: tweak gsm0808_cell_id_matches_list() doc
Change-Id: Ide94558d1c31356483252b83e04b061b4ee4d3bf
2019-03-05 23:49:02 +00:00
Max a478590250 coding: check gsm0503_rach_*() results
Check return value of RACH encode/decode functions and fail test on
unexpected results.

Change-Id: I41bfa808e3c064a11152e7ce8ee77a01d38a0744
Related: OS#1854
2019-03-05 11:30:39 +01:00
Neels Hofmeyr 6d57c57276 fix api doc typo for osmo_plmn_name2()
Change-Id: Ic2652c7e4ffe1e707022168ac6c0da7c88ae7f45
2019-02-26 22:43:19 +00:00
Neels Hofmeyr 050f2d3259 log: fsm: allow logging the timeout on state change
Add a flag that adds timeout info to osmo_fsm_inst state change logging.

To not affect unit testing, make this an opt-in feature that is disabled by
default -- mostly because osmo_fsm_inst_state_chg_keep_timer() will produce
non-deterministic logging depending on timing (logs remaining time).

Unit tests that don't verify log output and those that use fake time may also
enable this feature. Do so in fsm_test.c.

The idea is that in due course we will add osmo_fsm_log_timeouts(true) calls to
all of our production applications' main() initialization.

Change-Id: I089b81021a1a4ada1205261470da032b82d57872
2019-02-26 20:57:58 +00:00
Harald Welte 047f3872f5 NS: Add support for GPRS NS IP Sub-Network-Service (SNS)
The NS implementation part of the Gb implementation libosmogb
so far implemented a rather classic dialect of Gb, with lots of
heritage to FR (Frame Relay) transports.  At least since Release 6
of the NS specification, there's an IP Sub-Network Service (SNS),
which
* permits for dynamic configuration of IP endpoints and their NS-VCs
* abandons the concept of a NSVCI on IP transport
* forbids the use of RESET/BLOCK/UNBLOCK procedures on IP transport

This commit introduces BSS-side IP-SNS support to libosmogb in a
minimally invasive way.  It adds a corresponding SNS FSM to each NS
instance, and implements the new SIZE/CONFIG/ADD/DELETE/CHANGE_WEIGHT
procedures very closely aligned with the spec.

In order to use the SNS flavor (rather than the classic one),
a BSS implementation should use gprs_ns_nsip_connect_sns() instead
of the existing gprs_ns_nsip_connect().

This implementation comes with a set of TTCN-3 tests in
PCU_Tests_RAW_SNS.ttcn, see Change-ID
I0fe3d4579960bab0494c294ec7ab8032feed4fb2 of osmo-ttcn3-hacks.git

Closes: OS#3372
Closes: OS#3617
Change-Id: I84786c3b43a8ae34ef3b3ba84b33c90042d234ea
2019-02-26 12:18:30 +01:00
Harald Welte 35042a2919 NS: Factor out gprs_nsvc_start_test() and use it
This function performs  sending a NS-ALIVE PDU and starting Tns-Test,
let's use it in all places where we used to do that.

As part of this, also fix a bug where the sendto() return value (number
of bytes sent) would actually propagate up all the way to
gprs_ns_rx_reset() return value, which in turn affects the test results
on stdout.

Change-Id: I4d303117f77fabb74bbb91887b9914a81c2a084a
2019-02-26 12:18:30 +01:00
Harald Welte 17a642d8ff gprs_ns: Add code for SNS-SIZE and SNS-CONFIG encoding
Modern NS specifications contain a SNS (Sub Network Service) for
negotiating IP/port/weight parameters of NS-over-IP links dynamically.

This patch adds message encoding routines for SNS-CONFIG, SNS-SIZE
and their respective acknowledgements.

Related: OS#3372
Change-Id: I5c47e1c3c10deb89a7470ee2c03adfc174accc93
2019-02-26 11:17:44 +00:00
Neels Hofmeyr 99273c7662 enlarge gsm0808 msgb headroom
It should be large enough to prepend a struct osmo_scu_prim to pass down an
SCCP stack (see libosmo-sccp). 264 should suffice, but pick the next larger
power-of-two instead.

In osmo-msc, I would like to prepend an osmo_prim to the msgb created by
gsm0808 API, but turns out the headroom is too small:

    msgb(0x61700001b660): Not enough headroom msgb_push (126 < 264)

Instead of always copying a msgb that has just that instant been created, it
makes more sense to allocate sufficient headroom in the first place.

Change-Id: I95729991eb49555f8bba60c5dc916131b03b6cf2
2019-02-26 10:34:33 +00:00
Max 5ec0cf5475 LCLS: add string dump helpers
Add functions to dump LCLS (without GCR) and GCR. Dumping entire struct
results in inconveniently long string hence the separate functions. Both
use talloc functions so they expect caller to take care of providing
proper allocation context and freeing memory.

Change-Id: Ic3609224c8f3282d667e75f68bc20327e36eb9e6
2019-02-26 09:16:38 +00:00
Harald Welte 79f9270939 GPRS: Doxygen documentation for 'struct libgb_msgb_cb'
Change-Id: I4144506feee74a8219bd3736087c30cc6323ec1d
2019-02-23 14:38:23 +01:00
Harald Welte 47cf21f74f NS: Add missing NS Cause strings
When I added the definitions for the IP-SNS in commit
f030b210e8 back in 2010, I forgot to update
the string definitions in ns_cause_str[].  Let's fix that

Change-Id: I419ccc482d99b01263a60aede83dacd2d9de56ab
2019-02-23 14:12:34 +01:00
Harald Welte dc802810df NS: Don't print information about FR/GRE if not enabled!
Change-Id: I9209ee4ba5ebfc4f96b4c1d42840e1906455bae7
2019-02-23 11:34:31 +01:00
Max 2e717c968d Add multipatch capability to osmo-config-merge
That's pretty straightforward and convenient extention: handle all
extra positional arguments as patch file names. This makes it similar to
'cp' and other coreutils basic tools. For example:
osmo-config-merge base.cfg patch1.cfg patch2.cfg patch3.cfg
will apply 3 patches to the base config file.

Change-Id: I212cbdc3bf6f251c1a3175737ac74242fb004c6d
2019-02-22 21:28:45 +00:00
Harald Welte 52a8375025 select: Call log_reset_context() before calling file descriptor callbacks
Make sure to clear any log context before processing the next incoming message
as part of some file descriptor callback.  This effectively prevents "context
leaking" from processing of one message into processing of the next message as part
of one iteration through the list of file descriptors here.

Change-Id: I3644c7bc1a9cec5858eb0faf94efc8c3ba7f5d8d
Closes: OS#3813
2019-02-21 16:38:49 +01:00
Harald Welte 9ef2e15dc1 gprs_ns: Add missing NSVCI IE to NS-BLOCK-ACK message
According to Section 9.2.4 of 3GPP TS 48.016, the NS-BLOCK-ACK PDU has a
mandatory NSVCI IE which we so far were missing.

Change-Id: Ie7205e99d57f1e42d941f1be2460d8c9f46aadfe
Closes: OS#3808
2019-02-19 23:45:10 +01:00
Harald Welte 7dd0f9ce39 gprs_ns: Declare gprs_ns_tx_alive*() in header file
The symbols for those functions were always exported, but we
somehow didn't declare them in gprs_ns.h

Change-Id: Ib073e9c93fcdf408b63000182e90aabce37f687e
2019-02-19 23:45:10 +01:00
Harald Welte 9612fcb955 gprs_ns.c: cosmetic whitespace fixes
Change-Id: Ic19f65bdc5527ad5a69d0a92320ce5f672bf4d2b
2019-02-19 23:45:10 +01:00
Harald Welte 4091f929a1 gprs_ns: Use gprs_ns_tx_alive() instead of gprs_ns_tx_simple()
If we use gprs_ns_tx_alive() we will get logging for free.

Change-Id: I53d410d13540d389096c40425e1fa2eb7460b16b
2019-02-19 23:45:10 +01:00
Harald Welte 6a469e13e3 bssgp_tx_bvc_unblock(): Fix log message
We're transmitting a BVC-UNBLOCK but the log states the opposite:
BVC-BLOCK.  Let's fix that.

Change-Id: I70fa7336402d193513f89fcf3068b0b21925702d
2019-02-19 12:29:14 +00:00
Pau Espin 10f07da804 rsl: Support PDCH in rsl_chan_nr_str
During log review lack of support  for PDCH was spotted:

scheduler.c:593 Configuring multiframe with PDCH trx=0 ts=4
rsl.c:1159 (bts=0,trx=0,ts=4,ss=0): chan_nr=UNKNOWN on TS4 type=0x00 mode=SIGNALLING
rsl.c:741 (bts=0,trx=0,ts=4,pchan=TCH/F_TCH/H_PDCH as PDCH) (ss=0) PDTCH Tx CHAN ACT ACK

Wireshark shows:
1100 0... = C-bits: PDCH (24)
.... .100 = Time slot number (TN): 4

Change-Id: If6ed96c9eb0431eb24e2135634def61e0ea506ea
2019-02-18 18:02:59 +01:00
Harald Welte cf665fc6bc gsm0808: Add unit tests for test_create_clear_command2()
Change-Id: Ie3f34b78edc91a013152742bebbd839586a787fe
Related: OS#3805
2019-02-18 13:34:02 +00:00
Harald Welte d1365e1a81 gsm0808: comment about difference of gsm0808_create_clear_command()
This single function has a quite different behavior than the other
gsm0808_ functions in terms of how the resulting msgb l3h
pointers are set.  Let's document that to avoid more confusion.

Change-Id: I0367760a588fc968c5a2dea46001ef1ee7965c8c
2019-02-18 13:34:02 +00:00
Harald Welte 10ba47dd37 Fix BSSMAP length generated by gsm0808_create_clear_command2()
In Change-Id Id8a75e1da2d5f520064666e4ee413d1c91da6ae3 we recently
introduced adding the "CSFB INDICATOR" IE to the CLEAR COMMAND,
but we did so with a wrong length value.

Change-Id: I4d07d25fb03ca0f89fd7b94226c54309c77a010a
Closes: OS#3805
Related: OS#2778
2019-02-18 13:11:03 +00:00
Neels Hofmeyr 2cbe25f484 add OSMO_STRBUF_PRINTF()
We are using macros like this or different workarounds in libmsc. In the course
of implementing inter-MSC handover, I am encountering yet another such
situation of appending multiple strings to a limited char buffer. Standardize.

Add a unit test to utils_test.c.

Change-Id: I2497514e26c5e7a5d88985fc7e58343be1a027b2
2019-02-17 20:40:17 +00:00
Sylvain Munaut 8667f7a815 gsm_08_08.h: Add constants for Channel Type in signalling mode
This is from TS 08.08 3.2.2.11 directly. The choices for Data mode
and Speech mode were already present, but not for Signalling mode

Change-Id: I9e24841ea877a9a78dc4d2bd14cbf60c4bea79a6
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-02-17 13:35:24 +00:00
Neels Hofmeyr ee91040cec fix osmo_gsm48_classmark* libosmogsm.map entries
When the initial patch was tweaked from osmo_classmark_* to
osmo_gsm48_classmark_* naming, the libosmogsm.map entries were forgotten to be
changed as well.

Change-Id: I53a41b5e965a529d3c146ee85102f7f1725c6014
2019-02-15 04:02:37 +01:00
Neels Hofmeyr a0331edcef get_value_string(): guard against NULL
get_value_string() conveniently prints the value number to a static buffer if
it is unknown in a value_string array. Do the same if the value_string array
pointer itself is NULL.

If a value string array is user supplied and might be NULL, one could add a
separate NULL check around it; but by making get_value_string() itself guard
against NULL, another static char buffer to print the value number is avoided.

Change-Id: Ie640e9258a959da8f4f9089478de993509853997
2019-02-15 03:01:54 +00:00
Max 450f5ac910 Enable remote SIM protocol log level
It's defined in logging.h for quite some time but is not actually
enabled alongside with other internal logging categories.

Change-Id: I0e7a2add6293a072752900608c8ba34cc3850f31
2019-02-14 19:19:57 +01:00
Vadim Yanitskiy 6b4895ff53 gsm/gsm0480: introduce gsm0480_create_release_complete()
In OsmoMSC, it's required to be able to specify a particular GSM 04.07
transaction ID for GSM 04.80 Release complete message instead of the
hard-coded value, that is used gsm0480_create_ussd_release_complete().

Let's finally deprecate gsm0480_create_ussd_release_complete(), and
introduce a new function without USSD prefix, as this message
is also used in other "structured" supplementary services.

Change-Id: Ie3ac85fcef90a5e532334ba3482804d5305c88d7
2019-02-08 08:31:42 +00:00
Sylvain Munaut ebaefceb82 protocol/gsm_04_14: Fix the OPEN LOOP message type
Change-Id: Id4350dee4353ebf9de0450dd5dab6e4f2ee7c3a6
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-02-07 09:16:22 +01:00
Neels Hofmeyr 7b740f72c3 platform independence fix: tdef range tests
Run INT_MAX and ULONG_MAX related tests only manually, remove from automatic
testing. This will hopefully fix recent build failures on various platforms.

Add a 64 bit output example for expected results when invoking
`./tdef_test range'. This is not checked automatically and merely serves for
manual reference.

For vty tests, use 32bit max values instead of INT_MAX and ULONG_MAX.

Change-Id: I6242243bde1d7ddebb858512a1f0b07f4ec3e5c2
2019-02-06 01:05:37 +00:00
Philipp Maier 74c4c4e91a gsm0808: Add CSFB indication IE to BSSMAP CLEAR COMMAND
When a call that was established in a CSFB context ends the CLEAR
COMMAND that is send from the BSC to the MSC should contain a CSFB
indication IE, which consists of just the IE byte itsslef. This
additional IE tells the BSC to include other CSFB related IEs into the
RR Release message.

Change-Id: Id8a75e1da2d5f520064666e4ee413d1c91da6ae3
Related: OS#3778
2019-02-05 15:11:36 +00:00
Harald Welte b0708d3e76 bitvec: Add bitvec_tailroom_bits() function
This is similar to msgb_tailroom(): It returns the amount of space
left at the end of the bit vector (compared to the current cursor).

The function returns the number of bits left in the bitvec.

Change-Id: I8980a6b6d1973b67a2d9ad411c878d956fb428d1
2019-02-05 11:16:44 +01:00
Harald Welte ae7966d145 bitvec: Add bitvec_bytes_used() function
This new bitvec API function returns the number of bytes used in a given
bit-vector.

Change-Id: Id4bd7f7543f5b0f4f6f876e283bd065039c37646
2019-02-05 09:24:17 +00:00
Harald Welte 71806ddb29 gsm_08_08.h: Add IEI definitions from Release 15
Change-Id: If3649606ba7c25121e30ed02939ca08c94665be5
2019-02-05 09:24:17 +00:00
Harald Welte cf2caeb4d4 Extend gsm_04_08.h with CSFB related definitiosn form 44.018 Rel 15
These are some IEI definitions that we'll need for CSFB Fast Return

Change-Id: I0e101af316438b56d63d43fc2cb16d7caf563d07
2019-02-05 09:24:17 +00:00
Neels Hofmeyr 0fd615fd7b add osmo_tdef API, originally adopted from osmo-bsc T_def
Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more
consistent. Upgrade to first class API:
- add timer grouping
- add generic vty support
- add mising API doc
- add C test
- add VTY transcript tests, also as examples for using the API

From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API.

The root reason for moving to libosmocore is that I want to use the
mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the
FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the
mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API
in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible
place for this.

osmo_tdef provides:

- a list of Tnnnn (GSM) timers with description, unit and default value.
- vty UI to allow users to configure non-default timeouts.
- API to tie T timers to osmo_fsm states and set them on state transitions.

- a few standard units (minute, second, millisecond) as well as a custom unit
  (which relies on the timer's human readable description to indicate the
  meaning of the value).
- conversion for standard units: for example, some GSM timers are defined in
  minutes, while our FSM definitions need timeouts in seconds. Conversion is
  for convenience only and can be easily avoided via the custom unit.

By keeping separate osmo_tdef arrays, several groups of timers can be kept
separately. The VTY tests in tests/tdef/ showcase different schemes:

- tests/vty/tdef_vty_test_config_root.c:
  Keep several timer definitions in separately named groups: showcase the
  osmo_tdef_vty_groups*() API. Each timer group exists exactly once.

- tests/vty/tdef_vty_test_config_subnode.c:
  Keep a single list of timers without separate grouping.
  Put this list on a specific subnode below the CONFIG_NODE.
  There could be several separate subnodes with timers like this, i.e.
  continuing from this example, sets timers could be separated by placing
  timers in specific config subnodes instead of using the global group name.

- tests/vty/tdef_vty_test_dynamic.c:
  Dynamically allocate timer definitions per each new created object.
  Thus there can be an arbitrary number of independent timer definitions, one
  per allocated object.

T_def was introduced during the recent osmo-bsc refactoring for inter-BSC
handover, and has proven useful:

- without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be
  programmed with the right timeout value, for all code paths that invoke this
  state change. It is a likely source of errors to get one of them wrong.  By
  defining a T timer exactly for an FSM state, the caller can merely invoke the
  state change and trust on the original state definition to apply the correct
  timeout.

- it is helpful to have a standardized config file UI to provide user
  configurable timeouts, instead of inventing new VTY commands for each
  separate application of T timer numbers.

Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5
2019-02-04 18:52:16 +01:00
Neels Hofmeyr 44c15b7a8f doxygen: allow manual 'make apidoc' even if --disable-doxygen
Even if ./configure --disable-doxygen was passed and doxygen builds are by
default skipped, provide a manual 'make apidoc' target that nevertheless
generates the API doc on the premise that a 'doxygen' program is available.

Especially since we do a two-pass doxygen build whenever any source file
changes, my guess is --disable-doxygen could be a common choice. It is then
cumbersome to have to ./configure just to get one doxygen build started.

Change-Id: If8d8dfb8365c8f28612b8ce2b8ddf88f74df9a90
2019-02-04 16:43:57 +00:00
Neels Hofmeyr 375bf6dcc5 doxygen: add source files as dependencies
So far, when modifying a source file, the doxygen docs were not regenerated
automatically. It required a manual 'rm -rf docs/core' or similar. Make it
rebuild automatically:

Add each library's source files to the list of dependencies for the first-pass
doxygen build.

Attention, since all libraries depend on the .map files of each other library,
and each library depends on its own source files, that means that a single
touch on one .c file anywhere will result in rebuilding the entire doxygen
docs. It is correct to do so, since any file may introduce \ref targets used
anywhere else. If you don't want that, --disable-doxygen.

Change-Id: I15ea96be6e7abe91264b91f0b06963a0f2d63b0b
2019-02-04 16:43:57 +00:00
Neels Hofmeyr 2fe50ac951 doxygen: enable cross referencing everywhere
doxygen \ref cross-references to groups or files from other libraries only work
when the .map file was present when the HTML was generated, and when that .map
file was listed in TAGFILES in the Doxyfile.

- Makefile.am: introduce a two-pass build for doxygen API docs.
  - First build pass makes sure the .tag files are present.
  - Second build pass picks up all the references, hence generates hyperlinks
    properly.
- Add all libraries to TAGFILES of all other libraries, so we can from now on
  freely criss-cross reference from everywhere to everywhere.
- Add all libraries' tag files as dependencies for all others.

Example: in upcoming tdef.h, I would like to cross reference to tdef_vty.h, and
vice versa, even though they are in libosmocore and libosmovty, respectively.
This is now possible.

We may still need to fix some problems with naming collisions, see for example
stats.h, which exists twice with identical doxygen handle (different source
dirs seems to not suffice for doxygen).

Change-Id: Ib03d0b70d536c8f1386def666c89106a840f7363
2019-02-04 16:43:57 +00:00
Neels Hofmeyr c1aa178c8b vty api: add vty_out_va()
Provide a va_list type vty_out() variant, to be able to pass on variable
arguments from other function signatures to vty_out().

This will be used by Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 for osmo_tdef.

Change-Id: Ie6e6f11a6b794f3cb686350c1ed678e4d5bbbb75
2019-02-04 16:43:57 +00:00
Neels Hofmeyr 8d04f95d96 vty telnet: consistently never change nodes upon CTRL-C
Remove any special node exiting from the VTY CTRL-C handling.

From a curious VTY transcript test glitch, I noticed weird behavior by the VTY
telnet shell: usually, when the user hits CTRL-C, that means to cancel the
current command line and present a fresh, clean prompt. However, only on the
CONFIG_NODE and CFG_LOG_NODE, a CTRL-C also exits the current node and moves up
by one level. This behavior is unexplainable and makes zero sense.

No other nodes exit on CTRL-C:
- on the ENABLE node, a CTRL-C stays on the ENABLE_NODE and doesn't exit to the
  VIEW_NODE.
- any sub-nodes of the CONFIG_NODE stay unchanged, e.g. 'network' or 'bts' /
  'trx', etc.

There is no apparent special meaning of CTRL-C on CONFIG_NODE nor CFG_LOG_NODE
to justify this odd choice.

Particularly, the vty transcript tests using osmo_verify_transcript_vty.py rely
on sending CTRL-C to clear the command prompt, so that we can properly test
sending '?' to the VTY during transcripts. In a live session, a '?' prints
available options and then updates the prompt with identical command arguments.
In a transcript test, that doesn't make sense, because each time the transcript
writes out a new command to run. Consider e.g. a transcript test like:

	tdef_vty_test(config)# timer ?
	  tea       Tea time
	  test      Test timers
	  software  Typical software development cycle

	tdef_vty_test(config)# timer tea ?
	  [TNNNN]  T-number, optionally preceded by 't' or 'T'.

To be able to issue a fresh command after '?', osmo_verify_transcript_vty.py
explicitly sends a CTRL-C to clear the command buffer. Hence there we rely on
predictable behavior of CTRL-C.

More particularly, the upcoming osmo_tdef_vty transcript tests are apparently
the first that want to test '?' behavior on the CONFIG_NODE's root level and
fall on their face, because of the implicit exit that happens only there.

Change-Id: I4f339ba61f1c273fa7da85caf77ba116ae2697b1
2019-02-04 16:43:57 +00:00
Neels Hofmeyr 9ea9dd0d5f vty: enable tab-completion for optional-multi-choice args
In cmd_complete_command_real(), detect and strip square braces from
multi-choice arguments, to enable tab-completion for commands like

 > list
 cmd [(alpha|beta)]
 > cmd <TAB>
 alpha beta
 > cmd be<TAB>
 > cmd beta

Change-Id: I8c304300b3633bb6e9b3457fcfa42121c8272ac0
2019-02-04 16:43:57 +00:00
Neels Hofmeyr b55f4d2df2 vty: enable optional-multi-choice syntax: [(one|two)]
Since very recently we sensibly handle commands like

  cmd ([one]|[two]|[three])

as optional multi-choice arguments. In addition, support the more obvious
syntax of

  cmd [(one|two|three)]

Internally, the tokens are mangled to [one] [two] and [three], which is how the
rest of the code detects optional args, and makes sense in terms of UI:

  > cmd ?
  [one]
  [two]
  [three]

(i.e. optional arguments are always shown in braces in '?' listings)

Before this patch, commands defined with a syntax like [(one|two)], would lead
to an assertion (shows as "multiple") during program startup.

Change-Id: I952b3c00f97e2447f2308b0ec6f5f1714692b5b2
2019-02-04 16:43:57 +00:00