CProxy/main.h

55 lines
1.5 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef MAIN_H
#define MAIN_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#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>
#define MAX_CONNECTION 1020
#define BUFFER_SIZE 8192
#define PATH_SIZE 270
#define CACHE_SIZE 270
#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__);
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;
};
extern char local_host[CACHE_SIZE];
extern int epollfd, local_port, process;
extern struct epoll_event ev, events[MAX_CONNECTION + 1];
int create_connection(char *remote_host, int remote_port);
int create_connection6(char *remote_host, int remote_port);
extern struct global global;
extern uint16_t tcp_listen_port;
extern struct httpudp udp;
#endif