aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authoreihrul <eihrul>2010-05-14 02:04:42 +0000
committereihrul <eihrul>2010-05-14 02:04:42 +0000
commitc4138503f9986e9afe032476daf033bd2d95b4d8 (patch)
treec6e6daf4f3145f830689156aaa8a93963872efe4 /include
parent3ddbfb202d89675e1ba91c3cf053a0bd6ebbbf13 (diff)
downloadenet-c4138503f9986e9afe032476daf033bd2d95b4d8.tar.gz
enet-c4138503f9986e9afe032476daf033bd2d95b4d8.zip
added no_memory callback that allows overriding the default abort behavior
Diffstat (limited to 'include')
-rw-r--r--include/enet/callbacks.h1
-rw-r--r--include/enet/enet.h13
2 files changed, 9 insertions, 5 deletions
diff --git a/include/enet/callbacks.h b/include/enet/callbacks.h
index 0b9e693..b488ac7 100644
--- a/include/enet/callbacks.h
+++ b/include/enet/callbacks.h
@@ -12,6 +12,7 @@ typedef struct _ENetCallbacks
void * (ENET_CALLBACK * malloc) (size_t size);
void (ENET_CALLBACK * free) (void * memory);
int (ENET_CALLBACK * rand) (void);
+ void (ENET_CALLBACK * no_memory) (void);
} ENetCallbacks;
/** @defgroup callbacks ENet internal callbacks
diff --git a/include/enet/enet.h b/include/enet/enet.h
index b139976..2ffcb3f 100644
--- a/include/enet/enet.h
+++ b/include/enet/enet.h
@@ -23,10 +23,13 @@ extern "C"
#include "enet/list.h"
#include "enet/callbacks.h"
-typedef enum _ENetVersion
-{
- ENET_VERSION = 1
-} ENetVersion;
+#define ENET_VERSION_MAJOR 1
+#define ENET_VERSION_MINOR 2
+#define ENET_VERSION_PATCH 2
+#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
+#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
+
+typedef enet_uint32 ENetVersion;
typedef enum _ENetSocketType
{
@@ -376,7 +379,7 @@ typedef struct _ENetEvent
ENET_API int enet_initialize (void);
/**
- Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant.
+ Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored.
@param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
@param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults