ekg2
plugins/sniff/sniff_gg.h
Idź do dokumentacji tego pliku.
00001 /*
00002  *  (C) Copyright 2001-2003 Wojtek Kaniewski <wojtekka@irc.pl>
00003  *                          Robert J. WoĹşny <speedy@ziew.org>
00004  *                          Arkadiusz Miśkiewicz <arekm@pld-linux.org>
00005  *                          Tomasz Chiliński <chilek@chilan.com>
00006  *                          Piotr Wysocki <wysek@linux.bydg.org>
00007  *                          Dawid Jarosz <dawjar@poczta.onet.pl>
00008  *
00009  *                      & many others look at: http://ekg.chmurka.net/docs/protocol.html
00010  *
00011  *  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU Lesser General Public License Version
00013  *  2.1 as published by the Free Software Foundation.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Lesser General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU Lesser General Public
00021  *  License along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
00023  *  USA.
00024  */
00025 
00026 /* struct data && magic constants copied from libgadu (http://toxygen.net/libgadu) && 
00027  *      gg protocol documentation (http://ekg.chmurka.net/docs/protocol.html)
00028  *      great job guys! thx.
00029  */
00030 
00031 #include <sys/types.h>
00032 
00033 #define GG_PACKED __attribute__ ((packed))
00034 
00035 typedef struct {
00036         uint32_t type;                  /* typ pakietu */
00037         uint32_t len;           /* długość reszty pakietu */
00038         char data[];
00039 } GG_PACKED gg_header;
00040 
00041 #define GG_RECV_MSG 0x000a
00042 typedef struct {
00043         uint32_t sender;
00044         uint32_t seq;
00045         uint32_t time;
00046         uint32_t msgclass;
00047         char msg_data[];
00048 } GG_PACKED gg_recv_msg;
00049 
00050 #define GG_SEND_MSG 0x000b
00051 typedef struct {
00052         uint32_t recipient;
00053         uint32_t seq;
00054         uint32_t msgclass;
00055         char msg_data[];
00056 } GG_PACKED gg_send_msg;
00057 
00058 #define GG_WELCOME 0x0001
00059 typedef struct {
00060         uint32_t key;
00061 } GG_PACKED gg_welcome;
00062 
00063 #define GG_SEND_MSG_ACK 0x0005
00064 typedef struct {
00065         uint32_t status;
00066         uint32_t recipient;
00067         uint32_t seq;
00068 } GG_PACKED gg_send_msg_ack;
00069 
00070 #define GG_PING 0x0008
00071 #define GG_PONG 0x0007
00072 
00073 #define GG_STATUS 0x0002
00074 typedef struct {
00075         uint32_t uin;                   /* numerek */
00076         uint32_t status;                /* nowy stan */
00077         char status_data[];
00078 } GG_PACKED gg_status;
00079 
00080 #define GG_NEW_STATUS 0x0002
00081 typedef struct {
00082         uint32_t status;                        /* na jaki zmienić? */
00083         char status_data[];
00084 } GG_PACKED gg_new_status;
00085 
00086 #define GG_LOGIN_OK 0x0003
00087 #define GG_LIST_EMPTY 0x0012
00088 
00089 #define GG_STATUS60 0x000f
00090         
00091 typedef struct {
00092         uint32_t uin;                   /* numerek plus flagi w MSB */
00093         uint8_t status;                 /* status danej osoby */
00094         uint32_t remote_ip;             /* adres ip delikwenta */
00095         uint16_t remote_port;           /* port, na którym słucha klient */
00096         uint8_t version;                /* wersja klienta */
00097         uint8_t image_size;             /* maksymalny rozmiar grafiki w KiB */
00098         uint8_t dunno1;                 /* 0x00 */
00099         char status_data[];
00100 } GG_PACKED gg_status60;
00101 
00102 #define GG_NEED_EMAIL 0x0014
00103 
00104 #define GG_LOGIN60 0x0015
00105 
00106 typedef struct {
00107         uint32_t uin;                   /* mĂłj numerek */
00108         uint32_t hash;                  /* hash hasła */
00109         uint32_t status;                /* status na dzień dobry */
00110         uint32_t version;               /* moja wersja klienta */
00111         uint8_t dunno1;                 /* 0x00 */
00112         uint32_t local_ip;              /* mĂłj adres ip */
00113         uint16_t local_port;            /* port, na którym słucham */
00114         uint32_t external_ip;           /* zewnętrzny adres ip */
00115         uint16_t external_port;         /* zewnętrzny port */
00116         uint8_t image_size;             /* maksymalny rozmiar grafiki w KiB */
00117         uint8_t dunno2;                 /* 0xbe */
00118         char status_data[];
00119 } GG_PACKED gg_login60;
00120 
00121 #define GG_ADD_NOTIFY 0x000d
00122 #define GG_REMOVE_NOTIFY 0x000e
00123 
00124 typedef struct {
00125         uint32_t uin;                   /* numerek */
00126         uint8_t dunno1;                 /* bitmapa */
00127 } GG_PACKED gg_add_remove;
00128 
00129 #define GG_NOTIFY_REPLY60 0x0011
00130 typedef struct {
00131         uint32_t uin;                   /* numerek plus flagi w MSB */
00132         uint8_t status;                 /* status danej osoby */
00133         uint32_t remote_ip;             /* adres ip delikwenta */
00134         uint16_t remote_port;           /* port, na którym słucha klient */
00135         uint8_t version;                /* wersja klienta */
00136         uint8_t image_size;             /* maksymalny rozmiar grafiki w KiB */
00137         uint8_t dunno1;                 /* 0x00 */
00138         unsigned char next[];           /* nastepny, lub DLUGOSC_OPISU+OPIS */
00139 } GG_PACKED gg_notify_reply60;
00140 
00141 #define GG_NOTIFY_FIRST 0x000f
00142 #define GG_NOTIFY_LAST 0x0010
00143 
00144 #define GG_NOTIFY 0x0010
00145         
00146 typedef struct {
00147         uint32_t uin;                           /* numerek danej osoby */
00148         uint8_t dunno1;                         /* rodzaj wpisu w liście */
00149         char data[];
00150 } GG_PACKED gg_notify;
00151 
00152 #define GG_LOGIN70 0x19
00153 #define GG_LOGIN_HASH_GG32 0x01
00154 #define GG_LOGIN_HASH_SHA1 0x02
00155 
00156 typedef struct {
00157         uint32_t uin;                   /* mĂłj numerek */
00158         uint8_t hash_type;              /* rodzaj hashowania hasła */
00159         uint8_t hash[64];               /* hash hasła dopełniony zerami */
00160         uint32_t status;                /* status na dzień dobry */
00161         uint32_t version;               /* moja wersja klienta */
00162         uint8_t dunno1;                 /* 0x00 */
00163         uint32_t local_ip;              /* mĂłj adres ip */
00164         uint16_t local_port;            /* port, na którym słucham */
00165         uint32_t external_ip;           /* zewnętrzny adres ip (???) */
00166         uint16_t external_port;         /* zewnętrzny port (???) */
00167         uint8_t image_size;             /* maksymalny rozmiar grafiki w KiB */
00168         uint8_t dunno2;                 /* 0xbe */
00169         char status_data[];
00170 } GG_PACKED gg_login70;
00171 
00172 #define GG_USERLIST_REPLY 0x0010
00173 typedef struct {
00174         uint8_t type;
00175         char data[];
00176 } GG_PACKED gg_userlist_reply;
00177 
00178 #define GG_USERLIST_REQUEST 0x0016
00179 
00180 typedef struct {
00181         uint8_t type;
00182         char data[];
00183 } GG_PACKED gg_userlist_request;
00184 
00185 #define GG_PUBDIR50_REQUEST 0x0014
00186 
00187 typedef struct {
00188         uint8_t type;                   /* GG_PUBDIR50_* */
00189         uint32_t seq;                   /* czas wysłania zapytania */
00190         char data[];
00191 } GG_PACKED gg_pubdir50_request;
00192 
00193 #define GG_PUBDIR50_REPLY 0x000e
00194 
00195 typedef struct {
00196         uint8_t type;                   /* GG_PUBDIR50_* */
00197         uint32_t seq;                   /* czas wysłania zapytania */
00198         char data[];
00199 } GG_PACKED gg_pubdir50_reply;
00200 
00201 #define GG_DISCONNECTING 0x000b
00202 
00203 #define GG_STATUS77 0x17
00204 typedef struct {
00205         uint32_t uin;                   /* [gg_status60] numerek plus flagi w MSB */
00206         uint8_t status;                 /* [gg_status60] status danej osoby */
00207         uint32_t remote_ip;             /* [XXX] adres ip delikwenta */
00208         uint16_t remote_port;           /* [XXX] port, na którym słucha klient */
00209         uint8_t version;                /* [gg_status60] wersja klienta */
00210         uint8_t image_size;             /* [gg_status60] maksymalny rozmiar grafiki w KiB */
00211         uint8_t dunno1;                 /* 0x00 */
00212         uint32_t dunno2;                /* 0x00 */
00213         char status_data[];
00214 } GG_PACKED gg_status77;
00215 
00216 #define GG_NOTIFY_REPLY77 0x0018
00217 typedef struct {
00218         uint32_t uin;                   /* [gg_notify_reply60] numerek plus flagi w MSB */
00219         uint8_t status;                 /* [gg_notify_reply60] status danej osoby */
00220         uint32_t remote_ip;             /* [XXX] adres ip delikwenta */
00221         uint16_t remote_port;           /* [XXX] port, na którym słucha klient */
00222         uint8_t version;                /* [gg_notify_reply60] wersja klienta */
00223         uint8_t image_size;             /* [gg_notify_reply60] maksymalny rozmiar grafiki w KiB */
00224         uint8_t dunno1;                 /* 0x00 */
00225         uint32_t dunno2;                /* 0x00000000 */
00226         unsigned char next[];           /* [like gg_notify_reply60] nastepny (gg_notify_reply77), lub DLUGOSC_OPISU+OPIS + nastepny (gg_notify_reply77) */
00227 } GG_PACKED gg_notify_reply77;
00228 
00229 #define GG_DCC_ACCEPT 0x21
00230 
00231 typedef struct {
00232         uint32_t uin;                   /* uin */
00233         unsigned char code1[8];         /* kod polaczenia */
00234         uint32_t seek;                  /* od ktorego miejsca chcemy/mamy wysylac. */
00235         uint32_t empty;
00236 } GG_PACKED gg_dcc7_accept;
00237 
00238 #define GG_DCC7_REJECT 0x22
00239 typedef struct {
00240         uint32_t uid;
00241         unsigned char code1[8];
00242         uint32_t reason;                /* known values: 0x02 -> rejected, 0x06 -> invalid version (6.x) 
00243                                                          0x01 -> niemozliwe teraz? [jak ktos przesyla inny plik do Ciebie?] */
00244 } GG_PACKED gg_dcc7_reject;
00245 
00246 #define GG_DCC7_FILENAME_LEN    255     
00248 #define GG_DCC7_NEW 0x20
00249 typedef struct {
00250         unsigned char code1[8];
00251         uint32_t uin_from;              /* numer nadawcy */
00252         uint32_t uin_to;                /* numer odbiorcy */
00253         uint32_t type;                  /* rodzaj transmisji */
00254         unsigned char filename[GG_DCC7_FILENAME_LEN];
00255         uint32_t size;                  /* rozmiar, LE */
00256         uint32_t dunno1;                /* 00 00 00 00 */
00257         unsigned char hash[20];         /* hash w sha1 */
00258 } GG_PACKED gg_dcc7_new;
00259 
00260 #define GG_DCC7_ID_REQUEST 0x23
00261 
00262 typedef struct {
00263         uint32_t type;
00264 } GG_PACKED gg_dcc7_id_request;
00265 
00266 #define GG_DCC7_ID_REPLY 0x23
00267 
00268 typedef struct {
00269         uint32_t type;
00270         unsigned char code1[8];
00271 } GG_PACKED gg_dcc7_id_reply;
00272 
00273 #define GG_DCC7_TYPE_VOICE 0x00000001
00274 #define GG_DCC7_TYPE_FILE 0x00000004
00275 
00276 #define GG_SEND_MSG80 0x002d
00277 
00278 typedef struct {
00279         uint32_t recipient;
00280         uint32_t seq;
00281         uint32_t msgclass;
00282         uint32_t offset_plain;
00283         uint32_t offset_attr;
00284         char html_data[];
00285 
00286         /* '\0' */
00287         /* plaintext msg */
00288         /* '\0' */
00289         /* uint32_t dunno3; */                                          /* { 02 06 00 00 } */
00290         /* uint8_t dunno4; */                                           /* { 00 } */
00291         /* uint32_t dunno5; */          /* like msgclass? */            /* { 08 00 00 00 } */
00292 } GG_PACKED gg_send_msg80;
00293 
00294 #define GG_RECV_MSG80 0x002e
00295 
00296 typedef struct gg_recv_msg80 {
00297         uint32_t sender;
00298         uint32_t seq;
00299         uint32_t time;
00300         uint32_t msgclass;
00301         uint32_t offset_plain;
00302         uint32_t offset_attr;
00303         char html_data[];
00304 
00305         /* '\0' */
00306         /* plaintext msg */
00307         /* '\0' */
00308         /* uint32_t dunno3; */                                          /* { 02 06 00 00 } */
00309         /* uint8_t dunno4; */                                           /* { 00 } */
00310         /* uint32_t dunno5; */          /* like msgclass? */            /* { 08 00 00 00 } */
00311 } GG_PACKED gg_recv_msg80;
00312 
00313 #define GG_STATUS_NOT_AVAIL 0x0001              /* niedostępny */
00314 #define GG_STATUS_NOT_AVAIL_DESCR 0x0015        /* niedostępny z opisem (4.8) */
00315 #define GG_STATUS_AVAIL 0x0002                  /* dostępny */
00316 #define GG_STATUS_AVAIL_DESCR 0x0004            /* dostępny z opisem (4.9) */
00317 #define GG_STATUS_BUSY 0x0003                   /* zajęty */
00318 #define GG_STATUS_BUSY_DESCR 0x0005             /* zajęty z opisem (4.8) */
00319 #define GG_STATUS_INVISIBLE 0x0014              /* niewidoczny (4.6) */
00320 #define GG_STATUS_INVISIBLE_DESCR 0x0016        /* niewidoczny z opisem (4.9) */
00321 #define GG_STATUS_BLOCKED 0x0006                /* zablokowany */
00322 
00323 #define GG_STATUS_FRIENDS_MASK 0x8000           /* tylko dla znajomych (4.6) */
00324 #define GG_STATUS_VOICE_MASK 0x20000            /* czy ma wlaczone audio (7.7) */
00325 
00326 #define GG_USERLIST_PUT 0x00
00327 #define GG_USERLIST_PUT_MORE 0x01
00328 #define GG_USERLIST_GET 0x02
00329 
00330 #define GG_USERLIST_PUT_REPLY 0x00
00331 #define GG_USERLIST_PUT_MORE_REPLY 0x02
00332 #define GG_USERLIST_GET_REPLY 0x06
00333 #define GG_USERLIST_GET_MORE_REPLY 0x04
00334 
00335 #define GG_PUBDIR50_WRITE 0x01
00336 #define GG_PUBDIR50_READ 0x02
00337 #define GG_PUBDIR50_SEARCH_REQUEST 0x03
00338 #define GG_PUBDIR50_SEARCH_REPLY 0x05
00339 
00340 #define GG_PUBDIR50_UIN "FmNumber"
00341 #define GG_PUBDIR50_STATUS "FmStatus"
00342 #define GG_PUBDIR50_FIRSTNAME "firstname"
00343 #define GG_PUBDIR50_LASTNAME "lastname"
00344 #define GG_PUBDIR50_NICKNAME "nickname"
00345 #define GG_PUBDIR50_BIRTHYEAR "birthyear"
00346 #define GG_PUBDIR50_CITY "city"
00347 #define GG_PUBDIR50_GENDER "gender"
00348 #define GG_PUBDIR50_ACTIVE "ActiveOnly"
00349 #define GG_PUBDIR50_START "fmstart"
00350 #define GG_PUBDIR50_FAMILYNAME "familyname"
00351 #define GG_PUBDIR50_FAMILYCITY "familycity"
00352 
00353 #define GG_ACK_BLOCKED 0x0001
00354 #define GG_ACK_DELIVERED 0x0002
00355 #define GG_ACK_QUEUED 0x0003
00356 #define GG_ACK_MBOXFULL 0x0004
00357 #define GG_ACK_NOT_DELIVERED 0x0006
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje