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