Project

General

Profile

Libosmocore » History » Version 8

laforge, 02/19/2016 10:49 PM

1 1 laforge
[[PageOutline]]
2
= libosmocore =
3
4
libosmocore is a library with various utility functions that were originally developed as part of 
5
the [wiki:OpenBSC] project, but which are of a more generic nature and thus useful to (at least)
6 8 laforge
other programs that we develop in the sphere of Free Software / Open Source mobile communications.
7 1 laforge
8
There is no clear scope of it.  We simply move all shared code between [wiki:OsmocomBB] and [wiki:OpenBSC]
9
in this library to avoid code duplication.
10
11
== Obtaining it ==
12
13
When you download and build [wiki:OsmocomBB], then libosmocore is automatically part of the package,
14
no special action is required.
15
16
If you want to obtain a standalone version of libosmocore, you can use the following git URL:
17 5 laforge
18 1 laforge
{{{git clone git://git.osmocom.org/libosmocore.git}}}
19
20 7 tsaitgaist
== Compiling and installing it ==
21
22
To compile and install it as standalone:
23
24
{{{
25
cd libosmocore/
26
autoreconf -i
27
./configure
28
make
29
sudo make install
30
cd ..
31
}}}
32
33 1 laforge
== Licensing ==
34
35
This library is GPL licensed, as the code is taken from the similarly GPL-licensed OpenBSC codebase.
36
37
This means you '''cannot use this library from non-GPL licensed code without infringing copyright!
38
39
== Features ==
40
41
=== Select loop abstraction ===
42
This is implemented in select.[ch] and enables you to build complex asynchronous/non-blocking I/O
43
programs in a single thread.
44
45
=== Message buffer handling ===
46
Inspired by the Linux kernel {{{struct sk_buff}}}, this is our message buffer {{{struct msgb}}}
47
implementation.  It provides handling of packet buffers, putting them in queues, prepending
48
and appending data to it, etc.
49
50
=== Bitvector ===
51
A convenient set of routines to deal with bit-vectors in C.  This was originally written
52
for rest-octet parsing.
53
54
=== TLV handling ===
55
The GSM Layer3 and above are full of TV / TLV / TL16V and other data fields.  Our implementation
56
provides parser and generator functions, tightly coupled to {{{struct msgb}}}
57
58
=== Timers ===
59
Provides a timer core where you can register timers with a callback function. The function
60
is called when the timer expires.
61
62
=== Comp128v1 ===
63
A Comp128v1 implementation by Sylvain Munaut is included.
64
65 6 laforge
=== Rate Counter ===
66
Provides infrastructure for maintaining ''rate counters'', i.e. counters that can be incremented
67
and will also keep track of the rate of events per second, minute, hour and day.  A group of rate
68
counters is defined as an abstract ''class'', from which you can then allocate instances.  The
69
''class'' description includes information about the counter names.
70
71
72 3 laforge
=== Protocol helper code ===
73 1 laforge
74 3 laforge
==== GSM utils ====
75
 * conversion functions for ARFCN, RxLevel, 7bit GSM character set, power level, frame numbers, ...
76
77
==== GSM 04.08 ====
78
 * extensive header files for the GSM 04.08 (Layer 3 RR/MM/CC) messages
79
 * TLV parser definitions to parse the optional IEs
80
 * utility functions such as
81
  * human readable strings for RR cause names
82
  * converting GSM Mobile Identities (MI) to string and back
83
 * encoding and decoding functions for call control IEs
84
85 6 laforge
==== GSM 08.08 (A Interface) ====
86
 * API to wrap 04.08 messages in BSSMAP/DTAP message
87
 * TLV parser definitions
88
89 4 laforge
==== GSM 08.58 (A-bis RSL) ====
90 3 laforge
 * header file with structure and enum definitions for GSM 08.58 protocol
91
 * TLV parser definitions for RSL optional IEs
92 1 laforge
 * human readable strings for RSL Error values and RLM cause values
93 4 laforge
 * encoding and decoding of RSL channel number
94
95
==== GSM 12.21 (A-bis OML) ====
96
 * header file with structure and enum definitions for GSM 12.21 (and 08.59) protocol
97 3 laforge
98
==== GSM 04.11 (SMS) ====
99 1 laforge
 * header file with structure and enum definitions for GSM 04.11 (SMS RP and CP layers) protocol
100 3 laforge
101 1 laforge
=== Talloc memory allocator ===
102 6 laforge
The talloc memory allocator from the Samba project is (optionally) part of libosmocore.
103
It provides hierarchical memory allocation and extensive debugging features such as dumping
104
the currently allocated objects (at runtime) to the console.
105 1 laforge
106
=== Logging framework ===
107 6 laforge
A generic logging implementation, supporting a dynamic number of 'log targets', understanding
108
the notion of log levels and log categories.  Filtering based on levels and categories is
109
implemented in the core, while context-specific filtering can be implemented by the application
110
using libosmocore.
111 3 laforge
 * logging with various log levels for various subsystems inside the application
112
 * logging to stderr, syslog or application-defined targets
113
 * runtime reconfigurable per-subsystem log levels
114
 * timestamping of log lines
115
 * colorized log output
116
117
=== Write Queue ===
118
119
This is a write queue implementation on top of libosmocore's select loop abstraction.
120
It allows you to simply say "write this msg_buff to this file descriptor as soon as
121
the file descriptor is writable".
122 2 laforge
123
== Development Cycle ==
124
125
As we are still developing the GSM protocol stacks on the network side (OpenBSC) and phone side (OsmocomBB),
126
every so often there is a need to add some new code to libosmocore.  Even worse, we sometimes need to break
127
the API and ABI of the library.
128
129
However, by keeping libosmocore in a separate git repository, we run into one problem: Checking out an old
130
version of e.g. OpenBSC or OsmocomBB will result in failed builds, as we don't remember which old version
131
of libosmocore was required.  This makes debugging and things like git bisect very hard to impossible.
132
133
In order to solve this problem, we use [http://github.com/apenwarr/git-subtree git-subtree] to import the
134
full libosmocore.git repository into OsmocomBB.
135
136
This way, we ensure that there is always a compatible version of libosmocore inside the tree if we check out
137
old OsmocomBB versions from git.
138
139
=== Making changes to libosmocore ===
140
141
 '''NEVER COMMIT CHANGES DIRECTLY TO osmocom-bb.git:src/shared/libosmocore'''
142
143
Instead, use the following process:
144
 1. make your changes to your local copy of libosmocore
145
 1. test them together with OsmocomBB and OpenBSC
146
 1. test if libosmocore still builds for both host and target (ARM)
147
 1. create a ''diff'' of your local libosmocore changes
148
 1. apply that diff to the libosmocore.git repository
149
 1. use the script in osmocom-bb.git/src/shared/update-libosmocore.sh (uses git-subtree) to import your changes from libosmocore.git
150
 1. test + commit your OsmocomBB changes that depend on the newly introduced code to libosmocore
151
152
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)