ekg2  GIT master
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  guint32 type; /* typ pakietu */
37  guint32 len; /* długość reszty pakietu */
38  char data[];
39 } GG_PACKED gg_header;
40 
41 #define GG_RECV_MSG 0x000a
42 typedef struct {
43  guint32 sender;
44  guint32 seq;
45  guint32 time;
46  guint32 msgclass;
47  char msg_data[];
48 } GG_PACKED gg_recv_msg;
49 
50 #define GG_SEND_MSG 0x000b
51 typedef struct {
52  guint32 recipient;
53  guint32 seq;
54  guint32 msgclass;
55  char msg_data[];
56 } GG_PACKED gg_send_msg;
57 
58 #define GG_WELCOME 0x0001
59 typedef struct {
60  guint32 key;
61 } GG_PACKED gg_welcome;
62 
63 #define GG_SEND_MSG_ACK 0x0005
64 typedef struct {
65  guint32 status;
66  guint32 recipient;
67  guint32 seq;
68 } GG_PACKED gg_send_msg_ack;
69 
70 #define GG_PING 0x0008
71 #define GG_PONG 0x0007
72 
73 #define GG_STATUS 0x0002
74 typedef struct {
75  guint32 uin; /* numerek */
76  guint32 status; /* nowy stan */
77  char status_data[];
78 } GG_PACKED gg_status;
79 
80 #define GG_NEW_STATUS 0x0002
81 typedef struct {
82  guint32 status; /* na jaki zmienić? */
83  char status_data[];
84 } GG_PACKED gg_new_status;
85 
86 #define GG_LOGIN_OK 0x0003
87 #define GG_LIST_EMPTY 0x0012
88 
89 #define GG_STATUS60 0x000f
90 
91 typedef struct {
92  guint32 uin; /* numerek plus flagi w MSB */
93  guint8 status; /* status danej osoby */
94  guint32 remote_ip; /* adres ip delikwenta */
95  guint16 remote_port; /* port, na ktĂłrym słucha klient */
96  guint8 version; /* wersja klienta */
97  guint8 image_size; /* maksymalny rozmiar grafiki w KiB */
98  guint8 dunno1; /* 0x00 */
99  char status_data[];
100 } GG_PACKED gg_status60;
101 
102 #define GG_NEED_EMAIL 0x0014
103 
104 #define GG_LOGIN60 0x0015
105 
106 typedef struct {
107  guint32 uin; /* mĂłj numerek */
108  guint32 hash; /* hash hasła */
109  guint32 status; /* status na dzień dobry */
110  guint32 version; /* moja wersja klienta */
111  guint8 dunno1; /* 0x00 */
112  guint32 local_ip; /* mĂłj adres ip */
113  guint16 local_port; /* port, na ktĂłrym słucham */
114  guint32 external_ip; /* zewnętrzny adres ip */
115  guint16 external_port; /* zewnętrzny port */
116  guint8 image_size; /* maksymalny rozmiar grafiki w KiB */
117  guint8 dunno2; /* 0xbe */
118  char status_data[];
119 } GG_PACKED gg_login60;
120 
121 #define GG_ADD_NOTIFY 0x000d
122 #define GG_REMOVE_NOTIFY 0x000e
123 
124 typedef struct {
125  guint32 uin; /* numerek */
126  guint8 dunno1; /* bitmapa */
127 } GG_PACKED gg_add_remove;
128 
129 #define GG_NOTIFY_REPLY60 0x0011
130 typedef struct {
131  guint32 uin; /* numerek plus flagi w MSB */
132  guint8 status; /* status danej osoby */
133  guint32 remote_ip; /* adres ip delikwenta */
134  guint16 remote_port; /* port, na ktĂłrym słucha klient */
135  guint8 version; /* wersja klienta */
136  guint8 image_size; /* maksymalny rozmiar grafiki w KiB */
137  guint8 dunno1; /* 0x00 */
138  unsigned char next[]; /* nastepny, lub DLUGOSC_OPISU+OPIS */
139 } GG_PACKED gg_notify_reply60;
140 
141 #define GG_NOTIFY_FIRST 0x000f
142 #define GG_NOTIFY_LAST 0x0010
143 
144 #define GG_NOTIFY 0x0010
145 
146 typedef struct {
147  guint32 uin; /* numerek danej osoby */
148  guint8 dunno1; /* rodzaj wpisu w liście */
149  char data[];
150 } GG_PACKED gg_notify;
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  guint32 uin; /* mĂłj numerek */
158  guint8 hash_type; /* rodzaj hashowania hasła */
159  guint8 hash[64]; /* hash hasła dopełniony zerami */
160  guint32 status; /* status na dzień dobry */
161  guint32 version; /* moja wersja klienta */
162  guint8 dunno1; /* 0x00 */
163  guint32 local_ip; /* mĂłj adres ip */
164  guint16 local_port; /* port, na ktĂłrym słucham */
165  guint32 external_ip; /* zewnętrzny adres ip (???) */
166  guint16 external_port; /* zewnętrzny port (???) */
167  guint8 image_size; /* maksymalny rozmiar grafiki w KiB */
168  guint8 dunno2; /* 0xbe */
169  char status_data[];
170 } GG_PACKED gg_login70;
172 #define GG_USERLIST_REPLY 0x0010
173 typedef struct {
174  guint8 type;
175  char data[];
176 } GG_PACKED gg_userlist_reply;
177 
178 #define GG_USERLIST_REQUEST 0x0016
179 
180 typedef struct {
181  guint8 type;
182  char data[];
183 } GG_PACKED gg_userlist_request;
184 
185 #define GG_PUBDIR50_REQUEST 0x0014
186 
187 typedef struct {
188  guint8 type; /* GG_PUBDIR50_* */
189  guint32 seq; /* czas wysłania zapytania */
190  char data[];
191 } GG_PACKED gg_pubdir50_request;
192 
193 #define GG_PUBDIR50_REPLY 0x000e
194 
195 typedef struct {
196  guint8 type; /* GG_PUBDIR50_* */
197  guint32 seq; /* czas wysłania zapytania */
198  char data[];
199 } GG_PACKED gg_pubdir50_reply;
200 
201 #define GG_DISCONNECTING 0x000b
202 
203 #define GG_STATUS77 0x17
204 typedef struct {
205  guint32 uin; /* [gg_status60] numerek plus flagi w MSB */
206  guint8 status; /* [gg_status60] status danej osoby */
207  guint32 remote_ip; /* [XXX] adres ip delikwenta */
208  guint16 remote_port; /* [XXX] port, na ktĂłrym słucha klient */
209  guint8 version; /* [gg_status60] wersja klienta */
210  guint8 image_size; /* [gg_status60] maksymalny rozmiar grafiki w KiB */
211  guint8 dunno1; /* 0x00 */
212  guint32 dunno2; /* 0x00 */
213  char status_data[];
214 } GG_PACKED gg_status77;
215 
216 #define GG_NOTIFY_REPLY77 0x0018
217 typedef struct {
218  guint32 uin; /* [gg_notify_reply60] numerek plus flagi w MSB */
219  guint8 status; /* [gg_notify_reply60] status danej osoby */
220  guint32 remote_ip; /* [XXX] adres ip delikwenta */
221  guint16 remote_port; /* [XXX] port, na ktĂłrym słucha klient */
222  guint8 version; /* [gg_notify_reply60] wersja klienta */
223  guint8 image_size; /* [gg_notify_reply60] maksymalny rozmiar grafiki w KiB */
224  guint8 dunno1; /* 0x00 */
225  guint32 dunno2; /* 0x00000000 */
226  unsigned char next[]; /* [like gg_notify_reply60] nastepny (gg_notify_reply77), lub DLUGOSC_OPISU+OPIS + nastepny (gg_notify_reply77) */
227 } GG_PACKED gg_notify_reply77;
228 
229 #define GG_DCC_ACCEPT 0x21
230 
231 typedef struct {
232  guint32 uin; /* uin */
233  unsigned char code1[8]; /* kod polaczenia */
234  guint32 seek; /* od ktorego miejsca chcemy/mamy wysylac. */
235  guint32 empty;
236 } GG_PACKED gg_dcc7_accept;
237 
238 #define GG_DCC7_REJECT 0x22
239 typedef struct {
240  guint32 uid;
241  unsigned char code1[8];
242  guint32 reason; /* known values: 0x02 -> rejected, 0x06 -> invalid version (6.x)
243  0x01 -> niemozliwe teraz? [jak ktos przesyla inny plik do Ciebie?] */
244 } GG_PACKED gg_dcc7_reject;
245 
246 #define GG_DCC7_FILENAME_LEN 255
248 #define GG_DCC7_NEW 0x20
249 typedef struct {
250  unsigned char code1[8];
251  guint32 uin_from; /* numer nadawcy */
252  guint32 uin_to; /* numer odbiorcy */
253  guint32 type; /* rodzaj transmisji */
254  unsigned char filename[GG_DCC7_FILENAME_LEN];
255  guint32 size; /* rozmiar, LE */
256  guint32 dunno1; /* 00 00 00 00 */
257  unsigned char hash[20]; /* hash w sha1 */
258 } GG_PACKED gg_dcc7_new;
259 
260 #define GG_DCC7_ID_REQUEST 0x23
261 
262 typedef struct {
263  guint32 type;
264 } GG_PACKED gg_dcc7_id_request;
265 
266 #define GG_DCC7_ID_REPLY 0x23
267 
268 typedef struct {
269  guint32 type;
270  unsigned char code1[8];
271 } GG_PACKED gg_dcc7_id_reply;
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  guint32 recipient;
280  guint32 seq;
281  guint32 msgclass;
282  guint32 offset_plain;
283  guint32 offset_attr;
284  char html_data[];
285 
286  /* '\0' */
287  /* plaintext msg */
288  /* '\0' */
289  /* guint32 dunno3; */ /* { 02 06 00 00 } */
290  /* guint8 dunno4; */ /* { 00 } */
291  /* guint32 dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */
292 } GG_PACKED gg_send_msg80;
293 
294 #define GG_RECV_MSG80 0x002e
295 
296 typedef struct gg_recv_msg80 {
297  guint32 sender;
298  guint32 seq;
299  guint32 time;
300  guint32 msgclass;
301  guint32 offset_plain;
302  guint32 offset_attr;
303  char html_data[];
304 
305  /* '\0' */
306  /* plaintext msg */
307  /* '\0' */
308  /* guint32 dunno3; */ /* { 02 06 00 00 } */
309  /* guint8 dunno4; */ /* { 00 } */
310  /* guint32 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
guint8 dunno1
Definition: sniff_gg.h:98
guint32 uin
Definition: sniff_gg.h:75
guint32 hash
Definition: sniff_gg.h:108
guint32 time
Definition: sniff_gg.h:45
guint32 uin_from
Definition: sniff_gg.h:251
guint32 seq
Definition: sniff_gg.h:44
guint32 empty
Definition: sniff_gg.h:235
guint8 image_size
Definition: sniff_gg.h:97
char html_data[]
Definition: sniff_gg.h:172
guint32 uin_to
Definition: sniff_gg.h:252
guint32 version
Definition: sniff_gg.h:110
guint32 offset_attr
Definition: sniff_gg.h:283
guint32 uid
Definition: sniff_gg.h:240
guint32 recipient
Definition: sniff_gg.h:52
guint32 reason
Definition: sniff_gg.h:242
Definition: sniff_gg.h:296
guint32 remote_ip
Definition: sniff_gg.h:94
guint32 time
Definition: sniff_gg.h:299
guint32 offset_plain
Definition: sniff_gg.h:301
guint32 offset_attr
Definition: sniff_gg.h:302
#define GG_PACKED
Definition: sniff_gg.h:33
guint32 external_ip
Definition: sniff_gg.h:114
guint32 sender
Definition: sniff_gg.h:297
guint16 remote_port
Definition: sniff_gg.h:95
guint16 local_port
Definition: sniff_gg.h:113
guint8 type
Definition: sniff_gg.h:174
guint8 hash_type
Definition: sniff_gg.h:158
guint32 offset_plain
Definition: sniff_gg.h:282
guint32 seq
Definition: sniff_gg.h:298
guint32 len
Definition: sniff_gg.h:37
guint32 msgclass
Definition: sniff_gg.h:169
guint16 external_port
Definition: sniff_gg.h:115
guint32 seek
Definition: sniff_gg.h:234
char html_data[]
Definition: sniff_gg.h:303
guint32 dunno1
Definition: sniff_gg.h:256
guint32 status
Definition: sniff_gg.h:65
guint32 local_ip
Definition: sniff_gg.h:112
guint32 msgclass
Definition: sniff_gg.h:46
guint32 sender
Definition: sniff_gg.h:43
guint8 dunno2
Definition: sniff_gg.h:117
guint32 msgclass
Definition: sniff_gg.h:300
guint32 key
Definition: sniff_gg.h:60
#define GG_DCC7_FILENAME_LEN
Definition: sniff_gg.h:246
guint32 seq
Definition: sniff_gg.h:167