diff --git a/trunk/Samples/C++/REGISTER/test/ReadMe.txt b/trunk/Samples/C++/REGISTER/test/ReadMe.txt new file mode 100644 index 00000000..784510cb --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/ReadMe.txt @@ -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. + +///////////////////////////////////////////////////////////////////////////// diff --git a/trunk/Samples/C++/REGISTER/test/stdafx.cpp b/trunk/Samples/C++/REGISTER/test/stdafx.cpp new file mode 100644 index 00000000..96da9278 --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/stdafx.cpp @@ -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 diff --git a/trunk/Samples/C++/REGISTER/test/stdafx.h b/trunk/Samples/C++/REGISTER/test/stdafx.h new file mode 100644 index 00000000..47a0d025 --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/stdafx.h @@ -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 +#include + + + +// TODO: reference additional headers your program requires here diff --git a/trunk/Samples/C++/REGISTER/test/targetver.h b/trunk/Samples/C++/REGISTER/test/targetver.h new file mode 100644 index 00000000..a38195a4 --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/targetver.h @@ -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 + diff --git a/trunk/Samples/C++/REGISTER/test/test.cpp b/trunk/Samples/C++/REGISTER/test/test.cpp new file mode 100644 index 00000000..38013677 --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/test.cpp @@ -0,0 +1,82 @@ +// test.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include +#include +#include + +#define STACK_ID 1234 + +#ifdef WIN32 +# include +#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:doubango@example.com"); + stack->set_private_id("doubango@example.com"); + + stack->set_pcscf("192.168.0.14"); + stack->set_pcscf_port(5060); + stack->set_realm("example.com"); + + /* run stack */ + assert( ERR_SUCCEED(stack->run()) ); + + /* set other optional parameters */ + stack->set_displayname("Doubango"); + stack->set_privacy("none"); + stack->set_early_ims(false); + stack->set_expires(10); + + /* register */ + stack->sip_register(); + + /* wait */ +#ifdef WIN32 + Sleep(50000); +#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; +} \ No newline at end of file diff --git a/trunk/Samples/C++/REGISTER/test/test.sln b/trunk/Samples/C++/REGISTER/test/test.sln new file mode 100644 index 00000000..d9cef3f0 --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/test.sln @@ -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 diff --git a/trunk/Samples/C++/REGISTER/test/test.vcproj b/trunk/Samples/C++/REGISTER/test/test.vcproj new file mode 100644 index 00000000..08682c0d --- /dev/null +++ b/trunk/Samples/C++/REGISTER/test/test.vcproj @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/building_gstreamer32.txt b/trunk/building_gstreamer32.txt new file mode 100644 index 00000000..0720af4c --- /dev/null +++ b/trunk/building_gstreamer32.txt @@ -0,0 +1,99 @@ +Home page for downloading: http://www.gtk.org/download-windows.html + +## Preparation ## +mkdir /c/tmp +export PREFIX=/usr/local/win32 +export CFLAGS="-mthreads -D_WIN32_WINNT=0x0501 -DWINVER=0x0501" + +## Glib ## +cd /c/tmp +wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.22/glib_2.22.2-1_win32.zip +wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.22/glib-dev_2.22.2-1_win32.zip +mkdir glib +cd glib +unzip ../glib_2.22.2-1_win32.zip +unzip ../glib-dev_2.22.2-1_win32.zip +mv glib/* $PREFIX + +## Iconv ## +cd /c/tmp +wget ftp://ftp.uni-hannover.de/pub/mirror/gnu/old-gnu/libiconv/libiconv-1.9.1.bin.woe32.zip +unzip libiconv-1.9.1.bin.woe32.zip -d $PREFIX + +## Gettext ## +cd /c/tmp +wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip +wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-dev-0.17-1.zip +unzip gettext-runtime-0.17-1.zip -d $PREFIX +unzip gettext-runtime-dev-0.17-1.zip -d $PREFIX + +## DirectX Headers ## +cd /c/tmp +wget http://www.lysator.liu.se/~peda/directx-headers/directx-headers-0.03.tar.gz +tar -zxvf directx-headers-0.03.tar.gz +cd directx-headers-0.03/include +patch -p1 < ../patch/dsound.patch +patch -p1 < ../patch/ddraw.patch +patch -p1 < ../patch/dinput.patch +mv /c/tmp/directx-headers-0.03/* $PREFIX + +## Liboil ## +cd /c/tmp +wget http://liboil.freedesktop.org/download/liboil-0.3.16.tar.gz +tar -zxvf liboil-0.3.16.tar.gz +cd liboil-0.3.16 +./configure --prefix=$PREFIX --host=i586-mingw32msvc +make -k +make -k install + +## libxml2 ## +cd /c/tmp +wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz +tar -zxvf libxml2-2.7.6.tar.gz +cd libxml2-2.7.6 +./configure --prefix=$PREFIX --host=i586-mingw32msvc +make +make install + +## zlib ## +cd /c/tmp +wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz +tar -zxvf zlib-1.2.3.tar.gz +cd zlib-1.2.3 +./configure --prefix=$PREFIX +make +make install + +## Libpng ## +cd /c/tmp +wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.2.39-1_win32.zip +unzip libpng_1.2.39-1_win32.zip -d $PREFIX + +## Libogg ## +cd /c/tmp +wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz +tar -zxvf libogg-1.1.4.tar.gz +cd libogg-1.1.4 +./configure --prefix=$PREFIX --host=i586-mingw32msvc +make +make install + +## Libvorbis ## +cd /c/tmp +wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz +tar -zxvf libvorbis-1.2.3.tar.gz +cd libvorbis-1.2.3 +./configure --prefix=$PREFIX --host=i586-mingw32msvc +make +make install + +## Gstreamer ## +cd /c/tmp +wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.25.tar.gz +wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.gz +wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.16.tar.gz +#wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-0.10.16.tar.gz +#wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-0.10.13.tar.gz +tar -zxvf gstreamer-0.10.25.tar.gz +export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig +./configure --prefix=$PREFIX --host=i586-mingw32msvc diff --git a/trunk/doubango.sln b/trunk/doubango.sln index 9c4f53ba..627b019a 100644 --- a/trunk/doubango.sln +++ b/trunk/doubango.sln @@ -5,7 +5,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doubango", "doubango\douban EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua", "sofia-sip-1.12.10\win32\libsofia-sip-ua\libsofia_sip_ua.vcproj", "{0D85D39A-C7FB-4C52-A541-73665FB478E6}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcproj", "{D38BEAF4-2B25-49F4-97BC-3DC10440DC6D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "Samples\C++\REGISTER\test\test.vcproj", "{EB6DC417-98BF-45FD-90D0-F5C72F945316}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,10 +21,10 @@ Global {0D85D39A-C7FB-4C52-A541-73665FB478E6}.Debug|Win32.Build.0 = Debug|Win32 {0D85D39A-C7FB-4C52-A541-73665FB478E6}.Release|Win32.ActiveCfg = Release|Win32 {0D85D39A-C7FB-4C52-A541-73665FB478E6}.Release|Win32.Build.0 = Release|Win32 - {D38BEAF4-2B25-49F4-97BC-3DC10440DC6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {D38BEAF4-2B25-49F4-97BC-3DC10440DC6D}.Debug|Win32.Build.0 = Debug|Win32 - {D38BEAF4-2B25-49F4-97BC-3DC10440DC6D}.Release|Win32.ActiveCfg = Release|Win32 - {D38BEAF4-2B25-49F4-97BC-3DC10440DC6D}.Release|Win32.Build.0 = Release|Win32 + {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 diff --git a/trunk/doubango/doubango.vcproj b/trunk/doubango/doubango.vcproj index 7f629ee9..bb6afbbd 100644 --- a/trunk/doubango/doubango.vcproj +++ b/trunk/doubango/doubango.vcproj @@ -41,7 +41,7 @@ + + + + + + + + + + + + + + -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ %} %class sip_dialog_info diff --git a/trunk/doubango/sm/sm_dialog_invite.sm b/trunk/doubango/sm/sm_dialog_invite.sm index 4a7708be..7d8ae834 100644 --- a/trunk/doubango/sm/sm_dialog_invite.sm +++ b/trunk/doubango/sm/sm_dialog_invite.sm @@ -1,30 +1,31 @@ %{ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ %} %class sip_dialog_invite diff --git a/trunk/doubango/sm/sm_dialog_message.sm b/trunk/doubango/sm/sm_dialog_message.sm index cf52c451..58ff0004 100644 --- a/trunk/doubango/sm/sm_dialog_message.sm +++ b/trunk/doubango/sm/sm_dialog_message.sm @@ -1,30 +1,31 @@ %{ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ %} %class sip_dialog_message diff --git a/trunk/doubango/sm/sm_dialog_publish.sm b/trunk/doubango/sm/sm_dialog_publish.sm index 8f0ba5fa..40213cc8 100644 --- a/trunk/doubango/sm/sm_dialog_publish.sm +++ b/trunk/doubango/sm/sm_dialog_publish.sm @@ -1,30 +1,31 @@ %{ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ %} %class sip_dialog_publish diff --git a/trunk/doubango/sm/sm_dialog_register.sm b/trunk/doubango/sm/sm_dialog_register.sm index f9fcde93..115478c4 100644 --- a/trunk/doubango/sm/sm_dialog_register.sm +++ b/trunk/doubango/sm/sm_dialog_register.sm @@ -38,12 +38,12 @@ //------------------------------------------------------------------------------------- // Initialized //------------------------------------------------------------------------------------- -Initialized Entry { OnStateChanged(SS_REGISTER_INITIALIZED); } +Initialized Entry { OnStateChanged(srs_none); } { sm_registerSent() Trying { } } -Trying Entry { OnStateChanged(SS_REGISTER_TRYING); } +Trying Entry { OnStateChanged(srs_trying); } { sm_1xx_response() nil {} sm_2xx_response(unreg: bool) [unreg == true] Terminated {} @@ -58,7 +58,7 @@ Trying Entry { OnStateChanged(SS_REGISTER_TRYING); } Default nil {} } -Established Entry { OnStateChanged(SS_REGISTER_ESTABLISHED); } +Established Entry { OnStateChanged(srs_registered); } { sm_1xx_response() nil {} sm_2xx_response(unreg: bool) [unreg == true] Terminated {} @@ -69,7 +69,7 @@ Established Entry { OnStateChanged(SS_REGISTER_ESTABLISHED); } Default nil {} } -Authentifying Entry { OnStateChanged(SS_REGISTER_AUTHENTIFYING); } +Authentifying Entry { OnStateChanged(srs_authentifying); } { sm_1xx_response() nil {} sm_2xx_response(unreg: bool) [unreg == true] Terminated {} @@ -79,12 +79,12 @@ Authentifying Entry { OnStateChanged(SS_REGISTER_AUTHENTIFYING); } Default nil {} } -Terminated Entry { OnStateChanged(SS_REGISTER_TERMINATED); } +Terminated Entry { OnStateChanged(srs_unregistered); } { Default nil {} } -Default Entry { OnStateChanged(SS_REGISTER_UNKNOWN); } +Default Entry { OnStateChanged(srs_none); } { sm_401_407_421_494_response() Authentifying {} sm_3xx_response() nil {} diff --git a/trunk/doubango/sm/sm_dialog_subscribe.sm b/trunk/doubango/sm/sm_dialog_subscribe.sm index f030e732..da5eb859 100644 --- a/trunk/doubango/sm/sm_dialog_subscribe.sm +++ b/trunk/doubango/sm/sm_dialog_subscribe.sm @@ -1,30 +1,31 @@ -%{ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +%{ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ %} %class sip_dialog_subscribe diff --git a/trunk/doubango/src/api_engine.cxx b/trunk/doubango/src/api_engine.cxx index f71aedcc..6d1b7de8 100644 --- a/trunk/doubango/src/api_engine.cxx +++ b/trunk/doubango/src/api_engine.cxx @@ -1,29 +1,30 @@ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "api_engine.h" #include "api_stack.h" @@ -34,30 +35,23 @@ #include #include -#include - #define PSTACK stack* PREF_NAMESPACE_START -/* engine callback declaration */ -static void engine_callback(nua_event_t event, - int status, - char const *phrase, - nua_t *nua, - nua_magic_t *magic, - nua_handle_t *nh, - nua_hmagic_t *hmagic, - sip_t const *sip, - tagi_t tags[]); - -/* global variable holding engine initialization state */ +/** + global variable holding engine initialization state +*/ static bool __initialized = false; -/* global variable holding all stacks */ +/** + global variable holding all stacks +*/ static std::list __stacks; -/* predicate: find stack by id */ +/** + STL predicate to find stack by id +*/ struct pred_stack_find_by_id: public std::binary_function< PSTACK, int, bool > { bool operator () ( const PSTACK s, const int &id ) const { return s->get_id() == id; @@ -107,7 +101,7 @@ ERR engine_stack_create(int stack_id) { return ERR_STACK_ALREADY_EXIST; } - stack* stk = new stack(stack_id, engine_callback); + stack* stk = new stack(stack_id); if(stk->get_initialized()) { __stacks.push_back(stk); @@ -175,13 +169,20 @@ void* engine_stack_find(int stack_id) return NULL; } -/* engine callback*/ -void engine_callback(nua_event_t event, int status, char const *phrase, - nua_t *nua, nua_magic_t *magic, nua_handle_t *nh, - nua_hmagic_t *hmagic, sip_t const *sip, tagi_t tags[]) +/* put a stck */ +ERR engine_push_stack(void* stack_ptr) { - ((stack*)magic)->callback_handle(event, status, phrase, nua, magic, - nh, hmagic, sip, tags); + if(!__initialized) return ERR_ENGINE_NOT_INITIALIZED; + if(!stack_ptr) return ERR_STACK_IS_INVALID; + + stack* stk = (stack*)stack_ptr; // FIXME + if(!stk) return ERR_STACK_IS_INVALID; + if(engine_stack_find(stk->get_id())){ + return ERR_STACK_ALREADY_EXIST; + }else{ + __stacks.push_back(stk); + return ERR_SUCCESS; + } } #undef PSTACK diff --git a/trunk/doubango/src/api_engine.h b/trunk/doubango/src/api_engine.h index 2f5bfefd..ee25ef0a 100644 --- a/trunk/doubango/src/api_engine.h +++ b/trunk/doubango/src/api_engine.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef _DOUBANGO_API_ENGINE_H_ #define _DOUBANGO_API_ENGINE_H_ @@ -41,6 +42,7 @@ DOUBANGO_API_C ERR engine_stack_shutdown(int stack_id); DOUBANGO_API_C ERR engine_stack_shutdown_all(void); void* engine_stack_find(int stack_id); +ERR engine_push_stack(void* stack_ptr); PREF_NAMESPACE_END diff --git a/trunk/doubango/src/api_errors.h b/trunk/doubango/src/api_errors.h index 96d10828..9de4f1d5 100644 --- a/trunk/doubango/src/api_errors.h +++ b/trunk/doubango/src/api_errors.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef _DOUBANGO_ERRORS_H_ #define _DOUBANGO_ERRORS_H_ @@ -42,6 +43,12 @@ typedef enum tag_ERR ERR_NOT_IMPLEMENTED, ERR_FUNC_OBSOLETE, + /* PARAMS */ + ERR_PARAMS_INVALID_PCSCF, + ERR_PARAMS_INVALID_REALM, + ERR_PARAMS_INVALID_PUBLIC_ID, + ERR_PARAMS_INVALID_PRIVATE_ID, + /* ENGINE errors */ ERR_ENGINE_NOT_INITIALIZED, /* engine not initialized or initialization failed*/ ERR_ENGINE_ALREADY_INITIALIZED, /* engine have been already initialized */ diff --git a/trunk/doubango/src/api_sip.cxx b/trunk/doubango/src/api_sip.cxx index 1ce3c3f3..ba8f49fa 100644 --- a/trunk/doubango/src/api_sip.cxx +++ b/trunk/doubango/src/api_sip.cxx @@ -1,36 +1,37 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "api_sip.h" #include "api_engine.h" #include "api_stack.h" -#include -#include // FIXME: remove -#include // FIXME: remove +//#include +//#include // FIXME: remove +//#include // FIXME: remove PREF_NAMESPACE_START @@ -39,8 +40,6 @@ PREF_NAMESPACE_START if(!stk) return ERR_STACK_NOT_FOUND; \ if(!stk->get_initialized()) return ERR_STACK_NOT_INITIALIZED; \ if(!stk->get_running()) return ERR_STACK_NOT_RUNNING; - -#define SAFE_FREE_HOME_PTR(home, ptr) { if(ptr){ su_free(home, ptr); } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -124,27 +123,24 @@ ERR auth_set(int stack_id, const char* public_id, const char* private_id, const ERR auth_set_displayname(int stack_id, const char* displayname) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_displayname()); - stk->set_displayname( su_strdup(stk->get_home(), displayname) ); - nua_set_params(stk->get_nua(), + stk->set_displayname( displayname ); + /*nua_set_params(stk->get_nua(), NUTAG_M_DISPLAY(displayname), - TAG_NULL()); + TAG_NULL());*/ return ERR_SUCCESS; } ERR auth_set_public_id(int stack_id, const char* public_id) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_public_id()); - stk->set_public_id( su_strdup(stk->get_home(), public_id) ); + stk->set_public_id( public_id ); return ERR_SUCCESS; } ERR auth_set_private_id(int stack_id, const char* private_id) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_private_id()); - stk->set_private_id( su_strdup(stk->get_home(), private_id) ); + stk->set_private_id( private_id ); return ERR_SUCCESS; } @@ -156,19 +152,17 @@ ERR auth_set_preferred_id(int stack_id, const char* preferred_id) ERR auth_set_password(int stack_id, const char* password) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_password()); - stk->set_password( su_strdup(stk->get_home(), password) ); + stk->set_password( password ); return ERR_SUCCESS; } ERR auth_set_realm(int stack_id, const char* realm) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_realm()); - stk->set_realm( su_strdup(stk->get_home(), realm) ); - nua_set_params(stk->get_nua(), + stk->set_realm( realm ); + /*nua_set_params(stk->get_nua(), AUTHTAG_REALM(realm), - TAG_NULL()); + TAG_NULL());*/ return ERR_SUCCESS; } @@ -185,8 +179,7 @@ ERR auth_set_amf(int stack_id, const char* amf) ERR auth_set_privacy(int stack_id, const char* privacy) { GET_STACK(stack_id, stk); - SAFE_FREE_HOME_PTR(stk->get_home(), stk->get_privacy()); - stk->set_privacy( su_strdup(stk->get_home(), privacy) ); + stk->set_privacy( privacy ); return ERR_SUCCESS; } @@ -213,13 +206,15 @@ ERR network_set(int stack_id, const char* pcscf, int pcscf_port, const char* tra ERR network_set_pcscf(int stack_id, const char* pcscf, int pcscf_port) { GET_STACK(stack_id, stk); - char* pcscf_ip_port = su_sprintf(NULL, "sip:%s:%d", pcscf, pcscf_port); + stk->set_pcscf(pcscf); + stk->set_pcscf_port(pcscf_port); + /*char* pcscf_ip_port = su_sprintf(NULL, "sip:%s:%d", pcscf, pcscf_port); nua_set_params(stk->get_nua(), NUTAG_PROXY(pcscf_ip_port), NUTAG_OUTBOUND("no-validate"), TAG_NULL()); - su_free(NULL, pcscf_ip_port); + su_free(NULL, pcscf_ip_port);*/ return ERR_SUCCESS; } diff --git a/trunk/doubango/src/api_sip.h b/trunk/doubango/src/api_sip.h index 09723000..87963458 100644 --- a/trunk/doubango/src/api_sip.h +++ b/trunk/doubango/src/api_sip.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef _DOUBANGO_API_SIP_REGISTRATION_H_ #define _DOUBANGO_API_SIP_REGISTRATION_H_ @@ -117,4 +118,5 @@ DOUBANGO_API_C ERR sigcomp_set_cpb(int stack_id, int cpb); PREF_NAMESPACE_END + #endif /* _DOUBANGO_API_SIP_REGISTRATION_H_ */ \ No newline at end of file diff --git a/trunk/doubango/src/api_sip_states.h b/trunk/doubango/src/api_sip_states.h index b9a8f88a..529654e3 100644 --- a/trunk/doubango/src/api_sip_states.h +++ b/trunk/doubango/src/api_sip_states.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef _DOUBANGO_SIP_STATES_H_ #define _DOUBANGO_SIP_STATES_H_ @@ -31,6 +32,19 @@ PREF_NAMESPACE_START +/** + SIP registration states +*/ +typedef enum sip_state_registration_e +{ + srs_none, + srs_trying, + srs_authentifying, + srs_unregistered, + srs_registered +} +sip_state_registration_t; + typedef enum tag_SIP_STATE { SS_UNKNOWN_UNKNOWN, diff --git a/trunk/doubango/src/api_stack.cxx b/trunk/doubango/src/api_stack.cxx index b24842e0..0f34d775 100644 --- a/trunk/doubango/src/api_stack.cxx +++ b/trunk/doubango/src/api_stack.cxx @@ -1,43 +1,73 @@ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ +#include #include "api_stack.h" +#include "api_engine.h" + +#include +#include #define DEFAULT_USER_AGENT "IM-client/OMA1.0" PREF_NAMESPACE_START -/* stack constructor */ -stack::stack(int _id, nua_callback_f _callback) + +/* global callback shared between all stacks*/ +static void shared_callback(nua_event_t $event, int status, char const *phrase, + nua_t *nua, nua_magic_t *magic, nua_handle_t *nh, + nua_hmagic_t *hmagic, sip_t const *sip, tagi_t tags[]) { - if(!_callback) return; + GET_DIALOG_BY_HANDLE(((stack*)magic), dlg, nh); + if(dlg) + { + dlg->dialog_callback($event, status, phrase, nua, magic, + nh, hmagic, sip, tags); + } + else + { + } + //((stack*)magic)->callback_handle(event, status, phrase, nua, magic, + // nh, hmagic, sip, tags); +} + +/** + Stack constructor + + @param stack_id stack identifier + @param stack_callback stack callback function +*/ +stack::stack(int stack_id) +{ + /* check that no stack has the same id */ + assert(!engine_stack_find(stack_id)); // initialize - this->id = _id; - this->callback = _callback; + this->id = stack_id; this->initialized = false; this->thread = NULL; @@ -55,45 +85,92 @@ stack::stack(int _id, nua_callback_f _callback) /* Features */ smsip = true, oma_large_msg = true, oma_sip_im = true, gsma_is = true, gsma_vs = true; + /* Params */ + expires = IMS_DEFAULT_EXIPRES; + // initialize memory handling if( su_home_init(this->home) ) return; + /* add stack to the engine list */ + if(!ERR_SUCCEED(engine_push_stack(this))) return; + this->initialized = true; } -/* stack destructor */ +/** + stack destructor +*/ stack::~stack() { if(this->thread) CloseHandle(this->thread); } -/* run main loop for processing of messages */ +/** + Runs main loop for processing of messages + + @return returns ERR_SUCCESS if succeed and stack error code otherwise +*/ inline ERR stack::run() { + ERR error = ERR_SUCCESS; + if(this->initialized && !this->running && !this->thread) { -#ifdef WIN32 +#ifdef WIN32 // FIXME: use pthread_cond + pthread_create DWORD threadId; this->thread = CreateThread(NULL, 0, ThreadRunner, this, 0, &threadId); for(int i=0; i<5; i++) { - if(this->running) - { - return ERR_SUCCESS; - } + if(this->running) break; Sleep(1000); - } - - return ERR_STACK_NOT_RUNNING; + } #else # error "must be implemented" #endif } - return (!this->initialized ? ERR_STACK_NOT_INITIALIZED : (this->running? ERR_STACK_ALREADY_EXIST : ERR_GLOBAL_FAILURE)); + if(this->initialized && this->running) + { + /* + According to 3GPP TS 24.229 subcluse 5.1.1.1B when using an UE without ISIM or USIM we shall + assume that public identity, private identity and realm are provisioned. + I added the P-CSCF because without this information it's impossible to register + */ + error = + !this->public_id ? ERR_PARAMS_INVALID_PUBLIC_ID : + (!this->private_id ? ERR_PARAMS_INVALID_PRIVATE_ID : + ((!this->pcscf || !this->pcscf_port) ? ERR_PARAMS_INVALID_PCSCF: + (!this->realm ? ERR_PARAMS_INVALID_REALM : error))); + if(!ERR_SUCCEED(error)) goto bail; + + /* Proxy-CSCF */ + char* pcscf_ip_port = su_sprintf(NULL, "sip:%s:%d", this->pcscf, this->pcscf_port); + nua_set_params(nua, NUTAG_PROXY(pcscf_ip_port), NUTAG_OUTBOUND("no-validate"), TAG_NULL()); + su_free(NULL, pcscf_ip_port); + + /* Public id */ + nua_set_params(nua, NUTAG_IMPU(this->public_id), TAG_NULL()); + + /* Private id */ + nua_set_params(nua, NUTAG_IMPI(this->private_id), TAG_NULL()); + + /* Realm: a home network domain name to address the SIP REGISTER request to */ + nua_set_params(this->nua, NUTAG_REALM(this->realm), TAG_NULL()); + } +bail: + if(!ERR_SUCCEED(error) && this->running) + { + this->shutdown(); + } + + return error; } -/* shutdown the stack */ +/** + shutdown the stack + + @return +*/ inline ERR stack::shutdown() { if(this->running) @@ -114,7 +191,9 @@ inline ERR stack::shutdown() } } -/* event loop processing */ +/** + event loop processing +*/ void stack::loop() { // initialize root object @@ -126,7 +205,7 @@ void stack::loop() } // create NUA stack - this->nua = nua_create(this->root, this->callback, this, + this->nua = nua_create(this->root, shared_callback, this, NUTAG_USER_AGENT(DEFAULT_USER_AGENT), NUTAG_PROXY("sip:127.0.0.1:5060"), /* tags as necessary ...*/ @@ -162,7 +241,9 @@ void stack::loop() } #ifdef WIN32 -/* static threads runner*/ +/** + static threads runner +*/ DWORD WINAPI stack::ThreadRunner( void* magic ) { ((stack*)magic)->loop(); @@ -170,23 +251,5 @@ DWORD WINAPI stack::ThreadRunner( void* magic ) { } #endif -/* handle callback event*/ -void stack::callback_handle(nua_event_t _event, - int status, char const *phrase, - nua_t *nua, nua_magic_t *magic, - nua_handle_t *nh, nua_hmagic_t *hmagic, - sip_t const *sip, - tagi_t tags[]) -{ - GET_DIALOG_BY_HANDLE(dlg, nh); - if(dlg) - { - dlg->dialog_callback(_event, status, phrase, nua, magic, - nh, hmagic, sip, tags); - } - else - { - } -} PREF_NAMESPACE_END \ No newline at end of file diff --git a/trunk/doubango/src/api_stack.h b/trunk/doubango/src/api_stack.h index 0e677396..c0576d33 100644 --- a/trunk/doubango/src/api_stack.h +++ b/trunk/doubango/src/api_stack.h @@ -1,47 +1,56 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_STACK_H__ #define __DOUBANGO_STACK_H__ #include "pref.h" #include "api_errors.h" #include "sip_dialog.h" +#include "fastdelegate2.h" #include #include #include - + PREF_NAMESPACE_START /* generate setter and getter methods*/ -#define DEFINE_GET_SET(type, member)\ +#define DEFINE_GET_SET_STR(member)\ + inline char* &get_##member(){ return this->##member; } \ + inline void set_##member(const char* val){ \ + if(this->##member) su_free(this->home, this->##member); \ + this->##member = su_strdup(this->home, val); \ + } +#define DEFINE_GET_SET_VAL(type, member)\ inline type &get_##member(){ return this->##member; } \ inline void set_##member(type val){ this->##member = val; } + /* predicate: find dialog by id */ struct pred_dialog_find_by_id: public std::binary_function< sip_dialog*, unsigned int, bool > { bool operator () ( const sip_dialog* dlg, unsigned int dialog_id ) const { @@ -55,7 +64,7 @@ struct pred_dialog_find_by_handle: public std::binary_function< sip_dialog*, nua } }; /* predicate: find dialog by sipmethod */ -struct pred_dialog_find_by_sipmethod: public std::binary_function< sip_dialog*, const char*, bool > { +struct pred_dialog_find_by_sipmethod: public std::binary_function< const sip_dialog*, const char*, bool > { bool operator () ( const sip_dialog* dlg, const char* sipmethod ) const { return !stricmp(dlg->get_sipmethod(), sipmethod); } @@ -68,24 +77,27 @@ struct pred_dialog_find_by_sipmethod: public std::binary_function< sip_dialog*, if(iter != this->dialogs.end()) dlg = *iter; /* get dialog by xxx */ -#define GET_DIALOG_BY_XXX(dlg, predicate, xxx) \ +#define GET_DIALOG_BY_XXX(stk, dlg, predicate, xxx) \ sip_dialog* dlg = NULL; \ - std::list::iterator iter = std::find_if( this->dialogs.begin(), this->dialogs.end(), std::bind2nd( predicate(), xxx ) ); \ - if(iter != this->dialogs.end()) dlg = *iter; + std::list::iterator iter = std::find_if( stk->get_dialogs().begin(), stk->get_dialogs().end(), std::bind2nd( predicate(), xxx ) ); \ + if(iter != stk->get_dialogs().end()) dlg = *iter; /* get dialog by sipmethod*/ -#define GET_DIALOG_BY_SIPMETHOD(dlg, sipmethod) GET_DIALOG_BY_XXX(dlg, pred_dialog_find_by_sipmethod, sipmethod) +#define GET_DIALOG_BY_SIPMETHOD(stk, dlg, sipmethod) GET_DIALOG_BY_XXX(stk, dlg, pred_dialog_find_by_sipmethod, sipmethod) /* get dialog by handle */ -#define GET_DIALOG_BY_HANDLE(dlg, handle) GET_DIALOG_BY_XXX(dlg, pred_dialog_find_by_handle, handle) +#define GET_DIALOG_BY_HANDLE(stk, dlg, handle) GET_DIALOG_BY_XXX(stk, dlg, pred_dialog_find_by_handle, handle) /* get dialog by id */ -#define GET_DIALOG_BY_ID(dlg, dialog_id) GET_DIALOG_BY_XXX(dlg, pred_dialog_find_by_id, dialog_id) +#define GET_DIALOG_BY_ID(stk, dlg, dialog_id) GET_DIALOG_BY_XXX(stk, dlg, pred_dialog_find_by_id, dialog_id) class DOUBANGO_API stack { public: - stack(int id, nua_callback_f callback); + stack(int id); ~stack(); + static ERR initialize(); + static ERR deinitialize(); + inline ERR run(); inline ERR shutdown(); @@ -94,6 +106,7 @@ public: inline bool get_initialized() const { return this->initialized; } inline su_home_t* get_home() { return this->home; } inline nua_t* get_nua() { return this->nua; } + inline std::list& get_dialogs() { return this->dialogs; } // // SIP @@ -112,35 +125,39 @@ public: // // Authentication // - DEFINE_GET_SET(char*, displayname); - DEFINE_GET_SET(char*, public_id); - DEFINE_GET_SET(char*, private_id); - DEFINE_GET_SET(char*, realm); - DEFINE_GET_SET(char*, password); - DEFINE_GET_SET(char*, privacy); - DEFINE_GET_SET(bool, early_ims); + DEFINE_GET_SET_STR(displayname); + DEFINE_GET_SET_STR(public_id); + DEFINE_GET_SET_STR(private_id); + DEFINE_GET_SET_STR(realm); + DEFINE_GET_SET_STR(password); + DEFINE_GET_SET_STR(privacy); + DEFINE_GET_SET_VAL(bool, early_ims); // // Network // - DEFINE_GET_SET(char*, pcscf); - DEFINE_GET_SET(int, pcscf_port); + DEFINE_GET_SET_STR(pcscf); + DEFINE_GET_SET_VAL(int, pcscf_port); // // Features // - DEFINE_GET_SET(bool, smsip); - DEFINE_GET_SET(bool, oma_large_msg); - DEFINE_GET_SET(bool, oma_sip_im); - DEFINE_GET_SET(bool, gsma_is); - DEFINE_GET_SET(bool, gsma_vs); + DEFINE_GET_SET_VAL(bool, smsip); + DEFINE_GET_SET_VAL(bool, oma_large_msg); + DEFINE_GET_SET_VAL(bool, oma_sip_im); + DEFINE_GET_SET_VAL(bool, gsma_is); + DEFINE_GET_SET_VAL(bool, gsma_vs); - void callback_handle(nua_event_t event, - int status, char const *phrase, - nua_t *nua, nua_magic_t *magic, - nua_handle_t *nh, nua_hmagic_t *hmagic, - sip_t const *sip, - tagi_t tags[]); + // + // Parameters + // + DEFINE_GET_SET_VAL(int, expires); + + // + // Delegates + // + fastdelegate2::delegateregistrationStateChanged; + private: #ifdef WIN32 static DWORD WINAPI ThreadRunner( void* magic ); @@ -152,7 +169,6 @@ private: bool initialized; bool running; - nua_callback_f callback; void* thread; std::listdialogs; @@ -186,9 +202,14 @@ private: bool oma_sip_im; bool gsma_is; bool gsma_vs; + + // + // Parameters + // + int expires; }; -#undef DEFINE_GET_SET +#undef DEFINE_GET_SET_VAL PREF_NAMESPACE_END diff --git a/trunk/doubango/src/api_stack_sip.cxx b/trunk/doubango/src/api_stack_sip.cxx index 984415ac..d4ed93ff 100644 --- a/trunk/doubango/src/api_stack_sip.cxx +++ b/trunk/doubango/src/api_stack_sip.cxx @@ -1,29 +1,30 @@ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "api_stack.h" #include "sip_dialog_register.h" #include "sip_dialog_message.h" @@ -32,10 +33,11 @@ PREF_NAMESPACE_START + /* SIP REGISTER*/ ERR stack::sip_register() { - GET_DIALOG_BY_SIPMETHOD(dlg, "REGISTER"); + GET_DIALOG_BY_SIPMETHOD(this, dlg, "REGISTER"); if(dlg){ return dlg->Start(); } @@ -49,7 +51,7 @@ ERR stack::sip_register() /* SIP UNREGISTER */ ERR stack::sip_unregister() { - GET_DIALOG_BY_SIPMETHOD(dlg, "REGISTER"); + GET_DIALOG_BY_SIPMETHOD(this, dlg, "REGISTER"); if(dlg){ return dlg->Stop(); } @@ -67,7 +69,7 @@ ERR stack::sip_message(const char* dest_address, const char* content_type, const /* SIP PUBLISH */ ERR stack::sip_publish() { - GET_DIALOG_BY_SIPMETHOD(dlg, "PUBLISH"); + GET_DIALOG_BY_SIPMETHOD(this, dlg, "PUBLISH"); if(dlg){ return dlg->Start(); } @@ -81,7 +83,7 @@ ERR stack::sip_publish() /* SIP UNPUBLISH*/ ERR stack::sip_unpublish() { - GET_DIALOG_BY_SIPMETHOD(dlg, "PUBLISH"); + GET_DIALOG_BY_SIPMETHOD(this, dlg, "PUBLISH"); if(dlg){ return dlg->Stop(); } @@ -100,7 +102,7 @@ ERR stack::sip_subscribe(const char* dest_address, const char* eventpackg, const /* SIP UNSUBSCRIBE*/ ERR stack::sip_unsubscribe(unsigned int dialog_id) { - GET_DIALOG_BY_ID(dlg, dialog_id); + GET_DIALOG_BY_ID(this, dlg, dialog_id); if(dlg){ return dlg->Stop(); } diff --git a/trunk/doubango/src/config.h b/trunk/doubango/src/config.h index 6d29b3ce..3ef52dc1 100644 --- a/trunk/doubango/src/config.h +++ b/trunk/doubango/src/config.h @@ -1,26 +1,27 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ \ No newline at end of file +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ \ No newline at end of file diff --git a/trunk/doubango/src/doubango.h b/trunk/doubango/src/doubango.h index 4e3039b5..569dfb11 100644 --- a/trunk/doubango/src/doubango.h +++ b/trunk/doubango/src/doubango.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DOUBANGO_H__ #define __DOUBANGO_DOUBANGO_H__ diff --git a/trunk/doubango/src/fastdelegate.h b/trunk/doubango/src/fastdelegate.h new file mode 100644 index 00000000..087c801f --- /dev/null +++ b/trunk/doubango/src/fastdelegate.h @@ -0,0 +1,2135 @@ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ +// FastDelegate.h +// Efficient delegates in C++ that generate only two lines of asm code! +// Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp +// +// - Don Clugston, Mar 2004. +// Major contributions were made by Jody Hagins. +// History: +// 24-Apr-04 1.0 * Submitted to CodeProject. +// 28-Apr-04 1.1 * Prevent most unsafe uses of evil static function hack. +// * Improved syntax for horrible_cast (thanks Paul Bludov). +// * Tested on Metrowerks MWCC and Intel ICL (IA32) +// * Compiled, but not run, on Comeau C++ and Intel Itanium ICL. +// 27-Jun-04 1.2 * Now works on Borland C++ Builder 5.5 +// * Now works on /clr "managed C++" code on VC7, VC7.1 +// * Comeau C++ now compiles without warnings. +// * Prevent the virtual inheritance case from being used on +// VC6 and earlier, which generate incorrect code. +// * Improved warning and error messages. Non-standard hacks +// now have compile-time checks to make them safer. +// * implicit_cast used instead of static_cast in many cases. +// * If calling a const member function, a const class pointer can be used. +// * MakeDelegate() global helper function added to simplify pass-by-value. +// * Added fastdelegate.clear() +// 16-Jul-04 1.2.1* Workaround for gcc bug (const member function pointers in templates) +// 30-Oct-04 1.3 * Support for (non-void) return values. +// * No more workarounds in client code! +// MSVC and Intel now use a clever hack invented by John Dlugosz: +// - The FASTDELEGATEDECLARE workaround is no longer necessary. +// - No more warning messages for VC6 +// * Less use of macros. Error messages should be more comprehensible. +// * Added include guards +// * Added FastDelegate::empty() to test if invocation is safe (Thanks Neville Franks). +// * Now tested on VS 2005 Express Beta, PGI C++ +// 24-Dec-04 1.4 * Added DelegateMemento, to allow collections of disparate delegates. +// * <,>,<=,>= comparison operators to allow storage in ordered containers. +// * Substantial reduction of code size, especially the 'Closure' class. +// * Standardised all the compiler-specific workarounds. +// * MFP conversion now works for CodePlay (but not yet supported in the full code). +// * Now compiles without warnings on _any_ supported compiler, including BCC 5.5.1 +// * New syntax: FastDelegate< int (char *, double) >. +// 14-Feb-05 1.4.1* Now treats =0 as equivalent to .clear(), ==0 as equivalent to .empty(). (Thanks elfric). +// * Now tested on Intel ICL for AMD64, VS2005 Beta for AMD64 and Itanium. +// 30-Mar-05 1.5 * Safebool idiom: "if (dg)" is now equivalent to "if (!dg.empty())" +// * Fully supported by CodePlay VectorC +// * Bugfix for Metrowerks: empty() was buggy because a valid MFP can be 0 on MWCC! +// * More optimal assignment,== and != operators for static function pointers. + +#ifndef FASTDELEGATE_H +#define FASTDELEGATE_H +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include // to allow <,> comparisons + +//////////////////////////////////////////////////////////////////////////////// +// Configuration options +// +//////////////////////////////////////////////////////////////////////////////// + +// Uncomment the following #define for optimally-sized delegates. +// In this case, the generated asm code is almost identical to the code you'd get +// if the compiler had native support for delegates. +// It will not work on systems where sizeof(dataptr) < sizeof(codeptr). +// Thus, it will not work for DOS compilers using the medium model. +// It will also probably fail on some DSP systems. +#define FASTDELEGATE_USESTATICFUNCTIONHACK + +// Uncomment the next line to allow function declarator syntax. +// It is automatically enabled for those compilers where it is known to work. +//#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX + +//////////////////////////////////////////////////////////////////////////////// +// Compiler identification for workarounds +// +//////////////////////////////////////////////////////////////////////////////// + +// Compiler identification. It's not easy to identify Visual C++ because +// many vendors fraudulently define Microsoft's identifiers. +#if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__) +#define FASTDLGT_ISMSVC + +#if (_MSC_VER <1300) // Many workarounds are required for VC6. +#define FASTDLGT_VC6 +#pragma warning(disable:4786) // disable this ridiculous warning +#endif + +#endif + +// Does the compiler uses Microsoft's member function pointer structure? +// If so, it needs special treatment. +// Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's +// identifier, _MSC_VER. We need to filter Metrowerks out. +#if defined(_MSC_VER) && !defined(__MWERKS__) +#define FASTDLGT_MICROSOFT_MFP + +#if !defined(__VECTOR_C) +// CodePlay doesn't have the __single/multi/virtual_inheritance keywords +#define FASTDLGT_HASINHERITANCE_KEYWORDS +#endif +#endif + +// Does it allow function declarator syntax? The following compilers are known to work: +#if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1 +#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX +#endif + +// Gcc(2.95+), and versions of Digital Mars, Intel and Comeau in common use. +#if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__) +#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX +#endif + +// It works on Metrowerks MWCC 3.2.2. From boost.Config it should work on earlier ones too. +#if defined (__MWERKS__) +#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX +#endif + +#ifdef __GNUC__ // Workaround GCC bug #8271 + // At present, GCC doesn't recognize constness of MFPs in templates +#define FASTDELEGATE_GCC_BUG_8271 +#endif + + + +//////////////////////////////////////////////////////////////////////////////// +// General tricks used in this code +// +// (a) Error messages are generated by typdefing an array of negative size to +// generate compile-time errors. +// (b) Warning messages on MSVC are generated by declaring unused variables, and +// enabling the "variable XXX is never used" warning. +// (c) Unions are used in a few compiler-specific cases to perform illegal casts. +// (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to +// (char *) first to ensure that the correct number of *bytes* are added. +// +//////////////////////////////////////////////////////////////////////////////// +// Helper templates +// +//////////////////////////////////////////////////////////////////////////////// + + +namespace fastdelegate { +namespace detail { // we'll hide the implementation details in a nested namespace. + +// implicit_cast< > +// I believe this was originally going to be in the C++ standard but +// was left out by accident. It's even milder than static_cast. +// I use it instead of static_cast<> to emphasize that I'm not doing +// anything nasty. +// Usage is identical to static_cast<> +template +inline OutputClass implicit_cast(InputClass input){ + return input; +} + +// horrible_cast< > +// This is truly evil. It completely subverts C++'s type system, allowing you +// to cast from any class to any other class. Technically, using a union +// to perform the cast is undefined behaviour (even in C). But we can see if +// it is OK by checking that the union is the same size as each of its members. +// horrible_cast<> should only be used for compiler-specific workarounds. +// Usage is identical to reinterpret_cast<>. + +// This union is declared outside the horrible_cast because BCC 5.5.1 +// can't inline a function with a nested class, and gives a warning. +template +union horrible_union{ + OutputClass out; + InputClass in; +}; + +template +inline OutputClass horrible_cast(const InputClass input){ + horrible_union u; + // Cause a compile-time error if in, out and u are not the same size. + // If the compile fails here, it means the compiler has peculiar + // unions which would prevent the cast from working. + typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u) + && sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1]; + u.in = input; + return u.out; +} + +//////////////////////////////////////////////////////////////////////////////// +// Workarounds +// +//////////////////////////////////////////////////////////////////////////////// + +// Backwards compatibility: This macro used to be necessary in the virtual inheritance +// case for Intel and Microsoft. Now it just forward-declares the class. +#define FASTDELEGATEDECLARE(CLASSNAME) class CLASSNAME; + +// Prevent use of the static function hack with the DOS medium model. +#ifdef __MEDIUM__ +#undef FASTDELEGATE_USESTATICFUNCTIONHACK +#endif + +// DefaultVoid - a workaround for 'void' templates in VC6. +// +// (1) VC6 and earlier do not allow 'void' as a default template argument. +// (2) They also doesn't allow you to return 'void' from a function. +// +// Workaround for (1): Declare a dummy type 'DefaultVoid' which we use +// when we'd like to use 'void'. We convert it into 'void' and back +// using the templates DefaultVoidToVoid<> and VoidToDefaultVoid<>. +// Workaround for (2): On VC6, the code for calling a void function is +// identical to the code for calling a non-void function in which the +// return value is never used, provided the return value is returned +// in the EAX register, rather than on the stack. +// This is true for most fundamental types such as int, enum, void *. +// Const void * is the safest option since it doesn't participate +// in any automatic conversions. But on a 16-bit compiler it might +// cause extra code to be generated, so we disable it for all compilers +// except for VC6 (and VC5). +#ifdef FASTDLGT_VC6 +// VC6 workaround +typedef const void * DefaultVoid; +#else +// On any other compiler, just use a normal void. +typedef void DefaultVoid; +#endif + +// Translate from 'DefaultVoid' to 'void'. +// Everything else is unchanged +template +struct DefaultVoidToVoid { typedef T type; }; + +template <> +struct DefaultVoidToVoid { typedef void type; }; + +// Translate from 'void' into 'DefaultVoid' +// Everything else is unchanged +template +struct VoidToDefaultVoid { typedef T type; }; + +template <> +struct VoidToDefaultVoid { typedef DefaultVoid type; }; + + + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 1: +// +// Conversion of member function pointer to a standard form +// +//////////////////////////////////////////////////////////////////////////////// + +// GenericClass is a fake class, ONLY used to provide a type. +// It is vitally important that it is never defined, so that the compiler doesn't +// think it can optimize the invocation. For example, Borland generates simpler +// code if it knows the class only uses single inheritance. + +// Compilers using Microsoft's structure need to be treated as a special case. +#ifdef FASTDLGT_MICROSOFT_MFP + +#ifdef FASTDLGT_HASINHERITANCE_KEYWORDS + // For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP + // (4 bytes), even when the /vmg option is used. Declaring an empty class + // would give 16 byte pointers in this case.... + class __single_inheritance GenericClass; +#endif + // ...but for Codeplay, an empty class *always* gives 4 byte pointers. + // If compiled with the /clr option ("managed C++"), the JIT compiler thinks + // it needs to load GenericClass before it can call any of its functions, + // (compiles OK but crashes at runtime!), so we need to declare an + // empty class to make it happy. + // Codeplay and VC4 can't cope with the unknown_inheritance case either. + class GenericClass {}; +#else + class GenericClass; +#endif + +// The size of a single inheritance member function pointer. +const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)()); + +// SimplifyMemFunc< >::Convert() +// +// A template function that converts an arbitrary member function pointer into the +// simplest possible form of member function pointer, using a supplied 'this' pointer. +// According to the standard, this can be done legally with reinterpret_cast<>. +// For (non-standard) compilers which use member function pointers which vary in size +// depending on the class, we need to use knowledge of the internal structure of a +// member function pointer, as used by the compiler. Template specialization is used +// to distinguish between the sizes. Because some compilers don't support partial +// template specialisation, I use full specialisation of a wrapper struct. + +// general case -- don't know how to convert it. Force a compile failure +template +struct SimplifyMemFunc { + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { + // Unsupported member function type -- force a compile failure. + // (it's illegal to have a array with negative size). + typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100]; + return 0; + } +}; + +// For compilers where all member func ptrs are the same size, everything goes here. +// For non-standard compilers, only single_inheritance classes go here. +template <> +struct SimplifyMemFunc { + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { +#if defined __DMC__ + // Digital Mars doesn't allow you to cast between abitrary PMF's, + // even though the standard says you can. The 32-bit compiler lets you + // static_cast through an int, but the DOS compiler doesn't. + bound_func = horrible_cast(function_to_bind); +#else + bound_func = reinterpret_cast(function_to_bind); +#endif + return reinterpret_cast(pthis); + } +}; + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 1b: +// +// Workarounds for Microsoft and Intel +// +//////////////////////////////////////////////////////////////////////////////// + + +// Compilers with member function pointers which violate the standard (MSVC, Intel, Codeplay), +// need to be treated as a special case. +#ifdef FASTDLGT_MICROSOFT_MFP + +// We use unions to perform horrible_casts. I would like to use #pragma pack(push, 1) +// at the start of each function for extra safety, but VC6 seems to ICE +// intermittently if you do this inside a template. + +// __multiple_inheritance classes go here +// Nasty hack for Microsoft and Intel (IA32 and Itanium) +template<> +struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > { + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { + // We need to use a horrible_cast to do this conversion. + // In MSVC, a multiple inheritance member pointer is internally defined as: + union { + XFuncType func; + struct { + GenericMemFuncType funcaddress; // points to the actual member function + int delta; // #BYTES to be added to the 'this' pointer + }s; + } u; + // Check that the horrible_cast will work + typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1]; + u.func = function_to_bind; + bound_func = u.s.funcaddress; + return reinterpret_cast(reinterpret_cast(pthis) + u.s.delta); + } +}; + +// virtual inheritance is a real nuisance. It's inefficient and complicated. +// On MSVC and Intel, there isn't enough information in the pointer itself to +// enable conversion to a closure pointer. Earlier versions of this code didn't +// work for all cases, and generated a compile-time error instead. +// But a very clever hack invented by John M. Dlugosz solves this problem. +// My code is somewhat different to his: I have no asm code, and I make no +// assumptions about the calling convention that is used. + +// In VC++ and ICL, a virtual_inheritance member pointer +// is internally defined as: +struct MicrosoftVirtualMFP { + void (GenericClass::*codeptr)(); // points to the actual member function + int delta; // #bytes to be added to the 'this' pointer + int vtable_index; // or 0 if no virtual inheritance +}; +// The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the +// m_codeptr member is *always* called, regardless of the values of the other +// members. (This is *not* true for other compilers, eg GCC, which obtain the +// function address from the vtable if a virtual function is being called). +// Dlugosz's trick is to make the codeptr point to a probe function which +// returns the 'this' pointer that was used. + +// Define a generic class that uses virtual inheritance. +// It has a trival member function that returns the value of the 'this' pointer. +struct GenericVirtualClass : virtual public GenericClass +{ + typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)(); + GenericVirtualClass * GetThis() { return this; } +}; + +// __virtual_inheritance classes go here +template <> +struct SimplifyMemFunc +{ + + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { + union { + XFuncType func; + GenericClass* (X::*ProbeFunc)(); + MicrosoftVirtualMFP s; + } u; + u.func = function_to_bind; + bound_func = reinterpret_cast(u.s.codeptr); + union { + GenericVirtualClass::ProbePtrType virtfunc; + MicrosoftVirtualMFP s; + } u2; + // Check that the horrible_cast<>s will work + typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s) + && sizeof(function_to_bind)==sizeof(u.ProbeFunc) + && sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1]; + // Unfortunately, taking the address of a MF prevents it from being inlined, so + // this next line can't be completely optimised away by the compiler. + u2.virtfunc = &GenericVirtualClass::GetThis; + u.s.codeptr = u2.s.codeptr; + return (pthis->*u.ProbeFunc)(); + } +}; + +#if (_MSC_VER <1300) + +// Nasty hack for Microsoft Visual C++ 6.0 +// unknown_inheritance classes go here +// There is a compiler bug in MSVC6 which generates incorrect code in this case!! +template <> +struct SimplifyMemFunc +{ + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { + // There is an apalling but obscure compiler bug in MSVC6 and earlier: + // vtable_index and 'vtordisp' are always set to 0 in the + // unknown_inheritance case! + // This means that an incorrect function could be called!!! + // Compiling with the /vmg option leads to potentially incorrect code. + // This is probably the reason that the IDE has a user interface for specifying + // the /vmg option, but it is disabled - you can only specify /vmg on + // the command line. In VC1.5 and earlier, the compiler would ICE if it ever + // encountered this situation. + // It is OK to use the /vmg option if /vmm or /vms is specified. + + // Fortunately, the wrong function is only called in very obscure cases. + // It only occurs when a derived class overrides a virtual function declared + // in a virtual base class, and the member function + // points to the *Derived* version of that function. The problem can be + // completely averted in 100% of cases by using the *Base class* for the + // member fpointer. Ie, if you use the base class as an interface, you'll + // stay out of trouble. + // Occasionally, you might want to point directly to a derived class function + // that isn't an override of a base class. In this case, both vtable_index + // and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated. + // We can generate correct code in this case. To prevent an incorrect call from + // ever being made, on MSVC6 we generate a warning, and call a function to + // make the program crash instantly. + typedef char ERROR_VC6CompilerBug[-100]; + return 0; + } +}; + + +#else + +// Nasty hack for Microsoft and Intel (IA32 and Itanium) +// unknown_inheritance classes go here +// This is probably the ugliest bit of code I've ever written. Look at the casts! +// There is a compiler bug in MSVC6 which prevents it from using this code. +template <> +struct SimplifyMemFunc +{ + template + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { + // The member function pointer is 16 bytes long. We can't use a normal cast, but + // we can use a union to do the conversion. + union { + XFuncType func; + // In VC++ and ICL, an unknown_inheritance member pointer + // is internally defined as: + struct { + GenericMemFuncType m_funcaddress; // points to the actual member function + int delta; // #bytes to be added to the 'this' pointer + int vtordisp; // #bytes to add to 'this' to find the vtable + int vtable_index; // or 0 if no virtual inheritance + } s; + } u; + // Check that the horrible_cast will work + typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1]; + u.func = function_to_bind; + bound_func = u.s.funcaddress; + int virtual_delta = 0; + if (u.s.vtable_index) { // Virtual inheritance is used + // First, get to the vtable. + // It is 'vtordisp' bytes from the start of the class. + const int * vtable = *reinterpret_cast( + reinterpret_cast(pthis) + u.s.vtordisp ); + + // 'vtable_index' tells us where in the table we should be looking. + virtual_delta = u.s.vtordisp + *reinterpret_cast( + reinterpret_cast(vtable) + u.s.vtable_index); + } + // The int at 'virtual_delta' gives us the amount to add to 'this'. + // Finally we can add the three components together. Phew! + return reinterpret_cast( + reinterpret_cast(pthis) + u.s.delta + virtual_delta); + }; +}; +#endif // MSVC 7 and greater + +#endif // MS/Intel hacks + +} // namespace detail + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 2: +// +// Define the delegate storage, and cope with static functions +// +//////////////////////////////////////////////////////////////////////////////// + +// DelegateMemento -- an opaque structure which can hold an arbitary delegate. +// It knows nothing about the calling convention or number of arguments used by +// the function pointed to. +// It supplies comparison operators so that it can be stored in STL collections. +// It cannot be set to anything other than null, nor invoked directly: +// it must be converted to a specific delegate. + +// Implementation: +// There are two possible implementations: the Safe method and the Evil method. +// DelegateMemento - Safe version +// +// This implementation is standard-compliant, but a bit tricky. +// A static function pointer is stored inside the class. +// Here are the valid values: +// +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+ +// | 0 | 0 | 0 | Empty | +// | !=0 |(dontcare)| Invoker | Static function| +// | 0 | !=0 | !=0* | Method call | +// +--------------------+----------+------------+----------------+ +// * For Metrowerks, this can be 0. (first virtual function in a +// single_inheritance class). +// When stored stored inside a specific delegate, the 'dontcare' entries are replaced +// with a reference to the delegate itself. This complicates the = and == operators +// for the delegate class. + +// DelegateMemento - Evil version +// +// For compilers where data pointers are at least as big as code pointers, it is +// possible to store the function pointer in the this pointer, using another +// horrible_cast. In this case the DelegateMemento implementation is simple: +// +--pThis --+-- pMemFunc-+-- Meaning---------------------+ +// | 0 | 0 | Empty | +// | !=0 | !=0* | Static function or method call| +// +----------+------------+-------------------------------+ +// * For Metrowerks, this can be 0. (first virtual function in a +// single_inheritance class). +// Note that the Sun C++ and MSVC documentation explicitly state that they +// support static_cast between void * and function pointers. + +class DelegateMemento { +protected: + // the data is protected, not private, because many + // compilers have problems with template friends. + typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP. + detail::GenericClass *m_pthis; + GenericMemFuncType m_pFunction; + +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + typedef void (*GenericFuncPtr)(); // arbitrary code pointer + GenericFuncPtr m_pStaticFunction; +#endif + +public: +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {}; + void clear() { + m_pthis=0; m_pFunction=0; m_pStaticFunction=0; + } +#else + DelegateMemento() : m_pthis(0), m_pFunction(0) {}; + void clear() { m_pthis=0; m_pFunction=0; } +#endif +public: +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + inline bool IsEqual (const DelegateMemento &x) const{ + // We have to cope with the static function pointers as a special case + if (m_pFunction!=x.m_pFunction) return false; + // the static function ptrs must either both be equal, or both be 0. + if (m_pStaticFunction!=x.m_pStaticFunction) return false; + if (m_pStaticFunction!=0) return m_pthis==x.m_pthis; + else return true; + } +#else // Evil Method + inline bool IsEqual (const DelegateMemento &x) const{ + return m_pthis==x.m_pthis && m_pFunction==x.m_pFunction; + } +#endif + // Provide a strict weak ordering for DelegateMementos. + inline bool IsLess(const DelegateMemento &right) const { + // deal with static function pointers first +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0) + return m_pStaticFunction < right.m_pStaticFunction; +#endif + if (m_pthis !=right.m_pthis) return m_pthis < right.m_pthis; + // There are no ordering operators for member function pointers, + // but we can fake one by comparing each byte. The resulting ordering is + // arbitrary (and compiler-dependent), but it permits storage in ordered STL containers. + return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0; + + } + // BUGFIX (Mar 2005): + // We can't just compare m_pFunction because on Metrowerks, + // m_pFunction can be zero even if the delegate is not empty! + inline bool operator ! () const // Is it bound to anything? + { return m_pthis==0 && m_pFunction==0; } + inline bool empty() const // Is it bound to anything? + { return m_pthis==0 && m_pFunction==0; } +public: + DelegateMemento & operator = (const DelegateMemento &right) { + SetMementoFrom(right); + return *this; + } + inline bool operator <(const DelegateMemento &right) { + return IsLess(right); + } + inline bool operator >(const DelegateMemento &right) { + return right.IsLess(*this); + } + DelegateMemento (const DelegateMemento &right) : + m_pFunction(right.m_pFunction), m_pthis(right.m_pthis) +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + , m_pStaticFunction (right.m_pStaticFunction) +#endif + {} +protected: + void SetMementoFrom(const DelegateMemento &right) { + m_pFunction = right.m_pFunction; + m_pthis = right.m_pthis; +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + m_pStaticFunction = right.m_pStaticFunction; +#endif + } +}; + + +// ClosurePtr<> +// +// A private wrapper class that adds function signatures to DelegateMemento. +// It's the class that does most of the actual work. +// The signatures are specified by: +// GenericMemFunc: must be a type of GenericClass member function pointer. +// StaticFuncPtr: must be a type of function pointer with the same signature +// as GenericMemFunc. +// UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6 +// where it never returns void (returns DefaultVoid instead). + +// An outer class, FastDelegateN<>, handles the invoking and creates the +// necessary typedefs. +// This class does everything else. + +namespace detail { + +template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr> +class ClosurePtr : public DelegateMemento { +public: + // These functions are for setting the delegate to a member function. + + // Here's the clever bit: we convert an arbitrary member function into a + // standard form. XMemFunc should be a member function of class X, but I can't + // enforce that here. It needs to be enforced by the wrapper class. + template < class X, class XMemFunc > + inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) { + m_pthis = SimplifyMemFunc< sizeof(function_to_bind) > + ::Convert(pthis, function_to_bind, m_pFunction); +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + m_pStaticFunction = 0; +#endif + } + // For const member functions, we only need a const class pointer. + // Since we know that the member function is const, it's safe to + // remove the const qualifier from the 'this' pointer with a const_cast. + // VC6 has problems if we just overload 'bindmemfunc', so we give it a different name. + template < class X, class XMemFunc> + inline void bindconstmemfunc(const X *pthis, XMemFunc function_to_bind) { + m_pthis= SimplifyMemFunc< sizeof(function_to_bind) > + ::Convert(const_cast(pthis), function_to_bind, m_pFunction); +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + m_pStaticFunction = 0; +#endif + } +#ifdef FASTDELEGATE_GCC_BUG_8271 // At present, GCC doesn't recognize constness of MFPs in templates + template < class X, class XMemFunc> + inline void bindmemfunc(const X *pthis, XMemFunc function_to_bind) { + bindconstmemfunc(pthis, function_to_bind); +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + m_pStaticFunction = 0; +#endif + } +#endif + // These functions are required for invoking the stored function + inline GenericClass *GetClosureThis() const { return m_pthis; } + inline GenericMemFunc GetClosureMemPtr() const { return reinterpret_cast(m_pFunction); } + +// There are a few ways of dealing with static function pointers. +// There's a standard-compliant, but tricky method. +// There's also a straightforward hack, that won't work on DOS compilers using the +// medium memory model. It's so evil that I can't recommend it, but I've +// implemented it anyway because it produces very nice asm code. + +#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + +// ClosurePtr<> - Safe version +// +// This implementation is standard-compliant, but a bit tricky. +// I store the function pointer inside the class, and the delegate then +// points to itself. Whenever the delegate is copied, these self-references +// must be transformed, and this complicates the = and == operators. +public: + // The next two functions are for operator ==, =, and the copy constructor. + // We may need to convert the m_pthis pointers, so that + // they remain as self-references. + template< class DerivedClass > + inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &x) { + SetMementoFrom(x); + if (m_pStaticFunction!=0) { + // transform self references... + m_pthis=reinterpret_cast(pParent); + } + } + // For static functions, the 'static_function_invoker' class in the parent + // will be called. The parent then needs to call GetStaticFunction() to find out + // the actual function to invoke. + template < class DerivedClass, class ParentInvokerSig > + inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, + StaticFuncPtr function_to_bind ) { + if (function_to_bind==0) { // cope with assignment to 0 + m_pFunction=0; + } else { + bindmemfunc(pParent, static_function_invoker); + } + m_pStaticFunction=reinterpret_cast(function_to_bind); + } + inline UnvoidStaticFuncPtr GetStaticFunction() const { + return reinterpret_cast(m_pStaticFunction); + } +#else + +// ClosurePtr<> - Evil version +// +// For compilers where data pointers are at least as big as code pointers, it is +// possible to store the function pointer in the this pointer, using another +// horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and +// speeds up comparison and assignment. If C++ provided direct language support +// for delegates, they would produce asm code that was almost identical to this. +// Note that the Sun C++ and MSVC documentation explicitly state that they +// support static_cast between void * and function pointers. + + template< class DerivedClass > + inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &right) { + SetMementoFrom(right); + } + // For static functions, the 'static_function_invoker' class in the parent + // will be called. The parent then needs to call GetStaticFunction() to find out + // the actual function to invoke. + // ******** EVIL, EVIL CODE! ******* + template < class DerivedClass, class ParentInvokerSig> + inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, + StaticFuncPtr function_to_bind) { + if (function_to_bind==0) { // cope with assignment to 0 + m_pFunction=0; + } else { + // We'll be ignoring the 'this' pointer, but we need to make sure we pass + // a valid value to bindmemfunc(). + bindmemfunc(pParent, static_function_invoker); + } + + // WARNING! Evil hack. We store the function in the 'this' pointer! + // Ensure that there's a compilation failure if function pointers + // and data pointers have different sizes. + // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. + typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1]; + m_pthis = horrible_cast(function_to_bind); + // MSVC, SunC++ and DMC accept the following (non-standard) code: +// m_pthis = static_cast(static_cast(function_to_bind)); + // BCC32, Comeau and DMC accept this method. MSVC7.1 needs __int64 instead of long +// m_pthis = reinterpret_cast(reinterpret_cast(function_to_bind)); + } + // ******** EVIL, EVIL CODE! ******* + // This function will be called with an invalid 'this' pointer!! + // We're just returning the 'this' pointer, converted into + // a function pointer! + inline UnvoidStaticFuncPtr GetStaticFunction() const { + // Ensure that there's a compilation failure if function pointers + // and data pointers have different sizes. + // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. + typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1]; + return horrible_cast(this); + } +#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) + + // Does the closure contain this static function? + inline bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr){ + if (funcptr==0) return empty(); + // For the Evil method, if it doesn't actually contain a static function, this will return an arbitrary + // value that is not equal to any valid function pointer. + else return funcptr==reinterpret_cast(GetStaticFunction()); + } +}; + + +} // namespace detail + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 3: +// +// Wrapper classes to ensure type safety +// +//////////////////////////////////////////////////////////////////////////////// + + +// Once we have the member function conversion templates, it's easy to make the +// wrapper classes. So that they will work with as many compilers as possible, +// the classes are of the form +// FastDelegate3 +// They can cope with any combination of parameters. The max number of parameters +// allowed is 8, but it is trivial to increase this limit. +// Note that we need to treat const member functions seperately. +// All this class does is to enforce type safety, and invoke the delegate with +// the correct list of parameters. + +// Because of the weird rule about the class of derived member function pointers, +// you sometimes need to apply a downcast to the 'this' pointer. +// This is the reason for the use of "implicit_cast(pthis)" in the code below. +// If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction, +// without this trick you'd need to write: +// MyDelegate(static_cast(&d), &CDerivedClass::SimpleVirtualFunction); +// but with the trick you can write +// MyDelegate(&d, &CDerivedClass::SimpleVirtualFunction); + +// RetType is the type the compiler uses in compiling the template. For VC6, +// it cannot be void. DesiredRetType is the real type which is returned from +// all of the functions. It can be void. + +// Implicit conversion to "bool" is achieved using the safe_bool idiom, +// using member data pointers (MDP). This allows "if (dg)..." syntax +// Because some compilers (eg codeplay) don't have a unique value for a zero +// MDP, an extra padding member is added to the SafeBool struct. +// Some compilers (eg VC6) won't implicitly convert from 0 to an MDP, so +// in that case the static function constructor is not made explicit; this +// allows "if (dg==0) ..." to compile. + +//N=0 +template +class FastDelegate0 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(); + typedef RetType (*UnvoidStaticFunctionPtr)(); + typedef RetType (detail::GenericClass::*GenericMemFn)(); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate0 type; + + // Construction and comparison functions + FastDelegate0() { clear(); } + FastDelegate0(const FastDelegate0 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate0 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate0 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate0 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate0 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate0 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate0(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate0(DesiredRetType (*function_to_bind)() ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)() ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)()) { + m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() () const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction() const { + return (*(m_Closure.GetStaticFunction()))(); } +}; + +//N=1 +template +class FastDelegate1 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate1 type; + + // Construction and comparison functions + FastDelegate1() { clear(); } + FastDelegate1(const FastDelegate1 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate1 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate1 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate1 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate1 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate1 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate1(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate1(DesiredRetType (*function_to_bind)(Param1 p1) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) { + m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1) const { + return (*(m_Closure.GetStaticFunction()))(p1); } +}; + +//N=2 +template +class FastDelegate2 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate2 type; + + // Construction and comparison functions + FastDelegate2() { clear(); } + FastDelegate2(const FastDelegate2 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate2 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate2 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate2 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate2 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate2 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate2(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate2(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) { + m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2); } +}; + +//N=3 +template +class FastDelegate3 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate3 type; + + // Construction and comparison functions + FastDelegate3() { clear(); } + FastDelegate3(const FastDelegate3 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate3 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate3 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate3 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate3 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate3 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate3(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) { + m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3); } +}; + +//N=4 +template +class FastDelegate4 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate4 type; + + // Construction and comparison functions + FastDelegate4() { clear(); } + FastDelegate4(const FastDelegate4 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate4 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate4 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate4 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate4 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate4 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate4(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { + m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4); } +}; + +//N=5 +template +class FastDelegate5 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate5 type; + + // Construction and comparison functions + FastDelegate5() { clear(); } + FastDelegate5(const FastDelegate5 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate5 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate5 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate5 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate5 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate5 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate5(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { + m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5); } +}; + +//N=6 +template +class FastDelegate6 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate6 type; + + // Construction and comparison functions + FastDelegate6() { clear(); } + FastDelegate6(const FastDelegate6 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate6 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate6 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate6 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate6 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate6 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate6(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { + m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6); } +}; + +//N=7 +template +class FastDelegate7 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate7 type; + + // Construction and comparison functions + FastDelegate7() { clear(); } + FastDelegate7(const FastDelegate7 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate7 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate7 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate7 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate7 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate7 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate7(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { + m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7); } +}; + +//N=8 +template +class FastDelegate8 { +private: + typedef typename detail::DefaultVoidToVoid::type DesiredRetType; + typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8); + typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8); + typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8); + typedef detail::ClosurePtr ClosureType; + ClosureType m_Closure; +public: + // Typedefs to aid generic programming + typedef FastDelegate8 type; + + // Construction and comparison functions + FastDelegate8() { clear(); } + FastDelegate8(const FastDelegate8 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + void operator = (const FastDelegate8 &x) { + m_Closure.CopyFrom(this, x.m_Closure); } + bool operator ==(const FastDelegate8 &x) const { + return m_Closure.IsEqual(x.m_Closure); } + bool operator !=(const FastDelegate8 &x) const { + return !m_Closure.IsEqual(x.m_Closure); } + bool operator <(const FastDelegate8 &x) const { + return m_Closure.IsLess(x.m_Closure); } + bool operator >(const FastDelegate8 &x) const { + return x.m_Closure.IsLess(m_Closure); } + // Binding to non-const member functions + template < class X, class Y > + FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { + m_Closure.bindmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Binding to const member functions. + template < class X, class Y > + FastDelegate8(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + template < class X, class Y > + inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) { + m_Closure.bindconstmemfunc(detail::implicit_cast(pthis), function_to_bind); } + // Static functions. We convert them into a member function call. + // This constructor also provides implicit conversion + FastDelegate8(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) { + bind(function_to_bind); } + // for efficiency, prevent creation of a temporary + void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) { + bind(function_to_bind); } + inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { + m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction, + function_to_bind); } + // Invoke the delegate + RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const { + return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8); } + // Implicit conversion to "bool" using the safe_bool idiom +private: + typedef struct SafeBoolStruct { + int a_data_pointer_to_this_is_0_on_buggy_compilers; + StaticFunctionPtr m_nonzero; + } UselessTypedef; + typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type; +public: + operator unspecified_bool_type() const { + return empty()? 0: &SafeBoolStruct::m_nonzero; + } + // necessary to allow ==0 to work despite the safe_bool idiom + inline bool operator==(StaticFunctionPtr funcptr) { + return m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator!=(StaticFunctionPtr funcptr) { + return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } + inline bool operator ! () const { // Is it bound to anything? + return !m_Closure; } + inline bool empty() const { + return !m_Closure; } + void clear() { m_Closure.clear();} + // Conversion to and from the DelegateMemento storage class + const DelegateMemento & GetMemento() { return m_Closure; } + void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); } + +private: // Invoker for static functions + RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const { + return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8); } +}; + + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 4: +// +// FastDelegate<> class (Original author: Jody Hagins) +// Allows boost::function style syntax like: +// FastDelegate< double (int, long) > +// instead of: +// FastDelegate2< int, long, double > +// +//////////////////////////////////////////////////////////////////////////////// + +#ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX + +// Declare FastDelegate as a class template. It will be specialized +// later for all number of arguments. +template +class FastDelegate; + +//N=0 +// Specialization to allow use of +// FastDelegate< R ( ) > +// instead of +// FastDelegate0 < R > +template +class FastDelegate< R ( ) > + // Inherit from FastDelegate0 so that it can be treated just like a FastDelegate0 + : public FastDelegate0 < R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate0 < R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=1 +// Specialization to allow use of +// FastDelegate< R ( Param1 ) > +// instead of +// FastDelegate1 < Param1, R > +template +class FastDelegate< R ( Param1 ) > + // Inherit from FastDelegate1 so that it can be treated just like a FastDelegate1 + : public FastDelegate1 < Param1, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate1 < Param1, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=2 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2 ) > +// instead of +// FastDelegate2 < Param1, Param2, R > +template +class FastDelegate< R ( Param1, Param2 ) > + // Inherit from FastDelegate2 so that it can be treated just like a FastDelegate2 + : public FastDelegate2 < Param1, Param2, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate2 < Param1, Param2, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=3 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3 ) > +// instead of +// FastDelegate3 < Param1, Param2, Param3, R > +template +class FastDelegate< R ( Param1, Param2, Param3 ) > + // Inherit from FastDelegate3 so that it can be treated just like a FastDelegate3 + : public FastDelegate3 < Param1, Param2, Param3, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=4 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3, Param4 ) > +// instead of +// FastDelegate4 < Param1, Param2, Param3, Param4, R > +template +class FastDelegate< R ( Param1, Param2, Param3, Param4 ) > + // Inherit from FastDelegate4 so that it can be treated just like a FastDelegate4 + : public FastDelegate4 < Param1, Param2, Param3, Param4, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=5 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) > +// instead of +// FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > +template +class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) > + // Inherit from FastDelegate5 so that it can be treated just like a FastDelegate5 + : public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=6 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) > +// instead of +// FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > +template +class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) > + // Inherit from FastDelegate6 so that it can be treated just like a FastDelegate6 + : public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=7 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) > +// instead of +// FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > +template +class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) > + // Inherit from FastDelegate7 so that it can be treated just like a FastDelegate7 + : public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + +//N=8 +// Specialization to allow use of +// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) > +// instead of +// FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > +template +class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) > + // Inherit from FastDelegate8 so that it can be treated just like a FastDelegate8 + : public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > +{ +public: + // Make using the base type a bit easier via typedef. + typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType; + + // Allow users access to the specific type of this delegate. + typedef FastDelegate SelfType; + + // Mimic the base class constructors. + FastDelegate() : BaseType() { } + + template < class X, class Y > + FastDelegate(Y * pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )) + : BaseType(pthis, function_to_bind) { } + + template < class X, class Y > + FastDelegate(const Y *pthis, + R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const) + : BaseType(pthis, function_to_bind) + { } + + FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )) + : BaseType(function_to_bind) { } + void operator = (const BaseType &x) { + *static_cast(this) = x; } +}; + + +#endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX + +//////////////////////////////////////////////////////////////////////////////// +// Fast Delegates, part 5: +// +// MakeDelegate() helper function +// +// MakeDelegate(&x, &X::func) returns a fastdelegate of the type +// necessary for calling x.func() with the correct number of arguments. +// This makes it possible to eliminate many typedefs from user code. +// +//////////////////////////////////////////////////////////////////////////////// + +// Also declare overloads of a MakeDelegate() global function to +// reduce the need for typedefs. +// We need seperate overloads for const and non-const member functions. +// Also, because of the weird rule about the class of derived member function pointers, +// implicit downcasts may need to be applied later to the 'this' pointer. +// That's why two classes (X and Y) appear in the definitions. Y must be implicitly +// castable to X. + +// Workaround for VC6. VC6 needs void return types converted into DefaultVoid. +// GCC 3.2 and later won't compile this unless it's preceded by 'typename', +// but VC6 doesn't allow 'typename' in this context. +// So, I have to use a macro. + +#ifdef FASTDLGT_VC6 +#define FASTDLGT_RETTYPE detail::VoidToDefaultVoid::type +#else +#define FASTDLGT_RETTYPE RetType +#endif + +//N=0 +template +FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)()) { + return FastDelegate0(x, func); +} + +template +FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)() const) { + return FastDelegate0(x, func); +} + +//N=1 +template +FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) { + return FastDelegate1(x, func); +} + +template +FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) { + return FastDelegate1(x, func); +} + +//N=2 +template +FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) { + return FastDelegate2(x, func); +} + +template +FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) { + return FastDelegate2(x, func); +} + +//N=3 +template +FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) { + return FastDelegate3(x, func); +} + +template +FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) { + return FastDelegate3(x, func); +} + +//N=4 +template +FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { + return FastDelegate4(x, func); +} + +template +FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) { + return FastDelegate4(x, func); +} + +//N=5 +template +FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { + return FastDelegate5(x, func); +} + +template +FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) { + return FastDelegate5(x, func); +} + +//N=6 +template +FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { + return FastDelegate6(x, func); +} + +template +FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) { + return FastDelegate6(x, func); +} + +//N=7 +template +FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { + return FastDelegate7(x, func); +} + +template +FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) { + return FastDelegate7(x, func); +} + +//N=8 +template +FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { + return FastDelegate8(x, func); +} + +template +FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) { + return FastDelegate8(x, func); +} + + + // clean up after ourselves... +#undef FASTDLGT_RETTYPE + +} // namespace fastdelegate + +#endif // !defined(FASTDELEGATE_H) + diff --git a/trunk/doubango/src/fastdelegate2.h b/trunk/doubango/src/fastdelegate2.h new file mode 100644 index 00000000..c991cb3f --- /dev/null +++ b/trunk/doubango/src/fastdelegate2.h @@ -0,0 +1,684 @@ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ +/* + This code comes from http://www.rsdn.ru/forum/src/1712949.1.aspx + + * I have made some changes for MinGW (GCC 4.4.0) +*/ + +#ifndef MULTICATDELEGATE_H +#define MULTICATDELEGATE_H + +#include "FastDelegate.h" + +#include +#include + +#define DEFAULT_CRITICAL_SECTION fastdelegate2::dummy_section + +using namespace fastdelegate; + +namespace fastdelegate2 +{ + namespace detail + { + typedef fastdelegate::detail::DefaultVoid DefaultVoid; + } + + class dummy_section + { + public: + void lock() const {} + void unlock() const {} + }; + + template + class auto_cs_t + { + public: + auto_cs_t(const T& refcs) : m_refcs(refcs) { m_refcs.lock(); } + ~auto_cs_t() { m_refcs.unlock(); } + private: + const T& m_refcs; + }; + + template + class default_slot + { + public: + template + void operator() (const F& func) + { + vec_results.push_back(func()); + } + const std::vector& get_results() const + { + return vec_results; + } + private: + std::vector vec_results; + }; + + template <> + class default_slot + { + public: + template + void operator() (const F& func) + { + func(); + } + }; + + namespace detail + { + template + class delegate_base + { + public: + typedef DelegateT holder_type; + + delegate_base() {} + + protected: + void connect_delegate(const holder_type& dlghld) + { + auto_cs_t lock(cs); + + if (std::find(vec_subscribers.begin(), vec_subscribers.end(), dlghld) == vec_subscribers.end()) + vec_subscribers.push_back(dlghld); + } + bool disconnect_delegate(const holder_type& dlghld) + { + auto_cs_t lock(cs); + + typename std::vector::iterator iter = std::find(vec_subscribers.begin(), vec_subscribers.end(), dlghld); + if (iter != vec_subscribers.end()) + { + vec_subscribers.erase(iter); + return true; + } + return false; + } + + CritSect cs; + std::vector vec_subscribers; + }; + + template + struct caller1 + { + caller1(const DelegateT& holder, Param1 param1) : dlgh(holder), p1(param1) {} + RetType operator() () const { return dlgh(p1); } + Param1 p1; + const DelegateT& dlgh; + }; + template + struct caller2 + { + caller2(const DelegateT& holder, Param1 param1, Param2 param2) : dlgh(holder), p1(param1), p2(param2) {} + RetType operator() () const { return dlgh(p1, p2); } + Param1 p1; Param2 p2; + const DelegateT& dlgh; + }; + template + struct caller3 + { + caller3(const DelegateT& holder, Param1 param1, Param2 param2, Param3 param3) : dlgh(holder), p1(param1), p2(param2), p3(param3) {} + RetType operator() () const { return dlgh(p1, p2, p3); } + Param1 p1; Param2 p2; Param3 p3; + const DelegateT& dlgh; + }; + template + struct caller4 + { + caller4(const DelegateT& holder, Param1 param1, Param2 param2, Param3 param3, Param4 param4) : dlgh(holder), p1(param1), p2(param2), p3(param3), p4(param4) {} + RetType operator() () const { return dlgh(p1, p2, p3, p4); } + Param1 p1; Param2 p2; Param3 p3; Param4 p4; + const DelegateT& dlgh; + }; + template + struct caller5 + { + caller5(const DelegateT& holder, Param1 param1, Param2 param2, Param3 param3, Param4 param4, Param5 param5) : dlgh(holder), p1(param1), p2(param2), p3(param3), p4(param4), p5(param5) {} + RetType operator() () const { return dlgh(p1, p2, p3, p4, p5); } + Param1 p1; Param2 p2; Param3 p3; Param4 p4; Param5 p5; + const DelegateT& dlgh; + }; + template + struct caller6 + { + caller6(const DelegateT& holder, Param1 param1, Param2 param2, Param3 param3, Param4 param4, Param5 param5, Param6 param6) : dlgh(holder), p1(param1), p2(param2), p3(param3), p4(param4), p5(param5), p6(param6) {} + RetType operator() () const { return dlgh(p1, p2, p3, p4, p5, p6); } + Param1 p1; Param2 p2; Param3 p3; Param4 p4; Param5 p5; Param6 p6; + const DelegateT& dlgh; + }; + template + struct caller7 + { + caller7(const DelegateT& holder, Param1 param1, Param2 param2, Param3 param3, Param4 param4, Param5 param5, Param6 param6, Param7 param7) : dlgh(holder), p1(param1), p2(param2), p3(param3), p4(param4), p5(param5), p6(param6), p7(param7) {} + RetType operator() () const { return dlgh(p1, p2, p3, p4, p5, p6, p7); } + Param1 p1; Param2 p2; Param3 p3; Param4 p4; Param5 p5; Param6 p6; Param7 p7; + const DelegateT& dlgh; + }; + } //detail namespace + + template< class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate0 : + detail::delegate_base< CritSect, FastDelegate0 > + { + public: + delegate0() {} + template < class X, class Y > + delegate0(const Y *pthis, RetType (X::* fn)() const) + { connect_delegate(holder_type(pthis, fn)); } + template < class X, class Y > + delegate0(Y *pthis, RetType (X::* fn)()) + { connect_delegate(holder_type(pthis, fn)); } + delegate0(RetType (*fn)()) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)() const) + { connect_delegate(holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)()) + { connect_delegate(holder_type(pthis, fn)); } + void connect(RetType (*fn)()) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)() const) + { return disconnect_delegate(holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)()) + { return disconnect_delegate(holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)()) + { return disconnect_delegate(holder_type(fn)); } + void operator() () const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(); + } + SlotT invoke() const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(*iter); + return slot; + } + }; + template< class Param1, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate1 : + detail::delegate_base< CritSect, FastDelegate1 > + { + public: + delegate1() {} + template < class X, class Y > + delegate1(const Y *pthis, RetType (X::* fn)(Param1 p1) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate1(Y *pthis, RetType (X::* fn)(Param1 p1)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + delegate1(RetType (*fn)(Param1 p1)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate1 >::holder_type(fn)); } + void operator() (Param1 p1) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1); + } + SlotT invoke(Param1 p1) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller1 >::holder_type>((*iter), p1)); + return slot; + } + }; + template< class Param1, class Param2, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate2 : + detail::delegate_base< CritSect, FastDelegate2 > + { + public: + delegate2() {} + template < class X, class Y > + delegate2(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate2(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + delegate2(RetType (*fn)(Param1 p1, Param2 p2)) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate2 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2); + } + SlotT invoke(Param1 p1, Param2 p2) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller2 >::holder_type>((*iter), p1, p2)); + return slot; + } + }; + template< class Param1, class Param2, class Param3, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate3 : + detail::delegate_base< CritSect, FastDelegate3 > + { + public: + delegate3() {} + template < class X, class Y > + delegate3(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate3(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + delegate3(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate3 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2, Param3 p3) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2, p3); + } + SlotT invoke(Param1 p1, Param2 p2, Param3 p3) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller3 >::holder_type>((*iter), p1, p2, p3)); + return slot; + } + }; + template< class Param1, class Param2, class Param3, class Param4, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate4 : + detail::delegate_base< CritSect, FastDelegate4 > + { + public: + delegate4() {} + template < class X, class Y > + delegate4(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate4(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + delegate4(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate4 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2, p3, p4); + } + SlotT invoke(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller4 >::holder_type>((*iter), p1, p2, p3, p4)); + return slot; + } + }; + template< class Param1, class Param2, class Param3, class Param4, class Param5, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate5 : + detail::delegate_base< CritSect, FastDelegate5 > + { + public: + delegate5() {} + template < class X, class Y > + delegate5(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate5(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + delegate5(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate5 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2, p3, p4, p5); + } + SlotT invoke(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller5 >::holder_type>((*iter), p1, p2, p3, p4, p5)); + return slot; + } + }; + template< class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate6 : + detail::delegate_base< CritSect, FastDelegate6 > + { + public: + delegate6() {} + template < class X, class Y > + delegate6(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate6(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + delegate6(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate6 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2, p3, p4, p5, p6); + } + SlotT invoke(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller6 >::holder_type>((*iter), p1, p2, p3, p4, p5, p6)); + return slot; + } + }; + template< class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, + class RetType=detail::DefaultVoid, + class CritSect = DEFAULT_CRITICAL_SECTION, + class SlotT=default_slot > + class delegate7 : + detail::delegate_base< CritSect, FastDelegate7 > + { + public: + delegate7() {} + template < class X, class Y > + delegate7(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + template < class X, class Y > + delegate7(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + delegate7(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { connect_delegate(holder_type(fn)); } + template < class X, class Y > + void connect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + template < class X, class Y > + void connect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + void connect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { connect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(fn)); } + template < class X, class Y > + bool disconnect(const Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + template < class X, class Y > + bool disconnect(Y *pthis, RetType (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(pthis, fn)); } + bool disconnect(RetType (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) + { return disconnect_delegate(typename detail::delegate_base< CritSect, FastDelegate7 >::holder_type(fn)); } + void operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const + { + auto_cs_t lock(this->cs); + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) (*iter)(p1, p2, p3, p4, p5, p6, p7); + } + SlotT invoke(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const + { + auto_cs_t lock(this->cs); + SlotT slot; + typename std::vector >::holder_type>::const_iterator iter = this->vec_subscribers.begin(); + for (;iter != this->vec_subscribers.end();++iter) slot(detail::caller7 >::holder_type>((*iter), p1, p2, p3, p4, p5, p6, p7)); + return slot; + } + }; + + template class delegate; + + template + class delegate< R () > + : public delegate0 + { + public: + typedef delegate0 base_type; + + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)() const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)()) : base_type(pthis, fn) {} + delegate(R (*fn)()) : base_type(fn) {} + }; + template + class delegate< R (Param1) > + : public delegate1 + { + public: + typedef delegate1 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2) > + : public delegate2 + { + public: + typedef delegate2 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2, Param3) > + : public delegate3 + { + public: + typedef delegate3 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2, Param3 p3)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2, Param3, Param4) > + : public delegate4 + { + public: + typedef delegate4 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2, Param3, Param4, Param5) > + : public delegate5 + { + public: + typedef delegate5 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2, Param3, Param4, Param5, Param6) > + : public delegate6 + { + public: + typedef delegate6 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) : base_type(fn) {} + }; + template + class delegate< R (Param1, Param2, Param3, Param4, Param5, Param6, Param7) > + : public delegate7 + { + public: + typedef delegate7 base_type; + delegate() : base_type() {} + template < class X, class Y > + delegate(const Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) : base_type(pthis, fn) {} + template < class X, class Y > + delegate(Y *pthis, R (X::* fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) : base_type(pthis, fn) {} + delegate(R (*fn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) : base_type(fn) {} + }; +} + +#endif /* MULTICATDELEGATE_H */ \ No newline at end of file diff --git a/trunk/doubango/src/pref.h b/trunk/doubango/src/pref.h index 42ba148a..144e0bdc 100644 --- a/trunk/doubango/src/pref.h +++ b/trunk/doubango/src/pref.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_PREF_H__ #define __DOUBANGO_PREF_H__ @@ -31,18 +32,23 @@ #define PREF_NAMESPACE_USE 1 #define PREF_NAMESPACE_VALUE dgo -/* doubango api funtions export */ +/** + doubango api funtions export +*/ #if defined(WIN32) || defined(__SYMBIAN32__) # ifdef DOUBANGO_EXPORTS # define DOUBANGO_API __declspec(dllexport) -# define DOUBANGO_API_C extern "C" DOUBANGO_API # else # define DOUBANGO_API __declspec(dllimport) -# define DOUBANGO_API_C # endif #else # define DOUBANGO_API -# define DOUBANGO_API_C +#endif + +#ifdef __cplusplus +# define DOUBANGO_API_C extern "C" DOUBANGO_API +#else +# define DOUBANGO_API_C extern #endif /* disable warnings */ @@ -51,7 +57,7 @@ #endif /* namespace definition*/ -#if PREF_NAMESPACE_USE +#if PREF_NAMESPACE_USE && defined(__cplusplus) # define PREF_NAMESPACE_START namespace PREF_NAMESPACE_VALUE { # define PREF_NAMESPACE_END } #else @@ -59,4 +65,7 @@ # define PREF_NAMESPACE_END #endif +/* 3GPP TS 24.229 subclause 5.1.1.2 e) */ +#define IMS_DEFAULT_EXIPRES 600000 + #endif /* __DOUBANGO_PREF_H__ */ \ No newline at end of file diff --git a/trunk/doubango/src/sip_dialog.cxx b/trunk/doubango/src/sip_dialog.cxx index 390361cc..ede362b2 100644 --- a/trunk/doubango/src/sip_dialog.cxx +++ b/trunk/doubango/src/sip_dialog.cxx @@ -1,29 +1,30 @@ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog.h" #include "api_stack.h" @@ -49,11 +50,11 @@ sip_dialog::~sip_dialog() } /* called when dialog state change*/ -void sip_dialog::OnStateChanged(SIP_STATE state) +/*void sip_dialog::OnStateChanged(SIP_STATE state) { this->state_current = state; SU_DEBUG_3(("%s::OnStateChanged ==> %d\n", this->get_sipmethod(), state)); -} +}*/ /* authenticate the supplied request*/ void sip_dialog::authenticate(nua_handle_t *nh, sip_t const *sip) diff --git a/trunk/doubango/src/sip_dialog.h b/trunk/doubango/src/sip_dialog.h index d6f7f53c..926376dd 100644 --- a/trunk/doubango/src/sip_dialog.h +++ b/trunk/doubango/src/sip_dialog.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_SM_H__ #define __DOUBANGO_DIALOG_SM_H__ @@ -48,14 +49,14 @@ public: inline nua_handle_t* get_handle() const{ return this->handle; } inline void set_handle(nua_handle_t* h) { this->handle = h; } - inline SIP_STATE get_state_current() const{ return this->state_current; } - inline void set_state_current(SIP_STATE s) { this->state_current = s; } + //inline SIP_STATE get_state_current() const{ return this->state_current; } + //inline void set_state_current(SIP_STATE s) { this->state_current = s; } inline unsigned int get_dialog_id() const{ return this->dialog_id; } virtual ERR Start() = 0; virtual ERR Stop() = 0; - virtual void OnStateChanged(SIP_STATE state); + //virtual void OnStateChanged(SIP_STATE state); virtual inline const char* get_sipmethod()const = 0; virtual inline bool get_terminated()const = 0; virtual void dialog_callback(nua_event_t event, @@ -72,7 +73,7 @@ protected: protected: nua_handle_t* handle; stack* stk; - SIP_STATE state_current; + //SIP_STATE state_current; unsigned int dialog_id; private: diff --git a/trunk/doubango/src/sip_dialog_info.cxx b/trunk/doubango/src/sip_dialog_info.cxx index 2a9d0b75..8e372197 100644 --- a/trunk/doubango/src/sip_dialog_info.cxx +++ b/trunk/doubango/src/sip_dialog_info.cxx @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_info.h" PREF_NAMESPACE_START diff --git a/trunk/doubango/src/sip_dialog_info.h b/trunk/doubango/src/sip_dialog_info.h index 56d354b8..32f975d4 100644 --- a/trunk/doubango/src/sip_dialog_info.h +++ b/trunk/doubango/src/sip_dialog_info.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_INFO_SM_H__ #define __DOUBANGO_DIALOG_INFO_SM_H__ diff --git a/trunk/doubango/src/sip_dialog_invite.cxx b/trunk/doubango/src/sip_dialog_invite.cxx index dd852d94..3ac62ccd 100644 --- a/trunk/doubango/src/sip_dialog_invite.cxx +++ b/trunk/doubango/src/sip_dialog_invite.cxx @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_invite.h" PREF_NAMESPACE_START diff --git a/trunk/doubango/src/sip_dialog_invite.h b/trunk/doubango/src/sip_dialog_invite.h index 2d594435..5e1d7f28 100644 --- a/trunk/doubango/src/sip_dialog_invite.h +++ b/trunk/doubango/src/sip_dialog_invite.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_INVITE_SM_H__ #define __DOUBANGO_DIALOG_INVITE_SM_H__ diff --git a/trunk/doubango/src/sip_dialog_message.cxx b/trunk/doubango/src/sip_dialog_message.cxx index e54204b2..942da9d6 100644 --- a/trunk/doubango/src/sip_dialog_message.cxx +++ b/trunk/doubango/src/sip_dialog_message.cxx @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_message.h" #include "api_stack.h" @@ -71,7 +72,7 @@ ERR sip_dialog_message::Stop() /* dialog state changed */ void sip_dialog_message::OnStateChanged(SIP_STATE state) { - sip_dialog::OnStateChanged(state); + //sip_dialog::OnStateChanged(state); } /* get sip method */ @@ -100,7 +101,8 @@ ERR sip_dialog_message::sendMessage() /* returns true if terminated and false otherwise*/ inline bool sip_dialog_message::get_terminated()const { - return (this->state_current == SS_MESSAGE_TERMINATED); + return false; + //return (this->state_current == SS_MESSAGE_TERMINATED); } /* dialog callback */ diff --git a/trunk/doubango/src/sip_dialog_message.h b/trunk/doubango/src/sip_dialog_message.h index 06555a3f..b03275a8 100644 --- a/trunk/doubango/src/sip_dialog_message.h +++ b/trunk/doubango/src/sip_dialog_message.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_MESSAGE_SM_H__ #define __DOUBANGO_DIALOG_MESSAGE_SM_H__ diff --git a/trunk/doubango/src/sip_dialog_options.cxx b/trunk/doubango/src/sip_dialog_options.cxx index 31a5bd9b..2b92273a 100644 --- a/trunk/doubango/src/sip_dialog_options.cxx +++ b/trunk/doubango/src/sip_dialog_options.cxx @@ -1,29 +1,30 @@ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_options.h" PREF_NAMESPACE_START diff --git a/trunk/doubango/src/sip_dialog_options.h b/trunk/doubango/src/sip_dialog_options.h index b6c26599..6d74cc9d 100644 --- a/trunk/doubango/src/sip_dialog_options.h +++ b/trunk/doubango/src/sip_dialog_options.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_OPTIONS_SM_H__ #define __DOUBANGO_DIALOG_OPTIONS_SM_H__ diff --git a/trunk/doubango/src/sip_dialog_publish.cxx b/trunk/doubango/src/sip_dialog_publish.cxx index 993b4652..7c668c17 100644 --- a/trunk/doubango/src/sip_dialog_publish.cxx +++ b/trunk/doubango/src/sip_dialog_publish.cxx @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_publish.h" #include "api_stack.h" @@ -62,15 +63,16 @@ ERR sip_dialog_publish::Start() /* stop */ ERR sip_dialog_publish::Stop() { - ERR err = (this->state_current == SS_PUBLISH_ESTABLISHED) ? - this->sendUnpublish() : this->sendCancel(); - return err; + //ERR err = (this->state_current == SS_PUBLISH_ESTABLISHED) ? + // this->sendUnpublish() : this->sendCancel(); + //return err; + return ERR_NOT_IMPLEMENTED; } /* state changed */ void sip_dialog_publish::OnStateChanged(SIP_STATE state) { - sip_dialog::OnStateChanged(state); + //sip_dialog::OnStateChanged(state); #if 1 if(this->get_terminated()) { @@ -88,7 +90,8 @@ inline const char* sip_dialog_publish::get_sipmethod()const /* returns true if terminated and false otherwise*/ inline bool sip_dialog_publish::get_terminated()const { - return (this->state_current == SS_PUBLISH_TERMINATED); + //return (this->state_current == SS_PUBLISH_TERMINATED); + return false; } /* send SIP PUBLISH request */ diff --git a/trunk/doubango/src/sip_dialog_publish.h b/trunk/doubango/src/sip_dialog_publish.h index 87bda7a8..5ca284f7 100644 --- a/trunk/doubango/src/sip_dialog_publish.h +++ b/trunk/doubango/src/sip_dialog_publish.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_PUBLISH_SM_H__ #define __DOUBANGO_DIALOG_PUBLISH_SM_H__ diff --git a/trunk/doubango/src/sip_dialog_register.cxx b/trunk/doubango/src/sip_dialog_register.cxx index 9128542f..df46b243 100644 --- a/trunk/doubango/src/sip_dialog_register.cxx +++ b/trunk/doubango/src/sip_dialog_register.cxx @@ -1,37 +1,39 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_register.h" #include "api_stack.h" +#include "strutils.h" PREF_NAMESPACE_START /* sip_dialog_register constructor*/ sip_dialog_register::sip_dialog_register(stack* stk) -:sip_dialog(stk),sm_ctx(*this) +:sip_dialog(stk),sm_ctx(*this), state_current(srs_none) { } @@ -42,13 +44,40 @@ sip_dialog_register::~sip_dialog_register() // FIXME: destroy handle } -/* start */ +/** + Initialize default parameters for initial REGISTER request according to + 3GPP TS 24.229 subclause 5.1.1.2. +*/ ERR sip_dialog_register::Start() { this->sm_ctx.enterStartState(); this->handle = nua_handle(this->stk->get_nua(), this->stk->get_home(), - SIPTAG_TO_STR(this->stk->get_realm()), TAG_END()); + SIPTAG_FROM_STR(this->stk->get_public_id()), + SIPTAG_TO_STR(this->stk->get_public_id()), + //SIPTAG_TO_STR(this->stk->get_realm()), + + NUTAG_M_DISPLAY(this->stk->get_displayname()), + SIPTAG_PRIVACY_STR(this->stk->get_privacy()), + + SIPTAG_EXPIRES_STR(itoa(this->stk->get_expires()).c_str()), + NUTAG_OUTBOUND("no-options-keepalive"), + NUTAG_OUTBOUND("no-validate"), + NUTAG_EARLY_IMS(this->stk->get_early_ims()?1:0), + //NUTAG_KEEPALIVE(0), + //NUTAG_M_FEATURES("audio;expires=20;+g.3gpp.cs-voice"), + //NUTAG_M_USERNAME("FIXME"), + NUTAG_CALLEE_CAPS(0), + SIPTAG_SUPPORTED_STR("timer, precondition, path, replaces, 100rel, gruu, outbound"), + SIPTAG_EVENT_STR("registration"), + SIPTAG_ALLOW_EVENTS_STR("presence"), + + //NUTAG_M_FEATURES("+g.3gpp.smsip;+g.3gpp.cs-voice"), + //TAG_IF(this->gsma_vs, NUTAG_M_FEATURES("+g.3gpp.cs-voice")), + + TAG_END()); + + //su_free(NULL, features); if(!this->handle) { @@ -61,19 +90,23 @@ ERR sip_dialog_register::Start() /* stop */ ERR sip_dialog_register::Stop() { - ERR err = (this->state_current == SS_REGISTER_ESTABLISHED) ? + ERR err = (this->state_current == srs_registered) ? this->sendUnregister() : this->sendCancel(); return err; } /* state changed */ -void sip_dialog_register::OnStateChanged(SIP_STATE state) +void sip_dialog_register::OnStateChanged(sip_state_registration_t state) { - sip_dialog::OnStateChanged(state); + this->state_current = state; #if 0 - if(this->get_terminated()) + switch(state) { - printf("REGISTER terminated\n"); + case srs_none: printf("sip_dialog_register: %s\n", "srs_none"); break; + case srs_trying: printf("sip_dialog_register: %s\n", "srs_trying"); break; + case srs_authentifying: printf("sip_dialog_register: %s\n", "srs_authentifying"); break; + case srs_unregistered: printf("sip_dialog_register: %s\n", "srs_unregistered"); break; + case srs_registered: printf("sip_dialog_register: %s\n", "srs_registered"); break; } #endif } @@ -87,41 +120,20 @@ inline const char* sip_dialog_register::get_sipmethod()const /* returns true if terminated and false otherwise*/ inline bool sip_dialog_register::get_terminated()const { - return (this->state_current == SS_REGISTER_TERMINATED); + return (this->state_current == srs_unregistered); } /* send SIP REGISTER request */ ERR sip_dialog_register::sendRegister() { if(!this->handle) return ERR_SIP_DIALOG_UNKNOWN; + + /* register */ + nua_register(this->handle, TAG_END()); - // FIXME: secure - bool secure = false; - char* ims_default_auth = su_sprintf(NULL, "Digest username=\"%s\",realm=\"%s\",nonce=\"\",uri=\"%s:%s\",response=\"\"", - this->stk->get_private_id(), this->stk->get_realm(), secure?"sips":"sip",this->stk->get_realm()); - - nua_register(this->handle, - SIPTAG_PRIVACY_STR(this->stk->get_privacy()), - NUTAG_OUTBOUND("no-options-keepalive"), - NUTAG_OUTBOUND("no-validate"), - NUTAG_KEEPALIVE(0), - NUTAG_M_FEATURES("audio;expires=200;+g.3gpp.cs-voice"),// FIXME - NUTAG_M_USERNAME("FIXME"), - SIPTAG_FROM_STR(this->stk->get_public_id()), - SIPTAG_TO_STR(this->stk->get_public_id()), - NUTAG_CALLEE_CAPS(0), - SIPTAG_SUPPORTED_STR("timer, precondition, path, replaces, 100rel, gruu"), - SIPTAG_EVENT_STR("registration"), - SIPTAG_ALLOW_EVENTS_STR("presence"), - TAG_IF(!this->stk->get_early_ims(), SIPTAG_AUTHORIZATION_STR(ims_default_auth)), /* 3GPP TS 24.229. See section 5.1.1 */ - - //NUTAG_M_FEATURES("+g.3gpp.smsip;+g.3gpp.cs-voice"), - //TAG_IF(this->gsma_vs, NUTAG_M_FEATURES("+g.3gpp.cs-voice")), - - TAG_END()); + /* alert state machine */ this->sm_ctx.sm_registerSent(); - su_free(NULL, ims_default_auth); return ERR_SUCCESS; } @@ -177,11 +189,19 @@ void sip_dialog_register::dialog_callback(nua_event_t _event, else if(status<600) this->sm_ctx.sm_5xx_response(); else if(status<700) this->sm_ctx.sm_6xx_response(); else this->sm_ctx.sm_xxx_response(); + + // + // Alert all subscriber that the registration state has changed + // + this->stk->registrationStateChanged(this->stk->get_id(), this->state_current, status, phrase); + break; } default: { + this->sm_ctx.sm_xxx_response(); + this->stk->registrationStateChanged(this->stk->get_id(), this->state_current, status, phrase); break; } } diff --git a/trunk/doubango/src/sip_dialog_register.h b/trunk/doubango/src/sip_dialog_register.h index 2ebb33f7..d132dce6 100644 --- a/trunk/doubango/src/sip_dialog_register.h +++ b/trunk/doubango/src/sip_dialog_register.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_REGISTER_SM_H__ #define __DOUBANGO_DIALOG_REGISTER_SM_H__ @@ -44,7 +45,6 @@ public: /* sip_dialog override*/ ERR Start(); ERR Stop(); - void OnStateChanged(SIP_STATE state); inline const char* get_sipmethod()const; inline bool get_terminated()const; void dialog_callback(nua_event_t event, @@ -53,12 +53,17 @@ public: nua_handle_t *nh, nua_hmagic_t *hmagic, sip_t const *sip, tagi_t tags[]); + + /* public methods */ + inline void OnStateChanged(sip_state_registration_t state); + private: ERR sendRegister(); ERR sendUnregister(); ERR sendCancel(); private: + sip_state_registration_t state_current; sip_dialog_registerContext sm_ctx; }; diff --git a/trunk/doubango/src/sip_dialog_subscribe.cxx b/trunk/doubango/src/sip_dialog_subscribe.cxx index 7b989d0d..2d9a827e 100644 --- a/trunk/doubango/src/sip_dialog_subscribe.cxx +++ b/trunk/doubango/src/sip_dialog_subscribe.cxx @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "sip_dialog_subscribe.h" #include "api_stack.h" @@ -67,15 +68,16 @@ ERR sip_dialog_subscribe::Start() /* stop */ ERR sip_dialog_subscribe::Stop() { - ERR err = (this->state_current == SS_SUBSCRIBE_ESTABLISHED) ? - this->sendUnsubscribe() : this->sendCancel(); - return err; + //ERR err = (this->state_current == SS_SUBSCRIBE_ESTABLISHED) ? + // this->sendUnsubscribe() : this->sendCancel(); + //return err; + return ERR_NOT_IMPLEMENTED; } /* state changed */ void sip_dialog_subscribe::OnStateChanged(SIP_STATE state) { - sip_dialog::OnStateChanged(state); + //sip_dialog::OnStateChanged(state); #if 1 if(this->get_terminated()) { @@ -93,7 +95,8 @@ inline const char* sip_dialog_subscribe::get_sipmethod()const /* returns true if terminated and false otherwise*/ inline bool sip_dialog_subscribe::get_terminated()const { - return (this->state_current == SS_SUBSCRIBE_TERMINATED); + return false; + //return (this->state_current == SS_SUBSCRIBE_TERMINATED); } /* send SIP SUBSCRIBE request */ diff --git a/trunk/doubango/src/sip_dialog_subscribe.h b/trunk/doubango/src/sip_dialog_subscribe.h index 7b0c5536..78ec01a1 100644 --- a/trunk/doubango/src/sip_dialog_subscribe.h +++ b/trunk/doubango/src/sip_dialog_subscribe.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #ifndef __DOUBANGO_DIALOG_SUBSCRIBE_SM_H__ #define __DOUBANGO_DIALOG_SUBSCRIBE_SM_H__ diff --git a/trunk/doubango/src/sm_dialog_info_sm.cxx b/trunk/doubango/src/sm_dialog_info_sm.cxx index bb39cb12..867ce423 100644 --- a/trunk/doubango/src/sm_dialog_info_sm.cxx +++ b/trunk/doubango/src/sm_dialog_info_sm.cxx @@ -6,32 +6,33 @@ */ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ #include "sip_dialog_info.h" diff --git a/trunk/doubango/src/sm_dialog_invite_sm.cxx b/trunk/doubango/src/sm_dialog_invite_sm.cxx index 80e94770..489a6b8a 100644 --- a/trunk/doubango/src/sm_dialog_invite_sm.cxx +++ b/trunk/doubango/src/sm_dialog_invite_sm.cxx @@ -6,32 +6,33 @@ */ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ #include "sip_dialog_invite.h" diff --git a/trunk/doubango/src/sm_dialog_message_sm.cxx b/trunk/doubango/src/sm_dialog_message_sm.cxx index dca0b632..a92b7848 100644 --- a/trunk/doubango/src/sm_dialog_message_sm.cxx +++ b/trunk/doubango/src/sm_dialog_message_sm.cxx @@ -6,32 +6,33 @@ */ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ #include "sip_dialog_message.h" diff --git a/trunk/doubango/src/sm_dialog_publish_sm.cxx b/trunk/doubango/src/sm_dialog_publish_sm.cxx index c02b0245..9b08d21a 100644 --- a/trunk/doubango/src/sm_dialog_publish_sm.cxx +++ b/trunk/doubango/src/sm_dialog_publish_sm.cxx @@ -6,32 +6,33 @@ */ -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ #include "sip_dialog_publish.h" diff --git a/trunk/doubango/src/sm_dialog_register_sm.cxx b/trunk/doubango/src/sm_dialog_register_sm.cxx index 61899ce0..3e57be53 100644 --- a/trunk/doubango/src/sm_dialog_register_sm.cxx +++ b/trunk/doubango/src/sm_dialog_register_sm.cxx @@ -184,7 +184,7 @@ namespace dgo { sip_dialog_register& ctxt(context.getOwner()); - ctxt.OnStateChanged(SS_REGISTER_INITIALIZED); + ctxt.OnStateChanged(srs_none); return; } @@ -203,7 +203,7 @@ namespace dgo { sip_dialog_register& ctxt(context.getOwner()); - ctxt.OnStateChanged(SS_REGISTER_TRYING); + ctxt.OnStateChanged(srs_trying); return; } @@ -321,7 +321,7 @@ namespace dgo { sip_dialog_register& ctxt(context.getOwner()); - ctxt.OnStateChanged(SS_REGISTER_ESTABLISHED); + ctxt.OnStateChanged(srs_registered); return; } @@ -396,7 +396,7 @@ namespace dgo { sip_dialog_register& ctxt(context.getOwner()); - ctxt.OnStateChanged(SS_REGISTER_AUTHENTIFYING); + ctxt.OnStateChanged(srs_authentifying); return; } @@ -464,7 +464,7 @@ namespace dgo { sip_dialog_register& ctxt(context.getOwner()); - ctxt.OnStateChanged(SS_REGISTER_TERMINATED); + ctxt.OnStateChanged(srs_unregistered); return; } diff --git a/trunk/doubango/src/sm_dialog_subscribe_sm.cxx b/trunk/doubango/src/sm_dialog_subscribe_sm.cxx index 0e093b1d..8a5d8671 100644 --- a/trunk/doubango/src/sm_dialog_subscribe_sm.cxx +++ b/trunk/doubango/src/sm_dialog_subscribe_sm.cxx @@ -5,33 +5,34 @@ * from file : sm_dialog_subscribe.sm */ - -///**************************************************************************** -// _ _ -// | | | | -// _ | | ___ _ _| | _ ____ ____ ____ ___ -// / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ -// ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | -// \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ -// (_____| -// -// Copyright (C) 2009 xxxyyyzzz -// -// This file is part of Open Source Doubango IMS Client Framework project. -// -// 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 Lesser General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with DOUBANGO. -//****************************************************************************/ + +///** +//* @file +//* @author xxxyyyzzz +//* @version 1.0 +//* +//* @section LICENSE +//* +//* +//* This file is part of Open Source Doubango IMS Client Framework project. +//* +//* 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 Lesser General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with DOUBANGO. +//* +//* @section DESCRIPTION +//* +//* +//*/ #include "sip_dialog_subscribe.h" diff --git a/trunk/doubango/src/smc_autogen.bat b/trunk/doubango/src/smc_autogen.bat index 49ccc9e2..9b35a704 100644 --- a/trunk/doubango/src/smc_autogen.bat +++ b/trunk/doubango/src/smc_autogen.bat @@ -3,12 +3,12 @@ set SMC_HOME=%ROOT_DIR%\SMC_6_0_0 set SM_DIR=%ROOT_DIR%\doubango\sm set SRC_DIR=%ROOT_DIR%\doubango\src -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_info.sm -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_invite.sm -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_message.sm -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_options.sm -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_publish.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_info.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_invite.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_message.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_options.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_publish.sm java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_register.sm -java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm +rem java -jar %SMC_HOME%\Smc.jar -c++ -suffix cxx -verbose -noex -d %SRC_DIR% %SM_DIR%\sm_dialog_subscribe.sm pause \ No newline at end of file diff --git a/trunk/doubango/src/strutils.cxx b/trunk/doubango/src/strutils.cxx new file mode 100644 index 00000000..e87d7800 --- /dev/null +++ b/trunk/doubango/src/strutils.cxx @@ -0,0 +1,39 @@ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ + +#include "strutils.h" + +#ifdef WIN32 +# define snprintf _snprintf +#endif + +std::string itoa(int64_t i){ + char buffer[30]; memset(buffer, '\0', 30); + snprintf(buffer, 30, "%lld",i); + return std::string(buffer); +} \ No newline at end of file diff --git a/trunk/doubango/src/strutils.h b/trunk/doubango/src/strutils.h new file mode 100644 index 00000000..8693b972 --- /dev/null +++ b/trunk/doubango/src/strutils.h @@ -0,0 +1,39 @@ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ + +#ifndef __DOUBANGO_STRUTILS_H__ +#define __DOUBANGO_STRUTILS_H__ + +#include "pref.h" +#include +#include +#include + +std::string itoa(int64_t i); + +#endif /* __DOUBANGO_STRUTILS_H__ */ \ No newline at end of file diff --git a/trunk/links/GStreamer_Cross_Compile_With_MinGW_In_Chroot_Environment.htm b/trunk/links/GStreamer_Cross_Compile_With_MinGW_In_Chroot_Environment.htm new file mode 100644 index 00000000..deb0fcf0 --- /dev/null +++ b/trunk/links/GStreamer_Cross_Compile_With_MinGW_In_Chroot_Environment.htm @@ -0,0 +1,418 @@ + + + + + + + +gstreamer Wiki - GStreamer_Cross_Compile_With_MinGW_In_Chroot_Environment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+ + +

