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