oweals/libubox.git
10 years agoAdded fd_add method for uloop lua binding.
Xiongfei Guo [Fri, 20 Jun 2014 10:31:18 +0000 (10:31 +0000)]
Added fd_add method for uloop lua binding.

Use uloop.fd_add like this:

    local socket = require "socket"

    udp = socket.udp()

    uloop.fd_add(
        udp, -- socket
        function( -- callback function
            ufd,    -- socket object when register the fd
            events  -- uloop events. eg. uloop.ULOOP_READ .
        )
            local words, msg_or_ip, port_or_nil = ufd:receivefrom()
            print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words)
        end,
        uloop.ULOOP_READ -- event you want to listen
    )

The `examples/uloop-example.lua` show an example of this work.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
10 years agoFix stack overflow bug of uloop lua binding.
Xiongfei Guo [Fri, 20 Jun 2014 10:31:17 +0000 (10:31 +0000)]
Fix stack overflow bug of uloop lua binding.

The static variable `state` in `lua/uloop.c` should be clean after every callback.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
10 years agobuild a static version of libubox
John Crispin [Wed, 11 Jun 2014 00:39:12 +0000 (01:39 +0100)]
build a static version of libubox

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agovlist: add static initializer macros
Felix Fietkau [Thu, 5 Jun 2014 13:28:45 +0000 (15:28 +0200)]
vlist: add static initializer macros

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg_json: use cross-platform macro for fprintf on 64-bit values
Felix Fietkau [Sat, 31 May 2014 12:48:03 +0000 (14:48 +0200)]
blobmsg_json: use cross-platform macro for fprintf on 64-bit values

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agojson_script: fix a segfault in the file free handler
Felix Fietkau [Mon, 26 May 2014 13:53:29 +0000 (15:53 +0200)]
json_script: fix a segfault in the file free handler

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblob/blobmsg: Perform explicit casts from void* to avoid compilation errors when...
Jacob Siverskog [Fri, 9 May 2014 12:31:37 +0000 (14:31 +0200)]
blob/blobmsg: Perform explicit casts from void* to avoid compilation errors when using libubox from C++.

Signed-off by: Jacob Siverskog <jacob@teenageengineering.com>

10 years agouloop: fix multiple calls to uloop_run()
Luka Perkov [Mon, 5 May 2014 00:41:34 +0000 (02:41 +0200)]
uloop: fix multiple calls to uloop_run()

Signed-off-by: Luka Perkov <luka@openwrt.org>
10 years agoutils: add a bitfield size macro
Felix Fietkau [Wed, 30 Apr 2014 11:27:03 +0000 (13:27 +0200)]
utils: add a bitfield size macro

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agokvlist: constify arguments
Felix Fietkau [Mon, 28 Apr 2014 15:56:08 +0000 (17:56 +0200)]
kvlist: constify arguments

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agojson_script: add json_script_run_file()
Felix Fietkau [Mon, 28 Apr 2014 15:54:25 +0000 (17:54 +0200)]
json_script: add json_script_run_file()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agojson_script: implement json_script_eval_string
Felix Fietkau [Mon, 28 Apr 2014 14:57:28 +0000 (16:57 +0200)]
json_script: implement json_script_eval_string

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg: make length variables unsigned
Felix Fietkau [Sun, 27 Apr 2014 14:32:09 +0000 (16:32 +0200)]
blobmsg: make length variables unsigned

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblob: make length variables unsigned
Felix Fietkau [Sun, 27 Apr 2014 14:29:31 +0000 (16:29 +0200)]
blob: make length variables unsigned

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agosh/jshn.sh - json_cleanup() dont pollute env with local vars
Bastian Bittorf [Sun, 20 Apr 2014 20:55:48 +0000 (22:55 +0200)]
sh/jshn.sh - json_cleanup() dont pollute env with local vars

