summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
Commit message (Collapse)AuthorAgeFilesLines
* add osmo_fd_setup() convenience function to fill-in osmo_fdHarald Welte2017-08-121-0/+4
| | | | | | | | This basically follows the concept of osmo_timer_setup() and allows the caller to fill-in all configurable fields of osmo_fd in one line of code, rather than open-coding it in 5 lines everywhere. Change-Id: I6dbf19ea22fd65302bfc5424c10418d1b7939094
* Rename GSMTAP_CHANNEL_PDCH to GSMTAP_CHANNEL_PDTCHHarald Welte2017-07-291-1/+3
| | | | | | | PDCH is the physical channel, while actually we want to talk about PDTCH the logical channel. Introduce backwards compatibility define. Change-Id: Id6782d2247846e2db29fc58d98684970a66db948
* add DLMGCP logging category for libosmo-mgcpNeels Hofmeyr2017-07-181-1/+2
| | | | | | | In the course of splitting up the openbsc.git repository, we will create libosmo-mgcp and need a library logging category for that purpose. Change-Id: I09c587e2d59472cbde852d467d457254746d9e67
* socket: Add new OSMO_SOCK_F_NO_MCAST_ALL optionHarald Welte2017-07-131-0/+2
| | | | | | | Using this option at socket creation, the caller can request disabling the IP_MULTICAST_ALL socket option. Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
* socket: Allow disabling multicast loop on socket creationHarald Welte2017-07-131-0/+2
| | | | | | | | | | | This introduces a new flag OSMO_SOCK_F_NO_MCAST_LOOP, which can be used to disable the looping back of multicast packets transmitted throug this socket to other local sockets on the machine. As this looping-back is active by default, a single option to deviate from the default is deemed sufficient. Change-Id: I24a5b1ebc3f84d2d5d4734e54df50efaea26490b
* socket.c: Add multicast related convenience functionsHarald Welte2017-07-131-0/+6
| | | | Change-Id: Id703e7a7a1e065181a4c76c088b8dcc1b7fe15a2
* select: Add new osmo_fd_close() functionHarald Welte2017-07-131-0/+1
| | | | | | | | | This is a convenience helper that will both close a fd, mark it as closed and unregister it from the event loop abstraction. In most cases, you probably actually want to use it instead of manually closing and calling osmo_fd_unregister(). Change-Id: Icd0933eed6a24edde7cdcb378e138897ecc5332c
* gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNELHarald Welte2017-07-131-0/+3
| | | | Change-Id: Iaf8a99912f42a56ef785a1642e18238c0b67cf68
* gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap()Harald Welte2017-07-131-0/+1
| | | | Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25
* Add pseudo-random bit sequence generator to libosmcooreHarald Welte2017-07-101-0/+25
| | | | | | | These PRBS sequences are specified in ITU-T O.150. They are typically used as test data to be transmitted for BER (bit error rate) testing. Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
* Deprecate wrappers around loglevel_strsMax2017-07-081-2/+2
| | | | | | | | Add deprecation notice for public API use: it shouldn't be used outside of libosmocore anyway. Change-Id: I792e30dc44f027fd94e1f65af19fe08bac52b95c Related: OS#71
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-2338-163/+115
| | | | | | | | | | | | | | | | | 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: various fixes in core/timer.hNeels Hofmeyr2017-06-231-19/+16
| | | | | | | | | | | | Move a longish comment to the timer group so that it appears in the API doc. Un-doxygen some floating comments that were associated with unrelated code items ('/**' --> '/*'). Add braces to some function names so that the API doc will render as reference links. Change-Id: I3ea5b88cbe9cb54702429158bf47e768e04e8fe7
* api doc typo fix in core/logging.hNeels Hofmeyr2017-06-231-1/+1
| | | | Change-Id: I3f1cd5b10e7beccb61f370d7f8fa2666e56542cf
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-2329-400/+400
| | | | | | | | | | 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
* Move NUM_BYTES macro to core libraryMax2017-06-191-0/+2
| | | | | | | | | It's universally useful so it make sense to have it in the shared core: * move macro from libosmocoding to libosmocore * add OSMO_ prefix * add doxygen docs Change-Id: I5386ba3e1f1cc153ba96c29dc71c9075a052aa02
* Fix compilation warning on deprecated macroPau Espin Pedrol2017-06-182-2/+8
| | | | | | | | | A warning was printed even if the deprecation didn't apply to libosmocore because it is still allowed to use it internally. This patch fixes this case while still printing a warning if external projects build using libosmocore headers. Change-Id: I32212f20756f828af1017482a71e29e4b3adbad4
* update/extend doxygen documentationHarald Welte2017-06-121-7/+1
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* socket: Add osmo_sock_init2_ofd() functionPau Espin Pedrol2017-05-261-0/+4
| | | | | | Will be used by osmo-bts-trx Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
* sercomm: More API documentationHarald Welte2017-05-171-1/+27
| | | | Change-Id: I5d5002ceedd10e10d772693478f4f9cab6b1290a
* sercomm: Better integration of driver interfaceHarald Welte2017-05-171-6/+7
| | | | | | | | | We cannot assume a certain UART API like uart_baudrate() which only exists in OsmocomBB. Rather, use generic function prototypes (sercomm_drv_*) which are to be provided by the application / environment to the sercomm core. Change-Id: I01ea3067baf1791000c1a7d537ccce496a1ab1ee
* sercomm: Include in libosmocore MakefileHarald Welte2017-05-171-1/+1
| | | | Change-Id: If9d50d634381f43b2c67b97fea36a462a66e4559
* sercomm: remove unrequired helper functionsHarald Welte2017-05-171-2/+0
| | | | | | | | osmo_sercomm_{bind,get}_uart() are not really needed anymore, as sercomm_inst is public and thus the user can access the uart_id member directly. Change-Id: I6d57709c3764036046202f16a26c9eb87426c8d1
* sercomm: Move HDLC related defines into C fileHarald Welte2017-05-171-7/+0
| | | | | | | Those values are not relevant to the sercomm user, only to the implementation and thus can remain inside sercomm.c Change-Id: I5700a45985b7c119c6338932171aae62ee4e2d22
* sercomm: Add doxygen-style documentation to public APIHarald Welte2017-05-171-10/+19
| | | | Change-Id: I2d8b11905692920d328262836420f01305be489e
* sercomm: make rx msg size configurable per instanceHarald Welte2017-05-171-0/+1
| | | | Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
* sercomm: introduce osmo_ naming prefix in struct and function namesHarald Welte2017-05-171-14/+14
| | | | Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
* sercomm: Enable multiple instances of 'sercomm'Harald Welte2017-05-171-11/+36
| | | | | | | | Rather than having one global instance, let's permit multiple instances of sercomm to co-exist, with all API functions extended by the instance as first argument. Change-Id: I0f3b53f464b119d65747bcb0be0af2d631e1cc05
* Import sercomm.c from osmocom-bbHarald Welte2017-05-171-0/+61
| | | | | | | | | This imports the file src/target/firmware/comm/sercomm.c from osmocom-bb.git without introducing any modifications. It will not even be built yet, as Makefile integration is intentionally left until it has been adapted to work inside libosmocore. Change-Id: I9ee199381c7b5986a9540d124836cdddd0f66c86
* stats: Disable stats*.c on embedded targetsHarald Welte2017-05-151-0/+10
| | | | Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401
* introduce byteswap.h with osmo_{htonl,ntohl,htons,ntohs}Harald Welte2017-05-151-0/+43
| | | | | | | | We need to have an architecture-independend way of endian conversion / byte swapping functions which will also work on embedded (bare iron) builds. Let's introduce osmocom/core/bytesawp.h for this purpose. Change-Id: Ibc0cc1e36d4ed63a35cf8ceff3af0f26e5ac7a3d
* endian.h: Make it work on 'bare iron' builds (and possibly more platforms)Harald Welte2017-05-151-1/+13
| | | | | | | We can use __BYTE_ORDER__ which seems to be defined by both gcc and clang/llvm. Change-Id: Id6821c99e88242126d9697099b1dd92c6212526a
* timer: add osmo_timer_setup()Pablo Neira Ayuso2017-05-091-0/+2
| | | | | | | | | | | | | | | Add a new function timer function to set up the timer, similar to what we have in the Linux kernel. This patch also converts existing opencoded timer setup in the libosmocore tree as initial client of this new function. This patch implicitly removes function callback passed by reference that defeat compile time type validation. Compile-tested only, but I ran make check that reports success when testing timer infrastructure. Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
* vty: cleanup logging functionsMax2017-05-091-2/+2
| | | | | | | | | | | | * remove unused parameter from logging_vty_add_cmds() * mark log level descriptors static * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * deprecate log_vty_command_*() from public API as it should only be used by logging_vty_add_cmds() Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Related: OS#71
* osmo_fsm: Lookup functions to find FSM Instance by name or IDHarald Welte2017-04-161-0/+4
| | | | | | | Introduce two lookup helper functions to resolve a fsm_instance based on the FSM and name or ID. Also, add related test cases. Change-Id: I707f3ed2795c28a924e64adc612d378c21baa815
* msgb: Add msgb_pull_to_l2() analogous to msgb_pull_to_l3()Harald Welte2017-04-151-0/+15
| | | | | | | Introduce msgb_pull_to_l2() which pulls (removes) any msgb contents in front of the L2 header (msg->l2h). Change-Id: I7786a1b30f9e7eaa3dcdb3cbb2a85a126588f6cd
* Add osmo_sock_init2() function, allowing both BIND *and* CONNECTHarald Welte2017-04-091-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
* Add struct osmo_prim_event_map and osmo_event_for_prim()Harald Welte2017-04-091-0/+14
| | | | | | This can be used to map from an osmo_prim to an osmo_fsm event. Change-Id: I52350f4ebe97811b2a692e5a69a2cd39a853583c
* logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtranHarald Welte2017-04-031-1/+5
| | | | Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
* fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()Neels Hofmeyr2017-03-151-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
* linuxlist.h: add llist_first/last_entry macrosNeels Hofmeyr2017-03-151-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
* fsm: convenience: add inline osmo_fsm_inst_state_name()Neels Hofmeyr2017-03-011-0/+4
| | | | Change-Id: If9a6ecc4d6e2beaf716569e9a6053d73488e860b
* logging.h: fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2017-02-231-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
* logging.h: fixup: add API doc for logging enums recently addedNeels Hofmeyr2017-02-231-0/+5
| | | | Change-Id: Ic459b04219abe70171c8f80ed09df53d412dcfb2
* logging.h: fix backwards compat broken by recent commitNeels Hofmeyr2017-02-231-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
* logging: centrally define ctx and filter indexesNeels Hofmeyr2017-02-221-2/+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
* select: add functionality to check socket statePhilipp Maier2017-02-071-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
* socket: Introduce function to obtain socket nameHarald Welte2017-01-271-0/+2
| | | | | | | Using this function, one can obtain a human-readable string identifying the host and port names of the socket. Change-Id: Ib5de5c7b9effe1b0a363e4473a7be7fa38ca6ef3
* utils.h: #include <stdio.h> as we use fprintf()Harald Welte2017-01-231-0/+1
| | | | Change-Id: I911c7f4bcadde414ce0b384e13a3a9a4a953e2fb
* linuxlist.h: add llist_count()Neels Hofmeyr2017-01-211-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