jabberd2  2.7.0
Data Structures | Macros | Typedefs | Enumerations | Functions
mio_impl.h File Reference
#include "util/inaddr.h"

Go to the source code of this file.

Data Structures

struct  mio_priv_fd_st
 
struct  mio_priv_st
 now define our master data type More...
 

Macros

#define MIO(m)   ((mio_priv_t) m)
 
#define FD(m, f)   ((mio_priv_fd_t) f)
 
#define ACT(m, f, a, d)   (*(FD(m,f)->app))(m,a,&FD(m,f)->mio_fd,d,FD(m,f)->arg)
 
#define ZONE   __LINE__
 
#define MIO_DEBUG   0
 
#define mio_debug   if(MIO_DEBUG) _mio_debug
 

Typedefs

typedef struct mio_priv_fd_stmio_priv_fd_t
 
typedef struct mio_priv_stmio_priv_t
 now define our master data type More...
 

Enumerations

enum  mio_type_t {
  type_CLOSED = 0x00, type_NORMAL = 0x01, type_LISTEN = 0x02, type_CONNECT = 0x10,
  type_CONNECT_READ = 0x11, type_CONNECT_WRITE = 0x12
}
 our internal wrapper around a fd More...
 

Functions

static void _mio_debug (int line, const char *msgfmt,...)
 
static MIO_FUNCS mio_fd_t _mio_setup_fd (mio_t m, int fd, mio_handler_t app, void *arg)
 add and set up this fd to this mio More...
 
static void _mio_close (mio_t m, mio_fd_t fd)
 internal close function More...
 
static void _mio_accept (mio_t m, mio_fd_t fd)
 internally accept an incoming connection from a listen sock More...
 
static void _mio__connect (mio_t m, mio_fd_t fd)
 internally change a connecting socket to a normal one More...
 
static void _mio_app (mio_t m, mio_fd_t fd, mio_handler_t app, void *arg)
 reset app stuff for this fd More...
 
static void _mio_run (mio_t m, int timeout)
 main select loop runner More...
 
static void _mio_read (mio_t m, mio_fd_t fd)
 start processing read events More...
 
static void _mio_write (mio_t m, mio_fd_t fd)
 try writing to the socket via the app More...
 
static mio_fd_t _mio_listen (mio_t m, int port, const char *sourceip, mio_handler_t app, void *arg)
 set up a listener in this mio w/ this default app/arg More...
 
static mio_fd_t _mio_connect (mio_t m, int port, const char *hostip, const char *srcip, mio_handler_t app, void *arg)
 create an fd and connect to the given ip/port More...
 
static void _mio_free (mio_t m)
 adam More...
 
static mio_t _mio_new (int maxfd)
 eve More...
 

Macro Definition Documentation

◆ MIO

#define MIO (   m)    ((mio_priv_t) m)

Definition at line 71 of file mio_impl.h.

Referenced by _mio_new().

◆ FD

#define FD (   m,
 
)    ((mio_priv_fd_t) f)

◆ ACT

#define ACT (   m,
  f,
  a,
 
)    (*(FD(m,f)->app))(m,a,&FD(m,f)->mio_fd,d,FD(m,f)->arg)

Definition at line 73 of file mio_impl.h.

Referenced by _mio_accept(), _mio_close(), _mio_run(), and _mio_write().

◆ ZONE

#define ZONE   __LINE__

Definition at line 76 of file mio_impl.h.

