PageRenderTime 40ms CodeModel.GetById 32ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/fbus/fbus_parcel.h

http://ftk.googlecode.com/
C++ Header | 71 lines | 29 code | 13 blank | 29 comment | 0 complexity | a4b33e1c0e4ee26c65fe765d42308385 MD5 | raw file
 1/*
 2 * File: fbus_parcel.h
 3 * Author:  Li XianJing <xianjimli@hotmail.com>
 4 * Brief:   a buffer used to pack RPC parameters.
 5 *
 6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
 7 *
 8 * Licensed under the Academic Free License version 2.1
 9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25/*
26 * History:
27 * ================================================================
28 * 2010-07-25 Li XianJing <xianjimli@hotmail.com> created
29 *
30 */
31
32#ifndef FBUS_PARCEL_H
33#define FBUS_PARCEL_H
34
35#include "fbus_typedef.h"
36
37FTK_BEGIN_DECLS
38
39struct _FBusParcel;
40typedef struct _FBusParcel FBusParcel;
41
42FBusParcel* fbus_parcel_create(size_t capacity);
43
44size_t fbus_parcel_capacity(FBusParcel* thiz);
45size_t fbus_parcel_size(FBusParcel* thiz);
46size_t fbus_parcel_cursor(FBusParcel* thiz);
47void*  fbus_parcel_data(FBusParcel* thiz);
48Ret    fbus_parcel_extend(FBusParcel* thiz, size_t capacity);
49Ret    fbus_parcel_set_size(FBusParcel* thiz, size_t size);
50Ret    fbus_parcel_set_cursor(FBusParcel* thiz, size_t cursor);
51
52char  fbus_parcel_get_char(FBusParcel* thiz);
53short fbus_parcel_get_short(FBusParcel* thiz);
54int   fbus_parcel_get_int(FBusParcel* thiz);
55const char* fbus_parcel_get_string(FBusParcel* thiz);
56int   fbus_parcel_get_data_size(FBusParcel* thiz);
57const void* fbus_parcel_get_data(FBusParcel* thiz, size_t size);
58
59Ret fbus_parcel_write_char(FBusParcel* thiz, char data);
60Ret fbus_parcel_write_short(FBusParcel* thiz, short data);
61Ret fbus_parcel_write_int(FBusParcel* thiz, int data);
62Ret fbus_parcel_write_string(FBusParcel* thiz, const char* data);
63Ret fbus_parcel_write_data(FBusParcel* thiz, const void* data, size_t len);
64Ret fbus_parcel_reset(FBusParcel* thiz);
65
66void fbus_parcel_destroy(FBusParcel* thiz);
67
68FTK_END_DECLS
69
70#endif/*FBUS_PARCEL_H*/
71