Commit graph

59 commits

Author SHA1 Message Date
Peter Stadler
d35df8adda ubus: make libubus ready for linking into C++
Use extern "C" { ... } if using libubus.h in a C++ project.

Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
2020-01-05 17:34:03 +01:00
John Crispin
24ffe9b582 libubus-req: add data_cb callback handling for ubus notifications
Signed-off-by: John Crispin <john@phrozen.org>
2017-11-06 08:23:08 +01:00
Felix Fietkau
91acde66b9 libubus: do not modify uloop_cancelled
uloop_cancelled was used for two purposes within ubus_complete_request:
- interrupting recursive requests on SIGINT/SIGTERM
- breaking out of the poll loop in a recursive request that completed

Saving/restorung uloop_cancelled was buggy, leading to SIGTERM not being
processed properly. Simplify the logic by using a separate field for
internal use

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-02-03 18:39:15 +01:00
Felix Fietkau
d5fabacba1 libubus: reduce code duplication, fix indentation
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-12-24 14:35:58 +01:00
amine ahd
df088f03c0 Allow sending a fd along a ubus_request
Signed-off-by: amine.ahd <amine.ahd@gmail.com>
2016-12-24 14:31:04 +01:00
Emanuel Taube
fda009d8ba libubus.h: marking unused variables
Inform the compiler that the variables are not gona be used to avoid
compiler warnings.

Signed-off-by: Emanuel Taube <emanuel.taube@gmail.com>
2016-02-22 11:41:03 +01:00
Ben Kelly
6a86e65f7d libubus.h: add ubus_auto_shutdown()
Add ubus_auto_shutdown function, which ensures any pending uloop_timer is cancelled before calling ubus_shutdown on the context.

This avoids a condition where ubus_shutdown() is called during ubus_auto_connect attempting a reconnection.

