X-Git-Url: http://sjero.net/git/?p=linphone;a=blobdiff_plain;f=coreapi%2FTunnelManager.hh;h=113f76786c5ca3fa90291dd952b2f826d3c8aa59;hp=b6bc46723a884b35e22f9b8ef727df4234211cd0;hb=5f0d5793b7e65a518076de6f8e253770503f8824;hpb=22cdda2a444e48c49ddf1d5f64810403e13f4aec diff --git a/coreapi/TunnelManager.hh b/coreapi/TunnelManager.hh index b6bc4672..113f7678 100644 --- a/coreapi/TunnelManager.hh +++ b/coreapi/TunnelManager.hh @@ -11,8 +11,10 @@ #ifndef __TUNNEL_CLIENT_MANAGER_H__ #define __TUNNEL_CLIENT_MANAGER_H__ #include -#include "linphonecore.h" +#include #include "tunnel/client.hh" +#include "linphonecore.h" + extern "C" { #include "eXosip2/eXosip_transport_hook.h" } @@ -126,10 +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 UdpMirrorClientList; 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); @@ -137,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; @@ -147,15 +164,22 @@ class UdpMirrorClient; StateCallback mCallback; void * mCallbackData; bool mEnabled; - bool mStateChanged; + std::queue mEvq; std::list mServerAddrs; UdpMirrorClientList mUdpMirrorClients; UdpMirrorClientList::iterator mCurrentUdpMirrorClient; TunnelClient* mTunnelClient; void stopClient(); + Mutex mMutex; static Mutex sMutex; bool mAutoDetectStarted; + bool mReady; LinphoneRtpTransportFactories mTransportFactories; + std::string mHttpUserName; + std::string mHttpPasswd; + std::string mHttpProxyHost; + int mHttpProxyPort; + LinphoneFirewallPolicy mPreviousFirewallPolicy; }; /**