Add doubango v2.0

This commit is contained in:
bossiel 2011-03-25 09:38:07 +00:00
parent bfbdba0768
commit 5448386f00
2729 changed files with 768318 additions and 0 deletions

View File

@ -0,0 +1,33 @@
========================================================================
CONSOLE APPLICATION : test Project Overview
========================================================================
AppWizard has created this test application for you.
This file contains a summary of what you will find in each of the files that
make up your test application.
test.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
test.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named test.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// test.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -0,0 +1,15 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@ -0,0 +1,13 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif

View File

@ -0,0 +1,86 @@
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <assert.h>
#include <api_engine.h>
#include <api_stack.h>
#define STACK_ID 1234
#ifdef WIN32
# include <windows.h>
#endif
/* Event listening using a static method */
void OnRegistrationStateChanged(int stack_id, dgo::sip_state_registration_t state, int sipcode, const char* sipdesc)
{
/* check if it's our stack */
if(stack_id != STACK_ID) return;
switch(state)
{
case dgo::srs_none: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_none", sipdesc); break;
case dgo::srs_trying: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_trying", sipdesc); break;
case dgo::srs_authentifying: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_authentifying", sipdesc); break;
case dgo::srs_unregistered: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_unregistered", sipdesc); break;
case dgo::srs_registered: printf("Test_OnRegistrationStateChanged: %s(%s)\n", "srs_registered", sipdesc); break;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
/* MUST call this function to initialize the engine befor using the first stack */
assert( ERR_SUCCEED(dgo::engine_initialize()) );
/* create the stack */
dgo::stack* stack = new dgo::stack(STACK_ID);
/* Events registration */
stack->registrationStateChanged.connect(&OnRegistrationStateChanged);
/* check that the stack has been successfuly initialized */
assert(stack->get_initialized());
/* MUST: Initialize mandatory parameters */
stack->set_public_id("sip:bob@ims.inexbee.com");
stack->set_private_id("bob@ims.inexbee.com");
stack->set_pcscf("192.168.0.14");
stack->set_pcscf_port(4060);
stack->set_realm("ims.inexbee.com");
/* Not mandatory but must be set before starting */
stack->set_sigcomp(true);
/* run stack */
assert( ERR_SUCCEED(stack->run()) );
/* set other optional parameters */
stack->set_displayname("Doubango");
stack->set_privacy("none");
stack->set_password("bob");
stack->set_early_ims(false);
stack->set_expires(10);
/* register */
stack->sip_register();
/* wait */
#ifdef WIN32
Sleep(500000);
#else
getchar();
#endif
/* Now it's time to unregister */
stack->sip_unregister();
/* wait */
getchar();
/* destroy the engine and unregister all identities*/
assert( ERR_SUCCEED(dgo::engine_deinitialize()) );
return 0;
}

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{EB6DC417-98BF-45FD-90D0-F5C72F945316}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EB6DC417-98BF-45FD-90D0-F5C72F945316}.Debug|Win32.ActiveCfg = Debug|Win32
{EB6DC417-98BF-45FD-90D0-F5C72F945316}.Debug|Win32.Build.0 = Debug|Win32
{EB6DC417-98BF-45FD-90D0-F5C72F945316}.Release|Win32.ActiveCfg = Release|Win32
{EB6DC417-98BF-45FD-90D0-F5C72F945316}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="test"
ProjectGUID="{EB6DC417-98BF-45FD-90D0-F5C72F945316}"
RootNamespace="test"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\doubango\src&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\win32&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\su&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\ipt&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sresolv&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\bnf&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\url&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\msg&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sip&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nta&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nua&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\iptsec&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\http&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nth&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\nea&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\sdp&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\soa&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\stun&quot;;&quot;$(DOUBANGO_HOME)\sofia-sip-1.12.10\libsofia-sip-ua\tport&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\doubango.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\stdafx.cpp"
>
</File>
<File
RelativePath=".\test.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\targetver.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,9 @@
#!/bin/bash
# Build tinyDEMO for Google Android Systems
for project in tinySAK tinyNET tinyHTTP tinyXCAP tinyIPSec tinySMS tinySIGCOMP tinySDP tinyRTP tinyMSRP tinyMEDIA tinyDAV tinySIP
do
echo -e building "$project....\n"
make PROJECT=$project clean
make PROJECT=$project BT=$1 all
done

View File

@ -0,0 +1,40 @@
include ./root.mk
ifeq ($(PROJECT), tinyWRAP) ##### tinyWRAP
all:
(cd ../bindings/java/android; $(MAKE) -f droid-makefile all; cp -f lib$(PROJECT)_$(MARCH).$(EXT) $(OUTPUT_DIR))
clean:
(cd ../bindings/java/android; $(MAKE) -f droid-makefile clean)
else ifeq ($(PROJECT), tinyDEMO) ##### tinyDEMO
all:
(cd ../tinyDEMO $(MAKE) -f droid-makefile all; $(MAKE) -f droid-makefile install; cp -f demo $(OUTPUT_DIR))
clean:
(cd ../tinyDEMO; $(MAKE) -f droid-makefile clean)
else ##### All other libraries (tiny*)
all:
(cd ../$(PROJECT) ; $(MAKE) -f droid-makefile all; cp -f lib$(PROJECT)_$(MARCH).$(EXT) $(OUTPUT_DIR))
test:
(cd ../$(PROJECT)/test; $(MAKE) -f droid-makefile all; cp -f test $(OUTPUT_DIR))
install:
(cd ../$(PROJECT) ; $(MAKE) -f droid-makefile install)
clean:
(cd ../$(PROJECT); $(MAKE) -f droid-makefile clean)
(cd ../$(PROJECT)/test; $(MAKE) -f droid-makefile clean)
endif
gdbserver:
$(ANDROID_SDK_ROOT)/tools/adb forward tcp:1234: tcp:1234
$(ANDROID_SDK_ROOT)/tools/adb shell $(EXEC_DIR)/gdbserver :1234 $(EXEC_DIR)/test

View File

@ -0,0 +1,75 @@
######
## Root configuration file shared by all android projects.
######
export ANDROID_NDK_ROOT=/cygdrive/c/android-ndk-r4b
export ANDROID_SDK_ROOT=/cygdrive/c/android-sdk
export ANDROID_PLATFORM=android-3
export ANDROID_HOST=windows
export ANDROID_GCC_VER=4.4.0
# Output directory
export OUTPUT_DIR=$(shell pwd)/output
$(shell mkdir -p $(OUTPUT_DIR))
# Path where to copy executables -on the device or emulator-
export EXEC_DIR=/data/tmp
# Path where to copy libraries (*.so) -on the device or emulator-
export LIB_DIR=/system/lib
##################################################################################
export AR=arm-eabi-ar
export CC=arm-eabi-gcc-$(ANDROID_GCC_VER)
export CPP=arm-eabi-g++
export CFLAGS_COMMON=$(CFLAGS) $(DEBUG_FLAGS) -I$(ANDROID_NDK_ROOT)/build/platforms/$(ANDROID_PLATFORM)/arch-arm/usr/include \
-msoft-float \
-fpic \
-mthumb-interwork \
-ffunction-sections \
-funwind-tables \
-fstack-protector \
-D__ARM_ARCH_5__ \
-D__ARM_ARCH_5T__ \
-D__ARM_ARCH_5E__ \
-D__ARM_ARCH_5TE__ \
-MMD \
-MP \
-fno-short-enums \
-DANDROID
ifeq ($(NEON), yes)
export MARCH=armv7-a
export CFLAGS_COMMON+=-march=$(MARCH) -mtune=cortex-a8 -mfpu=neon -DHAVE_NEON=1 \
-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -Wno-psabi -mfloat-abi=softfp
else
export MARCH=armv5te
export CFLAGS_COMMON+=-march=$(MARCH) -mtune=xscale
endif
export CFLAGS_LIB= $(CFLAGS_COMMON) \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing \
-finline-limit=64 \
-DANDROID
#-mthumb
export LDFLAGS_COMMON=$(LDFLAGS) -Wl,-rpath=/system/lib,-rpath-link=$(ANDROID_NDK_ROOT)/build/platforms/$(ANDROID_PLATFORM)/arch-arm/usr/lib,-rpath-link=$(OUTPUT_DIR),-dynamic-linker=/system/bin/linker,-T,$(ANDROID_NDK_ROOT)/build/prebuilt/$(ANDROID_HOST)/arm-eabi-$(ANDROID_GCC_VER)/arm-eabi/lib/ldscripts/armelf.xsc -L$(ANDROID_NDK_ROOT)/build/platforms/$(ANDROID_PLATFORM)/arch-arm/usr/lib
export LDFLAGS_COMMON+=-nostdlib -lc -L$(OUTPUT_DIR)
ifeq ($(BT), static)
export EXT=a
export LDFLAGS_LIB=
export CFLAGS_LIB+=-static
else
export EXT=so
export LDFLAGS_LIB=$(LDFLAGS_COMMON)
export LDFLAGS_LIB+=-Wl,--no-undefined
export LDFLAGS_LIB+=-Wl,--no-whole-archive
export LDFLAGS_LIB+=-Wl,-soname,lib$(PROJECT).$(EXT),-Bsymbolic,-shared,--whole-archive
endif

View File

@ -0,0 +1,92 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*/
#include "ActionConfig.h"
tmedia_type_t _get_media_type(twrap_media_type_t type){
int media_type = tmedia_none; // Use int because | operator not defined for enumerators
switch(type){
case twrap_media_msrp:
media_type |= tmedia_msrp;
break;
case twrap_media_audio:
media_type |= tmedia_audio;
break;
case twrap_media_video:
media_type |= tmedia_video;
break;
case twrap_media_audiovideo:
media_type |= tmedia_audiovideo;
break;
}
return (tmedia_type_t)media_type;
}
ActionConfig::ActionConfig()
{
this->handle = tsip_action_create(tsip_atype_config,
TSIP_ACTION_SET_NULL());
}
ActionConfig::~ActionConfig()
{
TSK_OBJECT_SAFE_FREE(this->handle);
}
bool ActionConfig::addHeader(const char* name, const char* value)
{
return (tsip_action_set(this->handle,
TSIP_ACTION_SET_HEADER(name, value),
TSIP_ACTION_SET_NULL()) == 0);
}
ActionConfig* ActionConfig::setResponseLine(short code, const char* phrase)
{
int32_t _code = code;
tsip_action_set(this->handle,
TSIP_ACTION_SET_RESP_LINE(_code, phrase),
TSIP_ACTION_SET_NULL());
return this;
}
ActionConfig* ActionConfig::setMediaString(twrap_media_type_t type, const char* key, const char* value)
{
tmedia_type_t media_type = _get_media_type(type);
tsip_action_set(this->handle,
TSIP_ACTION_SET_MEDIA(
TMEDIA_SESSION_SET_STR(media_type, key, value),
TMEDIA_SESSION_SET_NULL()),
TSIP_ACTION_SET_NULL());
return this;
}
ActionConfig* ActionConfig::setMediaInt(twrap_media_type_t type, const char* key, int value)
{
tmedia_type_t media_type = _get_media_type(type);
tsip_action_set(this->handle,
TSIP_ACTION_SET_MEDIA(
TMEDIA_SESSION_SET_INT32(media_type, key, value),
TMEDIA_SESSION_SET_NULL()),
TSIP_ACTION_SET_NULL());
return this;
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_ACTIONCONFIG_H
#define TINYWRAP_ACTIONCONFIG_H
#include "tinysip.h"
#include "Common.h"
class ActionConfig
{
public:
ActionConfig();
virtual ~ActionConfig();
bool addHeader(const char* name, const char* value);
ActionConfig* setResponseLine(short code, const char* phrase);
ActionConfig* setMediaString(twrap_media_type_t type, const char* key, const char* value);
ActionConfig* setMediaInt(twrap_media_type_t type, const char* key, int value);
private:
tsip_action_handle_t* handle;
#if !defined(SWIG)
public:
const tsip_action_handle_t* getHandle()const{
return this->handle;
}
#endif
};
#endif /* TINYWRAP_ACTIONCONFIG_H */

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file AudioResampler.cxx
* @brief Audio resampler
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*/
#include "AudioResampler.h"
#include "tinymedia/tmedia_resampler.h"
#include "tsk_debug.h"
AudioResampler::AudioResampler(uint32_t nInFreq, uint32_t nOutFreq, uint32_t nFrameDuration, uint32_t nChannels, uint32_t nQuality):
m_nOutFreq(nOutFreq),
m_nInFreq(nInFreq),
m_nFrameDuration(nFrameDuration),
m_nChannels(nChannels),
m_nQuality(nQuality)
{
if((m_pWrappedResampler = tmedia_resampler_create())){
int ret;
if((ret = tmedia_resampler_open(m_pWrappedResampler, nInFreq, nOutFreq, nFrameDuration, nChannels, m_nQuality))){
TSK_DEBUG_ERROR("Failed to open audio resampler (%d)", ret);
TSK_OBJECT_SAFE_FREE(m_pWrappedResampler);
}
}
else{
TSK_DEBUG_ERROR("No audio resampler could be found. Did you forget to call tdav_init()?");
}
}
AudioResampler::~AudioResampler()
{
TSK_OBJECT_SAFE_FREE(m_pWrappedResampler);
}
uint32_t AudioResampler::process(const void* pInData, uint32_t nInSizeInBytes, void* pOutData, uint32_t nOutSizeInBytes)
{
if(!m_pWrappedResampler){
TSK_DEBUG_ERROR("Embedded resampler is invalid");
return 0;
}
if(nInSizeInBytes < getInputRequiredSizeInShort()/2){
TSK_DEBUG_ERROR("Input buffer is too short");
return 0;
}
if(nOutSizeInBytes < getOutputRequiredSizeInShort()/2){
TSK_DEBUG_ERROR("Output buffer is too short");
return 0;
}
return 2*tmedia_resampler_process(m_pWrappedResampler, (uint16_t*)pInData, nInSizeInBytes/2, (uint16_t*)pOutData, nOutSizeInBytes/2);
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file AudioResampler.h
* @brief Audio resampler
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*/
#ifndef TINYWRAP_AUDIO_RESAMPLER_H
#define TINYWRAP_AUDIO_RESAMPLER_H
#include "tinyWRAP_config.h"
class AudioResampler
{
public:
AudioResampler(uint32_t nInFreq, uint32_t nOutFreq, uint32_t nFrameDuration, uint32_t nChannels, uint32_t nQuality);
~AudioResampler();
public:
inline bool isValid(){ return (m_pWrappedResampler != NULL); }
inline uint32_t getOutputRequiredSizeInShort(){ return (m_nOutFreq * m_nFrameDuration)/1000; }
inline uint32_t getInputRequiredSizeInShort(){ return (m_nInFreq * m_nFrameDuration)/1000; }
uint32_t process(const void* pInData, uint32_t nInSizeInBytes, void* pOutData, uint32_t nOutSizeInBytes);
private:
struct tmedia_resampler_s* m_pWrappedResampler;
uint32_t m_nOutFreq;
uint32_t m_nInFreq;
uint32_t m_nFrameDuration;
uint32_t m_nChannels;
uint32_t m_nQuality;
};
#endif /* TINYWRAP_AUDIO_RESAMPLER_H */

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_COMMON_H
#define TINYWRAP_COMMON_H
#if ANDROID
# define dyn_cast static_cast
# define __JNIENV JNIEnv
#else
# define dyn_cast dynamic_cast
# define __JNIENV void
#endif
typedef enum twrap_media_type_e
{
twrap_media_none,
twrap_media_audio,
twrap_media_video,
twrap_media_audiovideo,
twrap_media_msrp
}
twrap_media_type_t;
#endif /* TINYWRAP_COMMON_H */

View File

@ -0,0 +1,142 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "DDebug.h"
#include "SipStack.h"
#include "Common.h"
#if ANDROID /* callbacks will fail with jni */
# include <android/log.h>
# define ANDROID_DEBUG_TAG "tinyWRAP"
#endif
/* Very Important ==> never call functions which could raise debug callbacks into callback functions
* Callbacks should not used with Android (JNI).
*/
enum cb_type{
cb_info,
cb_warn,
cb_error,
cb_fatal
};
int debug_xxx_cb(const void* arg, const char* fmt, enum cb_type type, va_list *app)
{
int ret = -1;
if(!arg){
return -1;
}
const SipStack* stack = dyn_cast<const SipStack*>((const SipStack*)arg);
if(stack && stack->getDebugCallback()){
char* message = tsk_null;
tsk_sprintf_2(&message, fmt, app);
switch(type){
case cb_info:
ret=
#if ANDROID
__android_log_write(ANDROID_LOG_INFO, ANDROID_DEBUG_TAG, message);
#else
stack->getDebugCallback()-> OnDebugInfo(message);
#endif
break;
case cb_warn:
ret=
#if ANDROID
__android_log_write(ANDROID_LOG_WARN, ANDROID_DEBUG_TAG, message);
#else
stack->getDebugCallback()-> OnDebugWarn(message);
#endif
break;
case cb_error:
ret=
#if ANDROID
__android_log_write(ANDROID_LOG_ERROR, ANDROID_DEBUG_TAG, message);
#else
stack->getDebugCallback()-> OnDebugError(message);
#endif
break;
case cb_fatal:
ret=
#if ANDROID
__android_log_write(ANDROID_LOG_FATAL, ANDROID_DEBUG_TAG, message);
#else
stack->getDebugCallback()-> OnDebugFatal(message);
#endif
break;
}
TSK_FREE(message);
}
return ret;
}
int DDebugCallback::debug_info_cb(const void* arg, const char* fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = debug_xxx_cb(arg, fmt, cb_info, &ap);
va_end(ap);
return ret;
}
int DDebugCallback::debug_warn_cb(const void* arg, const char* fmt, ...){
va_list ap;
int ret;
va_start(ap, fmt);
ret = debug_xxx_cb(arg, fmt, cb_warn, &ap);
va_end(ap);
return ret;
}
int DDebugCallback::debug_error_cb(const void* arg, const char* fmt, ...){
va_list ap;
int ret;
va_start(ap, fmt);
ret = debug_xxx_cb(arg, fmt, cb_error, &ap);
va_end(ap);
return ret;
}
int DDebugCallback::debug_fatal_cb(const void* arg, const char* fmt, ...){
va_list ap;
int ret;
va_start(ap, fmt);
ret = debug_xxx_cb(arg, fmt, cb_fatal, &ap);
va_end(ap);
return ret;
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIP_DEBUG_H
#define TINYWRAP_SIP_DEBUG_H
class DDebugCallback
{
public:
DDebugCallback() { }
virtual ~DDebugCallback() {}
virtual int OnDebugInfo(const char* message) { return -1; }
virtual int OnDebugWarn(const char* message) { return -1; }
virtual int OnDebugError(const char* message) { return -1; }
virtual int OnDebugFatal(const char* message) { return -1; }
#if !defined(SWIG)
public:
static int debug_info_cb(const void* arg, const char* fmt, ...);
static int debug_warn_cb(const void* arg, const char* fmt, ...);
static int debug_error_cb(const void* arg, const char* fmt, ...);
static int debug_fatal_cb(const void* arg, const char* fmt, ...);
#endif
private:
};
#endif /* TINYWRAP_SIP_DEBUG_H */

View File

@ -0,0 +1,169 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "MediaContent.h"
MediaContent::MediaContent(tmedia_content_t* _content)
: data(tsk_null)
{
this->content = (tmedia_content_t*)tsk_object_ref(_content);
}
MediaContent::~MediaContent()
{
TSK_OBJECT_SAFE_FREE(this->content);
TSK_OBJECT_SAFE_FREE(this->data);
}
const char* MediaContent::getType()
{
if(this->content){
return this->content->type;
}
return tsk_null;
}
unsigned MediaContent::getDataLength()
{
if(!this->content){
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(!this->data){
this->data = tmedia_content_get_data(this->content);
}
return (this->data ? this->data->size : 0);
}
unsigned MediaContent::getData(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(!this->content){
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(!this->data){
this->data = tmedia_content_get_data(this->content);
}
if(output && maxsize && this->data){
retsize = (this->data->size > maxsize) ? maxsize : this->data->size;
memcpy(output, this->data->data, retsize);
}
return retsize;
}
MediaContent* MediaContent::parse(const void* data, unsigned size, const char* type)
{
MediaContent* mediaContent = tsk_null;
tmedia_content_t* _content = tmedia_content_parse(data, (tsk_size_t)size, type);
if(_content){
if(TMEDIA_CONTENT_IS_CPIM(_content)){
mediaContent = new MediaContentCPIM(_content);
}
else if(TMEDIA_CONTENT_IS_DUMMY(_content)){
// Todo
}
TSK_OBJECT_SAFE_FREE(_content);
}
return mediaContent;
}
MediaContentCPIM* MediaContent::parse(const void* data, unsigned size)
{
MediaContent* mediaContent;
if((mediaContent = MediaContent::parse(data, size, TMEDIA_CONTENT_CPIM_TYPE))){
return dyn_cast<MediaContentCPIM*>(mediaContent);
}
return tsk_null;
}
/* ============ message/CPIM ================= */
MediaContentCPIM::MediaContentCPIM(tmedia_content_t* _content)
: MediaContent(_content)
{
}
MediaContentCPIM::~MediaContentCPIM()
{
}
unsigned MediaContentCPIM::getPayloadLength()
{
if(!this->content || !TMEDIA_CONTENT_IS_CPIM(this->content)){
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
return (TMEDIA_CONTENT_CPIM(this->content)->e ? TMEDIA_CONTENT_CPIM(this->content)->e->size : 0);
}
unsigned MediaContentCPIM::getPayload(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(!this->content || !TMEDIA_CONTENT_IS_CPIM(this->content)){
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(output && maxsize && TMEDIA_CONTENT_CPIM(this->content)->e){
retsize = (TMEDIA_CONTENT_CPIM(this->content)->e->size > maxsize) ? maxsize : TMEDIA_CONTENT_CPIM(this->content)->e->size;
memcpy(output, TMEDIA_CONTENT_CPIM(this->content)->e->data, retsize);
}
return retsize;
}
const char* MediaContentCPIM::getHeaderValue(const char* name)
{
const tmedia_content_cpim_t* cpim;
const tsk_list_item_t* item;
if(!this->content || !TMEDIA_CONTENT_IS_CPIM(this->content)){
TSK_DEBUG_ERROR("Invalid internal object");
return tsk_null;
}
cpim = TMEDIA_CONTENT_CPIM(this->content);
tsk_list_foreach(item, cpim->h_headers){
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)){
return TMEDIA_CONTENT_HEADER(item->data)->value;
}
}
tsk_list_foreach(item, cpim->m_headers){
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)){
return TMEDIA_CONTENT_HEADER(item->data)->value;
}
}
return tsk_null;
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_MEDIA_CONTENT_H
#define TINYWRAP_MEDIA_CONTENT_H
#include "tinymedia.h"
#include "Common.h"
class MediaContentCPIM;
class MediaContent
{
public:
#if !defined(SWIG)
MediaContent(tmedia_content_t* content);
#endif
virtual ~MediaContent();
public:
const char* getType();
virtual unsigned getDataLength();
virtual unsigned getData(void* output, unsigned maxsize);
// SWIG %newobject()
static MediaContent* parse(const void* data, unsigned size, const char* type);
static MediaContentCPIM* parse(const void* data, unsigned size);
virtual unsigned getPayloadLength() = 0;
virtual unsigned getPayload(void* output, unsigned maxsize) = 0;
protected:
tmedia_content_t* content;
private:
tsk_buffer_t* data;
};
/* ============ message/CPIM ================= */
class MediaContentCPIM : public MediaContent
{
public:
#if !defined(SWIG)
MediaContentCPIM(tmedia_content_t* content);
#endif
virtual ~MediaContentCPIM();
public:
virtual unsigned getPayloadLength();
virtual unsigned getPayload(void* output, unsigned maxsize);
const char* getHeaderValue(const char* name);
};
#endif /*TINYWRAP_MEDIA_CONTENT_H*/

View File

@ -0,0 +1,137 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "MediaSessionMgr.h"
extern tmedia_type_t _get_media_type(twrap_media_type_t type);
#if ANDROID
static void *__droid_destroy_mgr(void *mgr){
TSK_OBJECT_SAFE_FREE(mgr);
return tsk_null;
}
#endif
MediaSessionMgr::MediaSessionMgr(tmedia_session_mgr_t* _mgr)
{
this->mgr = (tmedia_session_mgr_t*)tsk_object_ref(_mgr);
}
MediaSessionMgr::~MediaSessionMgr()
{
#if ANDROID
// On Android, deleting the manager from the managed code will trigger OnPluginDestroyed() event
// for each plugin associated to this manager (audio,video,...consumers/producers)
void* tid[1] = { tsk_null };
if(tsk_thread_create(tid, __droid_destroy_mgr, this->mgr) == 0){
tsk_thread_join(tid);
}
else{
TSK_DEBUG_ERROR("Failed to start the thread");
}
#else
TSK_OBJECT_SAFE_FREE(this->mgr);
#endif
}
bool MediaSessionMgr::sessionSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
TSK_DEBUG_ERROR("Not implemented");
return false;
}
bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
TMEDIA_SESSION_CONSUMER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
bool MediaSessionMgr::consumerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
TMEDIA_SESSION_CONSUMER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
bool MediaSessionMgr::producerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
TMEDIA_SESSION_PRODUCER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
bool MediaSessionMgr::producerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = _get_media_type(media);
return (tmedia_session_mgr_set(this->mgr,
TMEDIA_SESSION_PRODUCER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
}
#include "tinydav/audio/tdav_session_audio.h"
#include "tinydav/video/tdav_session_video.h"
#include "ProxyPluginMgr.h"
ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bool consumer)
{
ProxyPlugin* plugin = tsk_null;
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(media != twrap_media_audio && media != twrap_media_video){
TSK_DEBUG_ERROR("Invalid media type");
return tsk_null;
}
if(manager && this->mgr){
tmedia_type_t _media = _get_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(this->mgr, _media);
if(session){
if(session->plugin == tdav_session_audio_plugin_def_t){
if(consumer){
plugin = manager->findPlugin(TDAV_SESSION_AUDIO(session)->consumer);
}
else{
plugin = manager->findPlugin(TDAV_SESSION_AUDIO(session)->producer);
}
}
else if(session->plugin == tdav_session_video_plugin_def_t){
if(consumer){
plugin = manager->findPlugin(TDAV_SESSION_VIDEO(session)->consumer);
}
else{
plugin = manager->findPlugin(TDAV_SESSION_VIDEO(session)->producer);
}
}
tsk_object_unref(session);
}
}
else{
TSK_DEBUG_ERROR("Invalid state");
}
return plugin;
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_MEDIA_SESSIONMGR_H
#define TINYWRAP_MEDIA_SESSIONMGR_H
#include "tinymedia.h"
#include "Common.h"
class ProxyPlugin;
class MediaSessionMgr
{
public:
#if !defined(SWIG)
MediaSessionMgr(tmedia_session_mgr_t* mgr);
#endif
virtual ~MediaSessionMgr();
public:
bool sessionSetInt32(twrap_media_type_t media, const char* key, int32_t value);
bool consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value);
bool consumerSetInt64(twrap_media_type_t media, const char* key, int64_t value);
bool producerSetInt32(twrap_media_type_t media, const char* key, int32_t value);
bool producerSetInt64(twrap_media_type_t media, const char* key, int64_t value);
#if !defined(SWIG)
ProxyPlugin* findProxyPlugin(twrap_media_type_t media, bool consumer);
#endif
ProxyPlugin* findProxyPluginConsumer(twrap_media_type_t media){
return this->findProxyPlugin(media, true);
}
ProxyPlugin* findProxyPluginProducer(twrap_media_type_t media){
return this->findProxyPlugin(media, false);
}
private:
tmedia_session_mgr_t* mgr;
};
#endif /* TINYWRAP_MEDIA_SESSIONMGR_H */

View File

@ -0,0 +1,273 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "Msrp.h"
#include "SipSession.h"
#include "Common.h"
/* ======================== MsrpMessage ========================*/
MsrpMessage::MsrpMessage()
:message(tsk_null)
{
}
MsrpMessage::MsrpMessage(tmsrp_message_t *_message)
{
this->message = (tmsrp_message_t *)tsk_object_ref(_message);
}
MsrpMessage::~MsrpMessage()
{
TSK_OBJECT_SAFE_FREE(this->message);
}
bool MsrpMessage::isRequest()
{
return (this->message->type == tmsrp_request);
}
short MsrpMessage::getCode()
{
return TMSRP_RESPONSE_CODE(this->message);
}
const char* MsrpMessage::getPhrase()
{
return TMSRP_RESPONSE_PHRASE(this->message);
}
tmsrp_request_type_t MsrpMessage::getRequestType()
{
if(TMSRP_MESSAGE_IS_REQUEST(this->message)){
return this->message->line.request.type;
}
return tmsrp_NONE;
}
void MsrpMessage::getByteRange(int64_t* start, int64_t* end, int64_t* total)
{
if(this->message->ByteRange){
*start = this->message->ByteRange->start;
*end = this->message->ByteRange->end;
*total = this->message->ByteRange->total;
}
else{
*start = *end = *total = -1;
}
}
bool MsrpMessage::isLastChunck()
{
if(TMSRP_MESSAGE_IS_REQUEST(this->message)){
return (this->message->end_line.cflag == '$');
}
else{
if(this->message->ByteRange){
return (this->message->ByteRange->end >= this->message->ByteRange->total);
}
}
return false;
}
bool MsrpMessage::isFirstChunck()
{
return (this->message && this->message->ByteRange->start == 1);
}
char* MsrpMessage::getMsrpHeaderValue(const char* name)
{
const tmsrp_header_t* header = this->getMsrpHeader(name, 0);
if(header){
return tmsrp_header_tostring(header);
}
return tsk_null;
}
char* MsrpMessage::getMsrpHeaderParamValue(const char* name, const char* param)
{
return tsk_null;
}
unsigned MsrpMessage::getMsrpContentLength()
{
if(this->message &&
this->message->Content &&
this->message->Content->data &&
this->message->Content->size){
return this->message->Content->size;
}
return 0;
}
unsigned MsrpMessage::getMsrpContent(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(!output ||
!this->message ||
!this->message->Content ||
!this->message->Content->data ||
!this->message->Content->size){
return 0;
}
retsize = (this->message->Content->size > maxsize) ? maxsize : this->message->Content->size;
memcpy(output, this->message->Content->data, retsize);
return retsize;
}
const tmsrp_header_t* MsrpMessage::getMsrpHeader(const char* name, unsigned index /*= 0*/)
{
tsk_size_t pos = 0;
const tmsrp_header_t* hdr = tsk_null;
const tsk_list_item_t *item;
/* From tmsrp_message_get_headerAt() */
if(!this->message || !name){
return tsk_null;
}
if(tsk_striequals(name, "To-Path")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->To;
goto bail;
}else pos++; }
if(tsk_striequals(name, "From-Path")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->From;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Message-ID")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->MessageID;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Byte-Range")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->ByteRange;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Failure-Report")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->FailureReport;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Success-Report")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->SuccessReport;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Status")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->Status;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Content-Type")){
if(index == 0){
hdr = (const tmsrp_header_t*)this->message->ContentType;
goto bail;
}else pos++; }
/* All other headers */
tsk_list_foreach(item, this->message->headers){
if(tsk_striequals(tmsrp_header_get_nameex(TMSRP_HEADER(item->data)), name)){
if(pos++ >= index){
hdr = (const tmsrp_header_t*)item->data;
break;
}
}
}
bail:
return hdr;
}
/* ======================== MsrpEvent ========================*/
MsrpEvent::MsrpEvent(const tmsrp_event_t *_msrpevent)
{
this->_event = _msrpevent;
if(this->_event && this->_event->message){
this->message = new MsrpMessage((tmsrp_message_t *)this->_event->message);
}
else{
this->message = tsk_null;
}
}
MsrpEvent::~MsrpEvent()
{
if(this->message){
delete this->message;
}
}
tmsrp_event_type_t MsrpEvent::getType()
{
if(this->_event){
return this->_event->type;
}
return tmsrp_event_type_none;
}
const MsrpSession* MsrpEvent::getSipSession()
{
if(this->_event && this->_event->callback_data){
return dyn_cast<const MsrpSession*>((const MsrpSession*)this->_event->callback_data);
}
return tsk_null;
}
const MsrpMessage* MsrpEvent::getMessage() const
{
return this->message;
}
int twrap_msrp_cb(const tmsrp_event_t* _event)
{
const MsrpSession* session = (const MsrpSession*)_event->callback_data;
MsrpCallback* callback;
int ret = -1;
if(session){
if((callback = session->getCallback())){
MsrpEvent* e = new MsrpEvent(_event);
ret = callback->OnEvent(e);
delete e;
}
else{
return 0;
}
}
else{
TSK_DEBUG_ERROR("Invalid parameter");
}
return ret;
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_MSRP_H
#define TINYWRAP_MSRP_H
#include "tinymsrp.h"
class MsrpSession;
class MsrpMessage
{
public:
MsrpMessage();
#if !defined(SWIG)
MsrpMessage(tmsrp_message_t *message);
#endif
virtual ~MsrpMessage();
bool isRequest();
short getCode();
const char* getPhrase();
tmsrp_request_type_t getRequestType();
#if defined(SWIG)
void getByteRange(int64_t* OUTPUT, int64_t* OUTPUT, int64_t* OUTPUT);
#else
void getByteRange(int64_t* start, int64_t* end, int64_t* total);
#endif
bool isLastChunck();
bool isFirstChunck();
char* getMsrpHeaderValue(const char* name);
char* getMsrpHeaderParamValue(const char* name, const char* param);
unsigned getMsrpContentLength();
unsigned getMsrpContent(void* output, unsigned maxsize);
private:
const tmsrp_header_t* getMsrpHeader(const char* name, unsigned index = 0);
private:
tmsrp_message_t *message;
};
class MsrpEvent
{
public:
#if !defined(SWIG)
MsrpEvent(const tmsrp_event_t *_event);
#endif
virtual ~MsrpEvent();
tmsrp_event_type_t getType();
const MsrpSession* getSipSession();
const MsrpMessage* getMessage() const;
protected:
const tmsrp_event_t *_event;
MsrpMessage* message;
};
class MsrpCallback
{
public:
MsrpCallback() { }
virtual ~MsrpCallback() {}
virtual int OnEvent(const MsrpEvent* e) { return -1; }
};
#if !defined(SWIG)
int twrap_msrp_cb(const tmsrp_event_t* _event);
#endif
#endif /* TINYWRAP_MSRP_H */

View File

@ -0,0 +1,34 @@
%{
#include "Msrp.h"
%}
/* Callbacks */
%feature("director") MsrpCallback;
%nodefaultctor;
%include "Msrp.h"
%clearnodefaultctor;
/* From tinyMSRP/tmsrp_message.h */
typedef enum tmsrp_request_type_e
{
tmsrp_NONE = 0,
tmsrp_SEND,
tmsrp_REPORT,
tmsrp_AUTH
//...
}
tmsrp_request_type_t;
/* From tinyMSRP/tmsrp_event.h */
typedef enum tmsrp_event_type_e
{
tmsrp_event_type_none,
tmsrp_event_type_connected,
tmsrp_event_type_disconnected,
tmsrp_event_type_message,
}
tmsrp_event_type_t;

View File

@ -0,0 +1,681 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file ProxyConsumer.c
* @brief Audio/Video proxy consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "ProxyConsumer.h"
#include "AudioResampler.h"
#include "tsk_memory.h"
#include "tsk_debug.h"
#include "tinydav/audio/tdav_consumer_audio.h"
#define twrap_consumer_proxy_audio_set tsk_null
#define twrap_consumer_proxy_video_set tsk_null
/* ============ Audio Consumer Interface ================= */
typedef struct twrap_consumer_proxy_audio_s
{
TDAV_DECLARE_CONSUMER_AUDIO;
uint64_t id;
tsk_bool_t started;
}
twrap_consumer_proxy_audio_t;
#define TWRAP_CONSUMER_PROXY_AUDIO(self) ((twrap_consumer_proxy_audio_t*)(self))
int twrap_consumer_proxy_audio_prepare(tmedia_consumer_t* self, const tmedia_codec_t* codec)
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
self->audio.ptime = codec->plugin->audio.ptime;
self->audio.in.channels = codec->plugin->audio.channels;
self->audio.in.rate = codec->plugin->rate;
ret = audioConsumer->getCallback()->prepare((int)codec->plugin->audio.ptime, codec->plugin->rate, codec->plugin->audio.channels);
}
}
return ret;
}
int twrap_consumer_proxy_audio_start(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
ret = audioConsumer->getCallback()->start();
}
}
TWRAP_CONSUMER_PROXY_AUDIO(self)->started = (ret == 0);
return ret;
}
int twrap_consumer_proxy_audio_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size, const tsk_object_t* proto_hdr)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
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);
}
}
return ret;
}
int twrap_consumer_proxy_audio_pause(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
ret = audioConsumer->getCallback()->pause();
}
}
return ret;
}
int twrap_consumer_proxy_audio_stop(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
ret = audioConsumer->getCallback()->stop();
}
}
TWRAP_CONSUMER_PROXY_AUDIO(self)->started = (ret == 0) ? tsk_false : tsk_true;
return ret;
}
//
// Audio consumer object definition
//
/* constructor */
static tsk_object_t* twrap_consumer_proxy_audio_ctor(tsk_object_t * self, va_list * app)
{
twrap_consumer_proxy_audio_t *consumer = (twrap_consumer_proxy_audio_t *)self;
if(consumer){
/* init base */
tdav_consumer_audio_init(TDAV_CONSUMER_AUDIO(consumer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
ProxyPlugin* proxyConsumer = new ProxyAudioConsumer(consumer);
uint64_t id = proxyConsumer->getId();
manager->addPlugin(&proxyConsumer);
manager->getCallback()->OnPluginCreated(id, twrap_proxy_plugin_audio_consumer);
}
}
return self;
}
/* destructor */
static tsk_object_t* twrap_consumer_proxy_audio_dtor(tsk_object_t * self)
{
twrap_consumer_proxy_audio_t *consumer = (twrap_consumer_proxy_audio_t *)self;
if(consumer){
/* stop */
if(consumer->started){
twrap_consumer_proxy_audio_stop(TMEDIA_CONSUMER(consumer));
}
/* deinit base */
tdav_consumer_audio_deinit(TDAV_CONSUMER_AUDIO(consumer));
/* deinit self */
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
manager->getCallback()->OnPluginDestroyed(consumer->id, twrap_proxy_plugin_audio_consumer);
manager->removePlugin(consumer->id);
}
}
return self;
}
/* object definition */
static const tsk_object_def_t twrap_consumer_proxy_audio_def_s =
{
sizeof(twrap_consumer_proxy_audio_t),
twrap_consumer_proxy_audio_ctor,
twrap_consumer_proxy_audio_dtor,
tdav_consumer_audio_cmp,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_audio_plugin_def_s =
{
&twrap_consumer_proxy_audio_def_s,
tmedia_audio,
"Audio Proxy Consumer",
twrap_consumer_proxy_audio_set,
twrap_consumer_proxy_audio_prepare,
twrap_consumer_proxy_audio_start,
twrap_consumer_proxy_audio_consume,
twrap_consumer_proxy_audio_pause,
twrap_consumer_proxy_audio_stop
};
TINYWRAP_GEXTERN const tmedia_consumer_plugin_def_t *twrap_consumer_proxy_audio_plugin_def_t = &twrap_consumer_proxy_audio_plugin_def_s;
/* ============ ProxyAudioConsumer Class ================= */
ProxyAudioConsumer::ProxyAudioConsumer(twrap_consumer_proxy_audio_t* pConsumer)
:ProxyPlugin(twrap_proxy_plugin_audio_consumer),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null)
{
memset(&m_PullBuffer, 0, sizeof(m_PullBuffer));
memset(&m_Resampler, 0, sizeof(m_Resampler));
if(m_pWrappedPlugin){
m_pWrappedPlugin->id = this->getId();
}
}
ProxyAudioConsumer::~ProxyAudioConsumer()
{
TSK_FREE(m_Resampler.pInBufferPtr);
m_Resampler.nInBufferSizeInByte = 0;
if(m_Resampler.pResampler){
delete m_Resampler.pResampler, m_Resampler.pResampler = tsk_null;
}
}
bool ProxyAudioConsumer::queryForResampler(uint16_t nInFreq, uint16_t nOutFreq, uint16_t nFrameDuration, uint16_t nChannels, uint16_t nResamplerQuality)
{
TSK_DEBUG_INFO("queryForResampler(%hu,%hu,%hu,%hu,%hu)", nInFreq, nOutFreq, nFrameDuration, nChannels, nResamplerQuality);
if(nResamplerQuality > 10){
TSK_DEBUG_WARN("%d is invalid value for quality", nResamplerQuality);
}
m_Resampler.pResampler = new AudioResampler(nInFreq, nOutFreq, nFrameDuration, nChannels, nResamplerQuality);
if(!m_Resampler.pResampler){
TSK_DEBUG_ERROR("Failed to create new 'AudioResampler' object");
return false;
}
bool bOK = m_Resampler.pResampler->isValid();
if(!bOK){
goto bail;
}
m_Resampler.nInBufferSizeInByte = m_Resampler.pResampler->getInputRequiredSizeInShort() * 2;
m_Resampler.pInBufferPtr = tsk_calloc(m_Resampler.nInBufferSizeInByte, 1);
bOK = (m_Resampler.pInBufferPtr != tsk_null);
bail:
if(!bOK){
if(m_Resampler.pResampler){
delete m_Resampler.pResampler, m_Resampler.pResampler = tsk_null;
}
TSK_FREE(m_Resampler.pInBufferPtr);
m_Resampler.nInBufferSizeInByte = 0;
}
return bOK;
}
bool ProxyAudioConsumer::setPullBuffer(const void* pPullBufferPtr, unsigned nPullBufferSize)
{
m_PullBuffer.pPullBufferPtr = pPullBufferPtr;
m_PullBuffer.nPullBufferSize = nPullBufferSize;
return true;
}
unsigned ProxyAudioConsumer::pull(void* _pOutput/*=tsk_null*/, unsigned _nSize/*=0*/)
{
if(m_pWrappedPlugin){
void* pOutput;
unsigned nSize;
if(_pOutput && _nSize){
pOutput = _pOutput, nSize = _nSize;
}
else{
pOutput = (void*)m_PullBuffer.pPullBufferPtr, nSize = m_PullBuffer.nPullBufferSize;
}
tsk_size_t nRetSize = 0;
if(m_Resampler.pResampler && m_Resampler.pInBufferPtr){
nRetSize = tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin), m_Resampler.pInBufferPtr, m_Resampler.nInBufferSizeInByte);
if(nRetSize){
nRetSize = m_Resampler.pResampler->process(m_Resampler.pInBufferPtr, nRetSize, pOutput, nSize);
}
}
else{
nRetSize = tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin), pOutput, nSize);
}
tdav_consumer_audio_tick(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin));
return nRetSize;
}
return 0;
}
bool ProxyAudioConsumer::setGain(unsigned nGain)
{
if(m_pWrappedPlugin){
// see also: MediaSessionMgr.consumerSetInt32(org.doubango.tinyWRAP.twrap_media_type_t.twrap_media_audio, "gain", nGain);
TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.gain = TSK_MIN(nGain,14);
return true;
}
return false;
}
unsigned ProxyAudioConsumer::getGain()
{
if(m_pWrappedPlugin){
return TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.gain;
}
return 0;
}
bool ProxyAudioConsumer::reset()
{
if(m_pWrappedPlugin){
return (tdav_consumer_audio_reset(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin)) == 0);
}
return false;
}
bool ProxyAudioConsumer::registerPlugin()
{
/* HACK: Unregister all other audio plugins */
tmedia_consumer_plugin_unregister_by_type(tmedia_audio);
/* Register our proxy plugin */
return (tmedia_consumer_plugin_register(twrap_consumer_proxy_audio_plugin_def_t) == 0);
}
/* ============ Video Consumer Interface ================= */
typedef struct twrap_consumer_proxy_video_s
{
TMEDIA_DECLARE_CONSUMER;
uint64_t id;
tsk_bool_t started;
}
twrap_consumer_proxy_video_t;
#define TWRAP_CONSUMER_PROXY_VIDEO(self) ((twrap_consumer_proxy_video_t*)(self))
int twrap_consumer_proxy_video_prepare(tmedia_consumer_t* self, const tmedia_codec_t* codec)
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
self->video.fps = TMEDIA_CODEC_VIDEO(codec)->fps;
// in
self->video.in.chroma = tmedia_yuv420p;
self->video.in.width = TMEDIA_CODEC_VIDEO(codec)->width;
self->video.in.height = TMEDIA_CODEC_VIDEO(codec)->height;
// display (out)
self->video.display.chroma = videoConsumer->getChroma();
self->video.display.auto_resize = videoConsumer->getAutoResizeDisplay();
if(!self->video.display.width){
self->video.display.width = self->video.in.width;
}
if(!self->video.display.height){
self->video.display.height = self->video.in.height;
}
ret = videoConsumer->getCallback()->prepare(TMEDIA_CODEC_VIDEO(codec)->width, TMEDIA_CODEC_VIDEO(codec)->height, TMEDIA_CODEC_VIDEO(codec)->fps);
}
}
return ret;
}
int twrap_consumer_proxy_video_start(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
ret = videoConsumer->getCallback()->start();
}
}
TWRAP_CONSUMER_PROXY_VIDEO(self)->started = (ret == 0);
return ret;
}
int twrap_consumer_proxy_video_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size, const tsk_object_t* proto_hdr)
{
ProxyPluginMgr* manager;
int ret = -1;
if(!self || !buffer || !size){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
if(videoConsumer->hasConsumeBuffer()){
unsigned nCopiedSize = videoConsumer->copyBuffer(buffer, size);
ret = videoConsumer->getCallback()->bufferCopied(nCopiedSize, size);
}
else{
ProxyVideoFrame* frame = new ProxyVideoFrame(buffer, size);
ret = videoConsumer->getCallback()->consume(frame);
delete frame, frame = tsk_null;
}
}
}
return ret;
}
int twrap_consumer_proxy_video_pause(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
ret = videoConsumer->getCallback()->pause();
}
}
return ret;
}
int twrap_consumer_proxy_video_stop(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
ret = videoConsumer->getCallback()->stop();
}
}
TWRAP_CONSUMER_PROXY_VIDEO(self)->started = (ret == 0) ? tsk_false : tsk_true;
return ret;
}
//
// Video consumer object definition
//
/* constructor */
static tsk_object_t* twrap_consumer_proxy_video_ctor(tsk_object_t * self, va_list * app)
{
twrap_consumer_proxy_video_t *consumer = (twrap_consumer_proxy_video_t *)self;
if(consumer){
/* init base */
tmedia_consumer_init(TMEDIA_CONSUMER(consumer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
ProxyPlugin* proxyConsumer = new ProxyVideoConsumer(ProxyVideoConsumer::getDefaultChroma(), consumer);
uint64_t id = proxyConsumer->getId();
manager->addPlugin(&proxyConsumer);
manager->getCallback()->OnPluginCreated(id, twrap_proxy_plugin_video_consumer);
}
}
return self;
}
/* destructor */
static tsk_object_t* twrap_consumer_proxy_video_dtor(tsk_object_t * self)
{
twrap_consumer_proxy_video_t *consumer = (twrap_consumer_proxy_video_t *)self;
if(consumer){
/* stop */
if(consumer->started){
twrap_consumer_proxy_video_stop(TMEDIA_CONSUMER(consumer));
}
/* deinit base */
tmedia_consumer_deinit(TMEDIA_CONSUMER(consumer));
/* deinit self */
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
manager->getCallback()->OnPluginDestroyed(consumer->id, twrap_proxy_plugin_video_consumer);
manager->removePlugin(consumer->id);
}
}
return self;
}
/* object definition */
static const tsk_object_def_t twrap_consumer_proxy_video_def_s =
{
sizeof(twrap_consumer_proxy_video_t),
twrap_consumer_proxy_video_ctor,
twrap_consumer_proxy_video_dtor,
tsk_null,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_video_plugin_def_s =
{
&twrap_consumer_proxy_video_def_s,
tmedia_video,
"Video Proxy Consumer",
twrap_consumer_proxy_video_set,
twrap_consumer_proxy_video_prepare,
twrap_consumer_proxy_video_start,
twrap_consumer_proxy_video_consume,
twrap_consumer_proxy_video_pause,
twrap_consumer_proxy_video_stop
};
TINYWRAP_GEXTERN const tmedia_consumer_plugin_def_t *twrap_consumer_proxy_video_plugin_def_t = &twrap_consumer_proxy_video_plugin_def_s;
/* ============ ProxyVideoConsumer Class ================= */
tmedia_chroma_t ProxyVideoConsumer::s_eDefaultChroma = tmedia_rgb565le;
bool ProxyVideoConsumer::s_bAutoResizeDisplay = false;
ProxyVideoConsumer::ProxyVideoConsumer(tmedia_chroma_t eChroma, struct twrap_consumer_proxy_video_s* pConsumer)
: m_eChroma(eChroma),
m_bAutoResizeDisplay(ProxyVideoConsumer::getDefaultAutoResizeDisplay()),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null),
ProxyPlugin(twrap_proxy_plugin_video_consumer)
{
m_pWrappedPlugin->id = this->getId();
m_ConsumeBuffer.pConsumeBufferPtr = tsk_null;
m_ConsumeBuffer.nConsumeBufferSize = 0;
}
ProxyVideoConsumer::~ProxyVideoConsumer()
{
}
bool ProxyVideoConsumer::setDisplaySize(unsigned nWidth, unsigned nHeight)
{
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.width = nWidth;
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.height = nHeight;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
return true;
}
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
return false;
}
unsigned ProxyVideoConsumer::getDisplayWidth()
{
unsigned displayWidth = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
displayWidth = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.width;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return displayWidth;
}
unsigned ProxyVideoConsumer::getDisplayHeight()
{
unsigned displayHeight = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
displayHeight = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.height;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return displayHeight;
}
tmedia_chroma_t ProxyVideoConsumer::getChroma()
{
return m_eChroma;
}
bool ProxyVideoConsumer::setAutoResizeDisplay(bool bAutoResizeDisplay){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.auto_resize = bAutoResizeDisplay ? tsk_true : tsk_false;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
m_bAutoResizeDisplay = bAutoResizeDisplay;
return true;
}
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
return false;
}
bool ProxyVideoConsumer::getAutoResizeDisplay()
{
return m_bAutoResizeDisplay;
}
bool ProxyVideoConsumer::setConsumeBuffer(const void* pConsumeBufferPtr, unsigned nConsumeBufferSize)
{
m_ConsumeBuffer.pConsumeBufferPtr = pConsumeBufferPtr;
m_ConsumeBuffer.nConsumeBufferSize = nConsumeBufferSize;
return true;
}
unsigned ProxyVideoConsumer::copyBuffer(const void* pBuffer, unsigned nSize)
{
unsigned nRetsize = 0;
if(pBuffer && nSize && m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize){
nRetsize = (nSize > m_ConsumeBuffer.nConsumeBufferSize) ? m_ConsumeBuffer.nConsumeBufferSize : nSize;
memcpy((void*)m_ConsumeBuffer.pConsumeBufferPtr, pBuffer, nRetsize);
}
return nRetsize;
}
bool ProxyVideoConsumer::registerPlugin()
{
/* HACK: Unregister all other video plugins */
tmedia_consumer_plugin_unregister_by_type(tmedia_video);
/* Register our proxy plugin */
return (tmedia_consumer_plugin_register(twrap_consumer_proxy_video_plugin_def_t) == 0);
}
ProxyVideoFrame::ProxyVideoFrame(const void* pBuffer, unsigned nSize)
{
m_pBuffer = pBuffer;
nSize = nSize;
}
ProxyVideoFrame::~ProxyVideoFrame()
{
}
unsigned ProxyVideoFrame::getSize()
{
return m_nSize;
}
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);
}
return nRetsize;
}

View File

@ -0,0 +1,194 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file ProxyConsumer.h
* @brief Audio/Video proxy consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*/
#ifndef TINYWRAP_CONSUMER_PROXY_H
#define TINYWRAP_CONSUMER_PROXY_H
#include "tinyWRAP_config.h"
#include "ProxyPluginMgr.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_consumer.h"
class AudioResampler;
/* ============ ProxyAudioConsumerCallback Class ================= */
class ProxyAudioConsumerCallback
{
public:
ProxyAudioConsumerCallback() { }
virtual ~ProxyAudioConsumerCallback(){ }
virtual int prepare(int ptime, int rate, int channels) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
};
/* ============ ProxyAudioConsumer Class ================= */
class ProxyAudioConsumer : public ProxyPlugin
{
public:
#if !defined(SWIG)
ProxyAudioConsumer(struct twrap_consumer_proxy_audio_s* pConsumer);
#endif
virtual ~ProxyAudioConsumer();
bool queryForResampler(uint16_t nInFreq, uint16_t nOutFreq, uint16_t nFrameDuration, uint16_t nChannels, uint16_t nResamplerQuality);
bool setPullBuffer(const void* pPullBufferPtr, unsigned nPullBufferSize);
unsigned pull(void* pOutput=tsk_null, unsigned nSize=0);
bool setGain(unsigned nGain);
unsigned getGain();
bool reset();
void setCallback(ProxyAudioConsumerCallback* pCallback) { m_pCallback = pCallback; }
#if !defined(SWIG)
inline ProxyAudioConsumerCallback* getCallback() { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin){
return m_pWrappedPlugin == pWrappedPlugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
return m_pWrappedPlugin ? TMEDIA_CONSUMER(m_pWrappedPlugin)->session_id : 0;
}
public:
static bool registerPlugin();
private:
struct twrap_consumer_proxy_audio_s* m_pWrappedPlugin;
ProxyAudioConsumerCallback* m_pCallback;
struct{
const void* pPullBufferPtr;
unsigned nPullBufferSize;
} m_PullBuffer;
struct{
void* pInBufferPtr;
unsigned nInBufferSizeInByte;
AudioResampler* pResampler;
} m_Resampler;
};
class ProxyVideoFrame;
/* ============ ProxyVideoConsumerCallback Class ================= */
class ProxyVideoConsumerCallback
{
public:
ProxyVideoConsumerCallback(){}
virtual ~ProxyVideoConsumerCallback() {}
virtual int prepare(int nWidth, int nHeight, int nFps) { return -1; }
virtual int consume(const ProxyVideoFrame* frame) { return -1; }
virtual int bufferCopied(unsigned nCopiedSize, unsigned nAvailableSize) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
};
/* ============ ProxyVideoConsumer Class ================= */
class ProxyVideoConsumer : public ProxyPlugin
{
public:
#if !defined(SWIG)
ProxyVideoConsumer(tmedia_chroma_t eChroma, struct twrap_consumer_proxy_video_s* pConsumer);
#endif
virtual ~ProxyVideoConsumer();
bool setDisplaySize(unsigned nWidth, unsigned nHeight);
unsigned getDisplayWidth();
unsigned getDisplayHeight();
void setCallback(ProxyVideoConsumerCallback* pCallback) { m_pCallback = pCallback; }
bool setAutoResizeDisplay(bool bAutoResizeDisplay);
bool getAutoResizeDisplay();
bool setConsumeBuffer(const void* pConsumeBufferPtr, unsigned nConsumeBufferSize);
#if !defined(SWIG)
bool hasConsumeBuffer() { return m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize; }
unsigned copyBuffer(const void* pBuffer, unsigned nSize);
inline ProxyVideoConsumerCallback* getCallback() { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin){
return m_pWrappedPlugin == wrapped_plugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
return m_pWrappedPlugin ? TMEDIA_CONSUMER(m_pWrappedPlugin)->session_id : 0;
}
public:
static bool registerPlugin();
static void setDefaultChroma(tmedia_chroma_t eChroma){ s_eDefaultChroma = eChroma; }
static void setDefaultAutoResizeDisplay(bool bAutoResizeDisplay){ s_bAutoResizeDisplay = bAutoResizeDisplay;}
#if !defined(SWIG)
tmedia_chroma_t getChroma();
static tmedia_chroma_t getDefaultChroma() { return s_eDefaultChroma; }
static bool getDefaultAutoResizeDisplay() { return s_bAutoResizeDisplay; }
#endif
private:
struct twrap_consumer_proxy_video_s* m_pWrappedPlugin;
tmedia_chroma_t m_eChroma;
ProxyVideoConsumerCallback* m_pCallback;
struct{
const void* pConsumeBufferPtr;
unsigned nConsumeBufferSize;
} m_ConsumeBuffer;
bool m_bAutoResizeDisplay;
static tmedia_chroma_t s_eDefaultChroma;
static bool s_bAutoResizeDisplay;
};
/* ============ ProxyVideoFrame Class ================= */
class ProxyVideoFrame
{
public:
#if !defined(SWIG)
ProxyVideoFrame(const void* pBuffer, unsigned nSize);
#endif
virtual ~ProxyVideoFrame();
public: /* For Java/C# applications */
unsigned getSize();
unsigned getContent(void* pOutput, unsigned nMaxsize);
#if !defined(SWIG) /* For C/C++ applications */
public:
inline unsigned fastGetSize()const{ return m_nSize; }
inline const void* fastGetContent()const{ return m_pBuffer; }
#endif
private:
const void* m_pBuffer;
unsigned m_nSize;
};
#endif /* TINYWRAP_CONSUMER_PROXY_H */

View File

@ -0,0 +1,290 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "ProxyPluginMgr.h"
#include "ProxyConsumer.h"
#include "ProxyProducer.h"
//
// "twrap_proxy_plugin_t" Declarations
//
typedef struct twrap_proxy_plugin_s
{
TSK_DECLARE_OBJECT;
ProxyPlugin* plugin;
}
twrap_proxy_plugin_t;
#define TWRAP_PROXY_PLUGIN(self) ((twrap_proxy_plugin_t*)(self))
static int pred_find_plugin_by_value(const tsk_list_item_t *item, const void *proxyPlugin);
static twrap_proxy_plugin_t* twrap_proxy_plugin_create(ProxyPlugin** plugin);
//
// "ProxyPluginMgr" Class Implementation
//
ProxyPluginMgr* ProxyPluginMgr::instance = tsk_null;
static uint64_t __uniqueId = 0;
ProxyPluginMgr::ProxyPluginMgr(ProxyPluginMgrCallback* _callback)
:callback(_callback)
{
this->plugins = tsk_list_create();
if(!this->callback){
TSK_DEBUG_WARN("Callback function is Null => You will have big problems as we won't check it before call");
}
}
ProxyPluginMgr::~ProxyPluginMgr()
{
if(this == ProxyPluginMgr::instance){
ProxyPluginMgr::instance = tsk_null;
}
TSK_OBJECT_SAFE_FREE(this->plugins);
}
ProxyPluginMgr* ProxyPluginMgr::createInstance(ProxyPluginMgrCallback* _callback)
{
if(!ProxyPluginMgr::instance){
ProxyPluginMgr::instance = new ProxyPluginMgr(_callback);
}
else{
TSK_DEBUG_WARN("Plugin instance already exist");
ProxyPluginMgr::instance->callback = _callback;
}
return ProxyPluginMgr::instance;
}
ProxyPluginMgr* ProxyPluginMgr::getInstance()
{
if(!ProxyPluginMgr::instance){
TSK_DEBUG_ERROR("No instance of the manager could be found");
}
return ProxyPluginMgr::instance;
}
uint64_t ProxyPluginMgr::getUniqueId()
{
return ++__uniqueId;
}
int ProxyPluginMgr::addPlugin(ProxyPlugin** plugin)
{
twrap_proxy_plugin_t* twrap_plugin;
int ret = -1;
tsk_list_lock(this->plugins);
if(!plugin || !*plugin){
TSK_DEBUG_ERROR("Invalid parameter");
goto bail;
}
if(tsk_list_find_item_by_pred(this->plugins, pred_find_plugin_by_value, *plugin)){
TSK_DEBUG_ERROR("Plugin already exist");
goto bail;
}
if((twrap_plugin = twrap_proxy_plugin_create(plugin))){
tsk_list_push_back_data(this->plugins, (void**)&twrap_plugin);
ret = 0;
}
else{
TSK_DEBUG_ERROR("Failed to create plugin");
goto bail;
}
bail:
tsk_list_unlock(this->plugins);
return ret;
}
int ProxyPluginMgr::removePlugin(ProxyPlugin** plugin)
{
if(!plugin || !*plugin){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
return this->removePlugin((*plugin)->getId());
}
ProxyPlugin* ProxyPluginMgr::findPlugin(uint64_t id)
{
ProxyPlugin* ret = tsk_null;
tsk_list_item_t* item;
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id){
ret = TWRAP_PROXY_PLUGIN(item->data)->plugin;
break;
}
}
tsk_list_unlock(this->plugins);
return ret;
}
ProxyPlugin* ProxyPluginMgr::findPlugin(tsk_object_t* wrapped_plugin)
{
ProxyPlugin* ret = tsk_null;
tsk_list_item_t* item;
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->isWrapping(wrapped_plugin)){
ret = TWRAP_PROXY_PLUGIN(item->data)->plugin;
break;
}
}
tsk_list_unlock(this->plugins);
return ret;
}
int ProxyPluginMgr::removePlugin(uint64_t id)
{
tsk_list_item_t* item;
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id){
tsk_list_remove_item(this->plugins, item);
break;
}
}
tsk_list_unlock(this->plugins);
return 0;
}
ProxyAudioConsumer* ProxyPluginMgr::findAudioConsumer(uint64_t id)
{
ProxyPlugin* audioConsumer = this->findPlugin(id);
if(audioConsumer && audioConsumer->getType() == twrap_proxy_plugin_audio_consumer){
return dyn_cast<ProxyAudioConsumer*>(audioConsumer);
}
return tsk_null;
}
ProxyVideoConsumer* ProxyPluginMgr::findVideoConsumer(uint64_t id)
{
ProxyPlugin* videoConsumer = this->findPlugin(id);
if(videoConsumer && videoConsumer->getType() == twrap_proxy_plugin_video_consumer){
return dyn_cast<ProxyVideoConsumer*>(videoConsumer);
}
return tsk_null;
}
ProxyAudioProducer* ProxyPluginMgr::findAudioProducer(uint64_t id)
{
ProxyPlugin* audioProducer = this->findPlugin(id);
if(audioProducer && audioProducer->getType() == twrap_proxy_plugin_audio_producer){
return dyn_cast<ProxyAudioProducer*>(audioProducer);
}
return tsk_null;
}
ProxyVideoProducer* ProxyPluginMgr::findVideoProducer(uint64_t id)
{
ProxyPlugin* videoProducer = this->findPlugin(id);
if(videoProducer && videoProducer->getType() == twrap_proxy_plugin_video_producer){
return dyn_cast<ProxyVideoProducer*>(videoProducer);
}
return tsk_null;
}
//
// "twrap_proxy_plugin_t" Implementations
//
static tsk_object_t* twrap_proxy_plugin_ctor(tsk_object_t * self, va_list * app)
{
twrap_proxy_plugin_t *_self = dyn_cast<twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(self));
if(_self){
}
return self;
}
static tsk_object_t* twrap_proxy_plugin_dtor(tsk_object_t * self)
{
twrap_proxy_plugin_t *_self = dyn_cast<twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(self));
if(_self){
if(_self->plugin){
delete _self->plugin, _self->plugin = tsk_null;
}
}
return self;
}
static int twrap_proxy_plugin_cmp(const tsk_object_t *_c1, const tsk_object_t *_c2)
{
const twrap_proxy_plugin_t *c1 = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(_c1));
const twrap_proxy_plugin_t *c2 = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(_c2));
if(c1 && c2){
return (c1->plugin == c2->plugin); // See "ProxyPlugin::operator =="
}
else if(!c1 && !c2) return 0;
else return -1;
}
static const tsk_object_def_t twrap_proxy_plugin_def_s =
{
sizeof(twrap_proxy_plugin_t),
twrap_proxy_plugin_ctor,
twrap_proxy_plugin_dtor,
twrap_proxy_plugin_cmp,
};
const tsk_object_def_t *twrap_proxy_plugin_def_t = &twrap_proxy_plugin_def_s;
static int pred_find_plugin_by_value(const tsk_list_item_t *item, const void *proxyPlugin)
{
if(item && item->data){
const twrap_proxy_plugin_t *twrap_plugin = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(item->data));
return (twrap_plugin->plugin == dyn_cast<const ProxyPlugin *>((const ProxyPlugin*)proxyPlugin)) ? 0 : -1;
}
return -1;
}
static twrap_proxy_plugin_t* twrap_proxy_plugin_create(ProxyPlugin** plugin)
{
if(!plugin || !*plugin){
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
twrap_proxy_plugin_t* twrap_plugin = (twrap_proxy_plugin_t*)tsk_object_new(twrap_proxy_plugin_def_t);
if(!twrap_plugin){
TSK_DEBUG_ERROR("Failed to create new instance of 'twrap_proxy_plugin_t'");
return tsk_null;
}
twrap_plugin->plugin = *plugin,
*plugin = tsk_null;
return twrap_plugin;
}

View File

@ -0,0 +1,124 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_PROXY_PLUGIN_MGR_H
#define TINYWRAP_PROXY_PLUGIN_MGR_H
#include "tinymedia.h"
#include "Common.h"
class ProxyPlugin;
class ProxyConsumer;
class ProxyAudioConsumer;
class ProxyVideoConsumer;
class ProxyAudioProducer;
class ProxyVideoProducer;
class ProxyPluginMgrCallback;
typedef enum twrap_proxy_plugin_type_e
{
twrap_proxy_plugin_audio_producer,
twrap_proxy_plugin_video_producer,
twrap_proxy_plugin_audio_consumer,
twrap_proxy_plugin_video_consumer,
}
twrap_proxy_plugin_type_t;
/* ============ ProxyPluginMgr Class ================= */
typedef tsk_list_t twrap_proxy_plungins_L_t; // contains "twrap_proxy_plungin_t" elements
class ProxyPluginMgr
{
private:
ProxyPluginMgr(ProxyPluginMgrCallback* callback);
public:
virtual ~ProxyPluginMgr();
// SWIG %newobject
static ProxyPluginMgr* createInstance(ProxyPluginMgrCallback* callback);
static ProxyPluginMgr* getInstance();
#if !defined(SWIG)
static uint64_t getUniqueId();
int addPlugin(ProxyPlugin**);
ProxyPlugin* findPlugin(uint64_t id);
ProxyPlugin* findPlugin(tsk_object_t* wrapped_plugin);
int removePlugin(uint64_t id);
int removePlugin(ProxyPlugin**);
inline ProxyPluginMgrCallback* getCallback(){ return this->callback; }
#endif
ProxyAudioConsumer* findAudioConsumer(uint64_t id);
ProxyVideoConsumer* findVideoConsumer(uint64_t id);
ProxyAudioProducer* findAudioProducer(uint64_t id);
ProxyVideoProducer* findVideoProducer(uint64_t id);
private:
static ProxyPluginMgr* instance;
ProxyPluginMgrCallback* callback;
twrap_proxy_plungins_L_t* plugins;
};
/* ============ ProxyPluginMgrCallback Class ================= */
class ProxyPluginMgrCallback
{
public:
ProxyPluginMgrCallback() { }
virtual ~ProxyPluginMgrCallback() { }
virtual int OnPluginCreated(uint64_t id, enum twrap_proxy_plugin_type_e type) { return -1; }
virtual int OnPluginDestroyed(uint64_t id, enum twrap_proxy_plugin_type_e type) { return -1; }
};
/* ============ ProxyPlugin Class ================= */
class ProxyPlugin
{
public:
#if !defined SWIG
ProxyPlugin(twrap_proxy_plugin_type_t _type) {
this->type=_type;
this->id = ProxyPluginMgr::getUniqueId();
}
#endif
virtual ~ProxyPlugin() {}
#if !defined(SWIG)
virtual bool operator ==(const ProxyPlugin &plugin)const{
return this->getId() == plugin.getId();
}
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin) = 0;
virtual inline uint64_t getMediaSessionId() = 0;
#endif
inline twrap_proxy_plugin_type_t getType()const{ return this->type; }
inline uint64_t getId()const{ return this->id; }
protected:
uint64_t id;
twrap_proxy_plugin_type_t type;
};
#endif /* TINYWRAP_PROXY_PLUGIN_MGR_H */

