annotate libpurple/protocols/msn/tlv.h @ 31771:b8e076d51817

Add P2Pv2 parsing and saving functions. Tested by compiling them! They aren't enabled yet, so we should still be doing v1 right now.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 10 Mar 2011 06:29:00 +0000
parents a6d2d7de8a08
children 506b77a27a53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
41 msn_tlv_t *msn_tlv_gettlv(GSList *list, const guint16 type, const int nth);
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
42 int msn_tlv_getlength(GSList *list, const guint16 type, const int nth);
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
43 char *msn_tlv_getstr(GSList *list, const guint16 type, const int nth);
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
44 guint8 msn_tlv_get8(GSList *list, const guint16 type, const int nth);
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
45 guint16 msn_tlv_get16(GSList *list, const guint16 type, const int nth);
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
46 guint32 msn_tlv_get32(GSList *list, const guint16 type, const int nth);
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);
31771
b8e076d51817 Add P2Pv2 parsing and saving functions. Tested by compiling them!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31494
diff changeset
55 int msn_tlvlist_write(char *bs, size_t bs_len, GSList *list);
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
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
58 int msn_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const char *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
59 int msn_tlvlist_add_empty(GSList **list, const guint16 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
60 int msn_tlvlist_add_8(GSList **list, const guint16 type, const 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
61 int msn_tlvlist_add_16(GSList **list, const guint16 type, const guint16 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
62 int msn_tlvlist_add_32(GSList **list, const guint16 type, const guint32 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
63 int msn_tlvlist_add_str(GSList **list, const guint16 type, const char *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
64
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 int msn_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const char *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
66 int msn_tlvlist_replace_str(GSList **list, const guint16 type, const char *str);
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
67 int msn_tlvlist_replace_empty(GSList **list, const guint16 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
68 int msn_tlvlist_replace_8(GSList **list, const guint16 type, const 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
69 int msn_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 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
70 int msn_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 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
71
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
72 void msn_tlvlist_remove(GSList **list, const guint16 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
73
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
74 #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
75