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
+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 */
};