-
Notifications
You must be signed in to change notification settings - Fork 56
/
generic.h
65 lines (56 loc) · 1.66 KB
/
generic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef _GENERIC_H_
#define _GENERIC_H_
#define PTW32_STATIC_LIB
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<getopt.h> //strlen
#ifdef WIN32
#include<winsock2.h>
#include<ws2tcpip.h>
#include<unistd.h>
#include<windows.h>
#else
#include<pthread.h> //for threading , link with lpthread
#include<netdb.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<signal.h>
#endif // head files check
// my headers start from here
#include "BaseAPI.h"
#include "CMD_Protocol.h"
#include "SocksBase.h"
#include "Sock_Tunnel.h"
#include "ssocksd_pro.h"
#include "Lcx_Base.h"
#include "rssocks_pro.h"
// end my headers
#ifdef WIN32
#define MIC_THREAD_FUN_DEF(fun_name,parm) \
WINAPI DWORD fun_name(LPVOID parm)
#define MIC_THREAD_HANDLE_ID HANDLE
#define MIC_THREAD_CREATE(handle,fun_name,parm) \
CreateThread(NULL,0,fun_name,(void*)parm,0,NULL)
#define MIC_THREAD_JOIN(handle) \
Sleep(1)
#define MIC_THREAD_END() Sleep(1)
#define MIC_SLEEP(x) Sleep(x*1000)
#define MIC_USLEEP(x) Sleep(x);
#else
#define MIC_THREAD_FUN_DEF(fun_name,parm) \
void *fun_name(void *parm)
#define MIC_THREAD_HANDLE_ID pthread_t
#define MIC_THREAD_CREATE(handle ,fun_name,parm) \
pthread_create(&handle,NULL,fun_name,(void*)parm)
#define MIC_THREAD_JOIN(handle) \
pthread_join(handle ,NULL)
#define MIC_THREAD_END() pthread_detach(pthread_self())
#define MIC_SLEEP(x) sleep(x)
#define MIC_USLEEP(x) usleep(x*1000);
#endif
#define MAX_POOL 1000
#define True 1
#define False 0
#define TUNMAX_BUF 10000
#endif // _GENERIC_H_