aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
AgeCommit message (Collapse)AuthorFilesLines
2017-04-08Add osmo_sock_init2() function, allowing both BIND *and* CONNECTlaforge/sock2Harald Welte1-0/+4
The old osmo_sock_init() function allows only either a bind (for a server socket), or a connect (for a client socket), but not both together. So there's no way to have a client socket that is bound to a specific local IP and/or port, which is needed for some use cases. Change-Id: Idab124bcca47872f55311a82d6818aed590965e6
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier1-0/+5
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier1-0/+3
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
2017-04-08gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier1-0/+2
gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
2017-04-08gsm0808: Add utils for Cell Identifier ListPhilipp Maier2-0/+16
The planned support for true A over IP requires the encoding of the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528
2017-04-08gsm0808: Add utils for Encryption InformationPhilipp Maier2-0/+18
The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb
2017-04-08gsm0808: Add utils for Channel TypePhilipp Maier2-0/+17
The planned support for true A over IP requires the encoding of the a Channel Type element (see also ASSIGNMENT REQUEST). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7
2017-04-08gsm0808: Add AoIP specific elements to gsm0808_create_... functionsPhilipp Maier1-2/+19
the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34
2017-04-08gsm0808: Add utils for Speech Codec List and Speech CodecPhilipp Maier2-0/+41
The planned support for true A over IP requires the encoding and decoding of a so called "Speech Codec Element" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200
2017-04-08gsm0808: Add utils for AoIP Transport Layer AddressPhilipp Maier1-0/+30
The planned support for true A over IP requires the encoding and decoding of a so called "AoIP Transport Layer Address" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332
2017-04-08add VTY port number for osmo-stpHarald Welte1-0/+1
Change-Id: I978e1b73aa8097a7db6318d78f9f93457e6ce2af
2017-04-03logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtranHarald Welte1-1/+5
Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
2017-03-23Add support for PCU version reportMax1-0/+1
Expand 3GPP TS 52.021 §9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614
2017-03-22abis: add message type namesMax1-0/+1
Add human-readable names for Message Types from 3GPP TS 52.021 §9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
2017-03-21abis: add attribute namesMax1-0/+1
Add human-readable names for Attributes from 3GPP TS 52.021 §9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614
2017-03-16add gsm48_pdisc_msgtype_name()Neels Hofmeyr1-0/+5
Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df
2017-03-16add gsm48_pdisc_names and gsm48_pdisc_name()Neels Hofmeyr1-0/+4
I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
2017-03-15fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()Neels Hofmeyr1-1/+1
To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7
2017-03-15ctrl_type_vals: explicitly terminateNeels Hofmeyr1-1/+1
Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc
2017-03-15linuxlist.h: add llist_first/last_entry macrosNeels Hofmeyr1-0/+30
Copy list_first_entry, list_first_entry_or_null and list_last_entry from current linux kernel's tools/include/linux/list.h and rename to llist_*. Slightly adjust API doc but stay as close to the source as possible. This can replace similar implementations in osmo-bts-octphy's l1_if.c, in openbsc's gtphub.c and in osmo-hlr's gsup_server.c. Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453
2017-03-15osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || INDNeels Hofmeyr1-0/+2
So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf
2017-03-14gsm_04_08: add _NUM_CHREQ_T to enumAlexander Couzens1-0/+1
_NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134
2017-03-14gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASEAlexander Couzens1-0/+2
The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068
2017-03-07libosmocoding: migrate transcoding routines from OsmoBTSVadim Yanitskiy5-0/+210
There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
2017-03-06gsm0503.h: generate header automaticallyVadim Yanitskiy1-174/+0
Since we have automatic header generation, implemented in the utils/conv_gen.py, it's time to use this feature! Change-Id: I21caa4e433b2cc1861611e35350a9671da444c2a
2017-03-01fsm: convenience: add inline osmo_fsm_inst_state_name()Neels Hofmeyr1-0/+4
Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b
2017-03-01Use value_string for ctrl_typeMax1-2/+4
Use value_string for enum ctrl_type instead of custom code. Add corresponding unit tests. Related: OS#1615 Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
2017-02-24ports.h: rename CSCN to MSCNeels Hofmeyr2-2/+2
See OS#1958 Change-Id: I85aee0f8fdfc9c69d0ba9240988c633d3e707f2d
2017-02-23Expand and expose ctrl connection allocationMax1-1/+1
Add function for allocating CTRL connection to public headers and replace call to previous static function with it. Add doxygen docs for this function. It's useful if we need to allocate ctrl connection but don't need to bind to any interfaces: when we act as ctrl client. Related: OS#1615 Change-Id: I522ed809cbebfd3d7dd08b4ed9137b39ff192e32
2017-02-23logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr1-16/+18
My recent logging patch was merged to master a bit too soon. Accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING". libosmocore will not be backwards-compatible with the few commits from change-id I5c343630020f4b108099696fd96c2111614c8067 up to this one. This and following commits are backwards compatible with those before that short window. See also: * openbsc change-id Ib2ec5e4884aa90f48051ee2f832af557aa525991 * osmo-pcu change-id I4db4a668f2be07f3d55f848d38d1b490d8a7a685 Change-Id: I424fe3f12ea620338902b2bb8230544bde3f1a93
2017-02-23logging.h: fixup: add API doc for logging enums recently addedNeels Hofmeyr1-0/+5
Change-Id: Ic459b04219abe70171c8f80ed09df53d412dcfb2
2017-02-23logging.h: fix backwards compat broken by recent commitNeels Hofmeyr1-0/+7
Commit 812ba6dc63a75c39678dd3fe652768e76bf63183 "logging: centrally define ctx and filter indexes" Removed definitions, which causes older e.g. openbsc and osmo-pcu code trees to fail to build against a newer libosmocore. Re-introduce the legacy definitions to redirect to the new ones and re-establish backwards compatibility. The GPRS_* constants used to be defined in gprs_msgb.h, but since that header also includes logging.h, rather place the legacy shims in logging.h next to the other ones. Change-Id: I455bb1bb474d758af0fd5b6397f7e57260ad739d
2017-02-23gsm_04_08.h: add R99 MSCR and CBQ3 to SI3 Ctrl Chan DescrNeels Hofmeyr1-3/+5
MSCR and CBQ3 are Release 1999 additions to the Control Channel Description IE of SI3. Assuming that no-one is using the spare bits, this will not cause any code conflicts. In the R99 struct, spare1 and spare2 are in different places, so rather rename them to spare_1 and spare_2 to make sure we get a compiler barf *if* anyone tries to use them with the wrong structure. Adjust the spec reference to TS 44.018; TS 04.08 Figure 10.5.33 is replaced by TS 44.018 Figure 10.5.2.11.1 which is right there in the named Section 10.5.2.11, so drop the explicit reference. Motivation: the R99 Control Channel Description defines MSCR to indicate whether the MSC is R99+ or not. To use UMTS AKA on GSM networks, we want to indicate that our libmsc is capable of R99, like OsmoSGSN already does. CBQ3 is merely added for completeness, no particular use case in mind. Related: OS#1593 Change-Id: If87e07b5d04e1617155383e14c98d2125fdd0608
2017-02-22logging: centrally define ctx and filter indexesNeels Hofmeyr2-6/+17
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
2017-02-15gsup: add osmo_gsup_message_type_name()Neels Hofmeyr1-0/+5
Change-Id: Ic29b588b72893821d73fe90ecc16c6bf78d5a360
2017-02-14Add CTRL port for OsmoHLRMax1-0/+1
Change-Id: I1328c89ec8e908bf4b4d2c0a398690278369e0f5 Related: OS#1645
2017-02-07select: add functionality to check socket statePhilipp Maier1-0/+2
osmo_fd_register() is used to register socket file descriptors, after registering a socket, there is no way to test if the socket is still registered or actually registered at all. This commit adds a new function osmo_fd_register_check() that can be used to check in advance, if the socket fd is registered, before performing further operations. Change-Id: I48ec7098d6bba586c81bf0d5c9088108e2c081c6
2017-02-06osmo_auth*: fix ordering of function argsNeels Hofmeyr1-2/+2
milenage_gen_vec() has parameter ordering of (..., auts, rand_auts, rand). osmo_auth_gen_vec_auts() has (..., rand_auts, auts, rand), but actually feeds args in the same order, so that its rand_auts becomes auts, and its auts becomes rand_auts. Interestingly enough, API user osmo-gen-vec.c also adheres to this misordering and in turn passes auts for osmo_auth_gen_vec_auts()'s rand_auts and vice versa, so that it matches milenage_gen_vec(). So both the implementation (milenage_*) and the API user use the same ordering, just osmo_auth_gen_vec_auts() and osmo_auth_impl{ .gen_vec_auts() } in-between have the argument names swapped. Any current user of this API would need to adhere to this swapping or will not get successful AUTS resolution to a SQN. So the least impact fix is to rename the args without any actual functional change. So swap the names rand_auts and auts for osmo_auth_gen_vec_auts() and osmo_auth_impl{ .gen_vec_auts() }. (Also adjust API doc ordering) Change-Id: I0dcbd49759fc32d3b8974102dbd1d6703364ebf4
2017-02-02gsm48: add UMTS AKA res+sync IEIs, msg type and cause valNeels Hofmeyr1-0/+4
According to 3GPP TS 24.008 9.2.3a, 9.2.3, 10.5.3.6 Change-Id: I745061ce8eb88aa23080dadcdbfe2d703c362a30
2017-02-02GSUP, OAP, osmo-gen-vec: fix AUTS length to 14, not 16Neels Hofmeyr1-1/+1
GSUP transmits AUTS for UMTS authentication procedures, and OAP uses the same procedures to authenticate. osmo-gen-vec is a utility program that passes AUTS to our osmo_auth_gen_vec_auts() API. According to 3GPP 33.102 6.3.3, AUTS = SQN^AK || MAC-S, which are 6 || 8 == 14 bytes. This is confirmed by 24.008 9.2.3a where the TLV has 16 bytes, TL = 2 and AUTS being the V = 14. It is not harmful for milenage_gen_vec_auts() to pass two more AUTS bytes. But writing 16 bytes to a GSUP struct is a potential problem when passing in a 14 byte long AUTS buffer to the GSUP API, which then reads past the AUTS buffer. The API implies the length, so far to be 16, so passing in a 14 byte buffer to GSUP would require copying to a larger buffer first. Fix this by using a length of 14 for AUTS everywhere instead. This constitues an ABI breakage, we may handle it as a "fix before an official release", otherwise we need a version bump. The OAP protocol document has also been updated, needs an update in the osmo-gsm-manuals as well. Change-Id: If25b173d9ec57ea4c504d860954912b7d82af455
2017-01-30comment: ports.h: more visibly remind to keep docs+wiki syncedNeels Hofmeyr2-0/+2
It is still too easy to forget syncing, so add another reminder at the end of the list. Change-Id: I95191906afa8e6ada31310d0e36de33e3fccf268
2017-01-28vty/ports.h: reserve port 4258 for OsmoHLR VTYNeels Hofmeyr1-0/+1
Change-Id: I08cb52d9399a27e6876e45da36f434708c4fddef
2017-01-27socket: Introduce function to obtain socket nameHarald Welte1-0/+2
Using this function, one can obtain a human-readable string identifying the host and port names of the socket. Change-Id: Ib5de5c7b9effe1b0a363e4473a7be7fa38ca6ef3
2017-01-25OML: add external alertsMax1-0/+2
Add special cause for alerts produced by external processes. Change-Id: Idd7ee085321f8172c72ecfdba320186049f4d988 Related: OS#1615
2017-01-23utils.h: #include <stdio.h> as we use fprintf()Harald Welte1-0/+1
Change-Id: I911c7f4bcadde414ce0b384e13a3a9a4a953e2fb
2017-01-21linuxlist.h: add llist_count()Neels Hofmeyr1-0/+16
After subchan_demux.c in libosmo-abis, osmo-bts/common/vty.c and openbsc's gtphub_test.c, more places would like to count the llist items (mostly unit tests). Instead of proliferating numerous local implementations, add here. NOTE: other than the previous llist_len() implementations, this one returns an *unsigned* length, which might need some adjusting of current callers. Call this llist_count() rather than llist_len() to highlight the fact that this is actively iterating. This also avoids a potential naming conflict when library versions mismatch. Change-Id: Ic49adc7a346f5722bf624d7d3b4a735e4220ae15
2017-01-16logging: remove code duplicationMax1-13/+4
* make DEBUGP* macro into simple wrappers around LOGP* * deprecate unused logp() function Related: OS#71 Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93
2017-01-16CTRL: add write-only helpersMax1-0/+24
Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which are not meant to be read, only to set. Similarly, add CTRL_CMD_DEFINE_WO_NOVRF() for commands which do not perform inbound data verification. Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
2017-01-15bitvec: Ensure bitvec.h and bitvec.c agree on function argument typeHarald Welte1-1/+1
uint32_t may or may not be unsigned int. Change-Id: I21c96985fcbb72372b6df949301c21f1ebca41f2
2017-01-15Always include <osmocom/core/talloc.h> and not <talloc.h>Harald Welte1-1/+1
In EMBEDDED builds we don't have a system-wide talloc Change-Id: Icc526016bda45b36e584afee8669996752d6d89c