Teonet library
0.4.7
|
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libgen.h>
#include <signal.h>
#include <pthread.h>
#include <stdbool.h>
#include "ev_mgr.h"
#include "net_multi.h"
#include "utils/utils.h"
#include "utils/rlutil.h"
#include "modules/metric.h"
#include "commands_creator.h"
Macros | |
#define | MODULE "event_manager" |
File: ev_mgr.c Author: Kirill Scherba kiril l@sc herba .ruMore... | |
#define | RUN_NAME "-teonet.run" |
#define | kev ((ksnetEvMgrClass*)(ka->ke)) |
#define | kev ((ksnetEvMgrClass *)w->data) |
#define | kev ((ksnetEvMgrClass*)(w->data)) |
#define | SEND_EVENT(data, data_len, user_data) kev->event_cb(kev, EV_K_ASYNC , data, data_len, user_data) |
#define | kev ((ksnetEvMgrClass *)w->data) |
Typedefs | |
typedef void(* | set_sigaction_h )(int, siginfo_t *, void *) |
Set sigaction function typedef. More... | |
Functions | |
ksnetEvMgrClass * | __ke_from_command_class (ksnCommandClass *X) |
ksnetEvMgrClass * | __ke_from_L0_class (ksnLNullClass *X) |
ksnetArpClass * | __arp_from_command_class (ksnCommandClass *X) |
void | idle_cb (EV_P_ ev_idle *w, int revents) |
Idle callback (runs every 11.5 second of Idle time) More... | |
void | idle_activity_cb (EV_P_ ev_idle *w, int revents) |
Check activity Idle callback. More... | |
void | idle_async_cb (EV_P_ ev_idle *w, int revents) |
Async Idle callback. More... | |
void | timer_cb (EV_P_ ev_timer *w, int revents) |
Timer callback (runs every KSNET_EVENT_MGR_TIMER = 0.25 sec) More... | |
void | host_cb (EV_P_ ev_io *w, int revents) |
Teonet host fd read event callback. More... | |
void | sig_async_cb (EV_P_ ev_async *w, int revents) |
Async Event callback (Signal) More... | |
void | sigint_cb (struct ev_loop *loop, ev_signal *w, int revents) |
Signal to stop event loop callback. More... | |
void | sigusr2_cb (struct ev_loop *loop, ev_signal *w, int revents) |
SIGUSR2 signal handler. More... | |
int | modules_init (ksnetEvMgrClass *ke) |
Initialize connected to Event Manager Modules. More... | |
void | modules_destroy (ksnetEvMgrClass *ke) |
Destroy modules. More... | |
int | send_cmd_disconnect_cb (ksnetArpClass *ka, char *name, ksnet_arp_data *arp_data, void *data) |
void | metric_teonet_count (teoMetricClass *tm) |
Send default teonet metrics. More... | |
ksnetEvMgrClass * | ksnetEvMgrInit (int argc, char **argv, ksn_event_cb_type event_cb, int options) |
Initialize KSNet Event Manager and network. More... | |
ksnetEvMgrClass * | ksnetEvMgrInitPort (int argc, char **argv, void(*event_cb)(ksnetEvMgrClass *ke, ksnetEvMgrEvents event, void *data, size_t data_len, void *user_data), int options, int port, void *user_data) |
Initialize KSNet Event Manager and network and set new default port. More... | |
void | teoSetAppType (ksnetEvMgrClass *ke, char *type) |
Set Teonet application type. More... | |
void | teoSetAppVersion (ksnetEvMgrClass *ke, char *version) |
Set Teonet application version. More... | |
const char * | teoGetAppType (ksnetEvMgrClass *ke) |
Get current application type. More... | |
char * | teoGetFullAppTypeFromHostInfo (host_info_data *hid) |
const char * | teoGetAppVersion (ksnetEvMgrClass *ke) |
Get current application version. More... | |
const char * | teoGetLibteonetVersion () |
Get teonet library version. More... | |
void | ksnetEvMgrStop (ksnetEvMgrClass *ke) |
Stop event manager. More... | |
int | ksnetEvMgrStatus (ksnetEvMgrClass *ke) |
int | ksnetEvMgrRun (ksnetEvMgrClass *ke) |
Start KSNet Event Manager and network communication. More... | |
int | ksnetEvMgrFree (ksnetEvMgrClass *ke, int free_async) |
Free ksnetEvMgrClass after run. More... | |
void | ksnetEvMgrSetCustomTimer (ksnetEvMgrClass *ke, double time_interval) |
Set custom timer interval. More... | |
char * | ksnetEvMgrGetHostName (ksnetEvMgrClass *ke) |
Return host name. More... | |
host_info_data * | teoGetHostInfo (ksnetEvMgrClass *ke, size_t *hd_len) |
Get host info data. More... | |
void | ksnetEvMgrAsync (ksnetEvMgrClass *ke, void *data, size_t data_len, void *user_data) |
Async call to Event manager. More... | |
double | ksnetEvMgrGetTime (ksnetEvMgrClass *ke) |
Get KSNet event manager time. More... | |
void | connect_r_host_cb (ksnetEvMgrClass *ke) |
Connect to remote host. More... | |
void | open_local_port (ksnetEvMgrClass *ke) |
Send packet to local address to open private firewall. More... | |
int | remove_peer_addr (ksnetEvMgrClass *ke, __CONST_SOCKADDR_ARG addr) |
Remove peer by address. More... | |
int | check_connected_cb (ksnetArpClass *ka, char *peer_name, ksnet_arp_data_ext *arp, void *data) |
Check connected peers, send trip time request and disconnect peer at timeout. More... | |
int | ksnetEvMgrRestart (int argc, char **argv) |
Restart application. More... | |
Variables | |
int | teo_argc |
char ** | teo_argv |
const char * | null_str = "" |
File: ev_mgr.h Author: Kirill Scherba kiril l@sc herba .ruMore... | |
char | run_file [KSN_BUFFER_SIZE] |
#define kev ((ksnetEvMgrClass*)(ka->ke)) |
Referenced by check_connected_cb(), idle_activity_cb(), idle_async_cb(), and sig_async_cb().
#define kev ((ksnetEvMgrClass *)w->data) |
#define kev ((ksnetEvMgrClass*)(w->data)) |
#define kev ((ksnetEvMgrClass *)w->data) |
#define MODULE "event_manager" |
File: ev_mgr.c Author: Kirill Scherba kiril l@sc herba .ru
Created on April 11, 2015, 2:13 AM
Event manager module
Referenced by connect_r_host_cb(), idle_activity_cb(), idle_cb(), ksnetEvMgrFree(), ksnetEvMgrRun(), open_local_port(), sig_async_cb(), sigint_cb(), sigusr2_cb(), and timer_cb().
#define RUN_NAME "-teonet.run" |
Referenced by ksnetEvMgrRun().
#define SEND_EVENT | ( | data, | |
data_len, | |||
user_data | |||
) | kev->event_cb(kev, EV_K_ASYNC , data, data_len, user_data) |
Referenced by sig_async_cb().
typedef void(* set_sigaction_h)(int, siginfo_t *, void *) |
Set sigaction function typedef.
ksnetArpClass* __arp_from_command_class | ( | ksnCommandClass * | X | ) |
References ksnCommandClass::kc.
ksnetEvMgrClass* __ke_from_command_class | ( | ksnCommandClass * | X | ) |
References ksnCommandClass::kc.
ksnetEvMgrClass* __ke_from_L0_class | ( | ksnLNullClass * | X | ) |
References ksnLNullClass::ke.
int check_connected_cb | ( | ksnetArpClass * | ka, |
char * | peer_name, | ||
ksnet_arp_data_ext * | arp, | ||
void * | data | ||
) |
Check connected peers, send trip time request and disconnect peer at timeout.
ka | |
peer_name | |
arp_data | |
data |
References CHECK_EVENTS_AFTER, kev, ksnCommandSendCmdEcho(), ksnetEvMgrGetTime(), send_cmd_disconnect_cb(), TRIPTIME, and TRIPTIME_LEN.
Referenced by idle_activity_cb().
void connect_r_host_cb | ( | ksnetEvMgrClass * | ke | ) |
Connect to remote host.
ke | Pointer to ksnetEvMgrClass |
References CMD_CONNECT_R, createCmdConnectRPacketTcp(), createCmdConnectRPacketUdp(), DEBUG, DEBUG_VV, ksnTCPProxyClass::fd_client, free(), ksnetEvMgrClass::kc, ksn_printf, ksnCoreSendto(), ksnTCPProxyClientConnect(), MODULE, teonet_cfg::r_host_addr, teonet_cfg::r_host_name, teonet_cfg::r_port, teonet_cfg::r_tcp_f, resolveDnsName(), ksnetEvMgrClass::teo_cfg, and ksnetEvMgrClass::tp.
Referenced by idle_activity_cb(), and idle_cb().
void host_cb | ( | EV_P_ ev_io * | w, |
int | revents | ||
) |
Teonet host fd read event callback.
param loop
w | |
revents |
void idle_activity_cb | ( | EV_P_ ev_idle * | w, |
int | revents | ||
) |
Check activity Idle callback.
Start(restart) connection to R-Host and check connections to all peers.
param loop
w | |
revents |
References check_connected_cb(), connect_r_host_cb(), DEBUG_VV, kev, ksn_printf, ksnetArpGetAll(), MODULE, and UINT32_MAX.
Referenced by ksnetEvMgrRun().
void idle_async_cb | ( | EV_P_ ev_idle * | w, |
int | revents | ||
) |
Async Idle callback.
Process async queue messages
param loop
w | |
revents |
References kev.
Referenced by ksnetEvMgrRun().
void idle_cb | ( | EV_P_ ev_idle * | w, |
int | revents | ||
) |
Idle callback (runs every 11.5 second of Idle time)
This callback started by event manager timer after every CHECK_EVENTS_AFTER = 11.5 second. Send two user event: first EV_K_STARTED sent at startup (when application started) and second EV_K_IDLE sent every tick.
param loop
w | Pointer to watcher |
revents |
References connect_r_host_cb(), DEBUG_VV, EV_K_IDLE, EV_K_STARTED, ksnetEvMgrClass::ev_loop, ksnetEvMgrClass::event_cb, ksnCoreClass::host_w, ksnetEvMgrClass::idle_count, ksnetEvMgrClass::kc, ksn_printf, ksnCoreSetEventTime, MODULE, teonet_cfg::r_tcp_f, teoAsyncClass::t_id, ksnetEvMgrClass::ta, ksnetEvMgrClass::teo_cfg, and UINT32_MAX.
Referenced by ksnetEvMgrRun().
void ksnetEvMgrAsync | ( | ksnetEvMgrClass * | ke, |
void * | data, | ||
size_t | data_len, | ||
void * | user_data | ||
) |
Async call to Event manager.
ke | Pointer to ksnetEvMgrClass |
data | Pointer to data |
data_len | Data length |
user_data | Pointer to user data |
References ksnetEvMgrClass::async_mutex, ksnetEvMgrClass::async_queue, ksnetEvMgrClass::ev_loop, malloc(), and ksnetEvMgrClass::sig_async_w.
Referenced by teoLoggingClientSend().
int ksnetEvMgrFree | ( | ksnetEvMgrClass * | ke, |
int | free_async | ||
) |
Free ksnetEvMgrClass after run.
ke | Pointer to ksnetEvMgrClass |
free_async | 1 - free async queue data and destroy queue mutex; 0 - free basic class data; 2 - free all - async queue data and basic class data |
References ksnetEvMgrClass::app_type, ksnetEvMgrClass::app_version, ksnetEvMgrClass::argc, ksnetEvMgrClass::argv, ksnetEvMgrClass::async_mutex, ksnetEvMgrClass::async_queue, EV_K_STOPPED, EV_K_STOPPED_BEFORE, ksnetEvMgrClass::ev_loop, ksnetEvMgrClass::event_cb, free(), ksnetEvMgrClass::km, ksn_printf, ksnetEvMgrRestart(), MESSAGE, MODULE, modules_destroy(), ksnetEvMgrClass::net_idx, teonet_cfg::port, ksnetEvMgrClass::printf_mutex, run_file, ksnetEvMgrClass::sig_async_w, ksnetEvMgrClass::teo_cfg, and ksnetEvMgrClass::timer_w.
Referenced by ksnetEvMgrRun(), ksnMultiDestroy(), and teoMultiRemoveNet().
|
inline |
Return host name.
ke | Pointer to ksnetEvMgrClass |
References teonet_cfg::host_name, and ksnetEvMgrClass::teo_cfg.
Referenced by _check_connected(), event_cb(), teo::Teonet::getHostName(), ksnetEvMgrRun(), and teoGetHostInfo().
double ksnetEvMgrGetTime | ( | ksnetEvMgrClass * | ke | ) |
Get KSNet event manager time.
ke | Pointer to ksnetEvMgrClass |
References ksnetEvMgrClass::ev_loop, and ksnetEvMgrClass::runEventMgr.
Referenced by _check_connected(), check_connected_cb(), teo::Teonet::getTime(), ksnCommandEchoBuffer(), ksnCommandSendCmdEcho(), ksnCoreCheckNewPeer(), ksnCoreProcessPacket(), ksnet_printf(), ksnetArpShowData(), ksnetEvMgrSetCustomTimer(), ksnSplitCombine(), and timer_cb().
ksnetEvMgrClass* ksnetEvMgrInit | ( | int | argc, |
char ** | argv, | ||
ksn_event_cb_type | event_cb, | ||
int | options | ||
) |
Initialize KSNet Event Manager and network.
argc | Number of applications arguments (from main) |
argv | Applications arguments array (from main) |
event_cb | Events callback function called when an event happens |
options | Options set: READ_OPTIONS - read options from command line parameters; READ_CONFIGURATION - read options from configuration file |
References ksnetEvMgrInitPort().
ksnetEvMgrClass* ksnetEvMgrInitPort | ( | int | argc, |
char ** | argv, | ||
void(*)(ksnetEvMgrClass *ke, ksnetEvMgrEvents event, void *data, size_t data_len, void *user_data) | event_cb, | ||
int | options, | ||
int | port, | ||
void * | user_data | ||
) |
Initialize KSNet Event Manager and network and set new default port.
argc | Number of applications arguments (from main) |
argv | Applications arguments array (from main) |
event_cb | Events callback function called when an event happens |
options | Options set: READ_OPTIONS - read options from command line parameters; READ_CONFIGURATION - read options from configuration file |
port | Set default port number if non 0 |
user_data | Pointer to user data or NULL if absent |
References teonet_cfg::app_argc, teonet_cfg::app_argv, APP_PARAM, ksnetEvMgrClass::argc, ksnetEvMgrClass::argv, ksnetEvMgrClass::async_mutex, BLOCK_CLI_INPUT, teonet_cfg::block_cli_input_f, ksnetEvMgrClass::custom_timer_interval, ksnetEvMgrClass::ev_loop, ksnetEvMgrClass::event_cb, event_cb(), ke, ksnetEvMgrClass::kf, ksnetEvMgrClass::kl, ksnetEvMgrClass::km, ksnetEvMgrClass::ks, ksnet_configInit(), ksnet_optRead(), ksnet_optSetApp(), ksnetEvMgrClass::kt, ksnetEvMgrClass::last_custom_timer, malloc(), ksnetEvMgrClass::n_next, ksnetEvMgrClass::n_prev, ksnetEvMgrClass::net_count, ksnetEvMgrClass::net_idx, null_str, teonet_cfg::port, ksnetEvMgrClass::printf_mutex, read_config(), READ_CONFIGURATION, READ_OPTIONS, ksnetEvMgrClass::runEventMgr, teo_argc, teo_argv, ksnetEvMgrClass::teo_cfg, ksnetEvMgrClass::teo_class, ksnetEvMgrClass::tp, and ksnetEvMgrClass::user_data.
Referenced by ksnetEvMgrInit(), ksnMultiInit(), main(), teoMultiAddNet(), teo::Teonet::Teonet(), and teonet_t().
int ksnetEvMgrRestart | ( | int | argc, |
char ** | argv | ||
) |
Restart application.
argc | |
argv |
References free(), ksnet_formatMessage(), ksnet_stringArrSplit(), and usleep().
Referenced by ksnetEvMgrFree(), ksnMultiDestroy(), and sigusr2_cb().
int ksnetEvMgrRun | ( | ksnetEvMgrClass * | ke | ) |
Start KSNet Event Manager and network communication.
Start KSNet Event Manager and network communication
ke | Pointer to ksnetEvMgrClass |
References _ANSI_BROWN, _ANSI_NONE, ksnetEvMgrClass::async_queue, DEBUG_VV, ksnetEvMgrClass::ev_loop, free(), getDataPath(), idle_activity_cb(), ksnetEvMgrClass::idle_activity_count, ksnetEvMgrClass::idle_activity_w, idle_async_cb(), ksnetEvMgrClass::idle_async_w, idle_cb(), ksnetEvMgrClass::idle_count, ksnetEvMgrClass::idle_w, ksnetEvMgrClass::kc, ke, ksnetEvMgrClass::km, KSN_BUFFER_SIZE, ksn_printf, ksn_puts, KSNET_EVENT_MGR_TIMER, ksnetEvMgrFree(), ksnetEvMgrGetHostName(), MESSAGE, MODULE, modules_init(), ksnetEvMgrClass::net_idx, teonet_cfg::network, run_file, RUN_NAME, ksnetEvMgrClass::runEventMgr, sig_async_cb(), ksnetEvMgrClass::sig_async_w, teonet_cfg::sig_segv_f, ksnetEvMgrClass::sigabrt_w, sigint_cb(), ksnetEvMgrClass::sigint_w, ksnetEvMgrClass::sigkill_w, ksnetEvMgrClass::sigquit_w, ksnetEvMgrClass::sigstop_w, ksnetEvMgrClass::sigterm_w, sigusr2_cb(), ksnetEvMgrClass::teo_cfg, timer_cb(), ksnetEvMgrClass::timer_val, and ksnetEvMgrClass::timer_w.
Referenced by ksnMultiInit(), main(), teo::Teonet::run(), teoMultiAddNet(), teonet_t(), and test2().
void ksnetEvMgrSetCustomTimer | ( | ksnetEvMgrClass * | ke, |
double | time_interval | ||
) |
Set custom timer interval.
ke | Pointer to ksnetEvMgrClass |
time_interval |
References ksnetEvMgrClass::custom_timer_interval, ksnetEvMgrGetTime(), and ksnetEvMgrClass::last_custom_timer.
Referenced by event_cb(), main(), and teo::Teonet::setCustomTimer().
int ksnetEvMgrStatus | ( | ksnetEvMgrClass * | ke | ) |
References ksnetEvMgrClass::runEventMgr.
Referenced by ksnCoreProcessPacket(), and teo_recvfrom().
|
inline |
Stop event manager.
ke | Pointer to ksnetEvMgrClass |
References ksnetEvMgrClass::runEventMgr.
Referenced by event_cb(), hotkeys_cb(), ksnMultiDestroy(), main(), sigusr2_cb(), teo::Teonet::stop(), and teoMultiRemoveNet().
void metric_teonet_count | ( | teoMetricClass * | tm | ) |
Send default teonet metrics.
tm | Pointer to teoMetricClass |
References ksnCoreClass::ka, ksnetEvMgrClass::kc, teoMetricClass::ke, ksnetEvMgrClass::kl, ksnetArpMetrics(), ksnLNullStat(), teonet_cfg::statsd_peers_f, ksnetEvMgrClass::teo_cfg, teoMetricCounter(), and teoMetricGauge().
Referenced by timer_cb().
void modules_destroy | ( | ksnetEvMgrClass * | ke | ) |
Destroy modules.
ke |
References ksnetEvMgrClass::kc, ksnetEvMgrClass::kf, ksnetEvMgrClass::kh, ksnetEvMgrClass::kl, ksnetEvMgrClass::kq, ksnetEvMgrClass::ks, ksnCoreDestroy(), ksnCQueDestroy(), ksnetHotkeysDestroy(), ksnLNullDestroy(), ksnStreamDestroy(), ksnTcpDestroy(), ksnTCPProxyDestroy(), ksnTDBdestroy(), ksnTermDestroy(), ksnTunDestroy(), ksnVpnDestroy(), ksnetEvMgrClass::kt, ksnetEvMgrClass::kter, ksnetEvMgrClass::ktun, ksnetEvMgrClass::kvpn, ksnetEvMgrClass::lc, ksnetEvMgrClass::lr, ksnetEvMgrClass::ls, ksnCoreClass::port, teonet_cfg::port, ksnetEvMgrClass::ta, ksnetEvMgrClass::teo_cfg, teoAsyncDestroy(), teoLoggingClientDestroy(), teoLoggingServerDestroy(), teoLogReaderDestroy(), teoMetricDestroy(), ksnetEvMgrClass::tm, and ksnetEvMgrClass::tp.
Referenced by ksnetEvMgrFree().
int modules_init | ( | ksnetEvMgrClass * | ke | ) |
Initialize connected to Event Manager Modules.
ke |
References teonet_cfg::block_cli_input_f, teonet_cfg::dflag, teonet_cfg::filter, teonet_cfg::host_name, ksnetEvMgrClass::kc, ksnetEvMgrClass::kf, ksnetEvMgrClass::kh, ksnetEvMgrClass::kl, ksnetEvMgrClass::kq, ksnetEvMgrClass::ks, ksnCoreInit(), ksnCQueInit(), ksnetHotkeysInit(), ksnLNullInit(), ksnStreamInit(), ksnTcpInit(), ksnTCPProxyInit(), ksnTDBinit(), ksnTermInit(), ksnTunInit(), ksnVpnInit(), ksnetEvMgrClass::kt, ksnetEvMgrClass::kter, ksnetEvMgrClass::ktun, ksnetEvMgrClass::kvpn, ksnetEvMgrClass::lc, ksnetEvMgrClass::lr, ksnetEvMgrClass::ls, ksnetEvMgrClass::net_idx, teonet_cfg::port, ksnetEvMgrClass::ta, ksnetEvMgrClass::teo_cfg, teoAsyncInit(), teoHotkeySetFilter(), teoLoggingClientInit(), teoLoggingServerInit(), teoLogReaderInit(), teoMetricInit(), ksnetEvMgrClass::tm, and ksnetEvMgrClass::tp.
Referenced by ksnetEvMgrRun().
void open_local_port | ( | ksnetEvMgrClass * | ke | ) |
Send packet to local address to open private firewall.
References CMD_NONE, DEBUG_VV, free(), getIPs(), ip_is_private(), ip_to_array(), ksnetEvMgrClass::kc, ksn_printf, ksnCoreSendto(), ksnet_formatMessage(), ksnet_stringArrFree(), ksnet_stringArrLength(), MODULE, NULL_STR, teonet_cfg::r_port, and ksnetEvMgrClass::teo_cfg.
int remove_peer_addr | ( | ksnetEvMgrClass * | ke, |
__CONST_SOCKADDR_ARG | addr | ||
) |
Remove peer by address.
ke | Pointer to ksnetEvMgrClass |
addr |
0 | peer not found |
1 | peer removed |
-1 | peer not removed, this is this host |
References ksnCoreClass::ka, ksnetEvMgrClass::kc, and ksnetArpFindByAddr().
Referenced by trudp_event_cb().
int send_cmd_disconnect_cb | ( | ksnetArpClass * | ka, |
char * | name, | ||
ksnet_arp_data * | arp_data, | ||
void * | data | ||
) |
Referenced by check_connected_cb().
void sig_async_cb | ( | EV_P_ ev_async * | w, |
int | revents | ||
) |
Async Event callback (Signal)
param loop
w | |
revents |
References data, DEBUG_VV, free(), kev, ksn_puts, MODULE, and SEND_EVENT.
Referenced by ksnetEvMgrRun().
void sigint_cb | ( | struct ev_loop * | loop, |
ev_signal * | w, | ||
int | revents | ||
) |
Signal to stop event loop callback.
loop | |
w | |
revents |
References DEBUG, DEBUG_KSNET, ksn_puts, and MODULE.
Referenced by ksnetEvMgrRun().
void sigusr2_cb | ( | struct ev_loop * | loop, |
ev_signal * | w, | ||
int | revents | ||
) |
SIGUSR2 signal handler.
loop | |
w | |
revents |
References ksnetEvMgrClass::argc, ksnetEvMgrClass::argv, DEBUG, DEBUG_KSNET, ksnetEvMgrClass::km, ksn_printf, ksnetEvMgrRestart(), ksnetEvMgrStop(), ksnMultiDestroy(), MESSAGE, and MODULE.
Referenced by ksnetEvMgrRun().
|
inline |
Get current application type.
ke | Pointer to ksnetEvMgrClass |
References ksnetEvMgrClass::app_type.
Referenced by teoGetHostInfo().
|
inline |
Get current application version.
ke | Pointer to ksnetEvMgrClass |
References ksnetEvMgrClass::app_version.
Referenced by teoGetHostInfo().
char* teoGetFullAppTypeFromHostInfo | ( | host_info_data * | hid | ) |
References ksnet_sformatMessage(), and null_str.
Referenced by createCmdConnectPacket(), createCmdConnectRPacketUdp(), and ksnetArpAddHost().
host_info_data* teoGetHostInfo | ( | ksnetEvMgrClass * | ke, |
size_t * | hd_len | ||
) |
Get host info data.
ke | Pointer to ksnetEvMgrClass |
hd_len | Pointer to host_info_data length holder |
References ksnetEvMgrGetHostName(), teonet_cfg::l0_allow_f, malloc(), null_str, ksnetEvMgrClass::teo_cfg, teoGetAppType(), teoGetAppVersion(), VERSION, and teonet_cfg::vpn_connect_f.
Referenced by createCmdConnectPacket(), createCmdConnectRPacketUdp(), and ksnetArpAddHost().
|
inline |
Get teonet library version.
References VERSION.
Referenced by teo::Teonet::getTeonetVersion(), and main().
|
inline |
Set Teonet application type.
ke | Pointer to ksnetEvMgrClass |
type | Application type string |
References ksnetEvMgrClass::app_type.
Referenced by event_cb(), main(), and teo::Teonet::setAppType().
|
inline |
Set Teonet application version.
ke | Pointer to ksnetEvMgrClass |
version | Application version string |
References ksnetEvMgrClass::app_version.
Referenced by event_cb(), main(), and teo::Teonet::setAppVersion().
void timer_cb | ( | EV_P_ ev_timer * | w, |
int | revents | ||
) |
Timer callback (runs every KSNET_EVENT_MGR_TIMER = 0.25 sec)
param loop
w | |
revents |
References CHECK_EVENTS_AFTER, ksnetEvMgrClass::custom_timer_interval, DEBUG_VV, EV_K_TIMER, ksnetEvMgrClass::event_cb, ksnetEvMgrClass::idle_activity_w, ksnetEvMgrClass::idle_w, ksnetEvMgrClass::kc, ksn_printf, KSNET_EVENT_MGR_TIMER, ksnetEvMgrGetTime(), ksnCoreClass::last_check_event, ksnetEvMgrClass::last_custom_timer, metric_teonet_count(), MODULE, ksnetEvMgrClass::runEventMgr, ksnetEvMgrClass::timer_val, and ksnetEvMgrClass::tm.
Referenced by ksnetEvMgrRun().
const char* null_str = "" |
File: ev_mgr.h Author: Kirill Scherba kiril l@sc herba .ru
Created on April 11, 2015, 2:13 AM
Referenced by event_cb(), ksnetArpShowStr(), ksnetEvMgrInitPort(), teoGetFullAppTypeFromHostInfo(), and teoGetHostInfo().
char run_file[KSN_BUFFER_SIZE] |
Referenced by ksnetEvMgrFree(), and ksnetEvMgrRun().
int teo_argc |
Referenced by ksnetEvMgrInitPort().
char ** teo_argv |
Referenced by ksnetEvMgrInitPort().