View File

@ -0,0 +1,476 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file ProxyProducer.c
* @brief Audio/Video proxy producers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "ProxyProducer.h"
#include "tsk_memory.h"
#include "tsk_debug.h"
#include "tinydav/audio/tdav_producer_audio.h"
#define twrap_producer_proxy_audio_set tsk_null
#define twrap_producer_proxy_video_set tsk_null
/* ============ Audio Media Producer Interface ================= */
typedef struct twrap_producer_proxy_audio_s
{
TDAV_DECLARE_PRODUCER_AUDIO;
uint64_t id;
tsk_bool_t started;
}
twrap_producer_proxy_audio_t;
#define TWRAP_PRODUCER_PROXY_AUDIO(self) ((twrap_producer_proxy_audio_t*)(self))
int twrap_producer_proxy_audio_prepare(tmedia_producer_t* self, const tmedia_codec_t* codec)
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
self->audio.channels = codec->plugin->audio.channels;
self->audio.rate = codec->plugin->rate;
self->audio.ptime = codec->plugin->audio.ptime;
ret = audioProducer->getCallback()->prepare((int)codec->plugin->audio.ptime, codec->plugin->rate, codec->plugin->audio.channels);
}
}
return ret;
}
int twrap_producer_proxy_audio_start(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
ret = audioProducer->getCallback()->start();
}
}
TWRAP_PRODUCER_PROXY_AUDIO(self)->started = (ret == 0);
return ret;
}
int twrap_producer_proxy_audio_pause(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
ret = audioProducer->getCallback()->pause();
}
}
return ret;
}
int twrap_producer_proxy_audio_stop(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
ret = audioProducer->getCallback()->stop();
}
}
TWRAP_PRODUCER_PROXY_AUDIO(self)->started = (ret == 0) ? tsk_false : tsk_true;
return ret;
}
//
// Audio producer object definition
//
/* constructor */
static tsk_object_t* twrap_producer_proxy_audio_ctor(tsk_object_t * self, va_list * app)
{
twrap_producer_proxy_audio_t *producer = (twrap_producer_proxy_audio_t *)self;
if(producer){
/* init base */
tdav_producer_audio_init(TDAV_PRODUCER_AUDIO(producer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
ProxyPlugin* proxyProducer = new ProxyAudioProducer(producer);
uint64_t id = proxyProducer->getId();
manager->addPlugin(&proxyProducer);
manager->getCallback()->OnPluginCreated(id, twrap_proxy_plugin_audio_producer);
}
}
return self;
}
/* destructor */
static tsk_object_t* twrap_producer_proxy_audio_dtor(tsk_object_t * self)
{
twrap_producer_proxy_audio_t *producer = (twrap_producer_proxy_audio_t *)self;
if(producer){
/* stop */
if(producer->started){
twrap_producer_proxy_audio_stop(TMEDIA_PRODUCER(producer));
}
/* deinit base */
tdav_producer_audio_deinit(TDAV_PRODUCER_AUDIO(producer));
/* deinit self */
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
manager->getCallback()->OnPluginDestroyed(producer->id, twrap_proxy_plugin_audio_producer);
manager->removePlugin(producer->id);
}
}
return self;
}
/* object definition */
static const tsk_object_def_t twrap_producer_proxy_audio_def_s =
{
sizeof(twrap_producer_proxy_audio_t),
twrap_producer_proxy_audio_ctor,
twrap_producer_proxy_audio_dtor,
tdav_producer_audio_cmp,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t twrap_producer_proxy_audio_plugin_def_s =
{
&twrap_producer_proxy_audio_def_s,
tmedia_audio,
"Audio Proxy Producer",
twrap_producer_proxy_audio_set,
twrap_producer_proxy_audio_prepare,
twrap_producer_proxy_audio_start,
twrap_producer_proxy_audio_pause,
twrap_producer_proxy_audio_stop
};
TINYWRAP_GEXTERN const tmedia_producer_plugin_def_t *twrap_producer_proxy_audio_plugin_def_t = &twrap_producer_proxy_audio_plugin_def_s;
/* ============ ProxyAudioProducer Class ================= */
ProxyAudioProducer::ProxyAudioProducer(twrap_producer_proxy_audio_t* pProducer)
:m_pCallback(tsk_null), m_pWrappedPlugin(pProducer), ProxyPlugin(twrap_proxy_plugin_audio_producer)
{
m_pWrappedPlugin->id = this->getId();
m_PushBuffer.pPushBufferPtr = tsk_null;
m_PushBuffer.nPushBufferSize = 0;
}
ProxyAudioProducer::~ProxyAudioProducer()
{
}
bool ProxyAudioProducer::setPushBuffer(const void* pPushBufferPtr, unsigned nPushBufferSize)
{
m_PushBuffer.pPushBufferPtr = pPushBufferPtr;
m_PushBuffer.nPushBufferSize = nPushBufferSize;
return true;
}
int ProxyAudioProducer::push(const void* _pBuffer/*=tsk_null*/, unsigned _nSize/*=0*/)
{
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback){
const void* pBuffer;
unsigned nSize;
if(_pBuffer && _nSize){
pBuffer = _pBuffer, nSize = _nSize;
}
else{
pBuffer = m_PushBuffer.pPushBufferPtr, nSize = m_PushBuffer.nPushBufferSize;
}
return TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback(TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback_data, pBuffer, nSize);
}
return 0;
}
bool ProxyAudioProducer::setGain(unsigned nGain)
{
if(m_pWrappedPlugin){
// see also: MediaSessionMgr.producerSetInt32(org.doubango.tinyWRAP.twrap_media_type_t.twrap_media_audio, "gain", nGain);
TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.gain = TSK_MIN(nGain,14);
return true;
}
return false;
}
unsigned ProxyAudioProducer::getGain()
{
if(m_pWrappedPlugin){
return TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.gain;
}
return 0;
}
bool ProxyAudioProducer::registerPlugin()
{
/* HACK: Unregister all other audio plugins */
tmedia_producer_plugin_unregister_by_type(tmedia_audio);
/* Register our proxy plugin */
return (tmedia_producer_plugin_register(twrap_producer_proxy_audio_plugin_def_t) == 0);
}
/* ============ Video Media Producer Interface ================= */
typedef struct twrap_producer_proxy_video_s
{
TMEDIA_DECLARE_PRODUCER;
int rotation;
uint64_t id;
tsk_bool_t started;
}
twrap_producer_proxy_video_t;
#define TWRAP_PRODUCER_PROXY_VIDEO(self) ((twrap_producer_proxy_video_t*)(self))
int twrap_producer_proxy_video_prepare(tmedia_producer_t* self, const tmedia_codec_t* codec)
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
self->video.chroma = videoProducer->getChroma();
self->video.rotation = videoProducer->getRotation();
ret = videoProducer->getCallback()->prepare(TMEDIA_CODEC_VIDEO(codec)->width, TMEDIA_CODEC_VIDEO(codec)->height, TMEDIA_CODEC_VIDEO(codec)->fps);
}
}
return ret;
}
int twrap_producer_proxy_video_start(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
ret = videoProducer->getCallback()->start();
}
}
TWRAP_PRODUCER_PROXY_VIDEO(self)->started = (ret == 0);
return ret;
}
int twrap_producer_proxy_video_pause(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
ret = videoProducer->getCallback()->pause();
}
}
return ret;
}
int twrap_producer_proxy_video_stop(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
ret = videoProducer->getCallback()->stop();
}
}
TWRAP_PRODUCER_PROXY_VIDEO(self)->started = (ret == 0) ? tsk_false : tsk_true;
return ret;
}
//
// Video producer object definition
//
/* constructor */
static tsk_object_t* twrap_producer_proxy_video_ctor(tsk_object_t * self, va_list * app)
{
twrap_producer_proxy_video_t *producer = (twrap_producer_proxy_video_t *)self;
if(producer){
/* init base */
tmedia_producer_init(TMEDIA_PRODUCER(producer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
ProxyPlugin* proxyProducer = new ProxyVideoProducer(ProxyVideoProducer::getDefaultChroma(), producer);
uint64_t id = proxyProducer->getId();
manager->addPlugin(&proxyProducer);
manager->getCallback()->OnPluginCreated(id, twrap_proxy_plugin_video_producer);
}
}
return self;
}
/* destructor */
static tsk_object_t* twrap_producer_proxy_video_dtor(tsk_object_t * self)
{
twrap_producer_proxy_video_t *producer = (twrap_producer_proxy_video_t *)self;
if(producer){
/* stop */
if(producer->started){
twrap_producer_proxy_video_stop(TMEDIA_PRODUCER(producer));
}
/* deinit base */
tmedia_producer_deinit(TMEDIA_PRODUCER(producer));
/* deinit self */
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
manager->getCallback()->OnPluginDestroyed(producer->id, twrap_proxy_plugin_video_producer);
manager->removePlugin(producer->id);
}
}
return self;
}
/* object definition */
static const tsk_object_def_t twrap_producer_proxy_video_def_s =
{
sizeof(twrap_producer_proxy_video_t),
twrap_producer_proxy_video_ctor,
twrap_producer_proxy_video_dtor,
tsk_null,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t twrap_producer_proxy_video_plugin_def_s =
{
&twrap_producer_proxy_video_def_s,
tmedia_video,
"Video Proxy Producer",
twrap_producer_proxy_video_set,
twrap_producer_proxy_video_prepare,
twrap_producer_proxy_video_start,
twrap_producer_proxy_video_pause,
twrap_producer_proxy_video_stop
};
TINYWRAP_GEXTERN const tmedia_producer_plugin_def_t *twrap_producer_proxy_video_plugin_def_t = &twrap_producer_proxy_video_plugin_def_s;
/* ============ ProxyVideoProducer Class ================= */
tmedia_chroma_t ProxyVideoProducer::defaultChroma = tmedia_nv21;
ProxyVideoProducer::ProxyVideoProducer(tmedia_chroma_t _chroma, struct twrap_producer_proxy_video_s* _producer)
:callback(tsk_null), chroma(_chroma), rotation(0), producer(_producer), ProxyPlugin(twrap_proxy_plugin_video_producer)
{
this->producer->id = this->getId();
}
ProxyVideoProducer::~ProxyVideoProducer()
{
}
int ProxyVideoProducer::getRotation()
{
return this->rotation;
}
void ProxyVideoProducer::setRotation(int rot)
{
this->rotation = rot;
if(this->producer){
TMEDIA_PRODUCER(this->producer)->video.rotation = this->rotation;
}
}
// encode() then send()
int ProxyVideoProducer::push(const void* buffer, unsigned size)
{
if(this->producer && TMEDIA_PRODUCER(this->producer)->enc_cb.callback){
return TMEDIA_PRODUCER(this->producer)->enc_cb.callback(TMEDIA_PRODUCER(this->producer)->enc_cb.callback_data, buffer, size);
}
return 0;
}
// send() "as is"
int ProxyVideoProducer::send(const void* buffer, unsigned size, unsigned duration, bool marker)
{
if(this->producer && TMEDIA_PRODUCER(this->producer)->raw_cb.callback){
return TMEDIA_PRODUCER(this->producer)->raw_cb.callback(TMEDIA_PRODUCER(this->producer)->raw_cb.callback_data, buffer, size, duration, marker);
}
return 0;
}
tmedia_chroma_t ProxyVideoProducer::getChroma()
{
return this->chroma;
}
bool ProxyVideoProducer::registerPlugin()
{
/* HACK: Unregister all other video plugins */
tmedia_producer_plugin_unregister_by_type(tmedia_video);
/* Register our proxy plugin */
return (tmedia_producer_plugin_register(twrap_producer_proxy_video_plugin_def_t) == 0);
}

View File

@ -0,0 +1,144 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file ProxyProducer.h
* @brief Audio/Video proxy consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYWRAP_PRODUCER_PROXY_H
#define TINYWRAP_PRODUCER_PROXY_H
#include "tinyWRAP_config.h"
#include "ProxyPluginMgr.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_producer.h"
/* ============ ProxyAudioProducerCallback Class ================= */
class ProxyAudioProducerCallback
{
public:
ProxyAudioProducerCallback() { }
virtual ~ProxyAudioProducerCallback(){ }
virtual int prepare(int ptime, int rate, int channels) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
};
/* ============ ProxyAudioProducer Class ================= */
class ProxyAudioProducer : public ProxyPlugin
{
public:
#if !defined(SWIG)
ProxyAudioProducer(struct twrap_producer_proxy_audio_s* pProducer);
#endif
virtual ~ProxyAudioProducer();
bool setPushBuffer(const void* pPushBufferPtr, unsigned nPushBufferSize);
int push(const void* pBuffer=tsk_null, unsigned nSize=0);
bool setGain(unsigned nGain);
unsigned getGain();
void setCallback(ProxyAudioProducerCallback* pCallback) { m_pCallback = pCallback; }
#if !defined(SWIG)
inline ProxyAudioProducerCallback* getCallback() { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin){
return m_pWrappedPlugin == pWrappedPlugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
return m_pWrappedPlugin ? TMEDIA_PRODUCER(m_pWrappedPlugin)->session_id : 0;
}
public:
static bool registerPlugin();
private:
struct twrap_producer_proxy_audio_s* m_pWrappedPlugin;
ProxyAudioProducerCallback* m_pCallback;
struct{
const void* pPushBufferPtr;
unsigned nPushBufferSize;
} m_PushBuffer;
};
/* ============ ProxyVideoProducerCallback Class ================= */
class ProxyVideoProducerCallback
{
public:
ProxyVideoProducerCallback() { }
virtual ~ProxyVideoProducerCallback(){ }
virtual int prepare(int width, int height, int fps) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
};
/* ============ ProxyVideoProducer Class ================= */
class ProxyVideoProducer : public ProxyPlugin
{
public:
#if !defined(SWIG)
ProxyVideoProducer(tmedia_chroma_t chroma, struct twrap_producer_proxy_video_s* producer);
#endif
virtual ~ProxyVideoProducer();
int getRotation();
void setRotation(int rot);
int push(const void* buffer, unsigned size);
int send(const void* buffer, unsigned size, unsigned duration, bool marker);
void setCallback(ProxyVideoProducerCallback* _callback) { this->callback = _callback; }
#if !defined(SWIG)
inline ProxyVideoProducerCallback* getCallback() { return this->callback; }
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin){
return this->producer == wrapped_plugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
return this->producer ? TMEDIA_PRODUCER(this->producer)->session_id : 0;
}
public:
static bool registerPlugin();
static void setDefaultChroma(tmedia_chroma_t chroma){ ProxyVideoProducer::defaultChroma = chroma; }
#if !defined(SWIG)
tmedia_chroma_t getChroma();
static tmedia_chroma_t getDefaultChroma() { return ProxyVideoProducer::defaultChroma; }
#endif
private:
struct twrap_producer_proxy_video_s* producer;
ProxyVideoProducerCallback* callback;
tmedia_chroma_t chroma;
static tmedia_chroma_t defaultChroma;
int rotation;
};
#endif /* TINYWRAP_PRODUCER_PROXY_H */

View File

@ -0,0 +1,7 @@
%{
#include "SMSEncoder.h"
%}
%nodefaultctor;
%include "SMSEncoder.h"
%clearnodefaultctor;

View File

@ -0,0 +1,376 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SMSEncoder.h"
// Short description: http://betelco.blogspot.com/2009/10/sms-over-3gpp-ims-network.html
RPMessage::RPMessage(twrap_rpmessage_type_t _type, tsms_rpdu_message_t* _rp_message)
{
this->rp_message = (tsms_rpdu_message_t*)tsk_object_ref(_rp_message);
this->type = _type;
this->tmpBuffer = tsk_null;
}
RPMessage::RPMessage() :
rp_message(tsk_null),
type(twrap_rpmessage_type_sms_none),
tmpBuffer(tsk_null)
{
}
twrap_rpmessage_type_t RPMessage::getType()
{
return this->type;
}
unsigned RPMessage::getPayloadLength()
{
if(!this->tmpBuffer){
if((this->tmpBuffer = tsk_buffer_create_null())){
tsms_rpdu_data_serialize(this->rp_message, this->tmpBuffer);
}
}
return this->tmpBuffer ? this->tmpBuffer->size : 0;
}
unsigned RPMessage::getPayload(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(!this->tmpBuffer){
if((this->tmpBuffer = tsk_buffer_create_null())){
tsms_rpdu_message_serialize(this->rp_message, this->tmpBuffer);
}
}
if(output && maxsize && this->tmpBuffer && this->tmpBuffer->data){
retsize = (this->tmpBuffer->size > maxsize) ? maxsize : this->tmpBuffer->size;
memcpy(output, this->tmpBuffer->data, retsize);
}
return retsize;
}
RPMessage::~RPMessage()
{
TSK_OBJECT_SAFE_FREE(this->rp_message);
TSK_OBJECT_SAFE_FREE(this->tmpBuffer);
}
SMSData::SMSData(twrap_sms_type_t _type, int _mr, const void* _ascii, tsk_size_t _size): oa(tsk_null), da(tsk_null)
{
this->type = _type;
this->mr = _mr;
if((this->size = _size)){
if((this->ascii = tsk_calloc(size+1, 1))){
memcpy(this->ascii, _ascii, _size);
}
}
else{
this->ascii = tsk_null;
}
}
SMSData::SMSData(): oa(tsk_null), da(tsk_null)
{
this->type = twrap_sms_type_none;
this->mr = 0;
this->size = 0;
this->ascii = tsk_null;
}
SMSData::~SMSData()
{
TSK_FREE(this->ascii);
TSK_FREE(this->oa);
TSK_FREE(this->da);
}
twrap_sms_type_t SMSData::getType()
{
return this->type;
}
int SMSData::getMR()
{
return this->mr;
}
unsigned SMSData::getPayloadLength()
{
return this->size;
}
unsigned SMSData::getPayload(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && this->ascii){
retsize = (this->size > maxsize) ? maxsize : this->size;
memcpy(output, this->ascii, retsize);
}
return retsize;
}
const char* SMSData::getOA()
{
return this->oa;
}
const char* SMSData::getDA()
{
return this->da;
}
void SMSData::setOA(const char* _oa)
{
TSK_FREE(this->oa);
this->oa = tsk_strdup(_oa);
}
void SMSData::setDA(const char* _da)
{
TSK_FREE(this->da);
this->da = tsk_strdup(_da);
}
// More information about RP-DATA: http://www.doubango.org/API/tinySMS/group__tsms__rpdu__group.html#tsms_rpdu_group_DATA
RPMessage* SMSEncoder::encodeSubmit(int mr, const char *smsc, const char *destination, const char *ascii)
{
int ret;
tsk_buffer_t* buffer = tsk_null;
tsms_tpdu_submit_t* sms_submit = tsk_null;
tsms_rpdu_data_t* rp_data = tsk_null;
RPMessage* encodedData = tsk_null;
if(!smsc || ! destination || !ascii){
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
if(mr<0 || mr>0xFF){
TSK_DEBUG_WARN("Invalid Message Reference");
mr &= 0xFF;
}
// create SMS-SUBMIT message
if(!(sms_submit = tsms_tpdu_submit_create(mr, (const uint8_t*)smsc, (const uint8_t*)destination))){
TSK_DEBUG_ERROR("Failed to create the TPDU SMS-SUBMIT message");
goto bail;
}
// Set content for SMS-SUBMIT
if((buffer = tsms_pack_to_7bit(ascii))){
ret = tsms_tpdu_submit_set_userdata(sms_submit, buffer, tsms_alpha_7bit);
TSK_OBJECT_SAFE_FREE(buffer);
}
else{
TSK_DEBUG_ERROR("Failed to encode the TPDU SMS-SUBMIT message");
goto bail;
}
// create RP-DATA(SMS-SUBMIT)
if((rp_data = tsms_rpdu_data_create_mo(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_submit)))){
encodedData = new RPMessage(twrap_rpmessage_type_sms_submit, TSMS_RPDU_MESSAGE(rp_data));
}
else{
TSK_DEBUG_ERROR("Failed to create the RP-DATA(SMS-SUBMIT) message");
goto bail;
}
bail:
TSK_OBJECT_SAFE_FREE(buffer);
TSK_OBJECT_SAFE_FREE(sms_submit);
TSK_OBJECT_SAFE_FREE(rp_data);
return encodedData;
}
// More information about RP-DATA: http://www.doubango.org/API/tinySMS/group__tsms__rpdu__group.html#tsms_rpdu_group_DATA
RPMessage* SMSEncoder::encodeDeliver(int mr, const char* smsc, const char* originator, const char* ascii)
{
int ret;
tsk_buffer_t* buffer = tsk_null;
tsms_tpdu_deliver_t* sms_deliver = tsk_null;
tsms_rpdu_data_t* rp_data = tsk_null;
RPMessage* encodedData = tsk_null;
if(!smsc || ! originator || !ascii){
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
if(mr<0 || mr>0xFF){
TSK_DEBUG_WARN("Invalid Message Reference");
mr &= 0xFF;
}
// create SMS-DELIVER message
sms_deliver = tsms_tpdu_deliver_create((const uint8_t*)smsc, (const uint8_t*)originator);
// Set content for SMS-DELIVER
if((buffer = tsms_pack_to_7bit(ascii))){
ret = tsms_tpdu_deliver_set_userdata(sms_deliver, buffer, tsms_alpha_7bit);
TSK_OBJECT_SAFE_FREE(buffer);
}
// create RP-DATA message
if((rp_data = tsms_rpdu_data_create_mt(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_deliver)))){
encodedData = new RPMessage(twrap_rpmessage_type_sms_deliver, TSMS_RPDU_MESSAGE(rp_data));
}
else{
TSK_DEBUG_ERROR("Failed to create the RP-DATA(SMS-DELIVER) message");
goto bail;
}
bail:
TSK_OBJECT_SAFE_FREE(buffer);
TSK_OBJECT_SAFE_FREE(sms_deliver);
TSK_OBJECT_SAFE_FREE(rp_data);
return encodedData;
}
RPMessage* SMSEncoder::encodeACK(int mr, const char* smsc, const char* destination, bool forSUBMIT)
{
tsms_tpdu_report_t* sms_report = tsk_null;
tsms_rpdu_ack_t* rp_ack = tsk_null;
tsk_bool_t isSUBMIT = forSUBMIT ? tsk_true : tsk_false;
tsk_bool_t isERROR = tsk_false;
RPMessage* encodedData = tsk_null;
// create SMS-DELIVER(or SUBMIT)-REPORT message
sms_report = tsms_tpdu_report_create((const uint8_t*)smsc, isSUBMIT, isERROR);
// create RP-ACK message (From MS to SC)
if((rp_ack = tsms_rpdu_ack_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report)))){
encodedData = new RPMessage(twrap_rpmessage_type_sms_ack, TSMS_RPDU_MESSAGE(rp_ack));
}
TSK_OBJECT_SAFE_FREE(sms_report);
TSK_OBJECT_SAFE_FREE(rp_ack);
return encodedData;
}
RPMessage* SMSEncoder::encodeError(int mr, const char* smsc, const char* destination, bool forSUBMIT)
{
tsms_tpdu_report_t* sms_report = tsk_null;
tsms_rpdu_error_t* rp_error= tsk_null;
tsk_bool_t isSUBMIT = forSUBMIT ? tsk_true : tsk_false;
tsk_bool_t isERROR = tsk_true;
RPMessage* encodedData = tsk_null;
// create SMS-DELIVER-REPORT message
sms_report = tsms_tpdu_report_create((const uint8_t*)smsc, isSUBMIT, isERROR);
// create RP-ERROR message
if((rp_error = tsms_rpdu_error_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report), 0x0A/*call barred*/))){
encodedData = new RPMessage(twrap_rpmessage_type_sms_error, TSMS_RPDU_MESSAGE(rp_error));
}
TSK_OBJECT_SAFE_FREE(sms_report);
TSK_OBJECT_SAFE_FREE(rp_error);
return encodedData;
}
SMSData* SMSEncoder::decode(const void* data, unsigned size, bool MobOrig)
{
tsms_rpdu_message_t* rp_message = tsk_null;
tsms_tpdu_message_t* tpdu = tsk_null;
SMSData* decodedData = tsk_null;
if(!(rp_message = tsms_rpdu_message_deserialize(data, size))){
TSK_DEBUG_ERROR("Failed to deserialize the RP-MESSAGE");
goto bail;
}
switch(rp_message->mti){
case tsms_rpdu_type_data_mo:
case tsms_rpdu_type_data_mt:
{
char* ascii = tsk_null;
tsms_rpdu_data_t* rp_data = TSMS_RPDU_DATA(rp_message);
if((tpdu = tsms_tpdu_message_deserialize(rp_data->udata->data, rp_data->udata->size, MobOrig))){
if(tpdu->mti == tsms_tpdu_mti_deliver_mt || tpdu->mti == tsms_tpdu_mti_submit_mo){ /* SMS-SUBMIT or SMS-DELIVER? */
ascii = tsms_tpdu_message_get_payload(tpdu);
decodedData = new SMSData(twrap_sms_type_rpdata, rp_message->mr, ascii, tsk_strlen(ascii));
if(tpdu->mti == tsms_tpdu_mti_deliver_mt){
tsms_tpdu_deliver_t* tpdu_deliver = (tsms_tpdu_deliver_t*)tpdu;
decodedData->setOA(tpdu_deliver->oa ? tpdu_deliver->oa->digits : tsk_null);
}
/* IMPORTANT: to not uncomment
else if(TSK_OBJECT_DEF(tpdu) == tsms_tpdu_submit_def_t){
tsms_tpdu_submit_t* tpdu_submit = (tsms_tpdu_submit_t*)tpdu;
decodedData->setDA(tpdu_submit->da ? tpdu_submit->da->digits : tsk_null);
}*/
TSK_FREE(ascii);
}
}
break;
}
case tsms_rpdu_type_ack_mo:
case tsms_rpdu_type_ack_mt:
{
tsms_rpdu_ack_t* rp_ack = TSMS_RPDU_ACK(rp_message);
// ...do whatever you want
if(rp_ack->udata && (tpdu = tsms_tpdu_message_deserialize(rp_ack->udata->data, rp_ack->udata->size, MobOrig))){
// ...do whatever you want
}
decodedData = new SMSData(twrap_sms_type_ack, rp_message->mr, tsk_null, 0);
break;
}
case tsms_rpdu_type_error_mo:
case tsms_rpdu_type_error_mt:
{
tsms_rpdu_error_t* rp_error = TSMS_RPDU_ERROR(rp_message);
// ...do whatever you want
if(rp_error->udata && (tpdu = tsms_tpdu_message_deserialize(rp_error->udata->data, rp_error->udata->size, MobOrig))){
// ...do whatever you want
}
decodedData = new SMSData(twrap_sms_type_error, rp_message->mr, tsk_null, 0);
break;
}
case tsms_rpdu_type_smma_mo:
{
tsms_rpdu_smma_t* rp_smma = TSMS_RPDU_SMMA(rp_message);
// ...do whatever you want
decodedData = new SMSData(twrap_sms_type_smma, rp_message->mr, tsk_null, 0);
break;
}
default:
{
TSK_DEBUG_INFO("Unknown RP-Message type (%u).", rp_message->mti);
break;
}
}
bail:
TSK_OBJECT_SAFE_FREE(rp_message);
TSK_OBJECT_SAFE_FREE(tpdu);
return decodedData;
}

View File

