Preparing use of boost Uuids for unique ids which can be used to rejoin a game (Ticket #5). This requires boost 1.42 or later.

This commit is contained in:
lotodore
2011-02-09 21:45:33 +00:00
parent d93aae6b50
commit 372c2466e8
5 changed files with 35 additions and 34 deletions
+1 -3
View File
@@ -10,9 +10,7 @@ Linux:
- gnutls (e.g. version 2.2.2) --> http://www.gnu.org/software/gnutls/
- libboost_thread, libboost_filesystem, libboost_datetime, libboost_program_options,
libboost_iostreams, libboost_asio, libboost_regex
(version >= 1.36, 1.45.0 recommended) --> http://www.boost.org/
NOTE: Please do not use boost 1.39.0 for the dedicated server, due to bug
https://svn.boost.org/trac/boost/ticket/3095
(version >= 1.42, latest always recommended) --> http://www.boost.org/
- libSDL_mixer, libSDL --> http://www.libsdl.org/
- libSQLite >= 3.0 --> http://sqlite.org/
- libtinyxml > 2.0 --> http://www.sourceforge.net/projects/tinyxml
+1 -1
View File
@@ -765,7 +765,7 @@ NonZeroId ::= INTEGER(1..4294967295)
Id ::= INTEGER(0..4294967295)
Guid ::= INTEGER(0..4294967295) -- TODO
Guid ::= OCTET STRING (SIZE(16))
Card ::= INTEGER(0..51)
+27 -24
View File
@@ -10,7 +10,8 @@
int
Guid_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
unsigned long value;
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
@@ -19,31 +20,38 @@ Guid_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
value = *(const unsigned long *)sptr;
size = st->size;
/* Constraint check succeeded */
return 0;
if((size == 16)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using NativeInteger,
* This type is implemented using OCTET_STRING,
* so here we adjust the DEF accordingly.
*/
static void
Guid_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_NativeInteger.free_struct;
td->print_struct = asn_DEF_NativeInteger.print_struct;
td->ber_decoder = asn_DEF_NativeInteger.ber_decoder;
td->der_encoder = asn_DEF_NativeInteger.der_encoder;
td->xer_decoder = asn_DEF_NativeInteger.xer_decoder;
td->xer_encoder = asn_DEF_NativeInteger.xer_encoder;
td->uper_decoder = asn_DEF_NativeInteger.uper_decoder;
td->uper_encoder = asn_DEF_NativeInteger.uper_encoder;
td->free_struct = asn_DEF_OCTET_STRING.free_struct;
td->print_struct = asn_DEF_OCTET_STRING.print_struct;
td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder;
td->der_encoder = asn_DEF_OCTET_STRING.der_encoder;
td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder;
td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder;
td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder;
td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_NativeInteger.per_constraints;
td->elements = asn_DEF_NativeInteger.elements;
td->elements_count = asn_DEF_NativeInteger.elements_count;
/* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */
td->per_constraints = asn_DEF_OCTET_STRING.per_constraints;
td->elements = asn_DEF_OCTET_STRING.elements;
td->elements_count = asn_DEF_OCTET_STRING.elements_count;
td->specifics = asn_DEF_OCTET_STRING.specifics;
}
void
@@ -90,13 +98,8 @@ Guid_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
static asn_INTEGER_specifics_t asn_SPC_Guid_specs_1 = {
0, 0, 0, 0, 0,
0, /* Native long size */
1 /* Unsigned representation */
};
static ber_tlv_tag_t asn_DEF_Guid_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Guid = {
"Guid",
@@ -118,6 +121,6 @@ asn_TYPE_descriptor_t asn_DEF_Guid = {
/sizeof(asn_DEF_Guid_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
0, 0, /* No members */
&asn_SPC_Guid_specs_1 /* Additional specs */
0 /* No specifics */
};
+2 -2
View File
@@ -12,14 +12,14 @@
#include <asn_application.h>
/* Including external dependencies */
#include <NativeInteger.h>
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Guid */
typedef unsigned long Guid_t;
typedef OCTET_STRING_t Guid_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Guid;
+4 -4
View File
@@ -9,7 +9,7 @@
static asn_TYPE_member_t asn_MBR_InitAckMessage_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct InitAckMessage, yourSessionId),
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
0,
&asn_DEF_Guid,
0, /* Defer constraints checking to the member type */
@@ -41,9 +41,9 @@ static ber_tlv_tag_t asn_DEF_InitAckMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_InitAckMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* yourSessionId at 144 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* yourPlayerId at 145 */
{ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 2, 0, 0 } /* yourAvatar at 146 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* yourPlayerId at 145 */
{ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 1 }, /* yourSessionId at 144 */
{ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 2, -1, 0 } /* yourAvatar at 146 */
};
static asn_SEQUENCE_specifics_t asn_SPC_InitAckMessage_specs_1 = {
sizeof(struct InitAckMessage),