1 /*****************************************************************************
2  * PokerTH - The open source texas holdem engine                             *
3  * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May          *
4  *                                                                           *
5  * This program is free software: you can redistribute it and/or modify      *
6  * it under the terms of the GNU Affero General Public License as            *
7  * published by the Free Software Foundation, either version 3 of the        *
8  * License, or (at your option) any later version.                           *
9  *                                                                           *
10  * This program is distributed in the hope that it will be useful,           *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
13  * GNU Affero General Public License for more details.                       *
14  *                                                                           *
15  * You should have received a copy of the GNU Affero General Public License  *
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
17  *                                                                           *
18  *                                                                           *
19  * Additional permission under GNU AGPL version 3 section 7                  *
20  *                                                                           *
21  * If you modify this program, or any covered work, by linking or            *
22  * combining it with the OpenSSL project's OpenSSL library (or a             *
23  * modified version of that library), containing parts covered by the        *
24  * terms of the OpenSSL or SSLeay licenses, the authors of PokerTH           *
25  * (Felix Hammer, Florian Thauer, Lothar May) grant you additional           *
26  * permission to convey the resulting work.                                  *
27  * Corresponding Source for a non-source form of such a combination          *
28  * shall include the source code for the parts of OpenSSL used as well       *
29  * as that of the covered work.                                              *
30  *****************************************************************************/
31 /* Socket message definitions. */
32 #ifndef _SOCKET_MSG_H_
33 #define _SOCKET_MSG_H_
34 
35 // Socket or connection related errors.
36 #define ERR_SOCK_INTERNAL				1
37 #define ERR_SOCK_SERVERADDR_NOT_SET		2
38 #define ERR_SOCK_INVALID_PORT			3
39 #define ERR_SOCK_CREATION_FAILED		4
40 #define ERR_SOCK_SET_ADDR_FAILED		5
41 #define ERR_SOCK_SET_PORT_FAILED		6
42 #define ERR_SOCK_RESOLVE_FAILED			7
43 #define ERR_SOCK_BIND_FAILED			8
44 #define ERR_SOCK_LISTEN_FAILED			9
45 #define ERR_SOCK_ACCEPT_FAILED			10
46 #define ERR_SOCK_CONNECT_FAILED			11
47 #define ERR_SOCK_CONNECT_TIMEOUT		12
48 #define ERR_SOCK_SELECT_FAILED			13
49 #define ERR_SOCK_RECV_FAILED			14
50 #define ERR_SOCK_SEND_FAILED			15
51 #define ERR_SOCK_CONN_RESET				16
52 #define ERR_SOCK_CONN_EXISTS			17
53 #define ERR_SOCK_INVALID_PACKET			18
54 #define ERR_SOCK_INVALID_STATE			19
55 #define ERR_SOCK_INVALID_TYPE			20
56 #define ERR_SOCK_INVALID_SERVERLIST_URL	21
57 #define ERR_SOCK_INVALID_SERVERLIST_XML 22
58 #define ERR_SOCK_UNZIP_FAILED			23
59 #define ERR_SOCK_TRANSFER_INIT_FAILED	24
60 #define ERR_SOCK_TRANSFER_OPEN_FAILED	25
61 #define ERR_SOCK_TRANSFER_INVALID_URL	26
62 #define ERR_SOCK_TRANSFER_SELECT_FAILED	27
63 #define ERR_SOCK_TRANSFER_FAILED		28
64 #define ERR_SOCK_CONNECT_IPV6_FAILED	29
65 #define ERR_SOCK_CONNECT_IPV6_TIMEOUT	30
66 // The following errors are game errors.
67 #define ERR_NET_VERSION_NOT_SUPPORTED	101
68 #define ERR_NET_SERVER_MAINTENANCE		102
69 #define ERR_NET_SERVER_FULL				103
70 #define ERR_NET_INVALID_PASSWORD		104
71 #define ERR_NET_INVALID_PASSWORD_STR	105
72 #define ERR_NET_PLAYER_NAME_IN_USE		106
73 #define ERR_NET_INVALID_PLAYER_NAME		107
74 #define ERR_NET_INVALID_PLAYER_CARDS	108
75 #define ERR_NET_INVALID_PLAYER_RESULTS	109
76 #define ERR_NET_INVALID_GAME_NAME		110
77 #define ERR_NET_INVALID_GAME_ROUND		111
78 #define ERR_NET_INVALID_SESSION			112
79 #define ERR_NET_UNKNOWN_GAME			113
80 #define ERR_NET_INVALID_CHAT_TEXT		114
81 #define ERR_NET_UNKNOWN_PLAYER_ID		115
82 #define ERR_NET_NO_CURRENT_PLAYER		116
83 #define ERR_NET_PLAYER_NOT_ACTIVE		117
84 #define ERR_NET_PLAYER_KICKED			118
85 #define ERR_NET_PLAYER_BANNED			119
86 #define ERR_NET_PLAYER_BLOCKED			120
87 #define ERR_NET_SESSION_TIMED_OUT		121
88 #define ERR_NET_INVALID_PLAYER_COUNT	122
89 #define ERR_NET_TOO_MANY_MANUAL_BLINDS	123
90 #define ERR_NET_INVALID_AVATAR_FILE		124
91 #define ERR_NET_AVATAR_TOO_LARGE		125
92 #define ERR_NET_BUF_INVALID_SIZE		126
93 #define ERR_NET_INVALID_REQUEST_ID		127
94 #define ERR_NET_WRONG_AVATAR_SIZE		128
95 #define ERR_NET_START_TIMEOUT			129
96 #define ERR_NET_GAME_TERMINATION_FAILED	130
97 #define ERR_NET_INTERNAL_GAME_ERROR		131
98 #define ERR_NET_DEALER_NOT_FOUND		132
99 #define ERR_NET_INIT_BLOCKED			133
100 #define ERR_NET_GSASL_INIT_FAILED		134
101 #define ERR_NET_GSASL_NO_SCRAM			135
102 #define ERR_NET_DB_CONNECT_FAILED		136
103 
104 #define ERR_IRC_INTERNAL				151
105 #define ERR_IRC_CONNECT_FAILED			152
106 #define ERR_IRC_TERMINATED				153
107 #define ERR_IRC_SELECT_FAILED			154
108 #define ERR_IRC_RECV_FAILED				155
109 #define ERR_IRC_SEND_FAILED				156
110 #define ERR_IRC_INVALID_PARAM			157
111 #define ERR_IRC_TIMEOUT					158
112 
113 // Notifications - removed from game
114 #define NTF_NET_INTERNAL				201
115 #define NTF_NET_REMOVED_ON_REQUEST		202
116 #define NTF_NET_REMOVED_GAME_FULL		203
117 #define NTF_NET_REMOVED_ALREADY_RUNNING	204
118 #define NTF_NET_REMOVED_KICKED			205
119 #define NTF_NET_REMOVED_TIMEOUT			206
120 #define NTF_NET_REMOVED_START_FAILED	207
121 #define NTF_NET_REMOVED_GAME_CLOSED		208
122 
123 // Notifications - join failed
124 #define NTF_NET_JOIN_GAME_INVALID		210
125 #define NTF_NET_JOIN_GAME_FULL			211
126 #define NTF_NET_JOIN_ALREADY_RUNNING	212
127 #define NTF_NET_JOIN_INVALID_PASSWORD	213
128 #define NTF_NET_JOIN_GUEST_FORBIDDEN	214
129 #define NTF_NET_JOIN_NOT_INVITED		215
130 #define NTF_NET_JOIN_GAME_NAME_IN_USE	216
131 #define NTF_NET_JOIN_GAME_BAD_NAME		217
132 #define NTF_NET_JOIN_INVALID_SETTINGS	218
133 #define NTF_NET_JOIN_IP_BLOCKED			219
134 #define NTF_NET_JOIN_REJOIN_FAILED		220
135 #define NTF_NET_JOIN_NO_SPECTATORS		221
136 
137 // Notifications - version
138 #define NTF_NET_NEW_RELEASE_AVAILABLE	231
139 #define NTF_NET_OUTDATED_BETA			232
140 
141 // This is an internal message which is not reported.
142 #define MSG_SOCK_INTERNAL_PENDING		0
143 
144 // The following messages are connect messages.
145 #define MSG_SOCK_INIT_DONE				1
146 #define MSG_SOCK_SERVER_LIST_DONE		2
147 #define MSG_SOCK_RESOLVE_DONE			3
148 #define MSG_SOCK_CONNECT_DONE			4
149 #define MSG_SOCK_SESSION_DONE			5
150 
151 #define MSG_SOCK_LIMIT_CONNECT			MSG_SOCK_SESSION_DONE
152 #define MSG_SOCK_LAST					MSG_SOCK_SESSION_DONE
153 
154 // The following messages are game messages.
155 #define MSG_NET_GAME_CLIENT_JOIN		MSG_SOCK_LIMIT_CONNECT + 1
156 #define MSG_NET_GAME_CLIENT_SYNCSTART	MSG_SOCK_LIMIT_CONNECT + 2
157 #define MSG_NET_GAME_CLIENT_SYNCREJOIN	MSG_SOCK_LIMIT_CONNECT + 3
158 #define MSG_NET_GAME_CLIENT_START		MSG_SOCK_LIMIT_CONNECT + 4
159 #define MSG_NET_GAME_CLIENT_HAND_START	MSG_SOCK_LIMIT_CONNECT + 5
160 #define MSG_NET_GAME_CLIENT_HAND_END	MSG_SOCK_LIMIT_CONNECT + 6
161 #define MSG_NET_GAME_CLIENT_END			MSG_SOCK_LIMIT_CONNECT + 7
162 
163 #define MSG_NET_GAME_SERVER_START		MSG_SOCK_LIMIT_CONNECT + 8
164 #define MSG_NET_GAME_SERVER_HAND_START	MSG_SOCK_LIMIT_CONNECT + 9
165 #define MSG_NET_GAME_SERVER_HAND_END	MSG_SOCK_LIMIT_CONNECT + 10
166 #define MSG_NET_GAME_SERVER_ROUND		MSG_SOCK_LIMIT_CONNECT + 11
167 #define MSG_NET_GAME_SERVER_ACTION		MSG_SOCK_LIMIT_CONNECT + 12
168 #define MSG_NET_GAME_SERVER_CARDS_DELAY	MSG_SOCK_LIMIT_CONNECT + 13
169 #define MSG_NET_GAME_SERVER_END			MSG_SOCK_LIMIT_CONNECT + 14
170 
171 #define MSG_NET_LIMIT_GAME				MSG_NET_GAME_SERVER_END
172 
173 // Some messages which are displayed in the GUI
174 #define MSG_NET_AVATAR_REPORT_ACCEPTED		MSG_NET_LIMIT_GAME + 1
175 #define MSG_NET_AVATAR_REPORT_DUP			MSG_NET_LIMIT_GAME + 2
176 #define MSG_NET_AVATAR_REPORT_REJECTED		MSG_NET_LIMIT_GAME + 3
177 #define MSG_NET_GAMENAME_REPORT_ACCEPTED	MSG_NET_LIMIT_GAME + 4
178 #define MSG_NET_GAMENAME_REPORT_DUP			MSG_NET_LIMIT_GAME + 5
179 #define MSG_NET_GAMENAME_REPORT_REJECTED	MSG_NET_LIMIT_GAME + 6
180 #define MSG_NET_ADMIN_REMOVE_GAME_ACCEPTED	MSG_NET_LIMIT_GAME + 7
181 #define MSG_NET_ADMIN_REMOVE_GAME_REJECTED	MSG_NET_LIMIT_GAME + 8
182 #define MSG_NET_ADMIN_BAN_PLAYER_ACCEPTED	MSG_NET_LIMIT_GAME + 9
183 #define MSG_NET_ADMIN_BAN_PLAYER_PENDING	MSG_NET_LIMIT_GAME + 10
184 #define MSG_NET_ADMIN_BAN_PLAYER_NODB		MSG_NET_LIMIT_GAME + 11
185 #define MSG_NET_ADMIN_BAN_PLAYER_DBERROR	MSG_NET_LIMIT_GAME + 12
186 #define MSG_NET_ADMIN_BAN_PLAYER_REJECTED	MSG_NET_LIMIT_GAME + 13
187 
188 #endif
189 
190