Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/tlv.h @ 32018:c714ccbcdf00
Add a function to add/replace a TLV to a list.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 07 May 2011 07:28:05 +0000 |
parents | bd59044a9100 |
children |
rev | line source |
---|---|
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 /** |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 * @file tlv.h MSN TLV functions |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 * |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 * purple |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 * |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 * source distribution. |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 * |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 * (at your option) any later version. |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 * |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 * |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 */ |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 #ifndef MSN_TLV_H |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 #define MSN_TLV_H |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 #include "msn.h" |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
30 /* TLV structure */ |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 typedef struct msn_tlv_s |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 { |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 guint8 type; |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
34 guint8 length; |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
35 guint8 *value; |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
36 } msn_tlv_t; |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 /* TLV handling functions */ |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 char *msn_tlv_getvalue_as_string(msn_tlv_t *tlv); |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 |
32016
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
41 msn_tlv_t *msn_tlv_gettlv(GSList *list, const guint8 type, const int nth); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
42 int msn_tlv_getlength(GSList *list, const guint8 type, const int nth); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
43 char *msn_tlv_getstr(GSList *list, const guint8 type, const int nth); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
44 guint8 msn_tlv_get8(GSList *list, const guint8 type, const int nth); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
45 guint16 msn_tlv_get16(GSList *list, const guint8 type, const int nth); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
46 guint32 msn_tlv_get32(GSList *list, const guint8 type, const int nth); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
48 /* TLV list handling functions */ |
31771
b8e076d51817
Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31494
diff
changeset
|
49 GSList *msn_tlvlist_read(const char *bs, size_t bs_len); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 GSList *msn_tlvlist_copy(GSList *orig); |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
51 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
52 int msn_tlvlist_count(GSList *list); |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
53 size_t msn_tlvlist_size(GSList *list); |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 gboolean msn_tlvlist_equal(GSList *one, GSList *two); |
32001
506b77a27a53
This should fix TLV in from and out of the wire.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31771
diff
changeset
|
55 char *msn_tlvlist_write(GSList *list, size_t *out_len); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
56 void msn_tlvlist_free(GSList *list); |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
57 |
32016
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
58 int msn_tlvlist_add_raw(GSList **list, const guint8 type, const guint8 length, const char *value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
59 int msn_tlvlist_add_empty(GSList **list, const guint8 type); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
60 int msn_tlvlist_add_8(GSList **list, const guint8 type, const guint8 value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
61 int msn_tlvlist_add_16(GSList **list, const guint8 type, const guint16 value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
62 int msn_tlvlist_add_32(GSList **list, const guint8 type, const guint32 value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
63 int msn_tlvlist_add_str(GSList **list, const guint8 type, const char *value); |
32018
c714ccbcdf00
Add a function to add/replace a TLV to a list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32016
diff
changeset
|
64 int msn_tlvlist_add_tlv(GSList **list, const msn_tlv_t *tlv); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
65 |
32016
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
66 int msn_tlvlist_replace_raw(GSList **list, const guint8 type, const guint8 lenth, const char *value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
67 int msn_tlvlist_replace_str(GSList **list, const guint8 type, const char *str); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
68 int msn_tlvlist_replace_empty(GSList **list, const guint8 type); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
69 int msn_tlvlist_replace_8(GSList **list, const guint8 type, const guint8 value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
70 int msn_tlvlist_replace_16(GSList **list, const guint8 type, const guint16 value); |
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
71 int msn_tlvlist_replace_32(GSList **list, const guint8 type, const guint32 value); |
32018
c714ccbcdf00
Add a function to add/replace a TLV to a list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32016
diff
changeset
|
72 int msn_tlvlist_replace_tlv(GSList **list, const msn_tlv_t *tlv); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 |
32016
bd59044a9100
The type and length of the TLV are only bytes, so fix the function
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32001
diff
changeset
|
74 void msn_tlvlist_remove(GSList **list, const guint8 type); |
31494
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 #endif /* MSN_TLV_H */ |
a6d2d7de8a08
Nick some TLV functions from AIM. I don't know if I need all of these,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
77 |