GStreamer_Cross_Compile_With_MinGW_In_Chroot_Environment

+
    +
  • Edit
  • +
  • View
  • +
  • Diffs
  • +
  • Info
  • +
  • Subscribe
  • +
  • Raw
  • +
  • Print
  • +
+ +

+ + +

+

<!> A simpler method for cross compiling is described in Win32_Cross_Compiling_With_Mingw.

This document provides instructions for building native win32 gstreamer binaries. Specifically, it describes a method of using the MinGW cross compiler in chroot environment under debian linux1.

+

1. Motivation

+

Building native win32 binaries can be acheived from the comfort of your Linux box by using the mingw cross compiler. I've found, however, that some of the autoconf macros will pick-up native Linux headers/libraries installed under /usr/local or /usr. By creating a gstreamer-cross-build chroot environment it is possible to prevent this kind of mix-up and obliterate the need to pass lots of --disable-xxx to the configure script for Here are instructions on how to cross-compile gstreamer on a Debian/Linux using the MinGW cross-compiler to create win32 binaries. +

2. Creating a chroot environment

+

(!) You need to decide either to install mingw 3.4.5 compatible (such as debian etch) or the newer mingw32 4.2.1 (Ubuntu hardy) based system. You may also want to install both. See below.

/!\ The dvdreadsrc plugin compiled with mingw32 4.2.1 did not work for me (TalShalif), while the same compiled with mingw 3.4.5 worked fine (you can even copy the one you compiled on 3.4.5 to 4.2.1 and see either it will work for you too). +

