123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- /*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
- *
- * This file is part of Open Source Doubango Framework.
- *
- * DOUBANGO is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * DOUBANGO is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with DOUBANGO.
- */
- #pragma once
- #include "rt_Config.h"
- #include "rt_Enums.h"
- struct tsip_event_s;
- class SipEvent;
- class DialogEvent;
- class StackEvent;
- class InviteEvent;
- class MessagingEvent;
- class InfoEvent;
- class OptionsEvent;
- class PublicationEvent;
- class RegistrationEvent;
- class SubscriptionEvent;
- #define rtISipEvent_Declare() \
- virtual short getCode(); \
- virtual Platform::String^ getPhrase(); \
- virtual rtISipSession^ getBaseSession(); \
- virtual rtSipMessage^ getSipMessage(); \
-
- #define rtISipEvent_Implement(cls) \
- short cls##::getCode(){ \
- return m_pEvent->getCode(); \
- } \
- Platform::String^ cls##::getPhrase(){ \
- return rtString::toString(m_pEvent->getPhrase()); \
- } \
- rtISipSession^ cls##::getBaseSession(){ \
- return ref new rtSipSession(const_cast<SipStack*>(m_pEvent->getStack()), const_cast<tsip_ssession_handle_t*>(m_pEvent->getWrappedEvent()->ss)); \
- } \
- rtSipMessage^ cls##::getSipMessage(){ \
- return ref new rtSipMessage(const_cast<struct tsip_message_s*>(const_cast<SipMessage*>(m_pEvent->getSipMessage())->getWrappedSipMessage())); \
- } \
-
- namespace doubango_rt
- {
- namespace BackEnd
- {
- interface class rtISipSession;
- ref class rtSipMessage;
- ref class rtInviteSession;
- ref class rtMsrpSession;
- ref class rtCallSession;
- ref class rtMessagingSession;
- ref class rtInfoSession;
- ref class rtOptionsSession;
- ref class rtPublicationSession;
- ref class rtRegistrationSession;
- ref class rtSubscriptionSession;
- /* ======================== rtISipEvent ========================*/
- public interface class rtISipEvent
- {
- short getCode();
- Platform::String^ getPhrase();
- rtISipSession^ getBaseSession();
- rtSipMessage^ getSipMessage();
- };
- /* ======================== rtDialogEvent ========================*/
- public ref class rtDialogEvent sealed : rtISipEvent
- {
- internal:
- rtDialogEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtDialogEvent();
- rtISipEvent_Declare();
- private:
- DialogEvent* m_pEvent;
- };
- /* ======================== rtStackEvent ========================*/
- public ref class rtStackEvent sealed : rtISipEvent
- {
- internal:
- rtStackEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtStackEvent();
- rtISipEvent_Declare();
- private:
- StackEvent* m_pEvent;
- };
- /* ======================== rtInviteEvent ========================*/
- public ref class rtInviteEvent sealed : rtISipEvent
- {
- internal:
- rtInviteEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtInviteEvent();
- rtISipEvent_Declare();
- rt_tsip_invite_event_type_t getType();
- rt_twrap_media_type_t getMediaType();
- rtInviteSession^ getSession();
- rtCallSession^ takeCallSessionOwnership();
- rtMsrpSession^ takeMsrpSessionOwnership();
- private:
- InviteEvent* m_pEvent;
- };
- /* ======================== rtMessagingEvent ========================*/
- public ref class rtMessagingEvent sealed : rtISipEvent
- {
- internal:
- rtMessagingEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtMessagingEvent();
- rtISipEvent_Declare();
- rt_tsip_message_event_type_t getType();
- rtMessagingSession^ getSession();
- rtMessagingSession^ takeSessionOwnership();
- private:
- MessagingEvent* m_pEvent;
- };
- /* ======================== rtInfoEvent ========================*/
- public ref class rtInfoEvent sealed : rtISipEvent
- {
- internal:
- rtInfoEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtInfoEvent();
- rtISipEvent_Declare();
- rt_tsip_info_event_type_t getType();
- rtInfoSession^ getSession();
- rtInfoSession^ takeSessionOwnership();
- private:
- InfoEvent* m_pEvent;
- };
- /* ======================== rtOptionsEvent ========================*/
- public ref class rtOptionsEvent sealed : rtISipEvent
- {
- internal:
- rtOptionsEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtOptionsEvent();
- rtISipEvent_Declare();
- rt_tsip_options_event_type_t getType();
- rtOptionsSession^ getSession();
- rtOptionsSession^ takeSessionOwnership();
- private:
- OptionsEvent* m_pEvent;
- };
- /* ======================== rtPublicationEvent ========================*/
- public ref class rtPublicationEvent sealed : rtISipEvent
- {
- internal:
- rtPublicationEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtPublicationEvent();
- rtISipEvent_Declare();
- rt_tsip_publish_event_type_t getType();
- rtPublicationSession^ getSession();
- rtPublicationSession^ takeSessionOwnership();
- private:
- PublicationEvent* m_pEvent;
- };
- /* ======================== rtRegistrationEvent ========================*/
- public ref class rtRegistrationEvent sealed : rtISipEvent
- {
- internal:
- rtRegistrationEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtRegistrationEvent();
- rtISipEvent_Declare();
- rt_tsip_register_event_type_t getType();
- rtRegistrationSession^ getSession();
- rtRegistrationSession^ takeSessionOwnership();
- private:
- RegistrationEvent* m_pEvent;
- };
- /* ======================== rtSubscriptionEvent ========================*/
- public ref class rtSubscriptionEvent sealed : rtISipEvent
- {
- internal:
- rtSubscriptionEvent(const struct tsip_event_s *e);
- public:
- virtual ~rtSubscriptionEvent();
- rtISipEvent_Declare();
- rt_tsip_subscribe_event_type_t getType();
- rtSubscriptionSession^ getSession();
- rtSubscriptionSession^ takeSessionOwnership();
- private:
- SubscriptionEvent* m_pEvent;
- };
- }
- }
|