-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
connection_p.h
43 lines (39 loc) · 826 Bytes
/
connection_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef CONNECTION_P_H
#define CONNECTION_P_H
#include <stdint.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <ev.h>
enum conn_state_t {
NEW_CONN,
WRITING_GREETING,
READING_AUTH,
WRITING_ASR,
READING_ASR,
WRITING_OOO,
WRITING_AF,
SLEEPING,
DONE
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
struct connection_t {
struct ev_loop* loop;
ev_io io;
ev_timer tmr;
ev_timer delay;
unsigned char* buffer;
unsigned char* auth_failed;
size_t size;
size_t pos;
uint32_t length;
uint16_t port;
uint16_t my_port;
enum conn_state_t state;
uint8_t sequence;
char ip[INET6_ADDRSTRLEN];
char my_ip[INET6_ADDRSTRLEN];
char host[NI_MAXHOST];
};
#pragma clang diagnostic pop
#endif /* CONNECTION_P_H */