Msrp.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.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. #ifndef TINYWRAP_MSRP_H
  23. #define TINYWRAP_MSRP_H
  24. #include "tinyWRAP_config.h"
  25. #include "tinymsrp.h"
  26. class MsrpSession;
  27. class TINYWRAP_API MsrpMessage
  28. {
  29. public:
  30. MsrpMessage();
  31. #if !defined(SWIG)
  32. MsrpMessage(tmsrp_message_t *message);
  33. #endif
  34. virtual ~MsrpMessage();
  35. bool isRequest();
  36. short getCode();
  37. const char* getPhrase();
  38. tmsrp_request_type_t getRequestType();
  39. #if defined(SWIG)
  40. void getByteRange(int64_t* OUTPUT, int64_t* OUTPUT, int64_t* OUTPUT);
  41. #else
  42. void getByteRange(int64_t* start, int64_t* end, int64_t* total);
  43. #endif
  44. bool isLastChunck();
  45. bool isFirstChunck();
  46. bool isSuccessReport();
  47. char* getMsrpHeaderValue(const char* name);
  48. char* getMsrpHeaderParamValue(const char* name, const char* param);
  49. unsigned getMsrpContentLength();
  50. unsigned getMsrpContent(void* output, unsigned maxsize);
  51. #if !defined(SWIG)
  52. const tmsrp_message_t* getWrappedMsrpMessage() {
  53. return m_pMessage;
  54. }
  55. #endif
  56. private:
  57. const tmsrp_header_t* getMsrpHeader(const char* name, unsigned index = 0);
  58. private:
  59. tmsrp_message_t *m_pMessage;
  60. };
  61. class TINYWRAP_API MsrpEvent
  62. {
  63. public:
  64. #if !defined(SWIG)
  65. MsrpEvent(const tmsrp_event_t *_event);
  66. #endif
  67. virtual ~MsrpEvent();
  68. tmsrp_event_type_t getType();
  69. const MsrpSession* getSipSession();
  70. const MsrpMessage* getMessage() const;
  71. protected:
  72. const tmsrp_event_t *_event;
  73. MsrpMessage* m_pMessage;
  74. };
  75. class TINYWRAP_API MsrpCallback
  76. {
  77. public:
  78. MsrpCallback() { }
  79. virtual ~MsrpCallback() {}
  80. virtual int OnEvent(const MsrpEvent* e) {
  81. return -1;
  82. }
  83. };
  84. #if !defined(SWIG)
  85. int twrap_msrp_cb(const tmsrp_event_t* _event);
  86. #endif
  87. #endif /* TINYWRAP_MSRP_H */