From 68a8eaafe5f43480f29308bfd2ec12ad54da43f1 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Fri, 15 Apr 2016 16:40:38 +0200 Subject: use upoll for event loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also add '#pragma once' in headers Change-Id: I90cc2d53ec60d4d1e66cf0f229109621e4019864 Signed-off-by: José Bollo --- include/afb-plugin.h | 7 ++++--- include/afb-poll-itf.h | 18 ++++++++---------- include/afb-req-itf.h | 2 ++ 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/afb-plugin.h b/include/afb-plugin.h index 4064f9e9..2c9935e6 100644 --- a/include/afb-plugin.h +++ b/include/afb-plugin.h @@ -15,6 +15,8 @@ * limitations under the License. */ +#pragma once + struct afb_req; /* Plugin Type */ @@ -61,13 +63,12 @@ enum AFB_Mode { AFB_MODE_GLOBAL }; -struct afb_poll; - struct AFB_interface { int verbosity; enum AFB_Mode mode; - struct afb_poll (*poll_open)(int fd, void *closure); + const struct afb_pollitf *pollitf; + void *pollclosure; }; extern const struct AFB_plugin *pluginRegister (const struct AFB_interface *interface); diff --git a/include/afb-poll-itf.h b/include/afb-poll-itf.h index 2c8889b6..b70eb993 100644 --- a/include/afb-poll-itf.h +++ b/include/afb-poll-itf.h @@ -15,17 +15,15 @@ * limitations under the License. */ -struct afb_poll_itf -{ - int (*on_readable)(void *, void (*cb)(void *)); - int (*on_writable)(void *, void (*cb)(void *)); - int (*on_hangup)(void *, void (*cb)(void *)); - void (*close)(void *data); -}; +#pragma once -struct afb_poll +struct afb_pollitf { - const struct afb_poll_itf *itf; - void *data; + int (*wait)(int timeout, void *pollclosure); + void *(*open)(int fd, void *closure, void *pollclosure); + int (*on_readable)(void *hndl, void (*cb)(void *closure)); + int (*on_writable)(void *hndl, void (*cb)(void *closure)); + void (*on_hangup)(void *hndl, void (*cb)(void *closure)); + void (*close)(void *hndl); }; diff --git a/include/afb-req-itf.h b/include/afb-req-itf.h index 7f7472f1..357ffd7b 100644 --- a/include/afb-req-itf.h +++ b/include/afb-req-itf.h @@ -15,6 +15,8 @@ * limitations under the License. */ +#pragma once + struct json_object; struct afb_arg { -- cgit 1.2.3-korg