diff options
author | eihrul <eihrul> | 2008-09-15 23:11:22 +0000 |
---|---|---|
committer | eihrul <eihrul> | 2008-09-15 23:11:22 +0000 |
commit | b846c47521bcf2978bf9f6c3a39e0e8a324664be (patch) | |
tree | 8faa2e1b7ec3d8fd8e9a18b15a21bd2c3d1eb31d /include | |
parent | 6cf5ada45ceaff7c56a413b9c14d602a49d1c975 (diff) | |
download | enet-b846c47521bcf2978bf9f6c3a39e0e8a324664be.tar.gz enet-b846c47521bcf2978bf9f6c3a39e0e8a324664be.zip |
added miscellaneous updates for broadcasting
Diffstat (limited to 'include')
-rw-r--r-- | include/enet/enet.h | 8 | ||||
-rw-r--r-- | include/enet/unix.h | 9 | ||||
-rw-r--r-- | include/enet/win32.h | 7 |
3 files changed, 22 insertions, 2 deletions
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 <stdlib.h> +#include <sys/time.h> #include <sys/types.h> #include <netinet/in.h> +#include <unistd.h> 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__ */ |