this script is mostly sourced, so we should try to keep the pollution
of the users environment as low as possible. make the var 'tmp' local

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>
10 years agouloop: clear uloop_fd::error on add
Felix Fietkau [Sat, 26 Apr 2014 14:55:17 +0000 (16:55 +0200)]
uloop: clear uloop_fd::error on add

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg_json: let blobmsg_format_json_with_cb with list == true also format arrays
Felix Fietkau [Sat, 26 Apr 2014 08:58:54 +0000 (10:58 +0200)]
blobmsg_json: let blobmsg_format_json_with_cb with list == true also format arrays

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblob: fix handling of custom validator callback
Felix Fietkau [Mon, 21 Apr 2014 10:02:30 +0000 (12:02 +0200)]
blob: fix handling of custom validator callback

https://dev.openwrt.org/ticket/15638

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agokvlist: avoid unused-but-set warnings in code not using the name in kvlist_for_each()
Felix Fietkau [Tue, 15 Apr 2014 14:58:55 +0000 (16:58 +0200)]
kvlist: avoid unused-but-set warnings in code not using the name in kvlist_for_each()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomd5: remove unnecessary variable change
Felix Fietkau [Sat, 12 Apr 2014 18:25:32 +0000 (20:25 +0200)]
md5: remove unnecessary variable change

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg_json: fix a memleak on error
Felix Fietkau [Sat, 12 Apr 2014 18:23:23 +0000 (20:23 +0200)]
blobmsg_json: fix a memleak on error

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoustream: remove unnecessary initialization
Felix Fietkau [Sat, 12 Apr 2014 18:21:13 +0000 (20:21 +0200)]
ustream: remove unnecessary initialization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg: remove unnecessary initialization
Felix Fietkau [Sat, 12 Apr 2014 18:20:36 +0000 (20:20 +0200)]
blobmsg: remove unnecessary initialization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agokvlist: add a simply key/value store implementation
Felix Fietkau [Fri, 11 Apr 2014 23:42:44 +0000 (01:42 +0200)]
kvlist: add a simply key/value store implementation

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoavl: add AVL_TREE macro to define an initialized struct avl_tree
Felix Fietkau [Thu, 27 Mar 2014 16:39:53 +0000 (17:39 +0100)]
avl: add AVL_TREE macro to define an initialized struct avl_tree

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove
Felix Fietkau [Thu, 20 Mar 2014 22:06:42 +0000 (23:06 +0100)]
list_compat.h: remove

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_remove()
Felix Fietkau [Thu, 20 Mar 2014 22:00:53 +0000 (23:00 +0100)]
list_compat.h: remove list_remove()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_add_before()
Felix Fietkau [Thu, 20 Mar 2014 22:00:24 +0000 (23:00 +0100)]
list_compat.h: remove list_add_before()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_add_after()
Felix Fietkau [Thu, 20 Mar 2014 21:59:26 +0000 (22:59 +0100)]
list_compat.h: remove list_add_after()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_add_head()
Felix Fietkau [Thu, 20 Mar 2014 21:58:21 +0000 (22:58 +0100)]
list_compat.h: remove list_add_head()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_init_head()
Felix Fietkau [Thu, 20 Mar 2014 21:56:31 +0000 (22:56 +0100)]
list_compat.h: remove list_init_head()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolist_compat.h: remove list_entity compat define
Felix Fietkau [Thu, 20 Mar 2014 21:55:45 +0000 (22:55 +0100)]
list_compat.h: remove list_entity compat define

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoavl.c: remove compat macros and switch to the argument order from list.h
Felix Fietkau [Thu, 20 Mar 2014 21:54:59 +0000 (22:54 +0100)]
avl.c: remove compat macros and switch to the argument order from list.h

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoutils: add __constructor and __hidden defines
Felix Fietkau [Tue, 18 Mar 2014 13:02:40 +0000 (14:02 +0100)]
utils: add __constructor and __hidden defines

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg_json: unconditionally use blobmsg data/len accessor functions
Felix Fietkau [Wed, 12 Mar 2014 19:13:05 +0000 (20:13 +0100)]
blobmsg_json: unconditionally use blobmsg data/len accessor functions

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements
Felix Fietkau [Wed, 12 Mar 2014 19:08:27 +0000 (20:08 +0100)]
blobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements

