summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* gsm: Deprecate buggy gsm_arfcn2band API and introduce gsm_arfcn2band_rcPau Espin Pedrol2018-11-201-1/+2
| | | | | | | | | | | | | | | | | | | ARFCNs are values in well defined ranges. Until this patch, ARFCNs not belonging to any band were blindly assigned to DCS1800 by gsm_arfcn2band, causing unnoticed bugs and misconfigurations in osmo-bsc. Previous API gsm_arfcn2band cannot accomodate this kind of check easily, so let's deprecate it to tell people to use a new API gsm_arfcn2band_rc which performs this kind of checks and allows callers to log failures, misconfigurations, etc. At the same time, modify implementation of gsm_arfcn2band to abort if an invalid ARFCN is passed, this way users of this API can notice they are passing wrong data to it that most probably will produce unexpected results. Related: OS#3063 Change-Id: I780d452dcebce385469e32ef2fd844df6033393a
* LCLS: add 48.008 parameter structureMax2018-11-201-0/+8
| | | | | | | | | | | It's convenient to hold all LCLS-related parameters from 3GPP TS 48.008 in a single structure. This will be used in follow-up patch handling Assignment Request with extended parameters as well as corresponding BSC code working with LCLS. Change-Id: I4b873f9a3c5a5d33b438382971b3d92e40d48d62 Related: OS#2487
* gsm_44_318.h: remove #if 0 from struct gan_cch_desc_ieNeels Hofmeyr2018-11-191-17/+0
| | | | | | | These are actually parts of the struct in big endian order, which will soon be done automatically by struct_endianess.py. Change-Id: I9bc694f10fa9cef0bb7fc791bb40e7602459b16b
* Add missing header includeMax2018-11-191-0/+1
| | | | | | | | That's necessary for 'struct tlv_parsed' definition although lack of it does not cause build failure in libosmocore for me but does so for osmo-bsc. Change-Id: I3b2d3955d02b07dc7ec5e9f0c66cc477196703ed
* Support cipher mode reject with extended causeMax2018-11-192-0/+3
| | | | | | | | | | | | | * add function to generate cipher mode reject with extended (2-byte) Cause IE * add function to get (extended) Cause value * add corresponding (extended cause) test * update existing (non-extended cause) test * use enum as a parameter for existing non-extended version to make interface more unified Change-Id: Id5509b94a18180a44f45300caaa02b843c166fa3 Related: OS#3187
* Move msgb_push helpers to public headerMax2018-11-192-0/+15
| | | | | | | | | | The msgb_wrap_with_TL() is generally useful so it make sense to make it public to facilitate code re-use. Other helpers can be implemented as trivial wrappers over existing tlv.h functions. Update headers and code accordingly. Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
* Update GSM0808_LCLS enumsMax2018-11-181-0/+3
| | | | | | | | Add values indicating that LCLS control/config/status value has not been received yet. Change-Id: I52dc6a52f5ee043ed2c1625ffecfd495e3c746b1 Related: OS#2487
* Update 3GPP TS 08.08 Cause handlingMax2018-11-183-3/+29
| | | | | | | | | | | | * add Class definitions * add helper to check for extended bit * add helper to get Cause's Class * use enum in gsm0808_cause_name() and gsm0808_create_cipher_reject() to avoid confusion between class and cause * update gsm0808_create_cipher_reject() comments Change-Id: I31b31dfc22eb4b6b07089e1255246ac458125340 Related: OS#3187
* Add helper wrapper for BSSAP TLV parsingMax2018-11-181-0/+3
| | | | Change-Id: Ib228368901ce90a02a5664f2510593371c7d29cd
* gsm29118: add value strings for SGSAP IEIPhilipp Maier2018-11-161-1/+4
| | | | | | | | The value strings for the SGSAP IEI are missing, lets add a set of value strings and a function to retrieve them. Change-Id: I2787303174f74ffba86675bce2c12f680d8ea708 Related: OS#3615
* gsm/protocol/gsm_08_58.h: Fix typoMartin Hauke2018-11-151-1/+1
| | | | | | | | | | | | | | Fix a typo that prevents building on ppc64 (Power8, Big Endian). Tested with gcc version: 8.2.1+r265487 /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I../include -DBUILDING_LIBOSMOCORE -Wall -Wall -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DBUILDING_LIBOSMOCORE -Wall -c -o panic.lo panic.c In file included from ../include/osmocom/gsm/rsl.h:6, from gsmtap_util.c:37: ../include/osmocom/gsm/protocol/gsm_08_58.h:60:4: error: expected specifier-qualifier-list before 'sapi' sapi:3; ^~~~ Change-Id: I4a40fc68cb6dfdfadfcc34213c4ecdabbbc356f2
* gsm_29_118: add missing include to header filePhilipp Maier2018-11-071-0/+1
| | | | | | | | | The header file gsm_29_118.h is defining variables of type struct value_string, which is declared in core/utils.h. We should add an include to utils.h to prevent confusion when the header is used. Change-Id: I9f9bb62d29cd068820ad5aa677717bd448de3f4a Related: OS#3615
* core/msgb.h: introduce msgb_l4len() helperVadim Yanitskiy2018-11-071-0/+12
| | | | | | | | | | There is already a group of similar functions for L1, L2 and L3, but L4 was missing. The L4 is usually used for parsing of complex L3 messages, such as SS/USSD and SMS. This change introduces a similar halper for L4. Change-Id: I755f2d654bbdad2a8b4f94df9023bdd370b07ae6
* gsm/gsup.h: cosmetic: use tab for comment alignmentVadim Yanitskiy2018-11-061-1/+1
| | | | Change-Id: Id71d4b45e2b9f42da5e23e709ad97d4d0abfc3d9
* gsm0808: cosmetic: rename parameter "reason" to "cause"Philipp Maier2018-10-301-1/+1
| | | | | | | | | The function that generates the clear command takes a parameter "reason", which is the cause code. Lets give it the name "cause" to have a coherent naming scheme that matches the other functions and the 3gpp specs. Change-Id: I7b6c15e8fa8db13deef5041095944ca1c58fb99f
* gsm23003: Add MME domain name related helper functionsHarald Welte2018-10-282-0/+13
| | | | | | | osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and osmo_gen_home_network_domain() Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb
* add osmo_sock_get_{local,remote}_ip{,_port}()Oliver Smith2018-10-261-0/+6
| | | | | | | | | | Return only the IP or port of either the local or remote connection, not the whole set of IP and port of both the local and remote connection like osmo_sock_get_name() does it. This is needed for OS#2841, where we only want to print the remote IP. Related: OS#2841 Change-Id: I6803c204771c59a2002bc6a0e6b79c83c35f87e1
* SGsAP protocol definitions (header + C file)Harald Welte2018-10-212-0/+170
| | | | Change-Id: Idddfc9b851eb4c2fa7dd661a9ce1b03a04883109
* gsm_08_58.h: Introduce struct abis_rsl_chan_nrPau Espin Pedrol2018-10-211-3/+32
| | | | | | | | | | | | It will allow to make code handling chan_nr values more easier to read and less prone to errors. union is used to be able to get the full octet in case we need to pass it somewhere else or encode it. An extra union is used in struct abis_rsl_common_hdr and others to allow using fields directly while keeping API compatibility. Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9
* gsm_08_58.h: Introduce struct abis_rsl_link_idPau Espin Pedrol2018-10-101-1/+24
| | | | | | | | | | | | It will allow to make code handling link_id values more easier to read and less prone to errors. union is used to be able to get the full octet in case we need to pass it somewhere else or encode it. An extra union is used in struct abis_rsl_common_hdr to allow using fields directly while keeping API compatibility. Change-Id: Ibd75a493bcfdf46c028ea466867d0c0d83d46343
* GSMTAP: fix typos in commentsShinjo Park2018-10-071-2/+2
| | | | Change-Id: I2e710141ee90ddc8b5336d5f81e99bd918d10106
* GSMTAP: add definitions for LTE NAS subtypesShinjo Park2018-10-071-0/+8
| | | | | | | | Wireshark GSMTAP dissector has LTE NAS subtypes for plain NAS messages and NAS messages with security header. This commit adds definition for these subtypes. Change-Id: I49d15fb13299c1bcbe0fb7e50bf222294c7a49ef
* GSMTAP: add definitions for new LTE RRC channelsShinjo Park2018-10-071-10/+25
| | | | | | | Later release of 3GPP TS 36.331 added new LTE RRC channels. This commit additionally defines LTE RRC message types existing in Release V15.3.0. Change-Id: Ifa48b2227be15af04c9a4702d2025abcc660f0df
* gsm0808: add function to convert AMR S15-S0 to gsm0408 settingsPhilipp Maier2018-09-251-0/+1
| | | | | | | | Add a function to convert S0-S15 bits to struct gsm48_multi_rate_conf, which hold the codec settings for AMR. Change-Id: I973736273c236eee84decf15868190e339c3fed4 Related: OS#3548
* gsm_utils: add function to get value strings for gsm48_chan_modePhilipp Maier2018-09-251-0/+2
| | | | | | | The enum gsm48_chan_mode has value strings, but no function to retrieve those strings. Lets add one. Change-Id: If715705e1ebdfcfdfae1c2099932f7bb8b3861a7
* vty/command.h: document and prettify CMD_ATTR_* flagsVadim Yanitskiy2018-09-241-2/+3
| | | | | | | | | | Since the CMD_ATTR_* flags are intended to be used in bitwise operations, let's assign them proper values. Adding a new flag (e.g. CMD_ATTR_FOO_BAR) could actually result in assigning 0x03 instead of expected (0x01 << 2). Change-Id: I3b1badef830f7e6436a67673b5709ec33c060c68 Related: OS#3584
* gsm0808_utils: constify parameterPhilipp Maier2018-09-211-1/+1
| | | | | | | parameter cfg in gsm0808_sc_cfg_from_gsm48_mr_cfg() is used read only. Lets add a const to make this clear to the compiler. Change-Id: I31e8d273b070b0afc446a298299d4f502d6c396b
* gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier2018-09-192-0/+15
| | | | | | | | | | | | | | | | Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 This resurrects change-id I4e656731b16621736c7a2f4e64d9ce63b1064e98 which was reverted in I9e0d405e303ed86d23703ca6362e958dddb2f861 due to gsm0808_test failing. The test failure is fixed by properly clearing the struct gsm48_multirate_cfg prior to running tests (add memset(0)). Change-Id: Ia782e21c206c15e840226d79b4209d13658ee916 Related: OS#3548
* Revert "gsm0808: add function to convert amr gsm0408 setings to gsm0808"Neels Hofmeyr2018-09-162-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2fd4fe6aa109c8df50baac465f0393a303a64dd2. As shown in https://jenkins.osmocom.org/jenkins/view/master/job/master-libosmocore/475/a2=default,a3=default,arch=amd64,label=osmocom-master-debian9/console This commit breaks gsm0808_test with: stderr: --- expout 2018-09-16 22:37:31.382280438 +0200 +++ /n/s/dev/make/libosmocore/tests/testsuite.dir/at-groups/21/stdout 2018-09-16 22:37:31.426281372 +0200 @@ -78,9 +78,9 @@ Input: m4_75= 0 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -92,9 +92,9 @@ Input: m4_75= 1 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -106,9 +106,9 @@ Input: m4_75= 0 smod= 0 m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 [...] Change-Id: I9e0d405e303ed86d23703ca6362e958dddb2f861
* gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier2018-09-142-0/+15
| | | | | | | | | Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 Change-Id: I4e656731b16621736c7a2f4e64d9ce63b1064e98 Related: OS#3548
* gsm0808: fix wrong codec defaults for OFR_AMR_WBPhilipp Maier2018-09-141-1/+1
| | | | | | | | | | | | | 3GPP TS 48.008 chapter 3.2.2.103 states that the configuration bits of OFR_AMR_WB are coded as follows: "S0, S2, S4 indicates the supported Codec Configurations. S1, S3, S5, S6, S7 are reserved and coded with zeroes." The current default setting of 0x3F violates this requirement. Lets set the "forbidden" settings zu zero and keep only the allowed ones. Change-Id: I4a481def59e9c98cfdcafc2b80c0ac7df0c14130
* logging vty: write: check logging levels validityNeels Hofmeyr2018-09-131-0/+1
| | | | Change-Id: If683b1272ad2d5b402b91c52c496aa7975bc6315
* logging vty: rewrite 'logging level' vty cmd generationNeels Hofmeyr2018-09-133-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completely drop the implementations of log_vty_command_{str,description}(). These functions have been public API once, marked as deprecated since c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7 (March 2017). I considered to keep them, or reduce them to useless stubs, but it is quite silly, really. These functions are completely and utterly useless outside of libosmocore. Any program linking these deserves to fail. Re-implement vty logging level command gen, in logging_vty.c. logging.c is simply the wrong place for that. Introduce logging_internal.h to share logging definitions to logging_vty.c without publishing as API. Introduce static gen_logging_level_cmd_strs() to compose a list of category arguments with their descriptions for VTY commands. Use osmo_talloc_asprintf() instead of the previous error prone and chaotic strlen() counting method. Do not dynamically generate log level arguments, just keep static strings. We are super unlikely to ever change the log levels we have. No changes in logging_vty_test.vty: proves that there is no functional change. All of this, besides introducing basic sanity, is cosmetic preparation to be able to re-use the generic command generation code for arbitrary commands with category or level args (for deprecated and new keywords). Rationale: I want to hide 'all' and 'everything' from the VTY command documentation, by means of deprecating. I first tried to simply define a deprecated 'logging level CAT everything' command: logging level (all|rsl|rr|...) (debug|info|notice|error|fatal) logging level CAT everything # <- deprecated and hidden But unfortunately, command matching doesn't work as intended when the CAT argument reflects a valid category; I want it to invoke the deprecated function as soon as the 'everything' keyword follows, but it stays stuck to the "valid" command when the category argument matches an explicit keyword in that list, and will throw an error on the following 'everything' keyword. I.e.: logging level rsl everything % Unknown command # <-- leads to config file parse error logging level unknown_string everything % Ignoring deprecated 'everything' # <-- works only for invalid categories So I need to define 'everything' separately, again with a list of each valid category instead of a generic CAT arg. Change-Id: I3b083f27e3d751ccec258880ae7676e9af959a63
* gsm0808: implement BSSMAP Classmark RequestNeels Hofmeyr2018-09-131-0/+1
| | | | | Related: OS#3043 Change-Id: I4a2e1d3923e33912579c4180aa1ff8e8f5abb7e7
* add osmo_str_tolower() and _toupper() with testNeels Hofmeyr2018-09-071-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | We already have osmo_str2lower() and osmo_str2upper(), but these lack: * proper destination buffer bounds checking, * ability to call directly as printf() argument. Deprecate osmo_str2upper() and osmo_str2lower() because of missing bounds checking. Introduce osmo_str_tolower_buf(), osmo_str_toupper_buf() to provide bounds-safe conversion, also able to safely convert a buffer in-place. Introduce osmo_str_tolower(), osmo_str_toupper() that call the above _buf() equivalents using a static buffer[128] and returning the resulting string directly, convenient for direct printing. Possibly truncated but always safe. Add unit tests to utils_test.c. Replace all libosmocore uses of now deprecated osmo_str2lower(). Naming: the ctype.h API is called tolower() and toupper(), so just prepend 'osmo_str_' and don't separate 'to_lower'. Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
* core/utils.h: move includes to the topVadim Yanitskiy2018-09-051-3/+2
| | | | | | | Having all inculdes listed in one place is a common good practice, which prevents one from adding duplicates. Change-Id: I3f52189d5e8f9afafc39525e95385a085f8f850a
* core/utils.h: drop duplicate '<stdbool.h>' includeVadim Yanitskiy2018-09-051-1/+0
| | | | Change-Id: I0979ddda91c4c0aa080b714cf2a698d7634f5091
* Add RSPRO support to IPA and logging definitionsHarald Welte2018-09-032-1/+3
| | | | Change-Id: Iee79f5273f32cb9ce4bd7a984e7f0625542e776f
* Add CC_CAUSE value_string arrayKeith2018-09-021-0/+4
| | | | | | | Adds a value_string array for GSM 04.08 Call Control cause values Change-Id: I296f208581ce2550805f9d96e20f7319e1199023
* log: add 'last' option to 'logging print file'Neels Hofmeyr2018-08-271-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow printing the source file information *after* the log information. Add target->print_filename_pos, log_set_print_filename_pos() and enum log_filename_pos, and the optional 'last' keyword to the 'logging print file' vty command. (An enum in case we want to add other positions later.) Rationale: on log lines, the logging context is usually printed first in the logging text. Without the source file information, this logging context pretty much aligns in an easily readable way. When adding the source file information, each line's logging context info is shifted right by a pretty much random amount and it is hard to spot recurring logging contexts. One solution is to switch off source file info, of course, but that's not an option when actively hacking on bugs and new features. For example, it is unnecessarily hard to spot lchan FSM related log lines in this osmo-bsc log snippet: DRSL NOTICE mgw_endpoint_fsm.c:603 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance DRSL NOTICE fsm.c:381 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated DMSC NOTICE mgw_endpoint_fsm.c:603 SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT DCHAN DEBUG lchan_rtp_fsm.c:741 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED DCHAN DEBUG lchan_rtp_fsm.c:520 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance DCHAN DEBUG fsm.c:381 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated DCHAN DEBUG lchan_rtp_fsm.c:520 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED DCHAN DEBUG lchan_fsm.c:1232 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR) DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance DRSL NOTICE fsm.c:381 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated DCHAN DEBUG lchan_fsm.c:1196 lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN DCHAN DEBUG lchan_fsm.c:354 lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state DLMGCP DEBUG mgcp_client.c:741 Tx MGCP msg to MGCP GW: 'DLCX 3 2@mgw MGCP 1.0' DLMGCP DEBUG mgcp_client.c:743 Sending msg to MGCP GW size: 66 DRLL NOTICE mgcp_client_fsm.c:422 MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP Placing the source file info behind the log text makes it much easier to follow, while the source file info is still available: DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance (mgw_endpoint_fsm.c:603) DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated (fsm.c:381) DMSC NOTICE SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT (mgw_endpoint_fsm.c:603) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:741) DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance (lchan_rtp_fsm.c:520) DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated (fsm.c:381) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:520) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK (lchan_fsm.c:1232) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR) (handover_fsm.c:745) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance (handover_fsm.c:745) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated (fsm.c:381) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN (lchan_fsm.c:1196) DCHAN DEBUG lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state (lchan_fsm.c:354) DLMGCP DEBUG Tx MGCP msg to MGCP GW: 'DLCX 3 12@mgw MGCP 1.0' (mgcp_client.c:741) DLMGCP DEBUG Sending msg to MGCP GW size: 67 (mgcp_client.c:743) DRLL NOTICE MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP (mgcp_client_fsm.c:422) Implementation: for 'last', insert source file info only when an '\n' is found at the end of the log line composition buffer, so that LOGP()...LOGPC() constructs also print source file info only when a log line actually ends. Change-Id: I393907b3c9e0cc1145e102328adad0a83ee13a9f
* socket: add flag to enforce SO_REUSEADDR on UDP socketsPhilipp Maier2018-08-231-0/+2
| | | | | | | | | | | | | | | | | | | When IPPROTO_UDP is used then SO_REUSEADDR omitted since UDP is connection less we do not have to wait until lingering connections time out. There were also negative effects such as that two applicatications could use the same UDP port, normally one of the two applications would get an error, but with SO_REUSEADDR this is supressed. However, there are applications (UDP MULTICAST) where two applications must be able to use the same port. In the osmocom project those are osmo-bts-virtual, virtphy and gsmtap in general. Lets introduce a flag that the API user can supply in order to have SO_REUSEADDR applied. - Add new flag OSMO_SOCK_F_UDP_REUSEADDR Change-Id: I94aaf6d5224ab23bde5ea5c4a83569b6145ab32b Related: OS#3497
* use __FILE__, not __BASE_FILE__Neels Hofmeyr2018-08-204-13/+13
| | | | | | | | | | | | | | | The intention was to use the file's basename, but __BASE_FILE__ means "the root file that is being parsed and contains #include statements". If we had a function using __BASE_FILE__ and that was defined in an #included file, __BASE_FILE__ would indicate the first file where the #include is, and not the file where the function is defined. __BASE_FILE__ works for us because we don't ever include function definitions that log something, so __BASE_FILE__ always coincides with __FILE__ for our logging; but still __BASE_FILE__ is semantically the wrong constant. Related: OS#2740 Change-Id: Ibc1d3746f1876ac42d6b1faf0e5f83bd2283cdcc
* msgb: Introduce msgb_{de,en}queue_count APIsPau Espin Pedrol2018-08-171-0/+34
| | | | | | | | | | It's a common pattern having a list of msgb and having to maintain its size (for instance, to limit the maximum size of the list). Having the counter updated at the same time that the msgb is enqueued or dequeued helps avoiding introducing new bugs by forgetting to update the size counter at the right places. Change-Id: I33b501e89a8f29e4aa121696bcbb13d4b83db40f
* signal: Introduce API osmo_signal_talloc_ctx_initPau Espin Pedrol2018-08-161-0/+1
| | | | | | | | | | | | Otherwise applications need to use "extern void* tall_sigh_ctx" and set it manually (that symbol is not exported in any header file) or end up allocating struct signal_handler into the NULL talloc ctx. API created in a similar way as already existing msgb_talloc_ctx_init(), but without the pool_size because it's not considered necessary in this case. Change-Id: Id58ca18eb826b8f4183a7cf0dbb2b38cba702a09
* 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
* libosmogsm: (re)introduce gsm48_push_l3hdr()Vadim Yanitskiy2018-08-052-3/+8
| | | | | | | | | | | | | There was gsm0480_l3hdr_push() declared in a header file, but not exposed in 'libosmogsm.map'. Furthermore, for some reason it was a part of GSM 04.80 API, what is not actually correct. Let's rename this symbol, and properly expose it as a part of the GSM 04.08 API. Also, let's introduce an auxiliary wrapper for messages, where the transaction identifier is required (see GSM 04.07, section 11.2.3.1.2). Change-Id: I8a045efe8335d83fcbe8d43eb180972e3b1d9dda
*