tmsrp_header.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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_header.h
  23. * @brief Defines a MSRP header/line (<type>=<value>).
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. *
  27. */
  28. #ifndef TINYMSRP_HEADER_H
  29. #define TINYMSRP_HEADER_H
  30. #include "tinymsrp_config.h"
  31. #include "tsk_ragel_state.h"
  32. #include "tsk_list.h"
  33. TMSRP_BEGIN_DECLS
  34. struct tmsrp_header_s;
  35. #define TMSRP_HEADER(self) ((tmsrp_header_t*)(self))
  36. #define TMSRP_HEADER_VALUE_TOSTRING_F(self) ((tmsrp_header_value_tostring_f)(self))
  37. typedef int (*tmsrp_header_value_tostring_f)(const struct tmsrp_header_s* header, tsk_buffer_t* output);
  38. /**
  39. * @enum tmsrp_header_type_e
  40. *
  41. * @brief List of all supported headers.
  42. **/
  43. typedef enum tmsrp_header_type_e {
  44. tmsrp_htype_Authentication_Info,
  45. tmsrp_htype_Authorization,
  46. tmsrp_htype_Byte_Range,
  47. tmsrp_htype_Content_Type,
  48. tmsrp_htype_Dummy,
  49. tmsrp_htype_Expires,
  50. tmsrp_htype_Failure_Report,
  51. tmsrp_htype_From_Path,
  52. tmsrp_htype_Max_Expires,
  53. tmsrp_htype_Message_ID,
  54. tmsrp_htype_Min_Expires,
  55. tmsrp_htype_Status,
  56. tmsrp_htype_Success_Report,
  57. tmsrp_htype_To_Path,
  58. tmsrp_htype_Use_Path,
  59. tmsrp_htype_WWW_Authenticate
  60. }
  61. tmsrp_header_type_t;
  62. /*================================
  63. */
  64. typedef struct tmsrp_header_s {
  65. TSK_DECLARE_OBJECT;
  66. tmsrp_header_type_t type;
  67. tmsrp_header_value_tostring_f tostring;
  68. }
  69. tmsrp_header_t;
  70. #define TMSRP_DECLARE_HEADER tmsrp_header_t __header__
  71. typedef tsk_list_t tmsrp_headers_L_t; /**< List of @ref tmsrp_header_t elements. */
  72. /*
  73. ================================*/
  74. TINYMSRP_API const char* tmsrp_header_get_name(tmsrp_header_type_t type);
  75. TINYMSRP_API const char* tmsrp_header_get_nameex(const tmsrp_header_t *self);
  76. TINYMSRP_API int tmsrp_header_serialize(const tmsrp_header_t *self, tsk_buffer_t *output);
  77. TINYMSRP_API char* tmsrp_header_tostring(const tmsrp_header_t *self);
  78. TMSRP_END_DECLS
  79. #endif /* TINYMSRP_HEADER_H */