summaryrefslogtreecommitdiffstats
path: root/include/osmocom/gprs
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-262-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add code for SNS-SIZE and SNS-CONFIG encodingHarald Welte2019-02-261-0/+9
| | | | | | | | | | | 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
* GPRS: Doxygen documentation for 'struct libgb_msgb_cb'Harald Welte2019-02-231-4/+4
| | | | Change-Id: I4144506feee74a8219bd3736087c30cc6323ec1d
* 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
* port rest octets encoding code from osmo-bscStefan Sperling2019-01-121-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | As part of fixing issue OS#3075, we want to migrate support for encoding system information from osmo-bsc to libosmocore. This change ports osmo-bsc code for encoding SI rest octets. The conversion was a bit tricky in some places because some functions receive a 'struct gsm_bts' parameter in osmo-bsc. In this libosmocore version, such functions expect parameters which correspond to the individual fields of 'struct gsm_bts' which are used by these functions. Several structs from osmo-bsc's system_information.h are now also declared in libosmocore headers, with an added osmo_ prefix to avoid collisions with existing definitions in osmo-bsc. Some helpers were ported from osmo-bsc's system_information.c to libosmocore's gsm48_rest_octets.c. Contrary to osmo-bsc's implementation they are now only visible within this file. Unfortunately, this code ported from osmo-bsc lacks unit tests. Change-Id: I47888965ab11bba1186c21987f1365c9270abeab Related: OS#3075
* add/clean big-endian packed structs (struct_endianess.py)Neels Hofmeyr2018-12-191-0/+105
| | | | | | | | | | | | | | This is 1:1 the result of doing cd libosmocore ./contrib/struct_endianess.py git commit -a Running struct_endianess.py again should result in no changes. That means we could include such a check in the gerrit verification job now. Change-Id: Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2
* bssgp: introduce flush queue functionsAlexander Couzens2018-08-101-0/+3
| | | | | | | | | | | | To reset the state of BSSGP allow to flush the BSSGP queues. When testing (with TTCN3) the test object should be resetted between each test. Introduce the functions: bssgp_fc_flush_queue() - flushs a single flow control object bssgp_flush_all_queues() - flushs queues of all BSSGP connections Change-Id: I29b6ad6742ddf9b0b58b4af37d9a1cf18e019325
* 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
* Add function to properly encode RAIMax2018-01-081-0/+1
| | | | | | | | | | | | | Add gsm48_encode_ra() which takes appropriate struct as [out] parameter instead of generic buffer. Using uint8_t buffer instead of proper struct type prooved to be error-prone - see Coverity CID57877, CID57876. Old gsm48_construct_ra() is made into tiny wrapper around new function. The test output is adjusted because of the change in function return value which was constant and hence ignored anyway. Related: OS#1640 Change-Id: I31f9605277f4945f207c2c44ff82e62399f8db74
* 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
* Add osmo_gprs_{ul,dl}_block_size_{bits,bytes} functionsHarald Welte2017-08-091-0/+25
| | | | | | Those functions can be used to look up the size of (E)GPRS blocks. Change-Id: I05ff75ef7dfae639886bbd09fe35f03a8af9d988
* BSSGP: add function to reset all PTP BVCMax2017-07-281-1/+1
| | | | | Change-Id: I9bf8f4dd784ccddbb9926492a85fff3293a0e913 Related: OS#1638
* Add missing BSSGP cause valuesMax2017-07-011-20/+57
| | | | | | Add values from 3GPP TS 48.018 Change-Id: Ie39a6c91a46d179392d861805a106743a07c6fb0
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-239-17/+29
| | | | | | | | | | | | | | | | | 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-235-33/+33
| | | | | | | | | | 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: add value strings for NS PDU typeMax2017-05-091-0/+2
| | | | | | | | Add value strings for Service Control PDUs according to 3GPP TS 48.016 ยง9 and use them for logging. Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | It is too easy for calling code to use the same filter and context indexes for different filters and structs. For example, openbsc's IMSI filter and libgb's GPRS_BVC filter both fall on index 1 even though there are plenty more indexes to choose from. To alleviate this, have one central definition here, sort of like ports.h does for VTY and CTRL port numbers. Add static asserts to make sure the indexes fit in the available array and bit mask space. Calling code like openbsc.git and osmo-pcu need adjustments and/or should move to using these enum values instead of their local definitions. Taking this opportunity to also prepare for a split of struct gsm_subscriber in openbsc into bsc_subsciber and vlr_subscriber with appropriate separate filter index constants for both subscriber types. Include previous LOG_FILTER_ALL in the LOGGING_FILTER_* enum, and replace its use by (1 << LOGGING_FILTER_ALL). Change-Id: I5c343630020f4b108099696fd96c2111614c8067
* 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
* egprs: Add CPS tables from TS 04.60Tom Tsou2016-07-251-0/+27
| | | | | | | | Includes EGPRS coding and puncturing scheme (CPS) tables from 3GPP TS 04.60. Currently osmo-bts-trx is the only user of CPS table values, but this may change with gprsdecode and other utilities. Change-Id: I09fe6514a0e2e51bb3206f8387633f7e0255345f
* Add EGPRS RLC/MAC headers from 3GPP TS 04.60Tom Tsou2016-07-121-0/+208
| | | | | | For shared use by osmo-pcu and osmo-bts-trx. Change-Id: I500cdc87cd30faf36c8cd92d234642f809c8f2aa
* Add helper function to convert numerical BSSGP PDU type to stringMax2016-03-111-0/+1
|
* gb: Add bssgp_msgb_copy functionJacob Erlbeck2016-02-221-0/+1
| | | | | | | | | | | | | | This function originates from openbsc/src/gprs but is just specific to BSSGP/Gb on the same level like bssgp_msgb_alloc. This commit puts the former gprs_msgb_copy function beside bssgp_msgb_alloc. Renamed function: gprs_msgb_copy -> bssgp_msgb_copy 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
* bssgp: Fix bssgp_tx_fc_bvc parameter typeJacob Erlbeck2015-05-061-1/+1
| | | | | | | | | | | | Currently large values for Bmax default MS get sliced since a uint16_t is used as the type of the corresponding parameter of bssgp_tx_fc_bvc. GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum of 6MB (0xffff * 100). This commit changes the type to uint32_t to cover the full value range. 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
* bssgp: Handle BSSGP STATUS messagesJacob Erlbeck2015-03-181-0/+2
| | | | | | | | | | | | | | | | | | | Currently incoming BSSGP STATUS messages are just logged and no other action is taken. This makes it impossible for higher layers to react to failures which are indicated by corresponding STATUS messages unless a timeout is triggered as a result of that failure later on. This commit adds a bssgp_rx_status() function and calls it on incoming STATUS messages. That function logs a message, increments the new BSSGP_CTR_STATUS counter if the bctx context exists and invokes an NM_STATUS status indication. The latter will allow the application to handle failures immediately. Since all STATUS messages should be handled, the function is already called in bssgp_rcvmsg and the message is no longer handled in (and will not reach) bssgp_rx_sign and bssgp_rx_ptp. Ticket: OW#1414 Sponsored-by: On-Waves ehf
* Change license of libosmogb from AGPLv3+ to GPLv2+Harald Welte2014-10-261-4/+4
| | | | | | | | | | | The copyright holders Harald Welte, Holger Freyther, Andreas Eversberg and sysmocom - s.f.m.c. GmbH (represented by Holger and Harald) agree that the license of libosmogb should be GPLv2+ and not AGPLv3+. The reason the source files stated AGPLv3+ is due to the history, as they were moved from OpenBSC to libosmocore at the time we needed to use them from osmo-pcu. It was an oversight back then to not re-license them accordingly.
* 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-167-26/+7
| | | | 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
* msgb: Add may_alias attribute to struct libgb_msgb_cbJacob Erlbeck2013-10-081-1/+1
| | | | | | | | | | This explicitely allows aliasing of this struct to avoid the warning shown below. Note, that this warning isn't show when '-fno-strict-aliasing' is used. Addresses: gb/gprs_ns_test.c:85:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
* 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.
* Fix: Correcting bssgp_tx_fc_bvc, bssgp_tx_fc_ms, bssgp_tx_ul_udAndreas Eversberg2012-09-301-2/+2
|
* Gb: Add functions for sending flow control messages from BSS sideHarald Welte2012-09-101-0/+8
|
* Gb: Add header file for BSS-side BSSGP functionsHarald Welte2012-09-101-0/+67
| | | | .. not sure how we could have missed that so far.
* BSSGP: make bvc_ctx->fc a dynamic talloc allocationHarald Welte2012-09-071-1/+1
| | | | | this ensures that we can talloc the flow-control queue entries as siblings off the bvc_ctx.