#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <event2/event.h>
#include <amxrt/amxrt.h>
#include "amxrt_priv.h"
Go to the source code of this file.
|
static void | amxrt_el_free_event_source (amxc_llist_it_t *it) |
|
static void | amxrt_el_add_event_source (struct event *source, amxp_connection_t *con) |
|
static void | amxrt_el_signal_cb (UNUSED evutil_socket_t fd, UNUSED short event, UNUSED void *arg) |
|
static void | amxrt_el_signal_timers (UNUSED evutil_socket_t fd, UNUSED short event, UNUSED void *arg) |
|
static void | amxrt_el_connection_read_cb (UNUSED evutil_socket_t fd, UNUSED short flags, void *arg) |
|
static void | amxrt_el_connection_can_write_cb (UNUSED evutil_socket_t fd, UNUSED short flags, void *arg) |
|
static void | amxrt_el_amxp_signal_read_cb (UNUSED evutil_socket_t fd, UNUSED short flags, UNUSED void *arg) |
|
static void | amxrt_el_amxp_syssignal_read_cb (UNUSED evutil_socket_t fd, UNUSED short flags, UNUSED void *arg) |
|
static void | amxrt_el_slot_add_fd (UNUSED const char *const sig_name, const amxc_var_t *const data, UNUSED void *const priv) |
|
static void | amxrt_el_slot_wait_write_fd (UNUSED const char *const sig_name, const amxc_var_t *const data, UNUSED void *const priv) |
|
static void | amxrt_el_slot_remove_fd (UNUSED const char *const sig_name, const amxc_var_t *const data, UNUSED void *const priv) |
|
static void | amxrt_el_add_read_fd (amxc_llist_t *connections) |
|
static void | amxrt_el_remove_fd (amxc_llist_t *connections) |
|
amxp_connection_t * | amxrt_el_get_connection (amxc_llist_t *cons, int fd) |
|
int | amxrt_el_create (void) |
| Creates and initializes all needed event loop components. More...
|
|
int | amxrt_el_start (void) |
| Starts the event loop. More...
|
|
int | amxrt_el_stop (void) |
| Stops the event loop. More...
|
|
int | amxrt_el_destroy (void) |
| Cleans-up the event loop components. More...
|
|
|
static struct event_base * | base = NULL |
|
◆ el_data_t
◆ amxrt_el_add_event_source()
static void amxrt_el_add_event_source |
( |
struct event * |
source, |
|
|
amxp_connection_t * |
con |
|
) |
| |
|
static |
Definition at line 86 of file amxrt_el_libevent.c.
89 el_data->
read = source;
90 event_add(source, NULL);
93 con->el_data = el_data;
PRIVATE amxrt_t * amxrt_get(void)
amxc_llist_t event_sources
◆ amxrt_el_add_read_fd()
static void amxrt_el_add_read_fd |
( |
amxc_llist_t * |
connections | ) |
|
|
static |
Definition at line 219 of file amxrt_el_libevent.c.
220 struct event* source = NULL;
222 amxc_llist_for_each(it, connections) {
223 amxp_connection_t* con = amxc_llist_it_get_data(it, amxp_connection_t, it);
static void amxrt_el_connection_read_cb(UNUSED evutil_socket_t fd, UNUSED short flags, void *arg)
static void amxrt_el_add_event_source(struct event *source, amxp_connection_t *con)
static struct event_base * base
◆ amxrt_el_amxp_signal_read_cb()
static void amxrt_el_amxp_signal_read_cb |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
flags, |
|
|
UNUSED void * |
arg |
|
) |
| |
|
static |
◆ amxrt_el_amxp_syssignal_read_cb()
static void amxrt_el_amxp_syssignal_read_cb |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
flags, |
|
|
UNUSED void * |
arg |
|
) |
| |
|
static |
◆ amxrt_el_connection_can_write_cb()
static void amxrt_el_connection_can_write_cb |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
flags, |
|
|
void * |
arg |
|
) |
| |
|
static |
Definition at line 119 of file amxrt_el_libevent.c.
122 amxp_connection_t* con = (amxp_connection_t*) arg;
126 con->can_write = NULL;
◆ amxrt_el_connection_read_cb()
static void amxrt_el_connection_read_cb |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
flags, |
|
|
void * |
arg |
|
) |
| |
|
static |
Definition at line 112 of file amxrt_el_libevent.c.
115 amxp_connection_t* con = (amxp_connection_t*) arg;
116 con->reader(fd, con->priv);
◆ amxrt_el_free_event_source()
static void amxrt_el_free_event_source |
( |
amxc_llist_it_t * |
it | ) |
|
|
static |
◆ amxrt_el_get_connection()
amxp_connection_t* amxrt_el_get_connection |
( |
amxc_llist_t * |
cons, |
|
|
int |
fd |
|
) |
| |
Definition at line 240 of file amxrt_el_libevent.c.
241 amxp_connection_t* con = NULL;
242 amxc_llist_for_each(it, cons) {
243 con = amxc_llist_it_get_data(it, amxp_connection_t, it);
◆ amxrt_el_remove_fd()
static void amxrt_el_remove_fd |
( |
amxc_llist_t * |
connections | ) |
|
|
static |
Definition at line 229 of file amxrt_el_libevent.c.
230 amxc_llist_for_each(it, connections) {
231 amxp_connection_t* con = amxc_llist_it_get_data(it, amxp_connection_t, it);
233 if(el_data != NULL) {
static void amxrt_el_free_event_source(amxc_llist_it_t *it)
◆ amxrt_el_signal_cb()
static void amxrt_el_signal_cb |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
event, |
|
|
UNUSED void * |
arg |
|
) |
| |
|
static |
◆ amxrt_el_signal_timers()
static void amxrt_el_signal_timers |
( |
UNUSED evutil_socket_t |
fd, |
|
|
UNUSED short |
event, |
|
|
UNUSED void * |
arg |
|
) |
| |
|
static |
◆ amxrt_el_slot_add_fd()
static void amxrt_el_slot_add_fd |
( |
UNUSED const char *const |
sig_name, |
|
|
const amxc_var_t *const |
data, |
|
|
UNUSED void *const |
priv |
|
) |
| |
|
static |
Definition at line 146 of file amxrt_el_libevent.c.
149 amxp_connection_t* con = NULL;
150 struct event* source = NULL;
152 when_true(amxc_var_type_of(data) != AMXC_VAR_ID_FD, leave);
154 con = amxp_connection_get(amxc_var_constcast(fd_t, data));
155 when_null(con, leave);
◆ amxrt_el_slot_remove_fd()
static void amxrt_el_slot_remove_fd |
( |
UNUSED const char *const |
sig_name, |
|
|
const amxc_var_t *const |
data, |
|
|
UNUSED void *const |
priv |
|
) |
| |
|
static |
Definition at line 192 of file amxrt_el_libevent.c.
195 amxc_llist_t* connections = amxp_connection_get_connections();
196 amxp_connection_t* con = NULL;
198 when_true(amxc_var_type_of(data) != AMXC_VAR_ID_FD, leave);
202 connections = amxp_connection_get_listeners();
205 when_null(con, leave);
207 if(con->el_data != NULL) {
209 if(el_data != NULL) {
amxp_connection_t * amxrt_el_get_connection(amxc_llist_t *cons, int fd)
◆ amxrt_el_slot_wait_write_fd()
static void amxrt_el_slot_wait_write_fd |
( |
UNUSED const char *const |
sig_name, |
|
|
const amxc_var_t *const |
data, |
|
|
UNUSED void *const |
priv |
|
) |
| |
|
static |
Definition at line 164 of file amxrt_el_libevent.c.
167 amxp_connection_t* con = NULL;
170 when_true(amxc_var_type_of(data) != AMXC_VAR_ID_FD, leave);
172 con = amxp_connection_get(amxc_var_constcast(fd_t, data));
173 when_null(con, leave);
176 when_null(el_data, leave);
static void amxrt_el_connection_can_write_cb(UNUSED evutil_socket_t fd, UNUSED short flags, void *arg)
◆ base
struct event_base* base = NULL |
|
static |