/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. * History:
  26. * ================================================================
  27. * 2010-07-25 Li XianJing <xianjimli@hotmail.com> created
  28. *
  29. */
  30. #ifndef FBUS_PARCEL_H
  31. #define FBUS_PARCEL_H
  32. #include "fbus_typedef.h"
  33. FTK_BEGIN_DECLS
  34. struct _FBusParcel;
  35. typedef struct _FBusParcel FBusParcel;
  36. FBusParcel* fbus_parcel_create(size_t capacity);
  37. size_t fbus_parcel_capacity(FBusParcel* thiz);
  38. size_t fbus_parcel_size(FBusParcel* thiz);
  39. size_t fbus_parcel_cursor(FBusParcel* thiz);
  40. void* fbus_parcel_data(FBusParcel* thiz);
  41. Ret fbus_parcel_extend(FBusParcel* thiz, size_t capacity);
  42. Ret fbus_parcel_set_size(FBusParcel* thiz, size_t size);
  43. Ret fbus_parcel_set_cursor(FBusParcel* thiz, size_t cursor);
  44. char fbus_parcel_get_char(FBusParcel* thiz);
  45. short fbus_parcel_get_short(FBusParcel* thiz);
  46. int fbus_parcel_get_int(FBusParcel* thiz);
  47. const char* fbus_parcel_get_string(FBusParcel* thiz);
  48. int fbus_parcel_get_data_size(FBusParcel* thiz);
  49. const void* fbus_parcel_get_data(FBusParcel* thiz, size_t size);
  50. Ret fbus_parcel_write_char(FBusParcel* thiz, char data);
  51. Ret fbus_parcel_write_short(FBusParcel* thiz, short data);
  52. Ret fbus_parcel_write_int(FBusParcel* thiz, int data);
  53. Ret fbus_parcel_write_string(FBusParcel* thiz, const char* data);
  54. Ret fbus_parcel_write_data(FBusParcel* thiz, const void* data, size_t len);
  55. Ret fbus_parcel_reset(FBusParcel* thiz);
  56. void fbus_parcel_destroy(FBusParcel* thiz);
  57. FTK_END_DECLS
  58. #endif/*FBUS_PARCEL_H*/