Files
pokerth/docs/pokerth.asn1
T

495 lines
12 KiB
Plaintext
Raw Normal View History

--**************************************************************************
-- Copyright (C) 2009 by Lothar May *
-- *
-- This program is free software; you can redistribute it and/or modify *
-- it under the terms of the GNU General Public License as published by *
-- the Free Software Foundation; either version 2 of the License, or *
-- (at your option) any later version. *
-- *
-- This program is distributed in the hope that it will be useful, *
-- but WITHOUT ANY WARRANTY; without even the implied warranty of *
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-- GNU General Public License for more details. *
-- *
-- You should have received a copy of the GNU General Public License *
-- along with this program; if not, write to the *
-- Free Software Foundation, Inc., *
-- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
--**************************************************************************
POKERTH-PROTOCOL DEFINITIONS
IMPLICIT TAGS
EXTENSIBILITY IMPLIED ::=
BEGIN
PokerTHMessage ::= CHOICE {
initMessage InitMessage,
initAckMessage InitAckMessage,
avatarRequestMessage AvatarRequestMessage,
avatarReplyMessage AvatarReplyMessage,
gameListMessage GameListMessage,
playerInfoRequestMessage PlayerInfoRequestMessage,
playerInfoReplyMessage PlayerInfoReplyMessage,
2009-07-11 22:04:46 +00:00
subscriptionRequestMessage SubscriptionRequestMessage,
joinGameRequestMessage JoinGameRequestMessage,
2009-07-11 22:04:46 +00:00
joinGameReplyMessage JoinGameReplyMessage,
gamePlayerMessage GamePlayerMessage,
kickPlayerRequestMessage KickPlayerRequestMessage,
leaveGameRequestMessage LeaveGameRequestMessage,
startEventMessage StartEventMessage,
startEventAckMessage StartEventAckMessage,
gameStartMessage GameStartMessage,
handStartMessage HandStartMessage,
playersTurnMessage PlayersTurnMessage,
myActionRequestMessage MyActionRequestMessage,
yourActionRejectedMessage YourActionRejectedMessage,
2009-07-12 23:07:20 +00:00
playersActionDoneMessage PlayersActionDoneMessage,
dealFlopCardsMessage DealFlopCardsMessage,
dealTurnCardMessage DealTurnCardMessage,
dealRiverCardMessage DealRiverCardMessage,
allInShowCardsMessage AllInShowCardsMessage,
endOfHandMessage EndOfHandMessage,
endOfGameMessage EndOfGameMessage,
statisticsMessage StatisticsMessage,
chatRequestMessage ChatRequestMessage,
chatMessage ChatMessage,
dialogMessage DialogMessage,
errorMessage ErrorMessage
}
InitMessage ::= [APPLICATION 0] SEQUENCE {
requestedVersion Version,
login CHOICE {
anonymousLogin [0] AnonymousLogin,
2009-07-18 12:05:55 +00:00
authenticatedLogin [1] AuthenticatedLogin,
statisticsLogin [2] StatisticsLogin
}
}
2009-07-11 22:04:46 +00:00
Version ::= SEQUENCE {
major INTEGER(0..65535),
minor INTEGER(0..65535)
}
AnonymousLogin ::= SEQUENCE {
2009-07-18 12:05:55 +00:00
playerName UTF8String,
avatar AvatarHash OPTIONAL
}
-- TODO challenge/response
AuthenticatedLogin ::= SEQUENCE {
2009-07-18 12:05:55 +00:00
playerName UTF8String,
avatar AvatarHash OPTIONAL
}
StatisticsLogin ::= SEQUENCE {
}
InitAckMessage ::= [APPLICATION 1] SEQUENCE {
latestGameVersion Version,
latestBetaRevision INTEGER(0..65535),
yourSessionId Guid,
yourPlayerId NonZeroId
}
AvatarRequestMessage ::= [APPLICATION 2] SEQUENCE {
requestId NonZeroId,
avatar AvatarHash
}
AvatarReplyMessage ::= [APPLICATION 3] SEQUENCE {
requestId NonZeroId,
avatarResult CHOICE {
2009-07-18 12:05:55 +00:00
avatarHeader [0] AvatarHeader,
avatarData [1] AvatarData,
avatarEnd [2] AvatarEnd,
unknownAvatar [3] UnknownAvatar
}
}
2009-07-18 12:05:55 +00:00
AvatarHeader ::= SEQUENCE {
avatarType AvatarType,
2009-07-18 12:05:55 +00:00
avatarSize INTEGER(32..30720)
}
AvatarData ::= SEQUENCE {
avatarBlock OCTET STRING (SIZE(1..256))
}
AvatarEnd ::= SEQUENCE {
}
UnknownAvatar ::= SEQUENCE {
}
2009-07-11 22:04:46 +00:00
AvatarHash ::= OCTET STRING (SIZE(20)) -- sha-1 hash value
AvatarType ::= ENUMERATED {
imagePng (1),
imageJpg (2),
imageGif (3)
}
GameListMessage ::= [APPLICATION 4] SEQUENCE {
gameId NonZeroId,
gameListNotification CHOICE {
gameListNew [0] GameListNew,
gameListUpdate [1] GameListUpdate,
gameListPlayerJoined [2] GameListPlayerJoined,
gameListPlayerLeft [3] GameListPlayerLeft,
gameListAdminChanged [4] GameListAdminChanged
}
}
GameListNew ::= SEQUENCE {
gameMode GameMode,
isPrivate BOOLEAN,
playerIds SEQUENCE SIZE(1..10) OF NonZeroId,
adminPlayerId NonZeroId,
gameInfo GameInfo
}
GameListUpdate ::= SEQUENCE {
gameMode GameMode
}
GameListPlayerJoined ::= SEQUENCE {
playerId NonZeroId
}
GameListPlayerLeft ::= SEQUENCE {
playerId NonZeroId
}
GameListAdminChanged ::= SEQUENCE {
newAdminPlayerId NonZeroId
}
2009-07-11 22:04:46 +00:00
GameMode ::= ENUMERATED {
gameCreated (1),
gameStarted (2),
gameClosed (3)
}
PlayerInfoRequestMessage ::= [APPLICATION 5] SEQUENCE {
playerId NonZeroId
}
PlayerInfoReplyMessage ::= [APPLICATION 6] SEQUENCE {
playerId NonZeroId,
playerInfoResult CHOICE {
playerInfoData [0] PlayerInfoData,
unknownPlayerInfo [1] UnknownPlayerInfo
}
}
PlayerInfoData ::= SEQUENCE {
playerName UTF8String,
isHuman BOOLEAN,
avatarData SEQUENCE {
avatarType AvatarType,
avatar AvatarHash
} OPTIONAL
}
UnknownPlayerInfo ::= SEQUENCE {
}
2009-07-11 22:04:46 +00:00
-- 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 7] SEQUENCE {
subscriptionAction ENUMERATED {
unsubscribeGameList (1),
resubscribeGameList (2)
}
}
JoinGameRequestMessage ::= [APPLICATION 8] SEQUENCE {
joinGameAction CHOICE {
joinExistingGame [0] JoinExistingGame,
joinNewGame [1] JoinNewGame
},
password UTF8String OPTIONAL
}
JoinExistingGame ::= SEQUENCE {
gameId NonZeroId
}
JoinNewGame ::= SEQUENCE {
gameInfo GameInfo
}
JoinGameReplyMessage ::= [APPLICATION 9] SEQUENCE {
gameId NonZeroId,
joinGameResult CHOICE {
joinGameAck [0] JoinGameAck,
joinGameFailed [1] JoinGameFailed
}
}
JoinGameAck ::= SEQUENCE {
areYouAdmin BOOLEAN,
gameInfo GameInfo
}
JoinGameFailed ::= SEQUENCE {
joinGameFailureReason ENUMERATED {
invalidGame (1),
gameIsFull (2),
gameIsRunning (3),
invalidPassword (4)
}
}
GameInfo ::= SEQUENCE {
gameName UTF8String,
2009-07-11 22:04:46 +00:00
maxNumPlayers INTEGER(2..10),
raiseIntervalMode CHOICE {
raiseEveryHands [0] INTEGER(1..1000),
raiseEveryMinutes [1] INTEGER(1..1000)
},
endRaiseMode ENUMERATED {
doubleBlinds (1),
raiseByEndValue (2),
keepLastBlind (3)
},
proposedGuiSpeed INTEGER(1..11),
playerActionTimeout INTEGER(5..60), -- These are seconds
firstSmallBlind INTEGER(1..20000),
endRaiseSmallBlindValue INTEGER(1..20000),
startMoney INTEGER(1..1000000),
manualBlinds SEQUENCE SIZE(0..30) OF INTEGER(1..20001)
}
2009-07-11 22:04:46 +00:00
GamePlayerMessage ::= [APPLICATION 10] SEQUENCE {
gameId NonZeroId,
gamePlayerNotification CHOICE {
gamePlayerJoined [0] GamePlayerJoined,
gamePlayerLeft [1] GamePlayerLeft,
gameAdminChanged [2] GameAdminChanged,
removedFromGame [3] RemovedFromGame
}
}
2009-07-11 22:04:46 +00:00
GamePlayerJoined ::= SEQUENCE {
playerId NonZeroId
}
2009-07-11 22:04:46 +00:00
GamePlayerLeft ::= SEQUENCE {
playerId NonZeroId
}
GameAdminChanged ::= SEQUENCE {
newAdminPlayerId NonZeroId
}
RemovedFromGame ::= SEQUENCE {
removedFromGameReason ENUMERATED {
removedOnRequest (0), -- No error, client wished to leave.
kickedFromGame (1),
gameIsFull (2),
gameIsRunning (3),
gameTimeout (4)
}
}
KickPlayerRequestMessage ::= [APPLICATION 11] SEQUENCE {
gameId NonZeroId,
playerId NonZeroId
}
LeaveGameRequestMessage ::= [APPLICATION 12] SEQUENCE {
gameId NonZeroId
}
StartEventMessage ::= [APPLICATION 13] SEQUENCE {
gameId NonZeroId,
fillWithComputerPlayers BOOLEAN
}
StartEventAckMessage ::= [APPLICATION 14] SEQUENCE {
gameId NonZeroId
}
GameStartMessage ::= [APPLICATION 15] SEQUENCE {
gameId NonZeroId,
startDealerPlayerId NonZeroId,
playerSeats SEQUENCE SIZE(2..10) OF NonZeroId
}
HandStartMessage ::= [APPLICATION 16] SEQUENCE {
gameId NonZeroId,
2009-07-12 23:07:20 +00:00
yourCards SEQUENCE SIZE(2) OF Card,
2009-07-11 22:04:46 +00:00
smallBlind INTEGER(1..20001)
}
PlayersTurnMessage ::= [APPLICATION 17] SEQUENCE {
gameId NonZeroId,
playerId NonZeroId,
gameState GameState
}
MyActionRequestMessage ::= [APPLICATION 18] SEQUENCE {
gameId NonZeroId,
gameState GameState,
myAction PlayerAction,
myRelativeBet INTEGER(0..10000000)
}
YourActionRejectedMessage ::= [APPLICATION 19] SEQUENCE {
gameId NonZeroId,
gameState GameState,
yourAction PlayerAction,
yourRelativeBet INTEGER(0..10000000),
rejectionReason ENUMERATED {
rejectedInvalidGameState (1),
rejectedNotYourTurn (2),
rejectedActionNotAllowed (3)
}
}
PlayersActionDoneMessage ::= [APPLICATION 20] SEQUENCE {
gameId NonZeroId,
playerId NonZeroId,
gameState GameState,
playerAction PlayerAction,
totalPlayerBet INTEGER(0..10000000),
playerMoney INTEGER(0..10000000),
highestSet INTEGER(0..10000000),
minimumRaise INTEGER(0..10000000) -- TODO
}
2009-07-12 23:07:20 +00:00
DealFlopCardsMessage ::= [APPLICATION 21] SEQUENCE {
gameId NonZeroId,
flopCards SEQUENCE SIZE(3) OF Card
}
DealTurnCardMessage ::= [APPLICATION 22] SEQUENCE {
gameId NonZeroId,
turnCard Card
}
DealRiverCardMessage ::= [APPLICATION 23] SEQUENCE {
gameId NonZeroId,
riverCard Card
}
AllInShowCardsMessage ::= [APPLICATION 24] SEQUENCE {
gameId NonZeroId,
playersAllIn SEQUENCE SIZE(1..10) OF PlayerAllIn
}
PlayerAllIn ::= SEQUENCE {
playerId NonZeroId,
allInCards SEQUENCE SIZE(2) OF Card
}
EndOfHandMessage ::= [APPLICATION 25] SEQUENCE {
gameId NonZeroId,
endOfHandType CHOICE {
endOfHandShowCards [0] EndOfHandShowCards,
endOfHandHideCards [1] EndOfHandHideCards
}
}
EndOfHandShowCards ::= SEQUENCE {
playerResults SEQUENCE SIZE(1..10) OF PlayerResult
}
PlayerResult ::= SEQUENCE {
playerId NonZeroId,
resultCards SEQUENCE SIZE(2) OF Card,
bestHandPosition SEQUENCE SIZE(5) OF INTEGER, -- TODO size restrictions
cardsValue INTEGER,
moneyWon INTEGER(0..10000000),
playerMoney INTEGER(0..10000000)
}
EndOfHandHideCards ::= SEQUENCE {
playerId NonZeroId,
moneyWon INTEGER(0..10000000),
playerMoney INTEGER(0..10000000)
}
EndOfGameMessage ::= [APPLICATION 26] SEQUENCE {
gameId NonZeroId,
winnerPlayerId NonZeroId
}
StatisticsMessage ::= [APPLICATION 128] SEQUENCE {
statisticsData SEQUENCE SIZE(1..32) OF StatisticsData
}
StatisticsData ::= SEQUENCE {
statisticsType ENUMERATED {
statNumberOfPlayers (1)
},
statisticsValue INTEGER
}
ChatRequestMessage ::= [APPLICATION 129] SEQUENCE {
gameId Id,
chatText UTF8String
}
ChatMessage ::= [APPLICATION 130] SEQUENCE {
playerId Id,
gameId Id,
chatText UTF8String
}
DialogMessage ::= [APPLICATION 131] SEQUENCE {
notificationText UTF8String
}
ErrorMessage ::= [APPLICATION 255] SEQUENCE {
errorReason ENUMERATED {
errorReserved (0),
errorInitVersionNotSupported (1),
errorInitServerFull (2),
errorInitAuthFailure (3),
errorInitPlayerNameInUse (4),
errorInitInvalidPlayerName (5),
errorInitServerMaintenance (6),
errorAvatarTooLarge (7),
errorAvatarUploadBlocked (8),
errorInvalidPacket (256),
errorInvalidState (257),
errorKickedFromServer (258),
errorBannedFromServer (259),
errorSessionTimeout (260)
}
}
2009-07-11 22:04:46 +00:00
GameState ::= ENUMERATED {
statePreflop (0),
stateFlop (1),
stateTurn (2),
stateRiver (3),
statePreflopSmallBlind (4),
statePreflopBigBlind (5)
}
PlayerAction ::= ENUMERATED {
actionNone (0),
actionFold (1),
actionCheck (2),
actionCall (3),
actionBet (4),
actionRaise (5),
actionAllIn (6)
}
NonZeroId ::= INTEGER(1..4294967295)
2009-07-12 23:07:20 +00:00
Id ::= INTEGER(0..4294967295)
Guid ::= INTEGER(1..4294967295) -- TODO
2009-07-11 22:04:46 +00:00
Card ::= INTEGER(0..51)
END