This primarily helps with simplifying the ubus APIs.
blobmsg header presence is indicated by the BLOB_ATTR_EXTENDED bit in
the id_len field.

This changes the format ABI, but not the API.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agouloop: Add flag to allow callback to be called on error conditions.
Karl Vogel [Tue, 11 Feb 2014 08:37:08 +0000 (09:37 +0100)]
uloop: Add flag to allow callback to be called on error conditions.

In some conditions, an application is interested in errors happening
on a file descriptor and might be able to resolve the issue in the
callback function.

This patch adds a flag to notify the uloop framework that errors
should be passed to the callback function, instead of silently
removing the fd from the polling set.

Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
10 years agojshn: drop json_select warnings when called from json_get_values()
Felix Fietkau [Sun, 2 Feb 2014 14:22:23 +0000 (15:22 +0100)]
jshn: drop json_select warnings when called from json_get_values()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agolibubox: runqueue: Cancel task timeout when completeing task
Helmut Schaa [Wed, 15 Jan 2014 15:09:19 +0000 (15:09 +0000)]
libubox: runqueue: Cancel task timeout when completeing task

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
10 years agojshn: add ability to pass default values to json_get_var and json_get_vars
Jo-Philipp Wich [Tue, 10 Dec 2013 17:30:15 +0000 (17:30 +0000)]
jshn: add ability to pass default values to json_get_var and json_get_vars

10 years agojshn: in json_get_values(), handle json_select errors
Felix Fietkau [Mon, 2 Dec 2013 09:56:54 +0000 (10:56 +0100)]
jshn: in json_get_values(), handle json_select errors

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agojshn: optimize the shell code some more
Felix Fietkau [Thu, 28 Nov 2013 16:51:26 +0000 (17:51 +0100)]
jshn: optimize the shell code some more

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoblobmsg_json: do not emit any whitespace when formatting without indentation
Jo-Philipp Wich [Wed, 27 Nov 2013 18:40:15 +0000 (18:40 +0000)]
blobmsg_json: do not emit any whitespace when formatting without indentation

11 years agofix memset call in md5.c
John Crispin [Tue, 19 Nov 2013 21:50:53 +0000 (22:50 +0100)]
fix memset call in md5.c

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agoadd md5.c to libubox
John Crispin [Tue, 19 Nov 2013 19:31:45 +0000 (20:31 +0100)]
add md5.c to libubox

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agorunqueue: add a function that allows adding jobs to the front of the runqueue
John Crispin [Mon, 18 Nov 2013 10:15:19 +0000 (11:15 +0100)]
runqueue: add a function that allows adding jobs to the front of the runqueue

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agojshn: refactor _jshn_append to require fewer evals
Felix Fietkau [Wed, 30 Oct 2013 10:50:39 +0000 (11:50 +0100)]
jshn: refactor _jshn_append to require fewer evals

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: improve performance by getting rid of unnecessary variables in parser related...
Felix Fietkau [Wed, 30 Oct 2013 10:36:46 +0000 (11:36 +0100)]
jshn: improve performance by getting rid of unnecessary variables in parser related code

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: do not export SEQ_*
Felix Fietkau [Wed, 30 Oct 2013 09:55:01 +0000 (10:55 +0100)]
jshn: do not export SEQ_*

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: get rid of the table stack, use the UP_* variable instead to speed up processing
Felix Fietkau [Wed, 30 Oct 2013 09:34:40 +0000 (10:34 +0100)]
jshn: get rid of the table stack, use the UP_* variable instead to speed up processing

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: reduce the number of appends to the cleanup list to speed up processing of...
Felix Fietkau [Wed, 30 Oct 2013 09:19:52 +0000 (10:19 +0100)]
jshn: reduce the number of appends to the cleanup list to speed up processing of large json files

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: allow json_get_keys/values to refer to the currently selected array/table if...
Felix Fietkau [Tue, 29 Oct 2013 14:11:42 +0000 (15:11 +0100)]
jshn: allow json_get_keys/values to refer to the currently selected array/table if no argument is given

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: add json_get_values (useful for arrays)
Felix Fietkau [Tue, 29 Oct 2013 13:59:47 +0000 (14:59 +0100)]
jshn: add json_get_values (useful for arrays)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils.h: fix name collisions in __u_bswap16 with using "val" both inside the macro...
Felix Fietkau [Thu, 24 Oct 2013 09:33:22 +0000 (11:33 +0200)]
utils.h: fix name collisions in __u_bswap16 with using "val" both inside the macro and as argument

Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoRestore signal handler after uloop_run()
Kristian Evensen [Tue, 22 Oct 2013 08:24:15 +0000 (10:24 +0200)]
Restore signal handler after uloop_run()

