Common library for all Osmocom projects (libosmocore, libosmogsm, libosmovty, libosmogb, libosmosim, libosmousb, ...) https://osmocom.org/projects/libosmocore
Go to file
Neels Hofmeyr c36e2e4924 fix osmo_escape_str_c() and osmo_quote_str_c()
The osmo_escape_str_c() and osmo_quote_str_c() functions return truncated
results when characters need escaping. For example:

  osmo_quote_str_c(NULL, "foo"); --> "foo"
  osmo_quote_str_c(NULL, "foo\n"); --> "foo\n
  osmo_quote_str_c(NULL, "foo\tbar\t\n"); --> "foo\tbar\t

Implement these _c variants using OSMO_NAME_C_IMPL() to always allocate
sufficient memory.

However, current osmo_escape_str_buf2() and osmo_quote_str_buf2() fail to
return the required buffer size (even though that information is readily
avaiable), so these don't qualify for accurate use of OSMO_NAME_C_IMPL().

Hence, move the implementations of osmo_escape_str and osmo_quote_str to an
internal static function that returns the characters needed, so that all
dynamically allocating implementations can return un-truncated results.

Of course, external callers would also benefit from escape/quote API that
accurately returns the amount of characters needed, but I am not changing
public API in this patch, on purpose, ... yet.

Change-Id: I16c08eced41bf1b7acf6e95f658068ace99ca4c8
2019-11-23 07:58:47 +00:00
contrib configure: Introduce --disable-libsctp and error by default if libsctp not found 2019-10-24 15:56:49 +02:00
debian socket: Introduce API osmo_sock_init2_multiaddr() 2019-10-18 09:21:48 +00:00
doc merge_doc.xsl: move to osmo-gsm-manuals.git 2018-11-12 14:07:05 +01:00
include utils.h: add OSMO_NAME_C_IMPL() macro 2019-11-23 07:58:47 +00:00
m4 logging: Introduce mutex API to manage log_target in multi-thread envs 2019-10-09 14:19:52 +02:00
src fix osmo_escape_str_c() and osmo_quote_str_c() 2019-11-23 07:58:47 +00:00
tests utils.h: add OSMO_NAME_C_IMPL() macro 2019-11-23 07:58:47 +00:00
utils logging: Introduce mutex API to manage log_target in multi-thread envs 2019-10-09 14:19:52 +02:00
.gitignore gitignore: add doc/*.tag.prep 2019-06-28 12:27:30 +00:00
.gitreview add .gitreview 2016-05-19 06:39:13 +00:00
.mailmap Add .mailmap file for mapping mail addresses in shortlog 2016-08-08 13:12:17 +02:00
COPYING add GPL to project source 2010-02-21 09:21:30 +01:00
Doxyfile.codec.in Set HTML_TIMESTAMP to NO to make build reproducible 2019-07-17 11:03:44 +00:00
Doxyfile.coding.in doxygen: enable cross referencing everywhere 2019-02-04 16:43:57 +00:00
Doxyfile.core.in Set HTML_TIMESTAMP to NO to make build reproducible 2019-07-17 11:03:44 +00:00
Doxyfile.ctrl.in doxygen: enable cross referencing everywhere 2019-02-04 16:43:57 +00:00
Doxyfile.gb.in doxygen: enable cross referencing everywhere 2019-02-04 16:43:57 +00:00
Doxyfile.gsm.in Set HTML_TIMESTAMP to NO to make build reproducible 2019-07-17 11:03:44 +00:00
Doxyfile.vty.in Set HTML_TIMESTAMP to NO to make build reproducible 2019-07-17 11:03:44 +00:00
Makefile.am Makefile.am: don't delete example.xml, vtydoc.xsd 2019-06-28 12:27:30 +00:00
README.md README.md: Make sure all hyperlinks use <> 2017-03-17 21:31:42 +01:00
TODO-RELEASE GPRS/BSSGP: introduce bssgp_bvc_ctx_free() 2019-11-09 02:14:50 +07:00
configure.ac configure: Introduce --disable-libsctp and error by default if libsctp not found 2019-10-24 15:56:49 +02:00
git-version-gen add git-version-gen magic to automatically generate package version 2010-03-23 00:30:19 +08:00
libosmocodec.pc.in codec: Add the missing bits for include to install and pkgconfig to work 2010-10-24 18:23:10 +02:00
libosmocoding.pc.in libosmocoding: migrate transcoding routines from OsmoBTS 2017-03-07 01:06:38 +07:00
libosmocore.pc.in libosmocore.pc.in: Append -lsctp to Libs.private 2019-10-22 16:09:05 +02:00
libosmoctrl.pc.in remove our internal copy of talloc, use system libtalloc 2015-12-05 23:38:18 +01:00
libosmogb.pc.in remove our internal copy of talloc, use system libtalloc 2015-12-05 23:38:18 +01:00
libosmogsm.pc.in remove our internal copy of talloc, use system libtalloc 2015-12-05 23:38:18 +01:00
libosmosim.pc.in remove our internal copy of talloc, use system libtalloc 2015-12-05 23:38:18 +01:00
libosmovty.pc.in remove our internal copy of talloc, use system libtalloc 2015-12-05 23:38:18 +01:00
osmo-release.mk Fixup severe build performance issues 2017-10-04 16:26:37 +02:00
osmo-release.sh osmo-release.sh: update TODO-RELEASE for non-lib projects too 2019-09-20 15:11:03 +00:00

README.md

libosmocore - set of Osmocom core libraries

This repository contains a set of C-language libraries that form the core infrastructure of many Osmocom Open Source Mobile Communications projects.

Historically, a lot of this code was developed as part of the OpenBSC project, but which are of a more generic nature and thus useful to (at least) other programs that we develop in the sphere of Free Software / Open Source mobile communications.

There is no clear scope of it. We simply move all shared code between the various Osmocom projects in this library to avoid code duplication.

The libosmcoore.git repository build multiple libraries:

  • libosmocore contains some general-purpose functions like select-loop abstraction, message buffers, timers, linked lists
  • libosmovty contains routines related to the interactive command-line interface called VTY
  • libosmogsm contains definitions and helper code related to GSM protocols
  • libosmoctrl contains a shared implementation of the Osmocom control interface
  • libosmogb contains an implementation of the Gb interface with its NS/BSSGP protocols
  • libosmocodec contains an implementation of GSM voice codecs
  • libosmocoding contains an implementation of GSM channel coding
  • libosmosim contains infrastructure to interface SIM/UICC/USIM cards
  • libosmotrau contains encoding/decoding functions for A-bis TRAU frames

Homepage

The official homepage of the project is https://osmocom.org/projects/libosmocore/wiki/Libosmocore

GIT Repository

You can clone from the official libosmocore.git repository using

git clone git://git.osmocom.org/libosmocore.git

There is a cgit interface at http://git.osmocom.org/libosmocore/

Documentation

Doxygen-generated API documentation is generated during the build process, but also available online for each of the sub-libraries at http://ftp.osmocom.org/api/latest/libosmocore/

Mailing List

Discussions related to libosmocore are happening on the openbsc@lists.osmocom.org mailing list, please see https://lists.osmocom.org/mailman/listinfo/openbsc for subscription options and the list archive.

Please observe the Osmocom Mailing List Rules when posting.

Contributing

Our coding standards are described at https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards

We us a gerrit based patch submission/review process for managing contributions. Please see https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for more details

The current patch queue for libosmocore can be seen at https://gerrit.osmocom.org/#/q/project:libosmocore+status:open