Signed-off-by: Ben Kelly <ben@benjii.net>
2016-02-07 14:24:28 +01:00
Felix Fietkau
44a62711e0 libubus: add monitor support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-11-19 22:32:25 +01:00
John Crispin
8309c75828 add acl code
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-06-18 19:01:17 +02:00
John Crispin
e3815962c1 add optional tags to the ubus methos struct and the wrapper macros
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-06-18 19:01:17 +02:00
Delio Brignoli
7b79b6226e libubus: expose ubus_connect_ctx() in public API
ubus_connect_ctx() is equivalent to ubus_connect() but accepts a
pointer to a previously allocated ubus_context struct.
ubus_shutdown() is made available as an alternative to ubus_free()
to clean up contexts initialised by ubus_connect_ctx().

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2014-10-14 09:57:11 +02:00
Felix Fietkau
382a05f54d libubus: move ubus_msghdr_data to libubus-internal.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03 20:58:01 +02:00
Alexandru Ardelean
82da9db3a9 libubus: add logic to reduce msgbuf data size after 16 small messages 2014-07-03 12:45:13 +02:00
Alexandru Ardelean
6d24ad71f6 ubus: increase message size limit and make it configurable at build-time 2014-07-03 12:44:19 +02:00
Alexandru Ardelean
7e746e5a85 libubus: refactor ubus_context msgbuf data to be dynamically allocated 2014-07-03 12:42:42 +02:00
Felix Fietkau
bbd3fbc9cc libubus: always defer processing incoming invoke/unsubscribe/notify if there is a request pending
This fixes recursion problems on config reload in netifd and simplifies
application handling of requests

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-24 22:34:53 +02:00
Felix Fietkau
2c71017cfb libubus: add support for defining a policy mask
This allows sharing a policy array across methods, but masking out
unused entries for individual methods.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-27 00:40:25 +02:00
Felix Fietkau
47a9ab0c64 libubus: implement file descriptor passing support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-18 15:03:53 +01:00
John Crispin
29d7092252 add auto (re)connect logic to libubus
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-01-22 13:53:11 +00:00
Felix Fietkau
a9ee3ef0cf libubus: pull the variable length data array out of struct ubus_msghdr to fix builds with clang
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 17:28:37 +01:00
Felix Fietkau
3b66d054cc libubus: add ubus_unregister_subscriber wrapper
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-17 03:11:35 +01:00
Felix Fietkau
495f460818 libubus: add UBUS_METHOD_NOARG
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-06 16:56:33 +01:00
Felix Fietkau
3642af8097 libubus: fix data type of request sequence counter. fixes hang after ~64K requests
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-15 16:51:28 +01:00
Felix Fietkau
f3fabd45a7 libubus: implement notify handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-15 00:37:09 +01:00
Felix Fietkau
a69f062cbd ubus: add notification for subscribers present/gone
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-14 13:00:57 +01:00
Felix Fietkau
d366a6de83 watch add/remove -> subscribe/unsubscribe:
rename the ADD_WATCH/REMOVE_WATCH messages to SUBSCRIBE/UNSUBSCRIBE and change
the message format and libubus API in preparation for adding object notifications

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-13 19:35:38 +01:00
Felix Fietkau
7864896a1b add support for deferring a reply to a method invoke call 2012-10-01 14:09:19 +02:00
Felix Fietkau
a62e2f8c15 libubus: fix multiple inclusions of libubus.h 2012-06-01 10:09:14 +02:00
Felix Fietkau
34161692fa libubus: add support for reconnecting (and re-publishing objects) 2012-05-29 00:56:37 +02:00
Felix Fietkau
c6f7054515 ubusd: add support for watching objects to get notified when they go away 2012-05-19 21:09:35 +02:00
Felix Fietkau
c0c06ec7ea uloop: do not use ULOOP_EDGE_TRIGGER for the blocking socket, it can miss some events due to races 2012-05-18 22:32:25 +02:00
Felix Fietkau
8e5a6af1db libubus: limit stack depth for incoming invoke requests 2011-10-27 14:03:19 +02:00
Felix Fietkau
42bc27ae38 add copyright/license information 2011-06-17 16:35:11 +02:00
Felix Fietkau
e49b34f912 simplify object signatures by reusing the parser policy to define them 2011-03-27 20:03:18 +02:00
Felix Fietkau
6cf4326987 change the ubus signature type to int instead of the enum, as there are possible values not covered by the enum 2011-02-26 17:26:21 +01:00
Felix Fietkau
f2ee96c51d add support for timeouts on synchronous requests 2011-02-11 02:40:39 +01:00
Felix Fietkau
ef978a8ea0 libubus: add an inline function for socket event handling 2011-02-07 20:43:43 +01:00
Felix Fietkau
12a8f978cb add sender side length checks 2011-02-07 02:35:24 +01:00
Felix Fietkau
045e40ecfd reorder a few functions in libubus.h 2011-02-07 02:12:28 +01:00
Felix Fietkau
b0755698c1 fix max message length handling - exclude the header 2011-02-07 01:52:40 +01:00
Felix Fietkau
f9f602533a add code for sending events and fix the code for receiving events 2011-02-07 01:25:28 +01:00
Felix Fietkau
38aa926349 add a wrapper function for unregistering an event handler 2011-02-06 21:47:51 +01:00
Felix Fietkau
d2f1a01d9f add ubus_remove_object to libubus 2011-02-06 21:46:45 +01:00
Felix Fietkau
f8d55af76b rename publish to add_object 2011-02-06 21:33:03 +01:00
Felix Fietkau
ed4b742f3f implement code for receiving events 2011-02-05 23:23:44 +01:00
Felix Fietkau
f6a6b0d492 add functionality for registering anonymous objects as event listeners 2011-02-05 19:53:14 +01:00
Felix Fietkau
659a98c810 add an inline function to add the ubus socket to uloop 2011-01-31 20:00:39 +01:00
Felix Fietkau
7d4fd754af remove an obsolete define 2011-01-31 19:53:55 +01:00
Felix Fietkau
768d282ae9 make ubus_parse_msg static 2011-01-31 18:28:14 +01:00
Felix Fietkau
36b1a80b07 make ubus_start_request static 2011-01-31 18:27:23 +01:00