rt_Msrp.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with DOUBANGO.
  17. */
  18. #pragma once
  19. #include "rt_Enums.h"
  20. class MsrpCallback;
  21. class MsrpMessage;
  22. class MsrpEvent;
  23. namespace doubango_rt
  24. {
  25. namespace BackEnd
  26. {
  27. ref class rtMsrpSession;
  28. public ref class rtMsrpByteRange sealed
  29. {
  30. internal:
  31. rtMsrpByteRange(int64 start, int64 end, int64 total):_start(start),_end(end),_total(total) {}
  32. public:
  33. property int64 Start { int64 get() {
  34. return _start;
  35. };
  36. }
  37. property int64 End { int64 get() {
  38. return _end;
  39. };
  40. }
  41. property int64 Total { int64 get() {
  42. return _total;
  43. };
  44. }
  45. private:
  46. int64 _start, _end, _total;
  47. };
  48. public ref class rtMsrpMessage sealed
  49. {
  50. public:
  51. virtual ~rtMsrpMessage();
  52. internal:
  53. rtMsrpMessage(struct tmsrp_message_s *message);
  54. public:
  55. bool isRequest();
  56. short getCode();
  57. Platform::String^ getPhrase();
  58. rt_tmsrp_request_type_t getRequestType();
  59. #if COM_VISIBLE
  60. rtMsrpByteRange^ getByteRange();
  61. #else
  62. void getByteRange(Platform::IntPtr start, Platform::IntPtr end, Platform::IntPtr total);
  63. #endif
  64. bool isLastChunck();
  65. bool isFirstChunck();
  66. bool isSuccessReport();
  67. Platform::String^ getMsrpHeaderValue(Platform::String^ name);
  68. Platform::String^ getMsrpHeaderParamValue(Platform::String^ name, Platform::String^ param);
  69. unsigned getMsrpContentLength();
  70. #if COM_VISIBLE
  71. Platform::String^ getMsrpContent(unsigned maxsize);
  72. #else
  73. unsigned getMsrpContent(Platform::IntPtr output, unsigned maxsize);
  74. #endif
  75. private:
  76. MsrpMessage* m_pMsrpMessage;
  77. };
  78. public ref class rtMsrpEvent sealed
  79. {
  80. internal:
  81. rtMsrpEvent(const struct tmsrp_event_s *event);
  82. public:
  83. virtual ~rtMsrpEvent();
  84. rt_tmsrp_event_type_t getType();
  85. rtMsrpSession^ getSipSession();
  86. rtMsrpMessage^ getMessage();
  87. private:
  88. MsrpEvent* m_pMsrpEvent;
  89. };
  90. public interface class rtIMsrpCallback
  91. {
  92. virtual int OnEvent(rtMsrpEvent^ pEvent);
  93. };
  94. public ref class rtMsrpCallback sealed
  95. {
  96. internal:
  97. rtMsrpCallback(rtIMsrpCallback^ pI);
  98. const MsrpCallback* getWrappedCallback() {
  99. return m_pCallback;
  100. }
  101. public:
  102. virtual ~rtMsrpCallback();
  103. private:
  104. MsrpCallback* m_pCallback;
  105. rtIMsrpCallback^ m_pI;
  106. };
  107. }
  108. }