#define __TUNNEL_CLIENT_MANAGER_H__
#include <list>
#include <string>
-#include "linphonecore.h"
#include "tunnel/client.hh"
+#include "linphonecore.h"
+
extern "C" {
#include "eXosip2/eXosip_transport_hook.h"
}
* 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;
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);
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;
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;
+ bool mReady;
LinphoneRtpTransportFactories mTransportFactories;
std::string mHttpUserName;
- std::string mHttpPasswd;
+ std::string mHttpPasswd;
+ std::string mHttpProxyHost;
+ int mHttpProxyPort;
+ LinphoneFirewallPolicy mPreviousFirewallPolicy;
};
/**