Commit graph

13 commits

Author SHA1 Message Date
Felix Fietkau
eb9bcb6418 ustream: prevent recursive calls to the read callback
Simplifies stacked ustreams and calling poll from the read function.
Reuse an unused leftover struct member in order to not break ABI.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-03-29 13:59:21 +01:00
Hauke Mehrtens
ecf56174da ustream: Add format string checks to ustream_(v)printf()
This tells the compiler that these functions are takeing a format
string, the compiler will now do additional checks and is able to emitt
a compile warning in case the format string is not valid.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2019-06-16 16:30:01 +02:00
Yousong Zhou
60236c4853 ustream: add function ustream_read().
It can be used to fill caller-specified buffer with data already in
ustream read buffer.  Useful in the following use pattern.

	int available = ustream_pending_data(s, false);
	if (available >= sizeof(struct msghdr)) {
		struct msghdr h;
		ustream_read(s, &h, sizeof(h));
	}

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-21 20:00:39 +01:00
Felix Fietkau
95fde87029 ustream: another fix for ustream_read_buf_full() with split read buffers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-31 18:10:52 +01:00
Felix Fietkau
e72b65c899 ustream: fix ustream_read_buf_full() for multiple read buffers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-30 16:52:32 +01:00
Felix Fietkau
7a117988d9 ustream: add ustream_pending_data accessor function
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-01 16:10:39 +01:00
Felix Fietkau
975ac3e5e3 ustream: add ustream_read_buf_full() helper
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-30 15:25:35 +01:00
Felix Fietkau
a9b44ebe55 ustream: make notify_state optional as well 2012-10-30 00:00:57 +01:00
Felix Fietkau
efc9f4b702 ustream: mark notify_read cb as optional 2012-10-30 00:00:23 +01:00
Felix Fietkau
dc69ce4799 ustream: add a poll callback function defined by the ustream implementation 2012-10-29 23:39:48 +01:00
Felix Fietkau
0e51f714d1 ustream: add a pointer to the ustream struct useful for chaining ustreams 2012-10-22 22:28:47 +02:00
Felix Fietkau
ba6cd4c322 ustream.h: include stdarg.h 2012-10-22 21:14:02 +02:00
Felix Fietkau
768a69b3ce add ustream, an api for stream buffer management 2012-10-21 23:00:06 +02:00