@ -0,0 +1,115 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SMSENCODER_H
#define TINYWRAP_SMSENCODER_H
#include "tinyWRAP_config.h"
#include "tinysip.h" /* SIP/IMS */
#include "tinysms.h" /* Binary SMS API*/
typedef enum twrap_rpmessage_type_e
{
twrap_rpmessage_type_sms_none,
twrap_rpmessage_type_sms_submit,
twrap_rpmessage_type_sms_deliver,
twrap_rpmessage_type_sms_ack,
twrap_rpmessage_type_sms_error,
}
twrap_rpmessage_type_t;
typedef enum twrap_sms_type_e
{
twrap_sms_type_none,
twrap_sms_type_rpdata,
twrap_sms_type_smma,
twrap_sms_type_ack,
twrap_sms_type_error,
}
twrap_sms_type_t;
class RPMessage
{
public:
#if !defined(SWIG)
RPMessage(twrap_rpmessage_type_t type, tsms_rpdu_message_t* rp_message);
#endif
RPMessage();
virtual ~RPMessage();
public:
/* Public API functions */
twrap_rpmessage_type_t getType();
unsigned getPayloadLength();
unsigned getPayload(void* output, unsigned maxsize);
private:
twrap_rpmessage_type_t type;
tsms_rpdu_message_t* rp_message;
tsk_buffer_t* tmpBuffer;
};
class SMSData
{
public:
#if !defined(SWIG)
SMSData(twrap_sms_type_t type, int mr, const void* ascii, tsk_size_t size);
#endif
SMSData();
virtual ~SMSData();
public:
/* Public API functions */
twrap_sms_type_t getType();
int getMR();
unsigned getPayloadLength();
unsigned getPayload(void* output, unsigned maxsize);
const char* getOA();
const char* getDA();
#if !defined(SWIG)
void setOA(const char* oa);
void setDA(const char* da);
#endif
private:
twrap_sms_type_t type;
int mr;
void* ascii;
char* oa;
char* da;
tsk_size_t size;
};
class SMSEncoder
{
public:
static RPMessage* encodeSubmit(int mr, const char* smsc, const char* destination, const char* ascii);
static RPMessage* encodeDeliver(int mr, const char* smsc, const char* originator, const char* ascii);
static RPMessage* encodeACK(int mr, const char* smsc, const char* destination, bool forSUBMIT);
static RPMessage* encodeError(int mr, const char* smsc, const char* destination, bool forSUBMIT);
static SMSData* decode(const void* data, unsigned size, bool MobOrig);
};
#endif /* TINYWRAP_SMSENCODER_H */

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SafeObject.h"
SafeObject::SafeObject()
{
this->mutex = tsk_mutex_create();
}
int SafeObject::Lock()const
{
return tsk_mutex_lock(this->mutex);
}
int SafeObject::UnLock()const
{
return tsk_mutex_unlock(this->mutex);
}
SafeObject::~SafeObject()
{
tsk_mutex_destroy(&this->mutex);
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SAFEOBJECT_H
#define TINYWRAP_SAFEOBJECT_H
#include "tsk_mutex.h"
class SafeObject
{
public:
SafeObject();
virtual ~SafeObject();
/* protected: */
int Lock()const;
int UnLock()const;
private:
tsk_mutex_handle_t *mutex;
};
#endif /* TINYWRAP_SAFEOBJECT_H */

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipCallback.h"

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPCALLBACK_H
#define TINYWRAP_SIPCALLBACK_H
class DialogEvent;
class StackEvent;
class InviteEvent;
class MessagingEvent;
class OptionsEvent;
class PublicationEvent;
class RegistrationEvent;
class SubscriptionEvent;
class SipCallback
{
public:
SipCallback() { }
virtual ~SipCallback() {}
virtual int OnDialogEvent(const DialogEvent* e) { return -1; }
virtual int OnStackEvent(const StackEvent* e) { return -1; }
virtual int OnInviteEvent(const InviteEvent* e) { return -1; }
virtual int OnMessagingEvent(const MessagingEvent* e) { return -1; }
virtual int OnOptionsEvent(const OptionsEvent* e) { return -1; }
virtual int OnPublicationEvent(const PublicationEvent* e) { return -1; }
virtual int OnRegistrationEvent(const RegistrationEvent* e) { return -1; }
virtual int OnSubscriptionEvent(const SubscriptionEvent* e) { return -1; }
private:
};
#endif /* TINYWRAP_SIPCALLBACK_H */

View File

@ -0,0 +1,303 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipEvent.h"
#include "SipSession.h"
#include "SipMessage.h"
#include "SipStack.h"
/* ======================== SipEvent ========================*/
SipEvent::SipEvent(const tsip_event_t *_sipevent)
{
this->sipevent = _sipevent;
if(_sipevent){
this->sipmessage = new SipMessage(_sipevent->sipmessage);
}
else{
this->sipmessage = tsk_null;
}
}
SipEvent::~SipEvent()
{
if(this->sipmessage){
delete this->sipmessage;
}
}
short SipEvent::getCode() const
{
return this->sipevent->code;
}
const char* SipEvent::getPhrase() const
{
return this->sipevent->phrase;
}
const SipSession* SipEvent::getBaseSession() const
{
const void* userdata = tsip_ssession_get_userdata(this->sipevent->ss);
if(userdata){
return dyn_cast<const SipSession*>((const SipSession*)userdata);
}
return tsk_null;
}
const SipMessage* SipEvent::getSipMessage() const
{
return this->sipmessage;
}
SipStack* SipEvent::getStack()const
{
const tsip_stack_handle_t* stack_handle = tsip_ssession_get_stack(sipevent->ss);
const void* userdata;
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))){
return dyn_cast<SipStack*>((SipStack*)userdata);
}
return tsk_null;
}
/* ======================== DialogEvent ========================*/
DialogEvent::DialogEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent){ }
DialogEvent::~DialogEvent(){ }
/* ======================== DialogEvent ========================*/
StackEvent::StackEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent){ }
StackEvent::~StackEvent(){ }
/* ======================== InviteEvent ========================*/
InviteEvent::InviteEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
{
}
InviteEvent::~InviteEvent()
{
}
tsip_invite_event_type_t InviteEvent::getType() const
{
return TSIP_INVITE_EVENT(this->sipevent)->type;
}
twrap_media_type_t InviteEvent::getMediaType()
{
// Ignore Mixed session (both audio/video and MSRP) as specified by GSMA RCS.
if(this->sipevent && this->sipevent->ss){
tmedia_type_t type = tsip_ssession_get_mediatype(this->sipevent->ss);
if(type & tmedia_msrp){
return twrap_media_msrp;
}
else{
switch(type){
case tmedia_audio:
return twrap_media_audio;
case tmedia_video:
return twrap_media_video;
case tmedia_audiovideo:
return twrap_media_audiovideo;
}
}
}
return twrap_media_none;
}
const InviteSession* InviteEvent::getSession() const
{
return dyn_cast<const InviteSession*>(this->getBaseSession());
}
CallSession* InviteEvent::takeCallSessionOwnership() const
{
// TODO: Factor all takeSessionOwnership() functions
if(this->sipevent && this->sipevent->ss && !tsip_ssession_have_ownership(this->sipevent->ss)){
SipStack* stack = this->getStack();
if(stack){
/* The constructor will call take_ownerhip() */
return new CallSession(stack, this->sipevent->ss);
}
}
return tsk_null;
}
MsrpSession* InviteEvent::takeMsrpSessionOwnership() const
{
// TODO: Factor all takeSessionOwnership() functions
if(this->sipevent && this->sipevent->ss && !tsip_ssession_have_ownership(this->sipevent->ss)){
SipStack* stack = this->getStack();
if(stack){
/* The constructor will call take_ownerhip() */
return new MsrpSession(stack, this->sipevent->ss);
}
}
return tsk_null;
}
/* ======================== MessagingEvent ========================*/
MessagingEvent::MessagingEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
{
}
MessagingEvent::~MessagingEvent()
{
}
tsip_message_event_type_t MessagingEvent::getType() const
{
return TSIP_MESSAGE_EVENT(this->sipevent)->type;
}
const MessagingSession* MessagingEvent::getSession() const
{
return dyn_cast<const MessagingSession*>(this->getBaseSession());
}
MessagingSession* MessagingEvent::takeSessionOwnership() const
{
if(this->sipevent && this->sipevent->ss && !tsip_ssession_have_ownership(this->sipevent->ss)){
SipStack* stack = this->getStack();
if(stack){
/* The constructor will call take_ownerhip() */
return new MessagingSession(stack, this->sipevent->ss);
}
}
return tsk_null;
}
/* ======================== OptionsEvent ========================*/
OptionsEvent::OptionsEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
{
}
OptionsEvent::~OptionsEvent()
{
}
tsip_options_event_type_t OptionsEvent::getType() const
{
return TSIP_OPTIONS_EVENT(this->sipevent)->type;
}
const OptionsSession* OptionsEvent::getSession() const
{
return dyn_cast<const OptionsSession*>(this->getBaseSession());
}
OptionsSession* OptionsEvent::takeSessionOwnership() const
{
if(this->sipevent && this->sipevent->ss && !tsip_ssession_have_ownership(this->sipevent->ss)){
SipStack* stack = this->getStack();
if(stack){
/* The constructor will call take_ownerhip() */
return new OptionsSession(stack, this->sipevent->ss);
}
}
return tsk_null;
}
/* ======================== PublicationEvent ========================*/
PublicationEvent::PublicationEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
{
}
PublicationEvent::~PublicationEvent()
{
}
tsip_publish_event_type_t PublicationEvent::getType() const
{
return TSIP_PUBLISH_EVENT(this->sipevent)->type;
}
const PublicationSession* PublicationEvent::getSession() const
{
return dyn_cast<const PublicationSession*>(this->getBaseSession());
}
/* ======================== RegistrationEvent ========================*/
RegistrationEvent::RegistrationEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
{
}
RegistrationEvent::~RegistrationEvent()
{
}
tsip_register_event_type_t RegistrationEvent::getType() const
{
return TSIP_REGISTER_EVENT(this->sipevent)->type;
}
const RegistrationSession* RegistrationEvent::getSession() const
{
return dyn_cast<const RegistrationSession*>(this->getBaseSession());
}
RegistrationSession* RegistrationEvent::takeSessionOwnership() const
{
// TODO: Factor all takeSessionOwnership() functions
if(this->sipevent && this->sipevent->ss && !tsip_ssession_have_ownership(this->sipevent->ss)){
SipStack* stack = this->getStack();
if(stack){
/* The constructor will call take_ownerhip() */
return new RegistrationSession(stack, this->sipevent->ss);
}
}
return tsk_null;
}
/* ======================== SubscriptionEvent ========================*/
SubscriptionEvent::SubscriptionEvent(const tsip_event_t *sipevent)
:SipEvent(sipevent)
{
}
SubscriptionEvent::~SubscriptionEvent()
{
}
tsip_subscribe_event_type_t SubscriptionEvent::getType() const
{
return TSIP_SUBSCRIBE_EVENT(this->sipevent)->type;
}
const SubscriptionSession* SubscriptionEvent::getSession() const
{
return dyn_cast<const SubscriptionSession*>(this->getBaseSession());
}

View File

@ -0,0 +1,194 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPEVENT_H
#define TINYWRAP_SIPEVENT_H
#include "tinysip.h"
#include "Common.h"
class SipStack;
class SipSession;
class InviteSession;
class CallSession;
class MsrpSession;
class MessagingSession;
class OptionsSession;
class PublicationSession;
class RegistrationSession;
class SubscriptionSession;
class SipMessage;
/* ======================== SipEvent ========================*/
class SipEvent
{
public:
#if !defined(SWIG)
SipEvent(const tsip_event_t *sipevent);
#endif
virtual ~SipEvent();
public:
short getCode() const;
const char* getPhrase() const;
const SipSession* getBaseSession() const;
const SipMessage* getSipMessage() const;
protected:
#if !defined(SWIG)
SipStack* getStack()const;
#endif
protected:
const tsip_event_t *sipevent;
SipMessage* sipmessage;
};
/* ======================== DialogEvent ========================*/
class DialogEvent: public SipEvent
{
public:
#if !defined(SWIG)
DialogEvent(const tsip_event_t *sipevent);
#endif
virtual ~DialogEvent();
public: /* Public API functions */
};
/* ======================== StackEvent ========================*/
class StackEvent: public SipEvent
{
public:
#if !defined(SWIG)
StackEvent(const tsip_event_t *sipevent);
#endif
virtual ~StackEvent();
public: /* Public API functions */
};
/* ======================== InviteEvent ========================*/
class InviteEvent: public SipEvent
{
public:
#if !defined(SWIG)
InviteEvent(const tsip_event_t *sipevent);
#endif
virtual ~InviteEvent();
public: /* Public API functions */
tsip_invite_event_type_t getType() const;
twrap_media_type_t getMediaType();
const InviteSession* getSession() const;
CallSession* takeCallSessionOwnership() const;
MsrpSession* takeMsrpSessionOwnership() const;
};
/* ======================== MessagingEvent ========================*/
class MessagingEvent: public SipEvent
{
public:
#if !defined(SWIG)
MessagingEvent(const tsip_event_t *sipevent);
#endif
virtual ~MessagingEvent();
public: /* Public API functions */
tsip_message_event_type_t getType() const;
const MessagingSession* getSession() const;
MessagingSession* takeSessionOwnership() const;
};
/* ======================== OptionsEvent ========================*/
class OptionsEvent: public SipEvent
{
public:
#if !defined(SWIG)
OptionsEvent(const tsip_event_t *sipevent);
#endif
virtual ~OptionsEvent();
public: /* Public API functions */
tsip_options_event_type_t getType() const;
const OptionsSession* getSession() const;
OptionsSession* takeSessionOwnership() const;
};
/* ======================== PublicationEvent ========================*/
class PublicationEvent: public SipEvent
{
public:
#if !defined(SWIG)
PublicationEvent(const tsip_event_t *sipevent);
#endif
virtual ~PublicationEvent();
public: /* Public API functions */
tsip_publish_event_type_t getType() const;
const PublicationSession* getSession() const;
};
/* ======================== RegistrationEvent ========================*/
class RegistrationEvent: public SipEvent
{
public:
#if !defined(SWIG)
RegistrationEvent(const tsip_event_t *sipevent);
#endif
virtual ~RegistrationEvent();
public: /* Public API functions */
tsip_register_event_type_t getType() const;
const RegistrationSession* getSession() const;
RegistrationSession* takeSessionOwnership() const;
};
/* ======================== SubscriptionEvent ========================*/
class SubscriptionEvent: public SipEvent
{
public:
#if !defined(SWIG)
SubscriptionEvent(const tsip_event_t *sipevent);
#endif
virtual ~SubscriptionEvent();
public: /* Public API functions */
tsip_subscribe_event_type_t getType() const;
const SubscriptionSession* getSession() const;
};
#endif /* TINYWRAP_SIPEVENT_H */

View File