uloop_run calls uloop_setup_signals() to set up signal handling before the while
loop, but does not remove the signal handling after the loop has ended. This can
cause problems for for example applications using the ubus file descriptor in
their own event loops, and perhaps with their own signal handling.

This patch stores the signal handle that was in place when the initial
uloop_run() call was made, and restores the handle when this call returns.
For recursive calls, the signal handler is not updated.

One use-case I experienced was an application that subscribed to several ubus
objects and used the ubus file descriptor in its own event loop. Even though
ubus_register_subscriber() (which calls uloop_run()) had returned, the signal
handler was not removed. This caused SIGINT not to be caught by the application.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg: add blobmsg_len() for consistency (similar to blob_len)
Felix Fietkau [Sun, 20 Oct 2013 11:19:51 +0000 (13:19 +0200)]
blobmsg: add blobmsg_len() for consistency (similar to blob_len)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: add json_get_keys()
Felix Fietkau [Sat, 19 Oct 2013 22:00:42 +0000 (00:00 +0200)]
jshn: add json_get_keys()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: properly clear fields to fix ustream reuse
Felix Fietkau [Sat, 19 Oct 2013 16:20:03 +0000 (18:20 +0200)]
ustream: properly clear fields to fix ustream reuse

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblob: add a magic offset to nesting cookies to ensure that NULL is never returned...
Felix Fietkau [Tue, 15 Oct 2013 23:22:02 +0000 (01:22 +0200)]
blob: add a magic offset to nesting cookies to ensure that NULL is never returned as a normal value

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agovlist: constify key argument to vlist_add
Felix Fietkau [Sat, 5 Oct 2013 19:40:04 +0000 (21:40 +0200)]
vlist: constify key argument to vlist_add

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg_json: allow signed output of integers
Felix Fietkau [Fri, 4 Oct 2013 14:55:14 +0000 (16:55 +0200)]
blobmsg_json: allow signed output of integers

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblob: add blob_put_raw() for copying one or more blob attributes into the buffer...
Felix Fietkau [Wed, 25 Sep 2013 06:44:39 +0000 (08:44 +0200)]
blob: add blob_put_raw() for copying one or more blob attributes into the buffer directly

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg-example: fix length handling in dump_table() calls
Felix Fietkau [Wed, 11 Sep 2013 15:59:33 +0000 (17:59 +0200)]
blobmsg-example: fix length handling in dump_table() calls

11 years agouloop: fix deleting pending fd events on uloop_fd_del
Felix Fietkau [Wed, 31 Jul 2013 22:01:00 +0000 (00:01 +0200)]
uloop: fix deleting pending fd events on uloop_fd_del

When a fd gets deleted internally due to errors, fd->registered gets set
to false before events are moved to the staging array.
This leads to pending events not getting cleared properly when the fd
user finally calls uloop_fd_del.
Fix this by moving the check down and always checking for pending
events.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix formatting
Felix Fietkau [Mon, 29 Jul 2013 12:44:11 +0000 (14:44 +0200)]
blob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix formatting

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agouloop: Fix incorrect timeout
Helmut Schaa [Wed, 24 Jul 2013 12:51:55 +0000 (14:51 +0200)]
uloop: Fix incorrect timeout

