CProxy/main.h

55 lines
1.5 KiB
C
Raw Normal View History

#ifndef MAIN_H
#define MAIN_H
2020-01-21 19:48:05 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
2020-01-21 19:48:05 +08:00
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include <errno.h>
#include <signal.h>
#include <pthread.h>
#include <pwd.h>
#include <dirent.h>
#include <sched.h>
#include <getopt.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <sys/resource.h>
2020-01-21 19:48:05 +08:00
#define MAX_CONNECTION 1020
2020-07-30 18:10:31 +08:00
#define BUFFER_SIZE 8192
2020-01-21 19:48:05 +08:00
#define PATH_SIZE 270
#define CACHE_SIZE 270
2021-05-18 14:18:56 +08:00
#define HTTP_HEAD_CACHE_SIZE 1024
#define ERRDEBUG fprintf(stderr,"Error Occured at File: %s, Function: %s, Line: %d, Date: %s, Time: %s.\n", __FILE__, __FUNCTION__, __LINE__, __DATE__, __TIME__);
2020-01-21 19:48:05 +08:00
struct httpudp {
struct sockaddr_in dst;
char *http_request, *original_http_request; //original_http_request为初始化生成的请求头用来配合use_hdr语法
int http_request_len, original_http_request_len;
unsigned encodeCode, //数据编码传输
httpsProxy_encodeCode; //CONNECT代理编码
};
struct global {
int tcp_listen_fd, dns_listen_fd, udp_listen_fd, uid, procs, timeout_m;
unsigned mode:3, strict_modify:1;
};
2020-01-21 19:48:05 +08:00
extern char local_host[CACHE_SIZE];
extern int epollfd, local_port, process;
2020-01-21 19:48:05 +08:00
extern struct epoll_event ev, events[MAX_CONNECTION + 1];
int create_connection(char *remote_host, int remote_port);
2020-10-27 16:42:51 +08:00
int create_connection6(char *remote_host, int remote_port);
extern struct global global;
extern uint16_t tcp_listen_port;
extern struct httpudp udp;
2020-01-21 19:48:05 +08:00
#endif