libosmocore is a library with various utility functions that were originally developed as part of the OpenBSC project, but which are of a more generic nature and thus useful to (at least) other programs that we develop in the sphere of Free Software / Open Source mobile communications.

There is no clear scope of it. We simply move all shared code between the various Osmocom projects in this library to avoid code duplication.

The libosmcoore.git repository build multiple libraries:
  • libosmocore contains some general-purpose functions like select-loop abstraction, message buffers, timers, linked lists
  • libosmovty contains routines related to the interactive command-line interface called VTY
  • libosmogsm contains definitions and helper code related to GSM protocols
  • libosmoctrl contains a shared implementation of the Osmocom control interface
  • libosmogb contains an implementation of the Gb interface with its NS/BSSGP protocols
  • libosmocodec contains an implementation of GSM voice codecs
  • libosmocoding contains an implementation of GSM 05.03 burst transcoding functions
  • libosmosim contains infrastructure to interface SIM/UICC/USIM cards
  • libosmousb contains infrastructure to interface USB devices
  • libosmoisdn contains common code used in various ISDN related projects


To compile libosmocore you will need the following tools:

sudo apt-get install build-essential libtool libtalloc-dev libsctp-dev shtool autoconf automake git-core pkg-config make gcc gnutls-dev python-minimal libusb-1.0.0-dev libmnl-dev

In case this list should become out of date, it is a good idea to check the Build-Depends line of source:debian/control which should always be up-to-date as it is automatically verified.

and the following (optional) libraries:

sudo apt-get install libpcsclite-dev

Obtaining it

To obtain libosmocore, you can use the following git URL:

git clone

Compiling and installing it

To compile and install it as standalone:

cd libosmocore/
autoreconf -i
sudo make install
sudo ldconfig -i
cd ..

to compile without pcsclite library, run

./configure --disable-pcsc


This library is GPL licensed. This means you cannot use this library from non-GPL licensed code without infringing copyright!

API documentation

Browsing its source code

You can do that using our cgit installation at


Select loop abstraction

This is implemented in select.[ch] and enables you to build complex asynchronous/non-blocking I/O
programs in a single thread.

Message buffer handling

Inspired by the Linux kernel struct sk_buff, this is our message buffer struct msgb implementation. It provides handling of packet buffers, putting them in queues, prepending and appending data to it, etc.


A convenient set of routines to deal with bit-vectors in C. This was originally written
for rest-octet parsing.

TLV handling

The GSM Layer3 and above are full of TV / TLV / TL16V and other data fields. Our implementation provides parser and generator functions, tightly coupled to struct msgb


Provides a timer core where you can register timers with a callback function. The function
is called when the timer expires.


A COMP128v1 implementation by Sylvain Munaut and COMP128v23 is included.

Rate Counter

Provides infrastructure for maintaining rate counters, i.e. counters that can be incremented
and will also keep track of the rate of events per second, minute, hour and day. A group of rate
counters is defined as an abstract class, from which you can then allocate instances. The
class description includes information about the counter names.

Protocol helper code

GSM utils

  • conversion functions for ARFCN, RxLevel, 7bit GSM character set, power level, frame numbers, ...

GSM 04.08

  • extensive header files for the GSM 04.08 (Layer 3 RR/MM/CC) messages
  • TLV parser definitions to parse the optional IEs
  • utility functions such as
    • human readable strings for RR cause names
    • converting GSM Mobile Identities (MI) to string and back
  • encoding and decoding functions for call control IEs

GSM 08.08 (A Interface)

  • API to wrap 04.08 messages in BSSMAP/DTAP message
  • TLV parser definitions

GSM 08.58 (A-bis RSL)

  • header file with structure and enum definitions for GSM 08.58 protocol
  • TLV parser definitions for RSL optional IEs
  • human readable strings for RSL Error values and RLM cause values
  • encoding and decoding of RSL channel number

GSM 12.21 (A-bis OML)

  • header file with structure and enum definitions for GSM 12.21 (and 08.59) protocol

GSM 04.11 (SMS)

  • header file with structure and enum definitions for GSM 04.11 (SMS RP and CP layers) protocol

talloc memory allocator

The talloc memory allocator from the Samba project was part of libosmocore, but has meanwhile been made an external dependency. It provides hierarchical memory allocation and extensive debugging features such as dumping the currently allocated objects (at runtime) to the console.

Logging framework

A generic logging implementation, supporting a dynamic number of 'log targets', understanding the notion of log levels and log categories. Filtering based on levels and categories is implemented in the core, while context-specific filtering can be implemented by the application using libosmocore.
  • logging with various log levels for various subsystems inside the application
  • logging to stderr, syslog or application-defined targets
  • runtime reconfigurable per-subsystem log levels
  • timestamping of log lines
  • colorized log output

Write Queue

This is a write queue implementation on top of libosmocore's select loop abstraction.
It allows you to simply say "write this msg_buff to this file descriptor as soon as
the file descriptor is writable".

Commercial Support

Commercial support as well as development, system integration and training services for this project are available from sysmocom

Files (0)

Updated by fixeria about 1 year ago ยท 33 revisions

Add picture from clipboard (Maximum size: 48.8 MB)