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-08-06 20:21:38 +00:00
|
|
|
#define MAX_BOUND 10000
|
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 SERVER_MODE "server"
|
|
|
|
#define CLIENT_MODE "client"
|
|
|
|
|
|
|
|
#define PROXY_PORT 2020
|
|
|
|
#define PROXY_CONN 20
|
2024-08-06 20:21:38 +00:00
|
|
|
#define PROXY_MAX_MSGLEN 10000*1024
|
2024-09-04 09:10:08 +00:00
|
|
|
#define PROXY_DEF_PORT "80"
|
|
|
|
#define PROXY_BASE_PORT 10
|
2024-07-31 22:11:41 +00:00
|
|
|
|
|
|
|
#define REGEX_MATCHN 4
|
2024-08-02 16:38:13 +00:00
|
|
|
#define REGEX_TITLE "^([A-Z]+)[ ]+([a-zA-Z0-9\\:/_.,-]+)"\
|
|
|
|
"[ ]+([a-zA-Z0-9_.,/-]+)[\n\r]*$"
|
2024-08-01 10:27:38 +00:00
|
|
|
#define REGEX_HEADER "^([a-zA-Z0-9_-]*):[ \t]+([^\r\n]*)"
|
2024-09-04 09:10:08 +00:00
|
|
|
#define REGEX_HOST "^([a-zA-Z0-9_/,.-]+)(:[0-9]+)?$"
|
2024-07-31 22:11:41 +00:00
|
|
|
|
2024-08-08 11:25:23 +00:00
|
|
|
#define CLIENT_MESSAGE "GET http://archive.0xdeadbeer.org/ HTTP/1.0\r\n\r\n"\
|
|
|
|
"Host: archive.0xdeadbeer.org\r\n"\
|
2024-07-31 22:11:41 +00:00
|
|
|
|
2024-08-05 22:00:14 +00:00
|
|
|
#define STATEM_RCV_CLT 0b00000001
|
2024-09-08 20:00:58 +00:00
|
|
|
#define STATEM_CON_SRV 0b00000010
|
|
|
|
#define STATEM_FWD_SRV 0b00000100
|
|
|
|
#define STATEM_RCV_SRV 0b00001000
|
|
|
|
#define STATEM_FWD_CLT 0b00010000
|
|
|
|
#define STATEM_ERR 0b00100000
|
2024-08-05 22:00:14 +00:00
|
|
|
|
2024-07-21 20:41:14 +00:00
|
|
|
struct header {
|
|
|
|
char *key;
|
|
|
|
char *value;
|
|
|
|
};
|
|
|
|
|
2024-08-05 22:00:14 +00:00
|
|
|
struct request {
|
2024-09-04 09:10:08 +00:00
|
|
|
char *host_name;
|
|
|
|
char *host_port;
|
|
|
|
|
2024-07-21 20:41:14 +00:00
|
|
|
char *method;
|
|
|
|
char *uri;
|
|
|
|
char *ver;
|
2024-07-31 22:11:41 +00:00
|
|
|
int header_num;
|
2024-07-21 20:41:14 +00:00
|
|
|
struct header *headers;
|
|
|
|
};
|
|
|
|
|
2024-09-08 20:00:58 +00:00
|
|
|
struct conn {
|
|
|
|
int cltfd;
|
|
|
|
int srvfd;
|
|
|
|
|
|
|
|
struct httpareq cltreq;
|
|
|
|
struct httpares srvres;
|
|
|
|
};
|
|
|
|
|
2024-08-05 22:00:14 +00:00
|
|
|
#endif
|