@ -0,0 +1,258 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipMessage.h"
SdpMessage::SdpMessage()
:sdpmessage(tsk_null)
{
}
SdpMessage::SdpMessage(tsdp_message_t *_sdpmessage)
{
this->sdpmessage = (tsdp_message_t *)tsk_object_ref(_sdpmessage);
}
SdpMessage::~SdpMessage()
{
TSK_OBJECT_SAFE_FREE(this->sdpmessage);
}
char* SdpMessage::getSdpHeaderValue(const char* media, char name, unsigned index /*= 0*/)
{
const tsdp_header_M_t* M;
if((M = (const tsdp_header_M_t*)tsdp_message_get_header(this->sdpmessage, tsdp_htype_M))){
tsdp_header_type_t type = tsdp_htype_Dummy;
const tsdp_header_t* header;
switch(name){
case 'a': type = tsdp_htype_A; break;
case 'b': type = tsdp_htype_B; break;
case 'c': type = tsdp_htype_C; break;
case 'e': type = tsdp_htype_E; break;
case 'i': type = tsdp_htype_I; break;
case 'k': type = tsdp_htype_K; break;
case 'm': type = tsdp_htype_M; break;
case 'o': type = tsdp_htype_O; break;
case 'p': type = tsdp_htype_P; break;
case 'r': type = tsdp_htype_R; break;
case 's': type = tsdp_htype_S; break;
case 't': type = tsdp_htype_T; break;
case 'u': type = tsdp_htype_U; break;
case 'v': type = tsdp_htype_V; break;
case 'z': type = tsdp_htype_Z; break;
}
if((header = tsdp_message_get_headerAt(this->sdpmessage, type, index))){
return tsdp_header_tostring(header);
}
}
return tsk_null;
}
char* SdpMessage::getSdpHeaderAValue(const char* media, const char* attributeName)
{
const tsdp_header_M_t* M;
tsk_size_t i;
for(i = 0; (M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(this->sdpmessage, tsdp_htype_M, i)); i++){
if(tsk_striequals(M->media, media)){
const tsdp_header_A_t* A;
if((A = tsdp_header_M_findA(M, attributeName))){
return tsk_strdup(A->value);
}
}
}
return tsk_null;
}
SipMessage::SipMessage()
:sipmessage(tsk_null), sdpmessage(tsk_null)
{
}
SipMessage::SipMessage(tsip_message_t *_sipmessage)
: sdpmessage(tsk_null)
{
this->sipmessage = (tsip_message_t *)tsk_object_ref(_sipmessage);
}
SipMessage::~SipMessage()
{
TSK_OBJECT_SAFE_FREE(this->sipmessage);
if(this->sdpmessage){
delete this->sdpmessage;
}
}
const tsip_header_t* SipMessage::getSipHeader(const char* name, unsigned index /* =0 */)
{
/* Do not worry about calling tsk_striequals() several times because the function
* is fully optimized.
*/
/* Code below comes from tsip_message_get_headerAt() */
tsk_size_t pos = 0;
const tsk_list_item_t *item;
const tsip_header_t* hdr = tsk_null;
if(!this->sipmessage || !name){
return tsk_null;
}
if(tsk_striequals(name, "v") || tsk_striequals(name, "via")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->firstVia;
goto bail;
}else pos++; }
if(tsk_striequals(name, "f") || tsk_striequals(name, "from")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->From;
goto bail;
}else pos++; }
if(tsk_striequals(name, "t") || tsk_striequals(name, "to")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->To;
goto bail;
}else pos++; }
if(tsk_striequals(name, "m") || tsk_striequals(name, "contact")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->Contact;
goto bail;
}else pos++; }
if(tsk_striequals(name, "i") || tsk_striequals(name, "call-id")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->Call_ID;
goto bail;
}else pos++; }
if(tsk_striequals(name, "cseq")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->CSeq;
goto bail;
}else pos++; }
if(tsk_striequals(name, "expires")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->Expires;
goto bail;
}else pos++; }
if(tsk_striequals(name, "c") || tsk_striequals(name, "content-type")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->Content_Type;
goto bail;
}else pos++; }
if(tsk_striequals(name, "l") || tsk_striequals(name, "content-length")){
if(index == 0){
hdr = (const tsip_header_t*)this->sipmessage->Content_Length;
goto bail;
}else pos++; }
tsk_list_foreach(item, this->sipmessage->headers){
if(tsk_striequals(tsip_header_get_name_2(TSIP_HEADER(item->data)), name)){
if(pos++ >= index){
hdr = (const tsip_header_t*)item->data;
break;
}
}
}
bail:
return hdr;
}
// e.g. getHeaderParamValue("content-type");
char* SipMessage::getSipHeaderValue(const char* name, unsigned index /* = 0*/)
{
const tsip_header_t* header;
if((header = this->getSipHeader(name, index))){
switch(header->type){
case tsip_htype_From:
return tsip_uri_tostring(((const tsip_header_From_t*)header)->uri, tsk_false, tsk_false);
case tsip_htype_To:
return tsip_uri_tostring(((const tsip_header_To_t*)header)->uri, tsk_false, tsk_false);
break;
case tsip_htype_P_Asserted_Identity:
return tsip_uri_tostring(((const tsip_header_P_Asserted_Identity_t*)header)->uri, tsk_false, tsk_false);
break;
default:
return tsip_header_value_tostring(header);
}
}
// SWIG: %newobject getHeaderValueAt;
return tsk_null;
}
// e.g. getHeaderParamValue("content-type", "charset");
char* SipMessage::getSipHeaderParamValue(const char* name, const char* param, unsigned index /*=0*/)
{
const tsip_header_t* header;
if((header = this->getSipHeader(name, index))){
return tsip_header_get_param_value(header, param);
}
// SWIG: %newobject getSipHeaderParamValue;
return tsk_null;
}
/** Returns the content length.
*/
unsigned SipMessage::getSipContentLength()
{
return TSIP_MESSAGE_CONTENT_DATA_LENGTH(this->sipmessage);
}
/** Gets the message content
* @param output A pointer to the output buffer where to copy the data. MUST
* be allocated by the caller.
* @param maxsize The maximum number of octets to copy. Should be less than the size of the
* @a output buffer. You can use @a getSipContentLength() to get the right value to use.
* @retval The number of octet copied in the @a output buffer.
*/
unsigned SipMessage::getSipContent(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && TSIP_MESSAGE_HAS_CONTENT(this->sipmessage)){
retsize = (this->sipmessage->Content->size > maxsize) ? maxsize : this->sipmessage->Content->size;
memcpy(output, this->sipmessage->Content->data, retsize);
}
return retsize;
}
const SdpMessage* SipMessage::getSdpMessage()
{
if(!this->sdpmessage && TSIP_MESSAGE_HAS_CONTENT(this->sipmessage)){
tsdp_message_t* sdp = tsdp_message_parse(this->sipmessage->Content->data, this->sipmessage->Content->size);
if(sdp){
this->sdpmessage = new SdpMessage(sdp);
TSK_OBJECT_SAFE_FREE(sdp);
}
}
return this->sdpmessage;
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPMESSAGE_H
#define TINYWRAP_SIPMESSAGE_H
#include "tinysip.h"
class SdpMessage
{
public:
SdpMessage();
#if !defined(SWIG)
SdpMessage(tsdp_message_t *sdpmessage);
#endif
virtual ~SdpMessage();
char* getSdpHeaderValue(const char* media, char name, unsigned index = 0);
char* getSdpHeaderAValue(const char* media, const char* attributeName);
private:
tsdp_message_t *sdpmessage;
};
class SipMessage
{
public:
SipMessage();
#if !defined(SWIG)
SipMessage(tsip_message_t *sipmessage);
#endif
virtual ~SipMessage();
char* getSipHeaderValue(const char* name, unsigned index = 0);
char* getSipHeaderParamValue(const char* name, const char* param, unsigned index = 0);
unsigned getSipContentLength();
unsigned getSipContent(void* output, unsigned maxsize);
const SdpMessage* getSdpMessage();
private:
const tsip_header_t* getSipHeader(const char* name, unsigned index = 0);
private:
tsip_message_t *sipmessage;
SdpMessage *sdpmessage;
};
#endif /* TINYWRAP_SIPMESSAGE_H */

View File

@ -0,0 +1,749 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipSession.h"
#include "SipStack.h"
#include "MediaSessionMgr.h"
#include "Msrp.h"
/* ======================== AsyncAction ========================*/
typedef struct twrap_async_action_s
{
const tsip_ssession_handle_t *session;
const ActionConfig* config;
}
twrap_async_action_t;
/* ======================== SipSession ========================*/
SipSession::SipSession(SipStack* stack)
{
this->init(stack);
}
SipSession::SipSession(SipStack* stack, tsip_ssession_handle_t* handle)
{
this->init(stack, handle);
}
SipSession::~SipSession()
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_USERDATA(tsk_null),
TSIP_SSESSION_SET_NULL());
TSK_OBJECT_SAFE_FREE(this->handle);
}
void SipSession::init(SipStack* _stack, tsip_ssession_handle_t* _handle/*=tsk_null*/)
{
if(_handle){
/* "server-side-session" */
if(tsip_ssession_take_ownership(_handle)){ /* should never happen */
TSK_DEBUG_ERROR("Failed to take ownership");
return;
}
this->handle = _handle;
}
else{
/* "client-side-session" */
this->handle = tsip_ssession_create(_stack->getHandle(),
TSIP_SSESSION_SET_USERDATA(this),
TSIP_SSESSION_SET_NULL());
}
/* set userdata (context) and ref. the stack handle */
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_USERDATA(this),
TSIP_SSESSION_SET_NULL());
this->stack = _stack;
}
bool SipSession::addHeader(const char* name, const char* value)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_HEADER(name, value),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::haveOwnership()
{
return (tsip_ssession_have_ownership(this->handle) == tsk_true);
}
bool SipSession::removeHeader(const char* name)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_UNSET_HEADER(name),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::addCaps(const char* name, const char* value)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_CAPS(name, value),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::addCaps(const char* name)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_CAPS(name, tsk_null),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::removeCaps(const char* name)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_UNSET_CAPS(name),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::setExpires(unsigned expires)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_EXPIRES(expires),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::setFromUri(const char* fromUri)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_FROM(fromUri),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::setToUri(const char* toUri)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_TO(toUri),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::setSilentHangup(bool silent)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_SILENT_HANGUP(silent ? tsk_true : tsk_false),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::addSigCompCompartment(const char* compId)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT(compId),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool SipSession::removeSigCompCompartment()
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_UNSET_SIGCOMP_COMPARTMENT(),
TSIP_SSESSION_SET_NULL()) == 0);
}
unsigned SipSession::getId()
{
return (unsigned)tsip_ssession_get_id(this->handle);
}
const SipStack* SipSession::getStack()const
{
return this->stack;
}
/* ======================== InviteSession ========================*/
InviteSession::InviteSession(SipStack* Stack)
: SipSession(Stack), mediaMgr(tsk_null)
{
}
InviteSession::InviteSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: SipSession(Stack, handle), mediaMgr(tsk_null)
{
}
InviteSession::~InviteSession()
{
if(this->mediaMgr){
delete this->mediaMgr, this->mediaMgr = tsk_null;
}
}
#if ANDROID
static void *__droid_hangup(void *param)
{
twrap_async_action_t* asyn_action = (twrap_async_action_t*)param;
const tsip_action_handle_t* action_cfg = asyn_action->config ? asyn_action->config->getHandle() : tsk_null;
tsip_action_BYE(asyn_action->session,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
return tsk_null;
}
bool InviteSession::hangup(ActionConfig* config/*=tsk_null*/)
{
void* tid[1] = {0};
tsip_ssession_handle_t *handle;
int ret;
twrap_async_action_t asyn_action = {0};
handle = tsk_object_ref(this->handle);
asyn_action.config = config;
asyn_action.session = handle;
ret = tsk_thread_create(tid, __droid_hangup, &asyn_action);
tsk_thread_join(tid);
tsk_object_unref(handle);
return (ret == 0);
}
#else
bool InviteSession::hangup(ActionConfig* config/*=tsk_null*/)
{
return (tsip_action_BYE(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
#endif
#if ANDROID
static void *__droid_reject(void *param)
{
twrap_async_action_t* asyn_action = (twrap_async_action_t*)param;
const tsip_action_handle_t* action_cfg = asyn_action->config ? asyn_action->config->getHandle() : tsk_null;
tsip_action_REJECT(asyn_action->session,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
return tsk_null;
}
bool InviteSession::reject(ActionConfig* config/*=tsk_null*/)
{
void* tid[1] = {0};
tsip_ssession_handle_t *handle;
int ret;
twrap_async_action_t asyn_action = {0};
handle = tsk_object_ref(this->handle);
asyn_action.config = config;
asyn_action.session = handle;
ret = tsk_thread_create(tid, __droid_reject, &asyn_action);
tsk_thread_join(tid);
tsk_object_unref(handle);
return (ret == 0);
}
#else
bool InviteSession::reject(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_REJECT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
#endif
#if ANDROID
static void *__droid_accept(void *param)
{
twrap_async_action_t* asyn_action = (twrap_async_action_t*)param;
const tsip_action_handle_t* action_cfg = asyn_action->config ? asyn_action->config->getHandle() : tsk_null;
tsip_action_ACCEPT(asyn_action->session,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
return tsk_null;
}
bool InviteSession::accept(ActionConfig* config/*=tsk_null*/)
{
void* tid[1] = {0};
tsip_ssession_handle_t *handle;
int ret;
twrap_async_action_t asyn_action = {0};
handle = tsk_object_ref(this->handle);
asyn_action.config = config;
asyn_action.session = handle;
ret = tsk_thread_create(tid, __droid_accept, &asyn_action);
tsk_thread_join(tid);
tsk_object_unref(handle);
return (ret == 0);
}
#else
bool InviteSession::accept(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_ACCEPT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
#endif
const MediaSessionMgr* InviteSession::getMediaMgr()
{
if(!this->mediaMgr && this->handle){
tmedia_session_mgr_t* mgr = tsip_session_get_mediamgr(this->handle);
if(mgr){
this->mediaMgr = new MediaSessionMgr(mgr);
tsk_object_unref(mgr);
}
else{
TSK_DEBUG_WARN("No media session associated to this session");
}
}
return this->mediaMgr;
}
/* ======================== CallSession ========================*/
CallSession::CallSession(SipStack* Stack)
: InviteSession(Stack)
{
}
CallSession::CallSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: InviteSession(Stack, handle)
{
}
CallSession::~CallSession()
{
}
#define ANDROID32 1
#if ANDROID
typedef struct twrap_async_action_call_s
{
const tsip_ssession_handle_t *session;
const ActionConfig* config;
tmedia_type_t media_type;
}
twrap_async_action_call_t;
static void *__droid_call_thread(void *param)
{
twrap_async_action_call_t* asyn_action = (twrap_async_action_call_t*)param;
const tsip_action_handle_t* action_cfg = asyn_action->config ? asyn_action->config->getHandle() : tsk_null;
tsip_action_INVITE(asyn_action->session, asyn_action->media_type,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
return tsk_null;
}
static bool __droid_call(tsip_ssession_handle_t * session_handle, tmedia_type_t type, ActionConfig* config/*=tsk_null*/)
{
void* tid[1] = {0};
tsip_ssession_handle_t *handle;
int ret;
twrap_async_action_call_t asyn_action = {0};
handle = tsk_object_ref(session_handle);
asyn_action.config = config;
asyn_action.session = handle;
asyn_action.media_type = type;
ret = tsk_thread_create(tid, __droid_call_thread, &asyn_action);
tsk_thread_join(tid);
tsk_object_unref(handle);
return (ret == 0);
}
#endif
bool CallSession::callAudio(const char* remoteUri, ActionConfig* config/*=tsk_null*/)
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_TO(remoteUri),
TSIP_SSESSION_SET_NULL());
#if ANDROID
__droid_call(this->handle, tmedia_audio, config);
return true;
#else
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_INVITE(this->handle, tmedia_audio,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
#endif
}
bool CallSession::callAudioVideo(const char* remoteUri, ActionConfig* config/*=tsk_null*/)
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_TO(remoteUri),
TSIP_SSESSION_SET_NULL());
#if ANDROID
__droid_call(this->handle, (tmedia_type_t)(tmedia_audio | tmedia_video), config);
return true;
#else
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_INVITE(this->handle, (tmedia_type_t)(tmedia_audio | tmedia_video),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
#endif
}
bool CallSession::callVideo(const char* remoteUri, ActionConfig* config/*=tsk_null*/)
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_TO(remoteUri),
TSIP_SSESSION_SET_NULL());
#if ANDROID
__droid_call(this->handle, tmedia_video, config);
return true;
#else
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_INVITE(this->handle, tmedia_video,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
#endif
}
bool CallSession::setSessionTimer(unsigned timeout, const char* refresher)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_TIMERS(timeout, refresher),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool CallSession::set100rel(bool enabled)
{
if(enabled){
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_100rel(),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL()) == 0);
}
else{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_UNSET_100rel(),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL()) == 0);
}
}
bool CallSession::setQoS(tmedia_qos_stype_t type, tmedia_qos_strength_t strength)
{
return (tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_QOS(type, strength),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL()) == 0);
}
bool CallSession::hold(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_HOLD(this->handle, tmedia_all,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) ==0 );
}
bool CallSession::resume(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_RESUME(this->handle, tmedia_all,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool CallSession::sendDTMF(int number)
{
return (tsip_action_DTMF(this->handle, number,
TSIP_ACTION_SET_NULL()) == 0);
}
/* ======================== MsrpSession ========================*/
MsrpSession::MsrpSession(SipStack* Stack, MsrpCallback* _callback)
: InviteSession(Stack), callback(_callback)
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_MSRP_CB(twrap_msrp_cb),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL());
}
MsrpSession::MsrpSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: InviteSession(Stack, handle), callback(tsk_null)
{
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_MSRP_CB(twrap_msrp_cb),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL());
}
MsrpSession::~MsrpSession()
{
}
bool MsrpSession::setCallback(MsrpCallback* _callback)
{
this->callback = _callback;
return true;
}
bool MsrpSession::callMsrp(const char* remoteUri, ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
tsip_ssession_set(this->handle,
TSIP_SSESSION_SET_TO(remoteUri),
TSIP_SSESSION_SET_NULL());
return (tsip_action_INVITE(this->handle, tmedia_msrp,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool MsrpSession::sendMessage(const void* payload, unsigned len, ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_LARGE_MESSAGE(this->handle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool MsrpSession::sendFile(ActionConfig* config/*=tsk_null*/)
{
return false;
}
/* ======================== MessagingSession ========================*/
MessagingSession::MessagingSession(SipStack* Stack)
: SipSession(Stack)
{
}
MessagingSession::MessagingSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: SipSession(Stack, handle)
{
}
MessagingSession::~MessagingSession()
{
}
bool MessagingSession::send(const void* payload, unsigned len)
{
TSK_DEBUG_INFO("MessagingSession::Send()");
int ret;
if(payload && len){
ret = tsip_action_MESSAGE(this->handle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_NULL());
}
else{
ret = tsip_action_PUBLISH(this->handle,
TSIP_ACTION_SET_NULL());
}
return (ret == 0);
}
bool MessagingSession::accept()
{
return (tsip_action_ACCEPT(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
bool MessagingSession::reject()
{
return (tsip_action_REJECT(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
/* ======================== OptionsSession ========================*/
OptionsSession::OptionsSession(SipStack* Stack)
: SipSession(Stack)
{
}
OptionsSession::OptionsSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: SipSession(Stack, handle)
{
}
OptionsSession::~OptionsSession()
{
}
bool OptionsSession::send(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_OPTIONS(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool OptionsSession::accept(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_ACCEPT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool OptionsSession::reject(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_REJECT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
/* ======================== PublicationSession ========================*/
PublicationSession::PublicationSession(SipStack* Stack)
: SipSession(Stack)
{
}
PublicationSession::~PublicationSession()
{
}
bool PublicationSession::publish(const void* payload, unsigned len)
{
int ret;
if(payload && len){
ret = tsip_action_PUBLISH(this->handle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_NULL());
}
else{
ret = tsip_action_PUBLISH(this->handle,
TSIP_ACTION_SET_NULL());
}
return (ret == 0);
}
bool PublicationSession::unPublish()
{
return (tsip_action_UNPUBLISH(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
/* ======================== RegistrationSession ========================*/
RegistrationSession::RegistrationSession(SipStack* Stack)
: SipSession(Stack)
{
}
RegistrationSession::RegistrationSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: SipSession(Stack, handle)
{
}
RegistrationSession::~RegistrationSession()
{
}
bool RegistrationSession::register_()
{
return (tsip_action_REGISTER(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
bool RegistrationSession::unRegister()
{
return (tsip_action_UNREGISTER(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
bool RegistrationSession::accept(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_ACCEPT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
bool RegistrationSession::reject(ActionConfig* config/*=tsk_null*/)
{
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_action_REJECT(this->handle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
/* ======================== SubscriptionSession ========================*/
SubscriptionSession::SubscriptionSession(SipStack* Stack)
: SipSession(Stack)
{
}
SubscriptionSession::~SubscriptionSession()
{
}
bool SubscriptionSession::subscribe()
{
return (tsip_action_SUBSCRIBE(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}
bool SubscriptionSession::unSubscribe()
{
return (tsip_action_UNSUBSCRIBE(this->handle,
TSIP_ACTION_SET_NULL()) == 0);
}

View File

@ -0,0 +1,219 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPSESSION_H
#define TINYWRAP_SIPSESSION_H
#include "tinysip.h"
#include "tinymedia/tmedia_qos.h"
#include "ActionConfig.h"
class SipStack;
class MsrpCallback;
class MediaSessionMgr;
/* ======================== SipSession ========================*/
class SipSession
{
public:
SipSession(SipStack* stack);
#if !defined(SWIG)
SipSession(SipStack* stack, tsip_ssession_handle_t* handle);
#endif
virtual ~SipSession();
public:
bool haveOwnership();
bool addHeader(const char* name, const char* value);
bool removeHeader(const char* name);
bool addCaps(const char* name, const char* value);
bool addCaps(const char* name);
bool removeCaps(const char* name);
bool setExpires(unsigned expires);
bool setFromUri(const char* fromUri);
bool setToUri(const char* toUri);
bool setSilentHangup(bool silent);
bool addSigCompCompartment(const char* compId);
bool removeSigCompCompartment();
unsigned getId();
#if !defined(SWIG)
const SipStack* getStack() const;
#endif
private:
void init(SipStack* stack, tsip_ssession_handle_t* handle=tsk_null);
protected:
tsip_ssession_handle_t* handle;
const SipStack* stack;
};
/* ======================== InviteSession ========================*/
class InviteSession : public SipSession
{
public: /* ctor() and dtor() */
InviteSession(SipStack* Stack);
#if !defined(SWIG)
InviteSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~InviteSession();
public: /* Public functions */
bool accept(ActionConfig* config=tsk_null);
bool hangup(ActionConfig* config=tsk_null);
bool reject(ActionConfig* config=tsk_null);
const MediaSessionMgr* getMediaMgr();
private:
MediaSessionMgr* mediaMgr;
};
/* ======================== CallSession ========================*/
class CallSession : public InviteSession
{
public: /* ctor() and dtor() */
CallSession(SipStack* Stack);
#if !defined(SWIG)
CallSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~CallSession();
public: /* Public functions */
bool callAudio(const char* remoteUri, ActionConfig* config=tsk_null);
bool callAudioVideo(const char* remoteUri, ActionConfig* config=tsk_null);
bool callVideo(const char* remoteUri, ActionConfig* config=tsk_null);
bool setSessionTimer(unsigned timeout, const char* refresher);
bool set100rel(bool enabled);
bool setQoS(tmedia_qos_stype_t type, tmedia_qos_strength_t strength);
bool hold(ActionConfig* config=tsk_null);
bool resume(ActionConfig* config=tsk_null);
bool sendDTMF(int number);
};
/* ======================== MsrpSession ========================*/
class MsrpSession : public InviteSession
{
public: /* ctor() and dtor() */
MsrpSession(SipStack* Stack, MsrpCallback* callback);
#if !defined(SWIG)
MsrpSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~MsrpSession();
public: /* Public functions */
bool setCallback(MsrpCallback* callback);
bool callMsrp(const char* remoteUri, ActionConfig* config=tsk_null);
bool sendMessage(const void* payload, unsigned len, ActionConfig* config=tsk_null);
bool sendFile(ActionConfig* config=tsk_null);
public: /* Public helper function */
#if !defined(SWIG)
inline MsrpCallback* getCallback()const{
return this->callback;
}
#endif
private:
MsrpCallback* callback;
};
/* ======================== MessagingSession ========================*/
class MessagingSession : public SipSession
{
public: /* ctor() and dtor() */
MessagingSession(SipStack* Stack);
#if !defined(SWIG)
MessagingSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~MessagingSession();
public: /* Public functions */
bool send(const void* payload, unsigned len);
bool accept();
bool reject();
};
/* ======================== OptionsSession ========================*/
class OptionsSession : public SipSession
{
public: /* ctor() and dtor() */
OptionsSession(SipStack* Stack);
#if !defined(SWIG)
OptionsSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~OptionsSession();
public: /* Public functions */
bool send(ActionConfig* config=tsk_null);
bool accept(ActionConfig* config=tsk_null);
bool reject(ActionConfig* config=tsk_null);
};
/* ======================== PublicationSession ========================*/
class PublicationSession : public SipSession
{
public: /* ctor() and dtor() */
PublicationSession(SipStack* Stack);
virtual ~PublicationSession();
public: /* Public functions */
bool publish(const void* payload, unsigned len);
bool unPublish();
};
/* ======================== RegistrationSession ========================*/
class RegistrationSession : public SipSession
{
public: /* ctor() and dtor() */
RegistrationSession(SipStack* Stack);
#if !defined(SWIG)
RegistrationSession(SipStack* Stack, tsip_ssession_handle_t* handle);
#endif
virtual ~RegistrationSession();
public: /* Public functions */
bool register_();
bool unRegister();
bool accept(ActionConfig* config=tsk_null);
bool reject(ActionConfig* config=tsk_null);
};
/* ======================== SubscriptionSession ========================*/
class SubscriptionSession : public SipSession
{
public: /* ctor() and dtor() */
SubscriptionSession(SipStack* Stack);
virtual ~SubscriptionSession();
public: /* Public functions */
bool subscribe();
bool unSubscribe();
};
#endif /* TINYWRAP_SIPSESSION_H */

View File

@ -0,0 +1,524 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipStack.h"
#include "SipSession.h"
#include "SipEvent.h"
#include "DDebug.h"
#include "Common.h"
unsigned SipStack::count = 0;
/* === ANSI-C functions (local use) === */
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* callback_, const char* realm_uri, const char* impi_uri, const char* impu_uri)
:SafeObject()
{
this->debugCallback = tsk_null;
this->callback = callback_;
/* Initialize network layer */
if(SipStack::count == 0){
tdav_init();
tnet_startup();
}
/* Creates stack handle */
this->handle = 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());
SipStack::count++;
}
SipStack::~SipStack()
{
this->stop();
/* Destroy stack handle */
TSK_OBJECT_SAFE_FREE(this->handle);
/* DeInitialize the network layer (only if last stack) */
if(--SipStack::count == 0){
tdav_deinit();
tnet_cleanup();
}
}
bool SipStack::start()
{
return (tsip_stack_start(this->handle) == 0);
}
bool SipStack::setDebugCallback(DDebugCallback* callback)
{
if(this && callback){
this->debugCallback = callback;
tsk_debug_set_arg_data(this);
tsk_debug_set_info_cb(DDebugCallback::debug_info_cb);
tsk_debug_set_warn_cb(DDebugCallback::debug_warn_cb);
tsk_debug_set_error_cb(DDebugCallback::debug_error_cb);
tsk_debug_set_fatal_cb(DDebugCallback::debug_fatal_cb);
}
else if(this){
this->debugCallback = tsk_null;
tsk_debug_set_arg_data(tsk_null);
tsk_debug_set_info_cb(tsk_null);
tsk_debug_set_warn_cb(tsk_null);
tsk_debug_set_error_cb(tsk_null);
tsk_debug_set_fatal_cb(tsk_null);
}
return true;
}
bool SipStack::setRealm(const char* realm_uri)
{
int ret = tsip_stack_set(this->handle,
TSIP_STACK_SET_REALM(realm_uri),
TSIP_STACK_SET_NULL());
return (ret == 0);
}
bool SipStack::setIMPI(const char* impi)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_IMPI(impi),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setIMPU(const char* impu_uri)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_IMPU(impu_uri),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setPassword(const char* password)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_PASSWORD(password),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setAMF(const char* amf)
{
uint16_t _amf = (uint16_t)tsk_atox(amf);
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_IMS_AKA_AMF(_amf),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setOperatorId(const char* opid)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_IMS_AKA_OPERATOR_ID(opid),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setProxyCSCF(const char* fqdn, unsigned short port, const char* transport, const char* ipversion)
{
unsigned _port = port;//promote
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_PROXY_CSCF(fqdn, _port, transport, ipversion),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setLocalIP(const char* ip)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_LOCAL_IP(ip),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setLocalPort(unsigned short port)
{
unsigned _port = port;//promote
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_LOCAL_PORT(_port),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setEarlyIMS(bool enabled){
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_EARLY_IMS(enabled? tsk_true : tsk_false),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::addHeader(const char* name, const char* value)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_HEADER(name, value),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::removeHeader(const char* name)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_UNSET_HEADER(name),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::addDnsServer(const char* ip)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_DNS_SERVER(ip),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setDnsDiscovery(bool enabled)
{
tsk_bool_t _enabled = enabled;// 32bit/64bit workaround
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_DISCOVERY_NAPTR(_enabled),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setAoR(const char* ip, int port)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_AOR(ip, port),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setModeServer()
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_MODE_SERVER(),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict)
{
tsk_bool_t _enablePresDict= enablePresDict;// 32bit/64bit workaround
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_SIGCOMP(dms, sms, cpb, _enablePresDict),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::addSigCompCompartment(const char* compId)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_SIGCOMP_NEW_COMPARTMENT(compId),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::removeSigCompCompartment(const char* compId)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT(compId),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setSTUNServer(const char* ip, unsigned short port)
{
unsigned _port = port;//promote
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_STUN_SERVER(ip, _port),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setSTUNCred(const char* login, const char* password)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_STUN_CRED(login, password),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setTLSSecAgree(bool enabled)
{
tsk_bool_t _enable = enabled;
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_SECAGREE_TLS(_enable),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setSSLCretificates(const char* privKey, const char* pubKey, const char* caKey)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_TLS_CERTS(caKey, pubKey, privKey),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setIPSecSecAgree(bool enabled)
{
tsk_bool_t _enable = enabled;
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_SECAGREE_IPSEC(_enable),
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setIPSecParameters(const char* algo, const char* ealgo, const char* mode, const char* proto)
{
return (tsip_stack_set(this->handle,
TSIP_STACK_SET_IPSEC_PARAMS(algo, ealgo, mode, proto),
TSIP_STACK_SET_NULL()) == 0);
}
char* SipStack::dnsENUM(const char* service, const char* e164num, const char* domain)
{
tnet_dns_ctx_t* dnsctx = tsip_stack_get_dnsctx(this->handle);
char* uri = tsk_null;
if(dnsctx){
if(!(uri = tnet_dns_enum_2(dnsctx, service, e164num, domain))){
TSK_DEBUG_ERROR("ENUM(%s) failed", e164num);
}
tsk_object_unref(dnsctx);
return uri;
}
else{
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
}
char* SipStack::dnsNaptrSrv(const char* domain, const char* service, unsigned short *OUTPUT)
{
tnet_dns_ctx_t* dnsctx = tsip_stack_get_dnsctx(this->handle);
char* ip = tsk_null;
tnet_port_t port;
*OUTPUT = 0;
if(dnsctx){
if(!tnet_dns_query_naptr_srv(dnsctx, domain, service, &ip, &port)){
*OUTPUT = port;
}
tsk_object_unref(dnsctx);
return ip;
}
else{
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
}
char* SipStack::dnsSrv(const char* service, unsigned short* OUTPUT)
{
tnet_dns_ctx_t* dnsctx = tsip_stack_get_dnsctx(this->handle);
char* ip = tsk_null;
tnet_port_t port = 0;
*OUTPUT = 0;
if(dnsctx){
if(!tnet_dns_query_srv(dnsctx, service, &ip, &port)){
*OUTPUT = port;
}
tsk_object_unref(dnsctx);
return ip;
}
else{
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
}
char* SipStack::getLocalIPnPort(const char* protocol, unsigned short* OUTPUT)
{
tnet_ip_t ip;
tnet_port_t port;
int ret;
if(!OUTPUT || !protocol){
TSK_DEBUG_ERROR("invalid parameter");
return tsk_null;
}
if((ret = tsip_stack_get_local_ip_n_port(this->handle, protocol, &port, &ip))){
TSK_DEBUG_ERROR("Failed to get local ip and port with error code=%d", ret);
return tsk_null;
}
*OUTPUT = port;
return tsk_strdup(ip); // See Swig %newobject
}
char* SipStack::getPreferredIdentity()
{
tsip_uri_t* ppid = tsip_stack_get_preferred_id(this->handle);
char* str_ppid = tsk_null;
if(ppid){
str_ppid = tsip_uri_tostring(ppid, tsk_false, tsk_false);
TSK_OBJECT_SAFE_FREE(ppid);
}
return str_ppid;
}
bool SipStack::isValid()
{
return (this->handle != tsk_null);
}
bool SipStack::stop()
{
int ret = tsip_stack_stop(this->handle);
return (ret == 0);
}
void SipStack::setCodecs(tdav_codec_id_t codecs)
{
tdav_set_codecs(codecs);
}
void SipStack::setCodecs_2(int codecs) // For stupid languages
{
tdav_set_codecs((tdav_codec_id_t)codecs);
}
bool SipStack::isCodecSupported(tdav_codec_id_t codec)
{
return tdav_codec_is_supported(codec) ? true : false;
}
int stack_callback(const tsip_event_t *sipevent)
{
int ret = 0;
const SipStack* Stack = tsk_null;
SipEvent* e = tsk_null;
if(!sipevent){ /* should never happen ...but who know? */
TSK_DEBUG_WARN("Null SIP event.");
return -1;
}
else {
if(sipevent->type == tsip_event_stack && sipevent->userdata){
/* sessionless event */
Stack = dyn_cast<const SipStack*>((const SipStack*)sipevent->userdata);
}
else {
const void* userdata;
/* gets the stack from the session */
const tsip_stack_handle_t* stack_handle = tsip_ssession_get_stack(sipevent->ss);
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))){
Stack = dyn_cast<const SipStack*>((const SipStack*)userdata);
}
}
}
if(!Stack){
TSK_DEBUG_WARN("Invalid SIP event (Stack is Null).");
return -2;
}
Stack->Lock();
switch(sipevent->type){
case tsip_event_register:
{ /* REGISTER */
if(Stack->getCallback()){
e = new RegistrationEvent(sipevent);
Stack->getCallback()->OnRegistrationEvent((const RegistrationEvent*)e);
}
break;
}
case tsip_event_invite:
{ /* INVITE */
if(Stack->getCallback()){
e = new InviteEvent(sipevent);
Stack->getCallback()->OnInviteEvent((const InviteEvent*)e);
}
break;
}
case tsip_event_message:
{ /* MESSAGE */
if(Stack->getCallback()){
e = new MessagingEvent(sipevent);
Stack->getCallback()->OnMessagingEvent((const MessagingEvent*)e);
}
break;
}
case tsip_event_options:
{ /* OPTIONS */
if(Stack->getCallback()){
e = new OptionsEvent(sipevent);
Stack->getCallback()->OnOptionsEvent((const OptionsEvent*)e);
}
break;
}
case tsip_event_publish:
{ /* PUBLISH */
if(Stack->getCallback()){
e = new PublicationEvent(sipevent);
Stack->getCallback()->OnPublicationEvent((const PublicationEvent*)e);
}
break;
}
case tsip_event_subscribe:
{ /* SUBSCRIBE */
if(Stack->getCallback()){
e = new SubscriptionEvent(sipevent);
Stack->getCallback()->OnSubscriptionEvent((const SubscriptionEvent*)e);
}
break;
}
case tsip_event_dialog:
{ /* Common to all dialogs */
if(Stack->getCallback()){
e = new DialogEvent(sipevent);
Stack->getCallback()->OnDialogEvent((const DialogEvent*)e);
}
break;
}
case tsip_event_stack:
{ /* Stack event */
if(Stack->getCallback()){
e = new StackEvent(sipevent);
Stack->getCallback()->OnStackEvent((const StackEvent*)e);
}
break;
}
default:
{ /* Unsupported */
TSK_DEBUG_WARN("%d not supported as SIP event.", sipevent->type);
ret = -3;
break;
}
}
Stack->UnLock();
if(e){
delete e;
}
return ret;
}

View File

@ -0,0 +1,109 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPSTACK_H
#define TINYWRAP_SIPSTACK_H
#include "SipCallback.h"
#include "SafeObject.h"
#include "tinydav/tdav.h"
#include "tinysip.h"
class DDebugCallback;
class SipStack: public SafeObject
{
public: /* ctor() and dtor() */
SipStack(SipCallback* callback, const char* realm_uri, const char* impi_uri, const char* impu_uri);
~SipStack();
public: /* API functions */
bool start();
bool setDebugCallback(DDebugCallback* callback);
bool setRealm(const char* realm_uri);
bool setIMPI(const char* impi);
bool setIMPU(const char* impu_uri);
bool setPassword(const char* password);
bool setAMF(const char* amf);
bool setOperatorId(const char* opid);
bool setProxyCSCF(const char* fqdn, unsigned short port, const char* transport, const char* ipversion);
bool setLocalIP(const char* ip);
bool setLocalPort(unsigned short port);
bool setEarlyIMS(bool enabled);
bool addHeader(const char* name, const char* value);
bool removeHeader(const char* name);
bool addDnsServer(const char* ip);
bool setDnsDiscovery(bool enabled);
bool setAoR(const char* ip, int port);
#if !defined(SWIG)
bool setModeServer();
#endif
bool setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict);
bool addSigCompCompartment(const char* compId);
bool removeSigCompCompartment(const char* compId);
bool setSTUNServer(const char* ip, unsigned short port);
bool setSTUNCred(const char* login, const char* password);
bool setTLSSecAgree(bool enabled);
bool setSSLCretificates(const char* privKey, const char* pubKey, const char* caKey);
bool setIPSecSecAgree(bool enabled);
bool setIPSecParameters(const char* algo, const char* ealgo, const char* mode, const char* proto);
char* dnsENUM(const char* service, const char* e164num, const char* domain);
char* dnsNaptrSrv(const char* domain, const char* service, unsigned short *OUTPUT);
char* dnsSrv(const char* service, unsigned short* OUTPUT);
char* getLocalIPnPort(const char* protocol, unsigned short* OUTPUT);
char* getPreferredIdentity();
bool isValid();
bool stop();
static void setCodecs(tdav_codec_id_t codecs);
static void setCodecs_2(int codecs); // For stupid languages
static bool isCodecSupported(tdav_codec_id_t codec);
public: /* Public helper function */
#if !defined(SWIG)
inline tsip_stack_handle_t* getHandle()const{
return this->handle;
}
inline SipCallback* getCallback()const{
return this->callback;
}
inline DDebugCallback* getDebugCallback() const{
return this->debugCallback;
}
#endif
private:
SipCallback* callback;
DDebugCallback* debugCallback;
tsip_stack_handle_t *handle;
static unsigned count;
};
#endif /* TINYWRAP_SIPSTACK_H */

View File

@ -0,0 +1,257 @@
%{
#include "ActionConfig.h"
#include "MediaSessionMgr.h"
#include "MediaContent.h"
#include "SipUri.h"
#include "SipMessage.h"
#include "SipEvent.h"
#include "SipSession.h"
#include "ProxyPluginMgr.h"
#include "ProxyConsumer.h"
#include "ProxyProducer.h"
#include "SipCallback.h"
#include "SafeObject.h"
#include "SipStack.h"
%}
/* Callbacks */
%feature("director") SipCallback;
%feature("director") ProxyPluginMgrCallback;
%feature("director") ProxyAudioConsumerCallback;
%feature("director") ProxyVideoConsumerCallback;
%feature("director") ProxyAudioProducerCallback;
%feature("director") ProxyVideoProducerCallback;
%nodefaultctor;
%include "ActionConfig.h"
%include "MediaSessionMgr.h"
%include "MediaContent.h"
%include "SipUri.h"
%include "SipMessage.h"
%include "SipEvent.h"
%include "SipSession.h"
%include "ProxyPluginMgr.h"
%include "ProxyConsumer.h"
%include "ProxyProducer.h"
%include "SipCallback.h"
%include "SafeObject.h"
%include "SipStack.h"
%clearnodefaultctor;
/* ====== From "tinySIP\include\tinysip\tsip_event.h" ====== */
typedef enum tsip_event_type_e
{
tsip_event_invite,
tsip_event_message,
tsip_event_options,
tsip_event_publish,
tsip_event_register,
tsip_event_subscribe,
tsip_event_dialog
}
tsip_event_type_t;
// 7xx ==> errors
#define tsip_event_code_dialog_transport_error 702
#define tsip_event_code_dialog_global_error 703
#define tsip_event_code_dialog_message_error 704
// 8xx ==> success
#define tsip_event_code_dialog_request_incoming 800
#define tsip_event_code_dialog_request_cancelled 801
#define tsip_event_code_dialog_request_sent 802
// 9xx ==> Informational
#define tsip_event_code_dialog_connecting 900
#define tsip_event_code_dialog_connected 901
#define tsip_event_code_dialog_terminating 902
#define tsip_event_code_dialog_terminated 903
#define tsip_event_code_stack_started 950
#define tsip_event_code_stack_stopped 951
#define tsip_event_code_stack_failed_to_start 952
#define tsip_event_code_stack_failed_to_stop 953
/* ====== From "tinySIP\include\tinysip\tsip_api_register.h" ====== */
typedef enum tsip_register_event_type_e
{
tsip_i_newreg,
tsip_i_register, // refresh
tsip_ao_register,
tsip_i_unregister,
tsip_ao_unregister,
}
tsip_register_event_type_t;
/* ====== From "tinySIP\include\tinysip\tsip_api_subscribe.h" ====== */
typedef enum tsip_subscribe_event_type_e
{
tsip_i_subscribe,
tsip_ao_subscribe,
tsip_i_unsubscribe,
tsip_ao_unsubscribe,
tsip_i_notify,
tsip_ao_notify
}
tsip_subscribe_event_type_t;
/* ====== From "tinySIP\include\tinysip\tsip_api_publish.h" ====== */
typedef enum tsip_publish_event_type_e
{
tsip_i_publish,
tsip_ao_publish,
tsip_i_unpublish,
tsip_ao_unpublish
}
tsip_publish_event_type_t;
/* ====== From "tinySIP\include\tinysip\tsip_api_message.h" ====== */
typedef enum tsip_message_event_type_e
{
tsip_i_message,
tsip_ao_message,
}
tsip_message_event_type_t;
/* ====== From "tinySIP\include\tinysip\tsip_api_options.h" ====== */
typedef enum tsip_options_event_type_e
{
tsip_i_options,
tsip_ao_options,
}
tsip_options_event_type_t;
/* ====== From "tinySIP\include\tinysip\tsip_api_invite.h" ====== */
typedef enum tsip_invite_event_type_e
{
// ============================
// Sip Events
//
tsip_i_newcall,
//! in-dialog requests/reponses
tsip_i_request,
tsip_ao_request,
/* Explicit Call Transfer (ECT) */
tsip_o_ect_ok,
tsip_o_ect_nok,
tsip_i_ect,
// ============================
// Media Events
//
tsip_m_early_media,
/* 3GPP TS 24.610: Communication Hold */
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,
tsip_m_local_resume_nok,
tsip_m_remote_hold,
tsip_m_remote_resume,
}
tsip_invite_event_type_t;
/* ====== From "tinymedia/tmedia_common.h" ====== */
// used by tinyWRAP
typedef enum tmedia_chroma_e
{
tmedia_rgb24, // will be stored as bgr24 on x86 (little endians) machines; e.g. WindowsPhone7
tmedia_bgr24, // used by windows consumer (DirectShow) -
tmedia_rgb32, // used by iOS4 consumer (iPhone and iPod touch)
tmedia_rgb565le, // (used by both android and wince consumers)
tmedia_rgb565be,
tmedia_nv12, // used by iOS4 producer (iPhone and iPod Touch 3GS and 4)
tmedia_nv21, // Yuv420 SP (used by android producer)
tmedia_yuv422p,
tmedia_uyvy422, // used by iOS4 producer (iPhone and iPod Touch 3G)
tmedia_yuv420p, // Default
}
tmedia_chroma_t;
/* ====== From "tinymedia/tmedia_qos.h" ====== */
typedef enum tmedia_qos_stype_e
{
tmedia_qos_stype_none,/* not part of the RFC */
tmedia_qos_stype_segmented,
tmedia_qos_stype_e2e,
}
tmedia_qos_stype_t;
/* ====== From "tinymedia/tmedia_qos.h" ====== */
typedef enum tmedia_qos_strength_e
{
/* do no change the order (none -> optional -> manadatory) */
tmedia_qos_strength_none,
tmedia_qos_strength_failure,
tmedia_qos_strength_unknown,
tmedia_qos_strength_optional,
tmedia_qos_strength_mandatory
}
tmedia_qos_strength_t;
/* ====== From "tinymedia/tmedia_common.h" ====== */
typedef enum tmedia_bandwidth_level_e
{
tmedia_bl_low,
tmedia_bl_medium,
tmedia_bl_hight
}
tmedia_bandwidth_level_t;
/* ====== From "tinydav/tdav.h" ====== */
typedef enum tdav_codec_id_e
{
tdav_codec_id_none = 0x00000000,
tdav_codec_id_amr_nb_oa = 0x00000001<<0,
tdav_codec_id_amr_nb_be = 0x00000001<<1,
tdav_codec_id_amr_wb_oa = 0x00000001<<2,
tdav_codec_id_amr_wb_be = 0x00000001<<3,
tdav_codec_id_gsm = 0x00000001<<4,
tdav_codec_id_pcma = 0x00000001<<5,
tdav_codec_id_pcmu = 0x00000001<<6,
tdav_codec_id_ilbc = 0x00000001<<7,
tdav_codec_id_speex_nb = 0x00000001<<8,
tdav_codec_id_speex_wb = 0x00000001<<9,
tdav_codec_id_speex_uwb = 0x00000001<<10,
tdav_codec_id_bv16 = 0x00000001<<11,
tdav_codec_id_bv32 = 0x00000001<<12,
tdav_codec_id_evrc = 0x00000001<<13,
tdav_codec_id_g729ab = 0x00000001<<14,
/* room for new Audio codecs */
tdav_codec_id_h261 = 0x00010000<<0,
tdav_codec_id_h263 = 0x00010000<<1,
tdav_codec_id_h263p = 0x00010000<<2,
tdav_codec_id_h263pp = 0x00010000<<3,
tdav_codec_id_h264_bp10 = 0x00010000<<4,
tdav_codec_id_h264_bp20 = 0x00010000<<5,
tdav_codec_id_h264_bp30 = 0x00010000<<6,
tdav_codec_id_theora = 0x00010000<<7,
tdav_codec_id_mp4ves_es = 0x00010000<<8,
}
tdav_codec_id_t;

View File

@ -0,0 +1,93 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "SipUri.h"
SipUri::SipUri(const char* uristring)
{
this->uri = tsip_uri_parse(uristring, tsk_strlen(uristring));
}
SipUri::~SipUri()
{
TSK_OBJECT_SAFE_FREE(this->uri);
}
bool SipUri::isValid(const char* uriString)
{
tsip_uri_t* _uri;
bool ret = false;
if((_uri = tsip_uri_parse(uriString, tsk_strlen(uriString)))){
ret = (_uri->type != uri_unknown)
&& (!tsk_strnullORempty(_uri->host));
TSK_OBJECT_SAFE_FREE(_uri);
}
return ret;
}
bool SipUri::isValid()
{
return (this->uri != tsk_null);
}
const char* SipUri::getScheme()
{
if(this->uri){
return this->uri->scheme;
}
return tsk_null;
}
const char* SipUri::getHost()
{
return this->uri ? this->uri->host : tsk_null;
}
unsigned short SipUri::getPort()
{
return this->uri ? this->uri->port : 0;
}
const char* SipUri::getUserName()
{
return this->uri ? this->uri->user_name : tsk_null;
}
const char* SipUri::getPassword()
{
return this->uri ? this->uri->password : tsk_null;
}
const char* SipUri::getDisplayName()
{
return this->uri ? this->uri->display_name : tsk_null;
}
const char* SipUri::getParamValue(const char* pname)
{
if(this->uri && this->uri->params){
const char* pvalue = tsk_params_get_param_value(this->uri->params, pname);
return pvalue;
}
return tsk_null;
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_SIPURI_H
#define TINYWRAP_SIPURI_H
#include "tinysip.h"
class SipUri
{
public:
SipUri(const char*);
~SipUri();
public:
static bool isValid(const char*);
bool isValid();
const char* getScheme();
const char* getHost();
unsigned short getPort();
const char* getUserName();
const char* getPassword();
const char* getDisplayName();
const char* getParamValue(const char* pname);
private:
tsip_uri_t* uri;
};
#endif /* TINYWRAP_SIPURI_H */

View File

@ -0,0 +1,564 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#include "Xcap.h"
#include "Common.h"
unsigned XcapStack::count = 0;
/* === ANSI-C functions (local use) === */
static int stack_callback(const thttp_event_t *httpevent);
/* =================================== XCAP Event ==================================== */
typedef enum twrap_xcap_step_type_e
{
txst_name,
txst_pos,
txst_att,
txst_pos_n_att,
txst_ns
}
twrap_xcap_step_type_t;
typedef struct twrap_xcap_step_s
{
TSK_DECLARE_OBJECT;
twrap_xcap_step_type_t type;
char* qname;
char* att_qname;
char* att_value;
unsigned pos;
struct{
char* prefix;
char* value;
} ns;
}
twrap_xcap_step_t;
static tsk_object_t* twrap_xcap_step_ctor(tsk_object_t * self, va_list * app)
{
twrap_xcap_step_t *step = (twrap_xcap_step_t *)self;
if(step){
}
return self;
}
static tsk_object_t* twrap_xcap_step_dtor(tsk_object_t * self)
{
twrap_xcap_step_t *step = (twrap_xcap_step_t *)self;
if(step){
TSK_FREE(step->qname);
TSK_FREE(step->att_qname);
TSK_FREE(step->att_value);
TSK_FREE(step->ns.prefix);
TSK_FREE(step->ns.value);
}
return self;
}
static const tsk_object_def_t twrap_xcap_step_def_s =
{
sizeof(twrap_xcap_step_t),
twrap_xcap_step_ctor,
twrap_xcap_step_dtor,
tsk_null,
};
const tsk_object_def_t *twrap_xcap_step_def_t = &twrap_xcap_step_def_s;
twrap_xcap_step_t* twrap_xcap_step_create(twrap_xcap_step_type_t type){
twrap_xcap_step_t* step;
if((step = (twrap_xcap_step_t*)tsk_object_new(twrap_xcap_step_def_t))){
step->type = type;
}
return step;
}
XcapSelector::XcapSelector(XcapStack* stack)
: auid(tsk_null)
{
if(stack){
this->stack_handle = tsk_object_ref(stack->getHandle());
}
this->steps = tsk_list_create();
}
XcapSelector* XcapSelector::setAUID(const char* auid)
{
tsk_strupdate(&this->auid, auid);
return this;
}
XcapSelector* XcapSelector::setName(const char* qname)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_name))){
step->qname = tsk_strdup(qname);
tsk_list_push_back_data(this->steps, (void**)&step);
}
return this;
}
XcapSelector* XcapSelector::setAttribute(const char* qname, const char* att_qname, const char* att_value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_att))){
step->qname = tsk_strdup(qname);
step->att_qname = tsk_strdup(att_qname);
step->att_value = tsk_strdup(att_value);
tsk_list_push_back_data(this->steps, (void**)&step);
}
return this;
}
XcapSelector* XcapSelector::setPos(const char* qname, unsigned pos)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_pos))){
step->qname = tsk_strdup(qname);
step->pos = pos;
tsk_list_push_back_data(this->steps, (void**)&step);
}
return this;
}
XcapSelector* XcapSelector::setPosAttribute(const char* qname, unsigned pos, const char* att_qname, const char* att_value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_pos))){
step->qname = tsk_strdup(qname);
step->pos = pos;
step->att_qname = tsk_strdup(att_qname);
step->att_value = tsk_strdup(att_value);
tsk_list_push_back_data(this->steps, (void**)&step);
}
return this;
}
XcapSelector* XcapSelector::setNamespace(const char* prefix, const char* value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_ns))){
step->ns.prefix = tsk_strdup(prefix);
step->ns.value = tsk_strdup(value);
tsk_list_push_back_data(this->steps, (void**)&step);
}
return this;
}
/* From tinyXCAP::txcap_selector_get_node_2() */
char* XcapSelector::getString()
{
char* node = tsk_null;
char* temp = tsk_null;
char* _namespace = tsk_null;
tsk_buffer_t* buffer = tsk_buffer_create_null();
const tsk_list_item_t* item;
const twrap_xcap_step_t* step;
/* Node */
tsk_list_foreach(item, this->steps){
step = (twrap_xcap_step_t*)item->data;
switch(step->type){
case txst_name:
if(tsk_buffer_append_2(buffer, "/%s", step->qname)){
goto bail;
}
break;
case txst_pos:
tsk_buffer_append_2(buffer, "/%s%%5B%u%%5D",
step->att_qname, step->pos);
break;
case txst_att:
tsk_buffer_append_2(buffer, "/%s%%5B@%s=%%22%s%%22%%5D",
step->qname, step->att_qname, step->att_value);
break;
case txst_pos_n_att:
tsk_buffer_append_2(buffer, "/%s%%5B%u%%5D%%5B@%s=%%22%s%%22%%5D",
step->qname, step->pos, step->att_qname, step->att_value);
break;
case txst_ns:
tsk_sprintf(&temp, "%sxmlns(%s=%%22%s%%22)",
_namespace?"":"%3F", step->ns.prefix, step->ns.value);
tsk_strcat(&_namespace, temp);
TSK_FREE(temp);
break;
} /* switch */
} /* for */
/* append the namespace */
if(_namespace){
tsk_buffer_append(buffer, _namespace, strlen(_namespace));
TSK_FREE(_namespace);
}
bail:
if(TSK_BUFFER_DATA(buffer) && TSK_BUFFER_SIZE(buffer)){
node = tsk_strndup((const char*)TSK_BUFFER_DATA(buffer), TSK_BUFFER_SIZE(buffer));
}
TSK_OBJECT_SAFE_FREE(buffer);
/* Document */
if(this->auid){
char* document;
if((document = txcap_selector_get_document(this->stack_handle, this->auid))){
if(node){
tsk_strcat_2(&document, "/~~/%s%s", this->auid, node);
TSK_FREE(node);
}
return document;
}
}
return node;
}
void XcapSelector::reset()
{
TSK_FREE(this->auid);
tsk_list_clear_items(this->steps);
}
XcapSelector::~XcapSelector()
{
this->reset();
TSK_OBJECT_SAFE_FREE(this->steps);
tsk_object_unref(this->stack_handle);
}
/* =================================== XCAP Message ==================================== */
XcapMessage::XcapMessage() :
httpmessage(tsk_null)
{
}
XcapMessage::XcapMessage(const thttp_message_t *_httpmessage)
{
this->httpmessage = _httpmessage;
}
XcapMessage::~XcapMessage()
{
}
short XcapMessage::getCode() const
{
if(this->httpmessage){
return this->httpmessage->line.response.status_code;
}
return 0;
}
const char* XcapMessage::getPhrase() const
{
if(this->httpmessage){
return this->httpmessage->line.response.reason_phrase;
}
return tsk_null;
}
char* XcapMessage::getXcapHeaderValue(const char* name, unsigned index /*= 0*/)
{
const thttp_header_t* header;
if((header = thttp_message_get_headerByName(this->httpmessage, name))){
return thttp_header_value_tostring(header);
}
return tsk_null;
}
char* XcapMessage::getXcapHeaderParamValue(const char* name, const char* pname, unsigned index /*= 0*/)
{
const thttp_header_t* header;
if((header = thttp_message_get_headerByName(this->httpmessage, name))){
const tsk_param_t* param;
if((param = tsk_params_get_param_by_name(header->params, pname))){
return tsk_strdup(param->value);
}
}
return tsk_null;
}
unsigned XcapMessage::getXcapContentLength()
{
if(this->httpmessage && this->httpmessage->Content){
return this->httpmessage->Content->size;
}
return 0;
}
unsigned XcapMessage::getXcapContent(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && this->httpmessage->Content){
retsize = (this->httpmessage->Content->size > maxsize) ? maxsize : this->httpmessage->Content->size;
memcpy(output, this->httpmessage->Content->data, retsize);
}
return retsize;
}
/* =================================== XCAP Event ==================================== */
XcapEvent::XcapEvent(const thttp_event_t *_httpevent)
{
this->httpevent = _httpevent;
if(_httpevent){
this->httpmessage = new XcapMessage(_httpevent->message);
}
else{
this->httpmessage = tsk_null;
}
}
XcapEvent::~XcapEvent()
{
if(this->httpmessage){
delete this->httpmessage;
}
}
thttp_event_type_t XcapEvent::getType()
{
return this->httpevent->type;
}
const XcapMessage* XcapEvent::getXcapMessage() const
{
return this->httpmessage;
}
/* =================================== XCAP Callback ==================================== */
XcapCallback::XcapCallback()
{
}
XcapCallback::~XcapCallback()
{
}
/* =================================== XCAP Stack ==================================== */
XcapStack::XcapStack(XcapCallback* _callback, const char* xui, const char* password, const char* xcap_root)
{
/* Initialize network layer */
if(XcapStack::count == 0){
tnet_startup();
}
this->callback = _callback;
this->handle = txcap_stack_create(stack_callback, xui, password, xcap_root,
TXCAP_STACK_SET_USERDATA(this),
TXCAP_STACK_SET_NULL());
}
XcapStack::~XcapStack()
{
TSK_OBJECT_SAFE_FREE(this->handle);
/* DeInitialize the network layer (only if last stack) */
if(--XcapStack::count == 0){
tnet_cleanup();
}
}
bool XcapStack::registerAUID(const char* id, const char* mime_type, const char* ns, const char* document_name, bool is_global)
{
txcap_stack_t* stack = (txcap_stack_t*)this->handle;
if(stack){
tsk_bool_t _global = is_global?tsk_true:tsk_false; // 32bit <-> 64bit workaround
return (txcap_auid_register(stack->auids, id, mime_type, ns, document_name, _global) == 0);
}
return false;
}
bool XcapStack::start()
{
return (txcap_stack_start(this->handle) == 0);
}
bool XcapStack::setCredentials(const char* xui, const char* password)
{
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_XUI(xui),
TXCAP_STACK_SET_PASSWORD(password),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::setXcapRoot(const char* xcap_root)
{
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_ROOT(xcap_root),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::setLocalIP(const char* ip)
{
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_LOCAL_IP(ip),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::setLocalPort(unsigned port)
{
tsk_istr_t port_str;
tsk_itoa(port, &port_str);
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_LOCAL_PORT(port_str),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::addHeader(const char* name, const char* value)
{
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_HEADER(name, value),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::removeHeader(const char* name)
{
return txcap_stack_set(this->handle,
TXCAP_STACK_UNSET_HEADER(name),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::setTimeout(unsigned timeout)
{
tsk_istr_t timeout_str;
tsk_itoa(timeout, &timeout_str);
return txcap_stack_set(this->handle,
TXCAP_STACK_SET_TIMEOUT(timeout_str),
TXCAP_STACK_SET_NULL()) == 0;
}
bool XcapStack::getDocument(const char* url)
{
return txcap_action_fetch_document(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::getElement(const char* url)
{
return txcap_action_fetch_element(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::getAttribute(const char* url)
{
return txcap_action_fetch_attribute(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::deleteDocument(const char* url)
{
return txcap_action_delete_document(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::deleteElement(const char* url)
{
return txcap_action_delete_element(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::deleteAttribute(const char* url)
{
return txcap_action_delete_attribute(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::putDocument(const char* url, const void* payload, unsigned len, const char* contentType)
{
return txcap_action_create_document(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_PAYLOAD(payload, len),
TXCAP_ACTION_SET_HEADER("Content-Type", contentType),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::putElement(const char* url, const void* payload, unsigned len)
{
return txcap_action_create_element(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_PAYLOAD(payload, len),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::putAttribute(const char* url, const void* payload, unsigned len)
{
return txcap_action_create_attribute(this->handle,
TXCAP_ACTION_SET_REQUEST_URI(url),
TXCAP_ACTION_SET_PAYLOAD(payload, len),
TXCAP_ACTION_SET_NULL()) == 0;
}
bool XcapStack::stop()
{
return (txcap_stack_stop(this->handle) == 0);
}
int stack_callback(const thttp_event_t *httpevent)
{
int ret = 0;
const XcapStack* stack = tsk_null;
XcapEvent* e = tsk_null;
const txcap_stack_handle_t* stack_handle = thttp_session_get_userdata(httpevent->session);
if(!stack_handle || !(stack = dyn_cast<const XcapStack*>((const XcapStack*)stack_handle))){
TSK_DEBUG_ERROR("Invalid user data");
return -1;
}
if(stack->getCallback()){
if((e = new XcapEvent(httpevent))){
stack->getCallback()->onEvent(e);
delete e;
}
}
return 0;
}

View File

@ -0,0 +1,165 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_XCAP_H
#define TINYWRAP_XCAP_H
#include "tinyxcap.h"
class XcapStack;
typedef tsk_list_t twrap_xcap_steps_L_t;
//
// XcapSelector
//
class XcapSelector
{
public:
XcapSelector(XcapStack* stack);
virtual ~XcapSelector();
public: /* API functions */
XcapSelector* setAUID(const char* auid);
XcapSelector* setName(const char* qname);
XcapSelector* setAttribute(const char* qname, const char* att_qname, const char* att_value);
XcapSelector* setPos(const char* qname, unsigned pos);
XcapSelector* setPosAttribute(const char* qname, unsigned pos, const char* att_qname, const char* att_value);
XcapSelector* setNamespace(const char* prefix, const char* value);
char* getString();// %newobject
void reset();
private:
txcap_stack_handle_t* stack_handle;
char* auid;
twrap_xcap_steps_L_t* steps;
};
//
// XcapMessage
//
class XcapMessage
{
public:
XcapMessage();
#if !defined(SWIG)
XcapMessage(const thttp_message_t *httpmessage);
#endif
virtual ~XcapMessage();
short getCode() const;
const char* getPhrase() const;
char* getXcapHeaderValue(const char* name, unsigned index = 0);
char* getXcapHeaderParamValue(const char* name, const char* param, unsigned index = 0);
unsigned getXcapContentLength();
unsigned getXcapContent(void* output, unsigned maxsize);
private:
const thttp_message_t *httpmessage;
};
//
// XcapEvent
//
class XcapEvent
{
public:
#if !defined(SWIG)
XcapEvent(const thttp_event_t *httpevent);
#endif
virtual ~XcapEvent();
thttp_event_type_t getType();
const XcapMessage* getXcapMessage() const;
private:
const thttp_event_t *httpevent;
const XcapMessage* httpmessage;
};
//
// XcapCallback
//
class XcapCallback
{
public:
XcapCallback();
virtual ~XcapCallback();
virtual int onEvent(const XcapEvent* e)const { return -1; }
};
//
// XcapStack
//
class XcapStack
{
public:
XcapStack(XcapCallback* callback, const char* xui, const char* password, const char* xcap_root);
virtual ~XcapStack();
public: /* API functions */
bool registerAUID(const char* id, const char* mime_type, const char* ns, const char* document_name, bool is_global);
bool start();
bool setCredentials(const char* xui, const char* password);
bool setXcapRoot(const char* xcap_root);
bool setLocalIP(const char* ip);
bool setLocalPort(unsigned port);
bool addHeader(const char* name, const char* value);
bool removeHeader(const char* name);
bool setTimeout(unsigned timeout);
bool getDocument(const char* url);
bool getElement(const char* url);
bool getAttribute(const char* url);
bool deleteDocument(const char* url);
bool deleteElement(const char* url);
bool deleteAttribute(const char* url);
bool putDocument(const char* url, const void* payload, unsigned len, const char* contentType);
bool putElement(const char* url, const void* payload, unsigned len);
bool putAttribute(const char* url, const void* payload, unsigned len);
bool stop();
public: /* Public helper function */
#if !defined(SWIG)
txcap_stack_handle_t* getHandle(){
return this->handle;
}
XcapCallback* getCallback()const{
return this->callback;
}
#endif
private:
txcap_stack_handle_t* handle;
XcapCallback* callback;
static unsigned count;
};
#endif /* TINYWRAP_XCAP_H */

View File

@ -0,0 +1,22 @@
%{
#include "Xcap.h"
%}
/* Callbacks */
%feature("director") XcapCallback;
%nodefaultctor;
%include "Xcap.h"
%clearnodefaultctor;
typedef enum thttp_event_type_e
{
thttp_event_dialog_started,
thttp_event_message,
thttp_event_auth_failed,
thttp_event_closed,
thttp_event_transport_error,
thttp_event_dialog_terminated
}
thttp_event_type_t;

View File

@ -0,0 +1,69 @@
/* File : tinyWRAP.i */
%module(directors="1") tinyWRAP
%include "typemaps.i"
%include <stdint.i>
%{
#include "DDebug.h"
#include "AudioResampler.h"
%}
%feature("director") DDebugCallback;
%nodefaultctor;
%include "DDebug.h"
%include "AudioResampler.h"
%include "Common.h"
%clearnodefaultctor;
/* ========== Sip/Sdp Stack ========== */
%newobject getSipHeaderValue;
%newobject getSdpHeaderValue;
%newobject getSdpHeaderAValue;
%newobject getSipHeaderParamValue;
%newobject SipStack::dnsENUM;
%newobject SipStack::dnsNaptrSrv;
%newobject SipStack::dnsSrv;
%newobject SipStack::getPreferredIdentity;
%newobject SipStack::getLocalIPnPort;
%newobject MessagingEvent::takeSessionOwnership;
%newobject InviteEvent::takeCallSessionOwnership;
%newobject InviteEvent::takeMsrpSessionOwnership;
%newobject RegistrationEvent::takeSessionOwnership;
%newobject ProxyPluginMgr::createInstance;
%newobject MediaContent::parse;
%include SipStack.i
/* ========== Xcap Stack ========== */
%newobject XcapSelector::getString;
%newobject getXcapHeaderValue;
%newobject getXcapHeaderParamValue;
%include Xcap.i
/* ========== SMS ========== */
%newobject SMSEncoder::encodeSubmit;
%newobject SMSEncoder::encodeDeliver;
%newobject SMSEncoder::encodeACK;
%newobject SMSEncoder::encodeError;
%newobject SMSEncoder::decode;
%include SMS.i
/* ========== MSRP ========== */
%newobject getMsrpHeaderValue;
%newobject getMsrpHeaderParamValue;
%include Msrp.i

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef TINYWRAP_CONFIG_H
#define TINYWRAP_CONFIG_H
#ifdef __SYMBIAN32__
#undef _WIN32 /* Because of WINSCW */
#endif
/* Windows (XP/Vista/7/CE and Windows Mobile) macro definition.
*/
#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE)
# define TWRAP_UNDER_WINDOWS 1
#endif
#if (TWRAP_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(TINYWRAP_EXPORTS)
# define TINYWRAP_API __declspec(dllexport)
# define TINYWRAP_GEXTERN __declspec(dllexport)
#elif (TWRAP_UNDER_WINDOWS || defined(__SYMBIAN32__)) /*&& defined(TINYWRAP_IMPORTS)*/
# define TINYWRAP_API __declspec(dllimport)
# define TINYWRAP_GEXTERN __declspec(dllimport)
#else
# define TINYWRAP_API
# define TINYWRAP_GEXTERN extern
#endif
/* Guards against C++ name mangling
*/
#ifdef __cplusplus
# define TWRAP_BEGIN_DECLS extern "C" {
# define TWRAP_END_DECLS }
#else
# define TWRAP_BEGIN_DECLS
# define TWRAP_END_DECLS
#endif
/* Disable some well-known warnings
*/
#ifdef _MSC_VER
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdint.h>
#if HAVE_CONFIG_H
#include "../config.h"
#endif
#endif // TINYWRAP_CONFIG_H

View File

@ -0,0 +1,39 @@
##### CSharp
echo "--->CSharp...<---"
swig -c++ -csharp -namespace org.doubango.tinyWRAP -outdir csharp -o csharp/tinyWRAP_wrap.cxx csharp/csharp.i
##### Objective-C
#echo "--->Objective-C...<---"
swig -c++ -objc -outdir objc -o -objc/tinyWRAP_wrap.cxx -objc/-objc.i
##### Java
echo "--->Java...<---"
swig -c++ -java -package org.doubango.tinyWRAP -outdir java -o java/tinyWRAP_wrap.cxx java/java.i
echo "Java(Google Dalvik)..."
echo "Google Android special tasks"
swig -c++ -java -package org.doubango.tinyWRAP -outdir java/android -o java/android/tinyWRAP_wrap.cxx java/java.i
sed -i 's/dynamic_cast/static_cast/g' java/android/tinyWRAP_wrap.cxx
sed -i 's/AttachCurrentThread((void \*\*)/AttachCurrentThread((JNIEnv \*\*)/g' java/android/tinyWRAP_wrap.cxx
sed -i 's/AttachCurrentThreadAsDaemon((void \*\*)/AttachCurrentThreadAsDaemon((JNIEnv \*\*)/g' java/android/tinyWRAP_wrap.cxx
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/SipCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/DDebugCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/ProxyPluginMgrCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/ProxyAudioConsumerCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/ProxyAudioProducerCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/ProxyVideoProducerCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/ProxyVideoConsumerCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/XcapCallback.java
sed -i 's/_director_connect(this, swigCPtr, swigCMemOwn, true)/_director_connect(this, swigCPtr, swigCMemOwn, false)/g' java/android/MsrpCallback.java
##### Python
echo "--->Python...<---"
swig -c++ -python -outdir python -o python/tinyWRAP_wrap.cxx python/python.i
##### Perl
echo "--->Perl...<---"
swig -c++ -perl -outdir perl -o Perl/tinyWRAP_wrap.cxx perl/perl.i
##### Ruby
echo "--->Ruby...<---"
#swig -c++ -ruby -outdir Ruby -o Ruby/tinyWRAP_wrap.cxx ruby/ruby.i

View File

@ -0,0 +1,72 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ActionConfig : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ActionConfig(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ActionConfig obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ActionConfig() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ActionConfig(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ActionConfig() : this(tinyWRAPPINVOKE.new_ActionConfig(), true) {
}
public bool addHeader(string name, string value) {
bool ret = tinyWRAPPINVOKE.ActionConfig_addHeader(swigCPtr, name, value);
return ret;
}
public ActionConfig setResponseLine(short code, string phrase) {
IntPtr cPtr = tinyWRAPPINVOKE.ActionConfig_setResponseLine(swigCPtr, code, phrase);
ActionConfig ret = (cPtr == IntPtr.Zero) ? null : new ActionConfig(cPtr, false);
return ret;
}
public ActionConfig setMediaString(twrap_media_type_t type, string key, string value) {
IntPtr cPtr = tinyWRAPPINVOKE.ActionConfig_setMediaString(swigCPtr, (int)type, key, value);
ActionConfig ret = (cPtr == IntPtr.Zero) ? null : new ActionConfig(cPtr, false);
return ret;
}
public ActionConfig setMediaInt(twrap_media_type_t type, string key, int value) {
IntPtr cPtr = tinyWRAPPINVOKE.ActionConfig_setMediaInt(swigCPtr, (int)type, key, value);
ActionConfig ret = (cPtr == IntPtr.Zero) ? null : new ActionConfig(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,69 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class AudioResampler : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal AudioResampler(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(AudioResampler obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~AudioResampler() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_AudioResampler(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public AudioResampler(uint nInFreq, uint nOutFreq, uint nFrameDuration, uint nChannels, uint nQuality) : this(tinyWRAPPINVOKE.new_AudioResampler(nInFreq, nOutFreq, nFrameDuration, nChannels, nQuality), true) {
}
public bool isValid() {
bool ret = tinyWRAPPINVOKE.AudioResampler_isValid(swigCPtr);
return ret;
}
public uint getOutputRequiredSizeInShort() {
uint ret = tinyWRAPPINVOKE.AudioResampler_getOutputRequiredSizeInShort(swigCPtr);
return ret;
}
public uint getInputRequiredSizeInShort() {
uint ret = tinyWRAPPINVOKE.AudioResampler_getInputRequiredSizeInShort(swigCPtr);
return ret;
}
public uint process(byte[] pInData, uint nInSizeInBytes, byte[] pOutData, uint nOutSizeInBytes) {
uint ret = tinyWRAPPINVOKE.AudioResampler_process(swigCPtr, pInData, nInSizeInBytes, pOutData, nOutSizeInBytes);
return ret;
}
}
}

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class CallSession : InviteSession {
private HandleRef swigCPtr;
internal CallSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.CallSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(CallSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~CallSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_CallSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public CallSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_CallSession(SipStack.getCPtr(Stack)), true) {
}
public bool callAudio(string remoteUri, ActionConfig config) {
bool ret = tinyWRAPPINVOKE.CallSession_callAudio__SWIG_0(swigCPtr, remoteUri, ActionConfig.getCPtr(config));
return ret;
}
public bool callAudio(string remoteUri) {
bool ret = tinyWRAPPINVOKE.CallSession_callAudio__SWIG_1(swigCPtr, remoteUri);
return ret;
}
public bool callAudioVideo(string remoteUri, ActionConfig config) {
bool ret = tinyWRAPPINVOKE.CallSession_callAudioVideo__SWIG_0(swigCPtr, remoteUri, ActionConfig.getCPtr(config));
return ret;
}
public bool callAudioVideo(string remoteUri) {
bool ret = tinyWRAPPINVOKE.CallSession_callAudioVideo__SWIG_1(swigCPtr, remoteUri);
return ret;
}
public bool callVideo(string remoteUri, ActionConfig config) {
bool ret = tinyWRAPPINVOKE.CallSession_callVideo__SWIG_0(swigCPtr, remoteUri, ActionConfig.getCPtr(config));
return ret;
}
public bool callVideo(string remoteUri) {
bool ret = tinyWRAPPINVOKE.CallSession_callVideo__SWIG_1(swigCPtr, remoteUri);
return ret;
}
public bool setSessionTimer(uint timeout, string refresher) {
bool ret = tinyWRAPPINVOKE.CallSession_setSessionTimer(swigCPtr, timeout, refresher);
return ret;
}
public bool set100rel(bool enabled) {
bool ret = tinyWRAPPINVOKE.CallSession_set100rel(swigCPtr, enabled);
return ret;
}
public bool setQoS(tmedia_qos_stype_t type, tmedia_qos_strength_t strength) {
bool ret = tinyWRAPPINVOKE.CallSession_setQoS(swigCPtr, (int)type, (int)strength);
return ret;
}
public bool hold(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.CallSession_hold__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool hold() {
bool ret = tinyWRAPPINVOKE.CallSession_hold__SWIG_1(swigCPtr);
return ret;
}
public bool resume(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.CallSession_resume__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool resume() {
bool ret = tinyWRAPPINVOKE.CallSession_resume__SWIG_1(swigCPtr);
return ret;
}
public bool sendDTMF(int number) {
bool ret = tinyWRAPPINVOKE.CallSession_sendDTMF(swigCPtr, number);
return ret;
}
}
}

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class DDebugCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal DDebugCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(DDebugCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~DDebugCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_DDebugCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public DDebugCallback() : this(tinyWRAPPINVOKE.new_DDebugCallback(), true) {
SwigDirectorConnect();
}
public virtual int OnDebugInfo(string message) {
int ret = (SwigDerivedClassHasMethod("OnDebugInfo", swigMethodTypes0) ? tinyWRAPPINVOKE.DDebugCallback_OnDebugInfoSwigExplicitDDebugCallback(swigCPtr, message) : tinyWRAPPINVOKE.DDebugCallback_OnDebugInfo(swigCPtr, message));
return ret;
}
public virtual int OnDebugWarn(string message) {
int ret = (SwigDerivedClassHasMethod("OnDebugWarn", swigMethodTypes1) ? tinyWRAPPINVOKE.DDebugCallback_OnDebugWarnSwigExplicitDDebugCallback(swigCPtr, message) : tinyWRAPPINVOKE.DDebugCallback_OnDebugWarn(swigCPtr, message));
return ret;
}
public virtual int OnDebugError(string message) {
int ret = (SwigDerivedClassHasMethod("OnDebugError", swigMethodTypes2) ? tinyWRAPPINVOKE.DDebugCallback_OnDebugErrorSwigExplicitDDebugCallback(swigCPtr, message) : tinyWRAPPINVOKE.DDebugCallback_OnDebugError(swigCPtr, message));
return ret;
}
public virtual int OnDebugFatal(string message) {
int ret = (SwigDerivedClassHasMethod("OnDebugFatal", swigMethodTypes3) ? tinyWRAPPINVOKE.DDebugCallback_OnDebugFatalSwigExplicitDDebugCallback(swigCPtr, message) : tinyWRAPPINVOKE.DDebugCallback_OnDebugFatal(swigCPtr, message));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("OnDebugInfo", swigMethodTypes0))
swigDelegate0 = new SwigDelegateDDebugCallback_0(SwigDirectorOnDebugInfo);
if (SwigDerivedClassHasMethod("OnDebugWarn", swigMethodTypes1))
swigDelegate1 = new SwigDelegateDDebugCallback_1(SwigDirectorOnDebugWarn);
if (SwigDerivedClassHasMethod("OnDebugError", swigMethodTypes2))
swigDelegate2 = new SwigDelegateDDebugCallback_2(SwigDirectorOnDebugError);
if (SwigDerivedClassHasMethod("OnDebugFatal", swigMethodTypes3))
swigDelegate3 = new SwigDelegateDDebugCallback_3(SwigDirectorOnDebugFatal);
tinyWRAPPINVOKE.DDebugCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(DDebugCallback));
return hasDerivedMethod;
}
private int SwigDirectorOnDebugInfo(string message) {
return OnDebugInfo(message);
}
private int SwigDirectorOnDebugWarn(string message) {
return OnDebugWarn(message);
}
private int SwigDirectorOnDebugError(string message) {
return OnDebugError(message);
}
private int SwigDirectorOnDebugFatal(string message) {
return OnDebugFatal(message);
}
public delegate int SwigDelegateDDebugCallback_0(string message);
public delegate int SwigDelegateDDebugCallback_1(string message);
public delegate int SwigDelegateDDebugCallback_2(string message);
public delegate int SwigDelegateDDebugCallback_3(string message);
private SwigDelegateDDebugCallback_0 swigDelegate0;
private SwigDelegateDDebugCallback_1 swigDelegate1;
private SwigDelegateDDebugCallback_2 swigDelegate2;
private SwigDelegateDDebugCallback_3 swigDelegate3;
private static Type[] swigMethodTypes0 = new Type[] { typeof(string) };
private static Type[] swigMethodTypes1 = new Type[] { typeof(string) };
private static Type[] swigMethodTypes2 = new Type[] { typeof(string) };
private static Type[] swigMethodTypes3 = new Type[] { typeof(string) };
}
}

View File

@ -0,0 +1,45 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class DialogEvent : SipEvent {
private HandleRef swigCPtr;
internal DialogEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.DialogEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(DialogEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~DialogEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_DialogEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
}
}

View File

@ -0,0 +1,73 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class InviteEvent : SipEvent {
private HandleRef swigCPtr;
internal InviteEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.InviteEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(InviteEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~InviteEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_InviteEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public tsip_invite_event_type_t getType() {
tsip_invite_event_type_t ret = (tsip_invite_event_type_t)tinyWRAPPINVOKE.InviteEvent_getType(swigCPtr);
return ret;
}
public twrap_media_type_t getMediaType() {
twrap_media_type_t ret = (twrap_media_type_t)tinyWRAPPINVOKE.InviteEvent_getMediaType(swigCPtr);
return ret;
}
public InviteSession getSession() {
IntPtr cPtr = tinyWRAPPINVOKE.InviteEvent_getSession(swigCPtr);
InviteSession ret = (cPtr == IntPtr.Zero) ? null : new InviteSession(cPtr, false);
return ret;
}
public CallSession takeCallSessionOwnership() {
IntPtr cPtr = tinyWRAPPINVOKE.InviteEvent_takeCallSessionOwnership(swigCPtr);
CallSession ret = (cPtr == IntPtr.Zero) ? null : new CallSession(cPtr, true);
return ret;
}
public MsrpSession takeMsrpSessionOwnership() {
IntPtr cPtr = tinyWRAPPINVOKE.InviteEvent_takeMsrpSessionOwnership(swigCPtr);
MsrpSession ret = (cPtr == IntPtr.Zero) ? null : new MsrpSession(cPtr, true);
return ret;
}
}
}

View File

@ -0,0 +1,84 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class InviteSession : SipSession {
private HandleRef swigCPtr;
internal InviteSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.InviteSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(InviteSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~InviteSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_InviteSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public InviteSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_InviteSession(SipStack.getCPtr(Stack)), true) {
}
public bool accept(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.InviteSession_accept__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool accept() {
bool ret = tinyWRAPPINVOKE.InviteSession_accept__SWIG_1(swigCPtr);
return ret;
}
public bool hangup(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.InviteSession_hangup__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool hangup() {
bool ret = tinyWRAPPINVOKE.InviteSession_hangup__SWIG_1(swigCPtr);
return ret;
}
public bool reject(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.InviteSession_reject__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool reject() {
bool ret = tinyWRAPPINVOKE.InviteSession_reject__SWIG_1(swigCPtr);
return ret;
}
public MediaSessionMgr getMediaMgr() {
IntPtr cPtr = tinyWRAPPINVOKE.InviteSession_getMediaMgr(swigCPtr);
MediaSessionMgr ret = (cPtr == IntPtr.Zero) ? null : new MediaSessionMgr(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,93 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MediaContent : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal MediaContent(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MediaContent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MediaContent() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MediaContent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public byte[] getPayload() {
uint clen = this.getPayloadLength();
if(clen>0){
byte[] bytes = new byte[clen];
this.getPayload(bytes, clen);
return bytes;
}
return null;
}
public string getType() {
string ret = tinyWRAPPINVOKE.MediaContent_getType(swigCPtr);
return ret;
}
public virtual uint getDataLength() {
uint ret = tinyWRAPPINVOKE.MediaContent_getDataLength(swigCPtr);
return ret;
}
public virtual uint getData(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.MediaContent_getData(swigCPtr, output, maxsize);
return ret;
}
public static MediaContent parse(byte[] data, uint size, string type) {
IntPtr cPtr = tinyWRAPPINVOKE.MediaContent_parse__SWIG_0(data, size, type);
MediaContent ret = (cPtr == IntPtr.Zero) ? null : new MediaContent(cPtr, true);
return ret;
}
public static MediaContentCPIM parse(byte[] data, uint size) {
IntPtr cPtr = tinyWRAPPINVOKE.MediaContent_parse__SWIG_1(data, size);
MediaContentCPIM ret = (cPtr == IntPtr.Zero) ? null : new MediaContentCPIM(cPtr, true);
return ret;
}
public virtual uint getPayloadLength() {
uint ret = tinyWRAPPINVOKE.MediaContent_getPayloadLength(swigCPtr);
return ret;
}
public virtual uint getPayload(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.MediaContent_getPayload(swigCPtr, output, maxsize);
return ret;
}
}
}

View File

@ -0,0 +1,60 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MediaContentCPIM : MediaContent {
private HandleRef swigCPtr;
internal MediaContentCPIM(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.MediaContentCPIM_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MediaContentCPIM obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MediaContentCPIM() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MediaContentCPIM(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public override uint getPayloadLength() {
uint ret = tinyWRAPPINVOKE.MediaContentCPIM_getPayloadLength(swigCPtr);
return ret;
}
public override uint getPayload(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.MediaContentCPIM_getPayload(swigCPtr, output, maxsize);
return ret;
}
public string getHeaderValue(string name) {
string ret = tinyWRAPPINVOKE.MediaContentCPIM_getHeaderValue(swigCPtr, name);
return ret;
}
}
}

View File

@ -0,0 +1,83 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MediaSessionMgr : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal MediaSessionMgr(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MediaSessionMgr obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MediaSessionMgr() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MediaSessionMgr(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public bool sessionSetInt32(twrap_media_type_t media, string key, int value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_sessionSetInt32(swigCPtr, (int)media, key, value);
return ret;
}
public bool consumerSetInt32(twrap_media_type_t media, string key, int value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_consumerSetInt32(swigCPtr, (int)media, key, value);
return ret;
}
public bool consumerSetInt64(twrap_media_type_t media, string key, long value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_consumerSetInt64(swigCPtr, (int)media, key, value);
return ret;
}
public bool producerSetInt32(twrap_media_type_t media, string key, int value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_producerSetInt32(swigCPtr, (int)media, key, value);
return ret;
}
public bool producerSetInt64(twrap_media_type_t media, string key, long value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_producerSetInt64(swigCPtr, (int)media, key, value);
return ret;
}
public ProxyPlugin findProxyPluginConsumer(twrap_media_type_t media) {
IntPtr cPtr = tinyWRAPPINVOKE.MediaSessionMgr_findProxyPluginConsumer(swigCPtr, (int)media);
ProxyPlugin ret = (cPtr == IntPtr.Zero) ? null : new ProxyPlugin(cPtr, false);
return ret;
}
public ProxyPlugin findProxyPluginProducer(twrap_media_type_t media) {
IntPtr cPtr = tinyWRAPPINVOKE.MediaSessionMgr_findProxyPluginProducer(swigCPtr, (int)media);
ProxyPlugin ret = (cPtr == IntPtr.Zero) ? null : new ProxyPlugin(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,62 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MessagingEvent : SipEvent {
private HandleRef swigCPtr;
internal MessagingEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.MessagingEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MessagingEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MessagingEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MessagingEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public tsip_message_event_type_t getType() {
tsip_message_event_type_t ret = (tsip_message_event_type_t)tinyWRAPPINVOKE.MessagingEvent_getType(swigCPtr);
return ret;
}
public MessagingSession getSession() {
IntPtr cPtr = tinyWRAPPINVOKE.MessagingEvent_getSession(swigCPtr);
MessagingSession ret = (cPtr == IntPtr.Zero) ? null : new MessagingSession(cPtr, false);
return ret;
}
public MessagingSession takeSessionOwnership() {
IntPtr cPtr = tinyWRAPPINVOKE.MessagingEvent_takeSessionOwnership(swigCPtr);
MessagingSession ret = (cPtr == IntPtr.Zero) ? null : new MessagingSession(cPtr, true);
return ret;
}
}
}

View File

@ -0,0 +1,63 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MessagingSession : SipSession {
private HandleRef swigCPtr;
internal MessagingSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.MessagingSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MessagingSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MessagingSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MessagingSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public MessagingSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_MessagingSession(SipStack.getCPtr(Stack)), true) {
}
public bool send(byte[] payload, uint len) {
bool ret = tinyWRAPPINVOKE.MessagingSession_send(swigCPtr, payload, len);
return ret;
}
public bool accept() {
bool ret = tinyWRAPPINVOKE.MessagingSession_accept(swigCPtr);
return ret;
}
public bool reject() {
bool ret = tinyWRAPPINVOKE.MessagingSession_reject(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,76 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MsrpCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal MsrpCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MsrpCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MsrpCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MsrpCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public MsrpCallback() : this(tinyWRAPPINVOKE.new_MsrpCallback(), true) {
SwigDirectorConnect();
}
public virtual int OnEvent(MsrpEvent e) {
int ret = (SwigDerivedClassHasMethod("OnEvent", swigMethodTypes0) ? tinyWRAPPINVOKE.MsrpCallback_OnEventSwigExplicitMsrpCallback(swigCPtr, MsrpEvent.getCPtr(e)) : tinyWRAPPINVOKE.MsrpCallback_OnEvent(swigCPtr, MsrpEvent.getCPtr(e)));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("OnEvent", swigMethodTypes0))
swigDelegate0 = new SwigDelegateMsrpCallback_0(SwigDirectorOnEvent);
tinyWRAPPINVOKE.MsrpCallback_director_connect(swigCPtr, swigDelegate0);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(MsrpCallback));
return hasDerivedMethod;
}
private int SwigDirectorOnEvent(IntPtr e) {
return OnEvent((e == IntPtr.Zero) ? null : new MsrpEvent(e, false));
}
public delegate int SwigDelegateMsrpCallback_0(IntPtr e);
private SwigDelegateMsrpCallback_0 swigDelegate0;
private static Type[] swigMethodTypes0 = new Type[] { typeof(MsrpEvent) };
}
}

View File

@ -0,0 +1,63 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MsrpEvent : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal MsrpEvent(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MsrpEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MsrpEvent() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MsrpEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public tmsrp_event_type_t getType() {
tmsrp_event_type_t ret = (tmsrp_event_type_t)tinyWRAPPINVOKE.MsrpEvent_getType(swigCPtr);
return ret;
}
public MsrpSession getSipSession() {
IntPtr cPtr = tinyWRAPPINVOKE.MsrpEvent_getSipSession(swigCPtr);
MsrpSession ret = (cPtr == IntPtr.Zero) ? null : new MsrpSession(cPtr, false);
return ret;
}
public MsrpMessage getMessage() {
IntPtr cPtr = tinyWRAPPINVOKE.MsrpEvent_getMessage(swigCPtr);
MsrpMessage ret = (cPtr == IntPtr.Zero) ? null : new MsrpMessage(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,103 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MsrpMessage : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal MsrpMessage(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MsrpMessage obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MsrpMessage() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MsrpMessage(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public MsrpMessage() : this(tinyWRAPPINVOKE.new_MsrpMessage(), true) {
}
public bool isRequest() {
bool ret = tinyWRAPPINVOKE.MsrpMessage_isRequest(swigCPtr);
return ret;
}
public short getCode() {
short ret = tinyWRAPPINVOKE.MsrpMessage_getCode(swigCPtr);
return ret;
}
public string getPhrase() {
string ret = tinyWRAPPINVOKE.MsrpMessage_getPhrase(swigCPtr);
return ret;
}
public tmsrp_request_type_t getRequestType() {
tmsrp_request_type_t ret = (tmsrp_request_type_t)tinyWRAPPINVOKE.MsrpMessage_getRequestType(swigCPtr);
return ret;
}
public void getByteRange(out long arg0, out long arg1, out long arg2) {
tinyWRAPPINVOKE.MsrpMessage_getByteRange(swigCPtr, out arg0, out arg1, out arg2);
}
public bool isLastChunck() {
bool ret = tinyWRAPPINVOKE.MsrpMessage_isLastChunck(swigCPtr);
return ret;
}
public bool isFirstChunck() {
bool ret = tinyWRAPPINVOKE.MsrpMessage_isFirstChunck(swigCPtr);
return ret;
}
public string getMsrpHeaderValue(string name) {
string ret = tinyWRAPPINVOKE.MsrpMessage_getMsrpHeaderValue(swigCPtr, name);
return ret;
}
public string getMsrpHeaderParamValue(string name, string param) {
string ret = tinyWRAPPINVOKE.MsrpMessage_getMsrpHeaderParamValue(swigCPtr, name, param);
return ret;
}
public uint getMsrpContentLength() {
uint ret = tinyWRAPPINVOKE.MsrpMessage_getMsrpContentLength(swigCPtr);
return ret;
}
public uint getMsrpContent(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.MsrpMessage_getMsrpContent(swigCPtr, output, maxsize);
return ret;
}
}
}

View File

@ -0,0 +1,83 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class MsrpSession : InviteSession {
private HandleRef swigCPtr;
internal MsrpSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.MsrpSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(MsrpSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~MsrpSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_MsrpSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public MsrpSession(SipStack Stack, MsrpCallback callback) : this(tinyWRAPPINVOKE.new_MsrpSession(SipStack.getCPtr(Stack), MsrpCallback.getCPtr(callback)), true) {
}
public bool setCallback(MsrpCallback callback) {
bool ret = tinyWRAPPINVOKE.MsrpSession_setCallback(swigCPtr, MsrpCallback.getCPtr(callback));
return ret;
}
public bool callMsrp(string remoteUri, ActionConfig config) {
bool ret = tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_0(swigCPtr, remoteUri, ActionConfig.getCPtr(config));
return ret;
}
public bool callMsrp(string remoteUri) {
bool ret = tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_1(swigCPtr, remoteUri);
return ret;
}
public bool sendMessage(byte[] payload, uint len, ActionConfig config) {
bool ret = tinyWRAPPINVOKE.MsrpSession_sendMessage__SWIG_0(swigCPtr, payload, len, ActionConfig.getCPtr(config));
return ret;
}
public bool sendMessage(byte[] payload, uint len) {
bool ret = tinyWRAPPINVOKE.MsrpSession_sendMessage__SWIG_1(swigCPtr, payload, len);
return ret;
}
public bool sendFile(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.MsrpSession_sendFile__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool sendFile() {
bool ret = tinyWRAPPINVOKE.MsrpSession_sendFile__SWIG_1(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,62 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class OptionsEvent : SipEvent {
private HandleRef swigCPtr;
internal OptionsEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.OptionsEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(OptionsEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~OptionsEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_OptionsEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public tsip_options_event_type_t getType() {
tsip_options_event_type_t ret = (tsip_options_event_type_t)tinyWRAPPINVOKE.OptionsEvent_getType(swigCPtr);
return ret;
}
public OptionsSession getSession() {
IntPtr cPtr = tinyWRAPPINVOKE.OptionsEvent_getSession(swigCPtr);
OptionsSession ret = (cPtr == IntPtr.Zero) ? null : new OptionsSession(cPtr, false);
return ret;
}
public OptionsSession takeSessionOwnership() {
IntPtr cPtr = tinyWRAPPINVOKE.OptionsEvent_takeSessionOwnership(swigCPtr);
OptionsSession ret = (cPtr == IntPtr.Zero) ? null : new OptionsSession(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,78 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class OptionsSession : SipSession {
private HandleRef swigCPtr;
internal OptionsSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.OptionsSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(OptionsSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~OptionsSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_OptionsSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public OptionsSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_OptionsSession(SipStack.getCPtr(Stack)), true) {
}
public bool send(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.OptionsSession_send__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool send() {
bool ret = tinyWRAPPINVOKE.OptionsSession_send__SWIG_1(swigCPtr);
return ret;
}
public bool accept(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.OptionsSession_accept__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool accept() {
bool ret = tinyWRAPPINVOKE.OptionsSession_accept__SWIG_1(swigCPtr);
return ret;
}
public bool reject(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.OptionsSession_reject__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool reject() {
bool ret = tinyWRAPPINVOKE.OptionsSession_reject__SWIG_1(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,99 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyAudioConsumer : ProxyPlugin {
private HandleRef swigCPtr;
internal ProxyAudioConsumer(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.ProxyAudioConsumer_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyAudioConsumer obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyAudioConsumer() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyAudioConsumer(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public bool queryForResampler(ushort nInFreq, ushort nOutFreq, ushort nFrameDuration, ushort nChannels, ushort nResamplerQuality) {
bool ret = tinyWRAPPINVOKE.ProxyAudioConsumer_queryForResampler(swigCPtr, nInFreq, nOutFreq, nFrameDuration, nChannels, nResamplerQuality);
return ret;
}
public bool setPullBuffer(byte[] pPullBufferPtr, uint nPullBufferSize) {
bool ret = tinyWRAPPINVOKE.ProxyAudioConsumer_setPullBuffer(swigCPtr, pPullBufferPtr, nPullBufferSize);
return ret;
}
public uint pull(byte[] pOutput, uint nSize) {
uint ret = tinyWRAPPINVOKE.ProxyAudioConsumer_pull__SWIG_0(swigCPtr, pOutput, nSize);
return ret;
}
public uint pull(byte[] pOutput) {
uint ret = tinyWRAPPINVOKE.ProxyAudioConsumer_pull__SWIG_1(swigCPtr, pOutput);
return ret;
}
public uint pull() {
uint ret = tinyWRAPPINVOKE.ProxyAudioConsumer_pull__SWIG_2(swigCPtr);
return ret;
}
public bool setGain(uint nGain) {
bool ret = tinyWRAPPINVOKE.ProxyAudioConsumer_setGain(swigCPtr, nGain);
return ret;
}
public uint getGain() {
uint ret = tinyWRAPPINVOKE.ProxyAudioConsumer_getGain(swigCPtr);
return ret;
}
public bool reset() {
bool ret = tinyWRAPPINVOKE.ProxyAudioConsumer_reset(swigCPtr);
return ret;
}
public void setCallback(ProxyAudioConsumerCallback pCallback) {
tinyWRAPPINVOKE.ProxyAudioConsumer_setCallback(swigCPtr, ProxyAudioConsumerCallback.getCPtr(pCallback));
}
public virtual ulong getMediaSessionId() {
ulong ret = tinyWRAPPINVOKE.ProxyAudioConsumer_getMediaSessionId(swigCPtr);
return ret;
}
public static bool registerPlugin() {
bool ret = tinyWRAPPINVOKE.ProxyAudioConsumer_registerPlugin();
return ret;
}
}
}

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyAudioConsumerCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyAudioConsumerCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyAudioConsumerCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyAudioConsumerCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyAudioConsumerCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ProxyAudioConsumerCallback() : this(tinyWRAPPINVOKE.new_ProxyAudioConsumerCallback(), true) {
SwigDirectorConnect();
}
public virtual int prepare(int ptime, int rate, int channels) {
int ret = (SwigDerivedClassHasMethod("prepare", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_prepareSwigExplicitProxyAudioConsumerCallback(swigCPtr, ptime, rate, channels) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_prepare(swigCPtr, ptime, rate, channels));
return ret;
}
public virtual int start() {
int ret = (SwigDerivedClassHasMethod("start", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_startSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_start(swigCPtr));
return ret;
}
public virtual int pause() {
int ret = (SwigDerivedClassHasMethod("pause", swigMethodTypes2) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_pauseSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_pause(swigCPtr));
return ret;
}
public virtual int stop() {
int ret = (SwigDerivedClassHasMethod("stop", swigMethodTypes3) ? tinyWRAPPINVOKE.ProxyAudioConsumerCallback_stopSwigExplicitProxyAudioConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioConsumerCallback_stop(swigCPtr));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("prepare", swigMethodTypes0))
swigDelegate0 = new SwigDelegateProxyAudioConsumerCallback_0(SwigDirectorprepare);
if (SwigDerivedClassHasMethod("start", swigMethodTypes1))
swigDelegate1 = new SwigDelegateProxyAudioConsumerCallback_1(SwigDirectorstart);
if (SwigDerivedClassHasMethod("pause", swigMethodTypes2))
swigDelegate2 = new SwigDelegateProxyAudioConsumerCallback_2(SwigDirectorpause);
if (SwigDerivedClassHasMethod("stop", swigMethodTypes3))
swigDelegate3 = new SwigDelegateProxyAudioConsumerCallback_3(SwigDirectorstop);
tinyWRAPPINVOKE.ProxyAudioConsumerCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyAudioConsumerCallback));
return hasDerivedMethod;
}
private int SwigDirectorprepare(int ptime, int rate, int channels) {
return prepare(ptime, rate, channels);
}
private int SwigDirectorstart() {
return start();
}
private int SwigDirectorpause() {
return pause();
}
private int SwigDirectorstop() {
return stop();
}
public delegate int SwigDelegateProxyAudioConsumerCallback_0(int ptime, int rate, int channels);
public delegate int SwigDelegateProxyAudioConsumerCallback_1();
public delegate int SwigDelegateProxyAudioConsumerCallback_2();
public delegate int SwigDelegateProxyAudioConsumerCallback_3();
private SwigDelegateProxyAudioConsumerCallback_0 swigDelegate0;
private SwigDelegateProxyAudioConsumerCallback_1 swigDelegate1;
private SwigDelegateProxyAudioConsumerCallback_2 swigDelegate2;
private SwigDelegateProxyAudioConsumerCallback_3 swigDelegate3;
private static Type[] swigMethodTypes0 = new Type[] { typeof(int), typeof(int), typeof(int) };
private static Type[] swigMethodTypes1 = new Type[] { };
private static Type[] swigMethodTypes2 = new Type[] { };
private static Type[] swigMethodTypes3 = new Type[] { };
}
}

View File

@ -0,0 +1,89 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyAudioProducer : ProxyPlugin {
private HandleRef swigCPtr;
internal ProxyAudioProducer(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.ProxyAudioProducer_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyAudioProducer obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyAudioProducer() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyAudioProducer(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public bool setPushBuffer(byte[] pPushBufferPtr, uint nPushBufferSize) {
bool ret = tinyWRAPPINVOKE.ProxyAudioProducer_setPushBuffer(swigCPtr, pPushBufferPtr, nPushBufferSize);
return ret;
}
public int push(byte[] pBuffer, uint nSize) {
int ret = tinyWRAPPINVOKE.ProxyAudioProducer_push__SWIG_0(swigCPtr, pBuffer, nSize);
return ret;
}
public int push(byte[] pBuffer) {
int ret = tinyWRAPPINVOKE.ProxyAudioProducer_push__SWIG_1(swigCPtr, pBuffer);
return ret;
}
public int push() {
int ret = tinyWRAPPINVOKE.ProxyAudioProducer_push__SWIG_2(swigCPtr);
return ret;
}
public bool setGain(uint nGain) {
bool ret = tinyWRAPPINVOKE.ProxyAudioProducer_setGain(swigCPtr, nGain);
return ret;
}
public uint getGain() {
uint ret = tinyWRAPPINVOKE.ProxyAudioProducer_getGain(swigCPtr);
return ret;
}
public void setCallback(ProxyAudioProducerCallback pCallback) {
tinyWRAPPINVOKE.ProxyAudioProducer_setCallback(swigCPtr, ProxyAudioProducerCallback.getCPtr(pCallback));
}
public virtual ulong getMediaSessionId() {
ulong ret = tinyWRAPPINVOKE.ProxyAudioProducer_getMediaSessionId(swigCPtr);
return ret;
}
public static bool registerPlugin() {
bool ret = tinyWRAPPINVOKE.ProxyAudioProducer_registerPlugin();
return ret;
}
}
}

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyAudioProducerCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyAudioProducerCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyAudioProducerCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyAudioProducerCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyAudioProducerCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ProxyAudioProducerCallback() : this(tinyWRAPPINVOKE.new_ProxyAudioProducerCallback(), true) {
SwigDirectorConnect();
}
public virtual int prepare(int ptime, int rate, int channels) {
int ret = (SwigDerivedClassHasMethod("prepare", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyAudioProducerCallback_prepareSwigExplicitProxyAudioProducerCallback(swigCPtr, ptime, rate, channels) : tinyWRAPPINVOKE.ProxyAudioProducerCallback_prepare(swigCPtr, ptime, rate, channels));
return ret;
}
public virtual int start() {
int ret = (SwigDerivedClassHasMethod("start", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyAudioProducerCallback_startSwigExplicitProxyAudioProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioProducerCallback_start(swigCPtr));
return ret;
}
public virtual int pause() {
int ret = (SwigDerivedClassHasMethod("pause", swigMethodTypes2) ? tinyWRAPPINVOKE.ProxyAudioProducerCallback_pauseSwigExplicitProxyAudioProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioProducerCallback_pause(swigCPtr));
return ret;
}
public virtual int stop() {
int ret = (SwigDerivedClassHasMethod("stop", swigMethodTypes3) ? tinyWRAPPINVOKE.ProxyAudioProducerCallback_stopSwigExplicitProxyAudioProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyAudioProducerCallback_stop(swigCPtr));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("prepare", swigMethodTypes0))
swigDelegate0 = new SwigDelegateProxyAudioProducerCallback_0(SwigDirectorprepare);
if (SwigDerivedClassHasMethod("start", swigMethodTypes1))
swigDelegate1 = new SwigDelegateProxyAudioProducerCallback_1(SwigDirectorstart);
if (SwigDerivedClassHasMethod("pause", swigMethodTypes2))
swigDelegate2 = new SwigDelegateProxyAudioProducerCallback_2(SwigDirectorpause);
if (SwigDerivedClassHasMethod("stop", swigMethodTypes3))
swigDelegate3 = new SwigDelegateProxyAudioProducerCallback_3(SwigDirectorstop);
tinyWRAPPINVOKE.ProxyAudioProducerCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyAudioProducerCallback));
return hasDerivedMethod;
}
private int SwigDirectorprepare(int ptime, int rate, int channels) {
return prepare(ptime, rate, channels);
}
private int SwigDirectorstart() {
return start();
}
private int SwigDirectorpause() {
return pause();
}
private int SwigDirectorstop() {
return stop();
}
public delegate int SwigDelegateProxyAudioProducerCallback_0(int ptime, int rate, int channels);
public delegate int SwigDelegateProxyAudioProducerCallback_1();
public delegate int SwigDelegateProxyAudioProducerCallback_2();
public delegate int SwigDelegateProxyAudioProducerCallback_3();
private SwigDelegateProxyAudioProducerCallback_0 swigDelegate0;
private SwigDelegateProxyAudioProducerCallback_1 swigDelegate1;
private SwigDelegateProxyAudioProducerCallback_2 swigDelegate2;
private SwigDelegateProxyAudioProducerCallback_3 swigDelegate3;
private static Type[] swigMethodTypes0 = new Type[] { typeof(int), typeof(int), typeof(int) };
private static Type[] swigMethodTypes1 = new Type[] { };
private static Type[] swigMethodTypes2 = new Type[] { };
private static Type[] swigMethodTypes3 = new Type[] { };
}
}

View File

@ -0,0 +1,56 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyPlugin : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyPlugin(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyPlugin obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyPlugin() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyPlugin(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public twrap_proxy_plugin_type_t getType() {
twrap_proxy_plugin_type_t ret = (twrap_proxy_plugin_type_t)tinyWRAPPINVOKE.ProxyPlugin_getType(swigCPtr);
return ret;
}
public ulong getId() {
ulong ret = tinyWRAPPINVOKE.ProxyPlugin_getId(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,82 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyPluginMgr : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyPluginMgr(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyPluginMgr obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyPluginMgr() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyPluginMgr(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public static ProxyPluginMgr createInstance(ProxyPluginMgrCallback callback) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_createInstance(ProxyPluginMgrCallback.getCPtr(callback));
ProxyPluginMgr ret = (cPtr == IntPtr.Zero) ? null : new ProxyPluginMgr(cPtr, true);
return ret;
}
public static ProxyPluginMgr getInstance() {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_getInstance();
ProxyPluginMgr ret = (cPtr == IntPtr.Zero) ? null : new ProxyPluginMgr(cPtr, false);
return ret;
}
public ProxyAudioConsumer findAudioConsumer(ulong id) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_findAudioConsumer(swigCPtr, id);
ProxyAudioConsumer ret = (cPtr == IntPtr.Zero) ? null : new ProxyAudioConsumer(cPtr, false);
return ret;
}
public ProxyVideoConsumer findVideoConsumer(ulong id) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_findVideoConsumer(swigCPtr, id);
ProxyVideoConsumer ret = (cPtr == IntPtr.Zero) ? null : new ProxyVideoConsumer(cPtr, false);
return ret;
}
public ProxyAudioProducer findAudioProducer(ulong id) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_findAudioProducer(swigCPtr, id);
ProxyAudioProducer ret = (cPtr == IntPtr.Zero) ? null : new ProxyAudioProducer(cPtr, false);
return ret;
}
public ProxyVideoProducer findVideoProducer(ulong id) {
IntPtr cPtr = tinyWRAPPINVOKE.ProxyPluginMgr_findVideoProducer(swigCPtr, id);
ProxyVideoProducer ret = (cPtr == IntPtr.Zero) ? null : new ProxyVideoProducer(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,90 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyPluginMgrCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyPluginMgrCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyPluginMgrCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyPluginMgrCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyPluginMgrCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ProxyPluginMgrCallback() : this(tinyWRAPPINVOKE.new_ProxyPluginMgrCallback(), true) {
SwigDirectorConnect();
}
public virtual int OnPluginCreated(ulong id, twrap_proxy_plugin_type_t type) {
int ret = (SwigDerivedClassHasMethod("OnPluginCreated", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginCreatedSwigExplicitProxyPluginMgrCallback(swigCPtr, id, (int)type) : tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginCreated(swigCPtr, id, (int)type));
return ret;
}
public virtual int OnPluginDestroyed(ulong id, twrap_proxy_plugin_type_t type) {
int ret = (SwigDerivedClassHasMethod("OnPluginDestroyed", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginDestroyedSwigExplicitProxyPluginMgrCallback(swigCPtr, id, (int)type) : tinyWRAPPINVOKE.ProxyPluginMgrCallback_OnPluginDestroyed(swigCPtr, id, (int)type));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("OnPluginCreated", swigMethodTypes0))
swigDelegate0 = new SwigDelegateProxyPluginMgrCallback_0(SwigDirectorOnPluginCreated);
if (SwigDerivedClassHasMethod("OnPluginDestroyed", swigMethodTypes1))
swigDelegate1 = new SwigDelegateProxyPluginMgrCallback_1(SwigDirectorOnPluginDestroyed);
tinyWRAPPINVOKE.ProxyPluginMgrCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyPluginMgrCallback));
return hasDerivedMethod;
}
private int SwigDirectorOnPluginCreated(ulong id, int type) {
return OnPluginCreated(id, (twrap_proxy_plugin_type_t)type);
}
private int SwigDirectorOnPluginDestroyed(ulong id, int type) {
return OnPluginDestroyed(id, (twrap_proxy_plugin_type_t)type);
}
public delegate int SwigDelegateProxyPluginMgrCallback_0(ulong id, int type);
public delegate int SwigDelegateProxyPluginMgrCallback_1(ulong id, int type);
private SwigDelegateProxyPluginMgrCallback_0 swigDelegate0;
private SwigDelegateProxyPluginMgrCallback_1 swigDelegate1;
private static Type[] swigMethodTypes0 = new Type[] { typeof(ulong), typeof(twrap_proxy_plugin_type_t) };
private static Type[] swigMethodTypes1 = new Type[] { typeof(ulong), typeof(twrap_proxy_plugin_type_t) };
}
}

View File

@ -0,0 +1,97 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyVideoConsumer : ProxyPlugin {
private HandleRef swigCPtr;
internal ProxyVideoConsumer(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.ProxyVideoConsumer_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyVideoConsumer obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyVideoConsumer() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyVideoConsumer(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public bool setDisplaySize(uint nWidth, uint nHeight) {
bool ret = tinyWRAPPINVOKE.ProxyVideoConsumer_setDisplaySize(swigCPtr, nWidth, nHeight);
return ret;
}
public uint getDisplayWidth() {
uint ret = tinyWRAPPINVOKE.ProxyVideoConsumer_getDisplayWidth(swigCPtr);
return ret;
}
public uint getDisplayHeight() {
uint ret = tinyWRAPPINVOKE.ProxyVideoConsumer_getDisplayHeight(swigCPtr);
return ret;
}
public void setCallback(ProxyVideoConsumerCallback pCallback) {
tinyWRAPPINVOKE.ProxyVideoConsumer_setCallback(swigCPtr, ProxyVideoConsumerCallback.getCPtr(pCallback));
}
public bool setAutoResizeDisplay(bool bAutoResizeDisplay) {
bool ret = tinyWRAPPINVOKE.ProxyVideoConsumer_setAutoResizeDisplay(swigCPtr, bAutoResizeDisplay);
return ret;
}
public bool getAutoResizeDisplay() {
bool ret = tinyWRAPPINVOKE.ProxyVideoConsumer_getAutoResizeDisplay(swigCPtr);
return ret;
}
public bool setConsumeBuffer(byte[] pConsumeBufferPtr, uint nConsumeBufferSize) {
bool ret = tinyWRAPPINVOKE.ProxyVideoConsumer_setConsumeBuffer(swigCPtr, pConsumeBufferPtr, nConsumeBufferSize);
return ret;
}
public virtual ulong getMediaSessionId() {
ulong ret = tinyWRAPPINVOKE.ProxyVideoConsumer_getMediaSessionId(swigCPtr);
return ret;
}
public static bool registerPlugin() {
bool ret = tinyWRAPPINVOKE.ProxyVideoConsumer_registerPlugin();
return ret;
}
public static void setDefaultChroma(tmedia_chroma_t eChroma) {
tinyWRAPPINVOKE.ProxyVideoConsumer_setDefaultChroma((int)eChroma);
}
public static void setDefaultAutoResizeDisplay(bool bAutoResizeDisplay) {
tinyWRAPPINVOKE.ProxyVideoConsumer_setDefaultAutoResizeDisplay(bAutoResizeDisplay);
}
}
}

View File

@ -0,0 +1,146 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyVideoConsumerCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyVideoConsumerCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyVideoConsumerCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyVideoConsumerCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyVideoConsumerCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ProxyVideoConsumerCallback() : this(tinyWRAPPINVOKE.new_ProxyVideoConsumerCallback(), true) {
SwigDirectorConnect();
}
public virtual int prepare(int nWidth, int nHeight, int nFps) {
int ret = (SwigDerivedClassHasMethod("prepare", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_prepareSwigExplicitProxyVideoConsumerCallback(swigCPtr, nWidth, nHeight, nFps) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_prepare(swigCPtr, nWidth, nHeight, nFps));
return ret;
}
public virtual int consume(ProxyVideoFrame frame) {
int ret = (SwigDerivedClassHasMethod("consume", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_consumeSwigExplicitProxyVideoConsumerCallback(swigCPtr, ProxyVideoFrame.getCPtr(frame)) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_consume(swigCPtr, ProxyVideoFrame.getCPtr(frame)));
return ret;
}
public virtual int bufferCopied(uint nCopiedSize, uint nAvailableSize) {
int ret = (SwigDerivedClassHasMethod("bufferCopied", swigMethodTypes2) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_bufferCopiedSwigExplicitProxyVideoConsumerCallback(swigCPtr, nCopiedSize, nAvailableSize) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_bufferCopied(swigCPtr, nCopiedSize, nAvailableSize));
return ret;
}
public virtual int start() {
int ret = (SwigDerivedClassHasMethod("start", swigMethodTypes3) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_startSwigExplicitProxyVideoConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_start(swigCPtr));
return ret;
}
public virtual int pause() {
int ret = (SwigDerivedClassHasMethod("pause", swigMethodTypes4) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_pauseSwigExplicitProxyVideoConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_pause(swigCPtr));
return ret;
}
public virtual int stop() {
int ret = (SwigDerivedClassHasMethod("stop", swigMethodTypes5) ? tinyWRAPPINVOKE.ProxyVideoConsumerCallback_stopSwigExplicitProxyVideoConsumerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoConsumerCallback_stop(swigCPtr));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("prepare", swigMethodTypes0))
swigDelegate0 = new SwigDelegateProxyVideoConsumerCallback_0(SwigDirectorprepare);
if (SwigDerivedClassHasMethod("consume", swigMethodTypes1))
swigDelegate1 = new SwigDelegateProxyVideoConsumerCallback_1(SwigDirectorconsume);
if (SwigDerivedClassHasMethod("bufferCopied", swigMethodTypes2))
swigDelegate2 = new SwigDelegateProxyVideoConsumerCallback_2(SwigDirectorbufferCopied);
if (SwigDerivedClassHasMethod("start", swigMethodTypes3))
swigDelegate3 = new SwigDelegateProxyVideoConsumerCallback_3(SwigDirectorstart);
if (SwigDerivedClassHasMethod("pause", swigMethodTypes4))
swigDelegate4 = new SwigDelegateProxyVideoConsumerCallback_4(SwigDirectorpause);
if (SwigDerivedClassHasMethod("stop", swigMethodTypes5))
swigDelegate5 = new SwigDelegateProxyVideoConsumerCallback_5(SwigDirectorstop);
tinyWRAPPINVOKE.ProxyVideoConsumerCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyVideoConsumerCallback));
return hasDerivedMethod;
}
private int SwigDirectorprepare(int nWidth, int nHeight, int nFps) {
return prepare(nWidth, nHeight, nFps);
}
private int SwigDirectorconsume(IntPtr frame) {
return consume((frame == IntPtr.Zero) ? null : new ProxyVideoFrame(frame, false));
}
private int SwigDirectorbufferCopied(uint nCopiedSize, uint nAvailableSize) {
return bufferCopied(nCopiedSize, nAvailableSize);
}
private int SwigDirectorstart() {
return start();
}
private int SwigDirectorpause() {
return pause();
}
private int SwigDirectorstop() {
return stop();
}
public delegate int SwigDelegateProxyVideoConsumerCallback_0(int nWidth, int nHeight, int nFps);
public delegate int SwigDelegateProxyVideoConsumerCallback_1(IntPtr frame);
public delegate int SwigDelegateProxyVideoConsumerCallback_2(uint nCopiedSize, uint nAvailableSize);
public delegate int SwigDelegateProxyVideoConsumerCallback_3();
public delegate int SwigDelegateProxyVideoConsumerCallback_4();
public delegate int SwigDelegateProxyVideoConsumerCallback_5();
private SwigDelegateProxyVideoConsumerCallback_0 swigDelegate0;
private SwigDelegateProxyVideoConsumerCallback_1 swigDelegate1;
private SwigDelegateProxyVideoConsumerCallback_2 swigDelegate2;
private SwigDelegateProxyVideoConsumerCallback_3 swigDelegate3;
private SwigDelegateProxyVideoConsumerCallback_4 swigDelegate4;
private SwigDelegateProxyVideoConsumerCallback_5 swigDelegate5;
private static Type[] swigMethodTypes0 = new Type[] { typeof(int), typeof(int), typeof(int) };
private static Type[] swigMethodTypes1 = new Type[] { typeof(ProxyVideoFrame) };
private static Type[] swigMethodTypes2 = new Type[] { typeof(uint), typeof(uint) };
private static Type[] swigMethodTypes3 = new Type[] { };
private static Type[] swigMethodTypes4 = new Type[] { };
private static Type[] swigMethodTypes5 = new Type[] { };
}
}

View File

@ -0,0 +1,56 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyVideoFrame : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyVideoFrame(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyVideoFrame obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyVideoFrame() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyVideoFrame(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public uint getSize() {
uint ret = tinyWRAPPINVOKE.ProxyVideoFrame_getSize(swigCPtr);
return ret;
}
public uint getContent(byte[] pOutput, uint nMaxsize) {
uint ret = tinyWRAPPINVOKE.ProxyVideoFrame_getContent(swigCPtr, pOutput, nMaxsize);
return ret;
}
}
}

View File

@ -0,0 +1,82 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyVideoProducer : ProxyPlugin {
private HandleRef swigCPtr;
internal ProxyVideoProducer(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.ProxyVideoProducer_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyVideoProducer obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyVideoProducer() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyVideoProducer(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public int getRotation() {
int ret = tinyWRAPPINVOKE.ProxyVideoProducer_getRotation(swigCPtr);
return ret;
}
public void setRotation(int rot) {
tinyWRAPPINVOKE.ProxyVideoProducer_setRotation(swigCPtr, rot);
}
public int push(byte[] buffer, uint size) {
int ret = tinyWRAPPINVOKE.ProxyVideoProducer_push(swigCPtr, buffer, size);
return ret;
}
public int send(byte[] buffer, uint size, uint duration, bool marker) {
int ret = tinyWRAPPINVOKE.ProxyVideoProducer_send(swigCPtr, buffer, size, duration, marker);
return ret;
}
public void setCallback(ProxyVideoProducerCallback _callback) {
tinyWRAPPINVOKE.ProxyVideoProducer_setCallback(swigCPtr, ProxyVideoProducerCallback.getCPtr(_callback));
}
public virtual ulong getMediaSessionId() {
ulong ret = tinyWRAPPINVOKE.ProxyVideoProducer_getMediaSessionId(swigCPtr);
return ret;
}
public static bool registerPlugin() {
bool ret = tinyWRAPPINVOKE.ProxyVideoProducer_registerPlugin();
return ret;
}
public static void setDefaultChroma(tmedia_chroma_t chroma) {
tinyWRAPPINVOKE.ProxyVideoProducer_setDefaultChroma((int)chroma);
}
}
}

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class ProxyVideoProducerCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal ProxyVideoProducerCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(ProxyVideoProducerCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~ProxyVideoProducerCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_ProxyVideoProducerCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public ProxyVideoProducerCallback() : this(tinyWRAPPINVOKE.new_ProxyVideoProducerCallback(), true) {
SwigDirectorConnect();
}
public virtual int prepare(int width, int height, int fps) {
int ret = (SwigDerivedClassHasMethod("prepare", swigMethodTypes0) ? tinyWRAPPINVOKE.ProxyVideoProducerCallback_prepareSwigExplicitProxyVideoProducerCallback(swigCPtr, width, height, fps) : tinyWRAPPINVOKE.ProxyVideoProducerCallback_prepare(swigCPtr, width, height, fps));
return ret;
}
public virtual int start() {
int ret = (SwigDerivedClassHasMethod("start", swigMethodTypes1) ? tinyWRAPPINVOKE.ProxyVideoProducerCallback_startSwigExplicitProxyVideoProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoProducerCallback_start(swigCPtr));
return ret;
}
public virtual int pause() {
int ret = (SwigDerivedClassHasMethod("pause", swigMethodTypes2) ? tinyWRAPPINVOKE.ProxyVideoProducerCallback_pauseSwigExplicitProxyVideoProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoProducerCallback_pause(swigCPtr));
return ret;
}
public virtual int stop() {
int ret = (SwigDerivedClassHasMethod("stop", swigMethodTypes3) ? tinyWRAPPINVOKE.ProxyVideoProducerCallback_stopSwigExplicitProxyVideoProducerCallback(swigCPtr) : tinyWRAPPINVOKE.ProxyVideoProducerCallback_stop(swigCPtr));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("prepare", swigMethodTypes0))
swigDelegate0 = new SwigDelegateProxyVideoProducerCallback_0(SwigDirectorprepare);
if (SwigDerivedClassHasMethod("start", swigMethodTypes1))
swigDelegate1 = new SwigDelegateProxyVideoProducerCallback_1(SwigDirectorstart);
if (SwigDerivedClassHasMethod("pause", swigMethodTypes2))
swigDelegate2 = new SwigDelegateProxyVideoProducerCallback_2(SwigDirectorpause);
if (SwigDerivedClassHasMethod("stop", swigMethodTypes3))
swigDelegate3 = new SwigDelegateProxyVideoProducerCallback_3(SwigDirectorstop);
tinyWRAPPINVOKE.ProxyVideoProducerCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(ProxyVideoProducerCallback));
return hasDerivedMethod;
}
private int SwigDirectorprepare(int width, int height, int fps) {
return prepare(width, height, fps);
}
private int SwigDirectorstart() {
return start();
}
private int SwigDirectorpause() {
return pause();
}
private int SwigDirectorstop() {
return stop();
}
public delegate int SwigDelegateProxyVideoProducerCallback_0(int width, int height, int fps);
public delegate int SwigDelegateProxyVideoProducerCallback_1();
public delegate int SwigDelegateProxyVideoProducerCallback_2();
public delegate int SwigDelegateProxyVideoProducerCallback_3();
private SwigDelegateProxyVideoProducerCallback_0 swigDelegate0;
private SwigDelegateProxyVideoProducerCallback_1 swigDelegate1;
private SwigDelegateProxyVideoProducerCallback_2 swigDelegate2;
private SwigDelegateProxyVideoProducerCallback_3 swigDelegate3;
private static Type[] swigMethodTypes0 = new Type[] { typeof(int), typeof(int), typeof(int) };
private static Type[] swigMethodTypes1 = new Type[] { };
private static Type[] swigMethodTypes2 = new Type[] { };
private static Type[] swigMethodTypes3 = new Type[] { };
}
}

View File

@ -0,0 +1,56 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class PublicationEvent : SipEvent {
private HandleRef swigCPtr;
internal PublicationEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.PublicationEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(PublicationEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~PublicationEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_PublicationEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public tsip_publish_event_type_t getType() {
tsip_publish_event_type_t ret = (tsip_publish_event_type_t)tinyWRAPPINVOKE.PublicationEvent_getType(swigCPtr);
return ret;
}
public PublicationSession getSession() {
IntPtr cPtr = tinyWRAPPINVOKE.PublicationEvent_getSession(swigCPtr);
PublicationSession ret = (cPtr == IntPtr.Zero) ? null : new PublicationSession(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,58 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class PublicationSession : SipSession {
private HandleRef swigCPtr;
internal PublicationSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.PublicationSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(PublicationSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~PublicationSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_PublicationSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public PublicationSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_PublicationSession(SipStack.getCPtr(Stack)), true) {
}
public bool publish(byte[] payload, uint len) {
bool ret = tinyWRAPPINVOKE.PublicationSession_publish(swigCPtr, payload, len);
return ret;
}
public bool unPublish() {
bool ret = tinyWRAPPINVOKE.PublicationSession_unPublish(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,64 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class RPMessage : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal RPMessage(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(RPMessage obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~RPMessage() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_RPMessage(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public RPMessage() : this(tinyWRAPPINVOKE.new_RPMessage(), true) {
}
public twrap_rpmessage_type_t getType() {
twrap_rpmessage_type_t ret = (twrap_rpmessage_type_t)tinyWRAPPINVOKE.RPMessage_getType(swigCPtr);
return ret;
}
public uint getPayloadLength() {
uint ret = tinyWRAPPINVOKE.RPMessage_getPayloadLength(swigCPtr);
return ret;
}
public uint getPayload(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.RPMessage_getPayload(swigCPtr, output, maxsize);
return ret;
}
}
}

View File

@ -0,0 +1,62 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class RegistrationEvent : SipEvent {
private HandleRef swigCPtr;
internal RegistrationEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.RegistrationEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(RegistrationEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~RegistrationEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_RegistrationEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public tsip_register_event_type_t getType() {
tsip_register_event_type_t ret = (tsip_register_event_type_t)tinyWRAPPINVOKE.RegistrationEvent_getType(swigCPtr);
return ret;
}
public RegistrationSession getSession() {
IntPtr cPtr = tinyWRAPPINVOKE.RegistrationEvent_getSession(swigCPtr);
RegistrationSession ret = (cPtr == IntPtr.Zero) ? null : new RegistrationSession(cPtr, false);
return ret;
}
public RegistrationSession takeSessionOwnership() {
IntPtr cPtr = tinyWRAPPINVOKE.RegistrationEvent_takeSessionOwnership(swigCPtr);
RegistrationSession ret = (cPtr == IntPtr.Zero) ? null : new RegistrationSession(cPtr, true);
return ret;
}
}
}

View File

@ -0,0 +1,78 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class RegistrationSession : SipSession {
private HandleRef swigCPtr;
internal RegistrationSession(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.RegistrationSession_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(RegistrationSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~RegistrationSession() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_RegistrationSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public RegistrationSession(SipStack Stack) : this(tinyWRAPPINVOKE.new_RegistrationSession(SipStack.getCPtr(Stack)), true) {
}
public bool register_() {
bool ret = tinyWRAPPINVOKE.RegistrationSession_register_(swigCPtr);
return ret;
}
public bool unRegister() {
bool ret = tinyWRAPPINVOKE.RegistrationSession_unRegister(swigCPtr);
return ret;
}
public bool accept(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.RegistrationSession_accept__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool accept() {
bool ret = tinyWRAPPINVOKE.RegistrationSession_accept__SWIG_1(swigCPtr);
return ret;
}
public bool reject(ActionConfig config) {
bool ret = tinyWRAPPINVOKE.RegistrationSession_reject__SWIG_0(swigCPtr, ActionConfig.getCPtr(config));
return ret;
}
public bool reject() {
bool ret = tinyWRAPPINVOKE.RegistrationSession_reject__SWIG_1(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,79 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SMSData : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SMSData(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SMSData obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SMSData() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SMSData(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SMSData() : this(tinyWRAPPINVOKE.new_SMSData(), true) {
}
public twrap_sms_type_t getType() {
twrap_sms_type_t ret = (twrap_sms_type_t)tinyWRAPPINVOKE.SMSData_getType(swigCPtr);
return ret;
}
public int getMR() {
int ret = tinyWRAPPINVOKE.SMSData_getMR(swigCPtr);
return ret;
}
public uint getPayloadLength() {
uint ret = tinyWRAPPINVOKE.SMSData_getPayloadLength(swigCPtr);
return ret;
}
public uint getPayload(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.SMSData_getPayload(swigCPtr, output, maxsize);
return ret;
}
public string getOA() {
string ret = tinyWRAPPINVOKE.SMSData_getOA(swigCPtr);
return ret;
}
public string getDA() {
string ret = tinyWRAPPINVOKE.SMSData_getDA(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,76 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SMSEncoder : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SMSEncoder(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SMSEncoder obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SMSEncoder() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SMSEncoder(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public static RPMessage encodeSubmit(int mr, string smsc, string destination, string ascii) {
IntPtr cPtr = tinyWRAPPINVOKE.SMSEncoder_encodeSubmit(mr, smsc, destination, ascii);
RPMessage ret = (cPtr == IntPtr.Zero) ? null : new RPMessage(cPtr, true);
return ret;
}
public static RPMessage encodeDeliver(int mr, string smsc, string originator, string ascii) {
IntPtr cPtr = tinyWRAPPINVOKE.SMSEncoder_encodeDeliver(mr, smsc, originator, ascii);
RPMessage ret = (cPtr == IntPtr.Zero) ? null : new RPMessage(cPtr, true);
return ret;
}
public static RPMessage encodeACK(int mr, string smsc, string destination, bool forSUBMIT) {
IntPtr cPtr = tinyWRAPPINVOKE.SMSEncoder_encodeACK(mr, smsc, destination, forSUBMIT);
RPMessage ret = (cPtr == IntPtr.Zero) ? null : new RPMessage(cPtr, true);
return ret;
}
public static RPMessage encodeError(int mr, string smsc, string destination, bool forSUBMIT) {
IntPtr cPtr = tinyWRAPPINVOKE.SMSEncoder_encodeError(mr, smsc, destination, forSUBMIT);
RPMessage ret = (cPtr == IntPtr.Zero) ? null : new RPMessage(cPtr, true);
return ret;
}
public static SMSData decode(byte[] data, uint size, bool MobOrig) {
IntPtr cPtr = tinyWRAPPINVOKE.SMSEncoder_decode(data, size, MobOrig);
SMSData ret = (cPtr == IntPtr.Zero) ? null : new SMSData(cPtr, true);
return ret;
}
}
}

View File

@ -0,0 +1,59 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SafeObject : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SafeObject(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SafeObject obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SafeObject() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SafeObject(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SafeObject() : this(tinyWRAPPINVOKE.new_SafeObject(), true) {
}
public int Lock() {
int ret = tinyWRAPPINVOKE.SafeObject_Lock(swigCPtr);
return ret;
}
public int UnLock() {
int ret = tinyWRAPPINVOKE.SafeObject_UnLock(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,64 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SdpMessage : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SdpMessage(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SdpMessage obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SdpMessage() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SdpMessage(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SdpMessage() : this(tinyWRAPPINVOKE.new_SdpMessage(), true) {
}
public string getSdpHeaderValue(string media, char name, uint index) {
string ret = tinyWRAPPINVOKE.SdpMessage_getSdpHeaderValue__SWIG_0(swigCPtr, media, name, index);
return ret;
}
public string getSdpHeaderValue(string media, char name) {
string ret = tinyWRAPPINVOKE.SdpMessage_getSdpHeaderValue__SWIG_1(swigCPtr, media, name);
return ret;
}
public string getSdpHeaderAValue(string media, string attributeName) {
string ret = tinyWRAPPINVOKE.SdpMessage_getSdpHeaderAValue(swigCPtr, media, attributeName);
return ret;
}
}
}

View File

@ -0,0 +1,174 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipCallback : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SipCallback(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipCallback obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipCallback() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipCallback(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SipCallback() : this(tinyWRAPPINVOKE.new_SipCallback(), true) {
SwigDirectorConnect();
}
public virtual int OnDialogEvent(DialogEvent e) {
int ret = (SwigDerivedClassHasMethod("OnDialogEvent", swigMethodTypes0) ? tinyWRAPPINVOKE.SipCallback_OnDialogEventSwigExplicitSipCallback(swigCPtr, DialogEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnDialogEvent(swigCPtr, DialogEvent.getCPtr(e)));
return ret;
}
public virtual int OnStackEvent(StackEvent e) {
int ret = (SwigDerivedClassHasMethod("OnStackEvent", swigMethodTypes1) ? tinyWRAPPINVOKE.SipCallback_OnStackEventSwigExplicitSipCallback(swigCPtr, StackEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnStackEvent(swigCPtr, StackEvent.getCPtr(e)));
return ret;
}
public virtual int OnInviteEvent(InviteEvent e) {
int ret = (SwigDerivedClassHasMethod("OnInviteEvent", swigMethodTypes2) ? tinyWRAPPINVOKE.SipCallback_OnInviteEventSwigExplicitSipCallback(swigCPtr, InviteEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnInviteEvent(swigCPtr, InviteEvent.getCPtr(e)));
return ret;
}
public virtual int OnMessagingEvent(MessagingEvent e) {
int ret = (SwigDerivedClassHasMethod("OnMessagingEvent", swigMethodTypes3) ? tinyWRAPPINVOKE.SipCallback_OnMessagingEventSwigExplicitSipCallback(swigCPtr, MessagingEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnMessagingEvent(swigCPtr, MessagingEvent.getCPtr(e)));
return ret;
}
public virtual int OnOptionsEvent(OptionsEvent e) {
int ret = (SwigDerivedClassHasMethod("OnOptionsEvent", swigMethodTypes4) ? tinyWRAPPINVOKE.SipCallback_OnOptionsEventSwigExplicitSipCallback(swigCPtr, OptionsEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnOptionsEvent(swigCPtr, OptionsEvent.getCPtr(e)));
return ret;
}
public virtual int OnPublicationEvent(PublicationEvent e) {
int ret = (SwigDerivedClassHasMethod("OnPublicationEvent", swigMethodTypes5) ? tinyWRAPPINVOKE.SipCallback_OnPublicationEventSwigExplicitSipCallback(swigCPtr, PublicationEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnPublicationEvent(swigCPtr, PublicationEvent.getCPtr(e)));
return ret;
}
public virtual int OnRegistrationEvent(RegistrationEvent e) {
int ret = (SwigDerivedClassHasMethod("OnRegistrationEvent", swigMethodTypes6) ? tinyWRAPPINVOKE.SipCallback_OnRegistrationEventSwigExplicitSipCallback(swigCPtr, RegistrationEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnRegistrationEvent(swigCPtr, RegistrationEvent.getCPtr(e)));
return ret;
}
public virtual int OnSubscriptionEvent(SubscriptionEvent e) {
int ret = (SwigDerivedClassHasMethod("OnSubscriptionEvent", swigMethodTypes7) ? tinyWRAPPINVOKE.SipCallback_OnSubscriptionEventSwigExplicitSipCallback(swigCPtr, SubscriptionEvent.getCPtr(e)) : tinyWRAPPINVOKE.SipCallback_OnSubscriptionEvent(swigCPtr, SubscriptionEvent.getCPtr(e)));
return ret;
}
private void SwigDirectorConnect() {
if (SwigDerivedClassHasMethod("OnDialogEvent", swigMethodTypes0))
swigDelegate0 = new SwigDelegateSipCallback_0(SwigDirectorOnDialogEvent);
if (SwigDerivedClassHasMethod("OnStackEvent", swigMethodTypes1))
swigDelegate1 = new SwigDelegateSipCallback_1(SwigDirectorOnStackEvent);
if (SwigDerivedClassHasMethod("OnInviteEvent", swigMethodTypes2))
swigDelegate2 = new SwigDelegateSipCallback_2(SwigDirectorOnInviteEvent);
if (SwigDerivedClassHasMethod("OnMessagingEvent", swigMethodTypes3))
swigDelegate3 = new SwigDelegateSipCallback_3(SwigDirectorOnMessagingEvent);
if (SwigDerivedClassHasMethod("OnOptionsEvent", swigMethodTypes4))
swigDelegate4 = new SwigDelegateSipCallback_4(SwigDirectorOnOptionsEvent);
if (SwigDerivedClassHasMethod("OnPublicationEvent", swigMethodTypes5))
swigDelegate5 = new SwigDelegateSipCallback_5(SwigDirectorOnPublicationEvent);
if (SwigDerivedClassHasMethod("OnRegistrationEvent", swigMethodTypes6))
swigDelegate6 = new SwigDelegateSipCallback_6(SwigDirectorOnRegistrationEvent);
if (SwigDerivedClassHasMethod("OnSubscriptionEvent", swigMethodTypes7))
swigDelegate7 = new SwigDelegateSipCallback_7(SwigDirectorOnSubscriptionEvent);
tinyWRAPPINVOKE.SipCallback_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5, swigDelegate6, swigDelegate7);
}
private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes) {
System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, methodTypes, null);
bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(SipCallback));
return hasDerivedMethod;
}
private int SwigDirectorOnDialogEvent(IntPtr e) {
return OnDialogEvent((e == IntPtr.Zero) ? null : new DialogEvent(e, false));
}
private int SwigDirectorOnStackEvent(IntPtr e) {
return OnStackEvent((e == IntPtr.Zero) ? null : new StackEvent(e, false));
}
private int SwigDirectorOnInviteEvent(IntPtr e) {
return OnInviteEvent((e == IntPtr.Zero) ? null : new InviteEvent(e, false));
}
private int SwigDirectorOnMessagingEvent(IntPtr e) {
return OnMessagingEvent((e == IntPtr.Zero) ? null : new MessagingEvent(e, false));
}
private int SwigDirectorOnOptionsEvent(IntPtr e) {
return OnOptionsEvent((e == IntPtr.Zero) ? null : new OptionsEvent(e, false));
}
private int SwigDirectorOnPublicationEvent(IntPtr e) {
return OnPublicationEvent((e == IntPtr.Zero) ? null : new PublicationEvent(e, false));
}
private int SwigDirectorOnRegistrationEvent(IntPtr e) {
return OnRegistrationEvent((e == IntPtr.Zero) ? null : new RegistrationEvent(e, false));
}
private int SwigDirectorOnSubscriptionEvent(IntPtr e) {
return OnSubscriptionEvent((e == IntPtr.Zero) ? null : new SubscriptionEvent(e, false));
}
public delegate int SwigDelegateSipCallback_0(IntPtr e);
public delegate int SwigDelegateSipCallback_1(IntPtr e);
public delegate int SwigDelegateSipCallback_2(IntPtr e);
public delegate int SwigDelegateSipCallback_3(IntPtr e);
public delegate int SwigDelegateSipCallback_4(IntPtr e);
public delegate int SwigDelegateSipCallback_5(IntPtr e);
public delegate int SwigDelegateSipCallback_6(IntPtr e);
public delegate int SwigDelegateSipCallback_7(IntPtr e);
private SwigDelegateSipCallback_0 swigDelegate0;
private SwigDelegateSipCallback_1 swigDelegate1;
private SwigDelegateSipCallback_2 swigDelegate2;
private SwigDelegateSipCallback_3 swigDelegate3;
private SwigDelegateSipCallback_4 swigDelegate4;
private SwigDelegateSipCallback_5 swigDelegate5;
private SwigDelegateSipCallback_6 swigDelegate6;
private SwigDelegateSipCallback_7 swigDelegate7;
private static Type[] swigMethodTypes0 = new Type[] { typeof(DialogEvent) };
private static Type[] swigMethodTypes1 = new Type[] { typeof(StackEvent) };
private static Type[] swigMethodTypes2 = new Type[] { typeof(InviteEvent) };
private static Type[] swigMethodTypes3 = new Type[] { typeof(MessagingEvent) };
private static Type[] swigMethodTypes4 = new Type[] { typeof(OptionsEvent) };
private static Type[] swigMethodTypes5 = new Type[] { typeof(PublicationEvent) };
private static Type[] swigMethodTypes6 = new Type[] { typeof(RegistrationEvent) };
private static Type[] swigMethodTypes7 = new Type[] { typeof(SubscriptionEvent) };
}
}

View File

@ -0,0 +1,68 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipEvent : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SipEvent(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipEvent() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public short getCode() {
short ret = tinyWRAPPINVOKE.SipEvent_getCode(swigCPtr);
return ret;
}
public string getPhrase() {
string ret = tinyWRAPPINVOKE.SipEvent_getPhrase(swigCPtr);
return ret;
}
public SipSession getBaseSession() {
IntPtr cPtr = tinyWRAPPINVOKE.SipEvent_getBaseSession(swigCPtr);
SipSession ret = (cPtr == IntPtr.Zero) ? null : new SipSession(cPtr, false);
return ret;
}
public SipMessage getSipMessage() {
IntPtr cPtr = tinyWRAPPINVOKE.SipEvent_getSipMessage(swigCPtr);
SipMessage ret = (cPtr == IntPtr.Zero) ? null : new SipMessage(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,95 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipMessage : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SipMessage(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipMessage obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipMessage() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipMessage(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public byte[] getSipContent() {
uint clen = this.getSipContentLength();
if(clen>0){
byte[] bytes = new byte[clen];
this.getSipContent(bytes, clen);
return bytes;
}
return null;
}
public SipMessage() : this(tinyWRAPPINVOKE.new_SipMessage(), true) {
}
public string getSipHeaderValue(string name, uint index) {
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, name, index);
return ret;
}
public string getSipHeaderValue(string name) {
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderValue__SWIG_1(swigCPtr, name);
return ret;
}
public string getSipHeaderParamValue(string name, string param, uint index) {
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderParamValue__SWIG_0(swigCPtr, name, param, index);
return ret;
}
public string getSipHeaderParamValue(string name, string param) {
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderParamValue__SWIG_1(swigCPtr, name, param);
return ret;
}
public uint getSipContentLength() {
uint ret = tinyWRAPPINVOKE.SipMessage_getSipContentLength(swigCPtr);
return ret;
}
public uint getSipContent(byte[] output, uint maxsize) {
uint ret = tinyWRAPPINVOKE.SipMessage_getSipContent(swigCPtr, output, maxsize);
return ret;
}
public SdpMessage getSdpMessage() {
IntPtr cPtr = tinyWRAPPINVOKE.SipMessage_getSdpMessage(swigCPtr);
SdpMessage ret = (cPtr == IntPtr.Zero) ? null : new SdpMessage(cPtr, false);
return ret;
}
}
}

View File

@ -0,0 +1,114 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipSession : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SipSession(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipSession obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipSession() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipSession(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SipSession(SipStack stack) : this(tinyWRAPPINVOKE.new_SipSession(SipStack.getCPtr(stack)), true) {
}
public bool haveOwnership() {
bool ret = tinyWRAPPINVOKE.SipSession_haveOwnership(swigCPtr);
return ret;
}
public bool addHeader(string name, string value) {
bool ret = tinyWRAPPINVOKE.SipSession_addHeader(swigCPtr, name, value);
return ret;
}
public bool removeHeader(string name) {
bool ret = tinyWRAPPINVOKE.SipSession_removeHeader(swigCPtr, name);
return ret;
}
public bool addCaps(string name, string value) {
bool ret = tinyWRAPPINVOKE.SipSession_addCaps__SWIG_0(swigCPtr, name, value);
return ret;
}
public bool addCaps(string name) {
bool ret = tinyWRAPPINVOKE.SipSession_addCaps__SWIG_1(swigCPtr, name);
return ret;
}
public bool removeCaps(string name) {
bool ret = tinyWRAPPINVOKE.SipSession_removeCaps(swigCPtr, name);
return ret;
}
public bool setExpires(uint expires) {
bool ret = tinyWRAPPINVOKE.SipSession_setExpires(swigCPtr, expires);
return ret;
}
public bool setFromUri(string fromUri) {
bool ret = tinyWRAPPINVOKE.SipSession_setFromUri(swigCPtr, fromUri);
return ret;
}
public bool setToUri(string toUri) {
bool ret = tinyWRAPPINVOKE.SipSession_setToUri(swigCPtr, toUri);
return ret;
}
public bool setSilentHangup(bool silent) {
bool ret = tinyWRAPPINVOKE.SipSession_setSilentHangup(swigCPtr, silent);
return ret;
}
public bool addSigCompCompartment(string compId) {
bool ret = tinyWRAPPINVOKE.SipSession_addSigCompCompartment(swigCPtr, compId);
return ret;
}
public bool removeSigCompCompartment() {
bool ret = tinyWRAPPINVOKE.SipSession_removeSigCompCompartment(swigCPtr);
return ret;
}
public uint getId() {
uint ret = tinyWRAPPINVOKE.SipSession_getId(swigCPtr);
return ret;
}
}
}

View File

@ -0,0 +1,226 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipStack : SafeObject {
private HandleRef swigCPtr;
internal SipStack(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.SipStack_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipStack obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipStack() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipStack(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
public SipStack(SipCallback callback, string realm_uri, string impi_uri, string impu_uri) : this(tinyWRAPPINVOKE.new_SipStack(SipCallback.getCPtr(callback), realm_uri, impi_uri, impu_uri), true) {
}
public bool start() {
bool ret = tinyWRAPPINVOKE.SipStack_start(swigCPtr);
return ret;
}
public bool setDebugCallback(DDebugCallback callback) {
bool ret = tinyWRAPPINVOKE.SipStack_setDebugCallback(swigCPtr, DDebugCallback.getCPtr(callback));
return ret;
}
public bool setRealm(string realm_uri) {
bool ret = tinyWRAPPINVOKE.SipStack_setRealm(swigCPtr, realm_uri);
return ret;
}
public bool setIMPI(string impi) {
bool ret = tinyWRAPPINVOKE.SipStack_setIMPI(swigCPtr, impi);
return ret;
}
public bool setIMPU(string impu_uri) {
bool ret = tinyWRAPPINVOKE.SipStack_setIMPU(swigCPtr, impu_uri);
return ret;
}
public bool setPassword(string password) {
bool ret = tinyWRAPPINVOKE.SipStack_setPassword(swigCPtr, password);
return ret;
}
public bool setAMF(string amf) {
bool ret = tinyWRAPPINVOKE.SipStack_setAMF(swigCPtr, amf);
return ret;
}
public bool setOperatorId(string opid) {
bool ret = tinyWRAPPINVOKE.SipStack_setOperatorId(swigCPtr, opid);
return ret;
}
public bool setProxyCSCF(string fqdn, ushort port, string transport, string ipversion) {
bool ret = tinyWRAPPINVOKE.SipStack_setProxyCSCF(swigCPtr, fqdn, port, transport, ipversion);
return ret;
}
public bool setLocalIP(string ip) {
bool ret = tinyWRAPPINVOKE.SipStack_setLocalIP(swigCPtr, ip);
return ret;
}
public bool setLocalPort(ushort port) {
bool ret = tinyWRAPPINVOKE.SipStack_setLocalPort(swigCPtr, port);
return ret;
}
public bool setEarlyIMS(bool enabled) {
bool ret = tinyWRAPPINVOKE.SipStack_setEarlyIMS(swigCPtr, enabled);
return ret;
}
public bool addHeader(string name, string value) {
bool ret = tinyWRAPPINVOKE.SipStack_addHeader(swigCPtr, name, value);
return ret;
}
public bool removeHeader(string name) {
bool ret = tinyWRAPPINVOKE.SipStack_removeHeader(swigCPtr, name);
return ret;
}
public bool addDnsServer(string ip) {
bool ret = tinyWRAPPINVOKE.SipStack_addDnsServer(swigCPtr, ip);
return ret;
}
public bool setDnsDiscovery(bool enabled) {
bool ret = tinyWRAPPINVOKE.SipStack_setDnsDiscovery(swigCPtr, enabled);
return ret;
}
public bool setAoR(string ip, int port) {
bool ret = tinyWRAPPINVOKE.SipStack_setAoR(swigCPtr, ip, port);
return ret;
}
public bool setSigCompParams(uint dms, uint sms, uint cpb, bool enablePresDict) {
bool ret = tinyWRAPPINVOKE.SipStack_setSigCompParams(swigCPtr, dms, sms, cpb, enablePresDict);
return ret;
}
public bool addSigCompCompartment(string compId) {
bool ret = tinyWRAPPINVOKE.SipStack_addSigCompCompartment(swigCPtr, compId);
return ret;
}
public bool removeSigCompCompartment(string compId) {
bool ret = tinyWRAPPINVOKE.SipStack_removeSigCompCompartment(swigCPtr, compId);
return ret;
}
public bool setSTUNServer(string ip, ushort port) {
bool ret = tinyWRAPPINVOKE.SipStack_setSTUNServer(swigCPtr, ip, port);
return ret;
}
public bool setSTUNCred(string login, string password) {
bool ret = tinyWRAPPINVOKE.SipStack_setSTUNCred(swigCPtr, login, password);
return ret;
}
public bool setTLSSecAgree(bool enabled) {
bool ret = tinyWRAPPINVOKE.SipStack_setTLSSecAgree(swigCPtr, enabled);
return ret;
}
public bool setSSLCretificates(string privKey, string pubKey, string caKey) {
bool ret = tinyWRAPPINVOKE.SipStack_setSSLCretificates(swigCPtr, privKey, pubKey, caKey);
return ret;
}
public bool setIPSecSecAgree(bool enabled) {
bool ret = tinyWRAPPINVOKE.SipStack_setIPSecSecAgree(swigCPtr, enabled);
return ret;
}
public bool setIPSecParameters(string algo, string ealgo, string mode, string proto) {
bool ret = tinyWRAPPINVOKE.SipStack_setIPSecParameters(swigCPtr, algo, ealgo, mode, proto);
return ret;
}
public string dnsENUM(string service, string e164num, string domain) {
string ret = tinyWRAPPINVOKE.SipStack_dnsENUM(swigCPtr, service, e164num, domain);
return ret;
}
public string dnsNaptrSrv(string domain, string service, out ushort OUTPUT) {
string ret = tinyWRAPPINVOKE.SipStack_dnsNaptrSrv(swigCPtr, domain, service, out OUTPUT);
return ret;
}
public string dnsSrv(string service, out ushort OUTPUT) {
string ret = tinyWRAPPINVOKE.SipStack_dnsSrv(swigCPtr, service, out OUTPUT);
return ret;
}
public string getLocalIPnPort(string protocol, out ushort OUTPUT) {
string ret = tinyWRAPPINVOKE.SipStack_getLocalIPnPort(swigCPtr, protocol, out OUTPUT);
return ret;
}
public string getPreferredIdentity() {
string ret = tinyWRAPPINVOKE.SipStack_getPreferredIdentity(swigCPtr);
return ret;
}
public bool isValid() {
bool ret = tinyWRAPPINVOKE.SipStack_isValid(swigCPtr);
return ret;
}
public bool stop() {
bool ret = tinyWRAPPINVOKE.SipStack_stop(swigCPtr);
return ret;
}
public static void setCodecs(tdav_codec_id_t codecs) {
tinyWRAPPINVOKE.SipStack_setCodecs((int)codecs);
}
public static void setCodecs_2(int codecs) {
tinyWRAPPINVOKE.SipStack_setCodecs_2(codecs);
}
public static bool isCodecSupported(tdav_codec_id_t codec) {
bool ret = tinyWRAPPINVOKE.SipStack_isCodecSupported((int)codec);
return ret;
}
}
}

View File

@ -0,0 +1,94 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class SipUri : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal SipUri(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(SipUri obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~SipUri() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_SipUri(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public SipUri(string arg0) : this(tinyWRAPPINVOKE.new_SipUri(arg0), true) {
}
public static bool isValid(string arg0) {
bool ret = tinyWRAPPINVOKE.SipUri_isValid__SWIG_0(arg0);
return ret;
}
public bool isValid() {
bool ret = tinyWRAPPINVOKE.SipUri_isValid__SWIG_1(swigCPtr);
return ret;
}
public string getScheme() {
string ret = tinyWRAPPINVOKE.SipUri_getScheme(swigCPtr);
return ret;
}
public string getHost() {
string ret = tinyWRAPPINVOKE.SipUri_getHost(swigCPtr);
return ret;
}
public ushort getPort() {
ushort ret = tinyWRAPPINVOKE.SipUri_getPort(swigCPtr);
return ret;
}
public string getUserName() {
string ret = tinyWRAPPINVOKE.SipUri_getUserName(swigCPtr);
return ret;
}
public string getPassword() {
string ret = tinyWRAPPINVOKE.SipUri_getPassword(swigCPtr);
return ret;
}
public string getDisplayName() {
string ret = tinyWRAPPINVOKE.SipUri_getDisplayName(swigCPtr);
return ret;
}
public string getParamValue(string pname) {
string ret = tinyWRAPPINVOKE.SipUri_getParamValue(swigCPtr, pname);
return ret;
}
}
}

View File

@ -0,0 +1,45 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.2
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class StackEvent : SipEvent {
private HandleRef swigCPtr;
internal StackEvent(IntPtr cPtr, bool cMemoryOwn) : base(tinyWRAPPINVOKE.StackEvent_SWIGUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(StackEvent obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~StackEvent() {
Dispose();
}
public override void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_StackEvent(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
base.Dispose();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More