diff options
author | Matthew Fredrickson <creslin@digium.com> | 2006-09-19 19:04:13 +0000 |
---|---|---|
committer | Matthew Fredrickson <creslin@digium.com> | 2006-09-19 19:04:13 +0000 |
commit | 1dfc281c40b987cf672b095a3b5ea04fcd342218 (patch) | |
tree | 75ea77c6fe1fbe2d4177be8c07a21213364d6d2e /channels/h323/compat_h323.h | |
parent | 44821e39f8389a9b6188f5244894945c96ba2164 (diff) |
Work!!!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/h323/compat_h323.h')
-rw-r--r-- | channels/h323/compat_h323.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/channels/h323/compat_h323.h b/channels/h323/compat_h323.h new file mode 100644 index 000000000..2ea640c4a --- /dev/null +++ b/channels/h323/compat_h323.h @@ -0,0 +1,78 @@ +#ifndef COMPAT_H323_H +#define COMPAT_H323_H + +#if VERSION(OPENH323_MAJOR,OPENH323_MINOR,OPENH323_BUILD) < VERSION(1,17,3) +/** + * Workaround for broken (less than 1.17.3) OpenH323 stack to be able to + * make TCP connections from specific address + */ +class MyH323TransportTCP : public H323TransportTCP +{ + PCLASSINFO(MyH323TransportTCP, H323TransportTCP); + +public: + MyH323TransportTCP( + H323EndPoint & endpoint, ///< H323 End Point object + PIPSocket::Address binding = PIPSocket::GetDefaultIpAny(), ///< Local interface to use + BOOL listen = FALSE ///< Flag for need to wait for remote to connect + ); + /**Connect to the remote party. + */ + virtual BOOL Connect(); +}; +#else +#define MyH323TransportTCP H323TransportTCP +#endif /* <VERSION(1,17,3) */ + +class MyH323TransportUDP: public H323TransportUDP +{ + PCLASSINFO(MyH323TransportUDP, H323TransportUDP); + +public: + MyH323TransportUDP(H323EndPoint &endpoint, + PIPSocket::Address binding = PIPSocket::GetDefaultIpAny(), + WORD localPort = 0, + WORD remotePort = 0): H323TransportUDP(endpoint, binding, localPort, remotePort) + { + } + virtual BOOL DiscoverGatekeeper(H323Gatekeeper &, + H323RasPDU &, + const H323TransportAddress &); +protected: + PDECLARE_NOTIFIER(PThread, MyH323TransportUDP, DiscoverMain); + H323Gatekeeper *discoverGatekeeper; + H323RasPDU *discoverPDU; + const H323TransportAddress *discoverAddress; + BOOL discoverResult; + BOOL discoverReady; + PMutex discoverMutex; +}; + +template <class _Abstract_T, typename _Key_T = PString> +class MyPFactory: public PFactory<_Abstract_T, _Key_T> +{ +public: + template <class _Contrete_T> class Worker: public PFactory<_Abstract_T, _Key_T>::WorkerBase + { + public: + Worker(const _Key_T &_key, bool singleton = false) + :PFactory<_Abstract_T, _Key_T>::WorkerBase(singleton), key(_key) + { + PFactory<_Abstract_T, _Key_T>::Register(key, this); + } + ~Worker() + { + PFactory<_Abstract_T, _Key_T>::Unregister(key); + } + + private: + PString key; + }; +}; + +#ifdef H323_REGISTER_CAPABILITY +#undef H323_REGISTER_CAPABILITY +#endif +#define H323_REGISTER_CAPABILITY(cls, capName) static MyPFactory<H323Capability>::Worker<cls> cls##Factory(capName, true) + +#endif /* !defined AST_H323_H */ |