natsvr.h

来自「自己开发基于P2P通讯的网络服务器」· C头文件 代码 · 共 67 行

H
67
字号
#ifndef	_NATSVR_H
#define _NATSVR_H

#include "natpacket.h"

#ifdef _WIN32

#include <winsock.h>
#define strncasecmp		_strnicmp
#define strcasecmp		_stricmp

typedef int		socklen_t;

#define close	closesocket
#define ioctl	ioctlsocket

#define EINPROGRESS		WSAEWOULDBLOCK

static int getSocketError() {	return WSAGetLastError(); }

#else

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <ctype.h>
#include <syslog.h>
#include <pthread.h>
#include <fcntl.h>
#include <errno.h>
#include <semaphore.h>
#include <time.h>
#include "md5.h"

static int getSocketError()
{
	return errno;
}

#endif

#define NIPQUAD(addr) \
	((unsigned char *)&addr)[0], \
	((unsigned char *)&addr)[1], \
	((unsigned char *)&addr)[2], \
	((unsigned char *)&addr)[3]

#ifndef	MAX_PATH
#define MAX_PATH  256
#endif

extern BOOL	g_bFinished;

#endif	// _NATSVR_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?