SipEvent.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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_SIPEVENT_H
  23. #define TINYWRAP_SIPEVENT_H
  24. #include "tinyWRAP_config.h"
  25. #include "tinysip.h"
  26. #include "Common.h"
  27. class SipStack;
  28. class SipSession;
  29. class InviteSession;
  30. class CallSession;
  31. class MsrpSession;
  32. class MessagingSession;
  33. class InfoSession;
  34. class OptionsSession;
  35. class PublicationSession;
  36. class RegistrationSession;
  37. class SubscriptionSession;
  38. class SipMessage;
  39. /* ======================== SipEvent ========================*/
  40. class TINYWRAP_API SipEvent
  41. {
  42. public:
  43. #if !defined(SWIG)
  44. SipEvent(const tsip_event_t *sipevent);
  45. #endif
  46. virtual ~SipEvent();
  47. public:
  48. short getCode() const;
  49. const char* getPhrase() const;
  50. const SipSession* getBaseSession() const;
  51. const SipMessage* getSipMessage() const;
  52. #if !defined(SWIG)
  53. const tsip_event_t * getWrappedEvent() {
  54. return sipevent;
  55. }
  56. #endif
  57. #if !defined(SWIG)
  58. SipStack* getStack()const;
  59. #endif
  60. protected:
  61. const tsip_event_t *sipevent;
  62. SipMessage* sipmessage;
  63. };
  64. /* ======================== DialogEvent ========================*/
  65. class TINYWRAP_API DialogEvent: public SipEvent
  66. {
  67. public:
  68. #if !defined(SWIG)
  69. DialogEvent(const tsip_event_t *sipevent);
  70. #endif
  71. virtual ~DialogEvent();
  72. public: /* Public API functions */
  73. };
  74. /* ======================== StackEvent ========================*/
  75. class TINYWRAP_API StackEvent: public SipEvent
  76. {
  77. public:
  78. #if !defined(SWIG)
  79. StackEvent(const tsip_event_t *sipevent);
  80. #endif
  81. virtual ~StackEvent();
  82. public: /* Public API functions */
  83. };
  84. /* ======================== InviteEvent ========================*/
  85. class TINYWRAP_API InviteEvent: public SipEvent
  86. {
  87. public:
  88. #if !defined(SWIG)
  89. InviteEvent(const tsip_event_t *sipevent);
  90. #endif
  91. virtual ~InviteEvent();
  92. public: /* Public API functions */
  93. tsip_invite_event_type_t getType() const;
  94. twrap_media_type_t getMediaType() const;
  95. const InviteSession* getSession() const;
  96. CallSession* takeCallSessionOwnership() const;
  97. MsrpSession* takeMsrpSessionOwnership() const;
  98. };
  99. /* ======================== MessagingEvent ========================*/
  100. class TINYWRAP_API MessagingEvent: public SipEvent
  101. {
  102. public:
  103. #if !defined(SWIG)
  104. MessagingEvent(const tsip_event_t *sipevent);
  105. #endif
  106. virtual ~MessagingEvent();
  107. public: /* Public API functions */
  108. tsip_message_event_type_t getType() const;
  109. const MessagingSession* getSession() const;
  110. MessagingSession* takeSessionOwnership() const;
  111. };
  112. /* ======================== InfoEvent ========================*/
  113. class TINYWRAP_API InfoEvent: public SipEvent
  114. {
  115. public:
  116. #if !defined(SWIG)
  117. InfoEvent(const tsip_event_t *sipevent);
  118. #endif
  119. virtual ~InfoEvent();
  120. public: /* Public API functions */
  121. tsip_info_event_type_t getType() const;
  122. const InfoSession* getSession() const;
  123. InfoSession* takeSessionOwnership() const;
  124. };
  125. /* ======================== OptionsEvent ========================*/
  126. class TINYWRAP_API OptionsEvent: public SipEvent
  127. {
  128. public:
  129. #if !defined(SWIG)
  130. OptionsEvent(const tsip_event_t *sipevent);
  131. #endif
  132. virtual ~OptionsEvent();
  133. public: /* Public API functions */
  134. tsip_options_event_type_t getType() const;
  135. const OptionsSession* getSession() const;
  136. OptionsSession* takeSessionOwnership() const;
  137. };
  138. /* ======================== PublicationEvent ========================*/
  139. class TINYWRAP_API PublicationEvent: public SipEvent
  140. {
  141. public:
  142. #if !defined(SWIG)
  143. PublicationEvent(const tsip_event_t *sipevent);
  144. #endif
  145. virtual ~PublicationEvent();
  146. public: /* Public API functions */
  147. tsip_publish_event_type_t getType() const;
  148. const PublicationSession* getSession() const;
  149. PublicationSession* takeSessionOwnership() const;
  150. };
  151. /* ======================== RegistrationEvent ========================*/
  152. class TINYWRAP_API RegistrationEvent: public SipEvent
  153. {
  154. public:
  155. #if !defined(SWIG)
  156. RegistrationEvent(const tsip_event_t *sipevent);
  157. #endif
  158. virtual ~RegistrationEvent();
  159. public: /* Public API functions */
  160. tsip_register_event_type_t getType() const;
  161. const RegistrationSession* getSession() const;
  162. RegistrationSession* takeSessionOwnership() const;
  163. };
  164. /* ======================== SubscriptionEvent ========================*/
  165. class TINYWRAP_API SubscriptionEvent: public SipEvent
  166. {
  167. public:
  168. #if !defined(SWIG)
  169. SubscriptionEvent(const tsip_event_t *sipevent);
  170. #endif
  171. virtual ~SubscriptionEvent();
  172. public: /* Public API functions */
  173. tsip_subscribe_event_type_t getType() const;
  174. const SubscriptionSession* getSession() const;
  175. SubscriptionSession* takeSessionOwnership() const;
  176. };
  177. #endif /* TINYWRAP_SIPEVENT_H */