uloop timeouts are calculated based on a time value that was fetched
before any callbacks were executed. Hence, the next timeout is off by
the time the callback execution took which can lead to strange side
effects.

Fix this by calculating the next timeout based on a fresh time value.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
11 years agorunqueue should cal the complete handler from more places
John Crispin [Tue, 2 Jul 2013 16:31:25 +0000 (18:31 +0200)]
runqueue should cal the complete handler from more places

Signed-off-by: John Crispin <blogic@openwrt.org>
11 years agosafe_list: add missing null pointer check in safe_list_del()
Felix Fietkau [Fri, 28 Jun 2013 11:05:06 +0000 (13:05 +0200)]
safe_list: add missing null pointer check in safe_list_del()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: return NULL in ustream_get_read_buf if there's a buffer, but no data
Felix Fietkau [Fri, 21 Jun 2013 17:53:09 +0000 (19:53 +0200)]
ustream: return NULL in ustream_get_read_buf if there's a buffer, but no data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg_json: do not corrupt UTF-8 strings
Felix Fietkau [Fri, 21 Jun 2013 15:19:37 +0000 (17:19 +0200)]
blobmsg_json: do not corrupt UTF-8 strings

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg_json: fix \u escaping for control characters
Felix Fietkau [Fri, 21 Jun 2013 15:06:34 +0000 (17:06 +0200)]
blobmsg_json: fix \u escaping for control characters

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agouloop: fix corner cases with recursive uloop_run calls
Felix Fietkau [Tue, 18 Jun 2013 10:01:08 +0000 (12:01 +0200)]
uloop: fix corner cases with recursive uloop_run calls

With multiple recursive calls to uloop_run, the callback for the same fd
can be run multiple times from different levels in the stack.
Prevent this by tracking the stack of uloop_fd callbacks and buffering new
incoming events for fds already on the stack.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agouloop: fix event flags processing on mac os x
Felix Fietkau [Tue, 18 Jun 2013 09:51:50 +0000 (11:51 +0200)]
uloop: fix event flags processing on mac os x

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agolibubox: make uloop_fd::flags generic
Felix Fietkau [Tue, 18 Jun 2013 09:11:04 +0000 (11:11 +0200)]
libubox: make uloop_fd::flags generic

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agouloop: fix edge trigger handling on mac os x
Felix Fietkau [Tue, 18 Jun 2013 07:57:39 +0000 (09:57 +0200)]
uloop: fix edge trigger handling on mac os x

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agouloop: rework event processing, fix use-after-free issues
Felix Fietkau [Tue, 11 Jun 2013 10:21:09 +0000 (12:21 +0200)]
uloop: rework event processing, fix use-after-free issues

Recursive calls to uloop_run() need to process already fetched events
first, before running kqueue/epoll to get more.

