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