path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2020-12-09logging: Introduce DLBSSGP logging constantHarald Welte2-2/+3
Historically, BSSGP uses a non-constant, user-configurable integer varieable for the logging sub-system. Let's replace this with a statically-allocated library logging constant. This is required if we want to use the subsystem number in e.g. static initialized for osmo_fsm.log_subsys. Change-Id: I506190aae9217c0956e4b5764d1a0c0772268e93
2020-12-08tlv.h: Add msgb_tvlv_put_{16,32}be()Harald Welte1-0/+15
Those routines are very useful when puzzling together BSSGP messages with 16-bit and 32bit sized IEs. Change-Id: I033f9a708c9d7ffad91336178231dc66233e1693
2020-12-08gsm_08_18.h: Add #defines for [extended] feature bitsHarald Welte1-0/+20
Change-Id: I7743cb901988c8fddd91127cfdca6e54b3d44ea8
2020-12-08bssgp: Add osmo_tlv_prot_def for BSSGPHarald Welte1-1/+14
Change-Id: I7e4226463f3c935134b5c2c737696fbfd1dd5815
2020-12-08tlv: Introduce enum with error codes for TLV parser functionsHarald Welte1-0/+10
Change-Id: I0b352792089c5c0c714712d2ea237beb92e1d73f
2020-12-08Introduce 'osmo_tlv_prot' abstraction for validation of TLV protocolsHarald Welte1-0/+50
This extends our existing TLV parser with the ability to * validate that mandatory IEs of a given message are present * validate that all present IEs are of required minimum length Introducing this generic layer will help us to reduce open-coded imperative verification across virtually all the protocols we implement, as well as add validation to those protocols where we don't properly perform related input validation yet. Change-Id: If1e1d9adfa141ca86001dbd62a6a339f9bf9a912
2020-12-07Include mnl.h iif --enable-libmnlPau Espin Pedrol1-1/+4
Change-Id: I06016e3a6e90b09b76634a00081d0d40a8e2f94b
2020-12-06log2.h: Avoid redefining __always_inlineHarald Welte1-3/+2
/build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:10:0: error: "__always_inline" redefined [-Werror] #define __always_inline inline __attribute__((always_inline)) /usr/include/x86_64-linux-gnu/sys/cdefs.h:311:0: note: this is the location of the previous definition # define __always_inline __inline __attribute__ ((__always_inline__)) Change-Id: I738d2a72f835a29e30b8ba20456e5c4c9aa844c9
2020-12-06log2.h: Use uintXX_t instead of kernel specific typesHarald Welte1-2/+3
Change-Id: Ieb872551bdbe514f2c77f9aeb2b9ee42f6573909
2020-12-06hash/log2: Add generic implementations of fls() and fls64()Harald Welte1-0/+59
When importing the hashtable code in I8ef73a62fe9846ce45058eb21cf999dd3eed5741 I didn't import actual implementations of the fls() and fls64() implementations, as at least gcc-10 was smart enough to detect we only use it on constant types and hence the computation can happen at build time via const_ilog2() However, in our jenkins build verification' this doesn't appear to happen, as we get below errors: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h: In function ‘__ilog2_u32’: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:20:9: error: implicit declaration of function ‘fls’ [-Werror=implicit-function-declaration] return fls(n) - 1; ^~~ /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h: In function ‘__ilog2_u64’: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:28:9: error: implicit declaration of function ‘fls64’ [-Werror=implicit-function-declaration] return fls64(n) - 1; ^~~~~ Let's provide some generic implementations for this case. If needed one could also introduce architecture-specific assembly implementations like in the Linux kernel, but so far we managed to keep libosmocore free of any assembly tweaks. Change-Id: Ifa4898eb66c8d949618edd47961b7a0330ed35b5
2020-12-06gsm_08_18.h: Add some PDU definitions still missingHarald Welte1-0/+19
In I7da8b25c9a89a7e3ae6c1680ba838e136d7d5293 I seem to have failed to realize that 3GPP TS 48.018 v15.0.0.0 Table 11.3.26 continues on yet another page. Let's add those missing PDU types definitions. Change-Id: I9173c35240ff78048b2b76a1155d90467ef16b2d
2020-12-05Use explicit type-casting in hlist_del() for C++ compatibilityHarald Welte1-2/+2
/usr/local/include/osmocom/core/linuxlist.h:479:12: error: invalid conversion from ‘void*’ to ‘hlist_node*’ [-fpermissive] 479 | n->next = LLIST_POISON1; Fixes: I8ef73a62fe9846ce45058eb21cf999dd3eed5741 Change-Id: I75b0a5fe097562007c53987d8d41811e9f35798d
2020-12-05core/linuxlist: do not use 'new' as a parameter nameVadim Yanitskiy1-4/+4
'new' is a reserved keyword in C++, so including this header from a C++ project (like osmo-pcu) breaks compilation. Let's rename it in the same way as it's already done in this file: add '_'. Change-Id: I7f7d9143edca75ce932601386a8766b0a62c0e24 Fixes: I8ef73a62fe9846ce45058eb21cf999dd3eed5741
2020-12-05Add hlist and hashtable from Linux kernelHarald Welte5-0/+617
For more than a decade we've used the linuxlist.h for double-linked lists. Let's also add the hlist (double-linked lists with single pointer sized head, and the hashtable that builds on top of it. This reflects the versions included in Linux 5.8 with some modifications to make them build in userspace (remove RCU versions, adjust for userspace include files and types, convert to doxygen). Change-Id: I8ef73a62fe9846ce45058eb21cf999dd3eed5741
2020-12-04bssgp: Fix typo in BSSGP Message Type enumHarald Welte1-1/+4
Change-Id: I63941f8b38485e569f56ba5065c2c00232703028
2020-12-03ns2: Add log filtering by NSE/NSEI, fix NSVC filter on receiveDaniel Willmann1-0/+2
NSVC filtering was only implemented on sending messages, this also adds log_set_context() calls to ns2_recv_vc() Filtering by NSE is implemented similar to NSVC. Change-Id: I63c0e85f82f5d08c5a6f535da94b8648498439d2 Related: SYS#5232
2020-12-02gsm_08_18.h: Update enums for message types and IEs with Release 15Harald Welte1-2/+123
Lots of newly introduced message types and information elements. Change-Id: I7da8b25c9a89a7e3ae6c1680ba838e136d7d5293
2020-12-02Integrate libmnl (minimal netlink) library with libosmocore select loopHarald Welte2-0/+23
This adds an easy way to listen to netlink events form the Linux kernel from within libosmocore applications. The new dependency can be disabled via the "--disable-lbimnl" configure flag. Change-Id: I4f787ee68f0d6d04f0a5655eb57d55b3b326a42f
2020-12-02logging: Calculate LOG_MAX_{CTX,FILTERS} from the enumDaniel Willmann1-10/+10
Change-Id: I1ee1278b029e42321932b87f94aa3e0eeed4108a Related: SYS#5232
2020-12-01cosmetic: frame_relay: Fix typosHarald Welte1-2/+2
Change-Id: Ifc29ddb43745571096b458393692a68052898daa
2020-12-01gsm: Add enum for Network Feature Support IEPau Espin Pedrol1-0/+1
Change-Id: Ie409fd163b612bc3e2d7b8bf22d720705f0f6af1
2020-11-30gprs_ns2: Introduce gprs_ns2_lltype_str() for link layer nameHarald Welte1-0/+5
Change-Id: I4b257c09d9d3c97d6da04240c7a74a95c7c93675
2020-11-24ns2: remove obsolete type GPRS_NS2_LL_E1Alexander Couzens1-1/+0
There is already frame relay type GRPS_NS2_LL_FR to support frame relay. Change-Id: Iabb4608d91ccb32a07cad67519166dabfba76612
2020-11-24ns2: move link layer type into NSEAlexander Couzens1-1/+2
Even it was in theory possible to mix NS-VC ll types within a NSE. This is an unrealistic configuration. Further more to select the correct load sharing mechanism the NSE must know the correct link layer. Change-Id: I18dfd40a2429cd61b7c4a3dad5f226c64296f7d8
2020-11-24ns2: move LL into public apiAlexander Couzens1-0/+8
Also fix prefix. GPRS_NS -> GPRS_NS2. In preparation to move LL into upper layer. Change-Id: I3b5e0d51ce69b095095e5160ca0cf0d4534db1b8
2020-11-24ns2: implement link sharing selectorAlexander Couzens1-0/+1
Change-Id: I212fa1a65e8c16cf1e525d1962d5689446c7e49e
2020-11-24ns2: add support for frame relayAlexander Couzens3-0/+157
Add support for frame relay over dahdi hdlc device. It's supporting lmi by q933 and supports both SGSN and BSS. Change-Id: Id3b49f93d33c271f77cd9c9db03cde6b727a4d30
2020-11-20gsm_08_58: add rxqual field to RSL_IE_OSMO_REP_ACCH_CAPPhilipp Maier1-2/+4
In order to transfer an RXQUAL threshold to the BTS as well, the struct that defines the contents of RSL_IE_OSMO_REP_ACCH_CAP needs to be updated with a 3 bit field to contain the RXQUAL value. Change-Id: I6dda239e9cd7033297bed1deb5eb1d9f87b8433f Related: SYS#5114 OS#4796 OS#4794 OS#4795
2020-11-18bssgp: Input argument to bssgp_tlv_parse() should be 'const'Harald Welte1-1/+1
Change-Id: I397b32a6e6ea3e9d218446138cceafa9b27685dd
2020-11-17gsm_08_58: add struct for RSL_IE_OSMO_REP_ACCH_CAPPhilipp Maier1-0/+16
The recently added IE is used to transfer a bitfield, lets add a struct that describes the bitfield. This makes the IE easier to use. Change-Id: I326e66dae25acfab0b3fddc7278b39a8cbf7d385 Related: SYS#5114, OS#4796, OS#4794, OS#4795
2020-11-17vty/command: add 'hidden only' VTY reference generation modeVadim Yanitskiy1-0/+2
Change-Id: I511ce26350cd04bb0f66d130b5286cab84f16df2 Related: SYS#4910
2020-11-16bts_features: add feature BTS_FEAT_ACCH_REPPhilipp Maier1-0/+1
Change-Id: Ib4d1d8d8a1a1d58bc320a1c0eff2d52100267f09 Related: SYS#5114, OS#4796, OS#4794, OS#4795
2020-11-13serial: Introduce API osmo_serial_speed_tPau Espin Pedrol1-0/+1
This allows usual integer parsing at app level and calling this function to make sure correct values will be passed to osmo_serial_set_baudrate(). Change-Id: I41415c99d26128b33a8bf5ef7b38948bd1fe5d50
2020-11-12gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier2-0/+173
3GPP TS 24.008 section describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. This is fixed version of Ic8b2bfd00330235f5bed00771e421588abfaac1f, which got reverted because it used the keyword "class" as struct member, which lead into problems with c++ builds. This is now fixed. Change-Id: Id8732551b33616227609cd6fcf6c3133751a89eb Related: OS#4796 SYS#5114
2020-11-11Revert "gsm_04_08: add parser for Mobile Station Classmark 3"Harald Welte2-173/+0
This reverts commit a4939dc8461c0a2d8e67aa3bb95bfb73ad9225b7, which caused massive build failures in C++ programs like osmo-pcu - unsurprisingly, as it calls a struct member "class", which is a reserved keyword in C++. Change-Id: Ia43e56385e7b580f492c560aee8ff8b1e8a0e1d8
2020-11-11tdef: Introduce OSMO_TDEF_US unitPau Espin Pedrol1-0/+1
Some applications may need submillisecond timers, such as those interacting with modbus serial lines (RS-485, RTU), which require timers of values around 1.5 char-time (T1.5), where a data char is composed of 11 bits sent on the line: 1 start bit, 8 data bits, 1 stop bit, and and parity bit (or 2nd stop bits if no parity). For instance, for a baudrate of 9600: 1.5 * 11 / 9600 = 1.718 ms = 1718 us So having a granularity of MS is not enough here. Change-Id: I71848d7c1ee0649929ce07680ee7320bb2a42f0e
2020-11-10gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier2-0/+173
3GPP TS 24.008 section describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. Change-Id: Ic8b2bfd00330235f5bed00771e421588abfaac1f Related: OS#4796 SYS#5114
2020-11-09gsm_08_58: add proprietary IE to signal Repeated ACCH CapabilityPhilipp Maier1-0/+3
3GPP TS 24.008, section specifies a Repeated ACCH Capability bit in the Classmark 3 IE. Unfortunately, there is no way specified how the Repeated ACCH feature should be controlled on RSL level. Since it is not unusual that BTS/BSC vendors occassionally add proprietary IEs to different RSL messages we may pick this as a solution as well and add a propritary RSL_IE_OSMO_REP_ACCH_CAP IE, so that we can enable repeated FACCH/SACCH on the BTS side when we send RSL CHAN ACT or RSL CHAN MODE MODIFY messages. Change-Id: I61ea6bf54ea90bd69b73ea0f0f3dc19a4214207b Related: OS#4796 SYS#5114
2020-11-09ns2: fixup gprs_ns2_prim_strsAlexander Couzens1-2/+2
The gprs_ns2_prim_strs was merged to early. The renaming in the last gerrit patchset wasn't done correct. Change-Id: Ie8e1e003d70af48f2d647b2c2701d4fc0f17e307
2020-11-06ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indicationDaniel Willmann1-0/+1
NS_AFF_CAUSE_VC_* failure and recovery should indicate the NSVC in question. Use the string representation reported by gprs_ns2_ll_str() for that. NS_AFF_CAUSE_VC_RECOVERY was never sent so do that on unblock as well. Change-Id: Iad6f0dc4565a46868cbbe17c361dcd473006c83d Related: SYS#4998
2020-11-06ns2: Add gprs_ns2_nsvc_state_name() to get the current state of a VCDaniel Willmann1-0/+3
Change-Id: I4c4c5b9142d7240ed452218e263ba12e2b70d1a0 Related: SYS#4998
2020-11-03Add exported function btsctx_alloc to public headerDaniel Willmann1-0/+2
Change-Id: Iddfb8e42d5d9e856c7165d3cff6c39191c86a4a5
2020-11-03libosmogb: Add a function to tx BVC RESET by nsei/bvciDaniel Willmann1-0/+1
This is needed for osmo-gbproxy where we need more control over BSSGP. Related: SYS#4998 Change-Id: Ifa769bce920a08cf93553dcb164a3fcf50162517
2020-10-29gsm48: add missing RR cause value definitionsVadim Yanitskiy1-0/+3
3GPP TS 44.018 version 15.4.0 Release 15 (2019-04). Change-Id: If7187e005d65fd2bf067d258148281c5df0526ff
2020-10-27gprs_ns2: convert gprs_ns2_cause_str into an static inlineAlexander Couzens1-1/+7
Be consistent with other implementation of get_value_string() in libosomocore. Change-Id: Ic79757df8683e0461c04f7ef9279e4fe645eb821
2020-10-27ns2: add value strings for ns2_affecting_cause_prim_str & ns2_prim_strAlexander Couzens1-0/+12
Change-Id: Ibf610fbd929dddc4a4e235152447caff522d4eb2
2020-10-25vty/command: fix: restrict the expert mode to the current sessionVadim Yanitskiy2-3/+3
Having the expert mode flag stored in the global 'host' structure was a bad idea, because this way it applies globally. In other words, if user Bob activates the expert mode in his dedicated session (e.g. a telnet connection), then not only him, but all other users would see the hidden commands in their VTYs. Moreover, if somebody deactivates the expert mode, it would also affect the Bob's VTY session. And finally, terminating a VTY session would not deactivate the expert mode. Let's move that flag from the global 'struct host' to 'struct vty' representing an individual VTY session, so then the expert mode would only affect the session where it was activated. In functions related to the XML VTY reference generation we don't have access to 'struct vty' (there may be no VTY session at all). Add two additional arguments to vty_dump_nodes(), indicating the global flag mask and a matching mode. This would allow to match the VTY commands in many different ways, e.g. one can dump hidden commands only, or all commands except the library specific ones. Change-Id: Iba13f0949061e3dadf9cf92829d15e97074fe4ad Related: SYS#4910
2020-10-24application: do not document unrelated forward-declarationsVadim Yanitskiy1-6/+3
Change-Id: Ic04caab15abbd0c0d3a01f6e128935a3ceed903e
2020-10-23select: Migrate over to poll()Harald Welte1-0/+1
select is an ancient interface with weird restrictions, such as the fact that it cannot be used for file descriptor values > 1024. This may have been sufficient 40 years ago, but certainly is not in 2020. I wanted to migrate to epoll(), but unfortunately it doesn't work well with the fact that existing programs simply set osmo_fd.flags without making any API calls at the time they change those flags. So let's do the migration to poll() as a first step, and then consider epoll() as a second step further down the road, after introducing new APIs and porting applications over. The poll() code introduced in this patch is not extremely efficient, as it needs to do extensive linked list iterations after poll() returns in order to find the osmo_fd from the fd. Optimization is possible, but let's postpone that to a follow-up patch. At compile time, a new --enable-force-io-select argument can be given to configure, forcing the use of the old select() backend instead of the new poll() based backend. Change-Id: I9e80da68a144b36926066610d0d3df06abe09bca
2020-10-23vty/command: introduce vty_dump_xml_ref_mode()Vadim Yanitskiy1-1/+14
This change introduces an enumerated type 'vty_ref_gen_mode' that (as the name suggests) defines the VTY reference generation mode: - DEFAULT - all commands except deprecated and hidden, - EXPERT - all commands including hidden, excluding deprecated; and a new function vty_dump_xml_ref_mode(), that allows to specify that mode. The old vty_dump_xml_ref() is now deprecated. Change-Id: Ie2022a7f9e167e5ceacf15350c037dd43768ff40 Related: SYS#4910