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