forked from Chion82/kcptun-raw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrans_packet.h
37 lines (29 loc) · 833 Bytes
/
trans_packet.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
#include <openssl/aes.h>
#define MTU 1440
#define FIRST_SYN UINT_MAX - 2
#define REPLY_SYN_ACK UINT_MAX - 1
#define REPLY_ACK UINT_MAX
struct trans_packet_state {
unsigned int seq;
unsigned int ack;
};
struct packet_info {
char dest_ip[128];
char source_ip[128];
uint16_t dest_port;
uint16_t source_port;
void (*on_packet_recv)(char*, uint16_t, char*, int);
int is_server;
struct trans_packet_state state;
int disable_seq_update;
};
int packet_send_sd;
int packet_recv_sd;
char* aes_ckey;
char* aes_vec;
AES_KEY aes_key;
void init_packet(struct packet_info* packetinfo);
int send_packet(struct packet_info* packetinfo, char* source_payload, int payloadlen, unsigned int flag);
void set_packet_recv_nonblocking();
void set_packet_send_nonblocking();
void check_packet_recv(struct packet_info* packetinfo);