From e573ed8da24e91484b45e5716c32e56c68717069 Mon Sep 17 00:00:00 2001 From: lotodore Date: Fri, 14 Aug 2009 14:56:29 +0000 Subject: [PATCH] Adding chat cleaner protocol files. --- src/third_party/asn1/ChatCleanerMessage.c | 86 ++++ src/third_party/asn1/ChatCleanerMessage.h | 60 +++ .../asn1/CleanerChatReplyMessage.c | 367 +++++++++++++++ .../asn1/CleanerChatReplyMessage.h | 54 +++ .../asn1/CleanerChatRequestMessage.c | 421 ++++++++++++++++++ .../asn1/CleanerChatRequestMessage.h | 46 ++ src/third_party/asn1/CleanerInitAckMessage.c | 128 ++++++ src/third_party/asn1/CleanerInitAckMessage.h | 42 ++ src/third_party/asn1/CleanerInitMessage.c | 128 ++++++ src/third_party/asn1/CleanerInitMessage.h | 42 ++ 10 files changed, 1374 insertions(+) create mode 100644 src/third_party/asn1/ChatCleanerMessage.c create mode 100644 src/third_party/asn1/ChatCleanerMessage.h create mode 100644 src/third_party/asn1/CleanerChatReplyMessage.c create mode 100644 src/third_party/asn1/CleanerChatReplyMessage.h create mode 100644 src/third_party/asn1/CleanerChatRequestMessage.c create mode 100644 src/third_party/asn1/CleanerChatRequestMessage.h create mode 100644 src/third_party/asn1/CleanerInitAckMessage.c create mode 100644 src/third_party/asn1/CleanerInitAckMessage.h create mode 100644 src/third_party/asn1/CleanerInitMessage.c create mode 100644 src/third_party/asn1/CleanerInitMessage.h diff --git a/src/third_party/asn1/ChatCleanerMessage.c b/src/third_party/asn1/ChatCleanerMessage.c new file mode 100644 index 00000000..d9a26f40 --- /dev/null +++ b/src/third_party/asn1/ChatCleanerMessage.c @@ -0,0 +1,86 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#include + +#include "ChatCleanerMessage.h" + +static asn_TYPE_member_t asn_MBR_ChatCleanerMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct ChatCleanerMessage, choice.cleanerInitMessage), + (ASN_TAG_CLASS_APPLICATION | (0 << 2)), + 0, + &asn_DEF_CleanerInitMessage, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerInitMessage" + }, + { ATF_NOFLAGS, 0, offsetof(struct ChatCleanerMessage, choice.cleanerInitAckMessage), + (ASN_TAG_CLASS_APPLICATION | (1 << 2)), + 0, + &asn_DEF_CleanerInitAckMessage, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerInitAckMessage" + }, + { ATF_NOFLAGS, 0, offsetof(struct ChatCleanerMessage, choice.cleanerChatRequestMessage), + (ASN_TAG_CLASS_APPLICATION | (2 << 2)), + 0, + &asn_DEF_CleanerChatRequestMessage, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerChatRequestMessage" + }, + { ATF_NOFLAGS, 0, offsetof(struct ChatCleanerMessage, choice.cleanerChatReplyMessage), + (ASN_TAG_CLASS_APPLICATION | (3 << 2)), + 0, + &asn_DEF_CleanerChatReplyMessage, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerChatReplyMessage" + }, +}; +static asn_TYPE_tag2member_t asn_MAP_ChatCleanerMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_APPLICATION | (0 << 2)), 0, 0, 0 }, /* cleanerInitMessage at 27 */ + { (ASN_TAG_CLASS_APPLICATION | (1 << 2)), 1, 0, 0 }, /* cleanerInitAckMessage at 28 */ + { (ASN_TAG_CLASS_APPLICATION | (2 << 2)), 2, 0, 0 }, /* cleanerChatRequestMessage at 29 */ + { (ASN_TAG_CLASS_APPLICATION | (3 << 2)), 3, 0, 0 } /* cleanerChatReplyMessage at 31 */ +}; +static asn_CHOICE_specifics_t asn_SPC_ChatCleanerMessage_specs_1 = { + sizeof(struct ChatCleanerMessage), + offsetof(struct ChatCleanerMessage, _asn_ctx), + offsetof(struct ChatCleanerMessage, present), + sizeof(((struct ChatCleanerMessage *)0)->present), + asn_MAP_ChatCleanerMessage_tag2el_1, + 4, /* Count of tags in the map */ + 0, + 4 /* Extensions start */ +}; +asn_TYPE_descriptor_t asn_DEF_ChatCleanerMessage = { + "ChatCleanerMessage", + "ChatCleanerMessage", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + 0, /* No PER visible constraints */ + asn_MBR_ChatCleanerMessage_1, + 4, /* Elements count */ + &asn_SPC_ChatCleanerMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/third_party/asn1/ChatCleanerMessage.h b/src/third_party/asn1/ChatCleanerMessage.h new file mode 100644 index 00000000..38d4863e --- /dev/null +++ b/src/third_party/asn1/ChatCleanerMessage.h @@ -0,0 +1,60 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#ifndef _ChatCleanerMessage_H_ +#define _ChatCleanerMessage_H_ + + +#include + +/* Including external dependencies */ +#include "CleanerInitMessage.h" +#include "CleanerInitAckMessage.h" +#include "CleanerChatRequestMessage.h" +#include "CleanerChatReplyMessage.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum ChatCleanerMessage_PR { + ChatCleanerMessage_PR_NOTHING, /* No components present */ + ChatCleanerMessage_PR_cleanerInitMessage, + ChatCleanerMessage_PR_cleanerInitAckMessage, + ChatCleanerMessage_PR_cleanerChatRequestMessage, + ChatCleanerMessage_PR_cleanerChatReplyMessage, + /* Extensions may appear below */ + +} ChatCleanerMessage_PR; + +/* ChatCleanerMessage */ +typedef struct ChatCleanerMessage { + ChatCleanerMessage_PR present; + union ChatCleanerMessage_u { + CleanerInitMessage_t cleanerInitMessage; + CleanerInitAckMessage_t cleanerInitAckMessage; + CleanerChatRequestMessage_t cleanerChatRequestMessage; + CleanerChatReplyMessage_t cleanerChatReplyMessage; + /* + * This type is extensible, + * possible extensions are below. + */ + } choice; + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} ChatCleanerMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_ChatCleanerMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _ChatCleanerMessage_H_ */ diff --git a/src/third_party/asn1/CleanerChatReplyMessage.c b/src/third_party/asn1/CleanerChatReplyMessage.c new file mode 100644 index 00000000..35f35690 --- /dev/null +++ b/src/third_party/asn1/CleanerChatReplyMessage.c @@ -0,0 +1,367 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#include + +#include "CleanerChatReplyMessage.h" + +static int +requestId_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +requestId_2_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; + 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 */ +} + +static void +requestId_2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + requestId_2_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +requestId_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +requestId_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + requestId_2_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +requestId_2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +requestId_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + requestId_2_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +requestId_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static int +cleanerActionType_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + /* Replace with underlying type checker */ + td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; + return td->check_constraints(td, sptr, ctfailcb, app_key); +} + +/* + * This type is implemented using NativeEnumerated, + * so here we adjust the DEF accordingly. + */ +static void +cleanerActionType_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { + td->free_struct = asn_DEF_NativeEnumerated.free_struct; + td->print_struct = asn_DEF_NativeEnumerated.print_struct; + td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; + td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; + td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; + td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; + td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; + td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + if(!td->per_constraints) + td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; + td->elements = asn_DEF_NativeEnumerated.elements; + td->elements_count = asn_DEF_NativeEnumerated.elements_count; + /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ +} + +static void +cleanerActionType_3_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +cleanerActionType_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +cleanerActionType_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +cleanerActionType_3_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +cleanerActionType_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +cleanerActionType_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + cleanerActionType_3_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static int +memb_requestId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +static int +memb_cleanerText_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTF8String_t *st = (const UTF8String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = UTF8String_length(st); + if((ssize_t)size < 0) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: UTF-8: broken encoding (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((size >= 1 && size <= 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_INTEGER_specifics_t asn_SPC_requestId_specs_2 = { + 0, 0, 0, 0, 0, + 0, /* Native long size */ + 1 /* Unsigned representation */ +}; +static ber_tlv_tag_t asn_DEF_requestId_tags_2[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_requestId_2 = { + "requestId", + "requestId", + requestId_2_free, + requestId_2_print, + requestId_2_constraint, + requestId_2_decode_ber, + requestId_2_encode_der, + requestId_2_decode_xer, + requestId_2_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_requestId_tags_2, + sizeof(asn_DEF_requestId_tags_2) + /sizeof(asn_DEF_requestId_tags_2[0]), /* 1 */ + asn_DEF_requestId_tags_2, /* Same as above */ + sizeof(asn_DEF_requestId_tags_2) + /sizeof(asn_DEF_requestId_tags_2[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_SPC_requestId_specs_2 /* Additional specs */ +}; + +static asn_INTEGER_enum_map_t asn_MAP_cleanerActionType_value2enum_3[] = { + { 0, 17, "cleanerActionNone" }, + { 1, 20, "cleanerActionWarning" }, + { 2, 17, "cleanerActionKick" }, + { 3, 16, "cleanerActionBan" } +}; +static unsigned int asn_MAP_cleanerActionType_enum2value_3[] = { + 3, /* cleanerActionBan(3) */ + 2, /* cleanerActionKick(2) */ + 0, /* cleanerActionNone(0) */ + 1 /* cleanerActionWarning(1) */ +}; +static asn_INTEGER_specifics_t asn_SPC_cleanerActionType_specs_3 = { + asn_MAP_cleanerActionType_value2enum_3, /* "tag" => N; sorted by tag */ + asn_MAP_cleanerActionType_enum2value_3, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0 +}; +static ber_tlv_tag_t asn_DEF_cleanerActionType_tags_3[] = { + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_cleanerActionType_3 = { + "cleanerActionType", + "cleanerActionType", + cleanerActionType_3_free, + cleanerActionType_3_print, + cleanerActionType_3_constraint, + cleanerActionType_3_decode_ber, + cleanerActionType_3_encode_der, + cleanerActionType_3_decode_xer, + cleanerActionType_3_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_cleanerActionType_tags_3, + sizeof(asn_DEF_cleanerActionType_tags_3) + /sizeof(asn_DEF_cleanerActionType_tags_3[0]), /* 1 */ + asn_DEF_cleanerActionType_tags_3, /* Same as above */ + sizeof(asn_DEF_cleanerActionType_tags_3) + /sizeof(asn_DEF_cleanerActionType_tags_3[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* Defined elsewhere */ + &asn_SPC_cleanerActionType_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_CleanerChatReplyMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatReplyMessage, requestId), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_requestId_2, + memb_requestId_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "requestId" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatReplyMessage, cleanerActionType), + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), + 0, + &asn_DEF_cleanerActionType_3, + 0, /* Defer constraints checking to the member type */ + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerActionType" + }, + { ATF_POINTER, 1, offsetof(struct CleanerChatReplyMessage, cleanerText), + (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + 0, + &asn_DEF_UTF8String, + memb_cleanerText_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "cleanerText" + }, +}; +static ber_tlv_tag_t asn_DEF_CleanerChatReplyMessage_tags_1[] = { + (ASN_TAG_CLASS_APPLICATION | (3 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CleanerChatReplyMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* requestId at 51 */ + { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 }, /* cleanerActionType at 53 */ + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 2, 0, 0 } /* cleanerText at 58 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CleanerChatReplyMessage_specs_1 = { + sizeof(struct CleanerChatReplyMessage), + offsetof(struct CleanerChatReplyMessage, _asn_ctx), + asn_MAP_CleanerChatReplyMessage_tag2el_1, + 3, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CleanerChatReplyMessage = { + "CleanerChatReplyMessage", + "CleanerChatReplyMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CleanerChatReplyMessage_tags_1, + sizeof(asn_DEF_CleanerChatReplyMessage_tags_1) + /sizeof(asn_DEF_CleanerChatReplyMessage_tags_1[0]) - 1, /* 1 */ + asn_DEF_CleanerChatReplyMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_CleanerChatReplyMessage_tags_1) + /sizeof(asn_DEF_CleanerChatReplyMessage_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_CleanerChatReplyMessage_1, + 3, /* Elements count */ + &asn_SPC_CleanerChatReplyMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/third_party/asn1/CleanerChatReplyMessage.h b/src/third_party/asn1/CleanerChatReplyMessage.h new file mode 100644 index 00000000..69ab82f6 --- /dev/null +++ b/src/third_party/asn1/CleanerChatReplyMessage.h @@ -0,0 +1,54 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#ifndef _CleanerChatReplyMessage_H_ +#define _CleanerChatReplyMessage_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum cleanerActionType { + cleanerActionType_cleanerActionNone = 0, + cleanerActionType_cleanerActionWarning = 1, + cleanerActionType_cleanerActionKick = 2, + cleanerActionType_cleanerActionBan = 3 +} e_cleanerActionType; + +/* CleanerChatReplyMessage */ +typedef struct CleanerChatReplyMessage { + unsigned long requestId; + long cleanerActionType; + UTF8String_t *cleanerText /* OPTIONAL */; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CleanerChatReplyMessage_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_requestId_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_cleanerActionType_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_CleanerChatReplyMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _CleanerChatReplyMessage_H_ */ diff --git a/src/third_party/asn1/CleanerChatRequestMessage.c b/src/third_party/asn1/CleanerChatRequestMessage.c new file mode 100644 index 00000000..cf3321ee --- /dev/null +++ b/src/third_party/asn1/CleanerChatRequestMessage.c @@ -0,0 +1,421 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#include + +#include "CleanerChatRequestMessage.h" + +static int +requestId_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +requestId_2_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; + 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 */ +} + +static void +requestId_2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + requestId_2_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +requestId_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +requestId_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + requestId_2_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +requestId_2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +requestId_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + requestId_2_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +requestId_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + requestId_2_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static int +playerId_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +/* + * This type is implemented using NativeInteger, + * so here we adjust the DEF accordingly. + */ +static void +playerId_3_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; + 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 */ +} + +static void +playerId_3_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) { + playerId_3_inherit_TYPE_descriptor(td); + td->free_struct(td, struct_ptr, contents_only); +} + +static int +playerId_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { + playerId_3_inherit_TYPE_descriptor(td); + return td->print_struct(td, struct_ptr, ilevel, cb, app_key); +} + +static asn_dec_rval_t +playerId_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, size_t size, int tag_mode) { + playerId_3_inherit_TYPE_descriptor(td); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); +} + +static asn_enc_rval_t +playerId_3_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { + playerId_3_inherit_TYPE_descriptor(td); + return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); +} + +static asn_dec_rval_t +playerId_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, const void *bufptr, size_t size) { + playerId_3_inherit_TYPE_descriptor(td); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); +} + +static asn_enc_rval_t +playerId_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { + playerId_3_inherit_TYPE_descriptor(td); + return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); +} + +static int +memb_requestId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +static int +memb_playerId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + unsigned long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const unsigned long *)sptr; + + /* Constraint check succeeded */ + return 0; +} + +static int +memb_playerName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTF8String_t *st = (const UTF8String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = UTF8String_length(st); + if((ssize_t)size < 0) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: UTF-8: broken encoding (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((size >= 1 && size <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_chatMessage_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTF8String_t *st = (const UTF8String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = UTF8String_length(st); + if((ssize_t)size < 0) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: UTF-8: broken encoding (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((size >= 1 && size <= 128)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_INTEGER_specifics_t asn_SPC_requestId_specs_2 = { + 0, 0, 0, 0, 0, + 0, /* Native long size */ + 1 /* Unsigned representation */ +}; +static ber_tlv_tag_t asn_DEF_requestId_tags_2[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_requestId_2 = { + "requestId", + "requestId", + requestId_2_free, + requestId_2_print, + requestId_2_constraint, + requestId_2_decode_ber, + requestId_2_encode_der, + requestId_2_decode_xer, + requestId_2_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_requestId_tags_2, + sizeof(asn_DEF_requestId_tags_2) + /sizeof(asn_DEF_requestId_tags_2[0]), /* 1 */ + asn_DEF_requestId_tags_2, /* Same as above */ + sizeof(asn_DEF_requestId_tags_2) + /sizeof(asn_DEF_requestId_tags_2[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_SPC_requestId_specs_2 /* Additional specs */ +}; + +static asn_INTEGER_specifics_t asn_SPC_playerId_specs_3 = { + 0, 0, 0, 0, 0, + 0, /* Native long size */ + 1 /* Unsigned representation */ +}; +static ber_tlv_tag_t asn_DEF_playerId_tags_3[] = { + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) +}; +static /* Use -fall-defs-global to expose */ +asn_TYPE_descriptor_t asn_DEF_playerId_3 = { + "playerId", + "playerId", + playerId_3_free, + playerId_3_print, + playerId_3_constraint, + playerId_3_decode_ber, + playerId_3_encode_der, + playerId_3_decode_xer, + playerId_3_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_playerId_tags_3, + sizeof(asn_DEF_playerId_tags_3) + /sizeof(asn_DEF_playerId_tags_3[0]), /* 1 */ + asn_DEF_playerId_tags_3, /* Same as above */ + sizeof(asn_DEF_playerId_tags_3) + /sizeof(asn_DEF_playerId_tags_3[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, 0, /* No members */ + &asn_SPC_playerId_specs_3 /* Additional specs */ +}; + +static asn_TYPE_member_t asn_MBR_CleanerChatRequestMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatRequestMessage, requestId), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_requestId_2, + memb_requestId_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "requestId" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatRequestMessage, playerId), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_playerId_3, + memb_playerId_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "playerId" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatRequestMessage, playerName), + (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + 0, + &asn_DEF_UTF8String, + memb_playerName_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "playerName" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerChatRequestMessage, chatMessage), + (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + 0, + &asn_DEF_UTF8String, + memb_chatMessage_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "chatMessage" + }, +}; +static ber_tlv_tag_t asn_DEF_CleanerChatRequestMessage_tags_1[] = { + (ASN_TAG_CLASS_APPLICATION | (2 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CleanerChatRequestMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* requestId at 44 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* playerId at 45 */ + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 2, 0, 1 }, /* playerName at 46 */ + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 3, -1, 0 } /* chatMessage at 47 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CleanerChatRequestMessage_specs_1 = { + sizeof(struct CleanerChatRequestMessage), + offsetof(struct CleanerChatRequestMessage, _asn_ctx), + asn_MAP_CleanerChatRequestMessage_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 3, /* Start extensions */ + 5 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CleanerChatRequestMessage = { + "CleanerChatRequestMessage", + "CleanerChatRequestMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CleanerChatRequestMessage_tags_1, + sizeof(asn_DEF_CleanerChatRequestMessage_tags_1) + /sizeof(asn_DEF_CleanerChatRequestMessage_tags_1[0]) - 1, /* 1 */ + asn_DEF_CleanerChatRequestMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_CleanerChatRequestMessage_tags_1) + /sizeof(asn_DEF_CleanerChatRequestMessage_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_CleanerChatRequestMessage_1, + 4, /* Elements count */ + &asn_SPC_CleanerChatRequestMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/third_party/asn1/CleanerChatRequestMessage.h b/src/third_party/asn1/CleanerChatRequestMessage.h new file mode 100644 index 00000000..41198cfc --- /dev/null +++ b/src/third_party/asn1/CleanerChatRequestMessage.h @@ -0,0 +1,46 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#ifndef _CleanerChatRequestMessage_H_ +#define _CleanerChatRequestMessage_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CleanerChatRequestMessage */ +typedef struct CleanerChatRequestMessage { + unsigned long requestId; + unsigned long playerId; + UTF8String_t playerName; + UTF8String_t chatMessage; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CleanerChatRequestMessage_t; + +/* Implementation */ +/* extern asn_TYPE_descriptor_t asn_DEF_requestId_2; // (Use -fall-defs-global to expose) */ +/* extern asn_TYPE_descriptor_t asn_DEF_playerId_3; // (Use -fall-defs-global to expose) */ +extern asn_TYPE_descriptor_t asn_DEF_CleanerChatRequestMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _CleanerChatRequestMessage_H_ */ diff --git a/src/third_party/asn1/CleanerInitAckMessage.c b/src/third_party/asn1/CleanerInitAckMessage.c new file mode 100644 index 00000000..be967e18 --- /dev/null +++ b/src/third_party/asn1/CleanerInitAckMessage.c @@ -0,0 +1,128 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#include + +#include "CleanerInitAckMessage.h" + +static int +memb_serverVersion_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_serverSecret_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTF8String_t *st = (const UTF8String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = UTF8String_length(st); + if((ssize_t)size < 0) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: UTF-8: broken encoding (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((size >= 1 && size <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_TYPE_member_t asn_MBR_CleanerInitAckMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CleanerInitAckMessage, serverVersion), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + memb_serverVersion_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "serverVersion" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerInitAckMessage, serverSecret), + (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + 0, + &asn_DEF_UTF8String, + memb_serverSecret_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "serverSecret" + }, +}; +static ber_tlv_tag_t asn_DEF_CleanerInitAckMessage_tags_1[] = { + (ASN_TAG_CLASS_APPLICATION | (1 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CleanerInitAckMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* serverVersion at 39 */ + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* serverSecret at 40 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CleanerInitAckMessage_specs_1 = { + sizeof(struct CleanerInitAckMessage), + offsetof(struct CleanerInitAckMessage, _asn_ctx), + asn_MAP_CleanerInitAckMessage_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CleanerInitAckMessage = { + "CleanerInitAckMessage", + "CleanerInitAckMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CleanerInitAckMessage_tags_1, + sizeof(asn_DEF_CleanerInitAckMessage_tags_1) + /sizeof(asn_DEF_CleanerInitAckMessage_tags_1[0]) - 1, /* 1 */ + asn_DEF_CleanerInitAckMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_CleanerInitAckMessage_tags_1) + /sizeof(asn_DEF_CleanerInitAckMessage_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_CleanerInitAckMessage_1, + 2, /* Elements count */ + &asn_SPC_CleanerInitAckMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/third_party/asn1/CleanerInitAckMessage.h b/src/third_party/asn1/CleanerInitAckMessage.h new file mode 100644 index 00000000..2ac671b7 --- /dev/null +++ b/src/third_party/asn1/CleanerInitAckMessage.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#ifndef _CleanerInitAckMessage_H_ +#define _CleanerInitAckMessage_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CleanerInitAckMessage */ +typedef struct CleanerInitAckMessage { + long serverVersion; + UTF8String_t serverSecret; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CleanerInitAckMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CleanerInitAckMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _CleanerInitAckMessage_H_ */ diff --git a/src/third_party/asn1/CleanerInitMessage.c b/src/third_party/asn1/CleanerInitMessage.c new file mode 100644 index 00000000..5b2309c1 --- /dev/null +++ b/src/third_party/asn1/CleanerInitMessage.c @@ -0,0 +1,128 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#include + +#include "CleanerInitMessage.h" + +static int +memb_requestedVersion_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + long value; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + value = *(const long *)sptr; + + if((value >= 0 && value <= 65535)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static int +memb_clientSecret_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) { + const UTF8String_t *st = (const UTF8String_t *)sptr; + size_t size; + + if(!sptr) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + size = UTF8String_length(st); + if((ssize_t)size < 0) { + _ASN_CTFAIL(app_key, td, sptr, + "%s: UTF-8: broken encoding (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if((size >= 1 && size <= 32)) { + /* Constraint check succeeded */ + return 0; + } else { + _ASN_CTFAIL(app_key, td, sptr, + "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } +} + +static asn_TYPE_member_t asn_MBR_CleanerInitMessage_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct CleanerInitMessage, requestedVersion), + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), + 0, + &asn_DEF_NativeInteger, + memb_requestedVersion_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "requestedVersion" + }, + { ATF_NOFLAGS, 0, offsetof(struct CleanerInitMessage, clientSecret), + (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), + 0, + &asn_DEF_UTF8String, + memb_clientSecret_constraint_1, + 0, /* PER is not compiled, use -gen-PER */ + 0, + "clientSecret" + }, +}; +static ber_tlv_tag_t asn_DEF_CleanerInitMessage_tags_1[] = { + (ASN_TAG_CLASS_APPLICATION | (0 << 2)), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static asn_TYPE_tag2member_t asn_MAP_CleanerInitMessage_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* requestedVersion at 34 */ + { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* clientSecret at 35 */ +}; +static asn_SEQUENCE_specifics_t asn_SPC_CleanerInitMessage_specs_1 = { + sizeof(struct CleanerInitMessage), + offsetof(struct CleanerInitMessage, _asn_ctx), + asn_MAP_CleanerInitMessage_tag2el_1, + 2, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ +}; +asn_TYPE_descriptor_t asn_DEF_CleanerInitMessage = { + "CleanerInitMessage", + "CleanerInitMessage", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, /* Use generic outmost tag fetcher */ + asn_DEF_CleanerInitMessage_tags_1, + sizeof(asn_DEF_CleanerInitMessage_tags_1) + /sizeof(asn_DEF_CleanerInitMessage_tags_1[0]) - 1, /* 1 */ + asn_DEF_CleanerInitMessage_tags_1, /* Same as above */ + sizeof(asn_DEF_CleanerInitMessage_tags_1) + /sizeof(asn_DEF_CleanerInitMessage_tags_1[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_CleanerInitMessage_1, + 2, /* Elements count */ + &asn_SPC_CleanerInitMessage_specs_1 /* Additional specs */ +}; + diff --git a/src/third_party/asn1/CleanerInitMessage.h b/src/third_party/asn1/CleanerInitMessage.h new file mode 100644 index 00000000..a3458f17 --- /dev/null +++ b/src/third_party/asn1/CleanerInitMessage.h @@ -0,0 +1,42 @@ +/* + * Generated by asn1c-0.9.22 (http://lionet.info/asn1c) + * From ASN.1 module "CHATCLEANER-PROTOCOL" + * found in "../../../docs/chatcleaner.asn1" + */ + +#ifndef _CleanerInitMessage_H_ +#define _CleanerInitMessage_H_ + + +#include + +/* Including external dependencies */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CleanerInitMessage */ +typedef struct CleanerInitMessage { + long requestedVersion; + UTF8String_t clientSecret; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} CleanerInitMessage_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_CleanerInitMessage; + +#ifdef __cplusplus +} +#endif + +#endif /* _CleanerInitMessage_H_ */