2024-07-21 20:41:14 +00:00
|
|
|
#ifndef STRUCTS_H
|
|
|
|
#define STRUCTS_H
|
|
|
|
|
2024-09-08 20:00:58 +00:00
|
|
|
#include "parslib/parslib.h"
|
|
|
|
|
|
|
|
#ifndef MAX_BOUND
|
2024-09-14 23:52:51 +00:00
|
|
|
#define MAX_BOUND 100000000000
|
2024-09-08 20:00:58 +00:00
|
|
|
#endif
|
2024-08-05 22:00:14 +00:00
|
|
|
|
2024-07-31 22:11:41 +00:00
|
|
|
#define PROXY_PORT 2020
|
|
|
|
#define PROXY_CONN 20
|
2024-09-17 16:40:01 +00:00
|
|
|
#define RELAY_BUFFER_SIZE 1024*2
|
|
|
|
#define RELAY_POLL_TIMEOUT 1000
|
2024-07-31 22:11:41 +00:00
|
|
|
|
2024-09-14 23:52:51 +00:00
|
|
|
enum states {
|
|
|
|
state_rcv_clt = 0,
|
|
|
|
state_con_srv,
|
|
|
|
state_fwd_srv,
|
|
|
|
state_rcv_srv,
|
2024-09-17 16:40:01 +00:00
|
|
|
state_fwd_clt,
|
|
|
|
state_ok
|
2024-09-14 23:52:51 +00:00
|
|
|
};
|
|
|
|
|
2024-09-17 16:40:01 +00:00
|
|
|
#define ERR_GENERIC -1
|
|
|
|
#define ERR_MEM -2
|
|
|
|
#define ERR_RECV -3
|
|
|
|
#define ERR_SEND -4
|
|
|
|
#define ERR_PARS -5
|
|
|
|
#define ERR_PARSTITLE -6
|
|
|
|
#define ERR_PARSHEADER -7
|
|
|
|
#define ERR_SUPPORT -8
|
|
|
|
#define ERR_TIMEOUT -9
|
2024-09-14 23:52:51 +00:00
|
|
|
|
|
|
|
char *states_str[] = {
|
|
|
|
"state_rcv_clt",
|
|
|
|
"state_con_srv",
|
|
|
|
"state_fwd_srv",
|
|
|
|
"state_rcv_srv",
|
2024-09-17 16:40:01 +00:00
|
|
|
"state_fwd_clt",
|
|
|
|
"state_ok"
|
2024-09-14 23:52:51 +00:00
|
|
|
};
|
2024-08-05 22:00:14 +00:00
|
|
|
|
2024-09-08 20:00:58 +00:00
|
|
|
struct conn {
|
|
|
|
int cltfd;
|
|
|
|
int srvfd;
|
|
|
|
|
2024-09-12 17:31:01 +00:00
|
|
|
char *cltbuff;
|
|
|
|
char *srvbuff;
|
2024-09-12 17:58:33 +00:00
|
|
|
|
|
|
|
int cltbuff_len;
|
2024-09-12 17:31:01 +00:00
|
|
|
int srvbuff_len;
|
|
|
|
|
2024-09-08 20:00:58 +00:00
|
|
|
struct httpareq cltreq;
|
|
|
|
struct httpares srvres;
|
|
|
|
};
|
|
|
|
|
2024-08-05 22:00:14 +00:00
|
|
|
#endif
|