6efcf6ef19e4b43613063567fa6171cca94b2167
[my-code/ivac.git] / src / input.h
1 /* input.h -- input headers */
2
3 #ifndef INPUT_H
4 #define INPUT_H
5
6 /* includes */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <unistd.h>
11 #include <errno.h>
12 #include <termios.h>
13
14 /* defines */
15 #define I_SUCCESS 1
16 #define I_ERROR -1
17
18 #define MENUE (1<<0)
19 #define CONNECTIONS (1<<1)
20
21 #define MAX_CONTENT 128
22
23 #define LINE_BUFFERED (1<<0)
24 #define CONTENT_BUFFER (1<<1)
25 #define INPUT_ECHO (1<<2)
26
27 /* input specific variables */
28 typedef struct s_input {
29   char *content;
30   int c_count;
31   unsigned char mode;
32   struct termios tios;
33 } t_input;
34
35 /* function prototypes */
36 int input_init(t_input *input);
37 int input_shutdown(t_input *input);
38 int input_get_event(t_input *input,int (*callback)(t_input *input,void *ptr),
39                    void *ptr);
40
41 #endif