summaryrefslogtreecommitdiffstats
path: root/include/osmocom/gprs/gprs_ns.h
Commit message (Collapse)AuthorAgeFilesLines
* Add _c versions of functions that otherwise return static buffersHarald Welte2019-04-101-0/+1
| | | | | | | | | | | | | | We have a habit of returning static buffers from some functions, particularly when generating some kind of string values. This is convenient in terms of memory management, but it comes at the expense of not being thread-safe, and not allowing for two calls of the related function within one printf() statement. Let's introduce _c suffix versions of those functions where the caller passes in a talloc context from which the output buffer shall be allocated. Change-Id: I8481c19b68ff67cfa22abb93c405ebcfcb0ab19b
* Add _buf() functions to bypass static string buffersHarald Welte2019-04-031-0/+2
| | | | | | | | | | | | | | | We have a number of static buffers in use in libosmo*. This means the related functions are not usable in a thread-safe way. While we so far don't have many multi-threaded programs in the osmocom universe, the static buffers also prevent us from calling the same e.g. string-ify function twice within a single printf() call. Let's make sure there's an alternative function in all those cases, where the user can pass in a caller-allocated buffer + size, and make the 'classic' function with the static buffer a wrapper around that _buf() variant. Change-Id: Ibf85f79e93244f53b2684ff6f1095c5b41203e05
* NS: Add support for GPRS NS IP Sub-Network-Service (SNS)Harald Welte2019-02-261-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* gprs_ns: Declare gprs_ns_tx_alive*() in header fileHarald Welte2019-02-191-0/+2
| | | | | | | The symbols for those functions were always exported, but we somehow didn't declare them in gprs_ns.h Change-Id: Ib073e9c93fcdf408b63000182e90aabce37f687e
* gprs_ns.h: Declare gprs_ns_cause_str() which already existed in c fileHarald Welte2018-07-221-0/+1
| | | | Change-Id: Ia95f0cc8d110f95814173bb5a1c11bd85d8cd533
* Add function gprs_nsvc_state_appendDaniel Willmann2018-06-141-0/+2
| | | | | | A common function to append the nsvc state from osmo-sgsn or osmo-gbproxy Change-Id: I7f0eaff7329ab98cad792d30b20ab053007aab85
* GPRS: constify NS printing routine parametersMax2017-10-241-1/+1
| | | | Change-Id: I549ab7c26ac1489e01f281594bafe44b0681dc83
* GPRS: clarify ip/frgre union useMax2017-10-241-0/+2
| | | | | | | | | * add comment about underlying assumption that structs in ip/frgre union members in gprs_nsvc struct have the same memory layout * remove such assumption from gprs_ns_ll_str() * use gprs_ns_ll_str() for NSE dump Change-Id: Idcb912b7b3f7460fd2b058e16650c0bde8f757ee
* GPRS: unify NS state printingMax2017-10-241-0/+4
| | | | | | | | | * introduce defines with NS state names * use them for vty and tests * expand test output to print complete NS state Change-Id: I69f8d536135ae76dbca623c2f1ffba625adcb1e9 Related: SYS#3610
* gb: optionally allow nsip packets only from a specific hostPhilipp Maier2017-10-241-0/+2
| | | | | | | | | | | | | | When listening for nsip connections is enabled, then every remote host may send packets. This is useful for an SGSN that serves multiple PCUs, but contraproductive for a PCU that awaits packets from a single SGSN. Add struct members remote_ip, and remote_port to struct gprs_ns_inst, when set, then the listening end uses connect() to ensure that only the expected host may send packets. Related: OS#2401 Change-Id: Ifeb201d9006eec275a46708007ff342cdfc14e45
* api doc: fix two doxygen group closing bracesNeels Hofmeyr2017-10-171-1/+1
| | | | Change-Id: I6c1f47d13c5b7a9cb2281de9f017df4f1ed88ba7
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-0/+2
| | | | | | | | | | | | | | | | | 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-231-16/+16
| | | | | | | | | | 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
* Add human-readable names for signal_nsMax2017-05-241-0/+2
| | | | | Change-Id: Id664355eb8305fb287e4dae0800fb20dc2f9b8cd Related: SYS#3610
* gprs: Increase NS_ALLOC_SIZE to 3kDaniel Willmann2016-09-231-1/+2
| | | | | | | | | 2k can be insufficient when responding with a STATUS message to a long LLC packet because the original message is included in the STATUS. Change-Id: I6f76751cfadf61e87ce4367a38907083e1c98562 Ticket: SYS#2967 Sponsored-by: On-Waves ehf
* stats: Add osmo_ name prefix to identifiersJacob Erlbeck2015-11-021-1/+1
| | | | | | | | | | 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]
* ns: Add statistics for some eventsJacob Erlbeck2015-10-281-0/+2
| | | | | | | | | | | | The following counters are added to the ns.nsvc counter group: lost.alive The number of missing ALIVE ACK messages lost.reset The number of missing RESET ACK messages The following items are added to the ns.nsvc stat item group: alive.delay The time in ms between sending ALIVE and receiving the next ALIVE ACK Sponsored-by: On-Waves ehf
* ns: Log when sending fails (Coverity)Jacob Erlbeck2015-04-071-6/+4
| | | | | | | | | | | | | | | | Currently the return value of the gprs_ns_tx family of functions is often ignored. This is not a serious issue, since the successful delivery of the messages is neither guaranteed nor acknowledged by the network layer anyway. Nevertheless this commit adds logging (level INFO) to gprs_ns_tx and gprs_ns_msgb_alloc. The definition of the latter has been moved from the header file to gprs_ns.c. Fixes: Coverity CID 1040678, 1040679, 1040680, 1040681, 1040682, 1040683, 1040684, 1040686, 1040687, 1040688, 1111545, 1240203, 1240204 Sponsored-by: On-Waves ehf
* gprs-ns: Let gprs_nsvc_reset return a valueJacob Erlbeck2014-10-091-1/+1
| | | | | | | | | | Currently gprs_nsvc_reset does not return any value. This patch changes the function to return an integer, where a value less than zero indicates an error. The value is taken from the gprs_ns_tx_reset function. In case of failure, an error message is logged. Sponsored-by: On-Waves ehf
* include: Switch to #pragma once patternSylvain Munaut2014-06-161-4/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gb: Fix NS RESET/RESET_ACK abnormal casesJacob Erlbeck2013-10-241-0/+5
| | | | | | | | | | | | | | | | This changes the implementations for the reception of RESET and RESET_ACK to be compatible with 3GPP TS 08.16, 7.3.1: - Just send a RESET_ACK with correct values back to the SGSN when a RESET with an invalid NSVCI or NSEI has been received. - Check RESET_ACK for matching NSEI and NSVCI. - Ignore unexpected RESET_ACKs. In addition, use RESET_ACK from a BSS to update the BSS source address based on the NSVCI to be tolerant with changing UDP source addresses/ports. Sponsored-by: On-Waves ehf
* gb: Fix gprs_ns_rx_reset to not create NS-VC duplicatesJacob Erlbeck2013-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Under special circumstances (see below) receiving a NS-RESET leads to duplicated NS-VC entries. This happens when the source port of a NS-VC changes to a new one that has already been used by another NS-VC. This patch changes gprs_ns_rx_reset() to check for this case and to use the existing NS-VC object. The NS-VC object that was associated with the source address before is detached from this source but kept in the NS-VC list so that it can be reattached when a correspondent NS-RESET is received later on. Meanwhile it will have a cleared link layer address which will not match a real link info. A new counter NS_CTR_REPLACED is incremented each time when the NS-VC object is replacing another one. A new signal S_NS_REPLACED is added which gets dispatched in this case, too. Another new counter NS_CTR_NSEI_CHG is incremented each time when the NSEI of a NS-VC object (with fixed NSVCI) changes. Ticket: OW#874 Sponsored-by: On-Waves ehf
* gb: Add functions to access the LL part of the NS-VC objectsJacob Erlbeck2013-10-151-1/+7
| | | | | | | | Adds the functions gprs_ns_ll_copy() and gprs_ns_ll_clear(). Renames gprs_ns_format_peer() to gprs_ns_ll_str(). All of these functions uniformly access the link layer part within the NS-VC objects. Sponsored-by: On-Waves ehf
* tests/gb: Show invoked signals in test outputJacob Erlbeck2013-10-111-0/+3
| | | | | | | Register an osmo signal handler to print a short notice about every SS_L_NS signal that is generated while processing the tests. Sponsored-by: On-Waves ehf
* gb: Separate nsvc creation from NS message processingJacob Erlbeck2013-10-081-0/+9
| | | | | | | | | | | | This patch refactors gprs_ns_rcvmsg() by moving the parts relevant to the NS messages into the new functions gprs_ns_vc_create() (nsvc object creation) and gprs_ns_process_msg() (main NS automaton). These do not contain code that directly depends on the link layer (they call other functions that still do). This reduces the gprs_ns_rcvmsg() function to calling these two functions and optionally setting up the link layer specific fields of the nsvc. Sponsored-by: On-Waves ehf
* libosmogb: Add function to close NS instance without destroying itHolger Hans Peter Freyther2013-07-061-1/+4
|
* gprs_ns: Allow to set the DSCP for the UDP socket.Holger Hans Peter Freyther2013-03-251-0/+1
| | | | Allow to tag the NS service with a custom DSCP.
* libosmogb: move files to proper location and fix buildHarald Welte2012-06-171-0/+189