Referenced by _active_user_create(), _active_user_delete(), _address_features(), _announce_broadcast_user(), _announce_in_sess(), _announce_pkt_sm(), _announce_user_delete(), _authreg_auth_get(), _authreg_auth_set(), _authreg_register_set(), _bind_features(), _c2s_client_mio_callback(), _c2s_client_sx_callback(), _c2s_component_presence(), _c2s_sx_sasl_callback(), _c2s_time_checks(), _disco_generate_packets(), _disco_pkt_router(), _disco_pkt_sm_populate(), _disco_unify_lists(), _disco_unify_walker(), _disco_user_result(), _dns_add_host(), _dns_add_result(), _dns_result_a(), _dns_result_aaaa(), _dns_result_srv(), _echo_pkt_sm(), _help_disco_extend(), _help_pkt_sm(), _in_packet(), _in_result(), _in_sx_callback(), _in_verify(), _iq_last_user_delete(), _iq_private_in_sess(), _iq_private_user_delete(), _iq_vcard_to_object(), _iq_vcard_to_pkt(), _iq_vcard_user_delete(), _iq_version_disco_extend(), _mio__connect(), _mio_accept(), _mio_close(), _mio_connect(), _mio_listen(), _mio_resolver_callback(), _mio_run(), _mio_setup_fd(), _offline_in_sess(), _offline_pkt_user(), _offline_user_delete(), _out_dialback(), _out_mio_callback(), _out_packet_queue(), _out_result(), _out_sx_callback(), _out_verify(), _pbx_close_pipe(), _pbx_mio_callback(), _pbx_open_pipe(), _pbx_presence_nad(), _pbx_process_command(), _pbx_read_command(), _pbx_read_pipe(), _pbx_write_pipe(), _pep_in_sess(), _pres_top(), _presence_pkt_sm(), _presence_pkt_user(), _privacy_action(), _privacy_free_z(), _privacy_in_router(), _privacy_in_sess(), _privacy_out_router(), _privacy_user_delete(), _privacy_user_load(), _roster_freeuser(), _roster_in_sess(), _roster_in_sess_s10n(), _roster_publish_get_group_name(), _roster_publish_save_item(), _roster_publish_user_load(), _roster_save_item(), _roster_set_item(), _roster_user_delete(), _roster_user_load(), _router_advertise(), _router_advertise_reverse(), _router_comp_write(), _router_process_bind(), _router_process_handshake(), _router_process_route(), _router_process_unbind(), _router_route_log_sink(), _router_sx_callback(), _router_sx_sasl_callback(), _router_time_checks(), _s2s_db_header(), _s2s_dns_expiry(), _s2s_populate_whitelist_domains(), _s2s_time_checks(), _session_in_router(), _session_pkt_router(), _sm_build_route(), _status_pkt_sm(), _status_user_delete(), _sx_ack_header(), _sx_ack_process(), _sx_chain_io_plugin(), _sx_chain_io_read(), _sx_chain_io_write(), _sx_chain_nad_plugin(), _sx_chain_nad_read(), _sx_chain_nad_write(), _sx_client_element_start(), _sx_client_notify_header(), _sx_compress_features(), _sx_compress_free(), _sx_compress_new(), _sx_compress_notify_compress(), _sx_compress_process(), _sx_compress_rio(), _sx_compress_wio(), _sx_error(), _sx_error_extended(), _sx_get_pending_write(), _sx_nad_write(), _sx_process_read(), _sx_raw_write(), _sx_reset(), _sx_sasl_client_process(), _sx_sasl_features(), _sx_sasl_free(), _sx_sasl_gsasl_callback(), _sx_sasl_notify_success(), _sx_sasl_open(), _sx_sasl_process(), _sx_sasl_rio(), _sx_sasl_server_process(), _sx_sasl_stream(), _sx_sasl_wio(), _sx_server_element_start(), _sx_server_notify_header(), _sx_ssl_client(), _sx_ssl_features(), _sx_ssl_free(), _sx_ssl_get_external_id(), _sx_ssl_handshake(), _sx_ssl_process(), _sx_ssl_rio(), _sx_ssl_server(), _sx_ssl_starttls_notify_proceed(), _sx_ssl_verify_callback(), _sx_ssl_wio(), _sx_websocket_free(), _sx_websocket_http_header_field(), _sx_websocket_http_header_value(), _sx_websocket_http_headers_complete(), _sx_websocket_new(), _sx_websocket_rio(), _sx_websocket_wio(), _template_roster_reload(), _template_roster_save_item(), _template_roster_user_create(), _unblock_jid(), _vacation_user_delete(), _validate_in_sess(), _verify_in_sess(), _verify_user_delete(), _verify_user_free(), _verify_user_load(), _xdata_field_parse(), aci_check(), aci_load(), aci_unload(), address_init(), authreg_init(), authreg_process(), bind_init(), c2s_pbx_init(), c2s_router_mio_callback(), c2s_router_sx_callback(), check_code(), dispatch(), dns_resolve_domain(), dns_select(), feature_register(), feature_unregister(), filter_load(), filter_packet(), in_mio_callback(), JABBER_MAIN(), jid_new(), libwebsock_fragment_buffer(), mm_disco_extend(), mm_in_router(), mm_in_sess(), mm_new(), mm_out_router(), mm_out_sess(), mm_pkt_router(), mm_pkt_sm(), mm_pkt_user(), mm_sess_end(), mm_sess_start(), mm_user_create(), mm_user_delete(), mm_user_load(), mm_user_unload(), module_init(), out_bounce_route_queue(), out_flush_route_queue(), out_packet(), out_route(), pkt_delay(), pkt_dup(), pkt_error(), pkt_free(), pkt_new(), pkt_router(), pkt_sess(), pres_deliver(), pres_error(), pres_in(), pres_probe(), pres_roster(), pres_update(), router_mio_callback(), s2s_db_init(), s2s_db_key(), s2s_domain_in_whitelist(), s2s_router_mio_callback(), s2s_router_sx_callback(), send_dialbacks(), send_email(), sess_end(), sess_route(), sess_start(), sm_c2s_action(), sm_mio_callback(), sm_storage_rate_limit(), sm_sx_callback(), sx_ack_init(), sx_auth(), sx_can_read(), sx_can_write(), sx_client_init(), sx_compress_client_compress(), sx_compress_init(), sx_env_plugin(), sx_free(), sx_new(), sx_sasl_auth(), sx_sasl_init(), sx_server_init(), sx_ssl_client_starttls(), sx_ssl_init(), sx_ssl_server_addcert(), sx_websocket_init(), user_create(), user_delete(), user_free(), user_load(), user_table_load(), xdata_new(), and xdata_parse().

◆ MIO_DEBUG

#define MIO_DEBUG   0

Definition at line 78 of file mio_impl.h.

