]> sjero.net Git - linphone/blobdiff - coreapi/TunnelManager.hh
- do not register outside of tunnel when tunnel is activated but not yet connected.
[linphone] / coreapi / TunnelManager.hh
index 20bb75d3d653787e4856bf0d938b0a7698eb2460..113f76786c5ca3fa90291dd952b2f826d3c8aa59 100644 (file)
 #ifndef __TUNNEL_CLIENT_MANAGER_H__
 #define __TUNNEL_CLIENT_MANAGER_H__
 #include <list>
-#include "linphonecore.h"
+#include <string>
 #include "tunnel/client.hh"
+#include "linphonecore.h"
+
 extern "C" {
        #include "eXosip2/eXosip_transport_hook.h"
 }
@@ -115,7 +117,7 @@ class UdpMirrorClient;
                /**
                 * Destroy the given RtpTransport.
                 */
-               void closeRtpTransport(RtpTransport *t);
+               void closeRtpTransport(RtpTransport *t, TunnelSocket *s);
 
                /**
                 * Create an RtpTransport.
@@ -126,11 +128,23 @@ class UdpMirrorClient;
                 * Get associated Linphone Core.
                 */
                LinphoneCore *getLinphoneCore();
+               virtual void setHttpProxy(const char *host,int port, const char *username, const char *passwd);
+               virtual bool isReady() const;
        private:
+               enum EventType{
+                       UdpMirrorClientEvent,
+                       TunnelEvent,
+               };
+               struct Event{
+                       EventType mType;
+                       union EventData{
+                               bool mConnected;
+                               bool mHaveUdp;
+                       }mData;
+               };
                typedef std::list<UdpMirrorClient> UdpMirrorClientList;
-               typedef std::list<RtpTransport*> RtpTransportList;
                virtual bool isStarted();
-               virtual bool isReady() const;
+               void onIterate();
                static int customSendto(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen);
                static int customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen);
                static int eXosipSendto(int fd,const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen,void* userdata);
@@ -138,9 +152,11 @@ class UdpMirrorClient;
                static int eXosipSelect(int nfds, fd_set *s1, fd_set *s2, fd_set *s3, struct timeval *tv,void* userdata);
                static void tunnelCallback(bool connected, TunnelManager *zis);
                static void sOnIterate(TunnelManager *zis);
-               static void UdpMirrorClientListener(bool result, void* data);
-
-               void processTunnelEvent();
+               static void sUdpMirrorClientCallback(bool result, void* data);
+               void waitUnRegistration();
+               void processTunnelEvent(const Event &ev);
+               void processUdpMirrorEvent(const Event &ev);
+               void postEvent(const Event &ev);
                LinphoneCore* mCore;
                LCSipTransports mRegularTransport;
                TunnelSocket *mSipSocket;
@@ -148,16 +164,22 @@ class UdpMirrorClient;
                StateCallback mCallback;
                void * mCallbackData;
                bool mEnabled;
-               bool mStateChanged;
+               std::queue<Event> mEvq;
                std::list <ServerAddr> mServerAddrs;
                UdpMirrorClientList mUdpMirrorClients;
                UdpMirrorClientList::iterator mCurrentUdpMirrorClient;
                TunnelClient* mTunnelClient;
                void stopClient();
+               Mutex mMutex;
                static Mutex sMutex;
                bool mAutoDetectStarted;
-               RtpTransportList mTransports;
+               bool mReady;
                LinphoneRtpTransportFactories mTransportFactories;
+               std::string mHttpUserName;
+               std::string mHttpPasswd;
+               std::string mHttpProxyHost;
+               int mHttpProxyPort;
+               LinphoneFirewallPolicy mPreviousFirewallPolicy;
        };
 
 /**