| 1 /* $Id$ */ |
|
| 2 |
|
| 3 /* |
|
| 4 * (C) Copyright 2009-2010 Jakub Zawadzki <darkjames@darkjames.ath.cx> |
|
| 5 * Bartłomiej Zimoń <uzi18@o2.pl> |
|
| 6 * Wojtek Kaniewski <wojtekka@irc.pl> |
|
| 7 * |
|
| 8 * This program is free software; you can redistribute it and/or modify |
|
| 9 * it under the terms of the GNU Lesser General Public License Version |
|
| 10 * 2.1 as published by the Free Software Foundation. |
|
| 11 * |
|
| 12 * This program is distributed in the hope that it will be useful, |
|
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 * GNU Lesser General Public License for more details. |
|
| 16 * |
|
| 17 * You should have received a copy of the GNU Lesser General Public |
|
| 18 * License along with this program; if not, write to the Free Software |
|
| 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, |
|
| 20 * USA. |
|
| 21 */ |
|
| 22 |
|
| 23 #ifndef LIBGADU_PROTOCOL_H |
|
| 24 #define LIBGADU_PROTOCOL_H |
|
| 25 |
|
| 26 #include "libgadu.h" |
|
| 27 |
|
| 28 #ifdef _WIN32 |
|
| 29 #pragma pack(push, 1) |
|
| 30 #endif |
|
| 31 |
|
| 32 #define GG_LOGIN80BETA 0x0029 |
|
| 33 |
|
| 34 #define GG_LOGIN80 0x0031 |
|
| 35 |
|
| 36 #define GG_LOGIN105 0x0083 |
|
| 37 |
|
| 38 #undef GG_FEATURE_STATUS80BETA |
|
| 39 #undef GG_FEATURE_MSG80 |
|
| 40 #undef GG_FEATURE_STATUS80 |
|
| 41 #define GG_FEATURE_STATUS80BETA 0x01 |
|
| 42 #define GG_FEATURE_MSG80 0x02 |
|
| 43 #define GG_FEATURE_STATUS80 0x05 |
|
| 44 |
|
| 45 #define GG_DEFAULT_HOST_WHITE_LIST { "gadu-gadu.pl", "gg.pl", NULL } |
|
| 46 |
|
| 47 #define GG8_LANG "pl" |
|
| 48 #define GG8_VERSION "Gadu-Gadu Client Build " |
|
| 49 |
|
| 50 #define GG11_VERSION "GG-Phoenix/" |
|
| 51 #define GG11_TARGET " (BUILD;WINNT_x86-msvc;rv:11.0,pl;release;standard) (OS;Windows;Windows NT 6.1)" |
|
| 52 |
|
| 53 struct gg_login80 { |
|
| 54 uint32_t uin; /* mój numerek */ |
|
| 55 uint8_t language[2]; /* język: GG8_LANG */ |
|
| 56 uint8_t hash_type; /* rodzaj hashowania hasła */ |
|
| 57 uint8_t hash[64]; /* hash hasła dopełniony zerami */ |
|
| 58 uint32_t status; /* status na dzień dobry */ |
|
| 59 uint32_t flags; /* flagi (przeznaczenie nieznane) */ |
|
| 60 uint32_t features; /* opcje protokołu (GG8_FEATURES) */ |
|
| 61 uint32_t local_ip; /* mój adres ip */ |
|
| 62 uint16_t local_port; /* port, na którym słucham */ |
|
| 63 uint32_t external_ip; /* zewnętrzny adres ip (???) */ |
|
| 64 uint16_t external_port; /* zewnętrzny port (???) */ |
|
| 65 uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ |
|
| 66 uint8_t dunno2; /* 0x64 */ |
|
| 67 } GG_PACKED; |
|
| 68 |
|
| 69 #define GG_LOGIN_HASH_TYPE_INVALID 0x0016 |
|
| 70 |
|
| 71 #define GG_LOGIN80_OK 0x0035 |
|
| 72 |
|
| 73 #define GG_LOGIN110_OK 0x009d |
|
| 74 |
|
| 75 /** |
|
| 76 * Logowanie powiodło się (pakiet \c GG_LOGIN80_OK) |
|
| 77 */ |
|
| 78 struct gg_login80_ok { |
|
| 79 uint32_t unknown1; /* 0x00000001 */ |
|
| 80 } GG_PACKED; |
|
| 81 |
|
| 82 /** |
|
| 83 * Logowanie nie powiodło się (pakiet \c GG_LOGIN80_FAILED) |
|
| 84 */ |
|
| 85 #define GG_LOGIN80_FAILED 0x0043 |
|
| 86 |
|
| 87 struct gg_login80_failed { |
|
| 88 uint32_t unknown1; /* 0x00000001 */ |
|
| 89 } GG_PACKED; |
|
| 90 |
|
| 91 #define GG_NEW_STATUS80BETA 0x0028 |
|
| 92 |
|
| 93 #define GG_NEW_STATUS80 0x0038 |
|
| 94 |
|
| 95 /** |
|
| 96 * Zmiana stanu (pakiet \c GG_NEW_STATUS80) |
|
| 97 */ |
|
| 98 struct gg_new_status80 { |
|
| 99 uint32_t status; /**< Nowy status */ |
|
| 100 uint32_t flags; /**< flagi (nieznane przeznaczenie) */ |
|
| 101 uint32_t description_size; /**< rozmiar opisu */ |
|
| 102 } GG_PACKED; |
|
| 103 |
|
| 104 #define GG_NEW_STATUS105 0x0063 |
|
| 105 |
|
| 106 #define GG_STATUS80BETA 0x002a |
|
| 107 #define GG_NOTIFY_REPLY80BETA 0x002b |
|
| 108 |
|
| 109 #define GG_STATUS80 0x0036 |
|
| 110 #define GG_NOTIFY_REPLY80 0x0037 |
|
| 111 |
|
| 112 struct gg_notify_reply80 { |
|
| 113 uint32_t uin; /* numerek plus flagi w najstarszym bajcie */ |
|
| 114 uint32_t status; /* status danej osoby */ |
|
| 115 uint32_t features; /* opcje protokołu */ |
|
| 116 uint32_t remote_ip; /* adres IP bezpośrednich połączeń */ |
|
| 117 uint16_t remote_port; /* port bezpośrednich połączeń */ |
|
| 118 uint8_t image_size; /* maksymalny rozmiar obrazków w KB */ |
|
| 119 uint8_t unknown1; /* 0x00 */ |
|
| 120 uint32_t flags; /* flagi połączenia */ |
|
| 121 uint32_t descr_len; /* rozmiar opisu */ |
|
| 122 } GG_PACKED; |
|
| 123 |
|
| 124 #define GG_SEND_MSG80 0x002d |
|
| 125 |
|
| 126 struct gg_send_msg80 { |
|
| 127 uint32_t recipient; |
|
| 128 uint32_t seq; |
|
| 129 uint32_t msgclass; |
|
| 130 uint32_t offset_plain; |
|
| 131 uint32_t offset_attr; |
|
| 132 } GG_PACKED; |
|
| 133 |
|
| 134 #define GG_RECV_MSG80 0x002e |
|
| 135 |
|
| 136 struct gg_recv_msg80 { |
|
| 137 uint32_t sender; |
|
| 138 uint32_t seq; |
|
| 139 uint32_t time; |
|
| 140 uint32_t msgclass; |
|
| 141 uint32_t offset_plain; |
|
| 142 uint32_t offset_attr; |
|
| 143 } GG_PACKED; |
|
| 144 |
|
| 145 #define GG_DISCONNECT_ACK 0x000d |
|
| 146 |
|
| 147 #define GG_RECV_MSG_ACK 0x0046 |
|
| 148 |
|
| 149 struct gg_recv_msg_ack { |
|
| 150 uint32_t seq; |
|
| 151 } GG_PACKED; |
|
| 152 |
|
| 153 #define GG_USER_DATA 0x0044 |
|
| 154 |
|
| 155 struct gg_user_data { |
|
| 156 uint32_t type; |
|
| 157 uint32_t user_count; |
|
| 158 } GG_PACKED; |
|
| 159 |
|
| 160 struct gg_user_data_user { |
|
| 161 uint32_t uin; |
|
| 162 uint32_t attr_count; |
|
| 163 } GG_PACKED; |
|
| 164 |
|
| 165 #define GG_TYPING_NOTIFICATION 0x0059 |
|
| 166 |
|
| 167 struct gg_typing_notification { |
|
| 168 uint16_t length; |
|
| 169 uint32_t uin; |
|
| 170 } GG_PACKED; |
|
| 171 |
|
| 172 #define GG_XML_ACTION 0x002c |
|
| 173 |
|
| 174 #define GG_RECV_OWN_MSG 0x005a |
|
| 175 |
|
| 176 #define GG_MULTILOGON_INFO 0x005b |
|
| 177 |
|
| 178 struct gg_multilogon_info { |
|
| 179 uint32_t count; |
|
| 180 } GG_PACKED; |
|
| 181 |
|
| 182 struct gg_multilogon_info_item { |
|
| 183 uint32_t addr; |
|
| 184 uint32_t flags; |
|
| 185 uint32_t features; |
|
| 186 uint32_t logon_time; |
|
| 187 gg_multilogon_id_t conn_id; |
|
| 188 uint32_t unknown1; |
|
| 189 uint32_t name_size; |
|
| 190 } GG_PACKED; |
|
| 191 |
|
| 192 #define GG_MULTILOGON_DISCONNECT 0x0062 |
|
| 193 |
|
| 194 struct gg_multilogon_disconnect { |
|
| 195 gg_multilogon_id_t conn_id; |
|
| 196 } GG_PACKED; |
|
| 197 |
|
| 198 #define GG_MSG_CALLBACK 0x02 /**< Żądanie zwrotnego połączenia bezpośredniego */ |
|
| 199 |
|
| 200 #define GG_MSG_OPTION_CONFERENCE 0x01 |
|
| 201 #define GG_MSG_OPTION_ATTRIBUTES 0x02 |
|
| 202 #define GG_MSG_OPTION_IMAGE_REQUEST 0x04 |
|
| 203 #define GG_MSG_OPTION_IMAGE_REPLY 0x05 |
|
| 204 #define GG_MSG_OPTION_IMAGE_REPLY_MORE 0x06 |
|
| 205 |
|
| 206 #define GG_DCC7_ABORT 0x0025 |
|
| 207 |
|
| 208 struct gg_dcc7_abort { |
|
| 209 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 210 uint32_t uin_from; /* numer nadawcy */ |
|
| 211 uint32_t uin_to; /* numer odbiorcy */ |
|
| 212 } GG_PACKED; |
|
| 213 |
|
| 214 #define GG_DCC7_ABORTED 0x0025 |
|
| 215 |
|
| 216 struct gg_dcc7_aborted { |
|
| 217 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 218 } GG_PACKED; |
|
| 219 |
|
| 220 #define GG_DCC7_VOICE_RETRIES 0x11 /* 17 powtorzen */ |
|
| 221 |
|
| 222 #define GG_DCC7_RESERVED1 0xdeadc0de |
|
| 223 #define GG_DCC7_RESERVED2 0xdeadbeaf |
|
| 224 |
|
| 225 struct gg_dcc7_voice_auth { |
|
| 226 uint8_t type; /* 0x00 -> wysylanie ID |
|
| 227 * 0x01 -> potwierdzenie ID |
|
| 228 */ |
|
| 229 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 230 uint32_t reserved1; /* GG_DCC7_RESERVED1 */ |
|
| 231 uint32_t reserved2; /* GG_DCC7_RESERVED2 */ |
|
| 232 } GG_PACKED; |
|
| 233 |
|
| 234 /* Wyciszony mikrofon. Ten pakiet jest wysylany co 1s (jesli chcemy podtrzymac |
|
| 235 * polaczenie). |
|
| 236 */ |
|
| 237 struct gg_dcc7_voice_nodata { |
|
| 238 uint8_t type; /* 0x02 */ |
|
| 239 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 240 uint32_t reserved1; /* GG_DCC7_RESERVED1 */ |
|
| 241 uint32_t reserved2; /* GG_DCC7_RESERVED2 */ |
|
| 242 } GG_PACKED; |
|
| 243 |
|
| 244 struct gg_dcc7_voice_data { |
|
| 245 uint8_t type; /* 0x03 */ |
|
| 246 uint32_t did; /* XXX: co ile zwieksza sie u nas id pakietu [uzywac 0x28] */ |
|
| 247 uint32_t len; /* rozmiar strukturki - 1 (sizeof(type)) */ |
|
| 248 uint32_t packet_id; /* numerek pakietu */ |
|
| 249 uint32_t datalen; /* rozmiar danych */ |
|
| 250 /* char data[]; */ /* ramki: albo gsm, albo speex, albo melp, albo inne. */ |
|
| 251 } GG_PACKED; |
|
| 252 |
|
| 253 struct gg_dcc7_voice_init { |
|
| 254 uint8_t type; /* 0x04 */ |
|
| 255 uint32_t id; /* nr kroku [0x1 - 0x5] */ |
|
| 256 uint32_t protocol; /* XXX: wersja protokolu (0x29, 0x2a, 0x2b) */ |
|
| 257 uint32_t len; /* rozmiar sizeof(protocol)+sizeof(len)+ |
|
| 258 * sizeof(data) = 0x08 + sizeof(data) */ |
|
| 259 /* char data[]; */ /* reszta danych */ |
|
| 260 } GG_PACKED; |
|
| 261 |
|
| 262 struct gg_dcc7_voice_init_confirm { |
|
| 263 uint8_t type; /* 0x05 */ |
|
| 264 uint32_t id; /* id tego co potwierdzamy [0x1 - 0x5] */ |
|
| 265 } GG_PACKED; |
|
| 266 |
|
| 267 #define GG_DCC7_RELAY_TYPE_SERVER 0x01 /* adres serwera, na który spytać o proxy */ |
|
| 268 #define GG_DCC7_RELAY_TYPE_PROXY 0x08 /* adresy proxy, na które sie łączyć */ |
|
| 269 |
|
| 270 #define GG_DCC7_RELAY_DUNNO1 0x02 |
|
| 271 |
|
| 272 #define GG_DCC7_RELAY_REQUEST 0x0a |
|
| 273 |
|
| 274 struct gg_dcc7_relay_req { |
|
| 275 uint32_t magic; /* 0x0a */ |
|
| 276 uint32_t len; /* długość całego pakietu */ |
|
| 277 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 278 uint16_t type; /* typ zapytania */ |
|
| 279 uint16_t dunno1; /* 0x02 */ |
|
| 280 } GG_PACKED; |
|
| 281 |
|
| 282 #define GG_DCC7_RELAY_REPLY_RCOUNT 0x02 |
|
| 283 |
|
| 284 #define GG_DCC7_RELAY_REPLY 0x0b |
|
| 285 |
|
| 286 struct gg_dcc7_relay_reply { |
|
| 287 uint32_t magic; /* 0x0b */ |
|
| 288 uint32_t len; /* długość całego pakietu */ |
|
| 289 uint32_t rcount; /* ilość serwerów */ |
|
| 290 } GG_PACKED; |
|
| 291 |
|
| 292 struct gg_dcc7_relay_reply_server { |
|
| 293 uint32_t addr; /* adres ip serwera */ |
|
| 294 uint16_t port; /* port serwera */ |
|
| 295 uint8_t family; /* rodzina adresów (na końcu?!) AF_INET=2 */ |
|
| 296 } GG_PACKED; |
|
| 297 |
|
| 298 #define GG_DCC7_WELCOME_SERVER 0xc0debabe |
|
| 299 |
|
| 300 struct gg_dcc7_welcome_server { |
|
| 301 uint32_t magic; /* 0xc0debabe */ |
|
| 302 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 303 } GG_PACKED; |
|
| 304 |
|
| 305 struct gg_dcc7_welcome_p2p { |
|
| 306 gg_dcc7_id_t id; /* identyfikator połączenia */ |
|
| 307 } GG_PACKED; |
|
| 308 |
|
| 309 #define GG_TIMEOUT_DISCONNECT 5 /**< Maksymalny czas oczekiwania na rozłączenie */ |
|
| 310 |
|
| 311 #define GG_USERLIST100_VERSION 0x5c |
|
| 312 |
|
| 313 struct gg_userlist100_version { |
|
| 314 uint32_t version; /* numer wersji listy kontaktów */ |
|
| 315 } GG_PACKED; |
|
| 316 |
|
| 317 #define GG_USERLIST100_REQUEST 0x0040 |
|
| 318 |
|
| 319 struct gg_userlist100_request { |
|
| 320 uint8_t type; /* rodzaj żądania */ |
|
| 321 uint32_t version; /* numer ostatniej znanej wersji listy kontaktów bądź 0 */ |
|
| 322 uint8_t format_type; /* rodzaj żądanego typu formatu listy kontaktów */ |
|
| 323 uint8_t unknown1; /* 0x01 */ |
|
| 324 /* char request[]; */ |
|
| 325 } GG_PACKED; |
|
| 326 |
|
| 327 #define GG_USERLIST100_REPLY 0x41 |
|
| 328 |
|
| 329 struct gg_userlist100_reply { |
|
| 330 uint8_t type; /* rodzaj odpowiedzi */ |
|
| 331 uint32_t version; /* numer wersji listy kontaktów aktualnie przechowywanej przez serwer */ |
|
| 332 uint8_t format_type; /* rodzaj przesyłanego typu formatu listy kontaktów */ |
|
| 333 uint8_t unknown1; /* 0x01 */ |
|
| 334 /* char reply[]; */ |
|
| 335 } GG_PACKED; |
|
| 336 |
|
| 337 struct gg_chat_create { |
|
| 338 uint32_t seq; |
|
| 339 uint32_t dummy; |
|
| 340 } GG_PACKED; |
|
| 341 |
|
| 342 struct gg_chat_invite { |
|
| 343 uint64_t id; |
|
| 344 uint32_t seq; |
|
| 345 uint32_t participants_count; |
|
| 346 /* struct { |
|
| 347 uint32_t uin; |
|
| 348 uint32_t dummy; (0x1e) |
|
| 349 } participants[]; */ |
|
| 350 } GG_PACKED; |
|
| 351 |
|
| 352 struct gg_chat_leave { |
|
| 353 uint64_t id; |
|
| 354 uint32_t seq; |
|
| 355 } GG_PACKED; |
|
| 356 |
|
| 357 struct gg_chat_created { |
|
| 358 uint64_t id; |
|
| 359 uint32_t seq; |
|
| 360 } GG_PACKED; |
|
| 361 |
|
| 362 struct gg_chat_invite_ack { |
|
| 363 uint64_t id; |
|
| 364 uint32_t seq; |
|
| 365 uint32_t unknown1; /* 0x00 */ |
|
| 366 uint32_t unknown2; /* 0x10 */ |
|
| 367 } GG_PACKED; |
|
| 368 |
|
| 369 struct gg_chat_left { |
|
| 370 uint64_t id; |
|
| 371 uint32_t uin; |
|
| 372 } GG_PACKED; |
|
| 373 |
|
| 374 #define GG_ADD_NOTIFY105 0x007b |
|
| 375 #define GG_REMOVE_NOTIFY105 0x007c |
|
| 376 #define GG_EVENT110 0x0084 |
|
| 377 #define GG_IMTOKEN 0x008c |
|
| 378 #define GG_ACCESS_INFO 0x008f |
|
| 379 #define GG_NOTIFY105_FIRST 0x0077 |
|
| 380 #define GG_NOTIFY105_LAST 0x0078 |
|
| 381 #define GG_NOTIFY105_LIST_EMPTY 0x0079 |
|
| 382 #define GG_PONG110 0x00a1 |
|
| 383 #define GG_OPTIONS 0x009b |
|
| 384 |
|
| 385 #define GG_SEND_MSG110 0x007d |
|
| 386 #define GG_RECV_MSG110 0x007e |
|
| 387 #define GG_RECV_OWN_MSG110 0x0082 |
|
| 388 #define GG_ACK110 0x0086 |
|
| 389 #define GG_SEND_MSG_ACK110 0x0087 |
|
| 390 |
|
| 391 #define GG_CHAT_INFO 0x0093 |
|
| 392 #define GG_CHAT_INFO_UPDATE 0x009e |
|
| 393 #define GG_CHAT_CREATED 0x0045 |
|
| 394 #define GG_CHAT_INVITE_ACK 0x0047 |
|
| 395 #define GG_CHAT_RECV_MSG 0x0088 |
|
| 396 #define GG_CHAT_RECV_OWN_MSG 0x008e |
|
| 397 #define GG_CHAT_CREATE 0x0047 |
|
| 398 #define GG_CHAT_INVITE 0x0090 |
|
| 399 #define GG_CHAT_LEAVE 0x0052 |
|
| 400 #define GG_CHAT_LEFT 0x0066 |
|
| 401 #define GG_CHAT_SEND_MSG 0x008d |
|
| 402 |
|
| 403 #define GG_UIN_INFO 0x007a |
|
| 404 #define GG_TRANSFER_INFO 0x00a0 |
|
| 405 #define GG_MAGIC_NOTIFICATION 0x009f |
|
| 406 |
|
| 407 #ifdef _WIN32 |
|
| 408 #pragma pack(pop) |
|
| 409 #endif |
|
| 410 |
|
| 411 #endif /* LIBGADU_PROTOCOL_H */ |
|