mirror of
https://github.com/DrBeef/Raze.git
synced 2024-12-16 15:40:58 +00:00
015acc9fb9
git-svn-id: https://svn.eduke32.com/eduke32@4512 1a8010ca-5511-0410-912e-c29ae57300e0
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
/**
|
|
@file unix.h
|
|
@brief ENet Unix header
|
|
*/
|
|
#ifndef __ENET_UNIX_H__
|
|
#define __ENET_UNIX_H__
|
|
|
|
#include <stdlib.h>
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#if defined(GEKKO)
|
|
# include <network.h>
|
|
#else
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#endif
|
|
#include <unistd.h>
|
|
|
|
#ifdef MSG_MAXIOVLEN
|
|
#define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN
|
|
#endif
|
|
|
|
typedef int ENetSocket;
|
|
|
|
#define ENET_SOCKET_NULL -1
|
|
|
|
#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
|
|
#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
|
|
|
|
#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
|
|
#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
|
|
|
|
typedef struct
|
|
{
|
|
void * data;
|
|
size_t dataLength;
|
|
} ENetBuffer;
|
|
|
|
#define ENET_CALLBACK
|
|
|
|
#define ENET_API extern
|
|
|
|
typedef fd_set ENetSocketSet;
|
|
|
|
#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset))
|
|
#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset))
|
|
#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset))
|
|
#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset))
|
|
|
|
#endif /* __ENET_UNIX_H__ */
|
|
|