diff --git a/docs/pokerth.asn1 b/docs/pokerth.asn1 index 51554c39..5becf04c 100644 --- a/docs/pokerth.asn1 +++ b/docs/pokerth.asn1 @@ -268,7 +268,6 @@ PlayerInfoData ::= SEQUENCE { UnknownPlayerInfo ::= SEQUENCE { } - -- The following request will not be confirmed by the server. It is used, -- optionally, to reduce server traffic. The server might ignore it. SubscriptionRequestMessage ::= [APPLICATION 10] SEQUENCE { @@ -351,9 +350,9 @@ NetGameInfo ::= SEQUENCE { delayBetweenHands INTEGER(5..20), -- These are seconds playerActionTimeout INTEGER(0..60), -- These are seconds firstSmallBlind INTEGER(1..20000), - endRaiseSmallBlindValue INTEGER(0..1000000), - startMoney INTEGER(1..1000000), - manualBlinds SEQUENCE SIZE(0..30) OF INTEGER(1..1000000) + endRaiseSmallBlindValue InitialAmountOfMoney, + startMoney InitialNonZeroAmountOfMoney, + manualBlinds SEQUENCE SIZE(0..30) OF InitialNonZeroAmountOfMoney } GamePlayerMessage ::= [APPLICATION 13] SEQUENCE { @@ -442,7 +441,7 @@ StartEventAckMessage ::= [APPLICATION 21] SEQUENCE { RejoinPlayerData ::= SEQUENCE { playerId NonZeroId, - playerMoney INTEGER(0..10000000) + playerMoney AmountOfMoney } GameStartModeInitial ::= SEQUENCE { @@ -491,14 +490,14 @@ MyActionRequestMessage ::= [APPLICATION 25] SEQUENCE { handNum NonZeroId, gameState NetGameState, myAction NetPlayerAction, - myRelativeBet INTEGER(0..10000000) + myRelativeBet AmountOfMoney } YourActionRejectedMessage ::= [APPLICATION 26] SEQUENCE { gameId NonZeroId, gameState NetGameState, yourAction NetPlayerAction, - yourRelativeBet INTEGER(0..10000000), + yourRelativeBet AmountOfMoney, rejectionReason ENUMERATED { rejectedInvalidGameState (1), rejectedNotYourTurn (2), @@ -511,10 +510,10 @@ PlayersActionDoneMessage ::= [APPLICATION 27] SEQUENCE { playerId NonZeroId, gameState NetGameState, playerAction NetPlayerAction, - totalPlayerBet INTEGER(0..10000000), - playerMoney INTEGER(0..10000000), - highestSet INTEGER(0..10000000), - minimumRaise INTEGER(0..10000000) -- TODO + totalPlayerBet AmountOfMoney, + playerMoney AmountOfMoney, + highestSet AmountOfMoney, + minimumRaise AmountOfMoney } DealFlopCardsMessage ::= [APPLICATION 28] SEQUENCE { @@ -563,14 +562,14 @@ PlayerResult ::= SEQUENCE { resultCard2 Card, bestHandPosition SEQUENCE SIZE(5) OF INTEGER, -- TODO size restrictions cardsValue INTEGER, - moneyWon INTEGER(0..10000000), - playerMoney INTEGER(0..10000000) + moneyWon AmountOfMoney, + playerMoney AmountOfMoney } EndOfHandHideCards ::= SEQUENCE { playerId NonZeroId, - moneyWon INTEGER(0..10000000), - playerMoney INTEGER(0..10000000) + moneyWon AmountOfMoney, + playerMoney AmountOfMoney } ShowMyCardsRequestMessage ::= [APPLICATION 33] SEQUENCE { @@ -803,4 +802,8 @@ Guid ::= OCTET STRING (SIZE(16)) Card ::= INTEGER(0..51) +AmountOfMoney ::= INTEGER(0..10000000) +InitialAmountOfMoney ::= INTEGER(0..1000000) +InitialNonZeroAmountOfMoney ::= INTEGER(1..1000000) + END diff --git a/pokerth_protocol.pro b/pokerth_protocol.pro index c3c4cdca..97741e5e 100644 --- a/pokerth_protocol.pro +++ b/pokerth_protocol.pro @@ -32,6 +32,9 @@ HEADERS += src/third_party/asn1/AllInShowCardsMessage.h \ src/third_party/asn1/CleanerChatRequestMessage.h \ src/third_party/asn1/CleanerChatReplyMessage.h \ src/third_party/asn1/GuestLogin.h \ + src/third_party/asn1/AmountOfMoney.h \ + src/third_party/asn1/InitialAmountOfMoney.h \ + src/third_party/asn1/InitialNonZeroAmountOfMoney.h \ src/third_party/asn1/AskKickDeniedMessage.h \ src/third_party/asn1/AskKickPlayerMessage.h \ src/third_party/asn1/AuthMessage.h \ @@ -183,6 +186,9 @@ SOURCES += src/third_party/asn1/ChatCleanerMessage.c \ src/third_party/asn1/CleanerInitAckMessage.c \ src/third_party/asn1/CleanerChatRequestMessage.c \ src/third_party/asn1/CleanerChatReplyMessage.c \ + src/third_party/asn1/AmountOfMoney.c \ + src/third_party/asn1/InitialAmountOfMoney.c \ + src/third_party/asn1/InitialNonZeroAmountOfMoney.c \ src/third_party/asn1/AuthMessage.c \ src/third_party/asn1/AuthClientResponse.c \ src/third_party/asn1/AuthServerChallenge.c \ diff --git a/src/third_party/asn1/EndOfHandHideCards.c b/src/third_party/asn1/EndOfHandHideCards.c index 3827c327..1d9603e8 100644 --- a/src/third_party/asn1/EndOfHandHideCards.c +++ b/src/third_party/asn1/EndOfHandHideCards.c @@ -7,56 +7,6 @@ #include "EndOfHandHideCards.h" -static int -memb_moneyWon_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 <= 10000000)) { - /* 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_playerMoney_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 <= 10000000)) { - /* 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_EndOfHandHideCards_1[] = { { ATF_NOFLAGS, 0, offsetof(struct EndOfHandHideCards, playerId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -70,8 +20,8 @@ static asn_TYPE_member_t asn_MBR_EndOfHandHideCards_1[] = { { ATF_NOFLAGS, 0, offsetof(struct EndOfHandHideCards, moneyWon), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_moneyWon_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "moneyWon" @@ -79,8 +29,8 @@ static asn_TYPE_member_t asn_MBR_EndOfHandHideCards_1[] = { { ATF_NOFLAGS, 0, offsetof(struct EndOfHandHideCards, playerMoney), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_playerMoney_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "playerMoney" @@ -92,7 +42,7 @@ static ber_tlv_tag_t asn_DEF_EndOfHandHideCards_tags_1[] = { static asn_TYPE_tag2member_t asn_MAP_EndOfHandHideCards_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* playerId at 570 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* moneyWon at 571 */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* playerMoney at 572 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* playerMoney at 573 */ }; static asn_SEQUENCE_specifics_t asn_SPC_EndOfHandHideCards_specs_1 = { sizeof(struct EndOfHandHideCards), diff --git a/src/third_party/asn1/EndOfHandHideCards.h b/src/third_party/asn1/EndOfHandHideCards.h index 9df2cb0e..301f5798 100644 --- a/src/third_party/asn1/EndOfHandHideCards.h +++ b/src/third_party/asn1/EndOfHandHideCards.h @@ -13,7 +13,7 @@ /* Including external dependencies */ #include "NonZeroId.h" -#include +#include "AmountOfMoney.h" #include #ifdef __cplusplus @@ -23,8 +23,8 @@ extern "C" { /* EndOfHandHideCards */ typedef struct EndOfHandHideCards { NonZeroId_t playerId; - long moneyWon; - long playerMoney; + AmountOfMoney_t moneyWon; + AmountOfMoney_t playerMoney; /* * This type is extensible, * possible extensions are below. diff --git a/src/third_party/asn1/MyActionRequestMessage.c b/src/third_party/asn1/MyActionRequestMessage.c index 3a69ba92..331b2da8 100644 --- a/src/third_party/asn1/MyActionRequestMessage.c +++ b/src/third_party/asn1/MyActionRequestMessage.c @@ -7,31 +7,6 @@ #include "MyActionRequestMessage.h" -static int -memb_myRelativeBet_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 <= 10000000)) { - /* 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_MyActionRequestMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct MyActionRequestMessage, gameId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -72,8 +47,8 @@ static asn_TYPE_member_t asn_MBR_MyActionRequestMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct MyActionRequestMessage, myRelativeBet), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_myRelativeBet_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "myRelativeBet" @@ -86,7 +61,7 @@ static ber_tlv_tag_t asn_DEF_MyActionRequestMessage_tags_1[] = { static asn_TYPE_tag2member_t asn_MAP_MyActionRequestMessage_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* gameId at 489 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* handNum at 490 */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -2, 0 }, /* myRelativeBet at 493 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -2, 0 }, /* myRelativeBet at 494 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 1 }, /* gameState at 491 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, -1, 0 } /* myAction at 492 */ }; diff --git a/src/third_party/asn1/MyActionRequestMessage.h b/src/third_party/asn1/MyActionRequestMessage.h index 18f36201..8d897544 100644 --- a/src/third_party/asn1/MyActionRequestMessage.h +++ b/src/third_party/asn1/MyActionRequestMessage.h @@ -15,7 +15,7 @@ #include "NonZeroId.h" #include "NetGameState.h" #include "NetPlayerAction.h" -#include +#include "AmountOfMoney.h" #include #ifdef __cplusplus @@ -28,7 +28,7 @@ extern "C" { NonZeroId_t handNum; NetGameState_t gameState; NetPlayerAction_t myAction; - long myRelativeBet; + AmountOfMoney_t myRelativeBet; /* * This type is extensible, * possible extensions are below. diff --git a/src/third_party/asn1/NetGameInfo.c b/src/third_party/asn1/NetGameInfo.c index 98208a7f..72cae6ed 100644 --- a/src/third_party/asn1/NetGameInfo.c +++ b/src/third_party/asn1/NetGameInfo.c @@ -203,31 +203,6 @@ endRaiseMode_13_encode_xer(asn_TYPE_descriptor_t *td, void *structure, return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static int -memb_NativeInteger_constraint_23(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 >= 1 && value <= 1000000)) { - /* 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_gameName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { @@ -385,56 +360,6 @@ memb_firstSmallBlind_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } } -static int -memb_endRaiseSmallBlindValue_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 <= 1000000)) { - /* 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_startMoney_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 >= 1 && value <= 1000000)) { - /* 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_manualBlinds_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { @@ -616,8 +541,8 @@ static asn_TYPE_member_t asn_MBR_manualBlinds_23[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_NativeInteger_constraint_23, + &asn_DEF_InitialNonZeroAmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "" @@ -741,8 +666,8 @@ static asn_TYPE_member_t asn_MBR_NetGameInfo_1[] = { { ATF_NOFLAGS, 0, offsetof(struct NetGameInfo, endRaiseSmallBlindValue), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_endRaiseSmallBlindValue_constraint_1, + &asn_DEF_InitialAmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "endRaiseSmallBlindValue" @@ -750,8 +675,8 @@ static asn_TYPE_member_t asn_MBR_NetGameInfo_1[] = { { ATF_NOFLAGS, 0, offsetof(struct NetGameInfo, startMoney), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_startMoney_constraint_1, + &asn_DEF_InitialNonZeroAmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "startMoney" @@ -780,7 +705,7 @@ static asn_TYPE_tag2member_t asn_MAP_NetGameInfo_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 1 }, /* netGameType at 334 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, -1, 0 }, /* endRaiseMode at 345 */ { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, 0, 0 }, /* gameName at 332 */ - { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, 0, 0 }, /* manualBlinds at 355 */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 11, 0, 0 }, /* manualBlinds at 356 */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 3, 0, 0 }, /* raiseEveryHands at 341 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 } /* raiseEveryMinutes at 342 */ }; diff --git a/src/third_party/asn1/NetGameInfo.h b/src/third_party/asn1/NetGameInfo.h index e3c24687..9bc25381 100644 --- a/src/third_party/asn1/NetGameInfo.h +++ b/src/third_party/asn1/NetGameInfo.h @@ -15,6 +15,8 @@ #include #include #include +#include "InitialAmountOfMoney.h" +#include "InitialNonZeroAmountOfMoney.h" #include #include #include @@ -69,10 +71,10 @@ extern "C" { long delayBetweenHands; long playerActionTimeout; long firstSmallBlind; - long endRaiseSmallBlindValue; - long startMoney; + InitialAmountOfMoney_t endRaiseSmallBlindValue; + InitialNonZeroAmountOfMoney_t startMoney; struct manualBlinds { - A_SEQUENCE_OF(long) list; + A_SEQUENCE_OF(InitialNonZeroAmountOfMoney_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/third_party/asn1/PlayerResult.c b/src/third_party/asn1/PlayerResult.c index 9c6046cc..7800ae51 100644 --- a/src/third_party/asn1/PlayerResult.c +++ b/src/third_party/asn1/PlayerResult.c @@ -33,56 +33,6 @@ memb_bestHandPosition_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } } -static int -memb_moneyWon_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 <= 10000000)) { - /* 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_playerMoney_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 <= 10000000)) { - /* 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_bestHandPosition_5[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -176,8 +126,8 @@ static asn_TYPE_member_t asn_MBR_PlayerResult_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayerResult, moneyWon), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_moneyWon_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "moneyWon" @@ -185,8 +135,8 @@ static asn_TYPE_member_t asn_MBR_PlayerResult_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayerResult, playerMoney), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_playerMoney_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "playerMoney" @@ -201,7 +151,7 @@ static asn_TYPE_tag2member_t asn_MAP_PlayerResult_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 3 }, /* resultCard2 at 562 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -3, 2 }, /* cardsValue at 564 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 5, -4, 1 }, /* moneyWon at 565 */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -5, 0 }, /* playerMoney at 566 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -5, 0 }, /* playerMoney at 567 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, 0, 0 } /* bestHandPosition at 563 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PlayerResult_specs_1 = { diff --git a/src/third_party/asn1/PlayerResult.h b/src/third_party/asn1/PlayerResult.h index 62fcc0dc..b68fa404 100644 --- a/src/third_party/asn1/PlayerResult.h +++ b/src/third_party/asn1/PlayerResult.h @@ -15,6 +15,7 @@ #include "NonZeroId.h" #include "Card.h" #include +#include "AmountOfMoney.h" #include #include #include @@ -35,8 +36,8 @@ extern "C" { asn_struct_ctx_t _asn_ctx; } bestHandPosition; long cardsValue; - long moneyWon; - long playerMoney; + AmountOfMoney_t moneyWon; + AmountOfMoney_t playerMoney; /* * This type is extensible, * possible extensions are below. diff --git a/src/third_party/asn1/PlayersActionDoneMessage.c b/src/third_party/asn1/PlayersActionDoneMessage.c index 02f069d5..19c9f0cb 100644 --- a/src/third_party/asn1/PlayersActionDoneMessage.c +++ b/src/third_party/asn1/PlayersActionDoneMessage.c @@ -7,106 +7,6 @@ #include "PlayersActionDoneMessage.h" -static int -memb_totalPlayerBet_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 <= 10000000)) { - /* 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_playerMoney_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 <= 10000000)) { - /* 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_highestSet_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 <= 10000000)) { - /* 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_minimumRaise_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 <= 10000000)) { - /* 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_PlayersActionDoneMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayersActionDoneMessage, gameId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -147,8 +47,8 @@ static asn_TYPE_member_t asn_MBR_PlayersActionDoneMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayersActionDoneMessage, totalPlayerBet), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_totalPlayerBet_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "totalPlayerBet" @@ -156,8 +56,8 @@ static asn_TYPE_member_t asn_MBR_PlayersActionDoneMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayersActionDoneMessage, playerMoney), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_playerMoney_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "playerMoney" @@ -165,8 +65,8 @@ static asn_TYPE_member_t asn_MBR_PlayersActionDoneMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayersActionDoneMessage, highestSet), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_highestSet_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "highestSet" @@ -174,8 +74,8 @@ static asn_TYPE_member_t asn_MBR_PlayersActionDoneMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PlayersActionDoneMessage, minimumRaise), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_minimumRaise_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "minimumRaise" @@ -191,7 +91,7 @@ static asn_TYPE_tag2member_t asn_MAP_PlayersActionDoneMessage_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 4, -2, 3 }, /* totalPlayerBet at 513 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 5, -3, 2 }, /* playerMoney at 514 */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -4, 1 }, /* highestSet at 515 */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 7, -5, 0 }, /* minimumRaise at 516 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 7, -5, 0 }, /* minimumRaise at 517 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 2, 0, 1 }, /* gameState at 511 */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, -1, 0 } /* playerAction at 512 */ }; diff --git a/src/third_party/asn1/PlayersActionDoneMessage.h b/src/third_party/asn1/PlayersActionDoneMessage.h index af736187..bf6f76f6 100644 --- a/src/third_party/asn1/PlayersActionDoneMessage.h +++ b/src/third_party/asn1/PlayersActionDoneMessage.h @@ -15,7 +15,7 @@ #include "NonZeroId.h" #include "NetGameState.h" #include "NetPlayerAction.h" -#include +#include "AmountOfMoney.h" #include #ifdef __cplusplus @@ -28,10 +28,10 @@ extern "C" { NonZeroId_t playerId; NetGameState_t gameState; NetPlayerAction_t playerAction; - long totalPlayerBet; - long playerMoney; - long highestSet; - long minimumRaise; + AmountOfMoney_t totalPlayerBet; + AmountOfMoney_t playerMoney; + AmountOfMoney_t highestSet; + AmountOfMoney_t minimumRaise; /* * This type is extensible, * possible extensions are below. diff --git a/src/third_party/asn1/RejoinPlayerData.c b/src/third_party/asn1/RejoinPlayerData.c index a7dcd1b6..124b1c5d 100644 --- a/src/third_party/asn1/RejoinPlayerData.c +++ b/src/third_party/asn1/RejoinPlayerData.c @@ -7,31 +7,6 @@ #include "RejoinPlayerData.h" -static int -memb_playerMoney_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 <= 10000000)) { - /* 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_RejoinPlayerData_1[] = { { ATF_NOFLAGS, 0, offsetof(struct RejoinPlayerData, playerId), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), @@ -45,8 +20,8 @@ static asn_TYPE_member_t asn_MBR_RejoinPlayerData_1[] = { { ATF_NOFLAGS, 0, offsetof(struct RejoinPlayerData, playerMoney), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_playerMoney_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "playerMoney" @@ -57,7 +32,7 @@ static ber_tlv_tag_t asn_DEF_RejoinPlayerData_tags_1[] = { }; static asn_TYPE_tag2member_t asn_MAP_RejoinPlayerData_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* playerId at 443 */ - { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* playerMoney at 444 */ + { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* playerMoney at 445 */ }; static asn_SEQUENCE_specifics_t asn_SPC_RejoinPlayerData_specs_1 = { sizeof(struct RejoinPlayerData), diff --git a/src/third_party/asn1/RejoinPlayerData.h b/src/third_party/asn1/RejoinPlayerData.h index 2ada0ae9..77336f30 100644 --- a/src/third_party/asn1/RejoinPlayerData.h +++ b/src/third_party/asn1/RejoinPlayerData.h @@ -13,7 +13,7 @@ /* Including external dependencies */ #include "NonZeroId.h" -#include +#include "AmountOfMoney.h" #include #ifdef __cplusplus @@ -23,7 +23,7 @@ extern "C" { /* RejoinPlayerData */ typedef struct RejoinPlayerData { NonZeroId_t playerId; - long playerMoney; + AmountOfMoney_t playerMoney; /* * This type is extensible, * possible extensions are below. diff --git a/src/third_party/asn1/YourActionRejectedMessage.c b/src/third_party/asn1/YourActionRejectedMessage.c index 99fe63f5..50a1d5bc 100644 --- a/src/third_party/asn1/YourActionRejectedMessage.c +++ b/src/third_party/asn1/YourActionRejectedMessage.c @@ -80,31 +80,6 @@ rejectionReason_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static int -memb_yourRelativeBet_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 <= 10000000)) { - /* 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_enum_map_t asn_MAP_rejectionReason_value2enum_6[] = { { 1, 24, "rejectedInvalidGameState" }, { 2, 19, "rejectedNotYourTurn" }, @@ -182,8 +157,8 @@ static asn_TYPE_member_t asn_MBR_YourActionRejectedMessage_1[] = { { ATF_NOFLAGS, 0, offsetof(struct YourActionRejectedMessage, yourRelativeBet), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, - &asn_DEF_NativeInteger, - memb_yourRelativeBet_constraint_1, + &asn_DEF_AmountOfMoney, + 0, /* Defer constraints checking to the member type */ 0, /* PER is not compiled, use -gen-PER */ 0, "yourRelativeBet" diff --git a/src/third_party/asn1/YourActionRejectedMessage.h b/src/third_party/asn1/YourActionRejectedMessage.h index 7c1f39e9..2db4c271 100644 --- a/src/third_party/asn1/YourActionRejectedMessage.h +++ b/src/third_party/asn1/YourActionRejectedMessage.h @@ -15,7 +15,7 @@ #include "NonZeroId.h" #include "NetGameState.h" #include "NetPlayerAction.h" -#include +#include "AmountOfMoney.h" #include #include @@ -36,7 +36,7 @@ extern "C" { NonZeroId_t gameId; NetGameState_t gameState; NetPlayerAction_t yourAction; - long yourRelativeBet; + AmountOfMoney_t yourRelativeBet; long rejectionReason; /* * This type is extensible,