From 27d41dd2ae1d9b43cbf3c282241ef22ddf87242d Mon Sep 17 00:00:00 2001 From: lsalzman Date: Tue, 7 May 2013 10:11:22 +0300 Subject: [PATCH] add enet_linked_version() for querying linked version --- ChangeLog | 2 ++ callbacks.c | 6 ++++++ include/enet/enet.h | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 45b1eb2..ddb34eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ +* added enet_linked_version() for checking the linked version * added enet_socket_get_address() for querying the local address of a socket +* silenced some debugging prints unless ENET_DEBUG is defined during compilation ENet 1.3.7 (March 6, 2013): diff --git a/callbacks.c b/callbacks.c index f941282..b3990af 100644 --- a/callbacks.c +++ b/callbacks.c @@ -27,6 +27,12 @@ enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits return enet_initialize (); } + +ENetVersion +enet_linked_version (void) +{ + return ENET_VERSION; +} void * enet_malloc (size_t size) diff --git a/include/enet/enet.h b/include/enet/enet.h index 68a8233..e32d68f 100644 --- a/include/enet/enet.h +++ b/include/enet/enet.h @@ -27,6 +27,9 @@ extern "C" #define ENET_VERSION_MINOR 3 #define ENET_VERSION_PATCH 7 #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) +#define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF) +#define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF) +#define ENET_VERSION_GET_PATCH(version) ((version)&0xFF) #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) typedef enet_uint32 ENetVersion; @@ -452,6 +455,12 @@ ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCall */ ENET_API void enet_deinitialize (void); +/** + Gives the linked version of the ENet library. + @returns the version number +*/ +ENET_API ENetVersion enet_linked_version (void); + /** @} */ /** @defgroup private ENet private implementation functions */