- Update RTCWeb profile to all interoperability with chrome stable "23.0.1271.64 m" and later
- Begin adding support for multiple transports - Begin adding support for p2p, mcu and mediaproxy modes - Fix issue gathering issue on Windows 7 and later (tied to webrtc4all issue #1)
This commit is contained in:
parent
0236c22d0a
commit
e18af84cd2
|
@ -98,7 +98,12 @@ int twrap_consumer_proxy_audio_consume(tmedia_consumer_t* self, const void* buff
|
|||
if((manager = ProxyPluginMgr::getInstance())){
|
||||
const ProxyAudioConsumer* audioConsumer;
|
||||
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
|
||||
ret = tdav_consumer_audio_put(TDAV_CONSUMER_AUDIO(self), buffer, size, proto_hdr);
|
||||
if(audioConsumer->getCallback()->putInJitterBuffer()){
|
||||
ret = tdav_consumer_audio_put(TDAV_CONSUMER_AUDIO(self), buffer, size, proto_hdr);
|
||||
}
|
||||
else{
|
||||
ret = audioConsumer->getCallback()->consume(buffer, size, proto_hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +455,7 @@ int twrap_consumer_proxy_video_consume(tmedia_consumer_t* self, const void* buff
|
|||
ret = videoConsumer->getCallback()->bufferCopied(nCopiedSize, size);
|
||||
}
|
||||
else{
|
||||
ProxyVideoFrame* frame = new ProxyVideoFrame(buffer, size);
|
||||
ProxyVideoFrame* frame = new ProxyVideoFrame(buffer, size, const_cast<ProxyVideoConsumer*>(videoConsumer)->getDecodedWidth(), const_cast<ProxyVideoConsumer*>(videoConsumer)->getDecodedHeight());
|
||||
ret = videoConsumer->getCallback()->consume(frame);
|
||||
delete frame, frame = tsk_null;
|
||||
}
|
||||
|
@ -740,10 +745,12 @@ bool ProxyVideoConsumer::registerPlugin()
|
|||
|
||||
|
||||
|
||||
ProxyVideoFrame::ProxyVideoFrame(const void* pBuffer, unsigned nSize)
|
||||
ProxyVideoFrame::ProxyVideoFrame(const void* pBufferPtr, unsigned nSize, unsigned nFrameWidth, unsigned nFrameHeight)
|
||||
{
|
||||
m_pBuffer = pBuffer;
|
||||
m_nSize = nSize;
|
||||
m_pBufferPtr = pBufferPtr;
|
||||
m_nBufferSize = nSize;
|
||||
m_nFrameWidth = nFrameWidth;
|
||||
m_nFrameHeight = nFrameHeight;
|
||||
}
|
||||
|
||||
ProxyVideoFrame::~ProxyVideoFrame()
|
||||
|
@ -752,15 +759,15 @@ ProxyVideoFrame::~ProxyVideoFrame()
|
|||
|
||||
unsigned ProxyVideoFrame::getSize()
|
||||
{
|
||||
return m_nSize;
|
||||
return m_nBufferSize;
|
||||
}
|
||||
|
||||
unsigned ProxyVideoFrame::getContent(void* pOutput, unsigned nMaxsize)
|
||||
{
|
||||
unsigned nRetsize = 0;
|
||||
if(pOutput && nMaxsize && m_pBuffer){
|
||||
nRetsize = (m_nSize > nMaxsize) ? nMaxsize : m_nSize;
|
||||
memcpy(pOutput, m_pBuffer, nRetsize);
|
||||
if(pOutput && nMaxsize && m_pBufferPtr){
|
||||
nRetsize = (m_nBufferSize > nMaxsize) ? nMaxsize : m_nBufferSize;
|
||||
memcpy(pOutput, m_pBufferPtr, nRetsize);
|
||||
}
|
||||
return nRetsize;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,12 @@ public:
|
|||
virtual int start() { return -1; }
|
||||
virtual int pause() { return -1; }
|
||||
virtual int stop() { return -1; }
|
||||
#if !defined(SWIG)
|
||||
// whether the audio buffer have to be stored in the JB then pulled using "ProxyAudioConsumer::pull()" or not
|
||||
virtual bool putInJitterBuffer(){ return true; }
|
||||
// only called if "putInJitterBuffer()" return "true"
|
||||
virtual int consume(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr){ return -1; }
|
||||
#endif
|
||||
};
|
||||
|
||||
/* ============ ProxyAudioConsumer Class ================= */
|
||||
|
@ -176,23 +182,25 @@ class ProxyVideoFrame
|
|||
{
|
||||
public:
|
||||
#if !defined(SWIG)
|
||||
ProxyVideoFrame(const void* pBuffer, unsigned nSize);
|
||||
ProxyVideoFrame(const void* pBufferPtr, unsigned nBufferSize, unsigned nFrameWidth, unsigned nFrameHeight);
|
||||
#endif
|
||||
virtual ~ProxyVideoFrame();
|
||||
|
||||
public: /* For Java/C# applications */
|
||||
unsigned getSize();
|
||||
unsigned getContent(void* pOutput, unsigned nMaxsize);
|
||||
inline unsigned getFrameWidth()const{ return m_nFrameWidth; }
|
||||
inline unsigned getFrameHeight()const{ return m_nFrameHeight; }
|
||||
|
||||
#if !defined(SWIG) /* For C/C++ applications */
|
||||
public:
|
||||
inline unsigned fastGetSize()const{ return m_nSize; }
|
||||
inline const void* fastGetContent()const{ return m_pBuffer; }
|
||||
inline unsigned getBufferSize()const{ return m_nBufferSize; }
|
||||
inline const void* getBufferPtr()const{ return m_pBufferPtr; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
const void* m_pBuffer;
|
||||
unsigned m_nSize;
|
||||
const void* m_pBufferPtr;
|
||||
unsigned m_nBufferSize, m_nFrameWidth, m_nFrameHeight;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -127,9 +127,9 @@ public:
|
|||
bool setRotation(int nRot);
|
||||
bool setActualCameraOutputSize(unsigned nWidth, unsigned nHeight);
|
||||
int push(const void* pBuffer, unsigned nSize);
|
||||
int send(const void* pBuffer, unsigned nSize, unsigned nDuration, bool bMarker);
|
||||
void setCallback(ProxyVideoProducerCallback* pCallback) { m_pCallback = pCallback; }
|
||||
#if !defined(SWIG)
|
||||
int send(const void* pBuffer, unsigned nSize, unsigned nDuration, bool bMarker);
|
||||
inline ProxyVideoProducerCallback* getCallback()const { return m_pCallback; }
|
||||
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin){
|
||||
return m_pWrappedPlugin == wrapped_plugin;
|
||||
|
|
|
@ -127,6 +127,11 @@ short SipMessage::getResponseCode()
|
|||
return TSIP_RESPONSE_CODE(m_pSipMessage);
|
||||
}
|
||||
|
||||
const char* SipMessage::getResponsePhrase()
|
||||
{
|
||||
return TSIP_RESPONSE_PHRASE(m_pSipMessage);
|
||||
}
|
||||
|
||||
const tsip_header_t* SipMessage::getSipHeader(const char* name, unsigned index /* =0 */)
|
||||
{
|
||||
/* Do not worry about calling tsk_striequals() several times because the function
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
bool isResponse();
|
||||
tsip_request_type_t getRequestType();
|
||||
short getResponseCode();
|
||||
const char* getResponsePhrase();
|
||||
char* getSipHeaderValue(const char* name, unsigned index = 0);
|
||||
char* getSipHeaderParamValue(const char* name, const char* param, unsigned index = 0);
|
||||
unsigned getSipContentLength();
|
||||
|
|
|
@ -239,7 +239,10 @@ bool InviteSession::hangup(ActionConfig* config/*=tsk_null*/)
|
|||
#else
|
||||
bool InviteSession::hangup(ActionConfig* config/*=tsk_null*/)
|
||||
{
|
||||
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
|
||||
|
||||
return (tsip_api_invite_send_bye(m_pHandle,
|
||||
TSIP_ACTION_SET_CONFIG(action_cfg),
|
||||
TSIP_ACTION_SET_NULL()) == 0);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -151,7 +151,7 @@ public: /* Public functions */
|
|||
|
||||
bool call(const char* remoteUriString, twrap_media_type_t media, ActionConfig* config=tsk_null);
|
||||
bool call(const SipUri* remoteUri, twrap_media_type_t media, ActionConfig* config=tsk_null);
|
||||
|
||||
|
||||
bool setSessionTimer(unsigned timeout, const char* refresher);
|
||||
bool set100rel(bool enabled);
|
||||
bool setRtcp(bool enabled);
|
||||
|
|
|
@ -35,15 +35,6 @@ bool SipStack::g_bInitialized = false;
|
|||
static int stack_callback(const tsip_event_t *sipevent);
|
||||
static int session_handle_event(const tsip_event_t *sipevent);
|
||||
|
||||
/* === default values === */
|
||||
#ifndef DEFAULT_LOCAL_IP
|
||||
//# ifdef ANDROID /* On the emulator */
|
||||
//# define DEFAULT_LOCAL_IP "10.0.2.15"
|
||||
//# else
|
||||
# define DEFAULT_LOCAL_IP TNET_SOCKET_HOST_ANY
|
||||
//# endif
|
||||
#endif
|
||||
|
||||
SipStack::SipStack(SipCallback* pCallback, const char* realm_uri, const char* impi_uri, const char* impu_uri)
|
||||
:SafeObject()
|
||||
{
|
||||
|
@ -57,7 +48,6 @@ SipStack::SipStack(SipCallback* pCallback, const char* realm_uri, const char* im
|
|||
|
||||
/* Creates stack handle */
|
||||
m_pHandle = tsip_stack_create(stack_callback, realm_uri, impi_uri, impu_uri,
|
||||
TSIP_STACK_SET_LOCAL_IP(DEFAULT_LOCAL_IP),
|
||||
TSIP_STACK_SET_USERDATA(this), /* used as context (useful for server-initiated requests) */
|
||||
TSIP_STACK_SET_NULL());
|
||||
}
|
||||
|
@ -207,10 +197,10 @@ bool SipStack::setAoR(const char* ip, int port)
|
|||
TSIP_STACK_SET_NULL()) == 0);
|
||||
}
|
||||
|
||||
bool SipStack::setModeServer()
|
||||
bool SipStack::setMode(enum tsip_stack_mode_e mode)
|
||||
{
|
||||
return (tsip_stack_set(m_pHandle,
|
||||
TSIP_STACK_SET_MODE_SERVER(),
|
||||
TSIP_STACK_SET_MODE(mode),
|
||||
TSIP_STACK_SET_NULL()) == 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public: /* API functions */
|
|||
bool setDnsDiscovery(bool enabled);
|
||||
bool setAoR(const char* ip, int port);
|
||||
#if !defined(SWIG)
|
||||
bool setModeServer();
|
||||
bool setMode(enum tsip_stack_mode_e mode);
|
||||
#endif
|
||||
|
||||
bool setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict);
|
||||
|
|
|
@ -45,6 +45,15 @@
|
|||
%clearnodefaultctor;
|
||||
|
||||
|
||||
/* ====== From "tinySIP\include\tsip.h" ====== */
|
||||
typedef enum tsip_stack_mode_e
|
||||
{
|
||||
tsip_stack_mode_ua,
|
||||
tsip_stack_mode_p2p,
|
||||
tsip_stack_mode_mediaproxy,
|
||||
tsip_stack_mode_mcu
|
||||
}
|
||||
tsip_stack_mode_t;
|
||||
|
||||
/* ====== From "tinySIP\include\tinysip\tsip_messag_common.h" ====== */
|
||||
typedef enum tsip_request_type_e
|
||||
|
|
|
@ -51,6 +51,16 @@ public class ProxyVideoFrame : IDisposable {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public uint getFrameWidth() {
|
||||
uint ret = tinyWRAPPINVOKE.ProxyVideoFrame_getFrameWidth(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public uint getFrameHeight() {
|
||||
uint ret = tinyWRAPPINVOKE.ProxyVideoFrame_getFrameHeight(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,11 +60,6 @@ public class ProxyVideoProducer : ProxyPlugin {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public int send(IntPtr pBuffer, uint nSize, uint nDuration, bool bMarker) {
|
||||
int ret = tinyWRAPPINVOKE.ProxyVideoProducer_send(swigCPtr, pBuffer, nSize, nDuration, bMarker);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setCallback(ProxyVideoProducerCallback pCallback) {
|
||||
tinyWRAPPINVOKE.ProxyVideoProducer_setCallback(swigCPtr, ProxyVideoProducerCallback.getCPtr(pCallback));
|
||||
}
|
||||
|
|
|
@ -72,6 +72,11 @@ public class SipMessage : IDisposable {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public string getResponsePhrase() {
|
||||
string ret = tinyWRAPPINVOKE.SipMessage_getResponsePhrase(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public string getSipHeaderValue(string name, uint index) {
|
||||
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, name, index);
|
||||
return ret;
|
||||
|
|
|
@ -537,6 +537,9 @@ class tinyWRAPPINVOKE {
|
|||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_getResponseCode")]
|
||||
public static extern short SipMessage_getResponseCode(HandleRef jarg1);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_getResponsePhrase")]
|
||||
public static extern string SipMessage_getResponsePhrase(HandleRef jarg1);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_getSipHeaderValue__SWIG_0")]
|
||||
public static extern string SipMessage_getSipHeaderValue__SWIG_0(HandleRef jarg1, string jarg2, uint jarg3);
|
||||
|
||||
|
@ -1284,6 +1287,12 @@ class tinyWRAPPINVOKE {
|
|||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoFrame_getContent")]
|
||||
public static extern uint ProxyVideoFrame_getContent(HandleRef jarg1, IntPtr jarg2, uint jarg3);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoFrame_getFrameWidth")]
|
||||
public static extern uint ProxyVideoFrame_getFrameWidth(HandleRef jarg1);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoFrame_getFrameHeight")]
|
||||
public static extern uint ProxyVideoFrame_getFrameHeight(HandleRef jarg1);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_new_ProxyAudioProducerCallback")]
|
||||
public static extern IntPtr new_ProxyAudioProducerCallback();
|
||||
|
||||
|
@ -1404,9 +1413,6 @@ class tinyWRAPPINVOKE {
|
|||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_push")]
|
||||
public static extern int ProxyVideoProducer_push(HandleRef jarg1, IntPtr jarg2, uint jarg3);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_send")]
|
||||
public static extern int ProxyVideoProducer_send(HandleRef jarg1, IntPtr jarg2, uint jarg3, uint jarg4, bool jarg5);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_ProxyVideoProducer_setCallback")]
|
||||
public static extern void ProxyVideoProducer_setCallback(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
|
|
|
@ -2608,6 +2608,18 @@ SWIGEXPORT short SWIGSTDCALL CSharp_SipMessage_getResponseCode(void * jarg1) {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT char * SWIGSTDCALL CSharp_SipMessage_getResponsePhrase(void * jarg1) {
|
||||
char * jresult ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (SipMessage *)jarg1;
|
||||
result = (char *)(arg1)->getResponsePhrase();
|
||||
jresult = SWIG_csharp_string_callback((const char *)result);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT char * SWIGSTDCALL CSharp_SipMessage_getSipHeaderValue__SWIG_0(void * jarg1, char * jarg2, unsigned int jarg3) {
|
||||
char * jresult ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
|
@ -5800,6 +5812,30 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ProxyVideoFrame_getContent(void * jar
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ProxyVideoFrame_getFrameWidth(void * jarg1) {
|
||||
unsigned int jresult ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (ProxyVideoFrame *)jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameWidth();
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ProxyVideoFrame_getFrameHeight(void * jarg1) {
|
||||
unsigned int jresult ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
arg1 = (ProxyVideoFrame *)jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameHeight();
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void * SWIGSTDCALL CSharp_new_ProxyAudioProducerCallback() {
|
||||
void * jresult ;
|
||||
ProxyAudioProducerCallback *result = 0 ;
|
||||
|
@ -6302,26 +6338,6 @@ SWIGEXPORT int SWIGSTDCALL CSharp_ProxyVideoProducer_push(void * jarg1, void * j
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_ProxyVideoProducer_send(void * jarg1, void * jarg2, unsigned int jarg3, unsigned int jarg4, unsigned int jarg5) {
|
||||
int jresult ;
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned int arg4 ;
|
||||
bool arg5 ;
|
||||
int result;
|
||||
|
||||
arg1 = (ProxyVideoProducer *)jarg1;
|
||||
arg2 = jarg2;
|
||||
arg3 = (unsigned int)jarg3;
|
||||
arg4 = (unsigned int)jarg4;
|
||||
arg5 = jarg5 ? true : false;
|
||||
result = (int)(arg1)->send((void const *)arg2,arg3,arg4,arg5);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_ProxyVideoProducer_setCallback(void * jarg1, void * jarg2) {
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
ProxyVideoProducerCallback *arg2 = (ProxyVideoProducerCallback *) 0 ;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 2.0.8
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
namespace org.doubango.tinyWRAP {
|
||||
|
||||
public enum tsip_stack_mode_t {
|
||||
tsip_stack_mode_ua,
|
||||
tsip_stack_mode_p2p,
|
||||
tsip_stack_mode_mediaproxy,
|
||||
tsip_stack_mode_mcu
|
||||
}
|
||||
|
||||
}
|
|
@ -43,4 +43,12 @@ public class ProxyVideoFrame {
|
|||
return tinyWRAPJNI.ProxyVideoFrame_getContent(swigCPtr, this, pOutput, nMaxsize);
|
||||
}
|
||||
|
||||
public long getFrameWidth() {
|
||||
return tinyWRAPJNI.ProxyVideoFrame_getFrameWidth(swigCPtr, this);
|
||||
}
|
||||
|
||||
public long getFrameHeight() {
|
||||
return tinyWRAPJNI.ProxyVideoFrame_getFrameHeight(swigCPtr, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,10 +51,6 @@ public class ProxyVideoProducer extends ProxyPlugin {
|
|||
return tinyWRAPJNI.ProxyVideoProducer_push(swigCPtr, this, pBuffer, nSize);
|
||||
}
|
||||
|
||||
public int send(java.nio.ByteBuffer pBuffer, long nSize, long nDuration, boolean bMarker) {
|
||||
return tinyWRAPJNI.ProxyVideoProducer_send(swigCPtr, this, pBuffer, nSize, nDuration, bMarker);
|
||||
}
|
||||
|
||||
public void setCallback(ProxyVideoProducerCallback pCallback) {
|
||||
tinyWRAPJNI.ProxyVideoProducer_setCallback(swigCPtr, this, ProxyVideoProducerCallback.getCPtr(pCallback), pCallback);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,10 @@ public class SipMessage {
|
|||
return tinyWRAPJNI.SipMessage_getResponseCode(swigCPtr, this);
|
||||
}
|
||||
|
||||
public String getResponsePhrase() {
|
||||
return tinyWRAPJNI.SipMessage_getResponsePhrase(swigCPtr, this);
|
||||
}
|
||||
|
||||
public String getSipHeaderValue(String name, long index) {
|
||||
return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, this, name, index);
|
||||
}
|
||||
|
|
|
@ -43,4 +43,12 @@ public class ProxyVideoFrame {
|
|||
return tinyWRAPJNI.ProxyVideoFrame_getContent(swigCPtr, this, pOutput, nMaxsize);
|
||||
}
|
||||
|
||||
public long getFrameWidth() {
|
||||
return tinyWRAPJNI.ProxyVideoFrame_getFrameWidth(swigCPtr, this);
|
||||
}
|
||||
|
||||
public long getFrameHeight() {
|
||||
return tinyWRAPJNI.ProxyVideoFrame_getFrameHeight(swigCPtr, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,10 +51,6 @@ public class ProxyVideoProducer extends ProxyPlugin {
|
|||
return tinyWRAPJNI.ProxyVideoProducer_push(swigCPtr, this, pBuffer, nSize);
|
||||
}
|
||||
|
||||
public int send(java.nio.ByteBuffer pBuffer, long nSize, long nDuration, boolean bMarker) {
|
||||
return tinyWRAPJNI.ProxyVideoProducer_send(swigCPtr, this, pBuffer, nSize, nDuration, bMarker);
|
||||
}
|
||||
|
||||
public void setCallback(ProxyVideoProducerCallback pCallback) {
|
||||
tinyWRAPJNI.ProxyVideoProducer_setCallback(swigCPtr, this, ProxyVideoProducerCallback.getCPtr(pCallback), pCallback);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,10 @@ public class SipMessage {
|
|||
return tinyWRAPJNI.SipMessage_getResponseCode(swigCPtr, this);
|
||||
}
|
||||
|
||||
public String getResponsePhrase() {
|
||||
return tinyWRAPJNI.SipMessage_getResponsePhrase(swigCPtr, this);
|
||||
}
|
||||
|
||||
public String getSipHeaderValue(String name, long index) {
|
||||
return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, this, name, index);
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ public class tinyWRAPJNI {
|
|||
public final static native boolean SipMessage_isResponse(long jarg1, SipMessage jarg1_);
|
||||
public final static native int SipMessage_getRequestType(long jarg1, SipMessage jarg1_);
|
||||
public final static native short SipMessage_getResponseCode(long jarg1, SipMessage jarg1_);
|
||||
public final static native String SipMessage_getResponsePhrase(long jarg1, SipMessage jarg1_);
|
||||
public final static native String SipMessage_getSipHeaderValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, long jarg3);
|
||||
public final static native String SipMessage_getSipHeaderValue__SWIG_1(long jarg1, SipMessage jarg1_, String jarg2);
|
||||
public final static native String SipMessage_getSipHeaderParamValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, String jarg3, long jarg4);
|
||||
|
@ -379,6 +380,8 @@ public class tinyWRAPJNI {
|
|||
public final static native void delete_ProxyVideoFrame(long jarg1);
|
||||
public final static native long ProxyVideoFrame_getSize(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long ProxyVideoFrame_getContent(long jarg1, ProxyVideoFrame jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
|
||||
public final static native long ProxyVideoFrame_getFrameWidth(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long ProxyVideoFrame_getFrameHeight(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long new_ProxyAudioProducerCallback();
|
||||
public final static native void delete_ProxyAudioProducerCallback(long jarg1);
|
||||
public final static native int ProxyAudioProducerCallback_prepare(long jarg1, ProxyAudioProducerCallback jarg1_, int jarg2, int jarg3, int jarg4);
|
||||
|
@ -421,7 +424,6 @@ public class tinyWRAPJNI {
|
|||
public final static native boolean ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
|
||||
public final static native boolean ProxyVideoProducer_setActualCameraOutputSize(long jarg1, ProxyVideoProducer jarg1_, long jarg2, long jarg3);
|
||||
public final static native int ProxyVideoProducer_push(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
|
||||
public final static native int ProxyVideoProducer_send(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, boolean jarg5);
|
||||
public final static native void ProxyVideoProducer_setCallback(long jarg1, ProxyVideoProducer jarg1_, long jarg2, ProxyVideoProducerCallback jarg2_);
|
||||
public final static native java.math.BigInteger ProxyVideoProducer_getMediaSessionId(long jarg1, ProxyVideoProducer jarg1_);
|
||||
public final static native boolean ProxyVideoProducer_registerPlugin();
|
||||
|
|
|
@ -3872,6 +3872,21 @@ SWIGEXPORT jshort JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1get
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getResponsePhrase(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jstring jresult = 0 ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(SipMessage **)&jarg1;
|
||||
result = (char *)(arg1)->getResponsePhrase();
|
||||
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getSipHeaderValue_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) {
|
||||
jstring jresult = 0 ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
|
@ -8292,6 +8307,36 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_1getFrameWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoFrame **)&jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameWidth();
|
||||
jresult = (jlong)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_1getFrameHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoFrame **)&jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameHeight();
|
||||
jresult = (jlong)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_new_1ProxyAudioProducerCallback(JNIEnv *jenv, jclass jcls) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyAudioProducerCallback *result = 0 ;
|
||||
|
@ -8950,31 +8995,6 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProduce
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jlong jarg3, jlong jarg4, jboolean jarg5) {
|
||||
jint jresult = 0 ;
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned int arg4 ;
|
||||
bool arg5 ;
|
||||
int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoProducer **)&jarg1;
|
||||
|
||||
arg2 = jenv->GetDirectBufferAddress(jarg2);
|
||||
|
||||
arg3 = (unsigned int)jarg3;
|
||||
arg4 = (unsigned int)jarg4;
|
||||
arg5 = jarg5 ? true : false;
|
||||
result = (int)(arg1)->send((void const *)arg2,arg3,arg4,arg5);
|
||||
jresult = (jint)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
ProxyVideoProducerCallback *arg2 = (ProxyVideoProducerCallback *) 0 ;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 2.0.8
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public enum tsip_stack_mode_t {
|
||||
tsip_stack_mode_ua,
|
||||
tsip_stack_mode_p2p,
|
||||
tsip_stack_mode_mediaproxy,
|
||||
tsip_stack_mode_mcu;
|
||||
|
||||
public final int swigValue() {
|
||||
return swigValue;
|
||||
}
|
||||
|
||||
public static tsip_stack_mode_t swigToEnum(int swigValue) {
|
||||
tsip_stack_mode_t[] swigValues = tsip_stack_mode_t.class.getEnumConstants();
|
||||
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
|
||||
return swigValues[swigValue];
|
||||
for (tsip_stack_mode_t swigEnum : swigValues)
|
||||
if (swigEnum.swigValue == swigValue)
|
||||
return swigEnum;
|
||||
throw new IllegalArgumentException("No enum " + tsip_stack_mode_t.class + " with value " + swigValue);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t() {
|
||||
this.swigValue = SwigNext.next++;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t(int swigValue) {
|
||||
this.swigValue = swigValue;
|
||||
SwigNext.next = swigValue+1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t(tsip_stack_mode_t swigEnum) {
|
||||
this.swigValue = swigEnum.swigValue;
|
||||
SwigNext.next = this.swigValue+1;
|
||||
}
|
||||
|
||||
private final int swigValue;
|
||||
|
||||
private static class SwigNext {
|
||||
private static int next = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +126,7 @@ public class tinyWRAPJNI {
|
|||
public final static native boolean SipMessage_isResponse(long jarg1, SipMessage jarg1_);
|
||||
public final static native int SipMessage_getRequestType(long jarg1, SipMessage jarg1_);
|
||||
public final static native short SipMessage_getResponseCode(long jarg1, SipMessage jarg1_);
|
||||
public final static native String SipMessage_getResponsePhrase(long jarg1, SipMessage jarg1_);
|
||||
public final static native String SipMessage_getSipHeaderValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, long jarg3);
|
||||
public final static native String SipMessage_getSipHeaderValue__SWIG_1(long jarg1, SipMessage jarg1_, String jarg2);
|
||||
public final static native String SipMessage_getSipHeaderParamValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, String jarg3, long jarg4);
|
||||
|
@ -379,6 +380,8 @@ public class tinyWRAPJNI {
|
|||
public final static native void delete_ProxyVideoFrame(long jarg1);
|
||||
public final static native long ProxyVideoFrame_getSize(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long ProxyVideoFrame_getContent(long jarg1, ProxyVideoFrame jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
|
||||
public final static native long ProxyVideoFrame_getFrameWidth(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long ProxyVideoFrame_getFrameHeight(long jarg1, ProxyVideoFrame jarg1_);
|
||||
public final static native long new_ProxyAudioProducerCallback();
|
||||
public final static native void delete_ProxyAudioProducerCallback(long jarg1);
|
||||
public final static native int ProxyAudioProducerCallback_prepare(long jarg1, ProxyAudioProducerCallback jarg1_, int jarg2, int jarg3, int jarg4);
|
||||
|
@ -421,7 +424,6 @@ public class tinyWRAPJNI {
|
|||
public final static native boolean ProxyVideoProducer_setRotation(long jarg1, ProxyVideoProducer jarg1_, int jarg2);
|
||||
public final static native boolean ProxyVideoProducer_setActualCameraOutputSize(long jarg1, ProxyVideoProducer jarg1_, long jarg2, long jarg3);
|
||||
public final static native int ProxyVideoProducer_push(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3);
|
||||
public final static native int ProxyVideoProducer_send(long jarg1, ProxyVideoProducer jarg1_, java.nio.ByteBuffer jarg2, long jarg3, long jarg4, boolean jarg5);
|
||||
public final static native void ProxyVideoProducer_setCallback(long jarg1, ProxyVideoProducer jarg1_, long jarg2, ProxyVideoProducerCallback jarg2_);
|
||||
public final static native java.math.BigInteger ProxyVideoProducer_getMediaSessionId(long jarg1, ProxyVideoProducer jarg1_);
|
||||
public final static native boolean ProxyVideoProducer_registerPlugin();
|
||||
|
|
|
@ -3872,6 +3872,21 @@ SWIGEXPORT jshort JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1get
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getResponsePhrase(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jstring jresult = 0 ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(SipMessage **)&jarg1;
|
||||
result = (char *)(arg1)->getResponsePhrase();
|
||||
if (result) jresult = jenv->NewStringUTF((const char *)result);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getSipHeaderValue_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) {
|
||||
jstring jresult = 0 ;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
|
@ -8292,6 +8307,36 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_1getFrameWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoFrame **)&jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameWidth();
|
||||
jresult = (jlong)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoFrame_1getFrameHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
unsigned int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoFrame **)&jarg1;
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameHeight();
|
||||
jresult = (jlong)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_new_1ProxyAudioProducerCallback(JNIEnv *jenv, jclass jcls) {
|
||||
jlong jresult = 0 ;
|
||||
ProxyAudioProducerCallback *result = 0 ;
|
||||
|
@ -8950,31 +8995,6 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProduce
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1send(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jlong jarg3, jlong jarg4, jboolean jarg5) {
|
||||
jint jresult = 0 ;
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned int arg4 ;
|
||||
bool arg5 ;
|
||||
int result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(ProxyVideoProducer **)&jarg1;
|
||||
|
||||
arg2 = jenv->GetDirectBufferAddress(jarg2);
|
||||
|
||||
arg3 = (unsigned int)jarg3;
|
||||
arg4 = (unsigned int)jarg4;
|
||||
arg5 = jarg5 ? true : false;
|
||||
result = (int)(arg1)->send((void const *)arg2,arg3,arg4,arg5);
|
||||
jresult = (jint)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ProxyVideoProducer_1setCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
ProxyVideoProducerCallback *arg2 = (ProxyVideoProducerCallback *) 0 ;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 2.0.8
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public enum tsip_stack_mode_t {
|
||||
tsip_stack_mode_ua,
|
||||
tsip_stack_mode_p2p,
|
||||
tsip_stack_mode_mediaproxy,
|
||||
tsip_stack_mode_mcu;
|
||||
|
||||
public final int swigValue() {
|
||||
return swigValue;
|
||||
}
|
||||
|
||||
public static tsip_stack_mode_t swigToEnum(int swigValue) {
|
||||
tsip_stack_mode_t[] swigValues = tsip_stack_mode_t.class.getEnumConstants();
|
||||
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
|
||||
return swigValues[swigValue];
|
||||
for (tsip_stack_mode_t swigEnum : swigValues)
|
||||
if (swigEnum.swigValue == swigValue)
|
||||
return swigEnum;
|
||||
throw new IllegalArgumentException("No enum " + tsip_stack_mode_t.class + " with value " + swigValue);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t() {
|
||||
this.swigValue = SwigNext.next++;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t(int swigValue) {
|
||||
this.swigValue = swigValue;
|
||||
SwigNext.next = swigValue+1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private tsip_stack_mode_t(tsip_stack_mode_t swigEnum) {
|
||||
this.swigValue = swigEnum.swigValue;
|
||||
SwigNext.next = this.swigValue+1;
|
||||
}
|
||||
|
||||
private final int swigValue;
|
||||
|
||||
private static class SwigNext {
|
||||
private static int next = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -474,6 +474,7 @@ sub DESTROY {
|
|||
*isResponse = *tinyWRAPc::SipMessage_isResponse;
|
||||
*getRequestType = *tinyWRAPc::SipMessage_getRequestType;
|
||||
*getResponseCode = *tinyWRAPc::SipMessage_getResponseCode;
|
||||
*getResponsePhrase = *tinyWRAPc::SipMessage_getResponsePhrase;
|
||||
*getSipHeaderValue = *tinyWRAPc::SipMessage_getSipHeaderValue;
|
||||
*getSipHeaderParamValue = *tinyWRAPc::SipMessage_getSipHeaderParamValue;
|
||||
*getSipContentLength = *tinyWRAPc::SipMessage_getSipContentLength;
|
||||
|
@ -1626,6 +1627,8 @@ sub DESTROY {
|
|||
|
||||
*getSize = *tinyWRAPc::ProxyVideoFrame_getSize;
|
||||
*getContent = *tinyWRAPc::ProxyVideoFrame_getContent;
|
||||
*getFrameWidth = *tinyWRAPc::ProxyVideoFrame_getFrameWidth;
|
||||
*getFrameHeight = *tinyWRAPc::ProxyVideoFrame_getFrameHeight;
|
||||
sub DISOWN {
|
||||
my $self = shift;
|
||||
my $ptr = tied(%$self);
|
||||
|
@ -1782,7 +1785,6 @@ sub DESTROY {
|
|||
*setRotation = *tinyWRAPc::ProxyVideoProducer_setRotation;
|
||||
*setActualCameraOutputSize = *tinyWRAPc::ProxyVideoProducer_setActualCameraOutputSize;
|
||||
*push = *tinyWRAPc::ProxyVideoProducer_push;
|
||||
*send = *tinyWRAPc::ProxyVideoProducer_send;
|
||||
*setCallback = *tinyWRAPc::ProxyVideoProducer_setCallback;
|
||||
*getMediaSessionId = *tinyWRAPc::ProxyVideoProducer_getMediaSessionId;
|
||||
*registerPlugin = *tinyWRAPc::ProxyVideoProducer_registerPlugin;
|
||||
|
@ -2435,6 +2437,10 @@ package tinyWRAP;
|
|||
*twrap_proxy_plugin_video_producer = *tinyWRAPc::twrap_proxy_plugin_video_producer;
|
||||
*twrap_proxy_plugin_audio_consumer = *tinyWRAPc::twrap_proxy_plugin_audio_consumer;
|
||||
*twrap_proxy_plugin_video_consumer = *tinyWRAPc::twrap_proxy_plugin_video_consumer;
|
||||
*tsip_stack_mode_ua = *tinyWRAPc::tsip_stack_mode_ua;
|
||||
*tsip_stack_mode_p2p = *tinyWRAPc::tsip_stack_mode_p2p;
|
||||
*tsip_stack_mode_mediaproxy = *tinyWRAPc::tsip_stack_mode_mediaproxy;
|
||||
*tsip_stack_mode_mcu = *tinyWRAPc::tsip_stack_mode_mcu;
|
||||
*tsip_NONE = *tinyWRAPc::tsip_NONE;
|
||||
*tsip_ACK = *tinyWRAPc::tsip_ACK;
|
||||
*tsip_BYE = *tinyWRAPc::tsip_BYE;
|
||||
|
|
|
@ -1597,18 +1597,19 @@ SWIG_Perl_SetModule(swig_module_info *module) {
|
|||
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[80]
|
||||
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[81]
|
||||
#define SWIGTYPE_p_tsip_request_type_e swig_types[82]
|
||||
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[83]
|
||||
#define SWIGTYPE_p_tsk_list_t swig_types[84]
|
||||
#define SWIGTYPE_p_twrap_media_type_e swig_types[85]
|
||||
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[86]
|
||||
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[87]
|
||||
#define SWIGTYPE_p_twrap_sms_type_e swig_types[88]
|
||||
#define SWIGTYPE_p_unsigned_char swig_types[89]
|
||||
#define SWIGTYPE_p_unsigned_int swig_types[90]
|
||||
#define SWIGTYPE_p_unsigned_long_long swig_types[91]
|
||||
#define SWIGTYPE_p_unsigned_short swig_types[92]
|
||||
static swig_type_info *swig_types[94];
|
||||
static swig_module_info swig_module = {swig_types, 93, 0, 0, 0, 0};
|
||||
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[83]
|
||||
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[84]
|
||||
#define SWIGTYPE_p_tsk_list_t swig_types[85]
|
||||
#define SWIGTYPE_p_twrap_media_type_e swig_types[86]
|
||||
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[87]
|
||||
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[88]
|
||||
#define SWIGTYPE_p_twrap_sms_type_e swig_types[89]
|
||||
#define SWIGTYPE_p_unsigned_char swig_types[90]
|
||||
#define SWIGTYPE_p_unsigned_int swig_types[91]
|
||||
#define SWIGTYPE_p_unsigned_long_long swig_types[92]
|
||||
#define SWIGTYPE_p_unsigned_short swig_types[93]
|
||||
static swig_type_info *swig_types[95];
|
||||
static swig_module_info swig_module = {swig_types, 94, 0, 0, 0, 0};
|
||||
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
||||
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
||||
|
||||
|
@ -6275,6 +6276,34 @@ XS(_wrap_SipMessage_getResponseCode) {
|
|||
}
|
||||
|
||||
|
||||
XS(_wrap_SipMessage_getResponsePhrase) {
|
||||
{
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int argvi = 0;
|
||||
char *result = 0 ;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 1) || (items > 1)) {
|
||||
SWIG_croak("Usage: SipMessage_getResponsePhrase(self);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_getResponsePhrase" "', argument " "1"" of type '" "SipMessage *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< SipMessage * >(argp1);
|
||||
result = (char *)(arg1)->getResponsePhrase();
|
||||
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_SipMessage_getSipHeaderValue__SWIG_0) {
|
||||
{
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
|
@ -17914,6 +17943,62 @@ XS(_wrap_ProxyVideoFrame_getContent) {
|
|||
}
|
||||
|
||||
|
||||
XS(_wrap_ProxyVideoFrame_getFrameWidth) {
|
||||
{
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int argvi = 0;
|
||||
unsigned int result;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 1) || (items > 1)) {
|
||||
SWIG_croak("Usage: ProxyVideoFrame_getFrameWidth(self);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ProxyVideoFrame, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoFrame_getFrameWidth" "', argument " "1"" of type '" "ProxyVideoFrame const *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoFrame * >(argp1);
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameWidth();
|
||||
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_ProxyVideoFrame_getFrameHeight) {
|
||||
{
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int argvi = 0;
|
||||
unsigned int result;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 1) || (items > 1)) {
|
||||
SWIG_croak("Usage: ProxyVideoFrame_getFrameHeight(self);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ProxyVideoFrame, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoFrame_getFrameHeight" "', argument " "1"" of type '" "ProxyVideoFrame const *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoFrame * >(argp1);
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameHeight();
|
||||
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_new_ProxyAudioProducerCallback) {
|
||||
{
|
||||
int argvi = 0;
|
||||
|
@ -19109,72 +19194,6 @@ XS(_wrap_ProxyVideoProducer_push) {
|
|||
|
||||
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_ProxyVideoProducer_send) {
|
||||
{
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned int arg4 ;
|
||||
bool arg5 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int res2 ;
|
||||
unsigned int val3 ;
|
||||
int ecode3 = 0 ;
|
||||
unsigned int val4 ;
|
||||
int ecode4 = 0 ;
|
||||
bool val5 ;
|
||||
int ecode5 = 0 ;
|
||||
int argvi = 0;
|
||||
int result;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 5) || (items > 5)) {
|
||||
SWIG_croak("Usage: ProxyVideoProducer_send(self,pBuffer,nSize,nDuration,bMarker);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ProxyVideoProducer, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoProducer_send" "', argument " "1"" of type '" "ProxyVideoProducer *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoProducer * >(argp1);
|
||||
res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ProxyVideoProducer_send" "', argument " "2"" of type '" "void const *""'");
|
||||
}
|
||||
ecode3 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
|
||||
if (!SWIG_IsOK(ecode3)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ProxyVideoProducer_send" "', argument " "3"" of type '" "unsigned int""'");
|
||||
}
|
||||
arg3 = static_cast< unsigned int >(val3);
|
||||
ecode4 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
|
||||
if (!SWIG_IsOK(ecode4)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ProxyVideoProducer_send" "', argument " "4"" of type '" "unsigned int""'");
|
||||
}
|
||||
arg4 = static_cast< unsigned int >(val4);
|
||||
ecode5 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
|
||||
if (!SWIG_IsOK(ecode5)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "ProxyVideoProducer_send" "', argument " "5"" of type '" "bool""'");
|
||||
}
|
||||
arg5 = static_cast< bool >(val5);
|
||||
result = (int)(arg1)->send((void const *)arg2,arg3,arg4,arg5);
|
||||
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
@ -25139,6 +25158,7 @@ static swig_type_info _swigt__p_tsip_options_event_type_e = {"_p_tsip_options_ev
|
|||
static swig_type_info _swigt__p_tsip_publish_event_type_e = {"_p_tsip_publish_event_type_e", "enum tsip_publish_event_type_e *|tsip_publish_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_register_event_type_e = {"_p_tsip_register_event_type_e", "enum tsip_register_event_type_e *|tsip_register_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_request_type_e = {"_p_tsip_request_type_e", "enum tsip_request_type_e *|tsip_request_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_stack_mode_e = {"_p_tsip_stack_mode_e", "enum tsip_stack_mode_e *|tsip_stack_mode_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_subscribe_event_type_e = {"_p_tsip_subscribe_event_type_e", "enum tsip_subscribe_event_type_e *|tsip_subscribe_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsk_list_t = {"_p_tsk_list_t", "twrap_xcap_steps_L_t *|twrap_proxy_plungins_L_t *|tsk_list_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_twrap_media_type_e = {"_p_twrap_media_type_e", "enum twrap_media_type_e *|twrap_media_type_t *", 0, 0, (void*)0, 0};
|
||||
|
@ -25234,6 +25254,7 @@ static swig_type_info *swig_type_initial[] = {
|
|||
&_swigt__p_tsip_publish_event_type_e,
|
||||
&_swigt__p_tsip_register_event_type_e,
|
||||
&_swigt__p_tsip_request_type_e,
|
||||
&_swigt__p_tsip_stack_mode_e,
|
||||
&_swigt__p_tsip_subscribe_event_type_e,
|
||||
&_swigt__p_tsk_list_t,
|
||||
&_swigt__p_twrap_media_type_e,
|
||||
|
@ -25329,6 +25350,7 @@ static swig_cast_info _swigc__p_tsip_options_event_type_e[] = { {&_swigt__p_tsi
|
|||
static swig_cast_info _swigc__p_tsip_publish_event_type_e[] = { {&_swigt__p_tsip_publish_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_register_event_type_e[] = { {&_swigt__p_tsip_register_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_request_type_e[] = { {&_swigt__p_tsip_request_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_stack_mode_e[] = { {&_swigt__p_tsip_stack_mode_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_subscribe_event_type_e[] = { {&_swigt__p_tsip_subscribe_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsk_list_t[] = { {&_swigt__p_tsk_list_t, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_twrap_media_type_e[] = { {&_swigt__p_twrap_media_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
|
@ -25424,6 +25446,7 @@ static swig_cast_info *swig_cast_initial[] = {
|
|||
_swigc__p_tsip_publish_event_type_e,
|
||||
_swigc__p_tsip_register_event_type_e,
|
||||
_swigc__p_tsip_request_type_e,
|
||||
_swigc__p_tsip_stack_mode_e,
|
||||
_swigc__p_tsip_subscribe_event_type_e,
|
||||
_swigc__p_tsk_list_t,
|
||||
_swigc__p_twrap_media_type_e,
|
||||
|
@ -25556,6 +25579,7 @@ static swig_command_info swig_commands[] = {
|
|||
{"tinyWRAPc::SipMessage_isResponse", _wrap_SipMessage_isResponse},
|
||||
{"tinyWRAPc::SipMessage_getRequestType", _wrap_SipMessage_getRequestType},
|
||||
{"tinyWRAPc::SipMessage_getResponseCode", _wrap_SipMessage_getResponseCode},
|
||||
{"tinyWRAPc::SipMessage_getResponsePhrase", _wrap_SipMessage_getResponsePhrase},
|
||||
{"tinyWRAPc::SipMessage_getSipHeaderValue", _wrap_SipMessage_getSipHeaderValue},
|
||||
{"tinyWRAPc::SipMessage_getSipHeaderParamValue", _wrap_SipMessage_getSipHeaderParamValue},
|
||||
{"tinyWRAPc::SipMessage_getSipContentLength", _wrap_SipMessage_getSipContentLength},
|
||||
|
@ -25738,6 +25762,8 @@ static swig_command_info swig_commands[] = {
|
|||
{"tinyWRAPc::delete_ProxyVideoFrame", _wrap_delete_ProxyVideoFrame},
|
||||
{"tinyWRAPc::ProxyVideoFrame_getSize", _wrap_ProxyVideoFrame_getSize},
|
||||
{"tinyWRAPc::ProxyVideoFrame_getContent", _wrap_ProxyVideoFrame_getContent},
|
||||
{"tinyWRAPc::ProxyVideoFrame_getFrameWidth", _wrap_ProxyVideoFrame_getFrameWidth},
|
||||
{"tinyWRAPc::ProxyVideoFrame_getFrameHeight", _wrap_ProxyVideoFrame_getFrameHeight},
|
||||
{"tinyWRAPc::new_ProxyAudioProducerCallback", _wrap_new_ProxyAudioProducerCallback},
|
||||
{"tinyWRAPc::delete_ProxyAudioProducerCallback", _wrap_delete_ProxyAudioProducerCallback},
|
||||
{"tinyWRAPc::ProxyAudioProducerCallback_prepare", _wrap_ProxyAudioProducerCallback_prepare},
|
||||
|
@ -25764,7 +25790,6 @@ static swig_command_info swig_commands[] = {
|
|||
{"tinyWRAPc::ProxyVideoProducer_setRotation", _wrap_ProxyVideoProducer_setRotation},
|
||||
{"tinyWRAPc::ProxyVideoProducer_setActualCameraOutputSize", _wrap_ProxyVideoProducer_setActualCameraOutputSize},
|
||||
{"tinyWRAPc::ProxyVideoProducer_push", _wrap_ProxyVideoProducer_push},
|
||||
{"tinyWRAPc::ProxyVideoProducer_send", _wrap_ProxyVideoProducer_send},
|
||||
{"tinyWRAPc::ProxyVideoProducer_setCallback", _wrap_ProxyVideoProducer_setCallback},
|
||||
{"tinyWRAPc::ProxyVideoProducer_getMediaSessionId", _wrap_ProxyVideoProducer_getMediaSessionId},
|
||||
{"tinyWRAPc::ProxyVideoProducer_registerPlugin", _wrap_ProxyVideoProducer_registerPlugin},
|
||||
|
@ -26326,6 +26351,26 @@ XS(SWIG_init) {
|
|||
SWIG_TypeClientData(SWIGTYPE_p_SipCallback, (void*) "tinyWRAP::SipCallback");
|
||||
SWIG_TypeClientData(SWIGTYPE_p_SafeObject, (void*) "tinyWRAP::SafeObject");
|
||||
SWIG_TypeClientData(SWIGTYPE_p_SipStack, (void*) "tinyWRAP::SipStack");
|
||||
/*@SWIG:/usr/local/share/swig/2.0.8/perl5/perltypemaps.swg,65,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "tsip_stack_mode_ua", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_stack_mode_ua)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/2.0.8/perl5/perltypemaps.swg,65,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "tsip_stack_mode_p2p", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_stack_mode_p2p)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/2.0.8/perl5/perltypemaps.swg,65,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "tsip_stack_mode_mediaproxy", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_stack_mode_mediaproxy)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/2.0.8/perl5/perltypemaps.swg,65,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "tsip_stack_mode_mcu", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_stack_mode_mcu)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/2.0.8/perl5/perltypemaps.swg,65,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "tsip_NONE", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_NONE)));
|
||||
|
|
|
@ -515,6 +515,7 @@ class SipMessage(_object):
|
|||
def isResponse(self): return _tinyWRAP.SipMessage_isResponse(self)
|
||||
def getRequestType(self): return _tinyWRAP.SipMessage_getRequestType(self)
|
||||
def getResponseCode(self): return _tinyWRAP.SipMessage_getResponseCode(self)
|
||||
def getResponsePhrase(self): return _tinyWRAP.SipMessage_getResponsePhrase(self)
|
||||
def getSipHeaderValue(self, *args): return _tinyWRAP.SipMessage_getSipHeaderValue(self, *args)
|
||||
def getSipHeaderParamValue(self, *args): return _tinyWRAP.SipMessage_getSipHeaderParamValue(self, *args)
|
||||
def getSipContentLength(self): return _tinyWRAP.SipMessage_getSipContentLength(self)
|
||||
|
@ -1161,6 +1162,8 @@ class ProxyVideoFrame(_object):
|
|||
__del__ = lambda self : None;
|
||||
def getSize(self): return _tinyWRAP.ProxyVideoFrame_getSize(self)
|
||||
def getContent(self, *args): return _tinyWRAP.ProxyVideoFrame_getContent(self, *args)
|
||||
def getFrameWidth(self): return _tinyWRAP.ProxyVideoFrame_getFrameWidth(self)
|
||||
def getFrameHeight(self): return _tinyWRAP.ProxyVideoFrame_getFrameHeight(self)
|
||||
ProxyVideoFrame_swigregister = _tinyWRAP.ProxyVideoFrame_swigregister
|
||||
ProxyVideoFrame_swigregister(ProxyVideoFrame)
|
||||
|
||||
|
@ -1260,7 +1263,6 @@ class ProxyVideoProducer(ProxyPlugin):
|
|||
def setRotation(self, *args): return _tinyWRAP.ProxyVideoProducer_setRotation(self, *args)
|
||||
def setActualCameraOutputSize(self, *args): return _tinyWRAP.ProxyVideoProducer_setActualCameraOutputSize(self, *args)
|
||||
def push(self, *args): return _tinyWRAP.ProxyVideoProducer_push(self, *args)
|
||||
def send(self, *args): return _tinyWRAP.ProxyVideoProducer_send(self, *args)
|
||||
def setCallback(self, *args): return _tinyWRAP.ProxyVideoProducer_setCallback(self, *args)
|
||||
def getMediaSessionId(self): return _tinyWRAP.ProxyVideoProducer_getMediaSessionId(self)
|
||||
__swig_getmethods__["registerPlugin"] = lambda x: _tinyWRAP.ProxyVideoProducer_registerPlugin
|
||||
|
@ -1419,6 +1421,10 @@ def SipStack_isCodecSupported(*args):
|
|||
return _tinyWRAP.SipStack_isCodecSupported(*args)
|
||||
SipStack_isCodecSupported = _tinyWRAP.SipStack_isCodecSupported
|
||||
|
||||
tsip_stack_mode_ua = _tinyWRAP.tsip_stack_mode_ua
|
||||
tsip_stack_mode_p2p = _tinyWRAP.tsip_stack_mode_p2p
|
||||
tsip_stack_mode_mediaproxy = _tinyWRAP.tsip_stack_mode_mediaproxy
|
||||
tsip_stack_mode_mcu = _tinyWRAP.tsip_stack_mode_mcu
|
||||
tsip_NONE = _tinyWRAP.tsip_NONE
|
||||
tsip_ACK = _tinyWRAP.tsip_ACK
|
||||
tsip_BYE = _tinyWRAP.tsip_BYE
|
||||
|
|
|
@ -3524,18 +3524,19 @@ namespace Swig {
|
|||
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[80]
|
||||
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[81]
|
||||
#define SWIGTYPE_p_tsip_request_type_e swig_types[82]
|
||||
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[83]
|
||||
#define SWIGTYPE_p_tsk_list_t swig_types[84]
|
||||
#define SWIGTYPE_p_twrap_media_type_e swig_types[85]
|
||||
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[86]
|
||||
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[87]
|
||||
#define SWIGTYPE_p_twrap_sms_type_e swig_types[88]
|
||||
#define SWIGTYPE_p_unsigned_char swig_types[89]
|
||||
#define SWIGTYPE_p_unsigned_int swig_types[90]
|
||||
#define SWIGTYPE_p_unsigned_long_long swig_types[91]
|
||||
#define SWIGTYPE_p_unsigned_short swig_types[92]
|
||||
static swig_type_info *swig_types[94];
|
||||
static swig_module_info swig_module = {swig_types, 93, 0, 0, 0, 0};
|
||||
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[83]
|
||||
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[84]
|
||||
#define SWIGTYPE_p_tsk_list_t swig_types[85]
|
||||
#define SWIGTYPE_p_twrap_media_type_e swig_types[86]
|
||||
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[87]
|
||||
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[88]
|
||||
#define SWIGTYPE_p_twrap_sms_type_e swig_types[89]
|
||||
#define SWIGTYPE_p_unsigned_char swig_types[90]
|
||||
#define SWIGTYPE_p_unsigned_int swig_types[91]
|
||||
#define SWIGTYPE_p_unsigned_long_long swig_types[92]
|
||||
#define SWIGTYPE_p_unsigned_short swig_types[93]
|
||||
static swig_type_info *swig_types[95];
|
||||
static swig_module_info swig_module = {swig_types, 94, 0, 0, 0, 0};
|
||||
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
||||
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
||||
|
||||
|
@ -8806,6 +8807,28 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_SipMessage_getResponsePhrase(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"O:SipMessage_getResponsePhrase",&obj0)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_getResponsePhrase" "', argument " "1"" of type '" "SipMessage *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< SipMessage * >(argp1);
|
||||
result = (char *)(arg1)->getResponsePhrase();
|
||||
resultobj = SWIG_FromCharPtr((const char *)result);
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_SipMessage_getSipHeaderValue__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
SipMessage *arg1 = (SipMessage *) 0 ;
|
||||
|
@ -17961,6 +17984,50 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ProxyVideoFrame_getFrameWidth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
unsigned int result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"O:ProxyVideoFrame_getFrameWidth",&obj0)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ProxyVideoFrame, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoFrame_getFrameWidth" "', argument " "1"" of type '" "ProxyVideoFrame const *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoFrame * >(argp1);
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameWidth();
|
||||
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ProxyVideoFrame_getFrameHeight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ProxyVideoFrame *arg1 = (ProxyVideoFrame *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
unsigned int result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"O:ProxyVideoFrame_getFrameHeight",&obj0)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ProxyVideoFrame, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoFrame_getFrameHeight" "', argument " "1"" of type '" "ProxyVideoFrame const *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoFrame * >(argp1);
|
||||
result = (unsigned int)((ProxyVideoFrame const *)arg1)->getFrameHeight();
|
||||
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *ProxyVideoFrame_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
|
||||
|
@ -19080,62 +19147,6 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ProxyVideoProducer_send(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
unsigned int arg3 ;
|
||||
unsigned int arg4 ;
|
||||
bool arg5 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int res2 ;
|
||||
unsigned int val3 ;
|
||||
int ecode3 = 0 ;
|
||||
unsigned int val4 ;
|
||||
int ecode4 = 0 ;
|
||||
bool val5 ;
|
||||
int ecode5 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
PyObject * obj1 = 0 ;
|
||||
PyObject * obj2 = 0 ;
|
||||
PyObject * obj3 = 0 ;
|
||||
PyObject * obj4 = 0 ;
|
||||
int result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"OOOOO:ProxyVideoProducer_send",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ProxyVideoProducer, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ProxyVideoProducer_send" "', argument " "1"" of type '" "ProxyVideoProducer *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< ProxyVideoProducer * >(argp1);
|
||||
res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
|
||||
if (!SWIG_IsOK(res2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ProxyVideoProducer_send" "', argument " "2"" of type '" "void const *""'");
|
||||
}
|
||||
ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
|
||||
if (!SWIG_IsOK(ecode3)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ProxyVideoProducer_send" "', argument " "3"" of type '" "unsigned int""'");
|
||||
}
|
||||
arg3 = static_cast< unsigned int >(val3);
|
||||
ecode4 = SWIG_AsVal_unsigned_SS_int(obj3, &val4);
|
||||
if (!SWIG_IsOK(ecode4)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ProxyVideoProducer_send" "', argument " "4"" of type '" "unsigned int""'");
|
||||
}
|
||||
arg4 = static_cast< unsigned int >(val4);
|
||||
ecode5 = SWIG_AsVal_bool(obj4, &val5);
|
||||
if (!SWIG_IsOK(ecode5)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "ProxyVideoProducer_send" "', argument " "5"" of type '" "bool""'");
|
||||
}
|
||||
arg5 = static_cast< bool >(val5);
|
||||
result = (int)(arg1)->send((void const *)arg2,arg3,arg4,arg5);
|
||||
resultobj = SWIG_From_int(static_cast< int >(result));
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_ProxyVideoProducer_setCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
ProxyVideoProducer *arg1 = (ProxyVideoProducer *) 0 ;
|
||||
|
@ -24459,6 +24470,7 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"SipMessage_isResponse", _wrap_SipMessage_isResponse, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getRequestType", _wrap_SipMessage_getRequestType, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getResponseCode", _wrap_SipMessage_getResponseCode, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getResponsePhrase", _wrap_SipMessage_getResponsePhrase, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getSipHeaderValue", _wrap_SipMessage_getSipHeaderValue, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getSipHeaderParamValue", _wrap_SipMessage_getSipHeaderParamValue, METH_VARARGS, NULL},
|
||||
{ (char *)"SipMessage_getSipContentLength", _wrap_SipMessage_getSipContentLength, METH_VARARGS, NULL},
|
||||
|
@ -24675,6 +24687,8 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"delete_ProxyVideoFrame", _wrap_delete_ProxyVideoFrame, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoFrame_getSize", _wrap_ProxyVideoFrame_getSize, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoFrame_getContent", _wrap_ProxyVideoFrame_getContent, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoFrame_getFrameWidth", _wrap_ProxyVideoFrame_getFrameWidth, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoFrame_getFrameHeight", _wrap_ProxyVideoFrame_getFrameHeight, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoFrame_swigregister", ProxyVideoFrame_swigregister, METH_VARARGS, NULL},
|
||||
{ (char *)"new_ProxyAudioProducerCallback", _wrap_new_ProxyAudioProducerCallback, METH_VARARGS, NULL},
|
||||
{ (char *)"delete_ProxyAudioProducerCallback", _wrap_delete_ProxyAudioProducerCallback, METH_VARARGS, NULL},
|
||||
|
@ -24707,7 +24721,6 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"ProxyVideoProducer_setRotation", _wrap_ProxyVideoProducer_setRotation, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_setActualCameraOutputSize", _wrap_ProxyVideoProducer_setActualCameraOutputSize, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_push", _wrap_ProxyVideoProducer_push, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_send", _wrap_ProxyVideoProducer_send, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_setCallback", _wrap_ProxyVideoProducer_setCallback, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_getMediaSessionId", _wrap_ProxyVideoProducer_getMediaSessionId, METH_VARARGS, NULL},
|
||||
{ (char *)"ProxyVideoProducer_registerPlugin", _wrap_ProxyVideoProducer_registerPlugin, METH_VARARGS, NULL},
|
||||
|
@ -25039,6 +25052,7 @@ static swig_type_info _swigt__p_tsip_options_event_type_e = {"_p_tsip_options_ev
|
|||
static swig_type_info _swigt__p_tsip_publish_event_type_e = {"_p_tsip_publish_event_type_e", "enum tsip_publish_event_type_e *|tsip_publish_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_register_event_type_e = {"_p_tsip_register_event_type_e", "enum tsip_register_event_type_e *|tsip_register_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_request_type_e = {"_p_tsip_request_type_e", "enum tsip_request_type_e *|tsip_request_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_stack_mode_e = {"_p_tsip_stack_mode_e", "enum tsip_stack_mode_e *|tsip_stack_mode_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsip_subscribe_event_type_e = {"_p_tsip_subscribe_event_type_e", "enum tsip_subscribe_event_type_e *|tsip_subscribe_event_type_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_tsk_list_t = {"_p_tsk_list_t", "twrap_xcap_steps_L_t *|twrap_proxy_plungins_L_t *|tsk_list_t *", 0, 0, (void*)0, 0};
|
||||
static swig_type_info _swigt__p_twrap_media_type_e = {"_p_twrap_media_type_e", "enum twrap_media_type_e *|twrap_media_type_t *", 0, 0, (void*)0, 0};
|
||||
|
@ -25134,6 +25148,7 @@ static swig_type_info *swig_type_initial[] = {
|
|||
&_swigt__p_tsip_publish_event_type_e,
|
||||
&_swigt__p_tsip_register_event_type_e,
|
||||
&_swigt__p_tsip_request_type_e,
|
||||
&_swigt__p_tsip_stack_mode_e,
|
||||
&_swigt__p_tsip_subscribe_event_type_e,
|
||||
&_swigt__p_tsk_list_t,
|
||||
&_swigt__p_twrap_media_type_e,
|
||||
|
@ -25229,6 +25244,7 @@ static swig_cast_info _swigc__p_tsip_options_event_type_e[] = { {&_swigt__p_tsi
|
|||
static swig_cast_info _swigc__p_tsip_publish_event_type_e[] = { {&_swigt__p_tsip_publish_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_register_event_type_e[] = { {&_swigt__p_tsip_register_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_request_type_e[] = { {&_swigt__p_tsip_request_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_stack_mode_e[] = { {&_swigt__p_tsip_stack_mode_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsip_subscribe_event_type_e[] = { {&_swigt__p_tsip_subscribe_event_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_tsk_list_t[] = { {&_swigt__p_tsk_list_t, 0, 0, 0},{0, 0, 0, 0}};
|
||||
static swig_cast_info _swigc__p_twrap_media_type_e[] = { {&_swigt__p_twrap_media_type_e, 0, 0, 0},{0, 0, 0, 0}};
|
||||
|
@ -25324,6 +25340,7 @@ static swig_cast_info *swig_cast_initial[] = {
|
|||
_swigc__p_tsip_publish_event_type_e,
|
||||
_swigc__p_tsip_register_event_type_e,
|
||||
_swigc__p_tsip_request_type_e,
|
||||
_swigc__p_tsip_stack_mode_e,
|
||||
_swigc__p_tsip_subscribe_event_type_e,
|
||||
_swigc__p_tsk_list_t,
|
||||
_swigc__p_twrap_media_type_e,
|
||||
|
@ -26033,6 +26050,10 @@ SWIG_init(void) {
|
|||
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_video_producer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_video_producer)));
|
||||
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_audio_consumer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_audio_consumer)));
|
||||
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_video_consumer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_video_consumer)));
|
||||
SWIG_Python_SetConstant(d, "tsip_stack_mode_ua",SWIG_From_int(static_cast< int >(tsip_stack_mode_ua)));
|
||||
SWIG_Python_SetConstant(d, "tsip_stack_mode_p2p",SWIG_From_int(static_cast< int >(tsip_stack_mode_p2p)));
|
||||
SWIG_Python_SetConstant(d, "tsip_stack_mode_mediaproxy",SWIG_From_int(static_cast< int >(tsip_stack_mode_mediaproxy)));
|
||||
SWIG_Python_SetConstant(d, "tsip_stack_mode_mcu",SWIG_From_int(static_cast< int >(tsip_stack_mode_mcu)));
|
||||
SWIG_Python_SetConstant(d, "tsip_NONE",SWIG_From_int(static_cast< int >(tsip_NONE)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ACK",SWIG_From_int(static_cast< int >(tsip_ACK)));
|
||||
SWIG_Python_SetConstant(d, "tsip_BYE",SWIG_From_int(static_cast< int >(tsip_BYE)));
|
||||
|
|
|
@ -48,7 +48,7 @@ tsk_size_t tdav_codec_dtmf_fmtp_decode(tmedia_codec_t* self, const void* in_data
|
|||
char* tdav_codec_dtmf_sdp_att_get(const tmedia_codec_t* self, const char* att_name)
|
||||
{
|
||||
if(tsk_striequals(att_name, "fmtp")){
|
||||
return tsk_strdup("0-15");
|
||||
return tsk_strdup("0-16");
|
||||
}
|
||||
return tsk_null;
|
||||
}
|
||||
|
|
|
@ -308,12 +308,13 @@ static tdav_codec_decl_t __codecs[] = {
|
|||
#if HAVE_BV16
|
||||
{ tdav_codec_id_bv16, &tdav_codec_bv16_plugin_def_t },
|
||||
#endif
|
||||
{ tdav_codec_id_pcmu, &tdav_codec_g711u_plugin_def_t },
|
||||
#if HAVE_LIBGSM
|
||||
{ tdav_codec_id_gsm, &tdav_codec_gsm_plugin_def_t },
|
||||
#endif
|
||||
{ tdav_codec_id_pcma, &tdav_codec_g711a_plugin_def_t },
|
||||
{ tdav_codec_id_pcmu, &tdav_codec_g711u_plugin_def_t },
|
||||
{ tdav_codec_id_g722, &tdav_codec_g722_plugin_def_t },
|
||||
|
||||
#if HAVE_ILBC
|
||||
{ tdav_codec_id_ilbc, &tdav_codec_ilbc_plugin_def_t },
|
||||
#endif
|
||||
|
|
|
@ -436,6 +436,7 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
|
|||
if(self->media_type == tmedia_audio){
|
||||
tsdp_header_M_add_headers(base->M.lo,
|
||||
TSDP_HEADER_A_VA_ARGS("ptime", "20"),
|
||||
TSDP_HEADER_A_VA_ARGS("silenceSupp", "off - - - -"),
|
||||
tsk_null);
|
||||
// the "telephone-event" fmt/rtpmap is added below
|
||||
}
|
||||
|
@ -581,7 +582,7 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
|
|||
// RTCWeb
|
||||
tsdp_header_M_add_headers(base->M.lo,
|
||||
TSDP_HEADER_A_VA_ARGS("mid", self->media_type == tmedia_audio ? "audio" : "video"),
|
||||
tsk_null);
|
||||
tsk_null);
|
||||
|
||||
while((candidate = tnet_ice_ctx_get_local_candidate_at(self->ice_ctx, index++))){
|
||||
if(self->use_rtcpmux && remote_use_rtcpmux && candidate->comp_id == TNET_ICE_CANDIDATE_COMPID_RTCP){
|
||||
|
|
|
@ -741,11 +741,11 @@ int tnet_dns_query_naptr_srv(tnet_dns_ctx_t *ctx, const char* domain, const char
|
|||
*port = 5060;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("DNS NAPTR query returned invalid falgs.");
|
||||
TSK_DEBUG_ERROR("DNS NAPTR query returned invalid flags");
|
||||
}
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("DNS NAPTR query returned zero result.");
|
||||
TSK_DEBUG_INFO("DNS NAPTR (%s) query returned zero result", domain);
|
||||
}
|
||||
|
||||
TSK_FREE(flags);
|
||||
|
|
|
@ -56,7 +56,7 @@ TNET_BEGIN_DECLS
|
|||
#define TNET_ICE_CANDIDATE_COMPID_RTP 1
|
||||
#define TNET_ICE_CANDIDATE_COMPID_RTCP 2
|
||||
|
||||
#define TNET_ICE_CANDIDATE_FOUND_SIZE_PREF 8
|
||||
#define TNET_ICE_CANDIDATE_FOUND_SIZE_PREF 9
|
||||
|
||||
typedef enum tnet_ice_cand_type_e
|
||||
{
|
||||
|
|
|
@ -629,6 +629,11 @@ int tnet_ice_ctx_recv_stun_message(tnet_ice_ctx_t* self, const void* data, tsk_s
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!self->is_active){
|
||||
TSK_DEBUG_INFO("ICE context not active");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((message = tnet_stun_message_deserialize(data, size))){
|
||||
if(message->type == stun_binding_request){
|
||||
// check controlling flag
|
||||
|
|
|
@ -83,7 +83,7 @@ int tnet_ice_utils_create_sockets(tnet_socket_type_t socket_type, const char* lo
|
|||
|
||||
/* beacuse failure will cause errors in the log, print a message to alert that there is
|
||||
* nothing to worry about */
|
||||
TSK_DEBUG_INFO("RTP/RTCP manager[Begin]: Trying to bind to random ports");
|
||||
TSK_DEBUG_INFO("RTP/RTCP manager[Begin]: Trying to bind to random ports [%s:%d]", local_ip, local_port);
|
||||
|
||||
if(look4_rtp){
|
||||
if(!(*socket_rtp = tnet_socket_create(local_ip, local_port, socket_type))){
|
||||
|
|
|
@ -351,21 +351,21 @@ void tnet_stun_attribute_pad(const tnet_stun_attribute_t* attribute, tsk_buffer_
|
|||
|
||||
|
||||
tnet_stun_attribute_t* tnet_stun_attribute_create();
|
||||
tnet_stun_attribute_mapped_addr_t* tnet_stun_attribute_mapped_address_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_xmapped_addr_t* tnet_stun_attribute_xmapped_address_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_username_t* tnet_stun_attribute_username_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_integrity_t* tnet_stun_attribute_integrity_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_fingerprint_t* tnet_stun_attribute_fingerprint_create(uint32_t fingerprint);
|
||||
tnet_stun_attribute_errorcode_t* tnet_stun_attribute_errorcode_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_realm_t* tnet_stun_attribute_realm_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_nonce_t* tnet_stun_attribute_nonce_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_unknowns_t* tnet_stun_attribute_unknowns_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_software_t* tnet_stun_attribute_software_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_altserver_t* tnet_stun_attribute_altserver_create(const void* payload, tsk_size_t payload_size);
|
||||
tnet_stun_attribute_ice_priority_t* tnet_stun_attribute_ice_priority_create(uint32_t value);
|
||||
tnet_stun_attribute_ice_use_candidate_t* tnet_stun_attribute_ice_use_candidate_create();
|
||||
tnet_stun_attribute_ice_controlled_t* tnet_stun_attribute_ice_controlled_create(uint64_t value);
|
||||
tnet_stun_attribute_ice_controlling_t* tnet_stun_attribute_ice_controlling_create(uint64_t value);
|
||||
TINYNET_API tnet_stun_attribute_mapped_addr_t* tnet_stun_attribute_mapped_address_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_xmapped_addr_t* tnet_stun_attribute_xmapped_address_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_username_t* tnet_stun_attribute_username_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_integrity_t* tnet_stun_attribute_integrity_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_fingerprint_t* tnet_stun_attribute_fingerprint_create(uint32_t fingerprint);
|
||||
TINYNET_API tnet_stun_attribute_errorcode_t* tnet_stun_attribute_errorcode_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_realm_t* tnet_stun_attribute_realm_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_nonce_t* tnet_stun_attribute_nonce_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_unknowns_t* tnet_stun_attribute_unknowns_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_software_t* tnet_stun_attribute_software_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_altserver_t* tnet_stun_attribute_altserver_create(const void* payload, tsk_size_t payload_size);
|
||||
TINYNET_API tnet_stun_attribute_ice_priority_t* tnet_stun_attribute_ice_priority_create(uint32_t value);
|
||||
TINYNET_API tnet_stun_attribute_ice_use_candidate_t* tnet_stun_attribute_ice_use_candidate_create();
|
||||
TINYNET_API tnet_stun_attribute_ice_controlled_t* tnet_stun_attribute_ice_controlled_create(uint64_t value);
|
||||
TINYNET_API tnet_stun_attribute_ice_controlling_t* tnet_stun_attribute_ice_controlling_create(uint64_t value);
|
||||
|
||||
|
||||
TNET_END_DECLS
|
||||
|
|
|
@ -143,17 +143,6 @@ tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
|||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
/*=== Attributes === */
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
attribute = item->data;
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
tnet_stun_attribute_pad(attribute, output);
|
||||
}
|
||||
}
|
||||
|
||||
/* AUTHENTICATION */
|
||||
if(self->realm && self->nonce){ // long term
|
||||
SERIALIZE_N_ADD_ATTRIBUTE(realm, self->realm, tsk_strlen(self->realm));
|
||||
|
@ -169,6 +158,17 @@ tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
|||
SERIALIZE_N_ADD_ATTRIBUTE(username, self->username, tsk_strlen(self->username));
|
||||
}
|
||||
|
||||
/*=== Attributes === */
|
||||
{
|
||||
tsk_list_item_t *item;
|
||||
tsk_list_foreach(item, self->attributes)
|
||||
{
|
||||
attribute = item->data;
|
||||
tnet_stun_attribute_serialize(attribute, output);
|
||||
tnet_stun_attribute_pad(attribute, output);
|
||||
}
|
||||
}
|
||||
|
||||
/* Message Length: The message length MUST contain the size, in bytes, of the message
|
||||
not including the 20-byte STUN header.
|
||||
*/
|
||||
|
@ -214,6 +214,9 @@ tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
|||
SERIALIZE_N_ADD_ATTRIBUTE(integrity, hmac, TSK_SHA1_DIGEST_SIZE);
|
||||
}
|
||||
|
||||
// LENGTH
|
||||
*(((uint16_t*)output->data) + 1) = tnet_htons((output->size - TNET_STUN_HEADER_SIZE + (self->fingerprint ? 8 : 0)));
|
||||
|
||||
/* FINGERPRINT */
|
||||
if(self->fingerprint){//JINGLE_ICE
|
||||
/* RFC 5389 - 15.5. FINGERPRINT
|
||||
|
@ -231,9 +234,6 @@ tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *self)
|
|||
TSK_OBJECT_SAFE_FREE(attribute);
|
||||
}
|
||||
|
||||
// LENGTH
|
||||
*(((uint16_t*)output->data)+1) = tnet_htons(((output->size) - TNET_STUN_HEADER_SIZE));
|
||||
|
||||
bail:
|
||||
return output;
|
||||
}
|
||||
|
@ -457,14 +457,14 @@ static tsk_object_t* tnet_stun_message_ctor(tsk_object_t * self, va_list * app)
|
|||
|
||||
message->fingerprint = 1;
|
||||
message->integrity = 0;
|
||||
|
||||
|
||||
{ /* Create random transaction id */
|
||||
tsk_istr_t random;
|
||||
tsk_md5digest_t digest;
|
||||
|
||||
tsk_strrandom(&random);
|
||||
TSK_MD5_DIGEST_CALC(random, sizeof(random), digest);
|
||||
|
||||
|
||||
memcpy(message->transaction_id, digest, TNET_STUN_TRANSACID_SIZE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,10 +224,10 @@ tnet_stun_message_t;
|
|||
typedef tnet_stun_message_t tnet_stun_response_t;
|
||||
typedef tnet_stun_message_t tnet_stun_request_t;
|
||||
|
||||
tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *message);
|
||||
TINYNET_API tsk_buffer_t* tnet_stun_message_serialize(const tnet_stun_message_t *message);
|
||||
tnet_stun_message_t* tnet_stun_message_deserialize(const uint8_t *data, tsk_size_t size);
|
||||
tsk_bool_t tnet_stun_message_has_attribute(const tnet_stun_message_t *self, tnet_stun_attribute_type_t type);
|
||||
int tnet_stun_message_add_attribute(tnet_stun_message_t *self, tnet_stun_attribute_t** attribute);
|
||||
TINYNET_API int tnet_stun_message_add_attribute(tnet_stun_message_t *self, tnet_stun_attribute_t** attribute);
|
||||
int tnet_stun_message_remove_attribute(tnet_stun_message_t *self, tnet_stun_attribute_type_t type);
|
||||
const tnet_stun_attribute_t* tnet_stun_message_get_attribute(const tnet_stun_message_t *self, tnet_stun_attribute_type_t type);
|
||||
short tnet_stun_message_get_errorcode(const tnet_stun_message_t *self);
|
||||
|
@ -237,8 +237,8 @@ int32_t tnet_stun_message_get_lifetime(const tnet_stun_message_t *self);
|
|||
tsk_bool_t tnet_stun_message_transac_id_equals(const tnet_stun_transacid_t id1, const tnet_stun_transacid_t id2);
|
||||
|
||||
|
||||
tnet_stun_message_t* tnet_stun_message_create(const char* username, const char* password);
|
||||
tnet_stun_message_t* tnet_stun_message_create_null();
|
||||
TINYNET_API tnet_stun_message_t* tnet_stun_message_create(const char* username, const char* password);
|
||||
TINYNET_API tnet_stun_message_t* tnet_stun_message_create_null();
|
||||
|
||||
TINYNET_GEXTERN const tsk_object_def_t *tnet_stun_message_def_t;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ static tsk_object_t* tnet_socket_ctor(tsk_object_t * self, va_list * app)
|
|||
if(bindsocket){
|
||||
/* Bind the socket */
|
||||
if((status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen))){
|
||||
TNET_PRINT_LAST_ERROR("bind have failed.");
|
||||
TNET_PRINT_LAST_ERROR("bind to [%s:%s]have failed", local_hostname, port);
|
||||
tnet_socket_close(sock);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,8 @@ tnet_socket_type_t;
|
|||
/**@def TNET_SOCKET_IS_VALID
|
||||
* Checks the socket validity.
|
||||
*/
|
||||
#define TNET_SOCKET_IS_VALID(socket) ((socket) && (socket->type !=tnet_socket_type_invalid) && (socket)->fd >0)
|
||||
#define TNET_SOCKET_IS_VALID(socket) ((socket) && TNET_SOCKET_TYPE_IS_VALID((socket)->type) && (socket)->fd >0)
|
||||
#define TNET_SOCKET_TYPE_IS_VALID(type) ((type) !=tnet_socket_type_invalid)
|
||||
|
||||
#define TNET_SOCKET_TYPE_IS_STREAM(type) ( ((type & TNET_SOCKET_TYPE_UDP) != TNET_SOCKET_TYPE_UDP) )
|
||||
#define TNET_SOCKET_TYPE_IS_DGRAM(type) ( ((type & TNET_SOCKET_TYPE_UDP) == TNET_SOCKET_TYPE_UDP) )
|
||||
|
@ -152,7 +153,7 @@ tnet_socket_type_t;
|
|||
* @def TNET_SOCKET_PORT_ANY
|
||||
* Any port.
|
||||
*/
|
||||
#define TNET_SOCKET_HOST_ANY 0
|
||||
#define TNET_SOCKET_HOST_ANY tsk_null
|
||||
#define TNET_SOCKET_PORT_ANY 0
|
||||
|
||||
/**
|
||||
|
|
|
@ -237,7 +237,14 @@ int tnet_transport_get_public_ip_n_port(const tnet_transport_handle_t *handle, t
|
|||
}
|
||||
|
||||
if(!stun_ok){
|
||||
return tnet_transport_get_ip_n_port(handle, fd, ip, port);
|
||||
if(fd == TNET_INVALID_FD && transport->local_ip){
|
||||
memcpy(*ip, transport->local_ip, TSK_MIN(sizeof(tnet_ip_t), tsk_strlen(transport->local_ip)));
|
||||
*port = transport->bind_local_port;
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
return tnet_transport_get_ip_n_port(handle, fd, ip, port);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "tnet_poll.h"
|
||||
|
||||
#define TNET_MAX_FDS 64
|
||||
#define TNET_MAX_FDS 1024
|
||||
|
||||
/*== Socket description ==*/
|
||||
typedef struct transport_socket_s
|
||||
|
|
|
@ -367,12 +367,16 @@ tnet_addresses_L_t* tnet_get_addresses(tnet_family_t family, tsk_bool_t unicast,
|
|||
if((if_index != -1) && (pCurrAddresses->IfIndex != if_index && pCurrAddresses->Ipv6IfIndex != if_index)){
|
||||
goto next;
|
||||
}
|
||||
if(pCurrAddresses->OperStatus != IfOperStatusUp){
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* == UNICAST addresses == */
|
||||
pUnicast = pCurrAddresses->FirstUnicastAddress;
|
||||
while(unicast && pUnicast){
|
||||
//memset(ip, '\0', sizeof(ip));
|
||||
tnet_get_sockip(pUnicast->Address.lpSockaddr, &ip);
|
||||
TSK_DEBUG_INFO("Found local IP address = AdapterName=%s Ip=%s", pCurrAddresses->AdapterName, ip);
|
||||
{
|
||||
tnet_address_t *address = tnet_address_create(ip);
|
||||
address->family = pUnicast->Address.lpSockaddr->sa_family;
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#define RUN_TEST_SOCKETS 0 /* FIXME: Android */
|
||||
#define RUN_TEST_TRANSPORT 0
|
||||
#define RUN_TEST_AUTH 0
|
||||
#define RUN_TEST_STUN 0
|
||||
#define RUN_TEST_ICE 1
|
||||
#define RUN_TEST_STUN 1
|
||||
#define RUN_TEST_ICE 0
|
||||
#define RUN_TEST_NAT 0
|
||||
#define RUN_TEST_IFACES 0
|
||||
#define RUN_TEST_DNS 0
|
||||
|
|
|
@ -52,13 +52,14 @@ void test_ice()
|
|||
int ret;
|
||||
static const tsk_bool_t use_ipv6 = tsk_false;
|
||||
static const tsk_bool_t use_rtcp = tsk_true;
|
||||
|
||||
static const tsk_bool_t use_ice_jingle = tsk_false;
|
||||
static const tsk_bool_t use_video = tsk_false;
|
||||
|
||||
long a = tnet_htonl(0x6b0c76a7);
|
||||
long b = tnet_htonl(0x034aa76b);
|
||||
long c = tnet_htonl(0x510da598);
|
||||
|
||||
ctx = tnet_ice_ctx_create(use_ipv6, use_rtcp, tsk_false, tnet_ice_callback, tsk_null);
|
||||
|
||||
ctx = tnet_ice_ctx_create(use_ice_jingle, use_ipv6, use_rtcp, use_video, tnet_ice_callback, tsk_null);
|
||||
tnet_ice_ctx_set_userdata(ctx, ctx);
|
||||
ret = tnet_ice_ctx_set_stun(ctx, "numb.viagenie.ca", 3478, "Doubango", "bossiel@yahoo.fr", "stun-password");
|
||||
ret = tnet_ice_ctx_start(ctx);
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#ifndef TNET_TEST_STUN_H
|
||||
#define TNET_TEST_STUN_H
|
||||
|
||||
//#define STUN_SERVER_IP "numb.viagenie.ca"
|
||||
//#define STUN_SERVER_PORT TNET_STUN_TCP_UDP_DEFAULT_PORT
|
||||
//#define STUN_SERVER_PROTO tnet_socket_type_udp_ipv4
|
||||
#define STUN_SERVER_IP "numb.viagenie.ca"
|
||||
#define STUN_SERVER_PORT TNET_STUN_TCP_UDP_DEFAULT_PORT
|
||||
#define STUN_SERVER_PROTO tnet_socket_type_udp_ipv4
|
||||
|
||||
// http://tools.ietf.org/html/draft-ietf-behave-stun-test-vectors-04
|
||||
|
||||
|
@ -40,40 +40,52 @@ void test_stun_dump_transacid(tnet_stun_transacid_t transcid)
|
|||
|
||||
void test_sun_sendMessage()
|
||||
{
|
||||
/*tnet_stun_message_handle_t *message = 0;
|
||||
tsk_buffer_t *buffer = 0;
|
||||
tnet_socket_t *socket = 0;
|
||||
tnet_stun_message_t *message = tsk_null;
|
||||
tsk_buffer_t *buffer = tsk_null;
|
||||
tnet_socket_t *socket = tsk_null;
|
||||
struct sockaddr_storage to;
|
||||
tnet_stun_attribute_t* stun_att;
|
||||
|
||||
// iWHr7ZwbQ1F4wmtk6scSEz0n (INVITE)
|
||||
// HAfDCVGhskSe63eww0F3Y (200: audio)
|
||||
// TN1KUcINJorcx8PISekSL (200: video)
|
||||
|
||||
message = TNET_STUN_MESSAGE_CREATE();
|
||||
tnet_stun_message_set_type(message, tsm_binding_request);
|
||||
tnet_stun_message_set_random_transacid(message);
|
||||
message = tnet_stun_message_create("mI5gMSVZWlt6oZ7:wqQxm4bcpPM6cUTd", "HAfDCVGhskSe63eww0F3Y");
|
||||
message->type = stun_binding_request;
|
||||
// ICE-CONTROLLING
|
||||
if((stun_att = (tnet_stun_attribute_t*)tnet_stun_attribute_ice_controlling_create(11131939471334912422))){
|
||||
tnet_stun_message_add_attribute(message, &stun_att);
|
||||
}
|
||||
// USE-CANDIDATE
|
||||
if((stun_att = (tnet_stun_attribute_t*)tnet_stun_attribute_ice_use_candidate_create())){
|
||||
tnet_stun_message_add_attribute(message, &stun_att);
|
||||
}
|
||||
// PRIORITY
|
||||
if((stun_att = (tnet_stun_attribute_t*)tnet_stun_attribute_ice_priority_create(1845501695))){
|
||||
tnet_stun_message_add_attribute(message, &stun_att);
|
||||
}
|
||||
|
||||
if(!(buffer = tnet_stun_message_serialize(message)))
|
||||
{
|
||||
if(!(buffer = tnet_stun_message_serialize(message))){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
// Create blocking socket and bind it
|
||||
socket = tnet_socket_create_EX(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO, 0);
|
||||
if(!TNET_SOCKET_IS_VALID(socket))
|
||||
{
|
||||
socket = tnet_socket_create(TNET_SOCKET_HOST_ANY, TNET_SOCKET_PORT_ANY, STUN_SERVER_PROTO);
|
||||
if(!TNET_SOCKET_IS_VALID(socket)){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
// Create stun server's sockaddr structure
|
||||
if(tnet_sockaddr_init(STUN_SERVER_IP, STUN_SERVER_PORT, STUN_SERVER_PROTO, &to))
|
||||
{
|
||||
if(tnet_sockaddr_init(STUN_SERVER_IP, STUN_SERVER_PORT, STUN_SERVER_PROTO, &to)){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
tnet_socket_sendto(socket, (struct sockaddr*)&to, buffer->data, buffer->size);
|
||||
|
||||
tnet_sockfd_sendto(socket->fd, (struct sockaddr*)&to, buffer->data, buffer->size);
|
||||
|
||||
bail:
|
||||
TSK_OBJECT_SAFE_FREE(message);
|
||||
TSK_OBJECT_SAFE_FREE(socket);
|
||||
TSK_OBJECT_SAFE_FREE(buffer);*/
|
||||
TSK_OBJECT_SAFE_FREE(buffer);
|
||||
}
|
||||
|
||||
void test_stun_context()
|
||||
|
@ -105,8 +117,8 @@ void test_stun_context()
|
|||
void test_stun()
|
||||
{
|
||||
//test_stun_transacid();
|
||||
//test_sun_sendMessage();
|
||||
test_stun_context();
|
||||
test_sun_sendMessage();
|
||||
//test_stun_context();
|
||||
}
|
||||
|
||||
#endif /* TNET_TEST_STUN_H */
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
Optimization="2"
|
||||
EnableIntrinsicFunctions="false"
|
||||
AdditionalIncludeDirectories="src;"..\thirdparties\win32\include";"..\tinySAK\src""
|
||||
PreprocessorDefinitions="TNET_HAVE_OPENSSL_H=1;WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYNET_EXPORTS"
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_ERROR;TNET_HAVE_OPENSSL_H=1;WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYNET_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="false"
|
||||
UsePrecompiledHeader="0"
|
||||
|
|
|
@ -46,7 +46,15 @@
|
|||
TSK_BEGIN_DECLS
|
||||
|
||||
#define TSK_SAFE_FREE(ptr) (void)tsk_free((void**)(&ptr));
|
||||
#define TSK_FREE(ptr) TSK_SAFE_FREE(ptr)
|
||||
#define TSK_FREE(ptr) TSK_SAFE_FREE((ptr))
|
||||
#define TSK_SAFE_FREE_ARRAY(pptr, count){ \
|
||||
int __i; \
|
||||
for(__i = 0; __i < (count); ++__i) \
|
||||
TSK_SAFE_FREE((pptr)[__i]); \
|
||||
}
|
||||
#define TSK_FREE_ARRAY(pptr, count) TSK_SAFE_FREE_ARRAY((pptr), (count))
|
||||
#define TSK_SAFE_FREE_TABLE(pptr) TSK_SAFE_FREE_ARRAY((pptr), (sizeof((pptr))/sizeof((pptr)[0])))
|
||||
#define TSK_FREE_TABLE(pptr) TSK_SAFE_FREE_TABLE((pptr))
|
||||
|
||||
TINYSAK_API void* tsk_malloc(tsk_size_t size);
|
||||
TINYSAK_API void* tsk_realloc (void * ptr, tsk_size_t size);
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
TSK_BEGIN_DECLS
|
||||
|
||||
#define TSK_OBJECT(self) ((tsk_object_t*)(self))
|
||||
|
||||
/**@ingroup tsk_object_group
|
||||
* Plain object.
|
||||
*/
|
||||
|
@ -52,6 +54,13 @@ typedef void tsk_object_t;
|
|||
**/
|
||||
#define TSK_OBJECT_SAFE_FREE(self) if(self) tsk_object_unref(self), self = tsk_null
|
||||
|
||||
#define TSK_OBJECT_SAFE_FREE_ARRAY(self, count) { \
|
||||
int __i; \
|
||||
for(__i = 0; __i < (count); ++__i) \
|
||||
TSK_OBJECT_SAFE_FREE((self)[__i]); \
|
||||
}
|
||||
#define TSK_OBJECT_SAFE_FREE_TABLE(self) TSK_OBJECT_SAFE_FREE_ARRAY((self), (sizeof((self))/sizeof((self)[0])))
|
||||
|
||||
/**@ingroup tsk_object_group
|
||||
* tag a structure as an object. If this macro is used then you MUST
|
||||
* provide a constructor and a destructor functions into an object definition (or meta-data).
|
||||
|
|
|
@ -106,10 +106,11 @@ static uint32_t fcstab_32[256] =
|
|||
*/
|
||||
uint32_t tsk_pppfcs32(register uint32_t fcs, register const uint8_t* cp, register int32_t len)
|
||||
{
|
||||
while (len--){
|
||||
fcs = (((fcs) >> 8) ^ fcstab_32[((fcs) ^ (*cp++)) & 0xff]);
|
||||
int32_t n;
|
||||
for(n = 0; n < len; ++n){
|
||||
fcs = (fcs >> 8) ^ (fcstab_32[(fcs & 0xff) ^ cp[n]]);
|
||||
}
|
||||
|
||||
return (fcs);
|
||||
return (fcs ^0xffffffff);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(SolutionDir)\include";"$(DOUBANGO_HOME)\tinySAK\src""
|
||||
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;"$(SolutionDir)\include";..\..\tinySAK\src"
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
|
|
@ -65,8 +65,29 @@
|
|||
#define SDP_MSG2 \
|
||||
"v=0\r\n"
|
||||
|
||||
#define SDP_MSG3 \
|
||||
"v=0\r\n" \
|
||||
"o=lgevcs 1 1 IN IP4 192.168.1.115\r\n" \
|
||||
"s=-\r\n" \
|
||||
"c=IN IP4 192.168.1.115\r\n" \
|
||||
"b=AS:512\r\n" \
|
||||
"t=0 0\r\n" \
|
||||
"m=audio 2000 RTP/AVP 9 8 0 101\r\n" \
|
||||
"a=rtpmap:9 G722/8000\r\n" \
|
||||
"a=rtpmap:8 PCMA/8000\r\n" \
|
||||
"a=rtpmap:0 PCMU/8000\r\n" \
|
||||
"a=rtpmap:101 telephone-event/8000\r\n" \
|
||||
"a=fmtp:101 0-11,16\r\n" \
|
||||
"a=sendrecv\r\n" \
|
||||
"m=video 2002 RTP/AVP 34\r\n" \
|
||||
"b=TIAS:512000\r\n" \
|
||||
"a=content:main\r\n" \
|
||||
"a=rtpmap:34 H263/90000\r\n" \
|
||||
"a=fmtp:34 CIF=2\r\n" \
|
||||
"a=sendrecv\r\n"
|
||||
|
||||
#define SDP_MSG_TO_TEST SDP_MSG1
|
||||
|
||||
#define SDP_MSG_TO_TEST SDP_MSG3
|
||||
|
||||
void test_caps();
|
||||
void test_holdresume();
|
||||
|
@ -101,7 +122,7 @@ void test_parser()
|
|||
//
|
||||
// create empty message
|
||||
//
|
||||
if((message = tsdp_message_create_empty("127.0.0.1", tsk_false))){
|
||||
if((message = tsdp_message_create_empty("127.0.0.1", tsk_false, 1))){
|
||||
|
||||
/* add media */
|
||||
tsdp_message_add_media(message, "audio", 8956, "RTP/AVP",
|
||||
|
@ -146,7 +167,7 @@ void test_caps()
|
|||
tsdp_message_t *message = tsk_null;
|
||||
char* str;
|
||||
|
||||
if((message = tsdp_message_create_empty("100.3.6.6", tsk_false))){
|
||||
if((message = tsdp_message_create_empty("100.3.6.6", tsk_false, 1))){
|
||||
|
||||
tsdp_message_add_headers(message,
|
||||
TSDP_HEADER_C_VA_ARGS("IN", "IP4", "192.0.2.4"),
|
||||
|
|
|
@ -46,8 +46,6 @@ typedef struct tsip_transac_layer_s
|
|||
|
||||
const tsip_stack_handle_t *stack;
|
||||
|
||||
tsk_bool_t reliable;
|
||||
|
||||
tsip_transacs_L_t *transactions;
|
||||
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
#include "tinysip_config.h"
|
||||
|
||||
#include "tsip.h"
|
||||
|
||||
#include "tinysip/tsip_message.h"
|
||||
|
||||
#include "tnet_transport.h"
|
||||
|
@ -44,16 +42,39 @@
|
|||
|
||||
TSIP_BEGIN_DECLS
|
||||
|
||||
//#define TSIP_TRANSPORT_IS_SECURE(self) (self && )
|
||||
#define TSIP_TRANSPORT(self) ((tsip_transport_t*)(self))
|
||||
|
||||
enum {
|
||||
TSIP_TRANSPORT_IDX_UDP,
|
||||
TSIP_TRANSPORT_IDX_TCP,
|
||||
TSIP_TRANSPORT_IDX_TLS,
|
||||
TSIP_TRANSPORT_IDX_WS,
|
||||
TSIP_TRANSPORT_IDX_WSS,
|
||||
|
||||
TSIP_TRANSPORT_IDX_MAX
|
||||
};
|
||||
|
||||
typedef struct tsip_transport_idx_xs
|
||||
{
|
||||
int idx;
|
||||
const char* name;
|
||||
enum tnet_socket_type_e type;
|
||||
}
|
||||
tsip_transport_idx_xt;
|
||||
|
||||
const tsip_transport_idx_xt* tsip_transport_get_by_name(const char* name);
|
||||
int tsip_transport_get_idx_by_name(const char* name);
|
||||
|
||||
|
||||
typedef struct tsip_transport_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tsk_bool_t initialized;
|
||||
|
||||
const tsip_stack_t *stack;
|
||||
int32_t idx;
|
||||
|
||||
const struct tsip_stack_s *stack;
|
||||
|
||||
tnet_socket_type_t type;
|
||||
struct sockaddr_storage pcscf_addr;
|
||||
|
@ -73,10 +94,10 @@ typedef struct tsip_transport_s
|
|||
}
|
||||
tsip_transport_t;
|
||||
|
||||
#define TSIP_DECLARE_TRANSPORT tsip_transport_t transport
|
||||
#define TSIP_DECLARE_TRANSPORT tsip_transport_t __transport__
|
||||
typedef tsk_list_t tsip_transports_L_t; /**< List of @ref tsip_transport_t elements. */
|
||||
|
||||
int tsip_transport_init(tsip_transport_t* self, tnet_socket_type_t type, const tsip_stack_handle_t *stack, const char *host, tnet_port_t port, const char* description);
|
||||
int tsip_transport_init(tsip_transport_t* self, tnet_socket_type_t type, const struct tsip_stack_s *stack, const char *host, tnet_port_t port, const char* description);
|
||||
int tsip_transport_deinit(tsip_transport_t* self);
|
||||
|
||||
int tsip_transport_set_tlscerts(tsip_transport_t *self, const char* ca, const char* pbk, const char* pvk);
|
||||
|
@ -106,7 +127,7 @@ tsip_uri_t* tsip_transport_get_uri(const tsip_transport_t *self, int lr);
|
|||
|
||||
#define tsip_transport_shutdown(transport) (transport ? tnet_transport_shutdown(transport->net_transport) : -1)
|
||||
|
||||
tsip_transport_t* tsip_transport_create(tsip_stack_t* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description);
|
||||
tsip_transport_t* tsip_transport_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description);
|
||||
|
||||
TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_def_t;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct tsip_transport_ipsec_s
|
|||
}
|
||||
tsip_transport_ipsec_t;
|
||||
|
||||
tsip_transport_ipsec_t* tsip_transport_ipsec_create(tsip_stack_t* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description);
|
||||
tsip_transport_ipsec_t* tsip_transport_ipsec_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description);
|
||||
|
||||
int tsip_transport_ipsec_createTempSAs(tsip_transport_ipsec_t* self);
|
||||
int tsip_transport_ipsec_ensureTempSAs(tsip_transport_ipsec_t* self, const tsip_response_t *r401_407, int64_t expires);
|
||||
|
|
|
@ -52,6 +52,8 @@ typedef struct tsip_transport_layer_s
|
|||
tsip_transport_layer_t;
|
||||
|
||||
tsip_transport_layer_t* tsip_transport_layer_create(tsip_stack_t *stack);
|
||||
const tsip_transport_t* tsip_transport_layer_find_by_type(const tsip_transport_layer_t* self, tnet_socket_type_t type);
|
||||
const tsip_transport_t* tsip_transport_layer_find_by_idx(const tsip_transport_layer_t* self, int32_t idx);
|
||||
|
||||
int tsip_transport_layer_add(tsip_transport_layer_t* self, const char* local_host, tnet_port_t local_port, tnet_socket_type_t type, const char* description);
|
||||
int tsip_transport_layer_remove(tsip_transport_layer_t* self, const char* description);
|
||||
|
|
|
@ -146,6 +146,7 @@ typedef struct tsip_message_s
|
|||
tnet_fd_t local_fd;
|
||||
struct sockaddr_storage remote_addr; // Only valid for Dgram
|
||||
tsk_bool_t update;
|
||||
tsk_bool_t reliable;
|
||||
}
|
||||
tsip_message_t;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tinysip/tsip_ssession.h"
|
||||
#include "tinysip/tsip_timers.h"
|
||||
#include "tinysip/tsip_event.h"
|
||||
#include "tinysip/transports/tsip_transport.h"
|
||||
|
||||
#include "tinysip/tsip_uri.h"
|
||||
|
||||
|
@ -56,6 +57,17 @@ TSIP_BEGIN_DECLS
|
|||
typedef uint8_t amf_t[2];
|
||||
typedef uint8_t operator_id_t[16];
|
||||
|
||||
// @tinyWRAP
|
||||
typedef enum tsip_stack_mode_e
|
||||
{
|
||||
tsip_stack_mode_ua,
|
||||
tsip_stack_mode_p2p,
|
||||
tsip_stack_mode_mediaproxy,
|
||||
tsip_stack_mode_mcu
|
||||
}
|
||||
tsip_stack_mode_t;
|
||||
#define TSIP_STACK_MODE_IS_SERVER(stack) ((stack)->network.mode == tsip_stack_mode_mediaproxy || (stack)->network.mode == tsip_stack_mode_mcu)
|
||||
#define TSIP_STACK_MODE_IS_CLIENT(stack) (!TSIP_STACK_MODE_IS_SERVER((stack)))
|
||||
|
||||
typedef enum tsip_stack_param_type_e
|
||||
{
|
||||
|
@ -82,7 +94,7 @@ typedef enum tsip_stack_param_type_e
|
|||
tsip_pname_discovery_dhcp,
|
||||
tsip_pname_proxy_cscf,
|
||||
tsip_pname_dnsserver,
|
||||
tsip_pname_mode_server,
|
||||
tsip_pname_mode,
|
||||
|
||||
|
||||
/* === Security === */
|
||||
|
@ -332,15 +344,18 @@ int ret = tsip_stack_set(stack,
|
|||
TSIP_STACK_SET_NULL());
|
||||
* @endcode
|
||||
*/
|
||||
#define TSIP_STACK_SET_REALM(URI_STR) tsip_pname_realm, (const char*)URI_STR
|
||||
#define TSIP_STACK_SET_LOCAL_IP(IP_STR) tsip_pname_local_ip, (const char*)IP_STR
|
||||
#define TSIP_STACK_SET_LOCAL_PORT(PORT_UINT) tsip_pname_local_port, (unsigned)PORT_UINT
|
||||
#define TSIP_STACK_SET_AOR(IP_STR, PORT_UINT) tsip_pname_aor, (const char*)IP_STR, (unsigned)PORT_UINT
|
||||
#define TSIP_STACK_SET_DISCOVERY_NAPTR(ENABLED_BOOL) tsip_pname_discovery_naptr, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_DISCOVERY_DHCP(ENABLED_BOOL) tsip_pname_discovery_dhcp, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_REALM(URI_STR) tsip_pname_realm, (const char*)URI_STR
|
||||
#define TSIP_STACK_SET_LOCAL_IP_2(TRANSPORT_STR, IP_STR) tsip_pname_local_ip, (const char*)TRANSPORT_STR, (const char*)IP_STR
|
||||
#define TSIP_STACK_SET_LOCAL_PORT_2(TRANSPORT_STR, PORT_UINT) tsip_pname_local_port, (const char*)TRANSPORT_STR, (unsigned)PORT_UINT
|
||||
#define TSIP_STACK_SET_LOCAL_IP(IP_STR) TSIP_STACK_SET_LOCAL_IP_2(tsk_null, IP_STR)// @deprecated
|
||||
#define TSIP_STACK_SET_LOCAL_PORT(PORT_UINT) TSIP_STACK_SET_LOCAL_PORT_2(tsk_null, PORT_UINT)// @deprecated
|
||||
#define TSIP_STACK_SET_AOR_2(TRANSPORT_STR, IP_STR, PORT_UINT) tsip_pname_aor, (const char*)TRANSPORT_STR, (const char*)IP_STR, (unsigned)PORT_UINT
|
||||
#define TSIP_STACK_SET_AOR(IP_STR, PORT_UINT) TSIP_STACK_SET_AOR_2(tsk_null, IP_STR, PORT_UINT)// @deprecated
|
||||
#define TSIP_STACK_SET_DISCOVERY_NAPTR(ENABLED_BOOL) tsip_pname_discovery_naptr, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_DISCOVERY_DHCP(ENABLED_BOOL) tsip_pname_discovery_dhcp, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_PROXY_CSCF(FQDN_STR, PORT_UINT, TRANSPORT_STR, IP_VERSION_STR) tsip_pname_proxy_cscf, (const char*)FQDN_STR, (unsigned)PORT_UINT, (const char*)TRANSPORT_STR, (const char*)IP_VERSION_STR
|
||||
#define TSIP_STACK_SET_DNS_SERVER(IP_STR) tsip_pname_dnsserver, (const char*)IP_STR
|
||||
#define TSIP_STACK_SET_MODE_SERVER() tsip_pname_mode_server
|
||||
#define TSIP_STACK_SET_DNS_SERVER(IP_STR) tsip_pname_dnsserver, (const char*)IP_STR
|
||||
#define TSIP_STACK_SET_MODE(MODE_ENUM) tsip_pname_mode, (tsip_stack_mode_t)MODE_ENUM
|
||||
|
||||
/* === Security === */
|
||||
/**@ingroup tsip_stack_group
|
||||
|
@ -432,13 +447,14 @@ int ret = tsip_stack_set(stack,
|
|||
*
|
||||
* @sa @ref TSIP_STACK_SET_IPSEC_PARAMS()
|
||||
*/
|
||||
#define TSIP_STACK_SET_EARLY_IMS(ENABLED_BOOL) tsip_pname_early_ims, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_SECAGREE_IPSEC(ENABLED_BOOL) tsip_pname_secagree_ipsec, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_SECAGREE_TLS(ENABLED_BOOL) tsip_pname_secagree_tls, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_IMS_AKA_AMF(AMF_UINT16) tsip_pname_amf, (uint16_t)AMF_UINT16
|
||||
#define TSIP_STACK_SET_IMS_AKA_OPERATOR_ID(OPID_HEX_STR) tsip_pname_operator_id, (const char*)OPID_HEX_STR
|
||||
#define TSIP_STACK_SET_EARLY_IMS(ENABLED_BOOL) tsip_pname_early_ims, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_SECAGREE_IPSEC_2(TRANSPORT_STR, ENABLED_BOOL) tsip_pname_secagree_ipsec, (const char*)TRANSPORT_STR, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_SECAGREE_IPSEC(ENABLED_BOOL) TSIP_STACK_SET_SECAGREE_IPSEC_2(tsk_null, ENABLED_BOOL) // @deprecated
|
||||
#define TSIP_STACK_SET_SECAGREE_TLS(ENABLED_BOOL) tsip_pname_secagree_tls, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_STACK_SET_IMS_AKA_AMF(AMF_UINT16) tsip_pname_amf, (uint16_t)AMF_UINT16
|
||||
#define TSIP_STACK_SET_IMS_AKA_OPERATOR_ID(OPID_HEX_STR) tsip_pname_operator_id, (const char*)OPID_HEX_STR
|
||||
#define TSIP_STACK_SET_IPSEC_PARAMS(ALG_STR, EALG_STR, MODE_STR, PROTOCOL_STR) tsip_pname_ipsec_params, (const char*)ALG_STR, (const char*)EALG_STR, (const char*)MODE_STR, (const char*)PROTOCOL_STR
|
||||
#define TSIP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) tsip_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR
|
||||
#define TSIP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) tsip_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR
|
||||
|
||||
|
||||
/* === Headers === */
|
||||
|
@ -524,6 +540,7 @@ int ret = tsip_stack_set(stack,
|
|||
typedef struct tsip_stack_s
|
||||
{
|
||||
TSK_DECLARE_RUNNABLE;
|
||||
TSK_DECLARE_SAFEOBJ;
|
||||
|
||||
tsk_bool_t timer_mgr_started;
|
||||
tsk_bool_t started;
|
||||
|
@ -551,24 +568,26 @@ typedef struct tsip_stack_s
|
|||
|
||||
/* === Network === */
|
||||
struct{
|
||||
char *local_ip;
|
||||
tnet_port_t local_port;
|
||||
tsip_stack_mode_t mode;
|
||||
|
||||
char *proxy_cscf;
|
||||
tnet_port_t proxy_cscf_port;
|
||||
tnet_socket_type_t proxy_cscf_type;
|
||||
char *local_ip_[TSIP_TRANSPORT_IDX_MAX];
|
||||
tnet_port_t local_port_[TSIP_TRANSPORT_IDX_MAX];
|
||||
|
||||
char *proxy_cscf_[TSIP_TRANSPORT_IDX_MAX];
|
||||
tnet_port_t proxy_cscf_port_[TSIP_TRANSPORT_IDX_MAX];
|
||||
tnet_socket_type_t proxy_cscf_type_[TSIP_TRANSPORT_IDX_MAX];
|
||||
int32_t transport_idx_default;
|
||||
|
||||
tsip_uri_t *realm;
|
||||
|
||||
//! IP adddress and port to use as AOR (user-defined)
|
||||
struct{
|
||||
char* ip;
|
||||
tnet_port_t port;
|
||||
char* ip_[TSIP_TRANSPORT_IDX_MAX];
|
||||
tnet_port_t port_[TSIP_TRANSPORT_IDX_MAX];
|
||||
} aor;
|
||||
|
||||
|
||||
tsk_bool_t discovery_naptr;
|
||||
tsk_bool_t discovery_dhcp;
|
||||
tsk_bool_t mode_server;
|
||||
} network;
|
||||
|
||||
/* === Security === */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "tinysip/dialogs/tsip_dialog_layer.h"
|
||||
#include "tinysip/transactions/tsip_transac_layer.h"
|
||||
#include "tinysip/transports/tsip_transport_layer.h"
|
||||
|
||||
#include "tinysip/transactions/tsip_transac_nict.h"
|
||||
|
||||
|
@ -54,7 +55,7 @@
|
|||
int tsip_dialog_update_challenges(tsip_dialog_t *self, const tsip_response_t* response, tsk_bool_t acceptNewVector);
|
||||
int tsip_dialog_add_common_headers(const tsip_dialog_t *self, tsip_request_t* request);
|
||||
|
||||
extern tsip_uri_t* tsip_stack_get_pcscf_uri(const tsip_stack_t *self, tsk_bool_t lr);
|
||||
extern tsip_uri_t* tsip_stack_get_pcscf_uri(const tsip_stack_t *self, tnet_socket_type_t type, tsk_bool_t lr);
|
||||
extern tsip_uri_t* tsip_stack_get_contacturi(const tsip_stack_t *self, const char* protocol);
|
||||
|
||||
tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* method)
|
||||
|
@ -351,7 +352,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
|
|||
*/
|
||||
#if _DEBUG && defined(SDS_HACK)/* FIXME: remove this */
|
||||
/* Ericsson SDS hack (INVITE with Proxy-CSCF as First route fail) */
|
||||
#else
|
||||
#elif 0
|
||||
tsip_uri_t *uri = tsip_stack_get_pcscf_uri(TSIP_DIALOG_GET_STACK(self), tsk_true);
|
||||
// Proxy-CSCF as first route
|
||||
if(uri){
|
||||
|
@ -421,20 +422,41 @@ int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request)
|
|||
As this is an outgoing request ==> It shall be a client transaction (NICT or ICT).
|
||||
For server transactions creation see @ref tsip_dialog_response_send.
|
||||
*/
|
||||
tsip_transac_t *transac = tsip_transac_layer_new(layer, tsk_true, request, TSIP_DIALOG(self));
|
||||
const tsk_bool_t isCT = tsk_true;
|
||||
tsip_transac_t *transac;
|
||||
const tsk_param_t *ws_src_ip, *ws_src_port;
|
||||
|
||||
/* Set the transaction's dialog. All events comming from the transaction (timeouts, errors ...) will be signaled to this dialog.
|
||||
*/
|
||||
// TSK_DEBUG_ERROR("Code not checked");
|
||||
if(self->uri_remote_target
|
||||
&& (ws_src_ip = tsk_params_get_param_by_name(self->uri_remote_target->params, "ws-src-ip"))
|
||||
&& (ws_src_port = tsk_params_get_param_by_name(self->uri_remote_target->params, "ws-src-port")))
|
||||
{
|
||||
// request->reliable
|
||||
}
|
||||
else{
|
||||
// FIXME: not correct but for now it's correct as we always use ONE transport for "ua" mode
|
||||
const tsip_transport_t* transport = tsip_transport_layer_find_by_idx(TSIP_DIALOG_GET_STACK(self)->layer_transport, TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default);
|
||||
if(!transport){
|
||||
TSK_DEBUG_ERROR("Failed to find a valid default transport [%d]", TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default);
|
||||
}
|
||||
else{
|
||||
request->reliable = TNET_SOCKET_TYPE_IS_STREAM(transport->type);
|
||||
}
|
||||
}
|
||||
|
||||
transac = tsip_transac_layer_new(layer, isCT, request, TSIP_DIALOG(self));
|
||||
|
||||
/* Set the transaction's dialog. All events comming from the transaction (timeouts, errors ...) will be signaled to this dialog */
|
||||
if(transac){
|
||||
switch(transac->type)
|
||||
{
|
||||
case tsip_ict:
|
||||
case tsip_nict:
|
||||
{
|
||||
/* Start the newly create IC/NIC transaction */
|
||||
ret = tsip_transac_start(transac, request);
|
||||
break;
|
||||
}
|
||||
case tsip_ict:
|
||||
case tsip_nict:
|
||||
{
|
||||
/* Start the newly create IC/NIC transaction */
|
||||
ret = tsip_transac_start(transac, request);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tsk_object_unref(transac);
|
||||
}
|
||||
|
|
|
@ -460,11 +460,12 @@ int tsip_dialog_invite_process_ro(tsip_dialog_invite_t *self, const tsip_message
|
|||
|
||||
/* Create session Manager if not already done */
|
||||
if(!self->msession_mgr){
|
||||
int32_t transport_idx = TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default;
|
||||
TSIP_DIALOG_GET_SS(self)->media.type = new_media_type;
|
||||
self->msession_mgr = tmedia_session_mgr_create(TSIP_DIALOG_GET_SS(self)->media.type, TSIP_DIALOG_GET_STACK(self)->network.local_ip,
|
||||
TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type), (sdp_ro == tsk_null));
|
||||
self->msession_mgr = tmedia_session_mgr_create(TSIP_DIALOG_GET_SS(self)->media.type, TSIP_DIALOG_GET_STACK(self)->network.local_ip_[transport_idx],
|
||||
TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type_[transport_idx]), (sdp_ro == tsk_null));
|
||||
if(TSIP_DIALOG_GET_STACK(self)->natt.ctx){
|
||||
tmedia_session_mgr_set_natt_ctx(self->msession_mgr, TSIP_DIALOG_GET_STACK(self)->natt.ctx, TSIP_DIALOG_GET_STACK(self)->network.aor.ip);
|
||||
tmedia_session_mgr_set_natt_ctx(self->msession_mgr, TSIP_DIALOG_GET_STACK(self)->natt.ctx, TSIP_DIALOG_GET_STACK(self)->network.aor.ip_[transport_idx]);
|
||||
}
|
||||
ret = tmedia_session_mgr_set_ice_ctx(self->msession_mgr, self->ice.ctx_audio, self->ice.ctx_video);
|
||||
}
|
||||
|
@ -1638,7 +1639,11 @@ static tsk_object_t* tsip_dialog_invite_ctor(tsk_object_t * self, va_list * app)
|
|||
dialog->supported.norefersub = tsk_true;
|
||||
dialog->required.ice = (((tsip_ssession_t*)ss)->media.profile == tmedia_profile_rtcweb);
|
||||
dialog->supported.ice = (dialog->required.ice || ((tsip_ssession_t*)ss)->media.enable_ice);
|
||||
#if 0 /* This was a patch for chrome but no longer needed when using version 23.0.1271.64 or later */
|
||||
dialog->ice.is_jingle = (((tsip_ssession_t*)ss)->media.profile == tmedia_profile_rtcweb);
|
||||
#else
|
||||
dialog->ice.is_jingle = tsk_false;
|
||||
#endif
|
||||
dialog->use_rtcp = (((tsip_ssession_t*)ss)->media.profile == tmedia_profile_rtcweb) ? tsk_true : ((tsip_ssession_t*)ss)->media.enable_rtcp;
|
||||
dialog->use_rtcpmux = (((tsip_ssession_t*)ss)->media.profile == tmedia_profile_rtcweb) ? tsk_true : ((tsip_ssession_t*)ss)->media.enable_rtcpmux;
|
||||
|
||||
|
|
|
@ -126,11 +126,12 @@ int c0000_Started_2_Outgoing_X_oINVITE(va_list *app)
|
|||
action = va_arg(*app, const tsip_action_t *);
|
||||
|
||||
/* This is the first FSM transaction when you try to make an audio/video/msrp call */
|
||||
if(!self->msession_mgr){
|
||||
if(!self->msession_mgr){
|
||||
int32_t transport_idx = TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default;
|
||||
self->msession_mgr = tmedia_session_mgr_create(action ? action->media.type : tmedia_all,
|
||||
TSIP_DIALOG_GET_STACK(self)->network.local_ip, TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type), tsk_true);
|
||||
TSIP_DIALOG_GET_STACK(self)->network.local_ip_[transport_idx], TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type_[transport_idx]), tsk_true);
|
||||
if(TSIP_DIALOG_GET_STACK(self)->natt.ctx){
|
||||
ret = tmedia_session_mgr_set_natt_ctx(self->msession_mgr, TSIP_DIALOG_GET_STACK(self)->natt.ctx, TSIP_DIALOG_GET_STACK(self)->network.aor.ip);
|
||||
ret = tmedia_session_mgr_set_natt_ctx(self->msession_mgr, TSIP_DIALOG_GET_STACK(self)->natt.ctx, TSIP_DIALOG_GET_STACK(self)->network.aor.ip_[transport_idx]);
|
||||
}
|
||||
|
||||
ret = tmedia_session_mgr_set_ice_ctx(self->msession_mgr, self->ice.ctx_audio, self->ice.ctx_video);
|
||||
|
|
|
@ -113,13 +113,14 @@ int tsip_dialog_invite_ice_timers_set(tsip_dialog_invite_t *self, int64_t timeou
|
|||
|
||||
static int tsip_dialog_invite_ice_create_ctx(tsip_dialog_invite_t * self, tmedia_type_t media_type)
|
||||
{
|
||||
int32_t transport_idx;
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
transport_idx = TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default;
|
||||
if(!self->ice.ctx_audio && (media_type & tmedia_audio)){
|
||||
self->ice.ctx_audio = tnet_ice_ctx_create(self->ice.is_jingle, TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type),
|
||||
self->ice.ctx_audio = tnet_ice_ctx_create(self->ice.is_jingle, TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type_[transport_idx]),
|
||||
self->use_rtcp, tsk_false, tsip_dialog_invite_ice_audio_callback, self);
|
||||
if(!self->ice.ctx_audio){
|
||||
TSK_DEBUG_ERROR("Failed to create ICE audio context");
|
||||
|
@ -129,7 +130,7 @@ static int tsip_dialog_invite_ice_create_ctx(tsip_dialog_invite_t * self, tmedia
|
|||
tnet_ice_ctx_set_rtcpmux(self->ice.ctx_audio, self->use_rtcpmux);
|
||||
}
|
||||
if(!self->ice.ctx_video && (media_type & tmedia_video)){
|
||||
self->ice.ctx_video = tnet_ice_ctx_create(self->ice.is_jingle, TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type),
|
||||
self->ice.ctx_video = tnet_ice_ctx_create(self->ice.is_jingle, TNET_SOCKET_TYPE_IS_IPV6(TSIP_DIALOG_GET_STACK(self)->network.proxy_cscf_type_[transport_idx]),
|
||||
self->use_rtcp, tsk_true, tsip_dialog_invite_ice_video_callback, self);
|
||||
if(!self->ice.ctx_video){
|
||||
TSK_DEBUG_ERROR("Failed to create ICE video context");
|
||||
|
|
|
@ -422,11 +422,12 @@ int tsip_dialog_layer_handle_incoming_msg(const tsip_dialog_layer_t *self, const
|
|||
goto bail;
|
||||
}
|
||||
else{
|
||||
transac = tsip_transac_layer_new(layer_transac, tsk_false, message, TSIP_DIALOG(dialog));
|
||||
static const tsk_bool_t isCT = tsk_false;
|
||||
transac = tsip_transac_layer_new(layer_transac, isCT, message, TSIP_DIALOG(dialog));
|
||||
tsk_object_unref(dialog);
|
||||
}
|
||||
}
|
||||
else{
|
||||
else{
|
||||
if(TSIP_MESSAGE_IS_REQUEST(message)){
|
||||
tsip_ssession_t* ss = tsk_null;
|
||||
tsip_dialog_t* newdialog = tsk_null;
|
||||
|
@ -478,7 +479,8 @@ int tsip_dialog_layer_handle_incoming_msg(const tsip_dialog_layer_t *self, const
|
|||
|
||||
// for new dialog, create a new transac and start it later
|
||||
if(newdialog){
|
||||
transac = tsip_transac_layer_new(layer_transac, tsk_false, message, newdialog);
|
||||
static const tsk_bool_t isCT = tsk_false;
|
||||
transac = tsip_transac_layer_new(layer_transac, isCT, message, newdialog);
|
||||
tsk_list_push_back_data(self->dialogs, (void**)&newdialog); /* add new dialog to the layer */
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,14 @@ static int s0000_Connected_2_Terminated_X_iREGISTER(va_list *app);
|
|||
/* ======================== conds ======================== */
|
||||
static tsk_bool_t _fsm_cond_not_served_here(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
#if 0 // FIXME: Have to disabled only when in proxy mode
|
||||
if(message && TSIP_REQUEST_IS_REGISTER(message)){
|
||||
if(tsk_object_cmp(TSIP_DIALOG_GET_STACK(dialog)->network.realm, message->line.request.uri) != 0){
|
||||
tsip_dialog_register_send_RESPONSE(dialog, TSIP_MESSAGE_AS_REQUEST(message), 404, "Domain not served here");
|
||||
return tsk_true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return tsk_false;
|
||||
}
|
||||
static tsk_bool_t _fsm_cond_server_unregistering(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
|
@ -78,6 +80,10 @@ int tsip_dialog_register_server_init(tsip_dialog_register_t *self)
|
|||
*/
|
||||
// Incoming -> (Accept) -> Connected
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Incoming, _fsm_action_accept, _fsm_state_Connected, s0000_Incoming_2_Connected_X_Accept, "s0000_Incoming_2_Connected_X_Accept"),
|
||||
// Incoming -> (iRegister) -> Incoming
|
||||
TSK_FSM_ADD(_fsm_state_Incoming, _fsm_action_iREGISTER, _fsm_cond_server_registering, _fsm_state_Incoming, tsk_null, "s0000_Incoming_2_Incoming_X_iREGISTER"),
|
||||
// Incoming -> (iRegister, expires=0) -> Terminated
|
||||
TSK_FSM_ADD(_fsm_state_Incoming, _fsm_action_iREGISTER, _fsm_cond_server_unregistering, _fsm_state_Terminated, tsk_null, "s0000_Incoming_2_Terminated_X_iREGISTER"),
|
||||
// Incoming -> (Reject) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Incoming, _fsm_action_reject, _fsm_state_Terminated, s0000_Incoming_2_Terminated_X_Reject, "s0000_Incoming_2_Terminated_X_Reject"),
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ int tsip_transac_deinit(tsip_transac_t *self)
|
|||
TSK_OBJECT_SAFE_FREE(self->dialog);
|
||||
|
||||
self->initialized = tsk_false;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
@ -129,14 +129,29 @@ int tsip_transac_cmp(const tsip_transac_t *t1, const tsip_transac_t *t2)
|
|||
|
||||
int tsip_transac_remove(const tsip_transac_t* self)
|
||||
{
|
||||
return tsip_transac_layer_remove(TSIP_TRANSAC_GET_STACK(self)->layer_transac, TSIP_TRANSAC(self));
|
||||
int ret;
|
||||
tsip_transac_t* safe_copy;
|
||||
|
||||
safe_copy = (tsip_transac_t*)tsk_object_ref(TSK_OBJECT(self));
|
||||
ret = tsip_transac_layer_remove(TSIP_TRANSAC_GET_STACK(self)->layer_transac, safe_copy);
|
||||
tsk_object_unref(safe_copy);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tsip_transac_fsm_act(tsip_transac_t* self, tsk_fsm_action_id action_id, const tsip_message_t* message)
|
||||
{
|
||||
int ret;
|
||||
tsip_transac_t* safe_copy;
|
||||
|
||||
if(!self || !self->fsm){
|
||||
TSK_DEBUG_WARN("Invalid parameter.");
|
||||
return -1;
|
||||
}
|
||||
return tsk_fsm_act(self->fsm, action_id, self, message, self, message);
|
||||
|
||||
safe_copy = tsk_object_ref(TSK_OBJECT(self));
|
||||
ret = tsk_fsm_act(self->fsm, action_id, safe_copy, message, self, message);
|
||||
tsk_object_unref(safe_copy);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -57,22 +57,22 @@ tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, tsk_boo
|
|||
{
|
||||
if(TSIP_REQUEST_IS_INVITE(msg)){
|
||||
// INVITE Client transaction (ICT)
|
||||
transac = (tsip_transac_t *)tsip_transac_ict_create(self->reliable, msg->CSeq->seq, msg->Call_ID->value, dialog);
|
||||
transac = (tsip_transac_t *)tsip_transac_ict_create(msg->reliable, msg->CSeq->seq, msg->Call_ID->value, dialog);
|
||||
}
|
||||
else{
|
||||
// NON-INVITE Client transaction (NICT)
|
||||
transac = (tsip_transac_t *)tsip_transac_nict_create(self->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value, dialog);
|
||||
transac = (tsip_transac_t *)tsip_transac_nict_create(msg->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value, dialog);
|
||||
}
|
||||
}
|
||||
else /* Server transaction */
|
||||
{
|
||||
if(TSIP_REQUEST_IS_INVITE(msg)){
|
||||
// INVITE Server transaction (IST)
|
||||
transac = (tsip_transac_t *)tsip_transac_ist_create(self->reliable, msg->CSeq->seq, msg->Call_ID->value, dialog);
|
||||
transac = (tsip_transac_t *)tsip_transac_ist_create(msg->reliable, msg->CSeq->seq, msg->Call_ID->value, dialog);
|
||||
}
|
||||
else{
|
||||
// NON-INVITE Server transaction (NIST)
|
||||
transac = (tsip_transac_t *)tsip_transac_nist_create(self->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value, dialog);
|
||||
transac = (tsip_transac_t *)tsip_transac_nist_create(msg->reliable, msg->CSeq->seq, msg->CSeq->method, msg->Call_ID->value, dialog);
|
||||
}
|
||||
|
||||
if(transac){ /* Copy branch from the message */
|
||||
|
|
|
@ -207,6 +207,8 @@ int tsip_transac_nist_init(tsip_transac_nist_t *self)
|
|||
/*=======================
|
||||
* === Trying ===
|
||||
*/
|
||||
// Trying -> (receive request retransmission) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_request, _fsm_state_Trying, tsk_null, "tsip_transac_nist_Trying_2_Trying_X_request"),
|
||||
// Trying -> (send 1xx) -> Proceeding
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_send_1xx, _fsm_state_Proceeding, tsip_transac_nist_Trying_2_Proceeding_X_send_1xx, "tsip_transac_nist_Trying_2_Proceeding_X_send_1xx"),
|
||||
// Trying -> (send 200 to 699) -> Completed
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2011 Mamadou Diop.
|
||||
* Copyright (C) 2012 Doubango Telecom
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
|
@ -23,9 +22,6 @@
|
|||
/**@file tsip_transport.c
|
||||
* @brief SIP transport.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
|
||||
*
|
||||
|
||||
*/
|
||||
#include "tinysip/transports/tsip_transport.h"
|
||||
|
||||
|
@ -39,10 +35,48 @@
|
|||
#include "tsk_buffer.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
|
||||
static const tsip_transport_idx_xt _tsip_transport_idxs_xs[TSIP_TRANSPORT_IDX_MAX] =
|
||||
{
|
||||
{ TSIP_TRANSPORT_IDX_UDP, "UDP", TNET_SOCKET_TYPE_UDP },
|
||||
{ TSIP_TRANSPORT_IDX_TCP, "TCP", TNET_SOCKET_TYPE_TCP },
|
||||
{ TSIP_TRANSPORT_IDX_TLS, "TLS", TNET_SOCKET_TYPE_TLS },
|
||||
{ TSIP_TRANSPORT_IDX_WS, "WS", TNET_SOCKET_TYPE_WS },
|
||||
{ TSIP_TRANSPORT_IDX_WSS, "WSS", TNET_SOCKET_TYPE_WSS },
|
||||
};
|
||||
|
||||
const tsip_transport_idx_xt* tsip_transport_get_by_name(const char* name)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < TSIP_TRANSPORT_IDX_MAX; ++i){
|
||||
if(tsk_striequals(_tsip_transport_idxs_xs[i].name, name)){
|
||||
return &_tsip_transport_idxs_xs[i];
|
||||
}
|
||||
}
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
// returns -1 if not exist
|
||||
int tsip_transport_get_idx_by_name(const char* name)
|
||||
{
|
||||
const tsip_transport_idx_xt* t_idx = tsip_transport_get_by_name(name);
|
||||
return t_idx? t_idx->idx : -1;
|
||||
}
|
||||
|
||||
/* creates new SIP transport */
|
||||
tsip_transport_t* tsip_transport_create(tsip_stack_t* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description)
|
||||
{
|
||||
return tsk_object_new(tsip_transport_def_t, stack, host, port, type, description);
|
||||
tsip_transport_t* transport;
|
||||
if((transport = tsk_object_new(tsip_transport_def_t, stack, host, port, type, description))){
|
||||
int i;
|
||||
for(i = 0; i < sizeof(_tsip_transport_idxs_xs)/sizeof(_tsip_transport_idxs_xs[0]); ++i){
|
||||
if(_tsip_transport_idxs_xs[i].type & type){
|
||||
transport->idx = _tsip_transport_idxs_xs[i].idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return transport;
|
||||
}
|
||||
|
||||
/* add Via header using the transport config */
|
||||
|
@ -107,14 +141,17 @@ int tsip_transport_addvia(const tsip_transport_t* self, const char *branch, tsip
|
|||
int tsip_transport_msg_update_aor(tsip_transport_t* self, tsip_message_t *msg)
|
||||
{
|
||||
int ret = 0;
|
||||
int32_t transport_idx;
|
||||
|
||||
/* already updtated (e.g. retrans)? */
|
||||
if(!msg->update){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
transport_idx = self->stack->network.transport_idx_default;
|
||||
|
||||
/* retrieves the transport ip address and port */
|
||||
if(!self->stack->network.aor.ip && !self->stack->network.aor.port){
|
||||
if(!self->stack->network.aor.ip_[0] && !self->stack->network.aor.port_[transport_idx]){
|
||||
tnet_ip_t ip = {0};
|
||||
tnet_port_t port = 0;
|
||||
|
||||
|
@ -123,16 +160,16 @@ int tsip_transport_msg_update_aor(tsip_transport_t* self, tsip_message_t *msg)
|
|||
return ret;
|
||||
}
|
||||
else{
|
||||
((tsip_stack_t*)self->stack)->network.aor.ip = tsk_strdup(ip);
|
||||
((tsip_stack_t*)self->stack)->network.aor.port = port;
|
||||
((tsip_stack_t*)self->stack)->network.aor.ip_[transport_idx] = tsk_strdup(ip);
|
||||
((tsip_stack_t*)self->stack)->network.aor.port_[transport_idx] = port;
|
||||
}
|
||||
}
|
||||
|
||||
/* === Host and port === */
|
||||
if(msg->Contact && msg->Contact->uri){
|
||||
tsk_strupdate(&(msg->Contact->uri->scheme), self->scheme);
|
||||
tsk_strupdate(&(msg->Contact->uri->host), self->stack->network.aor.ip);
|
||||
msg->Contact->uri->port = self->stack->network.aor.port;
|
||||
tsk_strupdate(&(msg->Contact->uri->host), self->stack->network.aor.ip_[transport_idx]);
|
||||
msg->Contact->uri->port = self->stack->network.aor.port_[transport_idx];
|
||||
|
||||
msg->Contact->uri->host_type = TNET_SOCKET_TYPE_IS_IPV6(self->type) ? host_ipv6 : host_ipv4; /* for serializer ...who know? */
|
||||
tsk_params_add_param(&msg->Contact->uri->params, "transport", self->protocol);
|
||||
|
@ -340,7 +377,10 @@ tsk_size_t tsip_transport_send(const tsip_transport_t* self, const char *branch,
|
|||
}
|
||||
|
||||
/* === Send the message === */
|
||||
if(TNET_SOCKET_TYPE_IS_IPSEC(self->type)){
|
||||
if(TNET_SOCKET_TYPE_IS_WS(self->type) || TNET_SOCKET_TYPE_IS_WSS(self->type)){
|
||||
ret = tsip_transport_send_raw_ws(self, msg->local_fd, buffer->data, buffer->size);
|
||||
}
|
||||
else if(TNET_SOCKET_TYPE_IS_IPSEC(self->type)){
|
||||
tnet_fd_t fd = tsip_transport_ipsec_getFD(TSIP_TRANSPORT_IPSEC(self), TSIP_MESSAGE_IS_REQUEST(msg));
|
||||
if(fd != TNET_INVALID_FD){
|
||||
//struct sockaddr_storage to;
|
||||
|
@ -351,25 +391,14 @@ tsk_size_t tsip_transport_send(const tsip_transport_t* self, const char *branch,
|
|||
}
|
||||
}
|
||||
else{
|
||||
if(self->stack->network.mode_server){
|
||||
if(TNET_SOCKET_TYPE_IS_WS(self->type) || TNET_SOCKET_TYPE_IS_WSS(self->type)){
|
||||
ret = tsip_transport_send_raw_ws(self, msg->local_fd, buffer->data, buffer->size);
|
||||
}
|
||||
else{
|
||||
ret = tsip_transport_send_raw(self, (const struct sockaddr*)&msg->remote_addr, buffer->data, buffer->size);
|
||||
const struct sockaddr_storage* to = tsk_null;
|
||||
struct sockaddr_storage destAddr;
|
||||
if(destIP && destPort){
|
||||
if(tnet_sockaddr_init(destIP, destPort, self->type, &destAddr) == 0){
|
||||
to = &destAddr;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// always send to the Proxy-CSCF
|
||||
const struct sockaddr_storage* to = tsk_null;
|
||||
struct sockaddr_storage destAddr;
|
||||
if(destIP && destPort){
|
||||
if(tnet_sockaddr_init(destIP, destPort, self->type, &destAddr) == 0){
|
||||
to = &destAddr;
|
||||
}
|
||||
}
|
||||
ret = tsip_transport_send_raw(self, (const struct sockaddr*)to, buffer->data, buffer->size);
|
||||
}
|
||||
ret = tsip_transport_send_raw(self, (const struct sockaddr*)to, buffer->data, buffer->size);
|
||||
}
|
||||
|
||||
//bail:
|
||||
|
@ -395,9 +424,9 @@ tsip_uri_t* tsip_transport_get_uri(const tsip_transport_t *self, tsk_bool_t lr)
|
|||
tsk_sprintf(&uristring, "%s:%s%s%s:%d;%s;transport=%s",
|
||||
self->scheme,
|
||||
ipv6 ? "[" : "",
|
||||
((tsip_stack_t*)self->stack)->network.aor.ip,
|
||||
((tsip_stack_t*)self->stack)->network.aor.ip_[self->idx],
|
||||
ipv6 ? "]" : "",
|
||||
((tsip_stack_t*)self->stack)->network.aor.port,
|
||||
((tsip_stack_t*)self->stack)->network.aor.port_[self->idx],
|
||||
lr ? "lr" : "",
|
||||
self->protocol);
|
||||
if(uristring){
|
||||
|
@ -413,7 +442,7 @@ tsip_uri_t* tsip_transport_get_uri(const tsip_transport_t *self, tsk_bool_t lr)
|
|||
}
|
||||
|
||||
|
||||
int tsip_transport_init(tsip_transport_t* self, tnet_socket_type_t type, const tsip_stack_handle_t *stack, const char *host, tnet_port_t port, const char* description)
|
||||
int tsip_transport_init(tsip_transport_t* self, tnet_socket_type_t type, const struct tsip_stack_s *stack, const char *host, tnet_port_t port, const char* description)
|
||||
{
|
||||
if(!self || self->initialized){
|
||||
return -1;
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "tinysip/headers/tsip_header_Security_Client.h"
|
||||
#include "tinysip/headers/tsip_header_Security_Server.h"
|
||||
|
||||
#include "tsip.h"
|
||||
|
||||
#include "tnet_socket.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
|
@ -47,7 +49,7 @@ tsip_ipsec_association_t* tsip_ipsec_association_create(const tsip_transport_t*
|
|||
return tsk_object_new(tsip_ipsec_association_def_t, transport);
|
||||
}
|
||||
|
||||
tsip_transport_ipsec_t* tsip_transport_ipsec_create(tsip_stack_t* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description)
|
||||
tsip_transport_ipsec_t* tsip_transport_ipsec_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description)
|
||||
{
|
||||
return tsk_object_new(tsip_transport_ipsec_def_t, stack, host, port, type, description);
|
||||
}
|
||||
|
@ -370,7 +372,7 @@ static tsk_object_t* tsip_transport_ipsec_ctor(tsk_object_t * self, va_list * ap
|
|||
{
|
||||
tsip_transport_ipsec_t *transport = self;
|
||||
if(transport){
|
||||
const tsip_stack_handle_t *stack = va_arg(*app, const tsip_stack_handle_t*);
|
||||
const struct tsip_stack_s *stack = va_arg(*app, const struct tsip_stack_s*);
|
||||
const char *host = va_arg(*app, const char*);
|
||||
#if defined(__GNUC__)
|
||||
tnet_port_t port = (tnet_port_t)va_arg(*app, unsigned);
|
||||
|
@ -474,7 +476,11 @@ static tsk_object_t* tsip_ipsec_association_ctor(tsk_object_t * self, va_list *
|
|||
tipsec_set_local(association->ctx, ip_local, ip_remote, association->socket_uc->port, association->socket_us->port);
|
||||
}
|
||||
else{
|
||||
tipsec_set_local(association->ctx, ip_local, transport->stack->network.proxy_cscf, association->socket_uc->port, association->socket_us->port);
|
||||
tipsec_set_local(association->ctx,
|
||||
ip_local,
|
||||
transport->stack->network.proxy_cscf_[transport->stack->network.transport_idx_default],
|
||||
association->socket_uc->port,
|
||||
association->socket_us->port);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
|
|
|
@ -54,6 +54,54 @@ tsip_transport_layer_t* tsip_transport_layer_create(tsip_stack_t *stack)
|
|||
return tsk_object_new(tsip_transport_layer_def_t, stack);
|
||||
}
|
||||
|
||||
const tsip_transport_t* tsip_transport_layer_find_by_type(const tsip_transport_layer_t* self, tnet_socket_type_t type)
|
||||
{
|
||||
const tsk_list_item_t *item;
|
||||
const tsip_transport_t* transport = tsk_null;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
tsk_list_lock(self->transports);
|
||||
|
||||
tsk_list_foreach(item, self->transports){
|
||||
if(((const tsip_transport_t*)item->data)->type == type){
|
||||
transport = ((const tsip_transport_t*)item->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tsk_list_unlock(self->transports);
|
||||
|
||||
return transport;
|
||||
}
|
||||
|
||||
const tsip_transport_t* tsip_transport_layer_find_by_idx(const tsip_transport_layer_t* self, int32_t idx)
|
||||
{
|
||||
const tsk_list_item_t *item;
|
||||
const tsip_transport_t* transport = tsk_null;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
tsk_list_lock(self->transports);
|
||||
|
||||
tsk_list_foreach(item, self->transports){
|
||||
if(((const tsip_transport_t*)item->data)->idx == idx){
|
||||
transport = ((const tsip_transport_t*)item->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tsk_list_unlock(self->transports);
|
||||
|
||||
return transport;
|
||||
}
|
||||
|
||||
int tsip_transport_layer_handle_incoming_msg(const tsip_transport_t *transport, tsip_message_t *message)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -190,6 +238,7 @@ parse_buffer:
|
|||
if(message && message->firstVia && message->Call_ID && message->CSeq && message->From && message->To){
|
||||
/* Set fd */
|
||||
message->local_fd = e->local_fd;
|
||||
message->reliable = tsk_true;
|
||||
/* Alert transaction/dialog layer */
|
||||
ret = tsip_transport_layer_handle_incoming_msg(transport, message);
|
||||
/* Parse next chunck */
|
||||
|
@ -428,6 +477,7 @@ parse_buffer:
|
|||
if(message && message->firstVia && message->Call_ID && message->CSeq && message->From && message->To){
|
||||
/* Set fd */
|
||||
message->local_fd = e->local_fd;
|
||||
message->reliable = tsk_true;
|
||||
/* Alert transaction/dialog layer */
|
||||
ret = tsip_transport_layer_handle_incoming_msg(transport, message);
|
||||
/* Parse next chunck */
|
||||
|
@ -506,6 +556,7 @@ static int tsip_transport_layer_dgram_cb(const tnet_transport_event_t* e)
|
|||
/* Set local fd used to receive the message and the address of the remote peer */
|
||||
message->local_fd = e->local_fd;
|
||||
message->remote_addr = e->remote_addr;
|
||||
message->reliable = tsk_false;
|
||||
|
||||
/* Alert transaction/dialog layer */
|
||||
ret = tsip_transport_layer_handle_incoming_msg(transport, message);
|
||||
|
@ -524,8 +575,8 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
return tsk_null;
|
||||
}
|
||||
|
||||
*destIP = tsk_strdup(self->stack->network.proxy_cscf);
|
||||
*destPort = self->stack->network.proxy_cscf_port;
|
||||
tsk_strupdate(destIP, self->stack->network.proxy_cscf_[self->stack->network.transport_idx_default]);
|
||||
*destPort = self->stack->network.proxy_cscf_port_[self->stack->network.transport_idx_default];
|
||||
|
||||
/* =========== Sending Request =========
|
||||
*
|
||||
|
@ -545,7 +596,7 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
continue;
|
||||
}
|
||||
if(route->uri && route->uri->host){
|
||||
*destIP = tsk_strdup(route->uri->host);
|
||||
tsk_strupdate(destIP, route->uri->host);
|
||||
*destPort = route->uri->port > 0 ? route->uri->port : 5060;
|
||||
b_using_route = tsk_true;
|
||||
break;
|
||||
|
@ -553,7 +604,7 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
}
|
||||
if(!b_using_route){
|
||||
if(dialog->uri_remote_target && dialog->uri_remote_target->host && dialog->uri_remote_target->port){
|
||||
*destIP = tsk_strdup(dialog->uri_remote_target->host);
|
||||
tsk_strupdate(destIP, dialog->uri_remote_target->host);
|
||||
*destPort = dialog->uri_remote_target->port;
|
||||
}
|
||||
}
|
||||
|
@ -563,11 +614,23 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
/* Find the right transport */
|
||||
tsk_list_foreach(item, self->transports){
|
||||
curr = item->data;
|
||||
if(curr->type == self->stack->network.proxy_cscf_type){
|
||||
if(curr->type == self->stack->network.proxy_cscf_type_[self->stack->network.transport_idx_default]){
|
||||
transport = curr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* DNS NAPTR + SRV if the Proxy-CSCF is not defined and route set is empty */
|
||||
if(transport && !(*destIP) && !self->stack->network.proxy_cscf_[self->stack->network.transport_idx_default]){
|
||||
tnet_port_t dstPort;
|
||||
if(tnet_dns_query_naptr_srv(self->stack->dns_ctx, msg->To->uri->host, transport->service, destIP, &dstPort) == 0){
|
||||
*destPort = dstPort;
|
||||
}
|
||||
else{
|
||||
tsk_strupdate(destIP, msg->To->uri->host);
|
||||
*destPort = 5060;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -626,7 +689,7 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
This effectively adds a new processing step between bullets two and
|
||||
three in Section 18.2.2 of SIP [1].
|
||||
*/
|
||||
*destIP = tsk_strdup(msg->firstVia->received);
|
||||
tsk_strupdate(destIP, msg->firstVia->received);
|
||||
*destPort = msg->firstVia->rport;
|
||||
}
|
||||
else
|
||||
|
@ -640,7 +703,7 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
unreachable" response, the procedures of Section 5 of [4]
|
||||
SHOULD be used to determine where to send the response.
|
||||
*/
|
||||
*destIP = tsk_strdup(msg->firstVia->received);
|
||||
tsk_strupdate(destIP, msg->firstVia->received);
|
||||
*destPort = msg->firstVia->port ? msg->firstVia->port : 5060;
|
||||
}
|
||||
}
|
||||
|
@ -651,7 +714,7 @@ static const tsip_transport_t* tsip_transport_layer_find(const tsip_transport_la
|
|||
sent to the address indicated by the "sent-by" value, using the
|
||||
procedures in Section 5 of [4].
|
||||
*/
|
||||
*destIP = tsk_strdup(msg->firstVia->host);
|
||||
tsk_strupdate(destIP, msg->firstVia->host);
|
||||
if(msg->firstVia->port >0)
|
||||
{
|
||||
*destPort = msg->firstVia->port;
|
||||
|
@ -838,6 +901,7 @@ int tsip_transport_layer_start(tsip_transport_layer_t* self)
|
|||
int ret = 0;
|
||||
tsk_list_item_t *item;
|
||||
tsip_transport_t* transport;
|
||||
int32_t transport_idx = self->stack->network.transport_idx_default;
|
||||
|
||||
/* start() */
|
||||
tsk_list_foreach(item, self->transports){
|
||||
|
@ -863,20 +927,22 @@ int tsip_transport_layer_start(tsip_transport_layer_t* self)
|
|||
tsip_transport_set_callback(transport, TNET_TRANSPORT_CB_F(tsip_transport_layer_stream_cb), transport);
|
||||
}
|
||||
|
||||
if((ret = tnet_sockaddr_init(self->stack->network.proxy_cscf, self->stack->network.proxy_cscf_port, transport->type, &transport->pcscf_addr))){
|
||||
TSK_DEBUG_ERROR("[%s:%u] is invalid address", self->stack->network.proxy_cscf, self->stack->network.proxy_cscf_port);
|
||||
if((ret = tnet_sockaddr_init(self->stack->network.proxy_cscf_[transport_idx], self->stack->network.proxy_cscf_port_[transport_idx], transport->type, &transport->pcscf_addr))){
|
||||
TSK_DEBUG_ERROR("[%s:%u] is invalid address", self->stack->network.proxy_cscf_[transport_idx], self->stack->network.proxy_cscf_port_[transport_idx]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(TNET_SOCKET_TYPE_IS_STREAM(transport->type)){
|
||||
if((fd = tsip_transport_connectto_2(transport, self->stack->network.proxy_cscf, self->stack->network.proxy_cscf_port)) == TNET_INVALID_FD){
|
||||
TSK_DEBUG_ERROR("Failed to connect the SIP transport");
|
||||
return ret;
|
||||
}
|
||||
if((ret = tnet_sockfd_waitUntilWritable(fd, TNET_CONNECT_TIMEOUT))){
|
||||
TSK_DEBUG_ERROR("%d milliseconds elapsed and the socket is still not connected.", TNET_CONNECT_TIMEOUT);
|
||||
tnet_transport_remove_socket(transport->net_transport, &fd);
|
||||
return ret;
|
||||
if(!TSIP_STACK_MODE_IS_SERVER(transport->stack)){
|
||||
if((fd = tsip_transport_connectto_2(transport, self->stack->network.proxy_cscf_[transport_idx], self->stack->network.proxy_cscf_port_[transport_idx])) == TNET_INVALID_FD){
|
||||
TSK_DEBUG_ERROR("Failed to connect the SIP transport");
|
||||
return ret;
|
||||
}
|
||||
if((ret = tnet_sockfd_waitUntilWritable(fd, TNET_CONNECT_TIMEOUT))){
|
||||
TSK_DEBUG_ERROR("%d milliseconds elapsed and the socket is still not connected.", TNET_CONNECT_TIMEOUT);
|
||||
tnet_transport_remove_socket(transport->net_transport, &fd);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2011 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
|
||||
* Copyright (C) 2012 Doubango Telecom <http://doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -22,10 +21,6 @@
|
|||
|
||||
/**@file tsip.c
|
||||
* @brief SIP (RFC 3261) and 3GPP IMS/LTE (TS 24.229) implementation.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
|
||||
*
|
||||
|
||||
*/
|
||||
#include "tsip.h"
|
||||
|
||||
|
@ -71,8 +66,16 @@ extern tsip_event_t* tsip_event_create(tsip_ssession_t* ss, short code, const ch
|
|||
} \
|
||||
}
|
||||
|
||||
static int __tsip_stack_get_transport_idx_by_name(tsip_stack_t *self, const char* name)
|
||||
{
|
||||
if(tsk_strnullORempty(name)){
|
||||
return self->network.transport_idx_default; // for backward compatibility
|
||||
}
|
||||
return tsip_transport_get_idx_by_name(name);
|
||||
}
|
||||
|
||||
/* Internal function used to set all user's parameters */
|
||||
int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
||||
static int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
||||
{
|
||||
tsip_stack_param_type_t curr;
|
||||
|
||||
|
@ -178,27 +181,39 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
|||
break;
|
||||
}
|
||||
case tsip_pname_local_ip:
|
||||
{ /* (const char*)IP_STR */
|
||||
{ /* (const char*)TRANSPORT_STR, (const char*)IP_STR */
|
||||
const char* TRANSPORT_STR = va_arg(*app, const char*);
|
||||
const char* IP_STR = va_arg(*app, const char*);
|
||||
tsk_strupdate(&self->network.local_ip, IP_STR);
|
||||
int t_idx = __tsip_stack_get_transport_idx_by_name(self, TRANSPORT_STR);
|
||||
if(t_idx < 0) { TSK_DEBUG_ERROR("%s not valid as transport or you're probably using deprecated function", TRANSPORT_STR); return -1; }
|
||||
|
||||
tsk_strupdate(&self->network.local_ip_[t_idx], IP_STR);
|
||||
break;
|
||||
}
|
||||
case tsip_pname_local_port:
|
||||
{ /* (unsigned)PORT_UINT */
|
||||
self->network.local_port = (tnet_port_t)va_arg(*app, unsigned);
|
||||
{ /* (const char*)TRANSPORT_STR, (unsigned)PORT_UINT */
|
||||
const char* TRANSPORT_STR = va_arg(*app, const char*);
|
||||
unsigned PORT_UINT = va_arg(*app, unsigned);
|
||||
int t_idx = __tsip_stack_get_transport_idx_by_name(self, TRANSPORT_STR);
|
||||
if(t_idx < 0) { TSK_DEBUG_ERROR("%s not valid as transport or you're probably using deprecated function", TRANSPORT_STR); return -1; }
|
||||
|
||||
self->network.local_port_[t_idx] = PORT_UINT;
|
||||
break;
|
||||
}
|
||||
case tsip_pname_aor:
|
||||
{ /* (const char*)IP_STR, (unsigned)PORT_UINT */
|
||||
{ /* (const char*)TRANSPORT_STR, (const char*)IP_STR, (unsigned)PORT_UINT */
|
||||
const char* TRANSPORT_STR = va_arg(*app, const char*);
|
||||
const char* IP_STR = va_arg(*app, const char*);
|
||||
tnet_port_t PORT_UINT = (tnet_port_t)va_arg(*app, unsigned);
|
||||
int t_idx = __tsip_stack_get_transport_idx_by_name(self, TRANSPORT_STR);
|
||||
if(t_idx < 0) { TSK_DEBUG_ERROR("%s not valid as transport or you're probably using deprecated function", TRANSPORT_STR); return -1; }
|
||||
|
||||
if(!tsk_strnullORempty(IP_STR)){
|
||||
tsk_strupdate(&self->network.aor.ip, IP_STR);
|
||||
tsk_strupdate(&self->network.aor.ip_[t_idx], IP_STR);
|
||||
}
|
||||
if(PORT_UINT){
|
||||
self->network.aor.port = PORT_UINT;
|
||||
self->network.aor.port_[t_idx] = PORT_UINT;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case tsip_pname_discovery_naptr:
|
||||
|
@ -217,47 +232,56 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
|||
tnet_port_t PORT_UINT = va_arg(*app, unsigned);
|
||||
const char* TRANSPORT_STR = va_arg(*app, const char*);
|
||||
const char* IP_VERSION_STR = va_arg(*app, const char*);
|
||||
int t_idx = __tsip_stack_get_transport_idx_by_name(self, TRANSPORT_STR);
|
||||
if(t_idx < 0) { TSK_DEBUG_ERROR("%s not valid as transport or you're probably using deprecated function", TRANSPORT_STR); return -1; }
|
||||
|
||||
if(TSIP_STACK_MODE_IS_CLIENT(self)){
|
||||
// "client" mode support a unique proxy_cscf -> reset previous transports
|
||||
int k;
|
||||
for(k = 0; k < sizeof(self->network.proxy_cscf_type_)/sizeof(self->network.proxy_cscf_type_[0]); ++k) {
|
||||
self->network.proxy_cscf_type_[k] = tnet_socket_type_invalid;
|
||||
}
|
||||
}
|
||||
|
||||
/* IP Address */
|
||||
tsk_strupdate(&self->network.proxy_cscf, FQDN_STR);
|
||||
tsk_strupdate(&self->network.proxy_cscf_[t_idx], FQDN_STR);
|
||||
|
||||
/* Port */
|
||||
if(PORT_UINT){
|
||||
self->network.proxy_cscf_port = PORT_UINT;
|
||||
self->network.proxy_cscf_port_[t_idx] = PORT_UINT;
|
||||
}
|
||||
|
||||
/* Transport */
|
||||
if(tsk_strnullORempty(TRANSPORT_STR) || tsk_striequals(TRANSPORT_STR, "UDP")){
|
||||
TNET_SOCKET_TYPE_SET_UDP(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_UDP(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else if(tsk_striequals(TRANSPORT_STR, "TCP")){
|
||||
TNET_SOCKET_TYPE_SET_TCP(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_TCP(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else if(tsk_striequals(TRANSPORT_STR, "TLS")){
|
||||
TNET_SOCKET_TYPE_SET_TLS(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_TLS(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else if(tsk_striequals(TRANSPORT_STR, "SCTP")){
|
||||
TNET_SOCKET_TYPE_SET_SCTP(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_SCTP(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else if(tsk_striequals(TRANSPORT_STR, "WS")){
|
||||
TNET_SOCKET_TYPE_SET_WS(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_WS(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else if(tsk_striequals(TRANSPORT_STR, "WSS")){
|
||||
TNET_SOCKET_TYPE_SET_WSS(self->network.proxy_cscf_type);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("%s not a valid transport", TRANSPORT_STR);
|
||||
/* not mandatoy */
|
||||
TNET_SOCKET_TYPE_SET_WSS(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
/* whether to use ipv6 or not */
|
||||
if(!tsk_strnullORempty(IP_VERSION_STR)){
|
||||
if(tsk_strcontains(IP_VERSION_STR, tsk_strlen(IP_VERSION_STR), "6")){
|
||||
TNET_SOCKET_TYPE_SET_IPV6Only(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_IPV6Only(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
if(tsk_strcontains(IP_VERSION_STR, tsk_strlen(IP_VERSION_STR), "4")){
|
||||
TNET_SOCKET_TYPE_SET_IPV4(self->network.proxy_cscf_type); /* Not IPV4only ==> '46'/'64' */
|
||||
TNET_SOCKET_TYPE_SET_IPV4(self->network.proxy_cscf_type_[t_idx]); /* Not IPV4only ==> '46'/'64' */
|
||||
}
|
||||
}
|
||||
|
||||
/* set default transport */
|
||||
self->network.transport_idx_default = t_idx;
|
||||
break;
|
||||
}
|
||||
case tsip_pname_dnsserver:
|
||||
|
@ -268,9 +292,9 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case tsip_pname_mode_server:
|
||||
{ /* No parameter */
|
||||
self->network.mode_server = tsk_true;
|
||||
case tsip_pname_mode:
|
||||
{ /* (tsip_stack_mode_t)MODE_ENUM */
|
||||
self->network.mode = va_arg(*app, tsip_stack_mode_t);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -283,13 +307,17 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
|||
break;
|
||||
}
|
||||
case tsip_pname_secagree_ipsec:
|
||||
{ /* (tsk_bool_t)ENABLED_BOOL */
|
||||
if((self->security.enable_secagree_ipsec = va_arg(*app, tsk_bool_t))){
|
||||
{ /* (const char*)TRANSPORT_STR, (tsk_bool_t)ENABLED_BOOL */
|
||||
const char* TRANSPORT_STR = va_arg(*app, const char*);
|
||||
tsk_bool_t ENABLED_BOOL = va_arg(*app, tsk_bool_t);
|
||||
int t_idx = __tsip_stack_get_transport_idx_by_name(self, TRANSPORT_STR);
|
||||
if(t_idx < 0) { TSK_DEBUG_ERROR("%s not valid as transport or you're probably using deprecated function", TRANSPORT_STR); return -1; }
|
||||
if(ENABLED_BOOL){
|
||||
tsk_strupdate(&self->security.secagree_mech, "ipsec-3gpp");
|
||||
TNET_SOCKET_TYPE_SET_IPSEC(self->network.proxy_cscf_type);
|
||||
TNET_SOCKET_TYPE_SET_IPSEC(self->network.proxy_cscf_type_[t_idx]);
|
||||
}
|
||||
else{
|
||||
TNET_SOCKET_TYPE_UNSET(self->network.proxy_cscf_type, IPSEC);
|
||||
TNET_SOCKET_TYPE_UNSET(self->network.proxy_cscf_type_[t_idx], IPSEC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -445,7 +473,8 @@ tsip_stack_handle_t* stack = tsip_stack_create(app_callback, realm_uri, impi_uri
|
|||
tsip_stack_handle_t* tsip_stack_create(tsip_stack_callback_f callback, const char* realm_uri, const char* impi_uri, const char* impu_uri, ...)
|
||||
{
|
||||
tsip_stack_t* stack = tsk_null;
|
||||
va_list ap;
|
||||
va_list ap;
|
||||
int i;
|
||||
|
||||
/* === check values === */
|
||||
if(!realm_uri || !impi_uri || !impu_uri){
|
||||
|
@ -472,11 +501,11 @@ tsip_stack_handle_t* tsip_stack_create(tsip_stack_callback_f callback, const cha
|
|||
}
|
||||
|
||||
/* === Default values === */
|
||||
stack->network.local_ip = TNET_SOCKET_HOST_ANY;
|
||||
stack->network.local_port = TNET_SOCKET_PORT_ANY;
|
||||
stack->network.mode = tsip_stack_mode_ua;
|
||||
for(i = 0; i < sizeof(stack->network.local_port_)/sizeof(stack->network.local_port_[0]); ++i) { stack->network.local_port_[i] = TNET_SOCKET_PORT_ANY; }
|
||||
for(i = 0; i < sizeof(stack->network.proxy_cscf_port_)/sizeof(stack->network.proxy_cscf_port_[0]); ++i) { stack->network.proxy_cscf_port_[i] = 5060; }
|
||||
for(i = 0; i < sizeof(stack->network.proxy_cscf_type_)/sizeof(stack->network.proxy_cscf_type_[0]); ++i) { stack->network.proxy_cscf_type_[i] = tnet_socket_type_invalid; }
|
||||
|
||||
stack->network.proxy_cscf_port = 5060;
|
||||
stack->network.proxy_cscf_type = tnet_socket_type_udp_ipv4;
|
||||
// all events should be delivered to the user before the stack stop
|
||||
tsk_runnable_set_important(TSK_RUNNABLE(stack), tsk_true);
|
||||
|
||||
|
@ -530,7 +559,7 @@ bail:
|
|||
*/
|
||||
int tsip_stack_start(tsip_stack_handle_t *self)
|
||||
{
|
||||
int ret = -1;
|
||||
int ret = -1, t_idx;
|
||||
tsip_stack_t *stack = self;
|
||||
const char* stack_error_desc = "Failed to start the stack";
|
||||
|
||||
|
@ -544,8 +573,10 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(stack);
|
||||
|
||||
// Debug info
|
||||
if(stack->network.mode_server){
|
||||
if(TSIP_STACK_MODE_IS_SERVER(stack)){
|
||||
TSK_DEBUG_INFO("Stack running in SERVER mode");
|
||||
}
|
||||
else{
|
||||
|
@ -567,69 +598,77 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
/* === Transport type === */
|
||||
if(!tsk_strnullORempty(stack->security.secagree_mech)){
|
||||
if(tsk_striequals(stack->security.secagree_mech, "ipsec-3gpp") && stack->security.enable_secagree_ipsec){
|
||||
#if 0
|
||||
TNET_SOCKET_TYPE_SET_IPSEC(stack->network.proxy_cscf_type);
|
||||
#endif
|
||||
TSK_DEBUG_ERROR("Not implemented");
|
||||
}
|
||||
//else if if(tsk_striquals(stack->security.secagree_mech, "ipsec-ike"))
|
||||
}
|
||||
|
||||
/* === Use DNS NAPTR+SRV for the P-CSCF discovery if we are in client mode === */
|
||||
if(!stack->network.mode_server){
|
||||
if(tsk_strnullORempty(stack->network.proxy_cscf) || (stack->network.discovery_dhcp || stack->network.discovery_naptr)){
|
||||
if(stack->network.discovery_dhcp){ /* DHCP v4/v6 */
|
||||
/* FIXME: */
|
||||
TSK_DEBUG_ERROR("Unexpected code called");
|
||||
ret = -2;
|
||||
} /* DHCP */
|
||||
else{ /* DNS NAPTR + SRV*/
|
||||
char* hostname = tsk_null;
|
||||
tnet_port_t port = 0;
|
||||
for(t_idx = 0; t_idx < sizeof(stack->network.proxy_cscf_type_) / sizeof(stack->network.proxy_cscf_type_[0]); ++t_idx){
|
||||
if(!TNET_SOCKET_TYPE_IS_VALID(stack->network.proxy_cscf_type_[t_idx])){
|
||||
continue;
|
||||
}
|
||||
/* === Use DNS NAPTR+SRV for the P-CSCF discovery if we are in client mode === */
|
||||
if(TSIP_STACK_MODE_IS_CLIENT(stack)){
|
||||
if(tsk_strnullORempty(stack->network.proxy_cscf_[t_idx]) || (stack->network.discovery_dhcp || stack->network.discovery_naptr)){
|
||||
if(stack->network.discovery_dhcp){ /* DHCP v4/v6 */
|
||||
/* FIXME: */
|
||||
TSK_DEBUG_ERROR("Unexpected code called");
|
||||
ret = -2;
|
||||
} /* DHCP */
|
||||
else{ /* DNS NAPTR + SRV*/
|
||||
char* hostname = tsk_null;
|
||||
tnet_port_t port = 0;
|
||||
|
||||
if(!(ret = tnet_dns_query_naptr_srv(stack->dns_ctx, stack->network.realm->host,
|
||||
TNET_SOCKET_TYPE_IS_DGRAM(stack->network.proxy_cscf_type) ? "SIP+D2U" :
|
||||
(TNET_SOCKET_TYPE_IS_TLS(stack->network.proxy_cscf_type) ? "SIPS+D2T" : "SIP+D2T"),
|
||||
&hostname, &port))){
|
||||
tsk_strupdate(&stack->network.proxy_cscf, hostname);
|
||||
if(!stack->network.proxy_cscf_port || stack->network.proxy_cscf_port==5060){ /* Only if the Proxy-CSCF port is missing or default */
|
||||
stack->network.proxy_cscf_port = port;
|
||||
if(!(ret = tnet_dns_query_naptr_srv(stack->dns_ctx, stack->network.realm->host,
|
||||
TNET_SOCKET_TYPE_IS_DGRAM(stack->network.proxy_cscf_type_[t_idx]) ? "SIP+D2U" :
|
||||
(TNET_SOCKET_TYPE_IS_TLS(stack->network.proxy_cscf_type_[t_idx]) ? "SIPS+D2T" : "SIP+D2T"),
|
||||
&hostname, &port))){
|
||||
tsk_strupdate(&stack->network.proxy_cscf_[t_idx], hostname);
|
||||
if(!stack->network.proxy_cscf_port_[t_idx] || stack->network.proxy_cscf_port_[t_idx]==5060){ /* Only if the Proxy-CSCF port is missing or default */
|
||||
stack->network.proxy_cscf_port_[t_idx] = port;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("P-CSCF discovery using DNS NAPTR failed. The stack will use the user supplied address and port.");
|
||||
}
|
||||
|
||||
TSK_FREE(hostname);
|
||||
} /* NAPTR */
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("P-CSCF discovery using DNS NAPTR failed. The stack will use the user supplied address and port.");
|
||||
}
|
||||
|
||||
TSK_FREE(hostname);
|
||||
} /* NAPTR */
|
||||
}
|
||||
|
||||
/* Check Proxy-CSCF IP address */
|
||||
if(stack->network.proxy_cscf){
|
||||
TSK_DEBUG_INFO("Proxy-CSCF=[%s]:%d", stack->network.proxy_cscf, stack->network.proxy_cscf_port);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Proxy-CSCF IP address is Null.");
|
||||
ret = -1983;
|
||||
goto bail;
|
||||
}
|
||||
}// !Server mode
|
||||
|
||||
/* === Get Best source address === */
|
||||
if(tsk_strnullORempty(stack->network.local_ip) || tsk_striequals(stack->network.local_ip, "127.0.0.1")){ /* loacal-ip is missing? */
|
||||
if(stack->network.mode_server){
|
||||
stack_error_desc = "In mode server you must provide a valid local ip";
|
||||
ret = -1984;
|
||||
goto bail;
|
||||
}
|
||||
else{ /* client mode: try to find best source address */
|
||||
tnet_ip_t bestsource;
|
||||
if((ret = tnet_getbestsource(stack->network.proxy_cscf, stack->network.proxy_cscf_port, stack->network.proxy_cscf_type, &bestsource))){ /* FIXME: what about linux version? */
|
||||
TSK_DEBUG_ERROR("Failed to get best source [%d].", ret);
|
||||
/* do not exit ==> will use default IP address */
|
||||
/* Check Proxy-CSCF IP address */
|
||||
if(!tsk_strnullORempty(stack->network.proxy_cscf_[t_idx])){
|
||||
TSK_DEBUG_INFO("Proxy-CSCF=[%s]:%d", stack->network.proxy_cscf_[t_idx], stack->network.proxy_cscf_port_[t_idx]);
|
||||
}
|
||||
else{
|
||||
tsk_strupdate(&stack->network.local_ip, bestsource);
|
||||
TSK_DEBUG_ERROR("Proxy-CSCF IP address is Null.");
|
||||
ret = -1983;
|
||||
goto bail;
|
||||
}
|
||||
}// !Server mode
|
||||
|
||||
/* === Get Best source address === */
|
||||
if(tsk_strnullORempty(stack->network.local_ip_[t_idx]) || tsk_striequals(stack->network.local_ip_[t_idx], "127.0.0.1")){ /* loacal-ip is missing? */
|
||||
if(TSIP_STACK_MODE_IS_SERVER(stack)){
|
||||
stack_error_desc = "In mode server you must provide a valid local ip";
|
||||
ret = -1984;
|
||||
goto bail;
|
||||
}
|
||||
else{ /* client mode: try to find best source address */
|
||||
tnet_ip_t bestsource;
|
||||
if((ret = tnet_getbestsource(stack->network.proxy_cscf_[t_idx], stack->network.proxy_cscf_port_[t_idx], stack->network.proxy_cscf_type_[t_idx], &bestsource))){ /* FIXME: what about linux version? */
|
||||
TSK_DEBUG_ERROR("Failed to get best source [%d].", ret);
|
||||
/* do not exit ==> will use default IP address */
|
||||
}
|
||||
else{
|
||||
tsk_strupdate(&stack->network.local_ip_[t_idx], bestsource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* for (t_idx...) */
|
||||
|
||||
/* === Runnable === */
|
||||
TSK_RUNNABLE(stack)->run = run;
|
||||
|
@ -647,17 +686,21 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
/* FIXME: for now only UDP(IPv4/IPv6) is supported */
|
||||
stack->natt.stun.port = TNET_STUN_TCP_UDP_DEFAULT_PORT;
|
||||
}
|
||||
stack->natt.ctx = tnet_nat_context_create(TNET_SOCKET_TYPE_IS_IPV6(stack->network.proxy_cscf_type)? tnet_socket_type_udp_ipv6: tnet_socket_type_udp_ipv4,
|
||||
stack->natt.ctx = tnet_nat_context_create(TNET_SOCKET_TYPE_IS_IPV6(stack->network.proxy_cscf_type_[stack->network.transport_idx_default])? tnet_socket_type_udp_ipv6: tnet_socket_type_udp_ipv4,
|
||||
stack->natt.stun.login, stack->natt.stun.pwd);
|
||||
tnet_nat_set_server(stack->natt.ctx, stack->natt.stun.ip, stack->natt.stun.port);
|
||||
}
|
||||
|
||||
/* === Transport Layer === */
|
||||
/* Adds the default transport to the transport Layer */
|
||||
if((ret = tsip_transport_layer_add(stack->layer_transport, stack->network.local_ip, stack->network.local_port, stack->network.proxy_cscf_type, "SIP transport"))){
|
||||
stack_error_desc = "Failed to add new transport";
|
||||
TSK_DEBUG_ERROR("%s", stack_error_desc);
|
||||
goto bail;
|
||||
for(t_idx = 0; t_idx < sizeof(stack->network.proxy_cscf_type_) / sizeof(stack->network.proxy_cscf_type_[stack->network.transport_idx_default]); ++t_idx){
|
||||
if(!TNET_SOCKET_TYPE_IS_VALID(stack->network.proxy_cscf_type_[t_idx])){
|
||||
continue;
|
||||
}
|
||||
if((ret = tsip_transport_layer_add(stack->layer_transport, stack->network.local_ip_[t_idx], stack->network.local_port_[t_idx], stack->network.proxy_cscf_type_[t_idx], "SIP transport"))){
|
||||
stack_error_desc = "Failed to add new transport";
|
||||
TSK_DEBUG_ERROR("%s", stack_error_desc);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
/* Starts the transport Layer */
|
||||
if((ret = tsip_transport_layer_start(stack->layer_transport))){
|
||||
|
@ -665,25 +708,30 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
TSK_DEBUG_ERROR("%s", stack_error_desc);
|
||||
goto bail;
|
||||
}
|
||||
else if(!stack->network.local_ip){
|
||||
/* Update the local_ip */
|
||||
if(!TSK_LIST_IS_EMPTY(stack->layer_transport->transports)){
|
||||
tnet_ip_t ip;
|
||||
if(!tnet_transport_get_ip_n_port_2(stack->layer_transport->transports->head->data, &ip, tsk_null)){
|
||||
stack->network.local_ip = tsk_strdup(ip);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_WARN("Failed to get local_ip");
|
||||
/* Do not exit */
|
||||
|
||||
/* Update the local_ip */
|
||||
for(t_idx = 0; t_idx < sizeof(stack->network.proxy_cscf_type_) / sizeof(stack->network.proxy_cscf_type_[0]); ++t_idx){
|
||||
if(!TNET_SOCKET_TYPE_IS_VALID(stack->network.proxy_cscf_type_[t_idx])){
|
||||
continue;
|
||||
}
|
||||
if(tsk_strnullORempty(stack->network.local_ip_[t_idx])){
|
||||
const tsip_transport_t* transport = tsip_transport_layer_find_by_type(stack->layer_transport, stack->network.proxy_cscf_type_[t_idx]);
|
||||
|
||||
if(transport){
|
||||
tnet_ip_t ip;
|
||||
if(!tnet_transport_get_ip_n_port_2(transport, &ip, tsk_null)){
|
||||
tsk_strupdate(&stack->network.local_ip_[t_idx], ip);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_WARN("Failed to get local_ip for transport type = %d", stack->network.proxy_cscf_type_[t_idx]);
|
||||
/* Do not exit */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* === ALL IS OK === */
|
||||
if(stack->layer_transac){ /* For transaction layer */
|
||||
stack->layer_transac->reliable = TNET_SOCKET_TYPE_IS_STREAM(stack->network.proxy_cscf_type);
|
||||
}
|
||||
|
||||
stack->started = tsk_true;
|
||||
|
||||
|
@ -692,6 +740,8 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
|
||||
TSK_DEBUG_INFO("SIP STACK -- START");
|
||||
|
||||
tsk_safeobj_unlock(stack);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
|
@ -710,6 +760,8 @@ bail:
|
|||
tsk_runnable_stop(TSK_RUNNABLE(stack));
|
||||
}
|
||||
|
||||
tsk_safeobj_unlock(stack);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -825,14 +877,17 @@ int tsip_stack_get_local_ip_n_port(const tsip_stack_handle_t *self, const char*
|
|||
int tsip_stack_stop(tsip_stack_handle_t *self)
|
||||
{
|
||||
tsip_stack_t *stack = self;
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if(stack){
|
||||
int ret;
|
||||
tsk_bool_t one_failed = tsk_false;
|
||||
int ret = 0;
|
||||
|
||||
tsk_safeobj_lock(stack);
|
||||
|
||||
if(!stack->started){
|
||||
TSK_DEBUG_WARN("Stack already stopped");
|
||||
return 0;
|
||||
TSK_DEBUG_INFO("Stack already stopped");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Hangup all dialogs starting by REGISTER */
|
||||
|
@ -885,8 +940,8 @@ int tsip_stack_stop(tsip_stack_handle_t *self)
|
|||
}
|
||||
|
||||
/* reset AoR */
|
||||
TSK_FREE(stack->network.aor.ip);
|
||||
stack->network.aor.port = 0;
|
||||
TSK_FREE_TABLE(stack->network.aor.ip_);
|
||||
memset(stack->network.aor.port_, 0, sizeof(stack->network.aor.port_));
|
||||
|
||||
if(!one_failed){
|
||||
stack->started = tsk_false;
|
||||
|
@ -894,6 +949,9 @@ int tsip_stack_stop(tsip_stack_handle_t *self)
|
|||
|
||||
TSK_DEBUG_INFO("SIP STACK -- STOP");
|
||||
|
||||
bail:
|
||||
tsk_safeobj_unlock(stack);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -923,35 +981,41 @@ tsip_uri_t* tsip_stack_get_contacturi(const tsip_stack_t *stack, const char* pro
|
|||
}
|
||||
|
||||
/* internal function used to construct a valid Proxy-CSCF URI used as the default first route */
|
||||
tsip_uri_t* tsip_stack_get_pcscf_uri(const tsip_stack_t *stack, tsk_bool_t lr)
|
||||
tsip_uri_t* tsip_stack_get_pcscf_uri(const tsip_stack_t *stack, tnet_socket_type_t type, tsk_bool_t lr)
|
||||
{
|
||||
if(stack){
|
||||
if(stack->layer_transport->transports && !TSK_LIST_IS_EMPTY(stack->layer_transport->transports)){
|
||||
tsip_transport_t *transport = stack->layer_transport->transports->head->data;
|
||||
if(transport){
|
||||
tsip_uri_t* uri = tsk_null;
|
||||
tsk_bool_t ipv6 = TNET_SOCKET_TYPE_IS_IPV6(transport->type);
|
||||
tsk_bool_t quote_ip = (ipv6 && tsk_strcontains(stack->network.proxy_cscf, tsk_strlen(stack->network.proxy_cscf), ":")) /* IPv6 IP string?*/;
|
||||
|
||||
char* uristring = tsk_null;
|
||||
tsk_sprintf(&uristring, "%s:%s%s%s:%d;%s;transport=%s",
|
||||
transport->scheme,
|
||||
quote_ip ? "[" : "",
|
||||
stack->network.proxy_cscf,
|
||||
quote_ip ? "]" : "",
|
||||
stack->network.proxy_cscf_port,
|
||||
lr ? "lr" : "",
|
||||
transport->protocol);
|
||||
if(uristring){
|
||||
if((uri = tsip_uri_parse(uristring, tsk_strlen(uristring)))){
|
||||
//uri->host_type = ipv6 ? thttp_host_ipv6 : thttp_host_ipv4;
|
||||
}
|
||||
TSK_FREE(uristring);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
const tsip_transport_t *transport = tsk_null;
|
||||
if(!TNET_SOCKET_TYPE_IS_VALID(type) && !TSK_LIST_IS_EMPTY(stack->layer_transport->transports)){
|
||||
transport = stack->layer_transport->transports->head->data;
|
||||
}
|
||||
else{
|
||||
transport = tsip_transport_layer_find_by_type(stack->layer_transport, type);
|
||||
}
|
||||
|
||||
if(transport){
|
||||
tsip_uri_t* uri = tsk_null;
|
||||
tsk_bool_t ipv6 = TNET_SOCKET_TYPE_IS_IPV6(transport->type);
|
||||
tsk_bool_t quote_ip = (ipv6 && tsk_strcontains(stack->network.proxy_cscf_[transport->idx], tsk_strlen(stack->network.proxy_cscf_[transport->idx]), ":")) /* IPv6 IP string?*/;
|
||||
|
||||
char* uristring = tsk_null;
|
||||
tsk_sprintf(&uristring, "%s:%s%s%s:%d;%s;transport=%s",
|
||||
transport->scheme,
|
||||
quote_ip ? "[" : "",
|
||||
stack->network.proxy_cscf_[transport->idx],
|
||||
quote_ip ? "]" : "",
|
||||
stack->network.proxy_cscf_port_[transport->idx],
|
||||
lr ? "lr" : "",
|
||||
transport->protocol);
|
||||
if(uristring){
|
||||
if((uri = tsip_uri_parse(uristring, tsk_strlen(uristring)))){
|
||||
//uri->host_type = ipv6 ? thttp_host_ipv6 : thttp_host_ipv4;
|
||||
}
|
||||
TSK_FREE(uristring);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
}
|
||||
return tsk_null;
|
||||
}
|
||||
|
@ -1005,6 +1069,7 @@ static tsk_object_t* tsip_stack_ctor(tsk_object_t * self, va_list * app)
|
|||
{
|
||||
tsip_stack_t *stack = self;
|
||||
if(stack){
|
||||
tsk_safeobj_init(stack);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -1040,12 +1105,12 @@ static tsk_object_t* tsip_stack_dtor(tsk_object_t * self)
|
|||
TSK_FREE(stack->identity.password);
|
||||
|
||||
/* Network(1/1) */
|
||||
TSK_FREE(stack->network.local_ip);
|
||||
TSK_FREE_TABLE(stack->network.local_ip_);
|
||||
TSK_OBJECT_SAFE_FREE(stack->network.realm);
|
||||
TSK_FREE(stack->network.proxy_cscf);
|
||||
TSK_FREE_TABLE(stack->network.proxy_cscf_);
|
||||
TSK_OBJECT_SAFE_FREE(stack->paths);
|
||||
|
||||
TSK_FREE(stack->network.aor.ip);
|
||||
TSK_FREE_TABLE(stack->network.aor.ip_);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(stack->service_routes);
|
||||
TSK_OBJECT_SAFE_FREE(stack->associated_uris);
|
||||
|
@ -1084,6 +1149,8 @@ static tsk_object_t* tsip_stack_dtor(tsk_object_t * self)
|
|||
TSK_OBJECT_SAFE_FREE(stack->ssessions);
|
||||
TSK_OBJECT_SAFE_FREE(stack->headers);
|
||||
|
||||
tsk_safeobj_deinit(stack);
|
||||
|
||||
TSK_DEBUG_INFO("*** SIP Stack destroyed ***");
|
||||
}
|
||||
return self;
|
||||
|
|
Loading…
Reference in New Issue