The state of cur_fd/cur_nfds and the event list needs to be maintained
properly to prevent accidental running of events pointing at deleted
uloop_fd structs.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: add bitfield inline ops
Felix Fietkau [Mon, 10 Jun 2013 11:37:14 +0000 (13:37 +0200)]
utils: add bitfield inline ops

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: only report stream eof once via state_change callback
Felix Fietkau [Fri, 31 May 2013 09:18:26 +0000 (11:18 +0200)]
ustream: only report stream eof once via state_change callback

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: only report a write error once via state_change callback
Felix Fietkau [Fri, 31 May 2013 09:17:02 +0000 (11:17 +0200)]
ustream: only report a write error once via state_change callback

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg_json: add blobmsg_add_json_from_file
Felix Fietkau [Wed, 29 May 2013 10:14:40 +0000 (12:14 +0200)]
blobmsg_json: add blobmsg_add_json_from_file

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agorunqueue: move completion handler from runqueue_process to runqueue_task to make...
Felix Fietkau [Wed, 8 May 2013 23:27:45 +0000 (01:27 +0200)]
runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agorunqueue: fix include path
Felix Fietkau [Wed, 8 May 2013 23:15:05 +0000 (01:15 +0200)]
runqueue: fix include path

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agorunqueue: add a simple task queueing/completion tracking implementation
Felix Fietkau [Wed, 8 May 2013 23:04:49 +0000 (01:04 +0200)]
runqueue: add a simple task queueing/completion tracking implementation

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream-example: fix container_of type errors
Felix Fietkau [Wed, 8 May 2013 23:06:40 +0000 (01:06 +0200)]
ustream-example: fix container_of type errors

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agolibubox: Allow to build against libjson-c > 0.9
Helmut Schaa [Tue, 7 May 2013 13:04:18 +0000 (15:04 +0200)]
libubox: Allow to build against libjson-c > 0.9

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
11 years agosafe_list: add safe_list_empty()
Felix Fietkau [Mon, 15 Apr 2013 13:53:57 +0000 (15:53 +0200)]
safe_list: add safe_list_empty()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agosafe_list: fix typo
Felix Fietkau [Mon, 15 Apr 2013 13:39:09 +0000 (15:39 +0200)]
safe_list: fix typo

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agolist.h: implement type safety for container_of()
Felix Fietkau [Mon, 18 Mar 2013 04:54:44 +0000 (05:54 +0100)]
list.h: implement type safety for container_of()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoavl: fix type handling in container_of uses
Felix Fietkau [Mon, 18 Mar 2013 04:53:44 +0000 (05:53 +0100)]
avl: fix type handling in container_of uses

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agosafe_list: add a new linked list variant
Felix Fietkau [Mon, 18 Mar 2013 02:58:54 +0000 (03:58 +0100)]
safe_list: add a new linked list variant

Use this linked list implementation as a replacement for list.h if you
want to allow deleting arbitrary list entries from within one or more
recursive iterator calling context

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: add support for the double datatype
Felix Fietkau [Sat, 16 Mar 2013 23:50:03 +0000 (00:50 +0100)]
jshn: add support for the double datatype

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoadd pkgconfig support for json-c
Thomas Gstädtner [Tue, 5 Mar 2013 00:30:51 +0000 (01:30 +0100)]
add pkgconfig support for json-c

this includes a fallback for legacy support

11 years agojson_script: do not rely on global includes for other libubox header files
Felix Fietkau [Sat, 2 Mar 2013 15:19:30 +0000 (16:19 +0100)]
json_script: do not rely on global includes for other libubox header files

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoadd json_script, a minimalistic JSON based script interpreter
Felix Fietkau [Thu, 28 Feb 2013 20:50:49 +0000 (21:50 +0100)]
add json_script, a minimalistic JSON based script interpreter

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblobmsg: implement blobmsg_printf and blobmsg_vprintf
Felix Fietkau [Sun, 17 Feb 2013 15:42:12 +0000 (16:42 +0100)]
blobmsg: implement blobmsg_printf and blobmsg_vprintf

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: make le16 endian conversion functions work with arguments that have side effects
Felix Fietkau [Thu, 14 Feb 2013 22:39:57 +0000 (23:39 +0100)]
utils: make le16 endian conversion functions work with arguments that have side effects

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils.h: make 16-bit little endian conversion robust against pointer subtraction...
Felix Fietkau [Thu, 14 Feb 2013 21:02:56 +0000 (22:02 +0100)]
utils.h: make 16-bit little endian conversion robust against pointer subtraction arguments

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: add little-endian swap helpers
Felix Fietkau [Wed, 13 Feb 2013 11:35:19 +0000 (12:35 +0100)]
utils: add little-endian swap helpers

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: prefer using gccs builtin swapping functions which support constant folding
Felix Fietkau [Mon, 11 Feb 2013 21:00:08 +0000 (22:00 +0100)]
utils: prefer using gccs builtin swapping functions which support constant folding

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: move endian swap helpers and __packed definition to utils.h
Felix Fietkau [Mon, 11 Feb 2013 20:46:41 +0000 (21:46 +0100)]
utils: move endian swap helpers and __packed definition to utils.h

Signed-off-by: Felix Fietkau <nbd@openwrt.org>