From b846c47521bcf2978bf9f6c3a39e0e8a324664be Mon Sep 17 00:00:00 2001 From: eihrul Date: Mon, 15 Sep 2008 23:11:22 +0000 Subject: added miscellaneous updates for broadcasting --- include/enet/enet.h | 8 ++++++-- include/enet/unix.h | 9 +++++++++ include/enet/win32.h | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/enet/enet.h b/include/enet/enet.h index 14106aa..cf7b2d0 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -46,7 +46,8 @@ typedef enum ENET_SOCKOPT_NONBLOCK = 1, ENET_SOCKOPT_BROADCAST = 2, ENET_SOCKOPT_RCVBUF = 3, - ENET_SOCKOPT_SNDBUF = 4 + ENET_SOCKOPT_SNDBUF = 4, + ENET_SOCKOPT_REUSEADDR = 5 } ENetSocketOption; enum @@ -403,7 +404,9 @@ ENET_API void enet_time_set (enet_uint32); /** @defgroup socket ENet socket functions @{ */ -ENET_API ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *); +ENET_API ENetSocket enet_socket_create (ENetSocketType); +ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); +ENET_API int enet_socket_listen (ENetSocket, int); ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t); @@ -411,6 +414,7 @@ ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer * ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32); ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int); ENET_API void enet_socket_destroy (ENetSocket); +ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32); /** @} */ diff --git a/include/enet/unix.h b/include/enet/unix.h index b20fecd..087015e 100644 --- a/include/enet/unix.h +++ b/include/enet/unix.h @@ -6,8 +6,10 @@ #define __ENET_UNIX_H__ #include +#include #include #include +#include typedef int ENetSocket; @@ -32,5 +34,12 @@ typedef struct #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_CLEAR (socket, & (sockset)) +#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) + #endif /* __ENET_UNIX_H__ */ diff --git a/include/enet/win32.h b/include/enet/win32.h index 310ecd5..0e1cf0c 100644 --- a/include/enet/win32.h +++ b/include/enet/win32.h @@ -46,6 +46,13 @@ typedef struct #define ENET_API extern #endif /* ENET_DLL */ +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_CLEAR (socket, & (sockset)) +#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) + #endif /* __ENET_WIN32_H__ */ -- cgit v1.2.3