summaryrefslogtreecommitdiffstats
path: root/src/msgb.c
Commit message (Collapse)AuthorAgeFilesLines
* src/msgb.c: avoid using internal talloc APIVadim Yanitskiy2018-03-091-2/+4
| | | | | | | | | | | | | | An internal symbol '_talloc_zero' of talloc library was used during a msgb allocation. This is not actually good because: - it may be removed or modified by talloc developers; - the behaviour may be changed by talloc developers; - it's marked as internal using 'underscore'; - there is public API to do the same. So, let's use the public API. Change-Id: I1080c9071e997944cc0f9fc3716129e9395437ad
* src/msgb.c: print an error if msgb allocation failedVadim Yanitskiy2018-03-091-1/+3
| | | | | | | | | | | | Printing an error message when msgb allocation failed was initially intended, but have been commented out for years. This would facilitate the bug hunting process, especially on embedded platforms with limited resources (e.g. amount of RAM). The GLOBAL logging subsystem with FATAL level is used for printing such messages. Change-Id: I3e2d1beabd6936fc28a1ad664c083ff1698bb644
* src/msgb.c: remove dead includes from OpenBSCVadim Yanitskiy2018-03-081-3/+0
| | | | | | | | The MSGB API is not a part of OpenBSC anymore, so let's remove dead includes, which were probably left here during the migration process. Change-Id: Ief562a6e5b220a84902f95862d67279f953ee726
* src/msgb.c: cosmetic: fix spelling mistakesVadim Yanitskiy2018-03-081-3/+3
| | | | Change-Id: I6b473aadaa22d95f2a8cc87580c638ccd7e531a4
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-0/+2
| | | | | | | | Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
* add function msgb_printf() to print formatted text into msg bufPhilipp Maier2017-10-221-0/+48
| | | | | | | | | | | In ASCII string based protocols it a printf() version that prints directly to the message buffer may be useful. Add function msgb_printf(), make sure that msg buffer bounderies are not exceeded. If the end of the tail buffer is hit, return with an error code. Change-Id: I15e1af68616309555d0ed9ac5da027c9833d42e3
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-2/+3
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-13/+13
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* update/extend doxygen documentationHarald Welte2017-06-121-2/+27
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* msgb: add msgb_talloc_ctx_init(), deprecate msgb_set_talloc_ctx()Neels Hofmeyr2016-09-271-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | So far each and every main() scope creates a msgb talloc context and either passes it to msgb_set_talloc_ctx() or sets tall_msgb_ctx directly (by defining it extern first). Remove some code duplication: add one central function that creates the "msgb" talloc context for all. Most users of msgb employ a talloc_named_const(), but osmo-bts uses a talloc_pool() instead. Offer both ways by means of the pool_size argument, and for both ways make sure the context is called "msgb". Suggest that msgb users should move to this new function: deprecate msgb_set_talloc_ctx(). To be able to do so, include core/defs.h in msgb.h. There's a tradeoff between hiding the msgb talloc context behind API that tries to guess all use cases versus avoiding code dup. This patch opts against code dup and boldly assumes that all future use is covered. Also, the new function suggests to not access tall_msgb_ctx directly, which can be considered a style improvement. It seems that not all main scopes that use msgb actually initialize the msgb ctx. As a fallback for these, explicitly initialize tall_msgb_ctx to NULL. Change-Id: I747fbbf977c4d2c868c8dead64cfc5fd86eb8d4c
* Fix potential segfault in msg_dequeueMax2016-06-231-3/+6
| | | | Change-Id: I06e9c5ba3e00c73a4e52d2583ce3492f236275ce
* Update doxygen annotations in libosmocoreHarald Welte2016-05-051-0/+1
| | | | | This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
* Fix some recently added formats on 64bitNeels Hofmeyr2015-12-241-3/+5
| | | | | 86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise, so let's keep it that way.
* msgb: Let msgb_hexdump be more tolerantJacob Erlbeck2015-12-211-7/+39
| | | | | | | This patch makes msgb_hexdump accept out of range lXh pointers and shows info about them instead of aborting the dump entirely. Sponsored-by: On-Waves ehf
* msgb: Add msgb_resize_area and msgb_copyJacob Erlbeck2015-12-211-0/+91
| | | | | | | | | | | | | | | These functions originate from openbsc/src/gprs but are generic msgb helper functions. msgb_copy: This function allocates a new msgb, copies the data buffer of msg, and adjusts the pointers (incl. l1h-l4h) accordingly. msgb_resize_area: This resizes a sub area of the msgb data and adjusts the pointers (incl. l1h-l4h) accordingly. Sponsored-by: On-Waves ehf
* msgb: Add msgb_hexdump() functionJacob Erlbeck2014-03-041-0/+49
| | | | | | | | | | | | This function works like osmo_hexdump() and returns a static buffer containing hex bytes along with markers for the layers. Note that it uses osmo_hexdump() internally, thus a call to msgb_hexdump() invalidates the buffer that has been returned by an earlier call to osmo_hexdump(). In short: don't mix them in a single call printf(). Sponsored-by: On-Waves ehf
* misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi2013-02-151-3/+3
| | | | | Doxygen generates quite a lot of warnings on libosmocore. Some of them are obvious typos - this patch aims to fix such low-hanging fruit.
* doc: Fix the Doxygen section endingsSylvain Munaut2012-04-181-1/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* some more doxygen work (include the notion of modules)Harald Welte2011-08-171-0/+51
|
* add msgb_set_talloc_ctx() to set the talloc context for msgb allocationsHarald Welte2011-06-291-0/+5
|
* misc: Remove the sys/types.h include from various filesHolger Hans Peter Freyther2011-04-181-1/+0
| | | | | We used this include for the u_int{8,16,32}_t types but we do not need this anymore.
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-2/+2
| | | | | | | | | | | | This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
* msgb: Add non-inlined helper functions to ease with language bindingsHolger Hans Peter Freyther2010-10-181-0/+11
| | | | | | It is easier from languages that dlopen libosmocore to have a function to access this data than to poke at the bytes of the struct directly. Add copyright for this method and the reset method I did earlier this year.
* msgb: initialize cb[] to zero during msgb_reset()Harald Welte2010-05-011-0/+2
|
* msgb: remove smsh, llch, tlli and gmmhHarald Welte2010-04-301-1/+1
| | | | | This is a lot of GSM/GPRS specific stuff in struct msgb which we want to avoid. The 'control buffer' will replace them.
* remove the unneeded bts_link pointer from msgbHarald Welte2010-04-301-1/+0
|
* msgb.c: Style cleanup in initializationSylvain Munaut2010-02-241-13/+4
| | | | Don't assign the same var twice & init all from the same source.
* intial checkin of the libosmocore projectHarald Welte2010-02-201-0/+98