libpurple/protocols/gg/lib/tvbuff.h

branch
release-2.x.y
changeset 43264
50facee54d1d
parent 43263
b9cf92c8b16b
equal deleted inserted replaced
43263:b9cf92c8b16b 43264:50facee54d1d
1 /* $Id$ */
2
3 /*
4 * (C) Copyright 2012 Tomek Wasilczyk <www.wasilczyk.pl>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License Version
8 * 2.1 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
18 * USA.
19 */
20
21 #ifndef LIBGADU_TVBUFF_H
22 #define LIBGADU_TVBUFF_H
23
24 #include "libgadu.h"
25
26 typedef struct gg_tvbuff gg_tvbuff_t;
27
28 gg_tvbuff_t * gg_tvbuff_new(const char *buffer, size_t length);
29 int gg_tvbuff_close(gg_tvbuff_t *tvb);
30
31 int gg_tvbuff_is_valid(const gg_tvbuff_t *tvb);
32
33 size_t gg_tvbuff_get_remaining(const gg_tvbuff_t *tvb);
34
35 int gg_tvbuff_have_remaining(gg_tvbuff_t *tvb, size_t length);
36
37 void gg_tvbuff_skip(gg_tvbuff_t *tvb, size_t amount);
38 void gg_tvbuff_rewind(gg_tvbuff_t *tvb, size_t amount);
39
40 int gg_tvbuff_match(gg_tvbuff_t *tvb, uint8_t value);
41
42 uint8_t gg_tvbuff_read_uint8(gg_tvbuff_t *tvb);
43 uint32_t gg_tvbuff_read_uint32(gg_tvbuff_t *tvb);
44 uint64_t gg_tvbuff_read_uint64(gg_tvbuff_t *tvb);
45
46 uint64_t gg_tvbuff_read_packed_uint(gg_tvbuff_t *tvb);
47
48 const char * gg_tvbuff_read_buff(gg_tvbuff_t *tvb, size_t length);
49 void gg_tvbuff_read_buff_cpy(gg_tvbuff_t *tvb, char *buffer, size_t length);
50 const char * gg_tvbuff_read_str(gg_tvbuff_t *tvb, size_t *length);
51 void gg_tvbuff_read_str_dup(gg_tvbuff_t *tvb, char **dst);
52
53 uin_t gg_tvbuff_read_uin(gg_tvbuff_t *tvb);
54
55 void gg_tvbuff_expected_uint8(gg_tvbuff_t *tvb, uint8_t value);
56 void gg_tvbuff_expected_uint32(gg_tvbuff_t *tvb, uint32_t value);
57 void gg_tvbuff_expected_eob(const gg_tvbuff_t *tvb);
58
59 #endif /* LIBGADU_TVBUFF_H */

mercurial