Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hotkeys.h
Go to the documentation of this file.
1 
11 #ifndef HOTKEYS_H
12 #define HOTKEYS_H
13 
14 #include "config/config.h"
15 
16 #include <ev.h>
17 #ifndef HAVE_MINGW
18 #include <sys/termios.h>
19 #endif
20 
21 #include "config/conf.h"
22 #include "net_core.h"
23 
24 #include "utils/string_arr.h"
28 typedef struct ping_timer_data {
29 
30  char *peer_name;
31  size_t peer_name_len;
32  struct ev_loop *loop;
34  ev_timer w;
35 
37 
41 typedef struct monitor_timer_data {
42 
43  struct ev_loop *loop;
45  ev_timer w;
46 
48 
52 typedef struct tr_udp_timer_data {
53 
54  struct ev_loop *loop;
56  int num_lines;
57  ev_timer tw;
58  ev_idle iw;
59  size_t num;
60 
62 
63 
67 typedef struct peer_timer_data {
68 
69  struct ev_loop *loop;
71  int num_lines;
72  ev_timer tw;
73  ev_idle iw;
74 
76 
77 
81 typedef struct ksnetHotkeysClass {
82 
83  void *ke;
85  #ifdef HAVE_MINGW
86  int initial_settings, new_settings;
87  #else
88  struct termios initial_settings, new_settings;
89  #endif
90  int wait_y;
91  int peer_m;
92  int tr_udp_m;
95  int str_number;
97 
98  unsigned filter_f;
99  char *filter;
100 
105 
106  ev_io stdin_w;
107  ev_idle idle_stdin_w;
108 
110 
111 extern const char *PING, *TRACE, *MONITOR, *TRIPTIME;
112 
113 #define PING_LEN 5
114 #define TRACE_LEN 6
115 #define MONITOR_LEN 8
116 #define TRIPTIME_LEN 9
117 
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121 
124 
125 void teoHotkeySetFilter(ksnetHotkeysClass *hotkeys, char *filter);
126 unsigned char teoFilterFlagCheck(void *ke);
127 unsigned char teoLogCheck(void *ke, void *log);
128 
135 #define _keys_non_blocking_stop(kh) \
136  tcsetattr(0, TCSANOW, &kh->initial_settings); \
137  kh->non_blocking = 0
138 
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* HOTKEYS_H */
KSNet mesh core data.
Definition: net_core.h:38
ksnetHotkeysClass * ksnetHotkeysInit(void *ke)
Initialize hot keys module.
Definition: hotkeys.c:604
int peer_m
Show peer mode: 0 - single; 1 - continously.
Definition: hotkeys.h:91
ksnCoreClass * kn
Definition: hotkeys.h:33
ev_io stdin_w
STDIN watcher.
Definition: hotkeys.h:106
int tr_udp_m
Show tr-udp mode: 0 - single; 1 - continously.
Definition: hotkeys.h:92
struct monitor_timer_data monitor_timer_data
Monitor timer data.
struct peer_timer_data peer_timer_data
Peer timer data.
struct ev_loop * loop
Definition: hotkeys.h:43
ev_timer w
Definition: hotkeys.h:45
#define KSN_BUFFER_SM_SIZE
Size of small buffer for string.
Definition: conf.h:16
void ksnetHotkeysDestroy(ksnetHotkeysClass *kh)
De-initialize hot key module.
Definition: hotkeys.c:654
int non_blocking
Non blocking mode: 1 - non-blocking.
Definition: hotkeys.h:84
Monitor timer data.
Definition: hotkeys.h:41
size_t peer_name_len
Definition: hotkeys.h:31
struct ksnetHotkeysClass ksnetHotkeysClass
Hot keys class data.
tr_udp_timer_data * put
Hotkey Peer timer data.
Definition: hotkeys.h:104
int num_lines
Definition: hotkeys.h:56
int last_hotkey
Last hotkey.
Definition: hotkeys.h:94
void * ke
Definition: hotkeys.h:83
struct termios initial_settings new_settings
Keybord settings.
Definition: hotkeys.h:88
unsigned char teoLogCheck(void *ke, void *log)
Definition: hotkeys.c:99
void teoHotkeySetFilter(ksnetHotkeysClass *hotkeys, char *filter)
Definition: hotkeys.c:81
Peer timer data.
Definition: hotkeys.h:67
struct ev_loop * loop
Definition: hotkeys.h:32
ev_timer tw
Definition: hotkeys.h:57
ksnCoreClass * kn
Definition: hotkeys.h:44
struct tr_udp_timer_data tr_udp_timer_data
TR UDP timer data.
ksnCoreClass * kn
Definition: hotkeys.h:70
Hot keys class data.
Definition: hotkeys.h:81
monitor_timer_data * mt
Hotkey Monitor timer data.
Definition: hotkeys.h:102
ev_timer tw
Definition: hotkeys.h:72
struct ping_timer_data ping_timer_data
File: hotkeys.h Author: Kirill Scherba kirill@scherba.ru
char str[4][KSN_BUFFER_SM_SIZE]
Strings.
Definition: hotkeys.h:96
const char * TRIPTIME
Definition: hotkeys.c:64
#define ke
size_t num
Definition: hotkeys.h:59
ksnCoreClass * kc
Definition: hotkeys.h:55
ping_timer_data * pt
Hotkey Pinger timer data.
Definition: hotkeys.h:101
unsigned filter_f
Definition: hotkeys.h:98
const char * MONITOR
Definition: hotkeys.c:63
ev_idle iw
Definition: hotkeys.h:58
ev_idle iw
Definition: hotkeys.h:73
char * filter
Definition: hotkeys.h:99
int str_number
Nuber of current string.
Definition: hotkeys.h:95
const char * PING
Definition: hotkeys.c:61
int num_lines
Definition: hotkeys.h:71
unsigned char teoFilterFlagCheck(void *ke)
Definition: hotkeys.c:88
ev_idle idle_stdin_w
Idle STDIN watcher.
Definition: hotkeys.h:107
int wait_y
Wait y (yes) mode.
Definition: hotkeys.h:90
void _keys_non_blocking_start(ksnetHotkeysClass *kh)
Start keyboard non-blocking mode.
Definition: hotkeys.c:581
char * peer_name
Definition: hotkeys.h:30
ev_timer w
Definition: hotkeys.h:34
struct ev_loop * loop
Definition: hotkeys.h:69
TR UDP timer data.
Definition: hotkeys.h:52
peer_timer_data * pet
Hotkey Peer timer data.
Definition: hotkeys.h:103
struct ev_loop * loop
Definition: hotkeys.h:54
File: hotkeys.h Author: Kirill Scherba kirill@scherba.ru
Definition: hotkeys.h:28
int tr_udp_queues_m
Show tr-udp queues mode: 0 - single; 1 - continously.
Definition: hotkeys.h:93
const char * TRACE
Definition: hotkeys.c:62