summaryrefslogtreecommitdiffstats
path: root/src/write_queue.c
Commit message (Collapse)AuthorAgeFilesLines
* select: Rename BSC_FD_* constants to OSMO_FD_*Harald Welte2019-03-211-7/+7
| | | | | | | | | | | | The naming of these constants dates back to when the code was private within OpenBSC. Everything else was renamed (bsc_fd -> osmo_fd) at the time, but somehow the BSC_FD_* defines have been missed at the time. Keep compatibility #defines around, but allow us to migrate the applications to a less confusing naming meanwhile. Change-Id: Ifae33ed61a7cf0ae54ad487399e7dd2489986436
* 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
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-5/+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-5/+5
| | | | | | | | | | 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-0/+1
| | | | | | | | | 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
* wqueue: Reject messges if queue is considered fullHolger Hans Peter Freyther2016-12-091-3/+8
| | | | | | | | | | | | | | | | | | The write queue was always meant to not queue more than the max_length messages but the implementation never rejected a message. Begin to log and enforce the queue size limit, add a testcase to verify the code and initialize except_cb as part of a fix for that new test case. Real applications might now run into the queue limit and drop messages where they just queued them before. It is unfortunate but I still think it is good to implement the routine as it was intended. We need to review osmo_wqueue_enqueue once more to see that no msgb is leaked. Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae
* Update doxygen annotations in libosmocoreHarald Welte2016-05-051-0/+2
| | | | | This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
* write_queue: Use EBADF instead of EBABDFD for portabilityHolger Hans Peter Freyther2014-07-011-3/+3
| | | | | EBADFD is linux specific while EBADF is POSIX. Fix the build on FreeBSD and use EBADF throughout the file.
* write_queue: Avoid possible use-after-free if fd is read-/writableDaniel Willmann2014-06-221-5/+18
| | | | | | | | | If the FD is both readable and writable and the read callback closes the connection (and frees the surrounding structure) we shouldn't call the write callback (or check anything else in the read fd). With this patch callback functions can return -EBADFD if they don't want the FD to be handled any more.
* doc: Fix the Doxygen section endingsSylvain Munaut2012-04-181-1/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* doxygen: Add 'write_queue' moduleHarald Welte2011-08-171-0/+28
|
* write-queue: use namespace prefix osmo_wqueue*Pablo Neira Ayuso2011-05-071-7/+7
| | | | | | | | | | Summary of changes: s/struct write_queue/struct osmo_wqueue/g s/write_queue_init/osmo_wqueue_init/g s/void write_queue_clear/osmo_wqueue_clear/g s/write_queue_enqueue/osmo_wqueue_enqueue/g s/write_queue_bfd_cb/osmo_wqueue_bfd_cb/g
* select: use namespace prefix osmo_fd* and osmo_select*Pablo Neira Ayuso2011-05-071-1/+1
| | | | | | | | | Summary of changes: s/struct bsc_fd/struct osmo_fd/g s/bsc_register_fd/osmo_fd_register/g s/bsc_unregister_fd/osmo_fd_unregister/g s/bsc_select_main/osmo_select_main/g
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-1/+1
| | | | | | | | | | | | 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>
* write_queue: Only pop the queue if it is not emptyHolger Hans Peter Freyther2011-02-151-8/+10
| | | | | | It is possible that the queue is cleared after the select and before the callback for writable is called. Check if the list is not empty brefore taking an item out of it.
* write_queue: Add callback for exceptions as well.Holger Hans Peter Freyther2010-04-081-0/+3
|
* write_queue: Add a method to clear the queue.Holger Hans Peter Freyther2010-03-261-0/+11
|
* write_queue: Make the bfd cb public so it can be used in a different contextHolger Hans Peter Freyther2010-03-081-2/+2
| | | | | | | | * I'm doing a nonblocking connect and for this I need to select on writable and the first thing I need to do is to check the SOL_SOCKET SO_ERROR state. I realize this by setting a different cb on the embedded bfd during setup and then go back to the real implementation.
* [write_queue] Add a generic write queue classHolger Hans Peter Freyther2010-02-261-0/+74
The write queue can be a dropin replacement for the bsc_fd. It is featuring two callbacks. One for ready read and one for ready write. Whenever there is a message in the queue the write_queue will set the BSC_FD_WRITE flag and then call the write callback. It will make sure to delete the msgb after the write function has been called. This class is intended to be be used in the osmocom, layer2, bsc_msc_ip, bsc_hack and other applications.