Libosmocore » History » Version 5
laforge, 02/19/2016 10:49 PM
formatting
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 | other programs that we develop in the sphere of Open Source mobile communications. |
||
7 | |||
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 | == Licensing == |
||
21 | |||
22 | This library is GPL licensed, as the code is taken from the similarly GPL-licensed OpenBSC codebase. |
||
23 | |||
24 | This means you '''cannot use this library from non-GPL licensed code without infringing copyright! |
||
25 | |||
26 | == Features == |
||
27 | |||
28 | === Select loop abstraction === |
||
29 | This is implemented in select.[ch] and enables you to build complex asynchronous/non-blocking I/O |
||
30 | programs in a single thread. |
||
31 | |||
32 | === Message buffer handling === |
||
33 | Inspired by the Linux kernel {{{struct sk_buff}}}, this is our message buffer {{{struct msgb}}} |
||
34 | implementation. It provides handling of packet buffers, putting them in queues, prepending |
||
35 | and appending data to it, etc. |
||
36 | |||
37 | === Bitvector === |
||
38 | A convenient set of routines to deal with bit-vectors in C. This was originally written |
||
39 | for rest-octet parsing. |
||
40 | |||
41 | === TLV handling === |
||
42 | The GSM Layer3 and above are full of TV / TLV / TL16V and other data fields. Our implementation |
||
43 | provides parser and generator functions, tightly coupled to {{{struct msgb}}} |
||
44 | |||
45 | === Timers === |
||
46 | Provides a timer core where you can register timers with a callback function. The function |
||
47 | is called when the timer expires. |
||
48 | |||
49 | === Comp128v1 === |
||
50 | A Comp128v1 implementation by Sylvain Munaut is included. |
||
51 | |||
52 | 3 | laforge | === Protocol helper code === |
53 | 1 | laforge | |
54 | 3 | laforge | ==== GSM utils ==== |
55 | * conversion functions for ARFCN, RxLevel, 7bit GSM character set, power level, frame numbers, ... |
||
56 | |||
57 | ==== GSM 04.08 ==== |
||
58 | * extensive header files for the GSM 04.08 (Layer 3 RR/MM/CC) messages |
||
59 | * TLV parser definitions to parse the optional IEs |
||
60 | * utility functions such as |
||
61 | * human readable strings for RR cause names |
||
62 | * converting GSM Mobile Identities (MI) to string and back |
||
63 | * encoding and decoding functions for call control IEs |
||
64 | |||
65 | 4 | laforge | ==== GSM 08.58 (A-bis RSL) ==== |
66 | 3 | laforge | * header file with structure and enum definitions for GSM 08.58 protocol |
67 | * TLV parser definitions for RSL optional IEs |
||
68 | * human readable strings for RSL Error values and RLM cause values |
||
69 | 1 | laforge | * encoding and decoding of RSL channel number |
70 | 4 | laforge | |
71 | ==== GSM 12.21 (A-bis OML) ==== |
||
72 | * header file with structure and enum definitions for GSM 12.21 (and 08.59) protocol |
||
73 | |||
74 | ==== GSM 04.11 (SMS) ==== |
||
75 | * header file with structure and enum definitions for GSM 04.11 (SMS RP and CP layers) protocol |
||
76 | 3 | laforge | |
77 | === Talloc memory allocator === |
||
78 | 1 | laforge | The talloc memory allocator from the Samba project. |
79 | 3 | laforge | |
80 | === Logging framework === |
||
81 | This is a generic framework for logging from application programs including the following |
||
82 | features: |
||
83 | * logging with various log levels for various subsystems inside the application |
||
84 | * logging to stderr, syslog or application-defined targets |
||
85 | * runtime reconfigurable per-subsystem log levels |
||
86 | * timestamping of log lines |
||
87 | * colorized log output |
||
88 | |||
89 | === Write Queue === |
||
90 | |||
91 | This is a write queue implementation on top of libosmocore's select loop abstraction. |
||
92 | It allows you to simply say "write this msg_buff to this file descriptor as soon as |
||
93 | the file descriptor is writable". |
||
94 | 2 | laforge | |
95 | == Development Cycle == |
||
96 | |||
97 | As we are still developing the GSM protocol stacks on the network side (OpenBSC) and phone side (OsmocomBB), |
||
98 | every so often there is a need to add some new code to libosmocore. Even worse, we sometimes need to break |
||
99 | the API and ABI of the library. |
||
100 | |||
101 | However, by keeping libosmocore in a separate git repository, we run into one problem: Checking out an old |
||
102 | version of e.g. OpenBSC or OsmocomBB will result in failed builds, as we don't remember which old version |
||
103 | of libosmocore was required. This makes debugging and things like git bisect very hard to impossible. |
||
104 | |||
105 | In order to solve this problem, we use [http://github.com/apenwarr/git-subtree git-subtree] to import the |
||
106 | full libosmocore.git repository into OsmocomBB. |
||
107 | |||
108 | This way, we ensure that there is always a compatible version of libosmocore inside the tree if we check out |
||
109 | old OsmocomBB versions from git. |
||
110 | |||
111 | === Making changes to libosmocore === |
||
112 | |||
113 | '''NEVER COMMIT CHANGES DIRECTLY TO osmocom-bb.git:src/shared/libosmocore''' |
||
114 | |||
115 | Instead, use the following process: |
||
116 | 1. make your changes to your local copy of libosmocore |
||
117 | 1. test them together with OsmocomBB and OpenBSC |
||
118 | 1. test if libosmocore still builds for both host and target (ARM) |
||
119 | 1. create a ''diff'' of your local libosmocore changes |
||
120 | 1. apply that diff to the libosmocore.git repository |
||
121 | 1. use the script in osmocom-bb.git/src/shared/update-libosmocore.sh (uses git-subtree) to import your changes from libosmocore.git |
||
122 | 1. test + commit your OsmocomBB changes that depend on the newly introduced code to libosmocore |
||
123 | |||
124 | It is important that the steps are followed in the order state above to ensure consistency of our repositories |