diff options
author | Determinant <[email protected]> | 2019-06-08 19:22:29 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-08 19:22:29 -0400 |
commit | 66c711cf653b082ae07e1119417dcb3461039c80 (patch) | |
tree | 4f018d84c6efc4dbaa3cf31102e26c0dd5db8b76 /include | |
parent | 1f5bffd006ef432a2fa12fe5baf03c7160c42f73 (diff) |
major API update
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/event.h | 20 | ||||
-rw-r--r-- | include/salticidae/network.h | 8 | ||||
-rw-r--r-- | include/salticidae/stream.h | 2 | ||||
-rw-r--r-- | include/salticidae/type.h | 1 |
4 files changed, 26 insertions, 5 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h index 5b44027..c82d54f 100644 --- a/include/salticidae/event.h +++ b/include/salticidae/event.h @@ -647,14 +647,20 @@ class ThreadCall { #ifdef SALTICIDAE_CBINDINGS using eventcontext_t = salticidae::EventContext; +using threadcall_t = salticidae::ThreadCall; +using threadcall_handle_t = salticidae::ThreadCall::Handle; using sigev_t = salticidae::SigEvent; +using timerev_t = salticidae::TimerEvent; #endif #else #include "config.h" #ifdef SALTICIDAE_CBINDINGS typedef struct eventcontext_t eventcontext_t; +typedef struct threadcall_t threadcall_t; +typedef struct threadcall_handle_t threadcall_handle_t; typedef struct sigev_t sigev_t; +typedef struct timerev_t timerev_t; #endif #endif @@ -669,11 +675,25 @@ void eventcontext_free(eventcontext_t *self); void eventcontext_dispatch(eventcontext_t *self); void eventcontext_stop(eventcontext_t *self); +typedef void (*threadcall_callback_t)(threadcall_handle_t *handle, void *userdata); +threadcall_t *threadcall_new(const eventcontext_t *ec); +void threadcall_free(threadcall_t *self); +void threadcall_async_call(threadcall_t *self, threadcall_callback_t callback, void *userdata); +eventcontext_t *threadcall_get_ec(threadcall_t *self); + typedef void (*sigev_callback_t)(int events); sigev_t *sigev_new(const eventcontext_t *ec, sigev_callback_t cb); void sigev_free(sigev_t *self); void sigev_add(sigev_t *self, int sig); +typedef void (*timerev_callback_t)(timerev_t *); +timerev_t *timerev_new(const eventcontext_t *ec, timerev_callback_t callback); +void timerev_set_callback(timerev_t *self, timerev_callback_t callback); +void timerev_free(timerev_t *self); +void timerev_add(timerev_t *self, double t_sec); +void timerev_del(timerev_t *self); +void timerev_clear(timerev_t *self); + #ifdef __cplusplus } #endif diff --git a/include/salticidae/network.h b/include/salticidae/network.h index c57f418..3b53f26 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -842,11 +842,11 @@ msgnetwork_conn_t *msgnetwork_connect(msgnetwork_t *self, const netaddr_t *addr) void msgnetwork_listen(msgnetwork_t *self, const netaddr_t *listen_addr); void msgnetwork_start(msgnetwork_t *self); -typedef void (*msgnetwork_msg_callback_t)(const msg_t *, const msgnetwork_conn_t *); -void msgnetwork_reg_handler(msgnetwork_t *self, _opcode_t opcode, msgnetwork_msg_callback_t cb); +typedef void (*msgnetwork_msg_callback_t)(const msg_t *, const msgnetwork_conn_t *, void *userdata); +void msgnetwork_reg_handler(msgnetwork_t *self, _opcode_t opcode, msgnetwork_msg_callback_t cb, void *userdata); -typedef void (*msgnetwork_conn_callback_t)(const msgnetwork_conn_t *, bool); -void msgnetwork_reg_conn_handler(msgnetwork_t *self, msgnetwork_conn_callback_t cb); +typedef void (*msgnetwork_conn_callback_t)(const msgnetwork_conn_t *, bool, void *userdata); +void msgnetwork_reg_conn_handler(msgnetwork_t *self, msgnetwork_conn_callback_t cb, void *userdata); msgnetwork_t *msgnetwork_conn_get_net(const msgnetwork_conn_t *conn); msgnetwork_conn_mode_t msgnetwork_conn_get_mode(const msgnetwork_conn_t *conn); diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 9b676a6..8f0c5b4 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -535,7 +535,7 @@ int64_t datastream_get_i64(datastream_t *self); const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len); uint256_t *datastream_get_hash(const datastream_t *self); -bytearray_t *datastream_to_bytearray(datastream_t *_moved_self); +bytearray_t *bytearray_new_moved_from_datastream(datastream_t *_moved_self); #ifdef __cplusplus } diff --git a/include/salticidae/type.h b/include/salticidae/type.h index c62272d..2d97ae9 100644 --- a/include/salticidae/type.h +++ b/include/salticidae/type.h @@ -99,6 +99,7 @@ using bytearray_t = salticidae::bytearray_t; #else #include <stdint.h> +#include <stddef.h> #ifdef SALTICIDAE_CBINDINGS typedef struct bytearray_t bytearray_t; #endif |