2.1. Create the Debian system

+
  1. Install debootstrap
    tanaka@linux> sudo apt-get install debootstrap
  2. Create root file system
    • Ubuntu hardy (mingw32 4.2.1)

      tanaka@linux> sudo debootstrap hardy mingw-chroot
    • Debian etch (mingw32 3.4.5)

      tanaka@linux> sudo debootstrap etch mingw-chroot
  3. (optional) Add shell chroot ID to avoid confusion
    root@linux> sudo chroot mingw-chroot
    +root@linux# echo "gstreamer-mingw" > /etc/debian_chroot
    +root@linux# exit

+

2.2. Install required packages on chroot system

+

tanaka@linux> sudo chroot mingw-chroot
  1. Update /etc/apt/source.list
    • Ubuntu hardy:

      # Binary
      +deb hardy main restricted universe multiverse
      +deb hardy-updates main restricted universe multiverse
      +deb hardy-security main restricted universe multiverse
    • Debian etch: {{{deb http://ftp.us.debian.org/debian etch main contrib non-free

deb http://ftp.us.debian.org/debian etch-proposed-updates main contrib non-free }}}

  • (gstreamer-mingw)root@linux# apt-get update    
  • Install packages
    • Ubuntu hardy:

      (gstreamer-mingw)root@linux# apt-get install mingw32 dpkg-dev pkg-config wget libglib2.0-dev language-pack-en tzdata unzip libtool automake autoconf m4 gettext cvs flex bison stow wine git-core subversion
    • Debian etch:

      (gstreamer-mingw)root@linux# apt-get install mingw32 mingw32-binutils dpkg-dev pkg-config wget libglib2.0-dev bzip2 less tzdata unzip libtool automake autoconf m4 gettext cvs flex bison stow wine  git-core subversion locales-all

<!> After completing the above steps, you may find it simpler to continue your compilation using David Schleef's script, as described in Win32_Cross_Compiling_With_Mingw.

+

2.3. Move standard headers, libs, binutils out of the way

+

You don't want any of gstreamer's autoconfig macros to pick-up libraries nor headers installed on the system (i.e. /usr/lib, /usr/include):

  1. Move headers out of the way
    (gstreamer-mingw)root@linux# mkdir /usr/include/tmp && mv /usr/include/* /usr/include/tmp
  2. Move away link libraries
    (gstreamer-mingw)root@linux# mkdir /usr/lib/tmp && mv /usr/lib/*.{a,so} /usr/lib/tmp
    Against the standard practice of libxx.so.n, some runtime libraries are named libxx-n.n.so. Put them back:
    (gstreamer-mingw)root@linux# mv /usr/lib/tmp/*[0-9]*.so /usr/lib
    But, but.. except for glib libraries named libgxxx-2.0.so, which need to be moved away again:
    (gstreamer-mingw)root@linux# mv /usr/lib/libg*-2.0.so /usr/lib/tmp
  3. Replace native binutils executables with links to mingw tools
    cd /usr/bin
    +mkdir tmp
    +mv gcc ar ranlib as ld cc cpp tmp
    +for i in gcc ar ranlib as ld cc cpp; do \
    +  ln -s i586-mingw32msvc-$i $i; \
    +done
    +ln -s i586-mingw32msvc-dlltool dlltool
    +ln -s i586-mingw32msvc-dllwrap dllwrap

+

2.4. Setup normal user environment inside chroot

+

Now you would want to be able to access your gstreamer development tree and/or home directory as a normal user from inside the chroot environment:

  1. Mount host home directory
    tanaka@linux> sudo mount --bind /home mingw-chroot/home    
  2. Add/Synchronize linux host => chroot host user ID Assuming your real user name is 'tanaka' and your uid on the Linux host is 1000:

    (gstreamer-mingw)root@linux# useradd -d /home/tanaka -s /bin/bash -u 1000 tanaka
    Now you can log into your chroot system as user 'tanaka' thusly:
    tanaka@linux> sudo chroot mingw-chroot su - tanaka
    +(gstreamer-mingw)tanaka@linux:~$ id
    +=> uid=1000(tanaka) gid=1000(tanaka) groups=1000(tanaka)

+

3. Building 3rd party win32 repository

+

+

3.1. Initializing stow repository

+

mkdir -p ~/win32/stow    

Make win32 repo available as /x on both the chroot environment as well as the real host. This will enable mapping ~tanaka/win32 to drive x: on a real windows machine.

tanaka@linux> sudo ln -s ~/win32 /x
+(gstreamer-mingw)root@linux# ln -s ~tanaka/win32 /x

+

3.2. Install precompiled Win32 binaries

+

tanaka@linux> cd /x/stow

Download fromhttp://www.gtk.org/download-windows.htmland install the following:

+

3.2.1. Glib

+

cd /tmp
+wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.16/glib-2.16.5.zip
+wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.16/glib-dev-2.16.5.zip
+mkdir -p /x/stow/glib-2.16.5
+cd /x/stow/glib-2.16.5
+unzip /tmp/glib-2.16.5.zip
+unzip /tmp/glib-dev-2.16.5.zip
+find -name "*\.pc" | xargs sed -i 's,^prefix=.*$,prefix=/x,'
+cd /x/stow
+stow glib-2.16.5

+

3.2.2. Iconv

+

cd /tmp
+wget http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip
+mkdir -p /x/stow/libiconv-1.9.1
+cd /x/stow/libiconv-1.9.1
+unzip /tmp/libiconv-1.9.1.bin.woe32.zip
+cd /x/stow
+stow libiconv-1.9.1

+

3.2.3. Gettext

+

cd /tmp/
+wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip
+wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-dev-0.17-1.zip
+mkdir /x/stow/gettext-runtime-0.17-1
+cd /x/stow/gettext-runtime-0.17-1
+unzip /tmp/gettext-runtime-0.17-1.zip
+unzip /tmp/gettext-runtime-dev-0.17-1.zip
+cd /x/stow
+stow gettext-runtime-0.17-1

+

3.2.4. Directx headers

+
  • Install headers
    cd /tmp
    +wget http://www.lysator.liu.se/~peda/directx-headers/directx-headers-0.03.tar.gz
    +tar -C /x/stow -zxvf /tmp/directx-headers-0.03.tar.gz
    +cd /x/stow
    +stow directx-headers-0.03
  • Fix small header compilation error

    <!> Patch will fail unless the following is copied as-is.

    (!) This change is trivial enough to modify by hand

    cd /x/stow/directx-headers-0.03/include
    +patch <<EOF
    +--- dsound.h    2008-07-31 17:43:23.000000000 +0300
    ++++ dsound.h    2008-07-31 16:51:58.000000000 +0300
    +@@ -1138,7 +1138,7 @@
    + #ifndef _IKsPropertySet_
    + #define _IKsPropertySet_
    +
    +-typedef struct IKsPropertySet IKsPropertySet,*LPKSPROPERTYSET;
    ++typedef struct IKsPropertySet *LPKSPROPERTYSET;
    +
    + DEFINE_GUID(IID_IKsPropertySet,0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93);
    + 
    +EOF

+

3.3. Compile other 3rd party packages

+

{i} It probably won't hurt (?) to add -mthreads to CFLAGS of all compilations. Also, some net functions (e.g. getaddrinfo()) are only available if you set WindowsXP compilation compatibility:

export CFLAGS='-mthreads -D_WIN32_WINNT=0x0501 -DWINVER=0x0501'

+

3.3.1. Liboil

+

<!> There is a linking error compiling one of the examples. Use the '-k' flag to force compilation

cd /tmp
+wget http://liboil.freedesktop.org/download/liboil-0.3.15.tar.gz
+tar zxvf liboil-0.3.15.tar.gz
+cd liboil-0.3.15
+./configure --prefix=/x --host=i586-mingw32msvc
+make -k
+rm -rf /tmp/liboil-0.3.15-dist
+make -k install DESTDIR=/tmp/liboil-0.3.15-dist
+(cd /x/stow && stow -D liboil-0.3.15)
+rm -rf /x/stow/liboil-0.3.15
+mv /tmp/liboil-0.3.15-dist/x /x/stow/liboil-0.3.15
+cd /x/stow
+stow liboil-0.3.15

+

3.3.2. Libxml2

+

cd /tmp
+wget ftp://xmlsoft.org/libxml2/libxml2-2.6.31.tar.gz
+tar zxvf libxml2-2.6.31.tar.gz
+cd libxml-2.6.31
+./configure --prefix=/x --host=i586-mingw32msvc
+make
+make install DESTDIR=/tmp/libxml2-2.6.31-dist
+mv /tmp/libxml2-2.6.31-dist/x /x/stow/libxml2-2.6.31
+cd /x/stow/
+stow libxml2-2.6.31

+

3.3.3. Zlib

+
  1. Get source
    cd /tmp
    +wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz
    +tar zxvf zlib-1.2.3.tar.gz
    +cd zlib-1.2.3
  2. Configure

    {i} Zlib does not use automake/libtool

    (!) We can create and use a cross-compile libtool script doing the following:

    cat > configure.ac <<EOF
    +AC_INIT(zlib, 1.2.3)
    +
    +AC_LIBTOOL_WIN32_DLL
    +AC_PROG_LIBTOOL
    +EOF
    +libtoolize
    +aclocal
    +autoconf
    +touch install.sh
    +./configure --prefix=/x --host=i586-mingw32msvc
  3. build

    The above would have craeted a libtool script which we will use to build zlib:

    for i in adler32 compress crc32 deflate gzio infback inffast inflate inftrees trees uncompr zutil; do \
    +  ./libtool --mode=compile --tag=CC i586-mingw32msvc-gcc -O3 -Wall -mthreads -c -o $i.lo $i.c; \
    +done
    +./libtool --tag=CC --mode=link i586-mingw32msvc-gcc -version-info 1 -mthreads -o libz.la -rpath /x/lib -module  -no-undefined *.lo
  4. install Manually install required files:
    mkdir -p /x/stow/zlib-1.2.3/{bin,lib,include}
    +./libtool --mode=install /usr/bin/install -c  libz.la /x/stow/zlib-1.2.3/lib/libz.la
    +(cd /x/stow/zlib-1.2.3/bin && ln -s ../lib/*.dll .)
    +cp zlib.h zconf.h /x/stow/zlib-1.2.3/include
    +cd /x/stow
    +stow zlib-1.2.3

+

3.3.4. Libpng

+

cd /tmp
+wget http://prdownloads.sourceforge.net/libpng/libpng-1.2.29.tar.bz2
+tar jxvf libpng-1.2.29.tar.bz2
+cd libpng-1.2.29
+LDFLAGS=-L/x/lib CFLAGS=-I/x/include PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
+make
+make -k install DESTDIR=/tmp/libpng-1.2.29-dist
+mv /tmp/libpng-1.2.29-dist/x/ /x/stow/libpng-1.2.29
+cd /x/stow/
+stow libpng-1.2.29

+

3.3.5. Libogg

+

/!\ Could not compile under mingw 3.4.5

cd /tmp
+wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
+tar zxvf libogg-1.1.3.tar.gz
+cd libogg-1.1.3
+./configure --prefix=/x --host=i586-mingw32msvc
+make
+make  install DESTDIR=/tmp/libogg-1.1.3-dist
+mv /tmp/libogg-1.1.3-dist/x /x/stow/libogg-1.1.3
+cd /x/stow
+stow libogg-1.1.3

+

3.3.6. Libvorbis

+

cd /tmp
+wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
+cd libvorbis-1.2.0
+PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
+make LDFLAGS='-L/x/lib -logg' -k
+make LDFLAGS='-L/x/lib -logg' -k install DESTDIR=/tmp/libvorbis-1.2.0-dist
+mv /tmp/libvorbis-1.2.0-dist/x /x/stow/libvorbis-1.2.0
+cd /x/stow
+stow libvorbis-1.2.0

+

3.3.7. a52dec

+
  • Get source
    cd /tmp
    +wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
    +tar zxvf a52dec-0.7.4.tar.gz
    +cd a52dec-0.7.4
  • To create a shared DLL you need to update configure using the latest autotools
    autoheader
    +aclocal
    +libtoolize --force
    +autoconf
    +automake --add-missing
  • Then run configure as usual:
    PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc --enable-shared
    +make
    +make install DESTDIR=/tmp/a52dec-0.7.4-dist
    +mv /tmp/a52dec-0.7.4-dist/x /x/stow/a52dec-0.7.4
    +cd /x/stow
    +stow a52dec-0.7.4  

+

3.3.8. mpeg2dec

+

cd /tmp/
+wget http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz
+tar zxvf libmpeg2-0.5.1.tar.gz
+cd libmpeg2-0.5.1
+PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc  --enable-shared
+make
+make install DESTDIR=/tmp/libmpeg2-0.5.1-dist
+mv /tmp/libmpeg2-0.5.1-dist/x /x/stow/libmpeg2-0.5.1
+cd /x/stow/
+stow libmpeg2-0.5.1

+

3.3.9. Libdvdread/Libdvdnav

+

/!\ There are some problems compiling/linking against libdvdread on mingw32 4.2.1 (TalShalif).

{i} libdvdnav contains a copy of libdvdread. The latest libdvdnav from mplayer seems to include also all the latest dvdread patches. It also does not hard-code dependancy on libdvdcss.

<!> use make -k due to link error in an unused library

cd /tmp
+wget http://www7.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdnav-4.1.2.tar.gz
+tar zxvf libdvdnav-4.1.2.tar.gz
+cd libdvdnav-4.1.2
+./autogen.sh noconfig
+PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
+make -k
+make -k install DESTDIR=/tmp/libdvdnav-4.1.2-dist
+mv /tmp/libdvdnav-4.1.2-dist/x /x/stow/libdvdnav-4.1.2
+cd /x/stow
+stow libdvdnav-4.1.2

+

3.3.10. Libdvdcss

+

{i} There is no compilation-time dependancy on libdvdcss. However, libdvdread looks for a runtime DLL libdvdcss.dll in order to read encrypted DVDs

  1. Download and upack code
    cd /tmp
    +wget http://download.videolan.org/pub/libdvdcss/1.2.9/libdvdcss-1.2.9.tar.bz2
    +tar jxvf libdvdcss-1.2.9.tar.bz2
  2. Configure
    cd libdvdcss-1.2.9
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc  --enable-shared
  3. Force creation of a DLL using our libtool hack
    sed -i 's,build_libtool_libs=no,build_libtool_libs=yes,' libtool
    +make
  4. Install
    make install DESTDIR=/tmp/libdvdcss-1.2.9-dist
    +mv /tmp/libdvdcss-1.2.9-dist/x /x/stow/libdvdcss-1.2.9
  5. crete libdvdcss.dll:

    cd /x/stow/libdvdcss-1.2.9/bin
    +ln -s libdvdcss-2.dll libdvdcss.dll
  6. stow
    cd /x/stow
    +stow libdvdcss-1.2.9

+

4. Building gstreamer

+

{i} If you want gstreamer's net features, you would need to set WindowsXP compilation compatibility. Put:

  • export CFLAGS='-mthreads -D_WIN32_WINNT=0x0501 -DWINVER=0x0501'

    before running the configure script under the chroot environment

<!> The chroot environment should really be used only to cross-compile gstreamer. Develop and manage your gstreamer sources under your home directory and chroot into 'gstreamer-mingw' only to run 'configure' and 'make' to build and install. If you have not done so already, on the linux host, get the gstreamer source and generate the configuration script under each component. For example:

  • Get source
    mkdir -p ~/src/gstreamer-dev
    +cd ~/src/gstreamer-dev
    +cvs -d :pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gstreamer
    +cvs -d :pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-base
    +cvs -d :pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-good
    +cvs -d :pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-bad
    +cvs -d :pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-ugly
  • Generate the configure script
    cd ~/src/gstreamer-dev/
    +(cd gstreamer && NOCONFIGURE=1 ./autogen.sh)
    +(cd gst-plugins-base && NOCONFIGURE=1 ./autogen.sh)
    +(cd gst-plugins-good && NOCONFIGURE=1 ./autogen.sh)
    +(cd gst-plugins-bad && NOCONFIGURE=1 ./autogen.sh)
    +(cd gst-plugins-ugly && NOCONFIGURE=1 ./autogen.sh)

+

4.1. gstreamer

+

(!) gstreamer and gst-* have -Werror in CFLAGS, so some win32-specific compilation warnings will cause make to fail. You can try running make ERROR_CFLAGS="-Wall -Wdeclaration-after-statement -fno-strict-aliasing" to ignore such warnings.

(!) Under 'gstreamer-mingw' chroot:

  • configure
    cd ~/src/gstreamer-dev/gstreamer
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
  • build
    make
  • install
    ver=`date +%Y%m%d`
    +name=gstreamer
    +rm -rf /tmp/${name}-${ver}-dist
    +make DESTDIR=/tmp/${name}-${ver}-dist install
    +(cd /x/stow && stow -D ${name}-*)
    +rm -rf /x/stow/${name}-${ver}
    +mv /tmp/${name}-${ver}-dist/x /x/stow/${name}-${ver}
    +cd /x/stow/
    +stow ${name}-${ver}

+

4.2. gst-plugins-base

+

{i} compile and install 3rd party libogg, libvorbis if you want these plugins to be installed.

(!) Under 'gstreamer-mingw' chroot:

  • configure
    cd ~/src/gstreamer-dev/gst-plugins-base
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
  • build
    make
  • install
    ver=`date +%Y%m%d`
    +make install DESTDIR=/tmp/gst-plugins-base-${ver}-dist
    +mv /tmp/gst-plugins-base-${ver}-dist/x /x/stow/gst-plugins-base-${ver}
    +cd /x/stow/
    +stow gst-plugins-base-${ver}

+

4.3. gst-plugins-good

+

{i} you will need to install the directx headers to compile the directvideosink and directaudiosink.

(!) Under 'gstreamer-mingw' chroot:

  • configure
    cd ~/src/gstreamer-dev/gst-plugins-good
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
  • build
    make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing'
  • install
    ver=`date +%Y%m%d`
    +make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing' install DESTDIR=/tmp/gst-plugins-good-${ver}-dist
    +mv /tmp/gst-plugins-good-${ver}-dist/x /x/stow/gst-plugins-good-${ver}
    +cd /x/stow/
    +stow gst-plugins-good-${ver}

+

4.4. gst-plugins-bad

+

(!) Under 'gstreamer-mingw' chroot:

  • configure
    cd ~/src/gstreamer-dev/gst-plugins-bad
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
  • build
    make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing'
  • instal
    ver=`date +%Y%m%d`
    +make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing' install DESTDIR=/tmp/gst-plugins-bad-${ver}-dist
    +mv /tmp/gst-plugins-bad-${ver}-dist/x /x/stow/gst-plugins-bad-${ver}
    +cd /x/stow/
    +stow gst-plugins-bad-${ver}

+

4.5. gst-plugins-ugly

+

/!\ The dvdreadsrc plugin compiled with mingw32 4.2.1 did not work for me (TalShalif), while the same compiled with mingw 3.4.5 worked fine (you can even copy the one you compiled on 3.4.5 to 4.2.1 and see either it will work for you too).

(!) Under 'gstreamer-mingw' chroot:

  • configure
    cd ~/src/gstreamer-dev/gst-plugins-ugly
    +PKG_CONFIG_PATH=/x/lib/pkgconfig ./configure --prefix=/x --host=i586-mingw32msvc
  • build
    make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing'
  • install
    ver=`date +%Y%m%d`
    +make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing' install DESTDIR=/tmp/gst-plugins-ugly-${ver}-dist
    +mv /tmp/gst-plugins-ugly-${ver}-dist/x /x/stow/gst-plugins-ugly-${ver}
    +cd /x/stow/
    +stow gst-plugins-ugly-${ver}

+

5. Plugin specific build problems

+

(!) You can try to disable plugins which break your build with --disable-xx - run ./configure --help for more details

{i} Some plugins will not be built for reasons such as faulty shared library dependancy detection. You can always go directly to the plugin sub-directory and run make there to build that particular plugin. You will need to manually copy the result DLL file to /x/stow/gst-plugins-xxx-vvv/lib/gstreamer-0.10 and run stow --restow on gst-plugins-xxx-vvv. Look at the directdraw/directsound example below - you may or may not need to use the forcedll-libtool hack. +

5.1. directdraw, directsound

+

libtool refuses to create the plugin DLLs for directdraw and directsound - both under gst-plugins-good. I have managed to force-create those using the following (the following example is for directdraw, but the same methodology applies to directsound):

  1. The following changes to ltmain.sh will force libtool to at least go through the steps of making the DLLs:
    cd ~/src/gstreamer-dev/gst-plugins-good
    +sed 's,build_libtool_libs=no,build_libtool_libs=yes,' < libtool > forcedll-libtool
  2. rebuild directdraw usgin forcedll-libtool
    cd ~/src/gstreamer-dev/gst-plugins-good/sys/directdraw
    +make clean
    +make ERROR_CFLAGS='-Wall -Wdeclaration-after-statement -fno-strict-aliasing'
  3. re-ran manually the last libtool link phase replacing ../../libtool with ../../forcedll-libtool: e.g.
    /bin/bash ../../libtool --tag=CC --mode=link i586-mingw32msvc-gcc  -g -O2   -o libgstdirectdrawsink.la -rpath /x/lib/gstreamer-0.10 -module -avoid-version -export-symbols-regex '^_*gst_plugin_desc$' -no-undefined libgstdirectdrawsink_la-gstdirectdrawsink.lo libgstdirectdrawsink_la-gstdirectdrawplugin.lo -lddraw -ldxguid -lgdi32 -L/x/lib -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lintl   -L/x/lib -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lintl   -lgstvideo-0.10 -lgstinterfaces-0.10
    with:
    /bin/bash ../../forcedll-libtool --tag=CC --mode=link i586-mingw32msvc-gcc  -g -O2   -o libgstdirectdrawsink.la -rpath /x/lib/gstreamer-0.10 -module -avoid-version -export-symbols-regex '^_*gst_plugin_desc$' -no-undefined libgstdirectdrawsink_la-gstdirectdrawsink.lo libgstdirectdrawsink_la-gstdirectdrawplugin.lo -lddraw -ldxguid -lgdi32 -L/x/lib -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lintl   -L/x/lib -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lintl   -lgstvideo-0.10 -lgstinterfaces-0.10
  4. Ran manually the final from the above output gcc link command appending the missing library libtool complains it can not find (-ldxguid in directdraw's case): e.g. replace:
    i586-mingw32msvc-gcc -shared .libs/libgstdirectdrawsink.dll.def  .libs/libgstdirectdrawsink_la-gstdirectdrawsink.o .libs/libgstdirectdrawsink_la-gstdirectdrawplugin.o  -lddraw -lgdi32 -L/x/lib /x/lib/libgstbase-0.10.dll.a /x/lib/libgstreamer-0.10.dll.a -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 /x/lib/libxml2.dll.a -lglib-2.0 -lintl /x/lib/libgstvideo-0.10.dll.a /x/lib/libgstinterfaces-0.10.dll.a  -o .libs/libgstdirectdrawsink.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgstdirectdrawsink.dll.a
    with:
    i586-mingw32msvc-gcc -shared .libs/libgstdirectdrawsink.dll.def  .libs/libgstdirectdrawsink_la-gstdirectdrawsink.o .libs/libgstdirectdrawsink_la-gstdirectdrawplugin.o  -lddraw -lgdi32 -L/x/lib /x/lib/libgstbase-0.10.dll.a /x/lib/libgstreamer-0.10.dll.a -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 /x/lib/libxml2.dll.a -lglib-2.0 -lintl /x/lib/libgstvideo-0.10.dll.a /x/lib/libgstinterfaces-0.10.dll.a  -o .libs/libgstdirectdrawsink.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgstdirectdrawsink.dll.a -ldxguid
  5. Copy DLL to plugin directory
    cp .libs/*.dll /x/stow/gst-plugins-good-${ver}/lib/gstreamer-0.10
    +cd /x/stow
    +stow --restow gst-plugins-good-${ver}

+

5.2. dvdread

+

configure disabled this plugin due to libdvdread detection failure. When manually compiling this plugin I had to re-ran manually the last libtool --tag=CC --mode=link command with -dvdread appended. +

5.3. a52

+

I had to re-ran manually the last libtool --tag=CC --mode=link command with -a52 appended. +

6. Testing

+

+

6.1. Using wine

+

(!) Do this on your real linux machine.

Install wine and try to run some simple pipelines:

  • Install the wine package
    sudo apt-get install wine
  • Run a pipeline
    cd /x/bin
    +wine ./gst-launch-0.10.exe fakesrc ! fakesink
    +wine ./gst-launch-0.10.exe audiotestsrc ! directsoundsink
    +wine ./gst-launch-0.10.exe videotestsrc ! directdrawsink

+

6.2. On a real MS Windows machine

+

(!) you need to configure samba with user home directory accsess on your linux machine.

Suposing your Linux machine IP address is 10.0.0.1:

  • log onto your windows machine:
    • Map \\10.0.0.1\tanaka to drive X:
  • Run a command shell:
    C:\> X:
    +X:\bin>gst-launch-0.10.exe --gst-plugin-path=x:/lib/gstreamer-0.10 fakesrc ! fakesink
    +X:\bin>gst-launch-0.10.exe --gst-plugin-path=x:/lib/gstreamer-0.10 videotestsrc ! directdrawsink
    Or if you have MSYS:
    $ cd /x/bin
    +$ gst-launch-0.10.exe --gst-plugin-path=x:/lib/gstreamer-0.10 fakesrc ! fakesink

Other pipelines to try:

x:/bin/gst-launch-0.10.exe --gst-plugin-path=x:/lib/gstreamer-0.10 dvdreadsrc device=e: ! queue ! dvddemux name=demux .current_video ! queue ! mpeg2dec ! ffmpegcolorspace ! directdrawsink demux.current_audio ! queue ! a52dec ! audioconvert ! directsoundsink
  1. I am running Ubuntu 8.04.1 (1)

+ + + + + + + + + + diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.c b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.c index 73bbc84c..2606e4fa 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.c +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.c @@ -26,6 +26,7 @@ * @brief REGISTER and registrations * * @author Pekka Pessi + * @author xxxyyyzzz * * @date Created: Wed Mar 8 11:48:49 EET 2006 ppessi */ @@ -140,6 +141,7 @@ int nua_stack_set_defaults(nua_handle_t *nh, NHP_SET(nhp, invite_enable, 1); NHP_SET(nhp, auto_alert, 0); NHP_SET(nhp, early_media, 0); + NHP_SET(nhp, early_ims, 0); NHP_SET(nhp, only183_100rel, 0); NHP_SET(nhp, auto_answer, 0); NHP_SET(nhp, auto_ack, 1); @@ -277,10 +279,13 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags) * NUTAG_CALLEE_CAPS() \n * NUTAG_DETECT_NETWORK_UPDATES() \n * NUTAG_EARLY_ANSWER() \n + * NUTAG_EARLY_IMS() \n * NUTAG_EARLY_MEDIA() \n * NUTAG_ENABLEINVITE() \n * NUTAG_ENABLEMESSAGE() \n * NUTAG_ENABLEMESSENGER() \n + * NUTAG_IMPI() \n + * NUTAG_IMPU() \n * NUTAG_INITIAL_ROUTE() \n * NUTAG_INITIAL_ROUTE_STR() \n * NUTAG_INSTANCE() \n @@ -593,7 +598,7 @@ int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e, } -/** Parse parameters from tags to @a nhp or @a ngp. +/** Parse parameters from @a tags to @a nhp or @a ngp. * * @param home allocate new values from @a home * @param nhp structure to store handle preferences @@ -701,6 +706,23 @@ static int nhp_set_tags(su_home_t *home, if (tag == NULL) break; + + /* NUTAG_EARLY_IMS(early_ims) */ + else if (tag == nutag_early_ims) { + NHP_SET(nhp, early_ims, value != 0); + } + /* NUTAG_IMPI(impi) */ + else if (tag == nutag_impi) { + NHP_SET_STR(nhp, impi, value); + } + /* NUTAG_IMPU() */ + else if (tag == nutag_impu) { + NHP_SET_STR_BY_URL(nhp, url_string_t, impu, value); + } + /* NUTAG_REALM(realm) */ + else if (tag == nutag_realm) { + NHP_SET_STR(nhp, realm, value); + } /* NUTAG_RETRY_COUNT(retry_count) */ else if (tag == nutag_retry_count) { NHP_SET(nhp, retry_count, (unsigned)value); @@ -1462,6 +1484,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags) * NUTAG_DETECT_NETWORK_UPDATES() \n * NUTAG_EARLY_ANSWER() \n * NUTAG_EARLY_MEDIA() \n + * NUTAG_EARLY_IMS() \n * NUTAG_ENABLEINVITE() \n * NUTAG_ENABLEMESSAGE() \n * NUTAG_ENABLEMESSENGER() \n @@ -1637,6 +1660,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e, TIF(NUTAG_AUTOALERT, auto_alert), TIF(NUTAG_EARLY_ANSWER, early_answer), TIF(NUTAG_EARLY_MEDIA, early_media), + TIF(NUTAG_EARLY_IMS, early_ims), TIF(NUTAG_ONLY183_100REL, only183_100rel), TIF(NUTAG_AUTOANSWER, auto_answer), TIF(NUTAG_AUTOACK, auto_ack), diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.h b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.h index 06dca166..67e20093 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.h +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_params.h @@ -31,6 +31,7 @@ * * @author Pekka Pessi * @author Kai Vehmanen + * @author xxxyyyzzz * * @date Created: Wed Mar 8 11:38:18 EET 2006 ppessi */ @@ -96,6 +97,8 @@ struct nua_handle_preferences /* Preferences for registration (and dialog establishment) */ unsigned nhp_callee_caps:1; /**< Add callee caps to contact */ unsigned nhp_media_features:1;/**< Add media features to caps*/ + /** Enable Early IMS security */ + unsigned nhp_early_ims:1; /** Enable Service-Route */ unsigned nhp_service_route_enable:1; /** Enable Path */ @@ -141,6 +144,15 @@ struct nua_handle_preferences /** Next hop URI (used instead of route). */ url_string_t *nhp_proxy; + /** IMS Private Identifier */ + char const *nhp_impi; + + /** IMS Public Identifier */ + url_string_t *nhp_impu; + + /** Default realm (IMS initial register) */ + char const *nhp_realm; + union { struct { /* A bit for each feature set by application */ /* NOTE: @@ -173,6 +185,7 @@ struct nua_handle_preferences unsigned nhb_message_auto_respond:1; unsigned nhb_callee_caps:1; unsigned nhb_media_features:1; + unsigned nhb_early_ims:1; unsigned nhb_service_route_enable:1; unsigned nhb_path_enable:1; unsigned nhb_auth_cache:1; @@ -185,6 +198,10 @@ struct nua_handle_preferences unsigned nhb_registrar:1; unsigned :0; /* at most 32 bits before this point */ + unsigned nhb_impi:1; + unsigned nhb_impu:1; + unsigned nhb_realm:1; + unsigned nhb_allow:1; unsigned nhb_supported:1; @@ -201,7 +218,7 @@ struct nua_handle_preferences unsigned nhb_appl_method:1; unsigned nhb_initial_route:1; unsigned nhb_proxy:1; - unsigned :0; + unsigned :0; /* padding */ } set_bits; unsigned set_unsigned[2]; } nhp_set_; diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_stack.c b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_stack.c index ccf9a8f4..3af5ea73 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_stack.c +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_stack.c @@ -2720,6 +2720,16 @@ int nua_client_request_sendmsg(nua_client_request_t *cr, msg_t *msg, sip_t *sip) return -1; } + /**For Initial REGISTER we must add default authentication if no erlyIMS as per + 3GPP TS 24.229 subclause 5.1.1.2.2. We must add tags for privateid and publicid + */ + if(cr->cr_method == sip_method_register && !NH_PGET(nh, early_ims)) + { + char* auth = su_sprintf(0,"Digest username=\"%s\", realm=\"%s\", nonce=\"\", response=\"\", uri=\""URL_FORMAT_STRING"\"", + NH_PGET(nh, impi), NH_PGET(nh, realm), URL_PRINT_ARGS(sip->sip_request->rq_url)); + sip_add_make(msg, sip, sip_authorization_class, auth); + su_free(0, auth); + } cr->cr_wait_for_cred = 0; if (cr->cr_methods->crm_send) diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag.c b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag.c index b519d430..1166b32e 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag.c +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag.c @@ -26,6 +26,7 @@ * * @author Pekka Pessi * @author Martti Mela + * @author xxxyyyzzz * * @date Created: Wed Feb 21 10:13:29 2001 ppessi */ @@ -414,6 +415,96 @@ tag_typedef_t nutag_callee_caps = BOOLTAG_TYPEDEF(callee_caps); * Reference tag for NUTAG_CALLEE_CAPS(). */ +/**@def NUTAG_IMPU(x) +* Set the IP Multimedia Public Identity (sip or tel uri). This uri is publicly published and can be +* seen as your sip adress. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* url_string_t const * (either char const * or url_t *) +* +* @par Values +* - SIP URI +* - TEL URI +* +* Corresponding tag taking reference parameter is NUTAG_IMPU_REF(). +*/ +tag_typedef_t nutag_impu = URLTAG_TYPEDEF(impu); + +/**@def NUTAG_IMPU_REF(x) + * Reference tag for NUTAG_IMPU(). + */ + +/**@def NUTAG_IMPI(x) +* Set the IP Multimedia Private Identity. This private user identity associated to the user's IMPUs. +* For basic sip clients (no IMS) you should fill this field with your authentication user name. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* char const * +* +* @par Values +* - Any +* +* Corresponding tag taking reference parameter is NUTAG_IMPI_REF(). +*/ +tag_typedef_t nutag_impi = STRTAG_TYPEDEF(impi); + +/**@def NUTAG_IMPI_REF(x) + * Reference tag for NUTAG_IMPI(). + */ + +/**@def NUTAG_REALM(x) +* In IMS context we must set the realm in the initial first REGISTER request as per +* 3GPP TS 24.229 subclause 5.1.1.2. This mean that we don't wait for the 401/407 response to provide credentials. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* char const * +* +* @par Values +* - Any +* +* Corresponding tag taking reference parameter is NUTAG_REALM_REF(). +*/ +tag_typedef_t nutag_realm = STRTAG_TYPEDEF(realm); + +/**@def NUTAG_REALM_REF(x) + * Reference tag for NUTAG_REALM(). + */ + +/**@def NUTAG_EARLY_IMS(x) +* Activate/deactivate early IMS security as per 3GPP TS 33.978. +* You may activate this option if you are using the stack as basic sip engine without IMS +* security features. +* +*@par Used with +* -nua_register(), nua_create(), nua_set_params(), nua_get_params() +* +*@par Parameter type +* +* int (boolean: nonzero is true, zero is false) +* +* @par Values +* - 0 (false) - use normal IMS security mechanisms as per 3GPP TS 33.203 +* - 1 (true) - try to use early IMS as per 3GPP TS 33.978 instead of default IMS security (3GPP TS 33.203) +* +* Corresponding tag taking reference parameter is NUTAG_EARLY_IMS_REF(). +*/ +tag_typedef_t nutag_early_ims = BOOLTAG_TYPEDEF(early_ims); + +/**@def NUTAG_EARLY_IMS_REF(x) + * Reference tag for NUTAG_EARLY_IMS(). + */ /**@def NUTAG_EARLY_MEDIA(x) * diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_dll.c b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_dll.c new file mode 100644 index 00000000..6862fb78 --- /dev/null +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_dll.c @@ -0,0 +1,3555 @@ +#ifdef _WIN32 +/* + * PLEASE NOTE: + * + * This file is automatically generated by tag_dll.awk. + * It contains magic required by Win32 DLLs to initialize + * tag_typedef_t variables. + * + * Do not, repeat, do not edit this file. Edit 'nua_tag.c' instead. + * + */ + +#define EXPORT __declspec(dllexport) + +/* + * This file is part of the Sofia-SIP package + * + * Copyright (C) 2005 Nokia Corporation. + * + * Contact: Pekka Pessi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +/**@CFILE nua_tag.c Tags and tag lists for NUA + * + * @author Pekka Pessi + * @author Martti Mela + * @author xxxyyyzzz + * + * @date Created: Wed Feb 21 10:13:29 2001 ppessi + */ + +#include "config.h" + +#undef TAG_NAMESPACE +#define TAG_NAMESPACE "nua" + +#define TAG_NAMESPACE "nua" + +#include "sofia-sip/nua_tag.h" + +#include +#include +#include +#include +#include + +/** @page nua_api_overview NUA API Overview + * + * This page shortly overviews the NUA API: different functions, tags, and + * where and how they affect the working of NUA engine. + * + * The application and the NUA engine can pass various parameters between + * them using tagged arguments. Tagged arguments can be used like named + * arguments in higher-lever language. + * + * @par NUA Agent + * + * The NUA agent object is created with nua_create(). The nua_create() also + * creates the transports and binds the transport sockets used by the SIP + * stack. + * + * The special tags controlling the transports are + * - NUTAG_URL(), NUTAG_SIPS_URL(), NUTAG_CERTIFICATE_DIR(), NUTAG_SIP_PARSER() + * + * See nta_agent_add_tport() for discussion about magic URIs used to + * initialize transports. + * + * The agent-wide parameter can be later modified or obtained with + * nua_set_params() and nua_get_params(), respectively. + * + * The #su_root_t mainloop integration uses + * - su_root_create(), su_root_threading(), + * su_root_poll(), su_root_run(), su_root_break() + * + * @par NUA Handles + * - nua_handle(), nua_get_hparams(), nua_set_hparams() + * - nua_handle_home(), nua_handle_has_invite(), nua_handle_has_subscribe(), + * nua_handle_has_register(), nua_handle_has_active_call(), + * nua_handle_has_call_on_hold(), nua_handle_has_events(), + * nua_handle_has_registrations(), nua_handle_remote(), and + * nua_handle_local(). + * - Settings: + * See nua_set_hparams(). There are a few "sticky" headers that are used + * on subsequent requests if given on any handle-specific call: + * - @Contact, @UserAgent, @Supported, @Allow, @Organization + * + * @par Client Generating SIP Requests + * - nua_register(), nua_unregister(), nua_invite(), nua_cancel(), + * nua_ack(), nua_bye(), nua_options(), nua_refer(), nua_publish(), + * nua_unpublish(), nua_prack(), nua_info(), nua_update(), nua_message(), + * nua_subscribe(), nua_unsubscribe(), nua_notify(), nua_method() + * - NUTAG_URL() + * Settings: + * - NUTAG_RETRY_COUNT(), NUTAG_PROXY(), + * NUTAG_INITIAL_ROUTE() and NUTAG_INITIAL_ROUTE_STR() + * - NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() + * - NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR() + * - NUTAG_USER_AGENT(), SIPTAG_USER_AGENT() and SIPTAG_USER_AGENT_STR() + * - SIPTAG_ORGANIZATION() and SIPTAG_ORGANIZATION_STR() + * + * @par Client Authenticating Requests + * - nua_authenticate(), #nua_r_authenticate + * - NUTAG_AUTH(), NUTAG_AUTH_CACHE() + * + * @par Server Processing Received SIP Requests + * - nua_respond(), NUTAG_WITH_THIS(), NUTAG_WITH_SAVED(), NUTAG_WITH() + * - #nua_i_invite, #nua_i_cancel, #nua_i_ack, #nua_i_bye, + * #nua_i_options, #nua_i_refer, #nua_i_publish, #nua_i_prack, + * #nua_i_info, #nua_i_update, #nua_i_message, #nua_i_subscribe, + * #nua_i_notify, #nua_i_method, #nua_i_register + * Settings: + * - NUTAG_APPL_METHOD(), NUTAG_PROXY() + * - NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() + * - NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR() + * + * @par Registrations and Contact Header Generation + * - nua_register(), #nua_r_register(), #nua_i_outbound, + * nua_unregister(), and #nua_r_unregister + * Settings: + * - NUTAG_CALLEE_CAPS() + * - NUTAG_DETECT_NETWORK_UPDATES() + * - NUTAG_INSTANCE() + * - NUTAG_KEEPALIVE() + * - NUTAG_KEEPALIVE_STREAM() + * - NUTAG_M_DISPLAY() + * - NUTAG_M_FEATURES() + * - NUTAG_M_PARAMS() + * - NUTAG_M_USERNAME() + * - NUTAG_OUTBOUND() + * - NUTAG_PATH_ENABLE() + * - NUTAG_SERVICE_ROUTE_ENABLE() + * Specifications: + * - @RFC3261 section 10, @RFC3327, @RFC3608, @RFC3680, @RFC3840, + * draft-ietf-sip-outbound, draft-ietf-sip-gruu-14 + * + * @par INVITE Sessions and Call Model + * - nua_invite(), #nua_r_invite, #nua_i_invite + * - nua_handle_has_active_call(), nua_handle_has_call_on_hold(), + * nua_handle_has_invite() + * - nua_cancel(), #nua_r_cancel, #nua_i_cancel + * - nua_ack(), #nua_i_ack + * - nua_bye(), #nua_r_bye, #nua_i_bye + * - #nua_i_state, NUTAG_CALLSTATE(), + * NUTAG_OFFER_SENT(), NUTAG_OFFER_RECV(), NUTAG_ANSWER_RECV(), and + * NUTAG_ANSWER_SENT(), SOATAG_REMOTE_SDP(), SOATAG_REMOTE_SDP_STR(), + * SOATAG_LOCAL_SDP(), SOATAG_LOCAL_SDP_STR() + * Settings: + * - NUTAG_AUTOACK(), NUTAG_AUTOALERT(), NUTAG_AUTOANSWER(), + * NUTAG_ENABLEINVITE(), NUTAG_INVITE_TIMER(), NUTAG_MEDIA_ENABLE(), + * SOATAG_USER_SDP(), SOATAG_USER_SDP_STR(), SOATAG_CAPS_SDP(), + * SOATAG_CAPS_SDP_STR() + * Specifications: + * - @RFC3261, @RFC3264 + * + * @par In-Session Information requests + * - nua_info() #nua_r_info, #nua_i_info + * Settings: + * - NUTAG_ALLOW("INFO"), NUTAG_APPL_METHOD("INFO") + * + * @par SDP Processing + * - #nua_i_state, SOATAG_ACTIVE_AUDIO(), SOATAG_ACTIVE_VIDEO(), + * SOATAG_ACTIVE_IMAGE(), SOATAG_ACTIVE_CHAT(), + * SOATAG_REMOTE_SDP(), SOATAG_REMOTE_SDP_STR(), + * SOATAG_LOCAL_SDP(), SOATAG_LOCAL_SDP_STR() + * Settings: + * - NUTAG_MEDIA_ENABLE(), NUTAG_SOA_NAME(), NUTAG_EARLY_ANSWER(), + * SOATAG_USER_SDP(), SOATAG_USER_SDP_STR(), SOATAG_CAPS_SDP(), + * SOATAG_CAPS_SDP_STR() + * Specifications: + * - @RFC3264 + * + * @par Call Model Extensions ("100rel" and "precondition") + * Early + * - nua_prack(), #nua_r_prack, #nua_i_prack + * - nua_update() #nua_r_update, #nua_i_update + * Settings: + * - NUTAG_EARLY_MEDIA(), NUTAG_ONLY183_100REL() + * - "100rel" or "precondition" in NUTAG_SUPPORTED()/SIPTAG_SUPPORTED() + * Specifications: + * - @RFC3262, @RFC3311, @RFC3312 + * + * @par SIP Session Timers ("timer") + * Periodic refresh of SIP Session initiated with INVITE with re-INVITE or + * UPDATE requests. + * Settings: + * - NUTAG_MIN_SE(), NUTAG_SESSION_REFRESHER(), + * NUTAG_SESSION_TIMER(), NUTAG_UPDATE_REFRESH(), + * NUTAG_REFRESH_WITHOUT_SDP(), + * - "timer" in NUTAG_SUPPORTED()/SIPTAG_SUPPORTED() + * Specifications: + * - @RFC4028 + * + * @par Caller Preferences and Callee Caps + * - Caller preferences in @AcceptContact header in a INVITE requests + * - Callee caps contained in @Contact header in a REGISTER request + * Settings: + * - NUTAG_CALLEE_CAPS(), NUTAG_MEDIA_FEATURES(), + * NUTAG_M_FEATURES() + * Specifications: + * - @RFC3840, @RFC3841 + * + * @par Instant Messaging + * - nua_message(), #nua_r_message, #nua_i_message + * Settings: + * - NUTAG_APPL_METHOD("MESSAGE"), + * NUTAG_ENABLEMESSAGE(), NUTAG_ENABLEMESSENGER() + * Specifications: + * - @RFC3428 + * + * @par Call Transfer + * - nua_refer(), #nua_r_refer, #nua_i_notify, SIPTAG_EVENT(), + * @ReferTo, SIPTAG_REFER_TO(), @ReferredBy, SIPTAG_REFERRED_BY(), + * nua_handle_make_replaces(), @Replaces, SIPTAG_REPLACES(), + * @ReferSub, SIPTAG_REFER_SUB() + * - #nua_i_refer, nua_notify(), #nua_r_notify, + * nua_handle_by_replaces() + * - nua_invite() with NUTAG_NOTIFY_REFER() and NUTAG_REFER_EVENT() + * Settings: + * - NUTAG_REFER_EXPIRES(), NUTAG_REFER_WITH_ID() + * Specifications: + * - @RFC3515 (@ReferTo), @RFC3892 (@ReferredBy), @RFC3891 (@Replaces), + * @RFC4488, @ReferSub + * + * @par Internal SIP Event Server + * - nua_notifier(), #nua_r_notifier, #nua_i_subscription, + * nua_authorize(), #nua_r_authorize, nua_terminate(), #nua_r_terminate + * - SIPTAG_EVENT(), SIPTAG_CONTENT_TYPE(), SIPTAG_PAYLOAD(), + * NUTAG_SUBSTATE() + * @par Settings + * - NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and + * SIPTAG_ALLOW_EVENTS_STR() + * - NUTAG_MAX_SUBSCRIPTIONS() + * - NUTAG_SUBSTATE(), NUTAG_SUB_EXPIRES() + * @par Specifications + * - @RFC3265 + * + * @par SIP Event Subscriber + * - nua_subscribe(), #nua_r_subscribe, #nua_i_notify, NUTAG_SUBSTATE(), + * SIPTAG_EVENT(), SIPTAG_EXPIRES() + * - nua_unsubscribe(), #nua_r_unsubscribe() + * @par Specifications + * - @RFC3265 + * + * @par SIP Event Notifier + * - #nua_i_subscribe(), nua_notify(), #nua_r_notify, + * NUTAG_SUBSTATE(), NUTAG_SUB_EXPIRES(), SIPTAG_EVENT() + * Settings: + * - NUTAG_SUB_EXPIRES() + * - NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and + * SIPTAG_ALLOW_EVENTS_STR() + * - NUTAG_ALLOW("SUBSCRIBE"), NUTAG_APPL_METHOD("SUBSCRIBE") + * @par Specifications + * - @RFC3265 + * + * @par SIP Event Publisher + * - nua_publish(), #nua_r_publish(), nua_unpublish(), nua_r_unpublish() + * - @SIPETag, SIPTAG_ETAG(), @SIPIfMatch, SIPTAG_IF_MATCH() + * @par Specifications + * - @RFC3903 + * + * @par SIP Event State Compositor (PUBLISH Server) + * - #nua_i_publish, @SIPETag, @SIPIfMatch + * @par Settings + * - NUTAG_ALLOW("PUBLISH"), NUTAG_APPL_METHOD("PUBLISH") + * @par Specifications + * - @RFC3903 + * + * @par Non-Standard Extension Methods + * - nua_method(), NUTAG_METHOD(), #nua_r_method, NUTAG_DIALOG() + * - #nua_i_method, nua_respond() + * Settings: + * - NUTAG_ALLOW(x), NUTAG_APPL_METHOD(x) + * + * @par Server Shutdown + * - nua_shutdown(), NUTAG_SHUTDOWN_EVENTS(), nua_destroy(). + */ + +/* @par S/MIME + * - NUTAG_SMIME_ENABLE() + * - NUTAG_SMIME_KEY_ENCRYPTION() + * - NUTAG_SMIME_MESSAGE_DIGEST() + * - NUTAG_SMIME_MESSAGE_ENCRYPTION() + * - NUTAG_SMIME_OPT() + * - NUTAG_SMIME_PROTECTION_MODE() + * - NUTAG_SMIME_SIGNATURE() + */ + +tag_typedef_t nutag_any; + +/**@def NUTAG_URL() + * + * URL address from application to NUA + * + * @par Used with + * any function that create SIP request or nua_handle() \n + * nua_create() \n + * nua_set_params() \n + * nua_get_params() \n + * + * @par Parameter type + * char const * or url_t * or url_string_t * + * + * @par Values + * #url_string_t, which is either a pointer to #url_t or NULL terminated + * character string representing URL + * + * For normal nua calls, this tag is used as request target, which is usually + * stored as request-URI. + * + * It is used to set stack's own address with nua_create(), nua_set_params() + * and nua_get_params(). It can be specified multiple times when used with + * nua_create(). + * + * @sa SIPTAG_TO() + * + * Corresponding tag taking reference parameter is NUTAG_URL_REF() + */ +EXPORT tag_typedef_t nutag_url_ref; +tag_typedef_t nutag_url; + + +/**@def NUTAG_METHOD(x) + * + * Extension method name. + * + * Specify extension method name with nua_method() function. + * + * @par Used with + * nua_method() \n + * + * @par Parameter type + * char const * + * + * @par Values + * Extension method name (e.g., "SERVICE") + * + * Corresponding tag taking reference parameter is NUTAG_METHOD_REF() + * + * @sa nua_method(), SIP_METHOD_UNKNOWN() + * + * @since New in @VERSION_1_12_4. + */ +EXPORT tag_typedef_t nutag_method_ref; +tag_typedef_t nutag_method; + +/**@def NUTAG_METHOD_REF(x) + * Reference tag for NUTAG_METHOD(). + */ + + +/*#@def NUTAG_UICC(x) + * + * Intentionally undocumented. + */ +EXPORT tag_typedef_t nutag_uicc_ref; +tag_typedef_t nutag_uicc; + +/*#@def NUTAG_UICC_REF(x) + * Reference tag for NUTAG_UICC(). + */ + + +/**@def NUTAG_MEDIA_FEATURES() + * + * Add media tags from our offer to Accept-Contact headers. + * + * Automatically generate @AcceptContact headers for caller + * preference processing according to the media capabilities in @a soa. + * + * @par Used with + * - nua_create(), nua_set_params(), nua_get_params() + * - nua_handle(), nua_set_hparams(), nua_get_hparams() + * - nua_invite() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - Do not add @AcceptContact + * - 1 (true) - Add @AcceptContact with media tags + * + * Corresponding tag taking reference parameter is NUTAG_MEDIA_FEATURES_REF() + * + * @sa nua_invite(), @AcceptContact, @RFC3841, @RFC3840, SOATAG_USER_SDP(), + * SIPTAG_ACCEPT_CONTACT(), NUTAG_CALLEE_CAPS() + */ +EXPORT tag_typedef_t nutag_media_features_ref; +tag_typedef_t nutag_media_features; + +/**@def NUTAG_MEDIA_FEATURES_REF(x) + * Reference tag for NUTAG_MEDIA_FEATURES(). + */ + + +/**@def NUTAG_CALLEE_CAPS(x) + * + * Add methods parameter and media feature parameter to the @Contact headers + * generated for REGISTER request. + * + * @par Used with + * - nua_create(), nua_set_params(), nua_get_params() + * - nua_handle(), nua_set_hparams(), nua_get_hparams() + * - nua_register() + * + * @par Parameter type + * int + * + * @par Values + * - 0 (false) - Do not include methods and media feature parameters + * - 1 (true) - Include media tags in @Contact + * + * Corresponding tag taking reference parameter is NUTAG_MEDIA_FEATURES_REF(). + * + * @sa nua_register(), @Contact, NUTAG_M_FEATURES(), @RFC3840, @RFC3841, + * SOATAG_USER_SDP(), NUTAG_MEDIA_FEATURES() + */ +EXPORT tag_typedef_t nutag_callee_caps_ref; +tag_typedef_t nutag_callee_caps; + +/**@def NUTAG_CALLEE_CAPS_REF(x) + * Reference tag for NUTAG_CALLEE_CAPS(). + */ + +/**@def NUTAG_IMPU(x) +* Set the IP Multimedia Public Identity (sip or tel uri). This uri is publicly published and can be +* seen as your sip adress. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* url_string_t const * (either char const * or url_t *) +* +* @par Values +* - SIP URI +* - TEL URI +* +* Corresponding tag taking reference parameter is NUTAG_IMPU_REF(). +*/ +EXPORT tag_typedef_t nutag_impu_ref; +tag_typedef_t nutag_impu; + +/**@def NUTAG_IMPU_REF(x) + * Reference tag for NUTAG_IMPU(). + */ + +/**@def NUTAG_IMPI(x) +* Set the IP Multimedia Private Identity. This private user identity associated to the user's IMPUs. +* For basic sip clients (no IMS) you should fill this field with your authentication user name. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* char const * +* +* @par Values +* - Any +* +* Corresponding tag taking reference parameter is NUTAG_IMPI_REF(). +*/ +EXPORT tag_typedef_t nutag_impi_ref; +tag_typedef_t nutag_impi; + +/**@def NUTAG_IMPI_REF(x) + * Reference tag for NUTAG_IMPI(). + */ + +/**@def NUTAG_REALM(x) +* In IMS context we must set the realm in the initial first REGISTER request as per +* 3GPP TS 24.229 subclause 5.1.1.2. This mean that we don't wait for the 401/407 response to provide credentials. +* +*@par Used with +* -nua_set_params(), nua_create(), nua_get_params() +* +*@par parameter type +* +* char const * +* +* @par Values +* - Any +* +* Corresponding tag taking reference parameter is NUTAG_REALM_REF(). +*/ +EXPORT tag_typedef_t nutag_realm_ref; +tag_typedef_t nutag_realm; + +/**@def NUTAG_REALM_REF(x) + * Reference tag for NUTAG_REALM(). + */ + +/**@def NUTAG_EARLY_IMS(x) +* Activate/deactivate early IMS security as per 3GPP TS 33.978. +* You may activate this option if you are using the stack as basic sip engine without IMS +* security features. +* +*@par Used with +* -nua_register(), nua_create(), nua_set_params(), nua_get_params() +* +*@par Parameter type +* +* int (boolean: nonzero is true, zero is false) +* +* @par Values +* - 0 (false) - use normal IMS security mechanisms as per 3GPP TS 33.203 +* - 1 (true) - try to use early IMS as per 3GPP TS 33.978 instead of default IMS security (3GPP TS 33.203) +* +* Corresponding tag taking reference parameter is NUTAG_EARLY_IMS_REF(). +*/ +EXPORT tag_typedef_t nutag_early_ims_ref; +tag_typedef_t nutag_early_ims; + +/**@def NUTAG_EARLY_IMS_REF(x) + * Reference tag for NUTAG_EARLY_IMS(). + */ + +/**@def NUTAG_EARLY_MEDIA(x) + * + * Establish early media session using 100rel, 183 responses and PRACK. + * + * @par Used with + * - nua_create(), nua_set_params(), nua_get_params() + * - nua_handle(), nua_set_hparams(), nua_get_hparams() + * - nua_invite(), nua_respond() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - do not try to use early media + * - 1 (true) - try to use early media + * + * @sa NUTAG_EARLY_ANSWER() + * + * Corresponding tag taking reference parameter is NUTAG_EARLY_MEDIA_REF(). + */ +EXPORT tag_typedef_t nutag_early_media_ref; +tag_typedef_t nutag_early_media; + +/**@def NUTAG_EARLY_MEDIA_REF(x) + * Reference tag for NUTAG_EARLY_MEDIA(). + */ + + +/**@def NUTAG_ONLY183_100REL(x) + * + * Require 100rel extension and PRACK only with 183 response. + * + * When NUTAG_EARLY_MEDIA() is set, and if this parameter is set, stack + * includes feature tag "100rel" in the @Require header only with 183: + * otherwise, all 1XX responses (except 100 Trying) require 100rel. + * + * @par Used with + * nua_set_params() \n + * nua_get_params() \n + * nua_handle() \n + * nua_set_hparams() \n + * nua_get_hparams() \n + * nua_invite() \n + * nua_respond() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - include 100rel in all preliminary responses + * - 1 (true) - include 100rel only in 183 responses + * + * @note + * This tag takes only effect when NUTAG_EARLY_MEDIA(1) has been used, too. + * + * Corresponding tag taking reference parameter is NUTAG_ONLY183_100REL_REF(). + * + * @sa + */ +EXPORT tag_typedef_t nutag_only183_100rel_ref; +tag_typedef_t nutag_only183_100rel; + +/**@def NUTAG_ONLY183_100REL_REF(x) + * Reference tag for NUTAG_ONLY183_100REL(). + */ + + +/**@def NUTAG_EARLY_ANSWER(x) + * + * Establish early media session by including SDP answer in 1XX response. + * + * @par Used with + * nua_respond(), nua_set_params(), nua_set_hparams() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - do not include SDP in non-100rel 1XX responses + * - 1 (true) - try to include SDP in preliminary responses + * + * Corresponding tag taking reference parameter is NUTAG_EARLY_ANSWER_REF(). + * + * @note Requires that @soa is enabled with NUTAG_MEDIA_ENABLE(1). + * + * @sa NUTAG_EARLY_MEDIA(), NUTAG_AUTOALERT(), NUTAG_MEDIA_ENABLE() + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_early_answer_ref; +tag_typedef_t nutag_early_answer; + +/**@def NUTAG_EARLY_ANSWER_REF(x) + * Reference tag for NUTAG_EARLY_ANSWER(). + */ + + +/**@def NUTAG_INCLUDE_EXTRA_SDP(x) + * + * Include an extra copy of SDP answer in the response. + * + * When NUTAG_INCLUDE_EXTRA_SDP(1) is included in nua_respond() tags, stack + * will include in the response a copy of the SDP offer/answer that was last + * sent to the client. This tag should be used only when you know that the + * remote end requires the extra SDP, for example, some versions of Cisco + * SIPGateway need a copy of answer in 200 OK even when they indicate + * support for 100rel. + * + * @par Used with + * nua_respond() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - do not include extra SDP on 200 OK + * - 1 (true) - include SDP in 200 OK even if it has been sent + * a 100rel response, too + * + * Corresponding tag taking reference parameter is + * NUTAG_INCLUDE_EXTRA_SDP_REF(). + * + * @note Requires that @soa is enabled with NUTAG_MEDIA_ENABLE(1). + * + * @sa NUTAG_EARLY_ANSWER(), NUTAG_EARLY_MEDIA(), NUTAG_AUTOALERT(), + * NUTAG_MEDIA_ENABLE(), @RFC3264, @RFC3264 + * + * @since New in @VERSION_1_12_4. + */ +EXPORT tag_typedef_t nutag_include_extra_sdp_ref; +tag_typedef_t nutag_include_extra_sdp; + +/**@def NUTAG_INCLUDE_EXTRA_SDP_REF(x) + * Reference tag for NUTAG_INCLUDE_EXTRA_SDP(). + */ + + +/**@def NUTAG_MEDIA_ENABLE() + * + * Enable built-in media session handling + * + * The built-in media session object @soa takes care of most details + * of offer-answer negotiation. + * + * @par Used with + * nua_create() + * + * @par Parameter type + * int + * + * @par Values + * - 0 (false) - do not use soa + * - 1 (true) - use soa with SDP O/A + * + * Corresponding tag taking reference parameter is NUTAG_MEDIA_ENABLE_REF() + */ +EXPORT tag_typedef_t nutag_media_enable_ref; +tag_typedef_t nutag_media_enable; + +/**@def NUTAG_MEDIA_ENABLE_REF(x) + * Reference tag for NUTAG_MEDIA_ENABLE(). + */ + + + +/**@def NUTAG_SOA_NAME(x) + * + * Name for SDP Offer-Answer session object. + * + * SDP Offer-Answer session object name. + * + * @par Used with nua_create(), nua_handle(). + * + * @par Parameter type + * void * (actually soa_session_t *) + * + * @par Values + * Pointer to MSS media session. + * + * Corresponding tag taking reference parameter is NUTAG_SOA_NAME_REF(). + */ +EXPORT tag_typedef_t nutag_soa_name_ref; +tag_typedef_t nutag_soa_name; + +/**@def NUTAG_SOA_NAME_REF(x) + * Reference tag for NUTAG_SOA_NAME(). + */ + + +/**@def NUTAG_RETRY_COUNT(x) + * + * Set request retry count. + * + * Retry count determines how many times stack will automatically retry + * after an recoverable error response, like 302, 401 or 407. + * + * Note that the first request does not count as retry. + * + * @par Used with + * nua_create(), nua_set_params(), nua_handle(), nua_set_hparams(), + * nua_get_params(), nua_get_hparams(), + * nua_register(), nua_unregister(), + * nua_options(), nua_invite(), nua_ack(), nua_cancel(), nua_bye(), + * nua_prack(), nua_update(), nua_info(), + * nua_message(), nua_publish(), nua_unpublish(), nua_notifier(), + * nua_subscribe(), nua_unsubscribe(), nua_notify(), nua_refer(), + * nua_method(), nua_respond() + * nua_authenticate(). + * + * @par Parameter type + * unsigned + * + * @par Values + * - 0 - Never retry automatically + * - Otherwise, number of extra transactions initiated after initial + * transaction failed with recoverable error response + * + * @NEW_1_12_4. + * + * Corresponding tag taking reference parameter is NUTAG_RETRY_COUNT_REF(). + */ +EXPORT tag_typedef_t nutag_retry_count_ref; +tag_typedef_t nutag_retry_count; + +/**@def NUTAG_RETRY_COUNT_REF(x) + * + * Reference tag for NUTAG_RETRY_COUNT(). + */ + + +/**@def NUTAG_MAX_SUBSCRIPTIONS(x) + * + * Set maximum number of simultaneous subscribers per single event server. + * + * Determines how many subscribers can simultaneously subscribe to a single + * event. + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * unsigned int + * + * @par Values + * - 0 (zero) - do not allow any subscriptions + * + * @sa nua_notifier(), nua_authorize() + * + * Corresponding tag taking reference parameter is + * NUTAG_MAX_SUBSCRIPTIONS_REF(). + */ +EXPORT tag_typedef_t nutag_max_subscriptions_ref; +tag_typedef_t nutag_max_subscriptions; + +/**@def NUTAG_MAX_SUBSCRIPTIONS_REF(x) + * Reference tag for NUTAG_MAX_SUBSCRIPTIONS(). + */ + + +/**@def NUTAG_CALLSTATE() + * + * Call state + * + * @par Used with + * #nua_i_state + * + * @par Parameter type + * int + * + * @par Values + * - #nua_callstate_init - Initial state + * - #nua_callstate_authenticating - 401/407 received + * - #nua_callstate_calling - INVITE sent + * - #nua_callstate_proceeding - 18X received + * - #nua_callstate_completing - 2XX received + * - #nua_callstate_received - INVITE received (and 100 Trying sent) + * - #nua_callstate_early - 18X sent + * - #nua_callstate_completed - 2XX sent + * - #nua_callstate_ready - 2XX and ACK received/sent + * - #nua_callstate_terminating - BYE sent + * - #nua_callstate_terminated - BYE complete + * + * Corresponding tag taking reference parameter is NUTAG_CALLSTATE_REF(). + */ +EXPORT tag_typedef_t nutag_callstate_ref; +tag_typedef_t nutag_callstate; + +/**@def NUTAG_CALLSTATE_REF(x) + * Reference tag for NUTAG_CALLSTATE(). + */ + + +/**@def NUTAG_OFFER_RECV() + * + * Indicate that SDP offer has been received. + * + * @par Used with + * #nua_i_state + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * Corresponding tag taking reference parameter is NUTAG_OFFER_RECV_REF(). + */ +EXPORT tag_typedef_t nutag_offer_recv_ref; +tag_typedef_t nutag_offer_recv; + +/**@def NUTAG_OFFER_RECV_REF(x) + * Reference tag for NUTAG_OFFER_RECV(). + */ + + +/**@def NUTAG_ANSWER_RECV() + * + * Indicate that SDP answer has been received. + * + * @par Used with + * #nua_i_state + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * Corresponding tag taking reference parameter is NUTAG_ANSWER_RECV_REF(). + */ +EXPORT tag_typedef_t nutag_answer_recv_ref; +tag_typedef_t nutag_answer_recv; + +/**@def NUTAG_ANSWER_RECV_REF(x) + * Reference tag for NUTAG_ANSWER_RECV(). + */ + + +/**@def NUTAG_OFFER_SENT() + * + * Indicate that SDP offer has been sent. + * + * @par Used with + * #nua_i_state + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * Corresponding tag taking reference parameter is NUTAG_OFFER_SENT_REF(). + */ +EXPORT tag_typedef_t nutag_offer_sent_ref; +tag_typedef_t nutag_offer_sent; + +/**@def NUTAG_OFFER_SENT_REF(x) + * Reference tag for NUTAG_OFFER_SENT(). + */ + + +/**@def NUTAG_ANSWER_SENT() + * + * Indicate that SDP answer has been sent. + * + * @par Used with + * #nua_i_state + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * Corresponding tag taking reference parameter is NUTAG_ANSWER_SENT_REF(). + */ +EXPORT tag_typedef_t nutag_answer_sent_ref; +tag_typedef_t nutag_answer_sent; + +/**@def NUTAG_ANSWER_SENT_REF(x) + * Reference tag for NUTAG_ANSWER_SENT(). + */ + + +/**@def NUTAG_SUBSTATE() + * + * Subscription state. + * + * @par Used with + * - with nua_create(), nua_set_params(), nua_get_params(), + * nua_handle(), nua_set_hparams(), nua_get_hparams(), and + * nua_notifier() to change the default subscription state returned by + * the internal event server + * - with nua_notify() and nua_respond() to SUBSCRIBE to determine the + * subscription state (if application include @SubscriptionState + * header in the tag list, the NUTAG_SUBSTATE() value is ignored) + * - with #nua_r_subscribe, #nua_i_notify, #nua_i_subscribe, and #nua_r_notify + * to indicate the current subscription state + * + * @par Parameter type + * int + * + * @par Values + * - #nua_substate_embryonic (0) + * - #nua_substate_pending (1) + * - #nua_substate_active (2) + * - #nua_substate_terminated (3) + * + * Note that the @SubscriptionState or @Expires headers specified by + * application with the nua_notify() or nua_respond() to SUBSCRIBE overrides + * the subscription state specified by NUTAG_SUBSTATE(). + * Application can terminate subscription by including + * NUTAG_SUBSTATE(nua_substate_terminated), @SubscriptionState with value + * "terminated" or @Expires header with value 0 in the NOTIFY request sent + * by nua_notify(). + * + * @sa @RFC3265, @SubscriptionState, SIPTAG_SUBSCRIPTION_STATE(), + * SIPTAG_SUBSCRIPTION_STATE_STR(), nua_notifier(), #nua_r_subscribe, + * #nua_i_subscribe, #nua_i_refer, #nua_r_notify, #nua_i_notify. + * + * Corresponding tag taking reference parameter is NUTAG_SUBSTATE_REF(). + */ +EXPORT tag_typedef_t nutag_substate_ref; +tag_typedef_t nutag_substate; + +/**@def NUTAG_SUBSTATE_REF(x) + * Reference tag for NUTAG_SUBSTATE(). + */ + + +/**@def NUTAG_SUB_EXPIRES() + * + * Default expiration time of subscriptions. + * + * @par Used with + * - with nua_create(), nua_set_params(), nua_get_params(), nua_handle(), + * nua_set_hparams(), nua_get_hparams(), nua_respond(), nua_notify(), and + * nua_notifier() to change the default expiration time of subscriptions + * + * @par Parameter type + * unsigned int + * + * @par Values + * - default expiration time in seconds + * + * Note that the expires parameter in @SubscriptionState or @Expires header + * in the nua_response() to the SUBSCRIBE overrides the default subscription + * expiration specified by NUTAG_SUB_EXPIRES(). + * + * @sa @RFC3265, NUTAG_REFER_EXPIRES(), @Expires, SIPTAG_EXPIRES(), + * SIPTAG_EXPIRES_STR(), @SubscriptionState, nua_respond(), nua_notifier(), + * #nua_r_subscribe, #nua_i_subscribe, #nua_r_refer, #nua_r_notify, + * #nua_i_notify. + * + * Corresponding tag taking reference parameter is NUTAG_SUB_EXPIRES_REF(). + * + * @NEW_1_12_9. + */ +EXPORT tag_typedef_t nutag_sub_expires_ref; +tag_typedef_t nutag_sub_expires; + +/**@def NUTAG_SUB_EXPIRES_REF(x) + * Reference tag for NUTAG_SUB_EXPIRES(). + */ + + +/**@def NUTAG_NEWSUB() + * + * Send unsolicited NOTIFY request. + * + * Some applications may require sending unsolicited NOTIFY requests, that + * is, NOTIFY without SUBSCRIBE or REFER request sent by event watcher. + * However, sending NOTIFY request requires an existing dialog usage by + * default. If the nua_notify() tags include NUTAG_NEWSUB(1), the usage + * is created by nua_notify() itself. + * + * If you want to create a subscription that does not terminate immediately + * include SIPTAG_SUBSCRIPTION_STATE()/SIPTAG_SUBSCRIPTION_STATE_STR() with + * an "expires" parameter in the argument list, too. + * + * @par Used with + * nua_notify() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 - false (default) - do not create new subscription + * but reject NOTIFY with 481 locally + * - 1 - true - create a subscription if it does not exist + * + * Corresponding tag taking reference parameter is NUTAG_NEWSUB_REF(). + * + * @NEW_1_12_5. + */ +EXPORT tag_typedef_t nutag_newsub_ref; +tag_typedef_t nutag_newsub; + +/**@def NUTAG_NEWSUB_REF(x) + * Reference tag for NUTAG_NEWSUB(). + */ + + +/**@def NUTAG_INVITE_TIMER(x) + * + * Timer for outstanding INVITE in seconds. + * + * INVITE will be canceled if no answer is received before timer expires. + * + * @par Used with + * nua_invite() \n + * nua_set_params(), nua_set_hparams(), + * nua_get_params(), nua_get_hparams() + * + * @par Parameter type + * int (enum nua_af) + * + * @par Values + * - 0 no timer + * - >0 timer in seconds + * + * Corresponding tag taking reference parameter is NUTAG_INVITE_TIMER_REF(). + */ +EXPORT tag_typedef_t nutag_invite_timer_ref; +tag_typedef_t nutag_invite_timer; + +/**@def NUTAG_INVITE_TIMER_REF(x) + * Reference tag for NUTAG_INVITE_TIMER(). + */ + + +/**@def NUTAG_SESSION_TIMER(x) + * + * Default session timer in seconds. + * + * Set default value for session timer in seconds when the session timer + * extension is used. The tag value is the proposed session expiration time + * in seconds, the session is refreshed twice during the expiration time. + * + * @par Sending INVITE and UPDATE Requests + * + * If NUTAG_SESSION_TIMER() is used with non-zero value, the value is used + * in the @SessionExpires header included in the INVITE or UPDATE requests. + * The intermediate proxies or the ultimate destination can lower the + * interval in @SessionExpires header. If the value is too low, they can + * reject the request with the status code 422 Session Timer Too + * Small. In that case, @b nua increases the value of @SessionExpires + * header and retries the request automatically. + * + * @par Returning a Response to the INVITE and UPDATE Requests + * + * The NUTAG_SESSION_TIMER() value is also used when sending the final + * response to the INVITE or UPDATE requests. If the NUTAG_SESSION_TIMER() + * value is 0 or the value in the @SessionExpires header of the request is + * lower than the value in NUTAG_SESSION_TIMER(), the value from the + * incoming @SessionExpires header is used. However, if the value in + * @SessionExpires is lower than the minimal acceptable session expiration + * interval specified with the tag NUTAG_MIN_SE() the request is + * automatically rejected with 422 Session Timer Too Small. + * + * @par Refreshes + * + * After the initial INVITE request, the SIP session is refreshed at the + * intervals indicated by the @SessionExpires header returned in the 2XX + * response. The party indicated with the "refresher" parameter of the + * @SessionExpires header sends a re-INVITE requests (or an UPDATE + * request if NUTAG_UPDATE_REFRESH(1) parameter tag has been set). + * + * Some SIP user-agents use INVITE without SDP offer to refresh session. + * By default, NUA sends an offer in 200 OK to such an INVITE and expects + * an answer back in ACK. If NUTAG_REFRESH_WITHOUT_SDP(1) tag is used, + * no SDP offer is sent in 200 OK if re-INVITE was received without SDP. + * + * @par When to Use NUTAG_SESSION_TIMER()? + * + * The session time extension is enabled ("timer" feature tag is included in + * @Supported header) but not activated by default (no @SessionExpires + * header is included in the requests or responses by default). Using + * non-zero value with NUTAG_SESSION_TIMER() or NUTAG_SESSION_REFRESHER() + * activates it. When the extension is activated, @nua refreshes the call + * state by sending periodic re-INVITE or UPDATE requests unless the remote + * end indicated that it will take care of refreshes. + * + * The session timer extension is mainly useful for proxies or back-to-back + * user agents that keep call state. The call state is "soft" meaning that + * if no call-related SIP messages are processed for certain time the state + * will be destroyed. An ordinary user-agent can also make use of session + * timer if it cannot get any activity feedback from RTP or other media. + * + * @note The session timer extension is used only if the feature + * tag "timer" is listed in the @Supported header, set by NUTAG_SUPPORTED(), + * SIPTAG_SUPPORTED(), or SIPTAG_SUPPORTED_STR() tags. + * + * @par Used with + * nua_invite(), nua_update(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * See nua_set_hparams() for a complete list of the the nua operations that + * accept this tag. + * + * @par Parameter type + * unsigned int + * + * @par Values + * - 0 disable + * - >0 interval in seconds + * + * Corresponding tag taking reference parameter is NUTAG_SESSION_TIMER_REF(). + * + * @sa NUTAG_SUPPORTED(), NUTAG_MIN_SE(), NUTAG_SESSION_REFRESHER(), + * nua_invite(), #nua_r_invite, #nua_i_invite, nua_respond(), + * nua_update(), #nua_r_update, #nua_i_update, + * NUTAG_UPDATE_REFRESH(), @RFC4028, @SessionExpires, @MinSE + */ +EXPORT tag_typedef_t nutag_session_timer_ref; +tag_typedef_t nutag_session_timer; + +/**@def NUTAG_SESSION_TIMER_REF(x) + * Reference tag for NUTAG_SESSION_TIMER(). + */ + + +/**@def NUTAG_MIN_SE(x) + * + * Minimum acceptable refresh interval for session. + * + * Specifies the value of @MinSE header in seconds. The @b Min-SE header is + * used to specify minimum acceptable refresh interval for session timer + * extension. + * + * @par Used with + * nua_handle(), nua_invite(), nua_update(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * See nua_set_hparams() for a complete list of the nua operations that + * accept this tag. + * + * @par Parameter type + * unsigned int + * + * @par Values + * interval in seconds. + * + * Corresponding tag taking reference parameter is NUTAG_MIN_SE_REF(). + * + * @sa NUTAG_SESSION_TIMER(), NUTAG_SESSION_REFRESHER(), + * NUTAG_UPDATE_REFRESH(), @RFC4028, @MinSE, @SessionExpires + */ +EXPORT tag_typedef_t nutag_min_se_ref; +tag_typedef_t nutag_min_se; + +/**@def NUTAG_MIN_SE_REF(x) + * Reference tag for NUTAG_MIN_SE(). + */ + + +/**@def NUTAG_SESSION_REFRESHER(x) + * + * Specify the preferred refresher. + * + * Specify for session timer extension which party is the preferred refresher. + * + * @par Used with + * nua_handle(), nua_invite(), nua_update(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * See nua_set_hparams() for a complete list of all the nua operations that + * accept this tag. + * + * @par Parameter type + * enum { #nua_no_refresher, #nua_local_refresher, #nua_remote_refresher, + * #nua_any_refresher } + * + * @par Values + * - nua_no_refresher (session timers are disabled) + * - nua_local_refresher + * - nua_remote_refresher + * - nua_any_refresher (default) + * + * Corresponding tag taking reference parameter is + * NUTAG_SESSION_REFRESHER_REF(). + * + * @sa NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(), + * NUTAG_UPDATE_REFRESH(), @RFC4028, @SessionExpires, @MinSE + */ +EXPORT tag_typedef_t nutag_session_refresher_ref; +tag_typedef_t nutag_session_refresher; + +/**@def NUTAG_SESSION_REFRESHER_REF(x) + * Reference tag for NUTAG_SESSION_REFRESHER(). + */ + + + + +/**@def NUTAG_UPDATE_REFRESH(x) + * + * Use UPDATE as refresh method. + * + * If this parameter is true and the remote endpoint has included UPDATE in + * Allow header, the nua stack uses UPDATE instead of INVITE to refresh the + * session when using the session timer extension. + * + * Note that the session timer headers @SessionExpires and @MinSE are always + * included in the UPDATE request and responses regardless of the value of + * this tag. + * + * @par Used with + * nua_handle(), nua_invite(), nua_update(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * See nua_set_hparams() for a complete list of all the nua operations that + * accept this tag. + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 1 (true, use UPDATE) + * - 0 (false, use INVITE) + * + * Corresponding tag taking reference parameter is NUTAG_UPDATE_REFRESH_REF(). + * + * @sa #nua_r_update, NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(), + * NUTAG_SESSION_REFRESHER(), @RFC4028, @SessionExpires, @MinSE + */ +EXPORT tag_typedef_t nutag_update_refresh_ref; +tag_typedef_t nutag_update_refresh; + +/**@def NUTAG_UPDATE_REFRESH_REF(x) + * Reference tag for NUTAG_UPDATE_REFRESH(). + */ + + +/**@def NUTAG_REFRESH_WITHOUT_SDP(x) + * + * Do not send offer in response if re-INVITE was received without SDP. + * + * Some SIP user-agents use INVITE without SDP offer to refresh session. + * By default, NUA sends an offer in 200 OK to such an INVITE and expects + * an answer back in ACK. + * + * If NUTAG_REFRESH_WITHOUT_SDP(1) tag is used, no SDP offer is sent in 200 + * OK if re-INVITE was received without SDP. + * + * @par Used with + * nua_handle(), nua_invite(), nua_update(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * See nua_set_hparams() for a complete list of all the nua operations that + * accept this tag. + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 1 (true, do not try to send offer in response to re-INVITE) + * - 0 (false, always use SDP offer-answer in re-INVITEs) + * + * Corresponding tag taking reference parameter is NUTAG_REFRESH_WITHOUT_SDP_REF(). + * + * @sa #nua_r_update, NUTAG_SESSION_TIMER(), NUTAG_MIN_SE_REF(), + * NUTAG_SESSION_REFRESHER(), NUTAG_UPDATE_REFRESH(), @RFC4028, + * @SessionExpires, @MinSE + */ +EXPORT tag_typedef_t nutag_refresh_without_sdp_ref; +tag_typedef_t nutag_refresh_without_sdp; + +/**@def NUTAG_REFRESH_WITHOUT_SDP_REF(x) + * Reference tag for NUTAG_REFRESH_WITHOUT_SDP_REF(). + */ + + +/**@def NUTAG_REFER_EXPIRES() + * + * Default lifetime for implicit subscriptions created by REFER. + * + * Default expiration time in seconds for implicit subscriptions created by + * REFER. + * + * @par Used with + * nua_handle(), nua_respond() \n + * nua_set_params() or nua_set_hparams() \n + * nua_get_params() or nua_get_hparams() + * + * @par Parameter type + * unsigned int + * + * @par Values + * - default interval in seconds + * + * @sa NUTAG_SUB_EXPIRES() + * + * Corresponding tag taking reference parameter is NUTAG_REFER_EXPIRES_REF(). + */ +EXPORT tag_typedef_t nutag_refer_expires_ref; +tag_typedef_t nutag_refer_expires; + +/**@def NUTAG_REFER_EXPIRES_REF(x) + * Reference tag for NUTAG_REFER_EXPIRES(). + */ + + +/**@def NUTAG_REFER_WITH_ID() + * + * Always use id parameter with refer event. + * + * When an incoming REFER creates an implicit subscription, the event header + * in the NOTIFY request may have an id parameter. The id parameter can be + * either always included (default behavior), or the parameter can be used + * only for the second and subsequent REFER requests received in a given + * dialog. + * + * Note that once the subscription is created, the event header should not + * be modified. Therefore this tag has no effect on already established + * subscriptions, and its use makes sense largely on nua_set_params() only. + * + * @par Used with + * nua_set_params() (nua_set_hparams(), nua_invite(), nua_respond(), + * nua_update()). + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false, do not use id with subscription created with first REFER request) + * - 1 (true, use id with all subscriptions created with REFER request) + * + * Corresponding tag taking reference parameter is NUTAG_REFER_WITH_ID_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_refer_with_id_ref; +tag_typedef_t nutag_refer_with_id; + +/**@def NUTAG_REFER_WITH_ID_REF(x) + * Reference tag for NUTAG_REFER_WITH_ID(). + */ + +/**@def NUTAG_AUTOALERT(x) + * + * Send alerting (180 Ringing) automatically (instead of 100 Trying). If the + * early media has been enabled with NUTAG_EARLY_MEDIA(1), the stack will + * send 183, wait for PRACK and then return 180 Ringing. + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - no automatic sending of "180 Ringing" + * - 1 (true) - "180 Ringing" sent automatically + * + * Corresponding tag taking reference parameter is NUTAG_AUTOALERT_REF(). + */ +EXPORT tag_typedef_t nutag_autoalert_ref; +tag_typedef_t nutag_autoalert; + +/**@def NUTAG_AUTOALERT_REF(x) + * Reference tag for NUTAG_AUTOALERT(). + */ + + +/**@def NUTAG_AUTOANSWER(x) + * + * Answer (with 200 Ok) automatically to incoming call. + * + * @par Used with + * nua_set_params(), nua_set_hparams() \n + * nua_get_params(), nua_get_hparams() \n + * nua_invite() \n + * nua_respond() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - No automatic sending of "200 Ok" + * - 1 (true) - "200 Ok" sent automatically + * + * Corresponding tag taking reference parameter is NUTAG_AUTOANSWER_REF(). + * + * @note Requires that @soa is enabled with NUTAG_MEDIA_ENABLE(1). + * + * @par Auto-Answer to Re-INVITE requests + * By default, NUA tries to auto answer the re-INVITEs used to refresh the + * session when the media is enabled. Set NUTAG_AUTOANSWER(0) on the call + * handle (e.g., include the tag with nua_invite(), nua_respond()) in order + * to disable the auto answer on re-INVITEs. + * + * @bug If the re-INVITE modifies the session (e.g., SDP contains offer that + * adds video stream to the session), NUA auto-answers it if + * NUTAG_AUTOANSWER(0) has not been set on the handle. It accepts or rejects + * media based on the existing user SDP (set with SOATAG_USER_SDP(), for + * example). It should auto-answer only session refresh request and let + * application decide how to handle requests to modify the session. + * + * @sa NUTAG_MEDIA_ENABLE(), NUTAG_AUTOALERT(), NUTAG_AUTOACK(). + */ +EXPORT tag_typedef_t nutag_autoanswer_ref; +tag_typedef_t nutag_autoanswer; + +/**@def NUTAG_AUTOANSWER_REF(x) + * Reference tag for NUTAG_AUTOANSWER(). + */ + + +/**@def NUTAG_AUTOACK(x) + * + * ACK automatically + * + * If this parameter is true, ACK is sent automatically after receiving 2XX + * series response to INVITE. Note that ACK is always sent automatically by + * lower layers of the stack after receiving an error response 3XX, 4XX, 5XX + * or 6XX. + * + * @par Used with + * nua_set_params(), nua_set_hparams(), \n + * nua_get_params(), nua_get_hparams(), \n + * nua_invite(), nua_ack(), nua_respond(), nua_update() \n + * nua_respond() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - No automatic sending of ACK + * - 1 (true) - ACK sent automatically + * + * Default value is NUTAG_AUTOACK(1). + * + * Corresponding tag taking reference parameter is NUTAG_AUTOACK_REF(). + */ +EXPORT tag_typedef_t nutag_autoack_ref; +tag_typedef_t nutag_autoack; + +/**@def NUTAG_AUTOACK_REF(x) + * Reference tag for NUTAG_AUTOACK(). + */ + + +/**@def NUTAG_ENABLEINVITE(x) + * + * Enable incoming INVITE. + * + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - Incoming INVITE not enabled. NUA answers 403 Forbidden + * - 1 (true) - Incoming INVITE enabled + * + * Corresponding tag taking reference parameter is NUTAG_ENABLEINVITE_REF(). + */ +EXPORT tag_typedef_t nutag_enableinvite_ref; +tag_typedef_t nutag_enableinvite; + +/**@def NUTAG_ENABLEINVITE_REF(x) + * Reference tag for NUTAG_ENABLEINVITE(). + */ + + + +/**@def NUTAG_ENABLEMESSAGE(x) + * + * Enable incoming MESSAGE + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - Incoming MESSAGE not enabled. NUA answers 403 Forbidden + * - 1 (true) - Incoming MESSAGE enabled + * + * Corresponding tag taking reference parameter is NUTAG_ENABLEMESSAGE_REF(). + */ +EXPORT tag_typedef_t nutag_enablemessage_ref; +tag_typedef_t nutag_enablemessage; + +/**@def NUTAG_ENABLEMESSAGE_REF(x) + * Reference tag for NUTAG_ENABLEMESSAGE(). + */ + + + +/**@def NUTAG_ENABLEMESSENGER(x) + * + * Enable incoming MESSAGE with To tag. + * + * Set this parameter true if you want to chat with Windows Messenger. When + * it is set, stack will accept MESSAGE requests with To tag outside + * existing dialogs. + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - disable Windows-Messenger-specific features + * - 1 (true) - enable Windows-Messenger-specific features + * + * Corresponding tag taking reference parameter is NUTAG_ENABLEMESSENGER_REF(). + */ +EXPORT tag_typedef_t nutag_enablemessenger_ref; +tag_typedef_t nutag_enablemessenger; + +/**@def NUTAG_ENABLEMESSENGER_REF(x) + * Reference tag for NUTAG_ENABLEMESSENGER(). + */ + + +/**@def NUTAG_SMIME_ENABLE(x) + * + * Enable S/MIME + * + * @par Used with + * nua_create() \n + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - S/MIME is Disabled + * - 1 (true) - S/MIME is Enabled + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_ENABLE_REF(). + */ +EXPORT tag_typedef_t nutag_smime_enable_ref; +tag_typedef_t nutag_smime_enable; + +/**@def NUTAG_SMIME_ENABLE_REF(x) + * Reference tag for NUTAG_SMIME_ENABLE(). + */ + + +/**@def NUTAG_SMIME_OPT(x) + * + * S/MIME Options + * + * This tag specifies the type of S/MIME security services requested + * by the user. + * + * @par Used with + * nua_set_params() \n + * nua_get_params() \n + * nua_message() + * + * @par Parameter type + * int + * + * @par Values + * - -1 (SM_ID_NULL) No security service needed + * - 0 (SM_ID_CLEAR_SIGN) Clear signing + * - 1 (SM_ID_SIGN) S/MIME signing + * - 2 (SM_ID_ENCRYPT) S/MIME encryption + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_OPT_REF(). + */ +EXPORT tag_typedef_t nutag_smime_opt_ref; +tag_typedef_t nutag_smime_opt; + +/**@def NUTAG_SMIME_OPT_REF(x) + * Reference tag for NUTAG_SMIME_OPT(). + */ + + +/**@def NUTAG_SMIME_PROTECTION_MODE(x) + * + * S/MIME protection mode + * + * This tag specifies the protection mode of the SIP message by + * S/MIME as requested by the user + * + * @par Used with + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * unsigned int + * + * @par Values + * - -1 (SM_MODE_NULL) Unspecified + * - 0 (SM_MODE_PAYLOAD_ONLY) SIP payload only + * - 1 (SM_MODE_TUNNEL) SIP tunneling mode + * - 2 (SM_MODE_SIPFRAG) SIPfrag protection + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_PROTECTION_MODE_REF(). + */ +EXPORT tag_typedef_t nutag_smime_protection_mode_ref; +tag_typedef_t nutag_smime_protection_mode = + INTTAG_TYPEDEF(smime_protection_mode); + +/**@def NUTAG_SMIME_PROTECTION_MODE_REF(x) + * Reference tag for NUTAG_SMIME_PROTECTION_MODE(). + */ + + +/**@def NUTAG_SMIME_MESSAGE_DIGEST(x) + * + * S/MIME digest algorithm + * + * This tag specifies the message digest algorithm to be used in S/MIME. + * + * @par Used with + * To be implemented + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_MESSAGE_DIGEST_REF(). + */ +EXPORT tag_typedef_t nutag_smime_message_digest_ref; +tag_typedef_t nutag_smime_message_digest = + STRTAG_TYPEDEF(smime_message_digest); + +/**@def NUTAG_SMIME_MESSAGE_DIGEST_REF(x) + * Reference tag for NUTAG_SMIME_MESSAGE_DIGEST(). + */ + + +/**@def NUTAG_SMIME_SIGNATURE(x) + * + * S/MIME signature algorithm + * + * This tag specifies the signature algorithm to be used in S/MIME. + * + * @par Used with + * To be implemented. + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_SIGNATURE_REF(). + */ +EXPORT tag_typedef_t nutag_smime_signature_ref; +tag_typedef_t nutag_smime_signature = + STRTAG_TYPEDEF(smime_signature); + +/**@def NUTAG_SMIME_SIGNATURE_REF(x) + * Reference tag for NUTAG_SMIME_SIGNATURE(). + */ + + +/**@def NUTAG_SMIME_KEY_ENCRYPTION(x) + * + * S/MIME key encryption algorithm + * + * This tag specifies the key encryption algorithm to be used by S/MIME. + * + * @par Used with + * To be implemented + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_KEY_ENCRYPTION_REF(). + */ +EXPORT tag_typedef_t nutag_smime_key_encryption_ref; +tag_typedef_t nutag_smime_key_encryption = + STRTAG_TYPEDEF(smime_key_encryption); + +/**@def NUTAG_SMIME_KEY_ENCRYPTION_REF(x) + * Reference tag for NUTAG_SMIME_KEY_ENCRYPTION(). + */ + + +/**@def NUTAG_SMIME_MESSAGE_ENCRYPTION(x) + * + * S/MIME message encryption algorithm + * + * This tag specifies the message encryption algorithm to be used in S/MIME. + * + * @par Used with + * To be implemented. + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_SMIME_MESSAGE_ENCRYPTION_REF(). + */ +EXPORT tag_typedef_t nutag_smime_message_encryption_ref; +tag_typedef_t nutag_smime_message_encryption = + STRTAG_TYPEDEF(smime_message_encryption); + +/**@def NUTAG_SMIME_MESSAGE_ENCRYPTION_REF(x) + * Reference tag for NUTAG_SMIME_MESSAGE_ENCRYPTION(). + */ + + +/**@def NUTAG_SIPS_URL(x) + * + * Local SIPS url. + * + * The application can specify an alternative local address for + * NUA user agent engine. Usually the alternative address is a + * secure SIP URI (SIPS) used with TLS transport. + * + * @par Used with + * nua_create() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_SIPS_URL_REF(). + */ +EXPORT tag_typedef_t nutag_sips_url_ref; +tag_typedef_t nutag_sips_url; + +/**@def NUTAG_SIPS_URL_REF(x) + * Reference tag for NUTAG_SIPS_URL(). + */ + + +/**@def NUTAG_CERTIFICATE_DIR(x) + * + * X.500 certificate directory + * + * @par Used with + * nua_create() + * + * @par Parameter type + * char const * + * + * @par Values + * NULL terminated pathname of directory containing agent.pem and cafile.pem files. + * + * Corresponding tag taking reference parameter is NUTAG_CERTIFICATE_DIR_REF(). + */ +EXPORT tag_typedef_t nutag_certificate_dir_ref; +tag_typedef_t nutag_certificate_dir; + +/**@def NUTAG_CERTIFICATE_DIR_REF(x) + * Reference tag for NUTAG_CERTIFICATE_DIR(). + */ + + +/**@def NUTAG_CERTIFICATE_PHRASE(x) + * + * Certificate phrase + * + * @par Used with + * Currently not processed by NUA + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_CERTIFICATE_PHRASE_REF(). + */ +EXPORT tag_typedef_t nutag_certificate_phrase_ref; +tag_typedef_t nutag_certificate_phrase; + +/**@def NUTAG_CERTIFICATE_PHRASE_REF(x) + * Reference tag for NUTAG_CERTIFICATE_PHRASE(). + */ + +extern msg_hclass_t sip_route_class[]; + +/**@def NUTAG_INITIAL_ROUTE(x) + * + * Specify initial route set. + * + * The initial route set is used instead or or in addition to the outbound + * proxy URL given by NUTAG_PROXY(). The NUTAG_INITIAL_ROUTE() accepts a + * list of parsed @Route header structures, NUTAG_INITIAL_ROUTE_STR() an + * unparsed string. + * + * If a tag list contains multiple NUTAG_INITIAL_ROUTE() or + * NUTAG_INITIAL_ROUTE_STR() tags, the route set is constructed from them + * all. + * + * The initial route is inserted into request message before the route + * entries set with SIPTAG_ROUTE() or SIPTAG_ROUTE_STR(). + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * sip_route_t const * + * + * @par Values + * Linked list of #sip_route_t structures + * + * Corresponding tag taking reference parameter is NUTAG_INITIAL_ROUTE_REF(). + * + * @NEW_1_12_7. + */ +EXPORT tag_typedef_t nutag_initial_route_ref; +tag_typedef_t nutag_initial_route; + +/**@def NUTAG_INITIAL_ROUTE_REF(x) + * Reference tag for NUTAG_INITIAL_ROUTE(). + */ + + +/**@def NUTAG_INITIAL_ROUTE_STR(x) + * + * Specify initial route set. + * + * The initial route set is used instead or or in addition to the outbound + * proxy URL given by NUTAG_PROXY(). The NUTAG_INITIAL_ROUTE() accepts a + * list of parsed @Route header structures, NUTAG_INITIAL_ROUTE_STR() a + * unparsed string containing route URIs, quoted with <> and separated by + * commas. + * + * Please note that the syntax requires <> around the @Route URIs if they + * contain parameters, e.g., "lr". + * + * If a tag list contains multiple NUTAG_INITIAL_ROUTE() or + * NUTAG_INITIAL_ROUTE_STR() tags, the route set is constructed from them + * all. + * + * The initial route set can be reset with NUTAG_INITIAL_ROUTE(NULL). + * + * If a tag list of a request contains SIPTAG_ROUTE() or + * SIPTAG_ROUTE_STR() tags, the resulting route set will contain first the + * initial route entries followed by the route URIs given with the + * SIPTAG_ROUTE()/SIPTAG_ROUTE_STR() tags. + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * sip_route_t const * + * + * @par Values + * Linked list of #sip_route_t structures + * + * Corresponding tag taking reference parameter is NUTAG_INITIAL_ROUTE_STR_REF(). + * + * @NEW_1_12_7. + */ +EXPORT tag_typedef_t nutag_initial_route_str_ref; +tag_typedef_t nutag_initial_route_str; + +/**@def NUTAG_INITIAL_ROUTE_STR_REF(x) + * Reference tag for NUTAG_INITIAL_ROUTE_STR(). + */ + + +/**@def NUTAG_REGISTRAR(x) + * + * Registrar URL + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * url_string_t const * (either char const * or url_t *) + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_REGISTRAR_REF(). + */ +EXPORT tag_typedef_t nutag_registrar_ref; +tag_typedef_t nutag_registrar; + +/**@def NUTAG_REGISTRAR_REF(x) + * Reference tag for NUTAG_REGISTRAR(). + */ + + +/**@def NUTAG_IDENTITY(x) + * + * Registration handle (used with requests and nua_respond()) (NOT YET IMPLEMENTED) + * + * When a new request is made or new call is responded, a new identity can + * be selected with NUTAG_IDENTITY(). The identity comprises of @b From + * header, initial route set, local contact header and media tags associated + * with it, soa handle and so on. User can make multiple registrations using + * multiple identities. + * + * @par Used with + * nua_invite() + * + * @par Parameter type + * nua_handle_t * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_IDENTITY_REF(). + */ +EXPORT tag_typedef_t nutag_identity_ref; +tag_typedef_t nutag_identity; + +/**@def NUTAG_IDENTITY_REF(x) + * Reference tag for NUTAG_IDENTITY(). + */ + + +/**@def NUTAG_M_DISPLAY(x) + * + * Display name for @Contact. + * + * Specify display name for the Contact header URI generated for + * registration request and dialog-creating requests/responses. + * + * Note that the display name is not included the request-URI when proxy + * forwards the request towards the user-agent. + * + * @par Used with + * nua_register(), nua_set_hparams(), nua_set_params(). + * nua_invite(), nua_respond(), nua_subscribe(), nua_notify() + * + * @par Parameter type + * string (char *) + * + * @par Values + * Valid display name. + * + * @sa NUTAG_M_USERNAME(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(), + * NUTAG_CALLEE_CAPS(). + * + * Corresponding tag taking reference parameter is NUTAG_M_DISPLAY_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_m_display_ref; +tag_typedef_t nutag_m_display; + +/**@def NUTAG_M_DISPLAY_REF(x) + * Reference tag for NUTAG_M_DISPLAY(). + */ + + +/**@def NUTAG_M_USERNAME(x) + * + * Username prefix for @Contact. + * + * Specify username part for the Contact header URI generated for + * registration request and dialog-creating requests/responses. + * + * Using username, application can make multiple registrations using + * multiple identities, or it can distinguish between different logical + * destinations. + * + * @par Used with + * nua_register(), nua_set_hparams(), nua_set_params(). + * nua_invite(), nua_respond(), nua_subscribe(), nua_notify() + * + * @par Parameter type + * string (char *) + * + * @par Values + * Valid SIP username. + * + * @sa NUTAG_M_DISPLAY(), NUTAG_M_PARAMS(), NUTAG_M_FEATURES(), + * NUTAG_CALLEE_CAPS(). + * + * Corresponding tag taking reference parameter is NUTAG_M_USERNAME_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_m_username_ref; +tag_typedef_t nutag_m_username; + +/**@def NUTAG_M_USERNAME_REF(x) + * Reference tag for NUTAG_M_USERNAME(). + */ + + +/**@def NUTAG_M_PARAMS(x) + * + * URL parameters for @Contact. + * + * Specify URL parameters for the @Contact header URI generated for + * registration request and dialog-creating requests/responses. + * + * Please note that some proxies may remove even the non-transport + * parameters from the request-URI when they forward the request towards + * user-agent. + * + * @par Used with + * nua_register(), nua_set_hparams(), nua_set_params(), + * nua_invite(), nua_respond(), nua_subscribe(), nua_notify() + * + * @par Parameter type + * string (char *) + * + * @par Values + * Semicolon-separated URL parameters. + * + * @sa NUTAG_M_DISPLAY(), NUTAG_M_USERNAME(), NUTAG_M_FEATURES(), + * NUTAG_CALLEE_CAPS(). + * + * Corresponding tag taking reference parameter is NUTAG_M_PARAMS_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_m_params_ref; +tag_typedef_t nutag_m_params; + +/**@def NUTAG_M_PARAMS_REF(x) + * Reference tag for NUTAG_M_PARAMS(). + */ + + +/**@def NUTAG_M_FEATURES(x) + * + * Header parameters for @Contact used in registration. + * + * Specify header parameters for the @Contact header generated for + * registration request and dialog-creating requests/responses. Such header + * parameters include "q", indicating preference for the @Contact URI, and + * "expires", indicating the desired expiration time for the registration. + * + * Additional header parameters are typically media feature tags, specified in + * @RFC3840. If NUTAG_CALLEE_CAPS(1) is specified, additional @Contact header + * parameters are generated based on SDP capabilities and SIP @Allow header. + * + * When using the "outbound" extension option, the stack will also add + * "+sip.instance" and "reg-id" header parameters to the @Contact. + * + * @par Used with + * nua_register(), nua_set_hparams(), nua_set_params() + * + * @par Parameter type + * string (char *) + * + * @par Values + * Semicolon-separated SIP header parameters. + * + * @sa NUTAG_M_DISPLAY(), NUTAG_M_USERNAME(), NUTAG_M_PARAMS(), + * NUTAG_CALLEE_CAPS(), NUTAG_IDENTITY(). + * + * Corresponding tag taking reference parameter is NUTAG_M_FEATURES_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_m_features_ref; +tag_typedef_t nutag_m_features; + +/**@def NUTAG_M_FEATURES_REF(x) + * Reference tag for NUTAG_M_FEATURES(). + */ + + +/**@def NUTAG_INSTANCE(x) + * + * Intance identifier. + * + * @par Used with + * nua_create(), nua_set_params(), nua_get_params(), + * nua_register() + * + * @par Parameter type + * char const * + * + * @par Value + * urn:uuid string, a globally unique identifier for this user-agent + * instance. + * + * Corresponding tag taking reference parameter is NUTAG_INSTANCE_REF(). + */ +EXPORT tag_typedef_t nutag_instance_ref; +tag_typedef_t nutag_instance; + +/**@def NUTAG_INSTANCE_REF(x) + * Reference tag for NUTAG_INSTANCE(). + */ + + +/**@def NUTAG_OUTBOUND(x) + * + * Outbound option string. + * + * The outbound option string can specify how the NAT traversal is handled. + * The option tokens are as follows: + * - "gruuize": try to generate a GRUU contact from REGISTER response + * - "outbound": use SIP outbound extension (off by default) + * - "validate": validate registration behind a NAT by sending OPTIONS to self + * - "natify": try to traverse NAT + * - "use-rport": use rport to traverse NAT + * - "options-keepalive": send periodic OPTIONS requests as keepalive messages + * + * An option token with "no-" or "not-" prefix turns the option off. For + * example, if you want to try to traverse NATs but not to use OPTIONS + * keepalive, use NUTAG_OUTBOUND("natify no-options-keepalive"). + * + * An empty string can be passed to let the stack choose the + * default values for outbound usage (in the 1.12.5 release, the + * defaults are: "gruuize no-outbound validate use-port options-keepalive"). + * + * @note + * Options string is used so that no new tags need to be added when the + * outbound functionality changes. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_OUTBOUND_REF(). + */ +EXPORT tag_typedef_t nutag_outbound_ref; +tag_typedef_t nutag_outbound; + +/**@def NUTAG_OUTBOUND_REF(x) + * Reference tag for NUTAG_OUTBOUND(). + */ + + +/*#@def NUTAG_OUTBOUND_SET1(x) + * + * Outbound proxy set 1. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_OUTBOUND_SET1_REF(). + */ +EXPORT tag_typedef_t nutag_outbound_set1_ref; +tag_typedef_t nutag_outbound_set1; + +/*#@def NUTAG_OUTBOUND_SET1_REF(x) + * Reference tag for NUTAG_OUTBOUND_SET1(). + */ + + +/*#@def NUTAG_OUTBOUND_SET2(x) + * + * Outbound proxy set 2. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_OUTBOUND_SET2_REF(). + */ +EXPORT tag_typedef_t nutag_outbound_set2_ref; +tag_typedef_t nutag_outbound_set2; + +/*#@def NUTAG_OUTBOUND_SET2_REF(x) + * Reference tag for NUTAG_OUTBOUND_SET2(). + */ + + +/*#@def NUTAG_OUTBOUND_SET3(x) + * + * Outbound proxy set 3. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_OUTBOUND_SET3_REF(). + */ +EXPORT tag_typedef_t nutag_outbound_set3_ref; +tag_typedef_t nutag_outbound_set3; + +/*#@def NUTAG_OUTBOUND_SET3_REF(x) + * Reference tag for NUTAG_OUTBOUND_SET3(). + */ + + +/*#@def NUTAG_OUTBOUND_SET4(x) + * + * Outbound proxy set 4. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_OUTBOUND_SET4_REF(). + */ +EXPORT tag_typedef_t nutag_outbound_set4_ref; +tag_typedef_t nutag_outbound_set4; + +/*#@def NUTAG_OUTBOUND_SET4_REF(x) + * Reference tag for NUTAG_OUTBOUND_SET4(). + */ + + + +/**@def NUTAG_KEEPALIVE(x) + * + * Keepalive interval in milliseconds. + * + * This setting applies to OPTIONS/STUN keepalives. See documentation + * for nua_register() for more detailed information. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * unsigned int + * + * @par Values + * - 0 - disable keepalives + * - 120000 - default value (120000 milliseconds, 120 seconds) + * + * Corresponding tag taking reference parameter is + * NUTAG_KEEPALIVE_REF(). + */ +EXPORT tag_typedef_t nutag_keepalive_ref; +tag_typedef_t nutag_keepalive; + +/**@def NUTAG_KEEPALIVE_REF(x) + * Reference tag for NUTAG_KEEPALIVE(). + */ + + +/**@def NUTAG_KEEPALIVE_STREAM(x) + * + * Transport-level keepalive interval for streams. + * + * See documentation for nua_register() for more detailed information. + * + * @par Used with + * nua_register() \n + * nua_set_params() \n + * nua_get_params() + * nua_set_hparams() \n + * nua_get_hparams() + * + * @par Parameter type + * unsigned int + * + * @par Values + * + * Transport-level keepalive interval for streams in milliseconds. If this + * parameter specified, it takes presedence over value given in + * NUTAG_KEEPALIVE(). + * + * Corresponding tag taking reference parameter is + * NUTAG_KEEPALIVE_STREAM_REF(). + * + * @todo Actually pass NUTAG_KEEPALIVE_STREAM() to transport layer. + */ +EXPORT tag_typedef_t nutag_keepalive_stream_ref; +tag_typedef_t nutag_keepalive_stream; + +/**@def NUTAG_KEEPALIVE_STREAM_REF(x) + * Reference tag for NUTAG_KEEPALIVE_STREAM(). + */ + + + +/**@def NUTAG_USE_DIALOG(x) + * + * Ask NUA to create dialog for this handle + * + * @par Used with nua calls that send a SIP request + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - do not create a dialog + * - 1 (true) - store dialog info + * + * Corresponding tag taking reference parameter is NUTAG_USE_DIALOG_REF(). + */ +EXPORT tag_typedef_t nutag_use_dialog_ref; +tag_typedef_t nutag_use_dialog; + +/**@def NUTAG_USE_DIALOG_REF(x) + * Reference tag for NUTAG_USE_DIALOG(). + */ + + +/**@def NUTAG_AUTH(x) + * + * Authentication data ("scheme" "realm" "user" "password") + * + * @par Used with + * nua_authenticate() + * + * @par Parameter type + * char const * + * + * @par Values + * NULL terminated string of format: \n + * basic digest scheme:"realm":user:password \n + * @b NOTE the double quotes around realm! + * For example: \n + * \code Digest:"nokia proxy":xyz:secret \endcode + * + * Corresponding tag taking reference parameter is NUTAG_AUTH_REF(). + */ +EXPORT tag_typedef_t nutag_auth_ref; +tag_typedef_t nutag_auth; + +/**@def NUTAG_AUTH_REF(x) + * Reference tag for NUTAG_AUTH(). + */ + + +/**@def NUTAG_AUTHTIME(x) + * + * Lifetime of authentication data in seconds. + * + * @par Used with + * Currently not processed by NUA + * + * @par Parameter type + * unsigned int + * + * @par Values + * - 0 (zero) - Use authentication data only for this handle + * - nonzero - Lifetime of authentication data in seconds + * + * @todo + * + * Corresponding tag taking reference parameter is NUTAG_AUTHTIME_REF(). + */ +EXPORT tag_typedef_t nutag_authtime_ref; +tag_typedef_t nutag_authtime; + +/**@def NUTAG_AUTHTIME_REF(x) + * Reference tag for NUTAG_AUTHTIME(). + */ + + + +/**@def NUTAG_EVENT(x) + * + * NUA event. + * + * @deprecated + * + * @par Parameter type + * enum nua_event_e + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_EVENT_REF(). + */ +EXPORT tag_typedef_t nutag_event_ref; +tag_typedef_t nutag_event; + +/**@def NUTAG_EVENT_REF(x) + * Reference tag for NUTAG_EVENT(). + */ + + +/**@def NUTAG_STATUS(x) + * + * Response status code + * + * @deprecated + * + * @par Parameter type + * unsigned int + * + * @par Values + * - 100 - preliminary response, request is being processed by next hop + * - 1XX - preliminary response, request is being processed by UAS + * - 2XX - successful final response + * - 3XX - redirection error response + * - 4XX - client error response + * - 5XX - server error response + * - 6XX - global error response + * + * Corresponding tag taking reference parameter is NUTAG_STATUS_REF(). + */ +EXPORT tag_typedef_t nutag_status_ref; +tag_typedef_t nutag_status; + +/**@def NUTAG_STATUS_REF(x) + * Reference tag for NUTAG_STATUS(). + */ + + +/**@def NUTAG_PHRASE(x) + * + * Response phrase + * + * @deprecated + * + * @par Parameter type + * char const * + * + * @par Values. + * + * Corresponding tag taking reference parameter is NUTAG_PHRASE_REF(). + */ +EXPORT tag_typedef_t nutag_phrase_ref; +tag_typedef_t nutag_phrase; + +/**@def NUTAG_PHRASE_REF(x) + * Reference tag for NUTAG_PHRASE(). + */ + + +/**@def NUTAG_HANDLE(x) + * + * NUA Handle + * + * @deprecated + * + * @par Parameter type + * nua_handle_t * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_HANDLE_REF(). + */ +EXPORT tag_typedef_t nutag_handle_ref; +tag_typedef_t nutag_handle; + +/**@def NUTAG_HANDLE_REF(x) + * Reference tag for NUTAG_HANDLE(). + */ + + +/**@def NUTAG_NOTIFY_REFER(x) + * + * Refer reply handle (used with refer) + * + * When making a call in response to a REFER request [RFC3515] with + * nua_invite(), the application can ask NUA to automatically generate + * notifications about the call progress to the referrer. In order to + * do that the application should pass to the stack the handle, which + * it used to receive the REFER request. It should also pass the event + * header object along with the handle using NUTAG_REFER_EVENT(). + * + * @par Used with + * nua_invite() + * + * @par Parameter type + * nua_handle_t * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_NOTIFY_REFER_REF(). + */ +EXPORT tag_typedef_t nutag_notify_refer_ref; +tag_typedef_t nutag_notify_refer; + +/**@def NUTAG_NOTIFY_REFER_REF(x) + * Reference tag for NUTAG_NOTIFY_REFER(). + */ + +/**@def NUTAG_REFER_EVENT(x) + * + * Event used with automatic refer notifications. + * + * When creating a call in response to a REFER request [RFC3515] + * the application can ask NUA to automatically generate notifications + * about the call progress to the referrer. The #nua_i_refer event will + * contain a suitable SIP event header for the notifications in the + * NUTAG_REFER_EVENT() tag. The application should store the SIP event + * header and when it makes the referred call, it should pass it back + * to the stack again using the NUTAG_REFER_EVENT() tag. + * + * @par Used with + * + * @par Parameter type + * sip_event_t * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_REFER_EVENT_REF(). + */ +EXPORT tag_typedef_t nutag_refer_event_ref; +tag_typedef_t nutag_refer_event; + +/**@def NUTAG_REFER_EVENT_REF(x) + * Reference tag for NUTAG_REFER_EVENT(). + */ + + +/**@def NUTAG_REFER_PAUSE() + * + * Invite pauses referrer's handle. + * + * When creating a call in response to a REFER [RFC3515] request, + * the application can ask that the original call will be muted + * when the new call is connected by specifying NUTAG_REFER_PAUSE() + * along with NUTAG_NOTIFY_REFER() as a parameter to nua_invite() call. + * + * @par Used with + * nua_invite() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - do not pause referring call + * - 1 (true) - pause referring call + * + * Corresponding tag taking reference parameter is NUTAG_REFER_PAUSE_REF(). + * + * @deprecated Not implemented. + */ +EXPORT tag_typedef_t nutag_refer_pause_ref; +tag_typedef_t nutag_refer_pause; + +/**@def NUTAG_REFER_PAUSE_REF(x) + * Reference tag for NUTAG_REFER_PAUSE(). + */ + + +/**@def NUTAG_USER_AGENT() + * + * User-Agent string. + * + * Indicate the User-Agent header used by the stack. The value set with this + * tag is concatenated with the value indicating the stack name and version, + * e.g., "sofia-sip/1.12.1" unless the stack name "sofia-sip" followed by + * slash is already included in the string. The concatenated value is + * returned in SIPTAG_USER_AGENT_STR() and NUTAG_USER_AGENT() when + * nua_get_params() is called. + * + * If you want to set the complete string, use SIPTAG_USER_AGENT_STR() or + * SIPTAG_USER_AGENT(). + * + * @par Used with + * nua_set_params(), nua_set_hparams() \n + * nua_get_params(), nua_get_hparams(), #nua_r_get_params \n + * any handle-specific nua call + * + * @par Parameter type + * char const * + * + * @par Values + * See @RFC3261 \n + * If NULL, stack uses default string which of format "sofia-sip/1.12". + * + * Corresponding tag taking reference parameter is NUTAG_USER_AGENT_REF(). + */ +EXPORT tag_typedef_t nutag_user_agent_ref; +tag_typedef_t nutag_user_agent; + +/**@def NUTAG_USER_AGENT_REF(x) + * Reference tag for NUTAG_USER_AGENT(). + */ + + +/**@def NUTAG_ALLOW() + * + * Allow a method (or methods). + * + * This tag is used to add a new method to the already existing set of + * allowed methods. If you want to ignore the existing set of allowed + * methods, use SIPTAG_ALLOW_STR() or SIPTAG_ALLOW(). + * + * The set of allowed methods is added to the @Allow header in the response + * or request messages. For incoming request, an error response 405 + * Method Not Allowed is automatically returned if the incoming method + * is not included in the set. + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * char const * + * + * @par Values + * Valid method name, or comma-separated list of them. + * + * Corresponding tag taking reference parameter is NUTAG_ALLOW_REF(). + */ +EXPORT tag_typedef_t nutag_allow_ref; +tag_typedef_t nutag_allow; + +/**@def NUTAG_ALLOW_REF(x) + * Reference tag for NUTAG_ALLOW(). + */ + + +/**@def NUTAG_ALLOW_EVENTS() + * + * Allow an event or events. + * + * This tag is used to add a new event to the already existing set of + * allowed events. If you want to ignore the existing set of allowed events, + * set the allowed event set with SIPTAG_ALLOW_EVENTS_STR() or + * SIPTAG_ALLOW_EVENTS(). + * + * The set of allowed methods is added to the @AllowEvents header in the + * response to the SUBSCRIBE or PUBLISH requests. For incoming SUBSCRIBE or + * PUBLISH request, an error response 489 Bad Event is automatically + * returned if the incoming method is not included in the set. + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * char const * + * + * @par Values + * Valid event name, or comma-separated list of them. + * + * @sa @AllowEvents, @RFC3265, @RFC3903, #nua_i_subscribe, #nua_i_publish, + * nua_subscribe(), nua_publish(), SIPTAG_ALLOW_EVENTS(), + * SIPTAG_ALLOW_EVENTS_STR() + * + * @NEW_1_12_4. + * + * Corresponding tag taking reference parameter is NUTAG_ALLOW_EVENTS_REF(). + */ +EXPORT tag_typedef_t nutag_allow_events_ref; +tag_typedef_t nutag_allow_events; + +/**@def NUTAG_ALLOW_EVENTS_REF(x) + * Reference tag for NUTAG_ALLOW_EVENTS(). + */ + + +/**@def NUTAG_APPL_METHOD() + * + * Indicate that a method (or methods) are handled by application. + * + * This tag is used to add a new method to the already existing set of + * methods handled by application, or clear the set. If you want to + * determine the set explicitly, include NUTAG_APPL_METHOD() twice, + * first with NULL and then with your supported set. + * + * The default set of application methods now include INVITE, REGISTER, + * PUBLISH and SUBSCRIBE. + * + * If the request method is in the set of methods handled by application, + * the nua stack does not automatically respond to the incoming request nor + * it will automatically send such a request. Note if the application adds + * the PRACK and UPDATE requests to the set of application methods it must + * also take care for sending the PRACK and UPDATE requests during the call + * setup when necessary. + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * char const * + * + * @par Values + * Valid method name, or comma-separated list of them. + * + * Corresponding tag taking reference parameter is NUTAG_APPL_METHOD_REF(). + * + * @since Working since @VERSION_1_12_5. Handling of client-side PRACK and + * UPDATE was fixed in @VERSION_1_12_6. + */ +EXPORT tag_typedef_t nutag_appl_method_ref; +tag_typedef_t nutag_appl_method; + +/**@def NUTAG_APPL_METHOD_REF(x) + * Reference tag for NUTAG_APPL_METHOD(). + */ + + +/**@def NUTAG_SUPPORTED() + * + * Support a feature. + * + * This tag is used to add a new feature to the existing set of supported + * SIP features. If you want to ignore the existing set of supported + * features, use SIPTAG_SUPPORTED_STR() or SIPTAG_SUPPORTED(). + * + * The set of supported features is added to the @Supported header in the + * response or request messages. For incoming requests, an error response + * 420 Bad Extension is automatically returned if the request + * requires features that are not included in the supported feature set. + * + * @par Used with + * nua_set_params() \n + * nua_set_hparams() \n + * any handle-specific nua call + * + * @par Parameter type + * char const * + * + * @par Values + * Feature name, or comma-separated list of them. + * + * Corresponding tag taking reference parameter is NUTAG_SUPPORTED_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_supported_ref; +tag_typedef_t nutag_supported; + +/**@def NUTAG_SUPPORTED_REF(x) + * Reference tag for NUTAG_SUPPORTED(). + */ + + +/**@def NUTAG_PATH_ENABLE(x) + * + * If true, add "path" to @Supported in REGISTER. + * + * @par Used with + * - nua_create(), nua_set_params(), nua_get_params() + * - nua_handle(), nua_set_hparams(), nua_get_hparams() + * - nua_register() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - Do not include "path" to @Supported header + * - 1 (true) - Include "path" to @Supported header + * + * @sa NUTAG_SERVICE_ROUTE_ENABLE(), NUTAG_SUPPORTED(), + * NUTAG_INITIAL_ROUTE(), NUTAG_INITIAL_ROUTE_STR(), @RFC3327 + * "SIP Extension Header Field for Registering Non-Adjacent Contacts", + * D. Willis, B. Hoeneisen, + * December 2002. + */ +EXPORT tag_typedef_t nutag_path_enable_ref; +tag_typedef_t nutag_path_enable; + +/**@def NUTAG_PATH_ENABLE_REF(x) + * Reference tag for NUTAG_PATH_ENABLE(). + */ + + + +/**@def NUTAG_SERVICE_ROUTE_ENABLE(x) + * + * Use route taken from the @ServiceRoute header in the 200 class response + * to REGISTER. + * + * @par Used with + * - nua_create(), nua_set_params(), nua_get_params() + * - nua_handle(), nua_set_hparams(), nua_get_hparams() + * - nua_register() + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - Do not use @ServiceRoute + * - 1 (true) - Use @ServiceRoute + * + * Corresponding tag taking reference parameter is NUTAG_SERVICE_ROUTE_ENABLE_REF(). + * + * @sa NUTAG_INITIAL_ROUTE(), NUTAG_INITIAL_ROUTE_STR(), @RFC3608 + * + * @todo + */ +EXPORT tag_typedef_t nutag_service_route_enable_ref; +tag_typedef_t nutag_service_route_enable = + BOOLTAG_TYPEDEF(service_route_enable); + +/**@def NUTAG_SERVICE_ROUTE_ENABLE_REF(x) + * Reference tag for NUTAG_SERVICE_ROUTE_ENABLE(). + */ + + +/**@def NUTAG_AUTH_CACHE(x) + * + * Authentication caching policy + * + * @par Used with + * nua_set_params(), nua_set_hparams() \n + * nua_get_params(), nua_get_hparams() \n + * @NUA_HPARAM_CALLS + * + * @par Parameter type + * enum nua_auth_cache + * + * @par Values + * - nua_auth_cache_dialog (0) - include credentials within dialog + * - nua_auth_cache_challenged (1) - include credentials only when + * challenged + * + * Corresponding tag taking reference parameter is NUTAG_AUTH_CACHE_REF(). + * + * @NEW_1_12_6. + */ +EXPORT tag_typedef_t nutag_auth_cache_ref; +tag_typedef_t nutag_auth_cache; + +/**@def NUTAG_AUTH_CACHE_REF(x) + * Reference tag for NUTAG_AUTH_CACHE(). + */ + + +/**@def NUTAG_DETECT_NETWORK_UPDATES(x) + * + * Enable detection of local IP address updates. + * + * @par Used with + * nua_create() \n + * nua_set_params() \n + * nua_get_params() + * + * @par Parameter type + * int (enum nua_nw_detector_e aka #nua_nw_detector_t) + * + * @sa #nua_i_network_changed, #nua_nw_detector_t + * + * Corresponding tag taking reference parameter is + * NUTAG_DETECT_NETWORK_UPDATES_REF(). + * + * @since New in @VERSION_1_12_2. + */ +EXPORT tag_typedef_t nutag_detect_network_updates_ref; +tag_typedef_t nutag_detect_network_updates; + +/**@def NUTAG_DETECT_NETWORK_UPDATES_REF(x) + * Reference tag for NUTAG_DETECT_NETWORK_UPDATES(). + */ + + +/**@def NUTAG_WITH_THIS(nua) + * + * Specify request to respond to. + * + * @par Used with + * nua_respond() + * + * @par Parameter type + * nua_t * + * + * @par Values + * Pointer to the nua agent instance object. + * + * @NEW_1_12_4. + * + * @sa NUTAG_WITH(), NUTAG_WITH_SAVED() + */ + +/**@def NUTAG_WITH(msg) + * + * Specify request to respond to. + * + * @par Used with + * nua_respond() + * + * @par Parameter type + * msg_t * + * + * @par Values + * Pointer to a request message. + * + * @NEW_1_12_4. + * + * @sa nua_save_event(), NUTAG_WITH_THIS(), NUTAG_WITH_SAVED() + */ + +/**@def NUTAG_WITH_SAVED(event) + * + * Specify request to respond to. + * + * @par Used with + * nua_respond() + * + * @par Parameter type + * nua_saved_event_t * + * + * @par Values + * Pointer to a saved event. + * + * @NEW_1_12_4. + * + * @sa nua_save_event(), NUTAG_WITH(), NUTAG_WITH_THIS() + */ + +EXPORT tag_typedef_t nutag_with_ref; +tag_typedef_t nutag_with; + + +/**@def NUTAG_DIALOG(x) + * + * An (extension) method is used to create dialog or refresh target. + * + * @par Used with + * nua_method() + * + * @par Parameter type + * unsigned int (0, 1, 2) + * + * @par Values + * - 0 if dialog target is not refreshed + * - 1 if dialog target is refreshed + * - > 1 if dialog is to be created + * + * @NEW_1_12_6. + * + * @sa nua_method(), #nua_i_method + */ +EXPORT tag_typedef_t nutag_dialog_ref; +tag_typedef_t nutag_dialog; + + +/**@def NUTAG_PROXY(x) + * + * Outbound proxy URL. + * + * Same tag as NTATAG_DEFAULT_PROXY() + * + * @par Used with + * nua_set_params() \n + * nua_get_params() \n + * nua_create() + * @note + * Since @VERSION_1_12_9, NUTAG_PROXY()/NTATAG_DEFAULT_PROXY() can be used + * to set handle-specific outbound route. The route is set with \n + * nua_set_hparams(), \n + * nua_invite(), nua_prack(), nua_ack(), nua_update(), nua_respond(), \n + * nua_info(), nua_cancel(), nua_bye(), \n + * nua_register(), nua_unregister(), nua_publish(), nua_unpublish(), \n + * nua_subscribe(), nua_unsubscribe(), nua_refer(), nua_notify(), \n + * nua_options(), nua_message(), nua_method() + * + * @par Parameter type + * url_string_t const * (either char const * or url_t *) + * + * @par Values + * NULL implies routing based on request-URI or Route header. + * Non-NULL is used as invisible routing URI, ie., routing URI that is + * not included in the request. + * + * Corresponding tag taking reference parameter is NUTAG_PROXY_REF(). + */ + +/**@def NUTAG_PROXY_REF(x) + * Reference tag for NUTAG_PROXY(). + */ + +/**@def NUTAG_SIP_PARSER(x) + * + * Pointer to SIP parser structure + * + * @par Used with + * nua_create() + * + * @par Parameter type + * msg_mclass_t const * + * + * @par Values + * Pointer to an extended SIP parser. + * + * @sa msg_mclass_clone(), msg_mclass_insert_header() + * + * Corresponding tag taking reference parameter is NUTAG_SIP_PARSER_REF(). + */ + +/**@def NUTAG_SIP_PARSER_REF(x) + * Reference tag for NUTAG_SIP_PARSER(). + */ + + +/**@def NUTAG_SHUTDOWN_EVENTS(x) + * + * Allow passing of normal events when stack is being shut down. + * + * By default, only #nua_r_shutdown events are passed to application after + * calling nua_shutdown(). If application is interested in nua events during + * shutdown, it should give NUTAG_SHUTDOWN_EVENTS(1) to nua_create() or + * nua_set_params() called before nua_shutdown(). + * + * @par Used with + * nua_create(), nua_set_params(). + * + * @par Parameter type + * int (boolean: nonzero is true, zero is false) + * + * @par Values + * - 0 (false) - pass only #nua_r_shutdown events to application during shutdown + * - 1 (true) - pass all events to application during shutdown + * + * Corresponding tag taking reference parameter is NUTAG_SHUTDOWN_EVENTS_REF(). + * + * @sa nua_shutdown(), nua_destroy(). + * + * @NEW_1_12_9. + */ +EXPORT tag_typedef_t nutag_shutdown_events_ref; +tag_typedef_t nutag_shutdown_events; + +/**@def NUTAG_SHUTDOWN_EVENTS_REF(x) + * Reference tag for NUTAG_SHUTDOWN_EVENTS(). + */ + + +/* ---------------------------------------------------------------------- */ + +EXPORT tag_typedef_t nutag_soa_session_ref; +tag_typedef_t nutag_soa_session; +EXPORT tag_typedef_t nutag_hold_ref; +tag_typedef_t nutag_hold; +EXPORT tag_typedef_t nutag_address_ref; +tag_typedef_t nutag_address; + +#include + +BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fwdReason, LPVOID fImpLoad) +{ + tag_typedef_t _nutag_retry_count = UINTTAG_TYPEDEF(retry_count); + tag_typedef_t _nutag_retry_count_ref = + REFTAG_TYPEDEF(nutag_retry_count); + tag_typedef_t _nutag_uicc = STRTAG_TYPEDEF(uicc); + tag_typedef_t _nutag_uicc_ref = + REFTAG_TYPEDEF(nutag_uicc); + tag_typedef_t _nutag_smime_opt = INTTAG_TYPEDEF(smime_opt); + tag_typedef_t _nutag_smime_opt_ref = + REFTAG_TYPEDEF(nutag_smime_opt); + tag_typedef_t _nutag_sips_url = URLTAG_TYPEDEF(sips_url); + tag_typedef_t _nutag_sips_url_ref = + REFTAG_TYPEDEF(nutag_sips_url); + tag_typedef_t _nutag_soa_session = PTRTAG_TYPEDEF(soa_session); + tag_typedef_t _nutag_soa_session_ref = + REFTAG_TYPEDEF(nutag_soa_session); + tag_typedef_t _nutag_keepalive_stream = UINTTAG_TYPEDEF(keepalive_stream); + tag_typedef_t _nutag_keepalive_stream_ref = + REFTAG_TYPEDEF(nutag_keepalive_stream); + tag_typedef_t _nutag_enablemessenger = BOOLTAG_TYPEDEF(enableMessenger); + tag_typedef_t _nutag_enablemessenger_ref = + REFTAG_TYPEDEF(nutag_enablemessenger); + tag_typedef_t _nutag_path_enable = BOOLTAG_TYPEDEF(path_enable); + tag_typedef_t _nutag_path_enable_ref = + REFTAG_TYPEDEF(nutag_path_enable); + tag_typedef_t _nutag_early_ims = BOOLTAG_TYPEDEF(early_ims); + tag_typedef_t _nutag_early_ims_ref = + REFTAG_TYPEDEF(nutag_early_ims); + tag_typedef_t _nutag_initial_route_str = STRTAG_TYPEDEF(inital_route_str); + tag_typedef_t _nutag_initial_route_str_ref = + REFTAG_TYPEDEF(nutag_initial_route_str); + tag_typedef_t _nutag_certificate_dir = STRTAG_TYPEDEF(certificate_dir); + tag_typedef_t _nutag_certificate_dir_ref = + REFTAG_TYPEDEF(nutag_certificate_dir); + tag_typedef_t _nutag_authtime = INTTAG_TYPEDEF(authtime); + tag_typedef_t _nutag_authtime_ref = + REFTAG_TYPEDEF(nutag_authtime); + tag_typedef_t _nutag_smime_signature = + tag_typedef_t _nutag_smime_signature_ref = + REFTAG_TYPEDEF(nutag_smime_signature); + tag_typedef_t _nutag_enableinvite = BOOLTAG_TYPEDEF(enableInvite); + tag_typedef_t _nutag_enableinvite_ref = + REFTAG_TYPEDEF(nutag_enableinvite); + tag_typedef_t _nutag_answer_sent = BOOLTAG_TYPEDEF(answer_sent); + tag_typedef_t _nutag_answer_sent_ref = + REFTAG_TYPEDEF(nutag_answer_sent); + tag_typedef_t _nutag_smime_message_encryption = + tag_typedef_t _nutag_smime_message_encryption_ref = + REFTAG_TYPEDEF(nutag_smime_message_encryption); + tag_typedef_t _nutag_keepalive = UINTTAG_TYPEDEF(keepalive); + tag_typedef_t _nutag_keepalive_ref = + REFTAG_TYPEDEF(nutag_keepalive); + tag_typedef_t _nutag_auth = STRTAG_TYPEDEF(auth); + tag_typedef_t _nutag_auth_ref = + REFTAG_TYPEDEF(nutag_auth); + tag_typedef_t _nutag_min_se = UINTTAG_TYPEDEF(min_se); + tag_typedef_t _nutag_min_se_ref = + REFTAG_TYPEDEF(nutag_min_se); + tag_typedef_t _nutag_url = URLTAG_TYPEDEF(url); + tag_typedef_t _nutag_url_ref = + REFTAG_TYPEDEF(nutag_url); + tag_typedef_t _nutag_identity = PTRTAG_TYPEDEF(identity); + tag_typedef_t _nutag_identity_ref = + REFTAG_TYPEDEF(nutag_identity); + tag_typedef_t _nutag_notify_refer = PTRTAG_TYPEDEF(notify_refer); + tag_typedef_t _nutag_notify_refer_ref = + REFTAG_TYPEDEF(nutag_notify_refer); + tag_typedef_t _nutag_initial_route = SIPEXTHDRTAG_TYPEDEF(initial_route, route); + tag_typedef_t _nutag_initial_route_ref = + REFTAG_TYPEDEF(nutag_initial_route); + tag_typedef_t _nutag_early_media = BOOLTAG_TYPEDEF(early_media); + tag_typedef_t _nutag_early_media_ref = + REFTAG_TYPEDEF(nutag_early_media); + tag_typedef_t _nutag_impi = STRTAG_TYPEDEF(impi) + tag_typedef_t _nutag_impi_ref = + REFTAG_TYPEDEF(nutag_impi); + tag_typedef_t _nutag_service_route_enable = + tag_typedef_t _nutag_service_route_enable_ref = + REFTAG_TYPEDEF(nutag_service_route_enable); + tag_typedef_t _nutag_allow_events = STRTAG_TYPEDEF(allow_events); + tag_typedef_t _nutag_allow_events_ref = + REFTAG_TYPEDEF(nutag_allow_events); + tag_typedef_t _nutag_smime_message_digest = + tag_typedef_t _nutag_smime_message_digest_ref = + REFTAG_TYPEDEF(nutag_smime_message_digest); + tag_typedef_t _nutag_only183_100rel = BOOLTAG_TYPEDEF(only183_100rel); + tag_typedef_t _nutag_only183_100rel_ref = + REFTAG_TYPEDEF(nutag_only183_100rel); + tag_typedef_t _nutag_use_dialog = BOOLTAG_TYPEDEF(use_dialog); + tag_typedef_t _nutag_use_dialog_ref = + REFTAG_TYPEDEF(nutag_use_dialog); + tag_typedef_t _nutag_outbound = STRTAG_TYPEDEF(outbound); + tag_typedef_t _nutag_outbound_ref = + REFTAG_TYPEDEF(nutag_outbound); + tag_typedef_t _nutag_outbound_set1 = STRTAG_TYPEDEF(outbound_set1); + tag_typedef_t _nutag_outbound_set1_ref = + REFTAG_TYPEDEF(nutag_outbound_set1); + tag_typedef_t _nutag_invite_timer = UINTTAG_TYPEDEF(invite_timer); + tag_typedef_t _nutag_invite_timer_ref = + REFTAG_TYPEDEF(nutag_invite_timer); + tag_typedef_t _nutag_outbound_set2 = STRTAG_TYPEDEF(outbound_set2); + tag_typedef_t _nutag_outbound_set2_ref = + REFTAG_TYPEDEF(nutag_outbound_set2); + tag_typedef_t _nutag_session_timer = UINTTAG_TYPEDEF(session_timer); + tag_typedef_t _nutag_session_timer_ref = + REFTAG_TYPEDEF(nutag_session_timer); + tag_typedef_t _nutag_outbound_set3 = STRTAG_TYPEDEF(outbound_set3); + tag_typedef_t _nutag_outbound_set3_ref = + REFTAG_TYPEDEF(nutag_outbound_set3); + tag_typedef_t _nutag_phrase = STRTAG_TYPEDEF(phrase); + tag_typedef_t _nutag_phrase_ref = + REFTAG_TYPEDEF(nutag_phrase); + tag_typedef_t _nutag_outbound_set4 = STRTAG_TYPEDEF(outbound_set4); + tag_typedef_t _nutag_outbound_set4_ref = + REFTAG_TYPEDEF(nutag_outbound_set4); + tag_typedef_t _nutag_impu = URLTAG_TYPEDEF(impu) + tag_typedef_t _nutag_impu_ref = + REFTAG_TYPEDEF(nutag_impu); + tag_typedef_t _nutag_detect_network_updates = UINTTAG_TYPEDEF(detect_network_updates); + tag_typedef_t _nutag_detect_network_updates_ref = + REFTAG_TYPEDEF(nutag_detect_network_updates); + tag_typedef_t _nutag_offer_recv = BOOLTAG_TYPEDEF(offer_recv); + tag_typedef_t _nutag_offer_recv_ref = + REFTAG_TYPEDEF(nutag_offer_recv); + tag_typedef_t _nutag_m_username = STRTAG_TYPEDEF(m_username); + tag_typedef_t _nutag_m_username_ref = + REFTAG_TYPEDEF(nutag_m_username); + tag_typedef_t _nutag_max_subscriptions = UINTTAG_TYPEDEF(max_subscriptions); + tag_typedef_t _nutag_max_subscriptions_ref = + REFTAG_TYPEDEF(nutag_max_subscriptions); + tag_typedef_t _nutag_smime_enable = BOOLTAG_TYPEDEF(smime_enable); + tag_typedef_t _nutag_smime_enable_ref = + REFTAG_TYPEDEF(nutag_smime_enable); + tag_typedef_t _nutag_answer_recv = BOOLTAG_TYPEDEF(answer_recv); + tag_typedef_t _nutag_answer_recv_ref = + REFTAG_TYPEDEF(nutag_answer_recv); + tag_typedef_t _nutag_shutdown_events = BOOLTAG_TYPEDEF(shutdown_events); + tag_typedef_t _nutag_shutdown_events_ref = + REFTAG_TYPEDEF(nutag_shutdown_events); + tag_typedef_t _nutag_session_refresher = INTTAG_TYPEDEF(session_refresher); + tag_typedef_t _nutag_session_refresher_ref = + REFTAG_TYPEDEF(nutag_session_refresher); + tag_typedef_t _nutag_user_agent = STRTAG_TYPEDEF(user_agent); + tag_typedef_t _nutag_user_agent_ref = + REFTAG_TYPEDEF(nutag_user_agent); + tag_typedef_t _nutag_soa_name = STRTAG_TYPEDEF(soa_name); + tag_typedef_t _nutag_soa_name_ref = + REFTAG_TYPEDEF(nutag_soa_name); + tag_typedef_t _nutag_update_refresh = BOOLTAG_TYPEDEF(update_refresh); + tag_typedef_t _nutag_update_refresh_ref = + REFTAG_TYPEDEF(nutag_update_refresh); + tag_typedef_t _nutag_dialog = UINTTAG_TYPEDEF(dialog); + tag_typedef_t _nutag_dialog_ref = + REFTAG_TYPEDEF(nutag_dialog); + tag_typedef_t _nutag_substate = INTTAG_TYPEDEF(substate); + tag_typedef_t _nutag_substate_ref = + REFTAG_TYPEDEF(nutag_substate); + tag_typedef_t _nutag_m_display = STRTAG_TYPEDEF(m_display); + tag_typedef_t _nutag_m_display_ref = + REFTAG_TYPEDEF(nutag_m_display); + tag_typedef_t _nutag_address = STRTAG_TYPEDEF(address); + tag_typedef_t _nutag_address_ref = + REFTAG_TYPEDEF(nutag_address); + tag_typedef_t _nutag_refer_with_id = BOOLTAG_TYPEDEF(refer_with_id); + tag_typedef_t _nutag_refer_with_id_ref = + REFTAG_TYPEDEF(nutag_refer_with_id); + tag_typedef_t _nutag_include_extra_sdp = BOOLTAG_TYPEDEF(include_extra_sdp); + tag_typedef_t _nutag_include_extra_sdp_ref = + REFTAG_TYPEDEF(nutag_include_extra_sdp); + tag_typedef_t _nutag_media_features = BOOLTAG_TYPEDEF(media_features); + tag_typedef_t _nutag_media_features_ref = + REFTAG_TYPEDEF(nutag_media_features); + tag_typedef_t _nutag_certificate_phrase = STRTAG_TYPEDEF(certificate_phrase); + tag_typedef_t _nutag_certificate_phrase_ref = + REFTAG_TYPEDEF(nutag_certificate_phrase); + tag_typedef_t _nutag_m_features = STRTAG_TYPEDEF(m_features); + tag_typedef_t _nutag_m_features_ref = + REFTAG_TYPEDEF(nutag_m_features); + tag_typedef_t _nutag_refer_event = SIPHDRTAG_NAMED_TYPEDEF(refer_event, event); + tag_typedef_t _nutag_refer_event_ref = + REFTAG_TYPEDEF(nutag_refer_event); + tag_typedef_t _nutag_refer_expires = UINTTAG_TYPEDEF(refer_expires); + tag_typedef_t _nutag_refer_expires_ref = + REFTAG_TYPEDEF(nutag_refer_expires); + tag_typedef_t _nutag_autoanswer = BOOLTAG_TYPEDEF(autoAnswer); + tag_typedef_t _nutag_autoanswer_ref = + REFTAG_TYPEDEF(nutag_autoanswer); + tag_typedef_t _nutag_enablemessage = BOOLTAG_TYPEDEF(enableMessage); + tag_typedef_t _nutag_enablemessage_ref = + REFTAG_TYPEDEF(nutag_enablemessage); + tag_typedef_t _nutag_realm = STRTAG_TYPEDEF(realm) + tag_typedef_t _nutag_realm_ref = + REFTAG_TYPEDEF(nutag_realm); + tag_typedef_t _nutag_registrar = URLTAG_TYPEDEF(registrar); + tag_typedef_t _nutag_registrar_ref = + REFTAG_TYPEDEF(nutag_registrar); + tag_typedef_t _nutag_m_params = STRTAG_TYPEDEF(m_params); + tag_typedef_t _nutag_m_params_ref = + REFTAG_TYPEDEF(nutag_m_params); + tag_typedef_t _nutag_status = INTTAG_TYPEDEF(status); + tag_typedef_t _nutag_status_ref = + REFTAG_TYPEDEF(nutag_status); + tag_typedef_t _nutag_refer_pause = BOOLTAG_TYPEDEF(refer_pause); + tag_typedef_t _nutag_refer_pause_ref = + REFTAG_TYPEDEF(nutag_refer_pause); + tag_typedef_t _nutag_appl_method = STRTAG_TYPEDEF(appl_method); + tag_typedef_t _nutag_appl_method_ref = + REFTAG_TYPEDEF(nutag_appl_method); + tag_typedef_t _nutag_allow = STRTAG_TYPEDEF(allow); + tag_typedef_t _nutag_allow_ref = + REFTAG_TYPEDEF(nutag_allow); + tag_typedef_t _nutag_handle = PTRTAG_TYPEDEF(handle); + tag_typedef_t _nutag_handle_ref = + REFTAG_TYPEDEF(nutag_handle); + tag_typedef_t _nutag_newsub = BOOLTAG_TYPEDEF(newsub); + tag_typedef_t _nutag_newsub_ref = + REFTAG_TYPEDEF(nutag_newsub); + tag_typedef_t _nutag_callee_caps = BOOLTAG_TYPEDEF(callee_caps); + tag_typedef_t _nutag_callee_caps_ref = + REFTAG_TYPEDEF(nutag_callee_caps); + tag_typedef_t _nutag_hold = BOOLTAG_TYPEDEF(hold); + tag_typedef_t _nutag_hold_ref = + REFTAG_TYPEDEF(nutag_hold); + tag_typedef_t _nutag_smime_key_encryption = + tag_typedef_t _nutag_smime_key_encryption_ref = + REFTAG_TYPEDEF(nutag_smime_key_encryption); + tag_typedef_t _nutag_auth_cache = INTTAG_TYPEDEF(auth_cache); + tag_typedef_t _nutag_auth_cache_ref = + REFTAG_TYPEDEF(nutag_auth_cache); + tag_typedef_t _nutag_any = NSTAG_TYPEDEF(*); + tag_typedef_t _nutag_any_ref = + REFTAG_TYPEDEF(nutag_any); + tag_typedef_t _nutag_with = PTRTAG_TYPEDEF(with); + tag_typedef_t _nutag_with_ref = + REFTAG_TYPEDEF(nutag_with); + tag_typedef_t _nutag_supported = STRTAG_TYPEDEF(supported); + tag_typedef_t _nutag_supported_ref = + REFTAG_TYPEDEF(nutag_supported); + tag_typedef_t _nutag_method = STRTAG_TYPEDEF(method); + tag_typedef_t _nutag_method_ref = + REFTAG_TYPEDEF(nutag_method); + tag_typedef_t _nutag_smime_protection_mode = + tag_typedef_t _nutag_smime_protection_mode_ref = + REFTAG_TYPEDEF(nutag_smime_protection_mode); + tag_typedef_t _nutag_early_answer = BOOLTAG_TYPEDEF(early_answer); + tag_typedef_t _nutag_early_answer_ref = + REFTAG_TYPEDEF(nutag_early_answer); + tag_typedef_t _nutag_event = INTTAG_TYPEDEF(event); + tag_typedef_t _nutag_event_ref = + REFTAG_TYPEDEF(nutag_event); + tag_typedef_t _nutag_media_enable = BOOLTAG_TYPEDEF(media_enable); + tag_typedef_t _nutag_media_enable_ref = + REFTAG_TYPEDEF(nutag_media_enable); + tag_typedef_t _nutag_instance = STRTAG_TYPEDEF(instance); + tag_typedef_t _nutag_instance_ref = + REFTAG_TYPEDEF(nutag_instance); + tag_typedef_t _nutag_callstate = INTTAG_TYPEDEF(callstate); + tag_typedef_t _nutag_callstate_ref = + REFTAG_TYPEDEF(nutag_callstate); + tag_typedef_t _nutag_autoack = BOOLTAG_TYPEDEF(autoACK); + tag_typedef_t _nutag_autoack_ref = + REFTAG_TYPEDEF(nutag_autoack); + tag_typedef_t _nutag_offer_sent = BOOLTAG_TYPEDEF(offer_sent); + tag_typedef_t _nutag_offer_sent_ref = + REFTAG_TYPEDEF(nutag_offer_sent); + tag_typedef_t _nutag_refresh_without_sdp = BOOLTAG_TYPEDEF(refresh_without_sdp); + tag_typedef_t _nutag_refresh_without_sdp_ref = + REFTAG_TYPEDEF(nutag_refresh_without_sdp); + tag_typedef_t _nutag_sub_expires = UINTTAG_TYPEDEF(substate); + tag_typedef_t _nutag_sub_expires_ref = + REFTAG_TYPEDEF(nutag_sub_expires); + tag_typedef_t _nutag_autoalert = BOOLTAG_TYPEDEF(autoAlert); + tag_typedef_t _nutag_autoalert_ref = + REFTAG_TYPEDEF(nutag_autoalert); + + *(struct tag_type_s *)nutag_retry_count = *_nutag_retry_count; + *(struct tag_type_s *)nutag_retry_count_ref = *_nutag_retry_count_ref; + *(struct tag_type_s *)nutag_uicc = *_nutag_uicc; + *(struct tag_type_s *)nutag_uicc_ref = *_nutag_uicc_ref; + *(struct tag_type_s *)nutag_smime_opt = *_nutag_smime_opt; + *(struct tag_type_s *)nutag_smime_opt_ref = *_nutag_smime_opt_ref; + *(struct tag_type_s *)nutag_sips_url = *_nutag_sips_url; + *(struct tag_type_s *)nutag_sips_url_ref = *_nutag_sips_url_ref; + *(struct tag_type_s *)nutag_soa_session = *_nutag_soa_session; + *(struct tag_type_s *)nutag_soa_session_ref = *_nutag_soa_session_ref; + *(struct tag_type_s *)nutag_keepalive_stream = *_nutag_keepalive_stream; + *(struct tag_type_s *)nutag_keepalive_stream_ref = *_nutag_keepalive_stream_ref; + *(struct tag_type_s *)nutag_enablemessenger = *_nutag_enablemessenger; + *(struct tag_type_s *)nutag_enablemessenger_ref = *_nutag_enablemessenger_ref; + *(struct tag_type_s *)nutag_path_enable = *_nutag_path_enable; + *(struct tag_type_s *)nutag_path_enable_ref = *_nutag_path_enable_ref; + *(struct tag_type_s *)nutag_early_ims = *_nutag_early_ims; + *(struct tag_type_s *)nutag_early_ims_ref = *_nutag_early_ims_ref; + *(struct tag_type_s *)nutag_initial_route_str = *_nutag_initial_route_str; + *(struct tag_type_s *)nutag_initial_route_str_ref = *_nutag_initial_route_str_ref; + *(struct tag_type_s *)nutag_certificate_dir = *_nutag_certificate_dir; + *(struct tag_type_s *)nutag_certificate_dir_ref = *_nutag_certificate_dir_ref; + *(struct tag_type_s *)nutag_authtime = *_nutag_authtime; + *(struct tag_type_s *)nutag_authtime_ref = *_nutag_authtime_ref; + *(struct tag_type_s *)nutag_smime_signature = *_nutag_smime_signature; + *(struct tag_type_s *)nutag_smime_signature_ref = *_nutag_smime_signature_ref; + *(struct tag_type_s *)nutag_enableinvite = *_nutag_enableinvite; + *(struct tag_type_s *)nutag_enableinvite_ref = *_nutag_enableinvite_ref; + *(struct tag_type_s *)nutag_answer_sent = *_nutag_answer_sent; + *(struct tag_type_s *)nutag_answer_sent_ref = *_nutag_answer_sent_ref; + *(struct tag_type_s *)nutag_smime_message_encryption = *_nutag_smime_message_encryption; + *(struct tag_type_s *)nutag_smime_message_encryption_ref = *_nutag_smime_message_encryption_ref; + *(struct tag_type_s *)nutag_keepalive = *_nutag_keepalive; + *(struct tag_type_s *)nutag_keepalive_ref = *_nutag_keepalive_ref; + *(struct tag_type_s *)nutag_auth = *_nutag_auth; + *(struct tag_type_s *)nutag_auth_ref = *_nutag_auth_ref; + *(struct tag_type_s *)nutag_min_se = *_nutag_min_se; + *(struct tag_type_s *)nutag_min_se_ref = *_nutag_min_se_ref; + *(struct tag_type_s *)nutag_url = *_nutag_url; + *(struct tag_type_s *)nutag_url_ref = *_nutag_url_ref; + *(struct tag_type_s *)nutag_identity = *_nutag_identity; + *(struct tag_type_s *)nutag_identity_ref = *_nutag_identity_ref; + *(struct tag_type_s *)nutag_notify_refer = *_nutag_notify_refer; + *(struct tag_type_s *)nutag_notify_refer_ref = *_nutag_notify_refer_ref; + *(struct tag_type_s *)nutag_initial_route = *_nutag_initial_route; + *(struct tag_type_s *)nutag_initial_route_ref = *_nutag_initial_route_ref; + *(struct tag_type_s *)nutag_early_media = *_nutag_early_media; + *(struct tag_type_s *)nutag_early_media_ref = *_nutag_early_media_ref; + *(struct tag_type_s *)nutag_impi = *_nutag_impi; + *(struct tag_type_s *)nutag_impi_ref = *_nutag_impi_ref; + *(struct tag_type_s *)nutag_service_route_enable = *_nutag_service_route_enable; + *(struct tag_type_s *)nutag_service_route_enable_ref = *_nutag_service_route_enable_ref; + *(struct tag_type_s *)nutag_allow_events = *_nutag_allow_events; + *(struct tag_type_s *)nutag_allow_events_ref = *_nutag_allow_events_ref; + *(struct tag_type_s *)nutag_smime_message_digest = *_nutag_smime_message_digest; + *(struct tag_type_s *)nutag_smime_message_digest_ref = *_nutag_smime_message_digest_ref; + *(struct tag_type_s *)nutag_only183_100rel = *_nutag_only183_100rel; + *(struct tag_type_s *)nutag_only183_100rel_ref = *_nutag_only183_100rel_ref; + *(struct tag_type_s *)nutag_use_dialog = *_nutag_use_dialog; + *(struct tag_type_s *)nutag_use_dialog_ref = *_nutag_use_dialog_ref; + *(struct tag_type_s *)nutag_outbound = *_nutag_outbound; + *(struct tag_type_s *)nutag_outbound_ref = *_nutag_outbound_ref; + *(struct tag_type_s *)nutag_outbound_set1 = *_nutag_outbound_set1; + *(struct tag_type_s *)nutag_outbound_set1_ref = *_nutag_outbound_set1_ref; + *(struct tag_type_s *)nutag_invite_timer = *_nutag_invite_timer; + *(struct tag_type_s *)nutag_invite_timer_ref = *_nutag_invite_timer_ref; + *(struct tag_type_s *)nutag_outbound_set2 = *_nutag_outbound_set2; + *(struct tag_type_s *)nutag_outbound_set2_ref = *_nutag_outbound_set2_ref; + *(struct tag_type_s *)nutag_session_timer = *_nutag_session_timer; + *(struct tag_type_s *)nutag_session_timer_ref = *_nutag_session_timer_ref; + *(struct tag_type_s *)nutag_outbound_set3 = *_nutag_outbound_set3; + *(struct tag_type_s *)nutag_outbound_set3_ref = *_nutag_outbound_set3_ref; + *(struct tag_type_s *)nutag_phrase = *_nutag_phrase; + *(struct tag_type_s *)nutag_phrase_ref = *_nutag_phrase_ref; + *(struct tag_type_s *)nutag_outbound_set4 = *_nutag_outbound_set4; + *(struct tag_type_s *)nutag_outbound_set4_ref = *_nutag_outbound_set4_ref; + *(struct tag_type_s *)nutag_impu = *_nutag_impu; + *(struct tag_type_s *)nutag_impu_ref = *_nutag_impu_ref; + *(struct tag_type_s *)nutag_detect_network_updates = *_nutag_detect_network_updates; + *(struct tag_type_s *)nutag_detect_network_updates_ref = *_nutag_detect_network_updates_ref; + *(struct tag_type_s *)nutag_offer_recv = *_nutag_offer_recv; + *(struct tag_type_s *)nutag_offer_recv_ref = *_nutag_offer_recv_ref; + *(struct tag_type_s *)nutag_m_username = *_nutag_m_username; + *(struct tag_type_s *)nutag_m_username_ref = *_nutag_m_username_ref; + *(struct tag_type_s *)nutag_max_subscriptions = *_nutag_max_subscriptions; + *(struct tag_type_s *)nutag_max_subscriptions_ref = *_nutag_max_subscriptions_ref; + *(struct tag_type_s *)nutag_smime_enable = *_nutag_smime_enable; + *(struct tag_type_s *)nutag_smime_enable_ref = *_nutag_smime_enable_ref; + *(struct tag_type_s *)nutag_answer_recv = *_nutag_answer_recv; + *(struct tag_type_s *)nutag_answer_recv_ref = *_nutag_answer_recv_ref; + *(struct tag_type_s *)nutag_shutdown_events = *_nutag_shutdown_events; + *(struct tag_type_s *)nutag_shutdown_events_ref = *_nutag_shutdown_events_ref; + *(struct tag_type_s *)nutag_session_refresher = *_nutag_session_refresher; + *(struct tag_type_s *)nutag_session_refresher_ref = *_nutag_session_refresher_ref; + *(struct tag_type_s *)nutag_user_agent = *_nutag_user_agent; + *(struct tag_type_s *)nutag_user_agent_ref = *_nutag_user_agent_ref; + *(struct tag_type_s *)nutag_soa_name = *_nutag_soa_name; + *(struct tag_type_s *)nutag_soa_name_ref = *_nutag_soa_name_ref; + *(struct tag_type_s *)nutag_update_refresh = *_nutag_update_refresh; + *(struct tag_type_s *)nutag_update_refresh_ref = *_nutag_update_refresh_ref; + *(struct tag_type_s *)nutag_dialog = *_nutag_dialog; + *(struct tag_type_s *)nutag_dialog_ref = *_nutag_dialog_ref; + *(struct tag_type_s *)nutag_substate = *_nutag_substate; + *(struct tag_type_s *)nutag_substate_ref = *_nutag_substate_ref; + *(struct tag_type_s *)nutag_m_display = *_nutag_m_display; + *(struct tag_type_s *)nutag_m_display_ref = *_nutag_m_display_ref; + *(struct tag_type_s *)nutag_address = *_nutag_address; + *(struct tag_type_s *)nutag_address_ref = *_nutag_address_ref; + *(struct tag_type_s *)nutag_refer_with_id = *_nutag_refer_with_id; + *(struct tag_type_s *)nutag_refer_with_id_ref = *_nutag_refer_with_id_ref; + *(struct tag_type_s *)nutag_include_extra_sdp = *_nutag_include_extra_sdp; + *(struct tag_type_s *)nutag_include_extra_sdp_ref = *_nutag_include_extra_sdp_ref; + *(struct tag_type_s *)nutag_media_features = *_nutag_media_features; + *(struct tag_type_s *)nutag_media_features_ref = *_nutag_media_features_ref; + *(struct tag_type_s *)nutag_certificate_phrase = *_nutag_certificate_phrase; + *(struct tag_type_s *)nutag_certificate_phrase_ref = *_nutag_certificate_phrase_ref; + *(struct tag_type_s *)nutag_m_features = *_nutag_m_features; + *(struct tag_type_s *)nutag_m_features_ref = *_nutag_m_features_ref; + *(struct tag_type_s *)nutag_refer_event = *_nutag_refer_event; + *(struct tag_type_s *)nutag_refer_event_ref = *_nutag_refer_event_ref; + *(struct tag_type_s *)nutag_refer_expires = *_nutag_refer_expires; + *(struct tag_type_s *)nutag_refer_expires_ref = *_nutag_refer_expires_ref; + *(struct tag_type_s *)nutag_autoanswer = *_nutag_autoanswer; + *(struct tag_type_s *)nutag_autoanswer_ref = *_nutag_autoanswer_ref; + *(struct tag_type_s *)nutag_enablemessage = *_nutag_enablemessage; + *(struct tag_type_s *)nutag_enablemessage_ref = *_nutag_enablemessage_ref; + *(struct tag_type_s *)nutag_realm = *_nutag_realm; + *(struct tag_type_s *)nutag_realm_ref = *_nutag_realm_ref; + *(struct tag_type_s *)nutag_registrar = *_nutag_registrar; + *(struct tag_type_s *)nutag_registrar_ref = *_nutag_registrar_ref; + *(struct tag_type_s *)nutag_m_params = *_nutag_m_params; + *(struct tag_type_s *)nutag_m_params_ref = *_nutag_m_params_ref; + *(struct tag_type_s *)nutag_status = *_nutag_status; + *(struct tag_type_s *)nutag_status_ref = *_nutag_status_ref; + *(struct tag_type_s *)nutag_refer_pause = *_nutag_refer_pause; + *(struct tag_type_s *)nutag_refer_pause_ref = *_nutag_refer_pause_ref; + *(struct tag_type_s *)nutag_appl_method = *_nutag_appl_method; + *(struct tag_type_s *)nutag_appl_method_ref = *_nutag_appl_method_ref; + *(struct tag_type_s *)nutag_allow = *_nutag_allow; + *(struct tag_type_s *)nutag_allow_ref = *_nutag_allow_ref; + *(struct tag_type_s *)nutag_handle = *_nutag_handle; + *(struct tag_type_s *)nutag_handle_ref = *_nutag_handle_ref; + *(struct tag_type_s *)nutag_newsub = *_nutag_newsub; + *(struct tag_type_s *)nutag_newsub_ref = *_nutag_newsub_ref; + *(struct tag_type_s *)nutag_callee_caps = *_nutag_callee_caps; + *(struct tag_type_s *)nutag_callee_caps_ref = *_nutag_callee_caps_ref; + *(struct tag_type_s *)nutag_hold = *_nutag_hold; + *(struct tag_type_s *)nutag_hold_ref = *_nutag_hold_ref; + *(struct tag_type_s *)nutag_smime_key_encryption = *_nutag_smime_key_encryption; + *(struct tag_type_s *)nutag_smime_key_encryption_ref = *_nutag_smime_key_encryption_ref; + *(struct tag_type_s *)nutag_auth_cache = *_nutag_auth_cache; + *(struct tag_type_s *)nutag_auth_cache_ref = *_nutag_auth_cache_ref; + *(struct tag_type_s *)nutag_any = *_nutag_any; + *(struct tag_type_s *)nutag_any_ref = *_nutag_any_ref; + *(struct tag_type_s *)nutag_with = *_nutag_with; + *(struct tag_type_s *)nutag_with_ref = *_nutag_with_ref; + *(struct tag_type_s *)nutag_supported = *_nutag_supported; + *(struct tag_type_s *)nutag_supported_ref = *_nutag_supported_ref; + *(struct tag_type_s *)nutag_method = *_nutag_method; + *(struct tag_type_s *)nutag_method_ref = *_nutag_method_ref; + *(struct tag_type_s *)nutag_smime_protection_mode = *_nutag_smime_protection_mode; + *(struct tag_type_s *)nutag_smime_protection_mode_ref = *_nutag_smime_protection_mode_ref; + *(struct tag_type_s *)nutag_early_answer = *_nutag_early_answer; + *(struct tag_type_s *)nutag_early_answer_ref = *_nutag_early_answer_ref; + *(struct tag_type_s *)nutag_event = *_nutag_event; + *(struct tag_type_s *)nutag_event_ref = *_nutag_event_ref; + *(struct tag_type_s *)nutag_media_enable = *_nutag_media_enable; + *(struct tag_type_s *)nutag_media_enable_ref = *_nutag_media_enable_ref; + *(struct tag_type_s *)nutag_instance = *_nutag_instance; + *(struct tag_type_s *)nutag_instance_ref = *_nutag_instance_ref; + *(struct tag_type_s *)nutag_callstate = *_nutag_callstate; + *(struct tag_type_s *)nutag_callstate_ref = *_nutag_callstate_ref; + *(struct tag_type_s *)nutag_autoack = *_nutag_autoack; + *(struct tag_type_s *)nutag_autoack_ref = *_nutag_autoack_ref; + *(struct tag_type_s *)nutag_offer_sent = *_nutag_offer_sent; + *(struct tag_type_s *)nutag_offer_sent_ref = *_nutag_offer_sent_ref; + *(struct tag_type_s *)nutag_refresh_without_sdp = *_nutag_refresh_without_sdp; + *(struct tag_type_s *)nutag_refresh_without_sdp_ref = *_nutag_refresh_without_sdp_ref; + *(struct tag_type_s *)nutag_sub_expires = *_nutag_sub_expires; + *(struct tag_type_s *)nutag_sub_expires_ref = *_nutag_sub_expires_ref; + *(struct tag_type_s *)nutag_autoalert = *_nutag_autoalert; + *(struct tag_type_s *)nutag_autoalert_ref = *_nutag_autoalert_ref; + + return TRUE; +} + +#endif diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_ref.c b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_ref.c index ea31d127..0e4ea9f7 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_ref.c +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/nua_tag_ref.c @@ -18,7 +18,6 @@ #define EXPORT #endif -#include #undef TAG_NAMESPACE #define TAG_NAMESPACE "nua" @@ -38,6 +37,18 @@ EXPORT tag_typedef_t nutag_media_features_ref = extern tag_typedef_t nutag_callee_caps; EXPORT tag_typedef_t nutag_callee_caps_ref = REFTAG_TYPEDEF(nutag_callee_caps); +extern tag_typedef_t nutag_impu; +EXPORT tag_typedef_t nutag_impu_ref = + REFTAG_TYPEDEF(nutag_impu); +extern tag_typedef_t nutag_impi; +EXPORT tag_typedef_t nutag_impi_ref = + REFTAG_TYPEDEF(nutag_impi); +extern tag_typedef_t nutag_realm; +EXPORT tag_typedef_t nutag_realm_ref = + REFTAG_TYPEDEF(nutag_realm); +extern tag_typedef_t nutag_early_ims; +EXPORT tag_typedef_t nutag_early_ims_ref = + REFTAG_TYPEDEF(nutag_early_ims); extern tag_typedef_t nutag_early_media; EXPORT tag_typedef_t nutag_early_media_ref = REFTAG_TYPEDEF(nutag_early_media); @@ -281,94 +292,3 @@ EXPORT tag_typedef_t nutag_hold_ref = extern tag_typedef_t nutag_address; EXPORT tag_typedef_t nutag_address_ref = REFTAG_TYPEDEF(nutag_address); - -EXPORT tag_type_t nua_tag_list[] = -{ - nutag_retry_count, - nutag_uicc, - nutag_smime_opt, - nutag_sips_url, - nutag_soa_session, - nutag_keepalive_stream, - nutag_enablemessenger, - nutag_path_enable, - nutag_initial_route_str, - nutag_certificate_dir, - nutag_authtime, - nutag_smime_signature, - nutag_enableinvite, - nutag_answer_sent, - nutag_smime_message_encryption, - nutag_keepalive, - nutag_auth, - nutag_min_se, - nutag_url, - nutag_identity, - nutag_notify_refer, - nutag_initial_route, - nutag_early_media, - nutag_service_route_enable, - nutag_allow_events, - nutag_smime_message_digest, - nutag_only183_100rel, - nutag_use_dialog, - nutag_outbound, - nutag_outbound_set1, - nutag_invite_timer, - nutag_outbound_set2, - nutag_session_timer, - nutag_outbound_set3, - nutag_phrase, - nutag_outbound_set4, - nutag_detect_network_updates, - nutag_offer_recv, - nutag_m_username, - nutag_max_subscriptions, - nutag_smime_enable, - nutag_answer_recv, - nutag_shutdown_events, - nutag_session_refresher, - nutag_user_agent, - nutag_soa_name, - nutag_update_refresh, - nutag_dialog, - nutag_substate, - nutag_m_display, - nutag_address, - nutag_refer_with_id, - nutag_include_extra_sdp, - nutag_media_features, - nutag_certificate_phrase, - nutag_m_features, - nutag_refer_event, - nutag_refer_expires, - nutag_autoanswer, - nutag_enablemessage, - nutag_registrar, - nutag_m_params, - nutag_status, - nutag_refer_pause, - nutag_appl_method, - nutag_allow, - nutag_handle, - nutag_newsub, - nutag_callee_caps, - nutag_hold, - nutag_smime_key_encryption, - nutag_auth_cache, - nutag_with, - nutag_supported, - nutag_method, - nutag_smime_protection_mode, - nutag_early_answer, - nutag_event, - nutag_media_enable, - nutag_instance, - nutag_callstate, - nutag_autoack, - nutag_offer_sent, - nutag_refresh_without_sdp, - nutag_sub_expires, - nutag_autoalert, - NULL -}; diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/sofia-sip/nua_tag.h b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/sofia-sip/nua_tag.h index fe39c329..f9bd8283 100644 --- a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/sofia-sip/nua_tag.h +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/sofia-sip/nua_tag.h @@ -31,6 +31,7 @@ * * @author Pekka Pessi * @author Martti Mela + * @author xxxyyyzzz * * @date Created: Mon Feb 19 18:54:26 EET 2001 ppessi */ @@ -114,6 +115,27 @@ SOFIAPUBVAR tag_typedef_t nutag_use_dialog; #define NUTAG_USE_DIALOG_REF(x) nutag_use_dialog_ref, tag_bool_vr(&(x)) SOFIAPUBVAR tag_typedef_t nutag_use_dialog_ref; +/* Parameters added for 3GPP IMS + */ +#define NUTAG_EARLY_IMS(x) nutag_early_ims, tag_bool_v(x) +SOFIAPUBVAR tag_typedef_t nutag_early_ims; +#define NUTAG_EARLY_IMS_REF(x) nutag_early_ims_ref, tag_bool_vr(&(x)) +SOFIAPUBVAR tag_typedef_t nutag_early_ims_ref; + +#define NUTAG_IMPU(x) nutag_impu, urltag_url_v(x) +SOFIAPUBVAR tag_typedef_t nutag_impu; +#define NUTAG_IMPU_REF(x) nutag_impu_ref, urltag_url_vr(&(x)) +SOFIAPUBVAR tag_typedef_t nutag_impu_ref; + +#define NUTAG_IMPI(x) nutag_impi, tag_str_v(x) +SOFIAPUBVAR tag_typedef_t nutag_impi; +#define NUTAG_IMPI_REF(x) nutag_impi_ref, tag_str_vr((&x)) +SOFIAPUBVAR tag_typedef_t nutag_impi_ref; + +#define NUTAG_REALM(x) nutag_realm, tag_str_v(x) +SOFIAPUBVAR tag_typedef_t nutag_realm; +#define NUTAG_realm_REF(x) nutag_realm_ref, tag_str_vr((&x)) +SOFIAPUBVAR tag_typedef_t nutag_realm_ref; /* Protocol engine parameters, * set by nua_set_params(), get by nua_get_params() */ diff --git a/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/tag_dll.sh b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/tag_dll.sh new file mode 100644 index 00000000..183a532f --- /dev/null +++ b/trunk/sofia-sip-1.12.10/libsofia-sip-ua/nua/tag_dll.sh @@ -0,0 +1 @@ +awk -v BINMODE="rw" -f ../su/tag_dll.awk nua_tag.c \ No newline at end of file diff --git a/trunk/sofia-sip-1.12.10/win32/SofiaSIP.ncb b/trunk/sofia-sip-1.12.10/win32/SofiaSIP.ncb deleted file mode 100644 index 8b2d8dab..00000000 Binary files a/trunk/sofia-sip-1.12.10/win32/SofiaSIP.ncb and /dev/null differ diff --git a/trunk/test/stdafx.cpp b/trunk/test/stdafx.cpp index e1063fc4..cfbfdc71 100644 --- a/trunk/test/stdafx.cpp +++ b/trunk/test/stdafx.cpp @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "stdafx.h" diff --git a/trunk/test/stdafx.h b/trunk/test/stdafx.h index 748f9e44..6ca194c0 100644 --- a/trunk/test/stdafx.h +++ b/trunk/test/stdafx.h @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #pragma once #include "targetver.h" diff --git a/trunk/test/test.cpp b/trunk/test/test.cpp index 4ca201de..d638e9aa 100644 --- a/trunk/test/test.cpp +++ b/trunk/test/test.cpp @@ -1,29 +1,30 @@ -/**************************************************************************** - _ _ - | | | | - _ | | ___ _ _| | _ ____ ____ ____ ___ - / || |/ _ \| | | | || \ / _ | _ \ / _ |/ _ \ - ( (_| | |_| | |_| | |_) | ( | | | | ( ( | | |_| | - \____|\___/ \____|____/ \_||_|_| |_|\_|| |\___/ - (_____| - - Copyright (C) 2009 xxxyyyzzz - - This file is part of Open Source Doubango IMS Client Framework project. - - 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 Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DOUBANGO. -****************************************************************************/ +/** +* @file +* @author xxxyyyzzz +* @version 1.0 +* +* @section LICENSE +* +* +* This file is part of Open Source Doubango IMS Client Framework project. +* +* 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +* @section DESCRIPTION +* +* +*/ #include "stdafx.h" #include diff --git a/trunk/win32/pthread/pthread.vcproj b/trunk/win32/pthread/pthread.vcproj new file mode 100644 index 00000000..85fbb1a5 --- /dev/null +++ b/trunk/win32/pthread/pthread.vcproj @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +