CProxy/http_proxy.h

35 lines
1.3 KiB
C
Raw Normal View History

#ifndef HTTP_PROXY_H
#define HTTP_PROXY_H
2020-01-21 19:48:05 +08:00
#include "conf.h"
2020-07-30 18:10:31 +08:00
#include "main.h"
2020-11-26 17:40:17 +08:00
#include <arpa/inet.h>
2020-01-21 19:48:05 +08:00
2022-04-20 17:12:58 +08:00
#define SSL_RSP_CONNECT "HTTP/1.1 200 Connection established\r\nServer: SpecialProxy_CuteBi\r\nConnection: keep-alive\r\n\r\n"
#define SSL_RSP_HTTP "HTTP/1.1 200 OK\r\nContent-length: 99999999\r\nServer: SpecialProxy_CuteBi\r\nContent-Type: text/plain; charset=utf-8\r\nConnection: keep-alive\r\n\r\n"
#define SSL_RSP_WEBSOCKET "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: SpecialProxy_CuteBi\r\n\r\n"
2020-01-21 19:48:05 +08:00
#define HTTP_TYPE 0
#define OTHER_TYPE 1
2020-11-26 17:40:17 +08:00
typedef struct tcp_connection {
char *ready_data, *incomplete_data;
int fd, ready_data_len, incomplete_data_len, sent_len, timer;
uint16_t destPort;
2020-12-15 10:43:06 +08:00
unsigned reread_data:1, request_type:1, keep_alive:1;
2020-11-26 17:40:17 +08:00
} conn_t;
2020-01-21 19:48:05 +08:00
extern int remote_port;
extern char remote_host[CACHE_SIZE];
extern int sslEncodeCode;
2020-11-26 17:40:17 +08:00
extern conn_t cts[MAX_CONNECTION];
extern void tcp_in(conn_t * in, conf * configure);
extern void tcp_out(conn_t * out);
extern void close_connection(conn_t * conn);
extern char *request_head(conn_t * in, conf * configure);
extern void dataEncode(char *data, int data_len, unsigned code);
extern int timeout_minute;
void *tcp_timeout_check(void *nullPtr);
2020-01-21 19:48:05 +08:00
#endif