◆ mio_debug

#define mio_debug   if(MIO_DEBUG) _mio_debug

Typedef Documentation

◆ mio_priv_fd_t

typedef struct mio_priv_fd_st * mio_priv_fd_t

◆ mio_priv_t

typedef struct mio_priv_st * mio_priv_t

now define our master data type

Enumeration Type Documentation

◆ mio_type_t

enum mio_type_t

our internal wrapper around a fd

Enumerator
type_CLOSED 
type_NORMAL 
type_LISTEN 
type_CONNECT 
type_CONNECT_READ 
type_CONNECT_WRITE 

Definition at line 41 of file mio_impl.h.

Function Documentation

◆ _mio_debug()

static void _mio_debug ( int  line,
const char *  msgfmt,
  ... 
)
static

Definition at line 81 of file mio_impl.h.

◆ _mio_setup_fd()

static MIO_FUNCS mio_fd_t _mio_setup_fd ( mio_t  m,
int  fd,
mio_handler_t  app,
void *  arg 
)
static

add and set up this fd to this mio

Definition at line 94 of file mio_impl.h.

References FD, MIO_ALLOC_FD, mio_debug, MIO_FREE_FD, type_NORMAL, and ZONE.

Referenced by _mio_accept(), _mio_connect(), _mio_listen(), and _mio_new().

◆ _mio_close()

static void _mio_close ( mio_t  m,
mio_fd_t  fd 
)
static

internal close function

Definition at line 129 of file mio_impl.h.

References ACT, action_CLOSE, FD, mio_fd_st::fd, MIO_CAN_FREE, mio_debug, MIO_FREE_FD, MIO_REMOVE_FD, type_CLOSED, and ZONE.

Referenced by _mio_new().

◆ _mio_accept()

static void _mio_accept ( mio_t  m,
mio_fd_t  fd 
)
static

internally accept an incoming connection from a listen sock

Definition at line 156 of file mio_impl.h.

References _mio_setup_fd(), ACT, action_ACCEPT, FD, mio_fd_st::fd, INET6_ADDRSTRLEN, j_inet_getport(), j_inet_ntop(), mio_debug, MIO_FREE_FD, MIO_REMOVE_FD, and ZONE.

Referenced by _mio_run().

◆ _mio__connect()

static void _mio__connect ( mio_t  m,
mio_fd_t  fd 
)
static

internally change a connecting socket to a normal one

Definition at line 200 of file mio_impl.h.

References FD, mio_fd_st::fd, mio_debug, mio_read, MIO_UNSET_WRITE, mio_write, type_CONNECT_READ, type_CONNECT_WRITE, type_NORMAL, and ZONE.

Referenced by _mio_run().

◆ _mio_app()

static void _mio_app ( mio_t  m,
mio_fd_t  fd,
mio_handler_t  app,
void *  arg 
)
static

reset app stuff for this fd

Definition at line 216 of file mio_impl.h.

References FD.

Referenced by _mio_new().

◆ _mio_run()

static void _mio_run ( mio_t  m,
int  timeout 
)
static

◆ _mio_read()

static void _mio_read ( mio_t  m,
mio_fd_t  fd 
)
static

start processing read events

Definition at line 297 of file mio_impl.h.

References FD, MIO_SET_READ, type_CONNECT, and type_CONNECT_READ.

Referenced by _mio_new().

◆ _mio_write()

static void _mio_write ( mio_t  m,
mio_fd_t  fd 
)
static

try writing to the socket via the app

Definition at line 312 of file mio_impl.h.

References ACT, action_WRITE, FD, MIO_SET_WRITE, type_CONNECT, type_CONNECT_WRITE, and type_NORMAL.

Referenced by _mio_new().

◆ _mio_listen()

static mio_fd_t _mio_listen ( mio_t  m,
int  port,
const char *  sourceip,
mio_handler_t  app,
void *  arg 
)
static

set up a listener in this mio w/ this default app/arg

Definition at line 333 of file mio_impl.h.

References _mio_setup_fd(), FD, j_inet_addrlen(), j_inet_pton(), j_inet_setport(), mio_debug, mio_read, sockaddr_storage::ss_family, type_LISTEN, and ZONE.

Referenced by _mio_new().

◆ _mio_connect()

static mio_fd_t _mio_connect ( mio_t  m,
int  port,
const char *  hostip,
const char *  srcip,
mio_handler_t  app,
void *  arg 
)
static

create an fd and connect to the given ip/port

Definition at line 390 of file mio_impl.h.

References _mio_setup_fd(), FD, j_inet_addrlen(), j_inet_pton(), j_inet_setport(), mio_debug, MIO_ERROR, MIO_SET_WRITE, MIO_SETERROR, MIO_STRERROR, sockaddr_storage::ss_family, type_CONNECT, and ZONE.

Referenced by _mio_new().

◆ _mio_free()

static void _mio_free ( mio_t  m)
static

adam

Definition at line 485 of file mio_impl.h.

References MIO_FREE_VARS.

Referenced by _mio_new().

◆ _mio_new()

static mio_t _mio_new ( int  maxfd)
static