tmsrp_data.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tmsrp_data.h
  23. * @brief MSRP input/output data.
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. *
  27. */
  28. #ifndef TINYMSRP_DATA_H
  29. #define TINYMSRP_DATA_H
  30. #include "tinymsrp_config.h"
  31. #include "tinymsrp/tmsrp_message.h"
  32. #include "tsk_buffer.h"
  33. TMSRP_BEGIN_DECLS
  34. #define TMSRP_DATA(self) ((tmsrp_data_t*)(self))
  35. #define TMSRP_DATA_IS_OUTGOING(self) (TMSRP_DATA(self)->outgoing)
  36. typedef struct tmsrp_data_s {
  37. TSK_DECLARE_OBJECT;
  38. tsk_bool_t outgoing;
  39. tsk_bool_t isOK;
  40. char* id;
  41. char* ctype;
  42. char* wctype;
  43. }
  44. tmsrp_data_t;
  45. #define TMSRP_DECLARE_DATA tmsrp_data_t data
  46. typedef tsk_list_t tmsrp_datas_L_t;
  47. typedef struct tmsrp_data_in_s {
  48. TMSRP_DECLARE_DATA;
  49. tsk_buffer_t* buffer;
  50. }
  51. tmsrp_data_in_t;
  52. int tmsrp_data_in_put(tmsrp_data_in_t* self, const void* pdata, tsk_size_t size);
  53. tmsrp_message_t* tmsrp_data_in_get(tmsrp_data_in_t* self);
  54. typedef struct tmsrp_data_out_s {
  55. TMSRP_DECLARE_DATA;
  56. FILE* file;
  57. tsk_buffer_t* message;
  58. tsk_size_t size; // File/message size
  59. }
  60. tmsrp_data_out_t;
  61. tmsrp_data_in_t* tmsrp_data_in_create();
  62. tmsrp_data_out_t* tmsrp_data_out_create(const void* pdata, tsk_size_t size);
  63. tmsrp_data_out_t* tmsrp_data_out_file_create(const char* filepath);
  64. tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self);
  65. TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_data_in_def_t;
  66. TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_data_out_def_t;
  67. TMSRP_END_DECLS
  68. #endif /* TINYMSRP_DATA_H */