ekg2
GIT master
Strona główna
Dodatkowe strony
Moduły
Struktury Danych
Pliki
Lista plików
Globalne
All
Struktury Danych
Pliki
Funkcje
Zmienne
Definicje typów
Wyliczenia
Wartości wyliczeń
Definicje
Grupay
Strony
plugins
icq
misc.h
Idź do dokumentacji tego pliku.
1
#ifndef __ICQ_MISC_H
2
#define __ICQ_MISC_H
3
4
typedef
struct
icq_tlv_list
{
5
struct
icq_tlv_list
*
next
;
6
7
guint16
type
;
8
guint16
len
;
9
10
guint32
nr
;
11
unsigned
char
*
buf
;
12
}
icq_tlv_t
;
13
14
struct
fieldnames_t
{
15
int
code
;
16
char
*
text
;
17
};
18
19
extern
struct
fieldnames_t
snac_families
[];
20
21
/* pack, unpack */
22
int
icq_unpack
(
unsigned
char
*buf,
unsigned
char
**endbuf,
int
*l,
char
*
format
, ...);
23
int
icq_unpack_nc
(
unsigned
char
*buf,
int
len,
char
*
format
, ...);
24
#define icq_unpack_tlv_word(tlv, val) \
25
do { \
26
val = 0; \
27
icq_unpack_nc(tlv ? tlv->buf : NULL, tlv ? tlv->len : 0, "W", &val); \
28
} while(0);
29
30
31
GString *
icq_pack
(
char
*
format
, ...);
32
GString *
icq_pack_append
(GString *str,
char
*
format
, ...);
33
34
#define icq_pack_tlv(type, data, datalen) (guint32) type, (guint32) datalen, (guint8 *) data
35
#define icq_pack_tlv_char(type, data) (guint32) type, (guint32) 1, (guint32) data
36
#define icq_pack_tlv_word(type, data) (guint32) type, (guint32) 2, (guint32) data
37
#define icq_pack_tlv_dword(type, data) (guint32) type, (guint32) 4, (guint32) data
38
#define icq_pack_tlv_str(type, str) icq_pack_tlv(type, str, xstrlen(str))
39
40
struct
icq_tlv_list
*
icq_unpack_tlvs
(
unsigned
char
**str,
int
*maxlen,
unsigned
int
maxcount);
41
struct
icq_tlv_list
*
icq_unpack_tlvs_nc
(
unsigned
char
*str,
int
maxlen,
unsigned
int
maxcount);
42
icq_tlv_t
*
icq_tlv_get
(
struct
icq_tlv_list
*l, guint16
type
);
43
void
icq_tlvs_destroy
(
struct
icq_tlv_list
**
list
);
44
45
void
icq_hexdump
(
int
level,
unsigned
char
*
p
,
size_t
len
);
46
char
*
icq_encryptpw
(
const
char
*pw);
47
guint16
icq_status
(
int
status);
48
49
#define ICQ_UNPACK(endbuf, args...) (icq_unpack(buf, endbuf, &len, args))
50
51
status_t
icq2ekg_status
(
int
icq_status
);
52
status_t
icq2ekg_status2
(
int
nMsgType);
53
54
/* misc */
55
int
tlv_length_check
(
char
*
name
,
icq_tlv_t
*t,
int
length);
56
57
#define ICQ_SNAC_NAMES_DEBUG 1
58
59
#if ICQ_SNAC_NAMES_DEBUG
60
const
char
*
icq_snac_name
(
int
family,
int
cmd);
61
#endif
62
63
const
char
*
icq_lookuptable
(
struct
fieldnames_t
*table,
int
code);
64
65
void
icq_pack_append_client_identification
(GString *pkt);
66
67
void
icq_convert_string_init
();
68
void
icq_convert_string_destroy
();
69
70
char
*
icq_convert_from_ucs2be
(
char
*
buf
,
int
len
);
71
GString *
icq_convert_to_ucs2be
(
char
*text);
72
char
*
icq_convert_from_utf8
(
char
*text);
73
74
void
icq_send_snac
(
session_t
*s, guint16 family, guint16 cmd,
private_data_t
*data,
snac_subhandler_t
subhandler,
char
*
format
, ...);
75
76
void
icq_rates_destroy
(
session_t
*s);
77
void
icq_rates_init
(
session_t
*s,
int
n_rates);
78
79
#endif
Wygenerowano Wt, 29 paź 2013 20:17:04 dla ekg2 programem
1.8.4