aboutsummaryrefslogtreecommitdiffstats
path: root/src/msgb.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte1-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
2017-10-22add function msgb_printf() to print formatted text into msg bufPhilipp Maier1-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
2017-06-23doxygen: unify use of \file across the boardNeels Hofmeyr1-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
2017-06-23doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr1-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
2017-06-12update/extend doxygen documentationHarald Welte1-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
2016-09-27msgb: add msgb_talloc_ctx_init(), deprecate msgb_set_talloc_ctx()Neels Hofmeyr1-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
2016-06-23Fix potential segfault in msg_dequeueMax1-3/+6
Change-Id: I06e9c5ba3e00c73a4e52d2583ce3492f236275ce
2016-05-05Update doxygen annotations in libosmocoreHarald Welte1-0/+1
This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
2015-12-24Fix some recently added formats on 64bitNeels Hofmeyr1-3/+5
86ec311896dd5d4 adds compiler warnings on 64bit. The build is clean otherwise, so let's keep it that way.
2015-12-21msgb: Let msgb_hexdump be more tolerantJacob Erlbeck1-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
2015-12-21msgb: Add msgb_resize_area and msgb_copyJacob Erlbeck1-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
2014-03-04msgb: Add msgb_hexdump() functionJacob Erlbeck1-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
2013-02-15misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi1-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.
2012-04-18doc: Fix the Doxygen section endingsSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-08-17some more doxygen work (include the notion of modules)Harald Welte1-0/+51
2011-06-29add msgb_set_talloc_ctx() to set the talloc context for msgb allocationsHarald Welte1-0/+5
2011-04-18misc: Remove the sys/types.h include from various filesHolger Hans Peter Freyther1-1/+0
We used this include for the u_int{8,16,32}_t types but we do not need this anymore.
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-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>
2010-10-18msgb: Add non-inlined helper functions to ease with language bindingsHolger Hans Peter Freyther1-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.
2010-05-01msgb: initialize cb[] to zero during msgb_reset()0.1.5Harald Welte1-0/+2
2010-04-30msgb: remove smsh, llch, tlli and gmmhHarald Welte1-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.
2010-04-30remove the unneeded bts_link pointer from msgbHarald Welte1-1/+0
2010-02-24msgb.c: Style cleanup in initializationSylvain Munaut1-13/+4
Don't assign the same var twice & init all from the same source.
2010-02-20intial checkin of the libosmocore projectHarald Welte1-0/+98