Files
pokerth/docs/pokerth.asn1
T

367 lines
9.1 KiB
Plaintext

--**************************************************************************
-- 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,
subscriptionRequestMessage SubscriptionRequestMessage,
joinGameRequestMessage JoinGameRequestMessage,
joinGameReplyMessage JoinGameReplyMessage,
gamePlayerMessage GamePlayerMessage,
kickPlayerRequestMessage KickPlayerRequestMessage,
leaveGameRequestMessage LeaveGameRequestMessage,
startEventMessage StartEventMessage,
startEventAckMessage StartEventAckMessage,
gameStartMessage GameStartMessage,
handStartMessage HandStartMessage,
playersTurnMessage PlayersTurnMessage,
myActionRequestMessage MyActionRequestMessage,
yourActionRejectedMessage YourActionRejectedMessage,
playersActionDoneMessage PlayersActionDoneMessage
}
InitMessage ::= [APPLICATION 0] SEQUENCE {
requestedVersion Version,
avatar AvatarHash OPTIONAL,
login CHOICE {
anonymousLogin [0] AnonymousLogin,
authenticatedLogin [1] AuthenticatedLogin
}
}
Version ::= SEQUENCE {
major INTEGER(0..65535),
minor INTEGER(0..65535)
}
AnonymousLogin ::= SEQUENCE {
playerName UTF8String
}
-- TODO challenge/response
AuthenticatedLogin ::= SEQUENCE {
playerName UTF8String
}
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 {
avatarData [0] AvatarData,
unknownAvatar [1] UnknownAvatar
}
}
AvatarData ::= SEQUENCE {
avatarType AvatarType,
avatarFile OCTET STRING (SIZE(32..30720))
}
UnknownAvatar ::= SEQUENCE {
}
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
}
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 {
}
-- 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,
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)
}
GamePlayerMessage ::= [APPLICATION 10] SEQUENCE {
gameId NonZeroId,
gamePlayerNotification CHOICE {
gamePlayerJoined [0] GamePlayerJoined,
gamePlayerLeft [1] GamePlayerLeft,
gameAdminChanged [2] GameAdminChanged,
removedFromGame [3] RemovedFromGame
}
}
GamePlayerJoined ::= SEQUENCE {
playerId NonZeroId
}
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,
yourFirstCard Card,
yourSecondCard Card,
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
}
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)
Guid ::= INTEGER(1..4294967295) -- TODO
Card ::= INTEGER(0..51)
END