Reorganize the folder structure and delete the Xcode build files

This commit is contained in:
Cameron Gutman
2016-03-31 07:22:03 -04:00
parent b7c7c98c45
commit 48a5d63045
39 changed files with 0 additions and 484 deletions

51
src/PlatformSockets.h Normal file
View File

@@ -0,0 +1,51 @@
#pragma once
#include "Limelight.h"
#include "Platform.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#define SetLastSocketError(x) WSASetLastError(x)
#define LastSocketError() WSAGetLastError()
#define SHUT_RDWR SD_BOTH
typedef int SOCK_RET;
typedef int SOCKADDR_LEN;
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <signal.h>
#define ioctlsocket ioctl
#define LastSocketError() errno
#define SetLastSocketError(x) errno = x
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
typedef int SOCKET;
typedef ssize_t SOCK_RET;
typedef socklen_t SOCKADDR_LEN;
#endif
#define LastSocketFail() ((LastSocketError() != 0) ? LastSocketError() : -1)
// IPv6 addresses have 2 extra characters for URL escaping
#define URLSAFESTRING_LEN (INET6_ADDRSTRLEN+2)
void addrToUrlSafeString(struct sockaddr_storage* addr, char* string);
SOCKET connectTcpSocket(struct sockaddr_storage* dstaddr, SOCKADDR_LEN addrlen, unsigned short port, int timeoutSec);
SOCKET bindUdpSocket(int addrfamily, int bufferSize);
int enableNoDelay(SOCKET s);
int recvUdpSocket(SOCKET s, char* buffer, int size);
void shutdownTcpSocket(SOCKET s);
void setRecvTimeout(SOCKET s, int timeoutSec);
void closeSocket(SOCKET s);