summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
Commit message (Collapse)AuthorAgeFilesLines
* endian: Be able to detect endian on GNU and BSDHolger Hans Peter Freyther2015-03-221-0/+38
| | | | | | | | | | | | | | | | | | On GNU __BYTE_ORDER and __LITTLE_ENDIAN is defined and the include is "endian.h" on FreeBSD it is "sys/endian.h" and LITTLE_ENDIAN/_LITTLE_ENDIAN and BYTE_ORDER/_BYTE_ORDER is defined. Create a header file that defines OSMO_IS_LITTLE_ENDIAN and OSMO_IS_BIG_ENDIAN and can be used as #if OSMO_IS_LITTLE_ENDIAN do_little_endian #elif OSMO_IS_BIG_ENDIAN do_big_endian #else #error "Unknown endian" #endif
* core/gsmtap: LTE RRC message types and LTE MAC definealtaf2015-01-181-0/+15
| | | | | Submitted-by: altaf <altaf329@gmail.com> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* bitvec: Fix typo in the csn1 encoding codeHolger Hans Peter Freyther2014-12-281-1/+1
| | | | | We can curse about CSN.1 and 3GPP but I think we want to call it cursor here.
* logging: Make it possible to print category/subsys and timestampsHolger Hans Peter Freyther2014-12-051-0/+6
| | | | | | | | | | | | We want to see from which category/subsystem a certain log message is coming from and use a different timestamp format as well. Add two new bitfields. This doesn't change the size of the structure and on 32bit we still have 27bits left. The extended timestamp will take preference over the current and default timestamp format. Fixes: SYS#602
* gtp: Add a global region for the gtp library of OpenGGSNHolger Hans Peter Freyther2014-12-041-1/+2
| | | | | We want to use libosmocore/libosmovty in the GGSN sourcecode and reserve a global region here.
* sttrb / loggingrb: Use GPLv2+ as license, not AGPLv3+Harald Welte2014-10-262-2/+2
| | | | | according to Holger, using AGPLv3+ at the time was a mistake and the license should always have indicated GPLv2+.
* msgb: make msgb_get() finally work as expectedHarald Welte2014-10-261-1/+1
|
* logging: Add ability to save/print current log filtersHarald Welte2014-08-251-0/+16
| | | | | | This enables the persistent configuration of let's say 'log filter imsi 012345678' for a given log file in the config file.
* Convert recently-introduced header files to #pragma onceHarald Welte2014-08-211-4/+1
|
* libctrl: Add DLCTRL as logging context for the control interfaceHarald Welte2014-08-211-1/+2
| | | | ... and make libctrl code use it
* libctrl: remove reference to bsc_replace_string()Harald Welte2014-08-211-0/+7
| | | | | ... and rather introduce a general osmo_talloc_replace_string() to libosmocore.
* Add osmo_get_macaddr() function to obtain etherent mac addressHarald Welte2014-08-181-0/+1
| | | | | This used to be private in osmo-bts/common/abis.c, where it really didn't belong.
* osmocore: Add function osmo_macaddr_parse() to parse ETH MAC addressHarald Welte2014-08-181-0/+6
|
* core/bitXXgen: Don't do 'return' in functions returning voidSylvain Munaut2014-06-161-2/+2
| | | | | | ISO C forbids 'return' with expression, in function returning void Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* core/bitXXgen: Use explicit cast of void* to uint8_tSylvain Munaut2014-06-161-4/+6
| | | | | | Turns out we use this header in C++ code ... Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* bits: Add left circular shift functionMax2014-06-161-0/+10
| | | | | Submitted-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* core: Add generic LE/BE load/store uint type convertors and use them in msgbMax2014-06-163-10/+121
| | | | | Submitted-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* include: Switch to #pragma once patternSylvain Munaut2014-06-1632-128/+32
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsmtap: add LTE defines to GSMTAP v2Max2014-06-151-1/+10
| | | | | Submitted-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* src/socket: Adding unix domain socket supportÁlvaro Neira Ayuso2014-03-261-0/+6
| | | | | | Added some function for adding the unix domain socket support. Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
* ladpm: Fix msgb handling and SAPI=3 establishment delayJacob Erlbeck2014-03-101-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently it takes 3s to establish a SAPI 3 SACCH connection with osmo-bts. This is due to the fact, that a broken SABME request is sent first and and is ignored by the MS. Then, after a T200 timeout (2s) the SABME command is sent again (this time correctly) and answered by the MS. The first SABME message is broken (it has a length field of 3 and ends with 3 bytes from the tail of the original RSL message), because of it is expected throughout lapdm.c that msg buffers containing RSL have msg->l2h == msg->data. Some abis input drivers fulfill this but IPA doesn't, thus the 3 bytes of the IPA header are still part of the msg and confuse length computation. Since internal fields of the msg are modified directly, this is difficult to see. This patch adds a new function msgb_pull_to_l3() that explicitely skips over all headers prepending L3 and therefore resets l1h and l2h. This function is then used instead of msgb_pull_l2h() which only worked correctly when msg->l2h == msg->data. In addition, code manipulating msg->tail and msg->len directly has been replaced by calls to msgb_trim(). Note that this patch does not fix all issues of this case in the LADP related code. Ticket: SYS#192 Sponsored-by: On-Waves ehf
* msgb: Add msgb_hexdump() functionJacob Erlbeck2014-03-041-0/+1
| | | | | | | | | | | | This function works like osmo_hexdump() and returns a static buffer containing hex bytes along with markers for the layers. Note that it uses osmo_hexdump() internally, thus a call to msgb_hexdump() invalidates the buffer that has been returned by an earlier call to osmo_hexdump(). In short: don't mix them in a single call printf(). Sponsored-by: On-Waves ehf
* vty: Make vty_event dispatch signals and use it in the testcaseHolger Hans Peter Freyther2013-10-101-0/+1
| | | | | | | | | The testcase didn't work on Ubuntu 12.04 because vty_create will directly call vty_event (e.g. not through the plt). This means that the approach to override vty_event in the testcase failed. Use the signal interface of libosmocore and make the testcase use it. The signals can be generally useful as well.
* core: Remove defined() check for OSMO_DEPRECATEJacob Erlbeck2013-08-151-11/+5
| | | | | | | | This reverts commit bf991bc0f3006eddf45d494ee7e476a75dbaf36e and fixes the bug instead. It's just sufficient to remove the defined() test, since identifiers that aren't macros are just considered as 0 when used with #if. (see cpp info page, section 4.2.2 'If' in cpp-4.6.info)
* core: Fix-up the OSMO_DEPRECATED for older compilersHolger Hans Peter Freyther2013-08-141-3/+9
| | | | | | | The code started to use #if defined(...) but the value was always for GCC/Clang. The only difference was that for older compilers the value of the definition was 0. Conditionally define these macros.
* core: Support clang with OSME_DEPRECATEDJacob Erlbeck2013-08-141-4/+15
| | | | | Separate feature checking from implementation. Supported are clang and gcc.
* core: Move OSMO_DEPRECATED to new core/defs.h fileJacob Erlbeck2013-08-141-0/+39
| | | | | | | | | | Add a new core/defs.h file for definitions that can be used from within header files without including prototypes and extern declarations. It's primarily meant for macro definitions and basic typedefs. Move the definition of OSMO_DEPRECATED there and use compiler version info to avoid compiler errors.
* utils.h: we need to include utils.h for osmo_generate_backtrace()Harald Welte2013-07-061-0/+2
| | | | | this causes compiler warnings in user code ever since commit 55cf02221f0654a3f48888f3b13766b671a120f0
* misc: Fix compiler warnings about the static_assert macro with gcc 4.8Holger Hans Peter Freyther2013-07-011-1/+1
| | | | | | | | | | | | | The modified macro is still working on a gcc 4.7 and gcc 4.8 after the removal of the typedef and addition of the unused attribute. include/osmocom/core/msgb.h: In function ‘msgb_alloc_headroom’: include/osmocom/core/utils.h:40:51: warning: typedef ‘dummyheadroom_bigger’ locally defined but not used [-Wunused-local-typedefs] #define osmo_static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; ^ include/osmocom/core/msgb.h:386:2: note: in expansion of macro ‘osmo_static_assert’ osmo_static_assert(size > headroom, headroom_bigger); ^
* utils: Use fprintf to print the assertion and generate a backtraceKaterina Barone-Adesi2013-03-251-1/+2
| | | | | | | | | This is changing the semantic of the assert. The regression tests now either need to check the stderr result, the exit status or print a message when all tests are completed. This is not that bad as the osmo_generate_backtrace is printing to the stdout right now.
* logging: add new log_targets_reopen() functionHarald Welte2013-03-181-0/+1
| | | | | This function will re-open all existing log files in the application, praticularly useful for SIGHUP handlers in case of logrotate
* utils: Introduce OSMO_ASSERT in the utils and use it in the unit testsKaterina Barone-Adesi2013-03-091-0/+7
| | | | | The tests should unconditionally assert, regardless of debug settings. This uses the OSMO_ prefix as it's in the global namespace.
* Added a ring buffer log target to store the last N log messages.Katerina Barone-Adesi2013-02-273-0/+103
| | | | | | | The log target can be used via log alarms and show alarms. Why? This feature was proposed/requested at http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget All messages use the same amount of space, prioritizing simplicity.
* Revert "Added a ring buffer log target to store the last N log messages."Holger Hans Peter Freyther2013-02-273-103/+0
| | | | | | | I noticed some more issues and it is the easiest to revert and include the fixed version. This reverts commit 73377229bb33ab79682ce4b126a63602d13304ad.
* Added a ring buffer log target to store the last N log messages.Katerina Barone-Adesi2013-02-273-0/+103
| | | | | | | The log target can be used via log alarms and show alarms. Why? This feature was proposed/requested at http://openbsc.osmocom.org/trac/wiki/Tasks/ErrorLogTarget All messages use the same amount of space, prioritizing simplicity.
* Add UMTS RRC message typesTobias Engel2013-02-211-0/+68
|
* misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi2013-02-159-9/+13
| | | | | Doxygen generates quite a lot of warnings on libosmocore. Some of them are obvious typos - this patch aims to fix such low-hanging fruit.
* msgb: fix msgb_pull_u*()Steve Markgraf2012-11-141-3/+3
| | | | | | | | msgb_pull returns a pointer to the new begin of the buffer, unlike msgb_get(), where those functions were originally taken from. Signed-off-by: Steve Markgraf <steve@steve-m.de>
* logging: Introduce a print_filename flag for the logtargetHolger Hans Peter Freyther2012-09-111-0/+3
| | | | | | Introduce a print_filename attribute for each logtarget. Initialize it with 1 to be backward compatible with earlier versions. The bit is taken from an existint bitfield. There were at least six bits left of the byte.
* logging: Mark the log_info_cat pointer as constsHolger Hans Peter Freyther2012-09-111-1/+1
| | | | | | Applications should keep the log area in a static const area. Mark the pointer as const to address compiler warnings in OpenBSC, cast the const away for the osmo_log_info as it is not declared as const.
* msgb: msgb_get() is supposed to get bytes from END, msgb_pull() from HEADHarald Welte2012-09-081-3/+34
| | | | | | msgb_get() has been wrong all the time, despite the documentation being correct. If you've used the broken msgb_get() before, you have to change your code now, sorry.
* gsmtap: add minimal support for encapsulating UMTS RRC in GSMTAPHarald Welte2012-09-021-0/+7
|
* utils: Change semantic of OSMO_MAX/OSMO_MIN to match semantic of a functionHolger Hans Peter Freyther2012-08-151-2/+2
| | | | | | | Add parentheses around the OSMO_MAX and OSMO_MIN macro to match the behaviour of calling a function. The current version does not evaluate to what is expected. (OSMO_MAX(3, 2) + 13) currently results in 3 and not 16.
* backtrace: Add a variant that uses the libosmocore logging frameworkHarald Welte2012-07-141-0/+1
| | | | | | I recently discovered that we can only print backtraces to stdout, which is of course useless in a daemon environment. We'd rather want to use the libosmocore logging framework instead.
* timer: Add function osmo_timer_remaining() to determine remainign timeHarald Welte2012-07-131-1/+3
|
* logging: Fix compile breakage introduced by the warning fixesHolger Hans Peter Freyther2012-07-121-1/+1
| | | | | | | | | | | | Make sure the declaration and definition match, add const to the functions called by logp/logp2. Compile output: logging.c:317: error: conflicting types for 'logp' ../include/osmocom/core/logging.h:34: note: previous declaration of 'logp' was here logging.c:327: error: conflicting types for 'logp2' ../include/osmocom/core/logging.h:168: note: previous declaration of 'logp2' was here make[3]: *** [logging.lo] Error 1
* logging: Avoid compiler warnings when compiling c++ codeAndreas Eversberg2012-07-101-2/+2
| | | | | | this patch i use to suppress warnings when compiling osmo-pcu (c++). since __FILE__ is constant, the called logging function with parameter "file" must be constant too, in order to avoid compiler warnings.
* build: simplify headers management and remove recursionDiego Elio Pettenò2012-06-301-31/+0
| | | | | | | | | | | | There is no real reason to keep the include directory a multi-level recursion, so instead declare everything within include (so that we can use proper nobase_ declarations) and be it. Please note that since we removed the sub-Makefile.am, ./configure will not create the directory structure for us on out-of-tree builds, so we have to make sure the directory we're generating to exists first. Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
* linuxrbtree: don't use 'new' as argument name to avoid C++ incompatibilityHarald Welte2012-06-181-1/+1
|
* signal: add SS_L_NS as a signal subsystem for NS code in libosmo-gbHarald Welte2012-06-161-0/+1
|