Project

General

Profile

Libosmocore » History » Version 33

fixeria, 02/25/2023 10:23 AM

1 1 laforge
h1. libosmocore
2 17 laforge
3
{{>toc}}
4 15 fixeria
5 16 laforge
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.
6 1 laforge
7 16 laforge
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.
8 1 laforge
9 16 laforge
The libosmcoore.git repository build multiple libraries:
10
* *libosmocore* contains some general-purpose functions like select-loop abstraction, message buffers, timers, linked lists
11
* *libosmovty* contains routines related to the interactive command-line interface called VTY
12
* *libosmogsm* contains definitions and helper code related to GSM protocols
13
* *libosmoctrl* contains a shared implementation of the Osmocom control interface
14
* *libosmogb* contains an implementation of the Gb interface with its NS/BSSGP protocols
15
* *libosmocodec* contains an implementation of GSM voice codecs
16 20 fixeria
* *libosmocoding* contains an implementation of GSM 05.03 burst transcoding functions
17 16 laforge
* *libosmosim* contains infrastructure to interface SIM/UICC/USIM cards
18 33 fixeria
* *libosmousb* contains infrastructure to interface USB devices
19
* *libosmoisdn* contains common code used in various ISDN related projects
20 12 tsaitgaist
21 15 fixeria
h2. Preconditions 
22
23
To compile libosmocore you will need the following tools:
24 1 laforge
25
<pre>
26 29 laforge
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
27 1 laforge
</pre>
28 29 laforge
29
_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._
30 12 tsaitgaist
31 15 fixeria
and the following (optional) libraries:
32 1 laforge
<pre>
33 16 laforge
sudo apt-get install libpcsclite-dev
34
</pre>
35 15 fixeria
36
h2. Obtaining it
37 5 laforge
38 1 laforge
To obtain libosmocore, you can use the following git URL:
39 15 fixeria
40 7 tsaitgaist
<pre>
41 30 laforge
git clone https://gitea.osmocom.org/osmocom/libosmocore.git
42 16 laforge
</pre>
43 15 fixeria
44
h2. Compiling and installing it
45
46 1 laforge
To compile and install it as standalone:
47
<pre>
48
cd libosmocore/
49
autoreconf -i
50 15 fixeria
./configure
51 1 laforge
make
52
sudo make install
53 7 tsaitgaist
sudo ldconfig -i
54 1 laforge
cd ..
55 15 fixeria
</pre>
56 1 laforge
57
to compile without pcsclite library, run
58 15 fixeria
<pre>
59 16 laforge
./configure --disable-pcsc
60
</pre>
61 15 fixeria
62
63 1 laforge
h2. Licensing
64
65 31 fixeria
This library is GPL licensed. This means you *cannot* use this library from non-GPL licensed code without infringing copyright!
66 18 laforge
67
h2. API documentation
68
69 30 laforge
* https://ftp.osmocom.org/api/latest/libosmocore/core/html/
70
* https://ftp.osmocom.org/api/latest/libosmocore/codec/html/
71
* https://ftp.osmocom.org/api/latest/libosmocore/coding/html/
72
* https://ftp.osmocom.org/api/latest/libosmocore/gb/html/
73 32 fixeria
* https://ftp.osmocom.org/api/latest/libosmocore/gsm/html/
74
* https://ftp.osmocom.org/api/latest/libosmocore/vty/html/
75
* https://ftp.osmocom.org/api/latest/libosmocore/ctrl/html/
76
* https://ftp.osmocom.org/api/latest/libosmocore/isdn/html/
77 18 laforge
78
h2. Browsing its source code
79
80 30 laforge
You can do that using our cgit installation at http://gitea.osmocom.org/osmocom/libosmocore/
81 1 laforge
82
h2. Features
83 15 fixeria
84
h3. Select loop abstraction
85
86 1 laforge
This is implemented in select.[ch] and enables you to build complex asynchronous/non-blocking I/O
87
programs in a single thread.
88
89 15 fixeria
90
h3. Message buffer handling
91
92 16 laforge
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.
93 1 laforge
94
h3. Bitvector
95 15 fixeria
96
A convenient set of routines to deal with bit-vectors in C.  This was originally written
97
for rest-octet parsing.
98 1 laforge
99 15 fixeria
h3. TLV handling
100 1 laforge
101 16 laforge
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@
102 1 laforge
103 15 fixeria
h3. Timers
104
105 1 laforge
Provides a timer core where you can register timers with a callback function. The function
106
is called when the timer expires.
107 15 fixeria
108
h3. COMP128v1-3
109
110
A COMP128v1 implementation by Sylvain Munaut and COMP128v23 is included.
111 3 laforge
112 15 fixeria
113
h3. Rate Counter
114 1 laforge
115
Provides infrastructure for maintaining _rate counters_, i.e. counters that can be incremented
116
and will also keep track of the rate of events per second, minute, hour and day.  A group of rate
117 15 fixeria
counters is defined as an abstract _class_, from which you can then allocate instances.  The
118 1 laforge
_class_ description includes information about the counter names.
119 3 laforge
120 1 laforge
h3. Protocol helper code
121
122 15 fixeria
h4. GSM utils
123 1 laforge
124
* conversion functions for ARFCN, [[RxLevel]], 7bit GSM character set, power level, frame numbers, ...
125 15 fixeria
126 3 laforge
h4. GSM 04.08
127 1 laforge
128 6 laforge
* extensive header files for the GSM 04.08 (Layer 3 RR/MM/CC) messages
129 15 fixeria
* TLV parser definitions to parse the optional IEs
130
* utility functions such as
131
** human readable strings for RR cause names
132
** converting GSM Mobile Identities (MI) to string and back
133
* encoding and decoding functions for call control IEs
134
135
136
h4. GSM 08.08 (A Interface)
137
138
* API to wrap 04.08 messages in BSSMAP/DTAP message
139
* TLV parser definitions
140
141
142
h4. GSM 08.58 (A-bis RSL)
143 1 laforge
144 15 fixeria
* header file with structure and enum definitions for GSM 08.58 protocol
145
* TLV parser definitions for RSL optional IEs
146 1 laforge
* human readable strings for RSL Error values and RLM cause values
147 15 fixeria
* encoding and decoding of RSL channel number
148
149
150
h4. GSM 12.21 (A-bis OML)
151
152
* header file with structure and enum definitions for GSM 12.21 (and 08.59) protocol
153 1 laforge
154 15 fixeria
155
h4. GSM 04.11 (SMS)
156
157 1 laforge
* header file with structure and enum definitions for GSM 04.11 (SMS RP and CP layers) protocol
158 6 laforge
159
160 16 laforge
h3. talloc memory allocator
161 3 laforge
162 16 laforge
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.
163 15 fixeria
164 3 laforge
h3. Logging framework
165
166 16 laforge
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.
167 15 fixeria
* logging with various log levels for various subsystems inside the application
168
* logging to stderr, syslog or application-defined targets
169
* runtime reconfigurable per-subsystem log levels
170
* timestamping of log lines
171 2 laforge
* colorized log output
172 15 fixeria
173
h3. Write Queue
174
175 2 laforge
This is a write queue implementation on top of libosmocore's select loop abstraction.
176 1 laforge
It allows you to simply say "write this msg_buff to this file descriptor as soon as
177 2 laforge
the file descriptor is writable".
178 28 laforge
179 32 fixeria
{{include(cellular-infrastructure:MacroCommercialSupport)}}
Add picture from clipboard (Maximum size: 48.8 MB)