Project

General

Profile

Libosmocore » History » Version 19

laforge, 10/11/2017 08:04 AM
add libosmocodec, libosmocoding and libosmogb doxygen links

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
* *libosmosim* contains infrastructure to interface SIM/UICC/USIM cards
17
* *libosmotrau* contains encoding/decoding functions for A-bis TRAU frames
18 1 laforge
19 12 tsaitgaist
20 15 fixeria
h2. Preconditions 
21
22
To compile libosmocore you will need the following tools:
23 1 laforge
24
<pre>
25 16 laforge
sudo apt-get install build-essential libtool libtalloc-dev shtool autoconf automake git-core pkg-config make gcc
26
</pre>
27 12 tsaitgaist
28 15 fixeria
and the following (optional) libraries:
29 1 laforge
<pre>
30 16 laforge
sudo apt-get install libpcsclite-dev
31
</pre>
32 15 fixeria
33
h2. Obtaining it
34 5 laforge
35 1 laforge
To obtain libosmocore, you can use the following git URL:
36 15 fixeria
37 7 tsaitgaist
<pre>
38 16 laforge
git clone git://git.osmocom.org/libosmocore.git
39
</pre>
40 15 fixeria
41
h2. Compiling and installing it
42
43 1 laforge
To compile and install it as standalone:
44
<pre>
45
cd libosmocore/
46
autoreconf -i
47 15 fixeria
./configure
48 1 laforge
make
49
sudo make install
50 7 tsaitgaist
sudo ldconfig -i
51 1 laforge
cd ..
52 15 fixeria
</pre>
53 1 laforge
54
to compile without pcsclite library, run
55 15 fixeria
<pre>
56 16 laforge
./configure --disable-pcsc
57
</pre>
58 15 fixeria
59
60 1 laforge
h2. Licensing
61
62
This library is GPL licensed. This means you *cannot use this library from non-GPL licensed code without infringing copyright!
63 18 laforge
64
h2. API documentation
65
66
* http://ftp.osmocom.org/api/latest/libosmocore/core/html/
67
* http://ftp.osmocom.org/api/latest/libosmocore/codec/html/
68 19 laforge
* http://ftp.osmocom.org/api/latest/libosmocore/coding/html/
69
* http://ftp.osmocom.org/api/latest/libosmocore/gb/html/
70 18 laforge
* http://ftp.osmocom.org/api/latest/libosmocore/gsm/html
71
* http://ftp.osmocom.org/api/latest/libosmocore/vty/html
72
73
h2. Browsing its source code
74
75
You can do that using our cgit installation at http://cgit.osmocom.org/cgit/libosmocore/
76 1 laforge
77
h2. Features
78 15 fixeria
79
h3. Select loop abstraction
80
81 1 laforge
This is implemented in select.[ch] and enables you to build complex asynchronous/non-blocking I/O
82
programs in a single thread.
83
84 15 fixeria
85
h3. Message buffer handling
86
87 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.
88 1 laforge
89
h3. Bitvector
90 15 fixeria
91
A convenient set of routines to deal with bit-vectors in C.  This was originally written
92
for rest-octet parsing.
93 1 laforge
94 15 fixeria
h3. TLV handling
95 1 laforge
96 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@
97 1 laforge
98 15 fixeria
h3. Timers
99
100 1 laforge
Provides a timer core where you can register timers with a callback function. The function
101
is called when the timer expires.
102 15 fixeria
103
h3. COMP128v1-3
104
105
A COMP128v1 implementation by Sylvain Munaut and COMP128v23 is included.
106 3 laforge
107 15 fixeria
108
h3. Rate Counter
109 1 laforge
110
Provides infrastructure for maintaining _rate counters_, i.e. counters that can be incremented
111
and will also keep track of the rate of events per second, minute, hour and day.  A group of rate
112 15 fixeria
counters is defined as an abstract _class_, from which you can then allocate instances.  The
113 1 laforge
_class_ description includes information about the counter names.
114 3 laforge
115 1 laforge
h3. Protocol helper code
116
117 15 fixeria
h4. GSM utils
118 1 laforge
119
* conversion functions for ARFCN, [[RxLevel]], 7bit GSM character set, power level, frame numbers, ...
120 15 fixeria
121 3 laforge
h4. GSM 04.08
122 1 laforge
123 6 laforge
* extensive header files for the GSM 04.08 (Layer 3 RR/MM/CC) messages
124 15 fixeria
* TLV parser definitions to parse the optional IEs
125
* utility functions such as
126
** human readable strings for RR cause names
127
** converting GSM Mobile Identities (MI) to string and back
128
* encoding and decoding functions for call control IEs
129
130
131
h4. GSM 08.08 (A Interface)
132
133
* API to wrap 04.08 messages in BSSMAP/DTAP message
134
* TLV parser definitions
135
136
137
h4. GSM 08.58 (A-bis RSL)
138 1 laforge
139 15 fixeria
* header file with structure and enum definitions for GSM 08.58 protocol
140
* TLV parser definitions for RSL optional IEs
141 1 laforge
* human readable strings for RSL Error values and RLM cause values
142 15 fixeria
* encoding and decoding of RSL channel number
143
144
145
h4. GSM 12.21 (A-bis OML)
146
147
* header file with structure and enum definitions for GSM 12.21 (and 08.59) protocol
148 1 laforge
149 15 fixeria
150
h4. GSM 04.11 (SMS)
151
152 1 laforge
* header file with structure and enum definitions for GSM 04.11 (SMS RP and CP layers) protocol
153 6 laforge
154
155 16 laforge
h3. talloc memory allocator
156 3 laforge
157 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.
158 15 fixeria
159 3 laforge
h3. Logging framework
160
161 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.
162 15 fixeria
* logging with various log levels for various subsystems inside the application
163
* logging to stderr, syslog or application-defined targets
164
* runtime reconfigurable per-subsystem log levels
165
* timestamping of log lines
166 2 laforge
* colorized log output
167 15 fixeria
168
h3. Write Queue
169
170 2 laforge
This is a write queue implementation on top of libosmocore's select loop abstraction.
171
It allows you to simply say "write this msg_buff to this file descriptor as soon as
172
the file descriptor is writable".
173
174 15 fixeria
175
h2. Development Cycle
176 2 laforge
177
As we are still developing the GSM protocol stacks on the network side (OpenBSC) and phone side (OsmocomBB),
178
every so often there is a need to add some new code to libosmocore.  Even worse, we sometimes need to break
179
the API and ABI of the library.
180
181 15 fixeria
However, by keeping libosmocore in a separate git repository, we run into one problem: Checking out an old
182 16 laforge
version of e.g. [[OpenBSC:]] or [[OsmocomBB:]] will result in failed builds, as we don't remember which old version
183 2 laforge
of libosmocore was required.  This makes debugging and things like git bisect very hard to impossible.
184 15 fixeria
185
In order to solve this problem, we use "git-subtree":http://github.com/apenwarr/git-subtree to import the
186 16 laforge
full libosmocore.git repository into [[OsmocomBB:]].
187 2 laforge
188 15 fixeria
This way, we ensure that there is always a compatible version of libosmocore inside the tree if we check out
189 16 laforge
old [[OsmocomBB:]] versions from git.
190 2 laforge
191 15 fixeria
192 1 laforge
h3. Making changes to libosmocore
193 15 fixeria
194
 *NEVER COMMIT CHANGES DIRECTLY TO osmocom-bb.git:src/shared/libosmocore*
195
196 1 laforge
Instead, use the following process:
197
 1. make your changes to your local copy of libosmocore
198 16 laforge
 1. test them together with [[OsmocomBB:]] and [[OpenBSC:]]
199 1 laforge
 1. test if libosmocore still builds for both host and target (ARM)
200 15 fixeria
 1. create a _diff_ of your local libosmocore changes
201 1 laforge
 1. apply that diff to the libosmocore.git repository
202
 1. use the script in osmocom-bb.git/src/shared/update-libosmocore.sh (uses git-subtree) to import your changes from libosmocore.git
203 16 laforge
 1. test + commit your [[OsmocomBB:]] changes that depend on the newly introduced code to libosmocore
204 1 laforge
205
It is important that the steps are followed in the order state above to ensure consistency of our repositories
Add picture from clipboard (Maximum size: 48.8 MB)