summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gsm0480: fix copy-pasted note for gsm0480_gen_return_error()Vadim Yanitskiy2018-12-141-3/+0
| | | | | | InvokeID is mandatory for ReturnError component. Change-Id: Ie1c7116d368c2029b9f524cb74ffa316e282ec83
* stats.h: Fix build on MacOSPau Espin Pedrol2018-12-131-2/+2
| | | | | | | Otherwise struct osmo_stats_config is not defined and compiler fails. Related: OS#3722 Change-Id: I037c3ca141ecee2d457e0a881a56e32ee24cec4d
* msgb: add test helpersMax2018-12-122-0/+231
| | | | | | | | It's often handy to compare certain msgb layer to a given array and print the position where they differ. Add simple pretty-printer and corresponding L* wrappers. Change-Id: I3bc95f2f5ab6e3f4b502647fb3e0aaaf1f7c4cf5
* fix api doc for osmo_bcd2str()Neels Hofmeyr2018-12-111-1/+1
| | | | Change-Id: I504ea849fc9daeb34a1b3c5343371161deba743e
* gsm48_mi_to_string(): do not read from zero length input bufferNeels Hofmeyr2018-12-101-1/+1
| | | | Change-Id: I12cada7c2c5187146ca5a33d1ebfefb4cad65632
* gsm48_mi_to_string(): guard against zero length output bufferNeels Hofmeyr2018-12-102-13/+13
| | | | | | | | All successful cases already return from the switch(), so simply handle all errors below it by returning an empty string (if there is enough string buffer). Change-Id: I709ac3b9efb7b4258d8660715b10312e11b9b571
* gsm48_generate_mid(): mask out ODD flag from mi_typeNeels Hofmeyr2018-12-103-8/+6
| | | | | | | | For MI encoding, see 3GPP TS 24.008, 10.5.1.4 Mobile Identity. The 'odd' flag indicates whether the last BCD nibble is used. Of course that flag should be made sure to reflect the actual length. Change-Id: Id6e695ebf9f86b295eaa7e2c6228989256f37e68
* gsm48_mi_to_string: use osmo_bcd2str(), fix some corner casesNeels Hofmeyr2018-12-103-29/+24
| | | | | | | | | | | | | By using osmo_bcd2str(), ensure that the resulting string is always nul terminated, and always return strlen()+1 whether truncated or not. Still keep up the previous return value style, even if that isn't consistent at all. The difference between IMSI/IMEI and TMSI return values remains and is not part of this patch. Change-Id: I1b51b72a721e1cc9d69796b804ebda741ff0f36b
* add osmo_bcd2str()Neels Hofmeyr2018-12-104-0/+186
| | | | | | | | | | | | | | | | | | Add a standalone bcd-to-string conversion function with generic parameters. Add a regression test in utils_test.c. So far there is no single universal implementation that converts a BCD to a string. I could only find gsm48_mi_to_string(), which also interprets surrounding bytes, MI type and TMSI as non-BCD value. The idea is to use this function from gsm48_mi_to_string() and similar implementations in subsequent commits. Root cause: in osmo-msc, I want to have an alternative MI-to-string function for composing an FSM name, which needs the BCD part of gsm48_mi_to_string() but not the TMSI part. Change-Id: I86b09d37ceef33331c1a56046a5443127d6c6be0
* Constify llist_count() parameterMax2018-12-101-1/+1
| | | | | | | Counting list entires should not alter the list content: let's make this obvious from type signature. Change-Id: I414e67a3de733fab407161b3264d3b89070ba537
* api doc: gsm48_mi_to_string(): warn of return value implementationNeels Hofmeyr2018-12-101-1/+4
| | | | Change-Id: If5e7abd15dddf39cdfad8071f4cd5ca8244eabe0
* gsm0408_test: test encoding and decoding Mobile IdentityNeels Hofmeyr2018-12-102-0/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | One would think by now we would solidly encode and decode Mobile Identities. Well, guess again. - rc is sometimes the amount of bytes written, sometimes actual strlen(). - on string truncation, rc is sometimes strlen() (assuming nul terminated), and sometimes snprintf()-style would-be strlen(). - returned string, when truncated by not enough buffer size, is sometimes nul terminated, sometimes not. - gsm48_mi_to_string() happily reads a byte from zero-length input buffer. - gsm48_mi_to_string() happily writes to zero length output buffer. - gsm48_mi_to_string() returns nonempty string for empty input. - encoding a MI type that still has the GSM_MI_ODD flag set results in encoding an even-length MI as odd-length (hence appending a stray 'F'). I am going to tweak the implementation of gsm48 mobile identity encoding / decoding, so first pinpoint the current behavior in a unit test, and show how perforated even such a seemingly trivial API can be. Change-Id: Iaae3af87f82f1a8f2e6273984c011b2813038cf7
* timer: Fix clockid_t undefined on MacOS < 10.12Pau Espin Pedrol2018-12-102-0/+5
| | | | | Related: OS#3722 Change-Id: If466a64bd44dcb8ae8a9b7f82bc9c9435ba3e640
* gsm0808: add encoder for cause codes and use itPhilipp Maier2018-12-086-19/+75
| | | | | | | | | | | | | | | | At the moment the all gsm0808 cause codes are encoded directly using the tlv API directly to put a one byte TLV field. This works ok for most situations where the cause code consists of a single byte. However, gsm0808 specifies a two byte cause code model where cause codes may be extended up to two bytes. Instead of implementing the encoding over and over and again, let's rather have an encoder function we can call. - Add an encoder function that can generate single byte and extended cause codeds and makes the length decision automatically. - Use only this function to append cause codes Change-Id: I71d58fad89502a43532f60717ca022c15c73f8bb
* gsm29118: add generator functions for GSM29118 messagesPhilipp Maier2018-12-075-0/+363
| | | | | | | | | We already have some GSM29118 related definitions and functions in libosmocore. Lets also add some functions to generate GSM29118 messages (similar to those we have for GSM0808). Change-Id: Ic87f8a771b87b52215d0a7451b67794557b80b8a Related: OS#3615
* gsm_29_118.h: Add constant for default portPhilipp Maier2018-12-071-0/+3
| | | | | | | | The specification defines a default port where the SGs interface should be reachable. Lets add a define-constant for it. Change-Id: Ia4b9f547dd980411d15b2691b7f535fa0463f0f1 Related: OS#3615
* cosmetic apn: correct whitespace errorPhilipp Maier2018-12-072-2/+2
| | | | | | | there is a whitespace between the * and osmo_apn_to_str(). Lets remove this. Change-Id: I094e6eb08eacf2d6459c47a7370837601aa92925
* Add osmo_sockaddr_in_to_str_and_uint()Max2018-12-072-5/+23
| | | | | | | | | It's similar to osmo_sockaddr_to_str_and_uint() but does not require odd typecasting for AF_INET case. Make osmo_sockaddr_to_str_and_uint() into wrapper around new function and make sure to check for address family before typecasting. Also use proper return type. Change-Id: Ie384483124d407a960ab6732e6a7fd90554389d2
* Allow log_init() with NULL log_infoMax2018-12-061-10/+15
| | | | | | | | | Since we have library-internal categories we don't have to force application to supply its own categories. This is especially useful for testing code inside libosmocore which only use internal categories anyway. Change-Id: I42159780b57684bff225789f036f28a4b25fc7b8
* gsm_29_118: add missing extern for struct value_string decl.Philipp Maier2018-12-051-8/+8
| | | | | | | | The value string arrays in the header file (gsm_29_118.h) are not declared as extern. Lets add it now. Change-Id: Ib6c4cbea649f790fa4db1ed2fe2b7e76a60291b4 Related: OS#3615
* LCLS: update osmo_lcls structMax2018-12-041-4/+4
| | | | | | | * use pointer to proper struct type for GCR * update comments to be useful for doxygen Change-Id: I8ccfbd0c146e462e599e5305520cc89602364ec3
* Add msgb_tl_put() helperMax2018-12-041-0/+12
| | | | | | | | | When adding complex TLV structures where length of V is not known in advance it's handy to be able to simply add Tag and save the pointer to the Length field so it can be updated once entire Value is added and its length is known. Change-Id: I8dc1e4880352833a0a49c1dd0d7cb4148ac43aff
* ctrl: use #define for TRAP idMax2018-12-032-1/+2
| | | | | | | We always use id = 0 when sending TRAP messages. Let's make this more obvious by introducing appropriate define. Change-Id: I33d7d4c6a1885a75a85d6f2f017430e0860b4126
* Update msgb Lx helpersMax2018-12-031-1/+17
| | | | | | | | | * add missing L1 and L4 hexdump * add msgb_l4() for consistency and convert msgb_sms() into simple alias Those will be used in follow-up patches for msgb debug/test helpers. Change-Id: I8d6dd1b1ff3aa98a452711c692ca7dee0449203b
* gsm0808: add message generator for BSSMAP HANDOVER PERFORMEDPhilipp Maier2018-12-033-0/+71
| | | | | | | | We currently have no generator function that can generate BSSMAP HANDOVER PERFORMED messages. Lets add function for this. Change-Id: I825106858bd89afc9837811b8fed2e8accc82441 Related: OS#3645
* configure.ac: check clock_gettime for glib < 2.17Alexander Couzens2018-12-032-1/+5
| | | | | | | glib < 2.17 doesn't support clock_gettime directly, it is available via librt. Change-Id: Ice853d85ffe859b1d4df48b91b050c24d85c861b
* Move BSSMAP_MSG_* defines to header fileMax2018-11-302-3/+3
| | | | | | | This will be reused be several tests related to TS 48.008 and TS 29.205 in follow-up commits. Change-Id: I4d8cc05b8df8e70c1f6257e53ae3acec7901681f
* ctrl: print textual error on IPA parsing failureMax2018-11-261-1/+1
| | | | Change-Id: I49bb613b416d549f554fd9d23cd37b63954324db
* add contrib/struct_endianess.pyNeels Hofmeyr2018-11-221-0/+369
| | | | | | | | | | | | In libosmocore (and likely elsewhere) we have scores of packed structs with sub-byte integer members that lack the necessary member reversal shims to be able to work on big endian architectures. Instead of manually editing each one of them and probably introduce errors in the process, this script handles the change automatically, and in the future allows us to verify correctness in gerrit verifications. Change-Id: I8e75b17d8071c7b3a2a171ba776fb76854b28a53
* Update gsm0808_create_ass() doxygenMax2018-11-221-2/+2
| | | | | | | | | | | * add spec reference * remove LCLS note: CI parameter is optional but have nothing to do with LCLS It's pretty hard to decipher from the spec what CI is useful for and we have not used it anyway so let's just keep it as "Optional" for now. Change-Id: I5552732afcec48047d993ae6ffb73a3e5d7c9202
* gsm: Deprecate buggy gsm_arfcn2band API and introduce gsm_arfcn2band_rcPau Espin Pedrol2018-11-204-25/+58
| | | | | | | | | | | | | | | | | | | 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
* document unblock-ack vs. signalling in gprs_ns_process_msg()Stefan Sperling2018-11-201-0/+6
| | | | | | | | | | | | | Since commit 797558ea1768e464f9559c5f7a4f3f4285c5de25 we send the NS_UNBLOCK_ACK message before dispatching the NS_UNBLOCK signal, instead of afterwards. Add comments which explain the intended order of events. Suggested-by: Pau Related: OS#2388 Change-Id: I4b93853c952a97302f8afc14f462f22c3e487564
* send NS_POUT_UNBLOCK_ACK before signalling S_NS_UNBLOCKStefan Sperling2018-11-192-6/+8
| | | | | | | | | | | | | | | | | | | | | In gprs_ns_process_msg(), we were dispatching the S_NS_UNBLOCK signal before sending out the NS_POUT_UNBLOCK_ACK message. Signal handlers might send messages to the other side, assuming that NS is now unblocked. However, since such messages will arrive before the UNBLOCK_ACK message the receiver might discard them. This problem has been observed with our TTCN3 BSSGP_Emulation as a peer to osmo-pcu. This patch makes TTCN3 PCU TC_paging() test pass regardless of whether the test or osmo-pcu is started first. Before this patch, this test would only pass if the test was started before osmo-pcu. A remaining problem is that the test does not yet keep passing reliably unless osmo-pcu is restarted between test runs. Change-Id: I3af54a14bb6bcfa167c9a9d9f67835e7f5b9f1bb Related: OS#2890 Related: OS#2388
* 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-197-1/+89
| | | | | | | | | | | | | * 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-193-39/+25
| | | | | | | | | | 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
* gsm48: gsm48_decode_freq_list: Improve documentation of paramter fPau Espin Pedrol2018-11-181-1/+1
| | | | Change-Id: Id8e3afff737211ded3c5689f2c83b1a544b42f9d
* Update GSM0808_LCLS enumsMax2018-11-182-0/+6
| | | | | | | | 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-186-9/+59
| | | | | | | | | | | | * 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
* fsm: fix apidoc of osmo_fsm_state_name()Philipp Maier2018-11-161-1/+1
| | | | | | | The api documentation of osmo_fsm_state_name() refers to an FSM instance, but it really means the state of an FSM. Change-Id: I88ddd6048426d380c49170e66f57b3843398c046
* gsm29118: add value strings for SGSAP IEIPhilipp Maier2018-11-163-1/+40
| | | | | | | | 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
* merge_doc.xsl: move to osmo-gsm-manuals.gitOliver Smith2018-11-121-48/+0
| | | | | | | | Allows building the manuals without the checked out libosmocore source. Related: OS#3385 Depends: I8e7036fae062ee783cb132b14608827a82c5e7c7 (osmo-gsm-manuals) Change-Id: Ifb81b18422987cdf36b75993d2782abf93b5f48c
* 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
* socket.c: fix IP and port buffer sizesOliver Smith2018-11-061-4/+4
| | | | | | | | Use INET6_ADDRSTRLEN (46) instead of 64 for IP address buffers, and 6 instead of 16 for port buffers (the highest possible port number is 65535). Change-Id: Ia25e2f3277ad2f60df31c08d12f42c1e6d2a14a6
* jenkins: print gcc version in logNeels Hofmeyr2018-11-061-1/+5
| | | | Change-Id: I8dfac78868f64213413e80cc52ac585d9d4a2c93
* core/msgb.h: introduce msgb_l4len() helperVadim Yanitskiy2018-11-072-0/+13
| | | | | | | | | | 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