ekg2
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
sniff_gg.h
Idź do dokumentacji tego pliku.
1 /*
2  * (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
3  * Robert J. WoĹşny <speedy@ziew.org>
4  * Arkadiusz Miśkiewicz <arekm@pld-linux.org>
5  * Tomasz Chiliński <chilek@chilan.com>
6  * Piotr Wysocki <wysek@linux.bydg.org>
7  * Dawid Jarosz <dawjar@poczta.onet.pl>
8  *
9  * & many others look at: http://ekg.chmurka.net/docs/protocol.html
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License Version
13  * 2.1 as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
23  * USA.
24  */
25 
26 /* struct data && magic constants copied from libgadu (http://toxygen.net/libgadu) &&
27  * gg protocol documentation (http://ekg.chmurka.net/docs/protocol.html)
28  * great job guys! thx.
29  */
30 
31 #include <sys/types.h>
32 
33 #define GG_PACKED __attribute__ ((packed))
34 
35 typedef struct {
36  uint32_t type; /* typ pakietu */
37  uint32_t len; /* długość reszty pakietu */
38  char data[];
40 
41 #define GG_RECV_MSG 0x000a
42 typedef struct {
43  uint32_t sender;
44  uint32_t seq;
45  uint32_t time;
46  uint32_t msgclass;
47  char msg_data[];
49 
50 #define GG_SEND_MSG 0x000b
51 typedef struct {
52  uint32_t recipient;
53  uint32_t seq;
54  uint32_t msgclass;
55  char msg_data[];
57 
58 #define GG_WELCOME 0x0001
59 typedef struct {
60  uint32_t key;
62 
63 #define GG_SEND_MSG_ACK 0x0005
64 typedef struct {
65  uint32_t status;
66  uint32_t recipient;
67  uint32_t seq;
69 
70 #define GG_PING 0x0008
71 #define GG_PONG 0x0007
72 
73 #define GG_STATUS 0x0002
74 typedef struct {
75  uint32_t uin; /* numerek */
76  uint32_t status; /* nowy stan */
77  char status_data[];
79 
80 #define GG_NEW_STATUS 0x0002
81 typedef struct {
82  uint32_t status; /* na jaki zmienić? */
83  char status_data[];
85 
86 #define GG_LOGIN_OK 0x0003
87 #define GG_LIST_EMPTY 0x0012
88 
89 #define GG_STATUS60 0x000f
90 
91 typedef struct {
92  uint32_t uin; /* numerek plus flagi w MSB */
93  uint8_t status; /* status danej osoby */
94  uint32_t remote_ip; /* adres ip delikwenta */
95  uint16_t remote_port; /* port, na ktĂłrym słucha klient */
96  uint8_t version; /* wersja klienta */
97  uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */
98  uint8_t dunno1; /* 0x00 */
99  char status_data[];
101 
102 #define GG_NEED_EMAIL 0x0014
103 
104 #define GG_LOGIN60 0x0015
105 
106 typedef struct {
107  uint32_t uin; /* mĂłj numerek */
108  uint32_t hash; /* hash hasła */
109  uint32_t status; /* status na dzień dobry */
110  uint32_t version; /* moja wersja klienta */
111  uint8_t dunno1; /* 0x00 */
112  uint32_t local_ip; /* mĂłj adres ip */
113  uint16_t local_port; /* port, na ktĂłrym słucham */
114  uint32_t external_ip; /* zewnętrzny adres ip */
115  uint16_t external_port; /* zewnętrzny port */
116  uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */
117  uint8_t dunno2; /* 0xbe */
118  char status_data[];
120 
121 #define GG_ADD_NOTIFY 0x000d
122 #define GG_REMOVE_NOTIFY 0x000e
123 
124 typedef struct {
125  uint32_t uin; /* numerek */
126  uint8_t dunno1; /* bitmapa */
128 
129 #define GG_NOTIFY_REPLY60 0x0011
130 typedef struct {
131  uint32_t uin; /* numerek plus flagi w MSB */
132  uint8_t status; /* status danej osoby */
133  uint32_t remote_ip; /* adres ip delikwenta */
134  uint16_t remote_port; /* port, na ktĂłrym słucha klient */
135  uint8_t version; /* wersja klienta */
136  uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */
137  uint8_t dunno1; /* 0x00 */
138  unsigned char next[]; /* nastepny, lub DLUGOSC_OPISU+OPIS */
140 
141 #define GG_NOTIFY_FIRST 0x000f
142 #define GG_NOTIFY_LAST 0x0010
143 
144 #define GG_NOTIFY 0x0010
145 
146 typedef struct {
147  uint32_t uin; /* numerek danej osoby */
148  uint8_t dunno1; /* rodzaj wpisu w liście */
149  char data[];
151 
152 #define GG_LOGIN70 0x19
153 #define GG_LOGIN_HASH_GG32 0x01
154 #define GG_LOGIN_HASH_SHA1 0x02
155 
156 typedef struct {
157  uint32_t uin; /* mĂłj numerek */
158  uint8_t hash_type; /* rodzaj hashowania hasła */
159  uint8_t hash[64]; /* hash hasła dopełniony zerami */
160  uint32_t status; /* status na dzień dobry */
161  uint32_t version; /* moja wersja klienta */
162  uint8_t dunno1; /* 0x00 */
163  uint32_t local_ip; /* mĂłj adres ip */
164  uint16_t local_port; /* port, na ktĂłrym słucham */
165  uint32_t external_ip; /* zewnętrzny adres ip (???) */
166  uint16_t external_port; /* zewnętrzny port (???) */
167  uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */
168  uint8_t dunno2; /* 0xbe */
169  char status_data[];
171 
172 #define GG_USERLIST_REPLY 0x0010
173 typedef struct {
174  uint8_t type;
175  char data[];
177 
178 #define GG_USERLIST_REQUEST 0x0016
179 
180 typedef struct {
181  uint8_t type;
182  char data[];
184 
185 #define GG_PUBDIR50_REQUEST 0x0014
186 
187 typedef struct {
188  uint8_t type; /* GG_PUBDIR50_* */
189  uint32_t seq; /* czas wysłania zapytania */
190  char data[];
192 
193 #define GG_PUBDIR50_REPLY 0x000e
194 
195 typedef struct {
196  uint8_t type; /* GG_PUBDIR50_* */
197  uint32_t seq; /* czas wysłania zapytania */
198  char data[];
200 
201 #define GG_DISCONNECTING 0x000b
202 
203 #define GG_STATUS77 0x17
204 typedef struct {
205  uint32_t uin; /* [gg_status60] numerek plus flagi w MSB */
206  uint8_t status; /* [gg_status60] status danej osoby */
207  uint32_t remote_ip; /* [XXX] adres ip delikwenta */
208  uint16_t remote_port; /* [XXX] port, na ktĂłrym słucha klient */
209  uint8_t version; /* [gg_status60] wersja klienta */
210  uint8_t image_size; /* [gg_status60] maksymalny rozmiar grafiki w KiB */
211  uint8_t dunno1; /* 0x00 */
212  uint32_t dunno2; /* 0x00 */
213  char status_data[];
215 
216 #define GG_NOTIFY_REPLY77 0x0018
217 typedef struct {
218  uint32_t uin; /* [gg_notify_reply60] numerek plus flagi w MSB */
219  uint8_t status; /* [gg_notify_reply60] status danej osoby */
220  uint32_t remote_ip; /* [XXX] adres ip delikwenta */
221  uint16_t remote_port; /* [XXX] port, na ktĂłrym słucha klient */
222  uint8_t version; /* [gg_notify_reply60] wersja klienta */
223  uint8_t image_size; /* [gg_notify_reply60] maksymalny rozmiar grafiki w KiB */
224  uint8_t dunno1; /* 0x00 */
225  uint32_t dunno2; /* 0x00000000 */
226  unsigned char next[]; /* [like gg_notify_reply60] nastepny (gg_notify_reply77), lub DLUGOSC_OPISU+OPIS + nastepny (gg_notify_reply77) */
228 
229 #define GG_DCC_ACCEPT 0x21
230 
231 typedef struct {
232  uint32_t uin; /* uin */
233  unsigned char code1[8]; /* kod polaczenia */
234  uint32_t seek; /* od ktorego miejsca chcemy/mamy wysylac. */
235  uint32_t empty;
237 
238 #define GG_DCC7_REJECT 0x22
239 typedef struct {
240  uint32_t uid;
241  unsigned char code1[8];
242  uint32_t reason; /* known values: 0x02 -> rejected, 0x06 -> invalid version (6.x)
243  0x01 -> niemozliwe teraz? [jak ktos przesyla inny plik do Ciebie?] */
245 
246 #define GG_DCC7_FILENAME_LEN 255
248 #define GG_DCC7_NEW 0x20
249 typedef struct {
250  unsigned char code1[8];
251  uint32_t uin_from; /* numer nadawcy */
252  uint32_t uin_to; /* numer odbiorcy */
253  uint32_t type; /* rodzaj transmisji */
254  unsigned char filename[GG_DCC7_FILENAME_LEN];
255  uint32_t size; /* rozmiar, LE */
256  uint32_t dunno1; /* 00 00 00 00 */
257  unsigned char hash[20]; /* hash w sha1 */
259 
260 #define GG_DCC7_ID_REQUEST 0x23
261 
262 typedef struct {
263  uint32_t type;
265 
266 #define GG_DCC7_ID_REPLY 0x23
267 
268 typedef struct {
269  uint32_t type;
270  unsigned char code1[8];
272 
273 #define GG_DCC7_TYPE_VOICE 0x00000001
274 #define GG_DCC7_TYPE_FILE 0x00000004
275 
276 #define GG_SEND_MSG80 0x002d
277 
278 typedef struct {
279  uint32_t recipient;
280  uint32_t seq;
281  uint32_t msgclass;
282  uint32_t offset_plain;
283  uint32_t offset_attr;
284  char html_data[];
285 
286  /* '\0' */
287  /* plaintext msg */
288  /* '\0' */
289  /* uint32_t dunno3; */ /* { 02 06 00 00 } */
290  /* uint8_t dunno4; */ /* { 00 } */
291  /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */
293 
294 #define GG_RECV_MSG80 0x002e
295 
296 typedef struct gg_recv_msg80 {
297  uint32_t sender;
298  uint32_t seq;
299  uint32_t time;
300  uint32_t msgclass;
301  uint32_t offset_plain;
302  uint32_t offset_attr;
303  char html_data[];
304 
305  /* '\0' */
306  /* plaintext msg */
307  /* '\0' */
308  /* uint32_t dunno3; */ /* { 02 06 00 00 } */
309  /* uint8_t dunno4; */ /* { 00 } */
310  /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */
312 
313 #define GG_STATUS_NOT_AVAIL 0x0001 /* niedostępny */
314 #define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostępny z opisem (4.8) */
315 #define GG_STATUS_AVAIL 0x0002 /* dostępny */
316 #define GG_STATUS_AVAIL_DESCR 0x0004 /* dostępny z opisem (4.9) */
317 #define GG_STATUS_BUSY 0x0003 /* zajęty */
318 #define GG_STATUS_BUSY_DESCR 0x0005 /* zajęty z opisem (4.8) */
319 #define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */
320 #define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */
321 #define GG_STATUS_BLOCKED 0x0006 /* zablokowany */
322 
323 #define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */
324 #define GG_STATUS_VOICE_MASK 0x20000 /* czy ma wlaczone audio (7.7) */
325 
326 #define GG_USERLIST_PUT 0x00
327 #define GG_USERLIST_PUT_MORE 0x01
328 #define GG_USERLIST_GET 0x02
329 
330 #define GG_USERLIST_PUT_REPLY 0x00
331 #define GG_USERLIST_PUT_MORE_REPLY 0x02
332 #define GG_USERLIST_GET_REPLY 0x06
333 #define GG_USERLIST_GET_MORE_REPLY 0x04
334 
335 #define GG_PUBDIR50_WRITE 0x01
336 #define GG_PUBDIR50_READ 0x02
337 #define GG_PUBDIR50_SEARCH_REQUEST 0x03
338 #define GG_PUBDIR50_SEARCH_REPLY 0x05
339 
340 #define GG_PUBDIR50_UIN "FmNumber"
341 #define GG_PUBDIR50_STATUS "FmStatus"
342 #define GG_PUBDIR50_FIRSTNAME "firstname"
343 #define GG_PUBDIR50_LASTNAME "lastname"
344 #define GG_PUBDIR50_NICKNAME "nickname"
345 #define GG_PUBDIR50_BIRTHYEAR "birthyear"
346 #define GG_PUBDIR50_CITY "city"
347 #define GG_PUBDIR50_GENDER "gender"
348 #define GG_PUBDIR50_ACTIVE "ActiveOnly"
349 #define GG_PUBDIR50_START "fmstart"
350 #define GG_PUBDIR50_FAMILYNAME "familyname"
351 #define GG_PUBDIR50_FAMILYCITY "familycity"
352 
353 #define GG_ACK_BLOCKED 0x0001
354 #define GG_ACK_DELIVERED 0x0002
355 #define GG_ACK_QUEUED 0x0003
356 #define GG_ACK_MBOXFULL 0x0004
357 #define GG_ACK_NOT_DELIVERED 0x0006