diff --git a/src/third_party/asn1/AnonymousLogin.c b/src/third_party/asn1/AnonymousLogin.c index 7309c58b..5b77a51b 100644 --- a/src/third_party/asn1/AnonymousLogin.c +++ b/src/third_party/asn1/AnonymousLogin.c @@ -8,12 +8,44 @@ #include "AnonymousLogin.h" +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 <= 64)) { + /* 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_AnonymousLogin_1[] = { { ATF_NOFLAGS, 0, offsetof(struct AnonymousLogin, playerName), (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_playerName_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "playerName" diff --git a/src/third_party/asn1/AuthenticatedLogin.c b/src/third_party/asn1/AuthenticatedLogin.c index 38e9ce5f..793b3a43 100644 --- a/src/third_party/asn1/AuthenticatedLogin.c +++ b/src/third_party/asn1/AuthenticatedLogin.c @@ -8,12 +8,44 @@ #include "AuthenticatedLogin.h" +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 <= 64)) { + /* 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_AuthenticatedLogin_1[] = { { ATF_NOFLAGS, 0, offsetof(struct AuthenticatedLogin, playerName), (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_playerName_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "playerName" diff --git a/src/third_party/asn1/ChatMessage.c b/src/third_party/asn1/ChatMessage.c index da421be5..f45ad3a4 100644 --- a/src/third_party/asn1/ChatMessage.c +++ b/src/third_party/asn1/ChatMessage.c @@ -8,6 +8,38 @@ #include "ChatMessage.h" +static int +memb_chatText_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_TYPE_member_t asn_MBR_ChatMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct ChatMessage, playerId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -31,7 +63,7 @@ static asn_TYPE_member_t asn_MBR_ChatMessage_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_chatText_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "chatText" diff --git a/src/third_party/asn1/ChatRequestMessage.c b/src/third_party/asn1/ChatRequestMessage.c index 9cfd3822..7bf55793 100644 --- a/src/third_party/asn1/ChatRequestMessage.c +++ b/src/third_party/asn1/ChatRequestMessage.c @@ -8,6 +8,38 @@ #include "ChatRequestMessage.h" +static int +memb_chatText_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_TYPE_member_t asn_MBR_ChatRequestMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct ChatRequestMessage, gameId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -22,7 +54,7 @@ static asn_TYPE_member_t asn_MBR_ChatRequestMessage_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_chatText_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "chatText" diff --git a/src/third_party/asn1/DialogMessage.c b/src/third_party/asn1/DialogMessage.c index 0c943ee6..ac3da675 100644 --- a/src/third_party/asn1/DialogMessage.c +++ b/src/third_party/asn1/DialogMessage.c @@ -8,12 +8,44 @@ #include "DialogMessage.h" +static int +memb_notificationText_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_TYPE_member_t asn_MBR_DialogMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct DialogMessage, notificationText), (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_notificationText_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "notificationText" diff --git a/src/third_party/asn1/JoinGameRequestMessage.c b/src/third_party/asn1/JoinGameRequestMessage.c index cbc5cd3f..707979e3 100644 --- a/src/third_party/asn1/JoinGameRequestMessage.c +++ b/src/third_party/asn1/JoinGameRequestMessage.c @@ -8,6 +8,38 @@ #include "JoinGameRequestMessage.h" +static int +memb_password_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 <= 64)) { + /* 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_joinGameAction_2[] = { { ATF_NOFLAGS, 0, offsetof(struct joinGameAction, choice.joinExistingGame), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), @@ -79,7 +111,7 @@ static asn_TYPE_member_t asn_MBR_JoinGameRequestMessage_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_password_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "password" diff --git a/src/third_party/asn1/NetGameInfo.c b/src/third_party/asn1/NetGameInfo.c index 00bddaef..b50f9823 100644 --- a/src/third_party/asn1/NetGameInfo.c +++ b/src/third_party/asn1/NetGameInfo.c @@ -156,6 +156,38 @@ memb_NativeInteger_constraint_17(asn_TYPE_descriptor_t *td, const void *sptr, } } +static int +memb_gameName_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 <= 64)) { + /* 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_maxNumPlayers_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { @@ -484,7 +516,7 @@ static asn_TYPE_member_t asn_MBR_NetGameInfo_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_gameName_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "gameName" diff --git a/src/third_party/asn1/PlayerInfoData.c b/src/third_party/asn1/PlayerInfoData.c index b61431a9..5b536358 100644 --- a/src/third_party/asn1/PlayerInfoData.c +++ b/src/third_party/asn1/PlayerInfoData.c @@ -8,6 +8,38 @@ #include "PlayerInfoData.h" +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 <= 64)) { + /* 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_avatarData_4[] = { { ATF_NOFLAGS, 0, offsetof(struct avatarData, avatarType), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), @@ -74,7 +106,7 @@ static asn_TYPE_member_t asn_MBR_PlayerInfoData_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, &asn_DEF_UTF8String, - 0, /* Defer constraints checking to the member type */ + memb_playerName_constraint_1, 0, /* PER is not compiled, use -gen-PER */ 0, "playerName"