diff --git a/.gitignore b/.gitignore index 9fecfaeed3a2b513057af79c804a12ee0d20f644..ef4892e797dd95581f3b202c7de3d38e1cb12bcf 100644 --- a/.gitignore +++ b/.gitignore @@ -107,7 +107,50 @@ sflphone-gtk/pixmaps/Makefile /libs/libiax2/ltmain.sh /libs/libiax2/iax-config /libs/libiax2/configure +/libs/libiax2/Makefile +/libs/libiax2/iax2-config +/libs/libiax2/src/Makefile +## dbus-c++ +libs/dbus-c++/Makefile +libs/dbus-c++/autom4te.cache/requests +libs/dbus-c++/config.log +libs/dbus-c++/Makefile +libs/dbus-c++/autom4te.cache/requests +libs/dbus-c++/config.log +libs/dbus-c++/config.status +libs/dbus-c++/configure +libs/dbus-c++/data/Makefile +libs/dbus-c++/dbus-c++-1-uninstalled.pc +libs/dbus-c++/dbus-c++-1.pc +libs/dbus-c++/doc/Doxyfile +libs/dbus-c++/doc/Makefile +libs/dbus-c++/examples/Makefile +libs/dbus-c++/examples/echo/.libs/ +libs/dbus-c++/examples/echo/Makefile +libs/dbus-c++/examples/echo/echo-client-glue.h +libs/dbus-c++/examples/echo/echo-client-mt +libs/dbus-c++/examples/echo/echo-server +libs/dbus-c++/examples/echo/echo-server-glue.h +libs/dbus-c++/examples/glib/Makefile +libs/dbus-c++/examples/glib/dbus-glue.h +libs/dbus-c++/examples/hal/.libs/ +libs/dbus-c++/examples/hal/Makefile +libs/dbus-c++/examples/hal/hal-listen +libs/dbus-c++/examples/properties/.libs/ +libs/dbus-c++/examples/properties/Makefile +libs/dbus-c++/examples/properties/propsgs-client +libs/dbus-c++/examples/properties/propsgs-glue-adaptor.h +libs/dbus-c++/examples/properties/propsgs-glue-proxy.h +libs/dbus-c++/examples/properties/propsgs-server +libs/dbus-c++/include/dbus-c++/config.h +libs/dbus-c++/include/dbus-c++/stamp-h1 +libs/dbus-c++/src/.libs/ +libs/dbus-c++/src/Makefile +libs/dbus-c++/tools/.libs/ +libs/dbus-c++/tools/Makefile +libs/dbus-c++/tools/dbusxx-introspect +libs/dbus-c++/tools/dbusxx-xml2cpp # Ignore temp files *~ diff --git a/README b/README index 76b149da40802ab194a8f2260b0571c88395aa4a..b0253512de02ffe8d5dac4db62b05225d36a806e 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ -This is SFLphone, release 0.9.x +This is SFLphone, release 0.9.3 -Copyright (c) Savoir-faire Linux, Inc 2004-2008 +Copyright (c) Savoir-faire Linux, Inc 2004-2009 <sflphoneteam@savoirfairelinux.com> This program 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 2 of the License, or +the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Introduction ------------ @@ -38,152 +37,7 @@ SFLPhone is actually used by the support team of Savoir-Faire Linux Inc. More information is available on the project homepage: http://www.sflphone.org/ - - -Getting the dependencies ------------------------- - -Required libraries and tools: -- ccRTP >= 1.3.4 (tested with ccrtp 1.4.1) - and Common C++ 2 >= 1.3.20 (tested with commoncpp2 1.4.1) - http://sourceforge.net/projects/gnutelephony/ -- libeXosip2 >= 2.2.2 (tested with eXosip2 2.2.3) - and libosip2 >= 2.2.1 (tested with libosip2-2.2.2) - http://savannah.gnu.org/projects/exosip/ - http://savannah.gnu.org/projects/osip/ -- libxml2, libxml2-devel, pkgconfig - usually available in distribution repositories -- autoconf - -Optional libraries: -- zeroconf: (tested with mDNSResponder87) - http://developer.apple.com/darwin/projects/bonjour/ -- speex: codec for sound - -Some of the required libraries may be downloaded from - http://www.sflphone.org/#downloads - or - http://www.sflphone.org/dev/ - -See tools/config.sh for details - -So in debian, you need: -apt-get install autoconf automake1.9 libtool libosip2-dev libexosip2-dev libccrtp-dev libcommoncpp2-dev pkg-config libsamplerate-dev libasound2-dev - - -Building the dependencies -------------------------- - -If you do not use either the development packages of your distribution or the source packages made by the upstream authors of dependencies, you may want to try our custom dependencies building script in tools/ directory: -Note that commoncpp, ccrtp, libosip and libexosip, samplerate are in debian and fedora. - -You can also compile each dependency, one by one: - -1/ For commoncpp2 - ./configure [option] - make - make install - -2/ For ccrtp - ./configure [option] - make - make install - -3/ For libosip2 - ./configure [option] - make - make install - - Note: if you install any package in /usr/local, don't forget to set pkg-config path with: - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ - - -Building SFLPhone ------------------ - -./configure -make -make install (as root) - - - -Using SFLPhone --------------- - -If you have the sflphone 0.3 or 0.4 release, copy the file sflphonerc -to sflphonedrc: - cp ~/.sflphone/sflphonerc ~/.sflphone/sflphonedrc -If you have an older version, remove your sflphonerc file located in -$HOME/.sflphone - -1. Install the GTK GUI - -2. Lauch sflphone interface, a setup window appears. - -3. If you do have a SIP account, fill the SIP stuff where related. You can - use STUN too. - -4. Save your settings, restart it. You're done. - -A user's guide will be available on: -http://www.sflphone.org/doc/ - - - -What if it does not build? --------------------------- - -- Try using the same versions of the libraries as we do. - See http://www.sflphone.org in section Downloads. - -- Try using the same compilers as ours: gcc 4.1.0 on Fedora Linux Core 5 - is known to work. - -- If you have dependencies installed in unusual directories, try setting - the environment variable CXXFLAGS before building, for example: - export CXXFLAGS="-I/opt/include" - - - -How to enable IAX support? --------------------------- - -Go inside libs directory and execute ./libiax2.sh script. -Then, run ./configure with --enable-iax2 option. - - -Debugging SFLPhone ------------------- -You can use the --with-debug option with configure -./configure --with-debug -make - - -Run-time troubleshooting ------------------------- - -- If errors occured when trying to load shared libraries, check that the - value of the environment variable LD_LIBRARY_PATH include the - directories containing the required libraries, eg: - export LD_LIBRARY_PATH=/path/to/my/lib:${LD_LIBRARY_PATH} - -- Portaudio don't detect your sound card because : - * artsd is running - * jackd is running - On 2005/11/22, jack wasn't working with these settings: - jackd -d alsa -r 8000 - * you use alsa with sflphone and another application, but dmixer isn't - configurated correctly inside ~/.asoundrc or /etc/alsa/alsa.conf - -- sflphone refuse to start because it's running - You could have something like: "Exception: could not bind socket" - Try to close sflphone before - echo "stop sflphone" | nc localhost 3999 - or - killall sflphone - - - + Short description of content of source tree ------------------------------------------- @@ -197,58 +51,7 @@ Short description of content of source tree The ManagerImpl class is the intermediaire between all the layer in the tree. - src/audio/ is the audio layer. It contains all about tones, dtmf, audiodriver, rtp layer, audio codec ulaw, alaw and gsm. -- src/audio/gsm/ contains the implementation of gsm audiocodec library. -- src/audio/pacpp/ implements PortAudioCpp, a native C++ binding of - PortAudio V19. (remove in sflphone 0.7) -- src/gui/ is the old directory that contains all about different user - interface. -- src/gui/server is the directory that talk (tcp socket on port 3999) to - sflphone client. The slfphone client can be a console program or a graphical - interface. - - - -How is structured SFLphone (>=0.5) ----------------------------------- - - +------------+ - |TCPSessionIO| - +------------+ - | - +------------+ - | SessionIO | - +------------+ - | - +------------+ - | GUI Server | - +------------+ - | - +---------------------------+ - | GUI Framework | - +---------------------------+ - | - +---------------------------+ - | ManagerImpl | - +---------------------------+ - | - +---------------------------+ - | Account | - +---------------------------+ - | - +---------------------------+ - | VoIPLink | - +---------------------------+ - | | - +-----------+ +-------+ - | SIP | | IAX | - | RTP | +-------+ - | STUN | - +-----------+ - -It's in ManagerImpl where we declared Call vector and VoIPLink vector. -VoIPLink vector contains all different VoIP link like SIP, IAX, ... -Call vector contains all the calls according to the kind of VoIP link. - +- src/dbus, the dbus xml interfaces, and c++ bindings About Savoir-Faire Linux @@ -258,15 +61,35 @@ Savoir-Faire Linux is a consulting company based in Montreal, Quebec. For more information, please check out our website: http://www.savoirfairelinux.com/ +How to compile +-------------- + +# First compile the SIP library +cd libs/pjproject-1.0.1 +./configure +make dep && make +sudo make install + +# Then the daemon +cd ../.. +./autogen.sh --prefix=/usr --with-debug +make +sudo make install + +# And the GTK client +cd sflphone-gtk +./autogen.sh --prefix=/usr --with-debug +make +sudo make install + Done ! Contributing to SFLPhone ------------------------ Of course we love patches. And contributions. And spring rolls. -The project infrastructure (CVS, bugtracker, MLs) is maintained on: -http://forge.novell.com/modules/xfmod/project/?sflphone +Development website: http://dev.savoirfairelinux.net/sflphone Do not hesitate to join us and post comments, suggestions, questions and general feedback on the forge.novell mailing-list. diff --git a/autogen.sh b/autogen.sh index ac85bd137c9dcf2f99eef6992751d1a92876cdcd..06b6a97c95e0c7f4db9c8bd21a358a14784e9187 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,6 +4,6 @@ aclocal -I m4 libtoolize --force autoheader -autoconf -v -f +autoconf -f automake -a ./configure $@ diff --git a/configure.ac b/configure.ac index e09abd63487dd9b2ef7b53b8c6cb69ebdc2bfbe1..b3a168ba65b780caf6fd54ac4cf5a24484e34dbe 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl SFLPhone - configure.ac for automake 1.9 and autoconf 2.59 dnl dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([SFLPhone],[0.9.3],[sflphoneteam@savoirfairelinux.com],[sflphone]) +AC_INIT([SFLphone],[0.9.3],[sflphoneteam@savoirfairelinux.com],[sflphone]) AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004-2009]]) AC_REVISION([$Revision$]) @@ -53,30 +53,29 @@ AC_CONFIG_FILES([man/Makefile]) AC_CONFIG_FILES([doc/Makefile \ doc/doxygen/Makefile]) -AC_CONFIG_FILES([platform/rpm/sflphone.spec \ - platform/fedora/sflphone.spec \ - platform/fedora/sflphone-fc6.spec]) +AC_CONFIG_FILES([platform/suse.spec \ + platform/fedora.spec]) dnl the file stamp-h.in should be there before (instead of AC_CONFIG_HEADERS(config.h)) dnl AM_CONFIG_HEADER(config.h) dnl Get project version -VERSION=`sed -ne 's/^#define SFLPHONED_VERSION "\(.*\)"/\1/p' ${srcdir}/src/global.h` +VERSION=`sed -ne 's/^#define SFLPHONED_VERSION "\(.*\)"/\1/p' src/global.h` dnl Get rid of release number RPM_VERSION=`echo $VERSION | cut -d- -f1` AC_SUBST(RPM_VERSION) RPM_RELEASE=`echo $VERSION | sed -ne 's/.*-\(.*\)/\1/p' ` AC_SUBST(RPM_RELEASE) -VERSION=`echo $VERSION | cut -d- -f1` +VERSION=`echo $VERSION | cut -f1 -d\' \'` AC_SUBST(VERSION) dnl Settings need Standard C++ Library LIBS="$LIBS -lstdc++" dnl Solaris pkgadd support definitions -PKGADD_PKG="SFLPhone" -PKGADD_NAME="SFLPhone - a SIP client and daemon" +PKGADD_PKG="SFLphone" +PKGADD_NAME="SFLphone - a SIP client and daemon" PKGADD_VENDOR="http://www.sflphone.org/" AC_SUBST(PKGADD_PKG) AC_SUBST(PKGADD_NAME) @@ -223,7 +222,6 @@ AC_ARG_WITH([speex], [], [with_speex=yes]) -LIBSPEEX= AS_IF([test "x$with_speex" != xno], [AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package). You may use --without-speex to compile without speex codec support.]))] [AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Unable to find the libspeexdsp headers (you may need to install the libspeexdsp-dev package). You may use --without-speex to compile without speex codec support.]))] @@ -232,11 +230,20 @@ AS_IF([test "x$with_speex" != xno], [AC_MSG_FAILURE( [libspeex link test failed. You may use --without-speex to compile without speex codec support.])] ) - ] - ) - + ] +dnl More advanced check in case the libspeexdsp is not installed +AC_SEARCH_LIBS(speex_preprocess_run, speexdsp, HAVE_SPEEXDSP="yes", HAVE_SPEEXDSP="no", []) + +if test $HAVE_SPEEXDSP="no"; then + echo $HAVE_SPEEXDSP; + AC_MSG_WARN([The silence detection in speex could not have been enabled]) +fi + +) + AC_DEFINE([HAVE_SPEEX], test "x$with_speex" = "xyes", [Define if you have libspeex]) AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" ) +AM_CONDITIONAL(ENABLE_SPEEXDSP, test $HAVE_SPEEXDSP = yes) dnl Check for ilbc support AC_ARG_WITH([ilbc], diff --git a/debian/changelog b/debian/changelog index 370a59f230810fc2d8b10d1051b2fd164f6f9e12..a9a2d466e2f55973d8e2469f393913399fc2a141 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,98 @@ -sflphone (0.9.3-0ubuntu1) intrepid; urgency=low +sflphone (0.9.3-0ubuntu3) %system%; urgency=low + + [ Alexandre Savard ] + * Both playback and record streams in PA_STREAM_CORKED (pulseaudio) + * Use PLUGHW device for ALSA capture + * Functional IAX and SIP recording for voicemail + * Use the less CPU-consuming interpolator algorithm for resampling + * Display in GTK GUI the codec used in conversation + * GTK GUI use ASCII instread of utf-8 + * Add record menus in GTK GUI + * Put on hold when dialing a new number + * AccountID's are saved in the history + + [ Emmanuel Milou ] + * Integrate DBUS C++, libiax2 in the git repository + * Update website + * Use libspeexdsp only if available on the system + * Updated .gitignore file + + [Cyrille Béraud] + * Account assistant manager improvment + * Add an email request when creating a new account to receive voicemails + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Sat, 14 Feb 2009 13:29:15 -0500 + +sflphone (0.9.3-0ubuntu2) %system%; urgency=low + + [ Emmanuel Milou ] + * Add compilation note in README + * Use default ALSA plugin for capture + * Fix the ALSA capture problem one more time + * Clean up debug messages in dbus.c + * Add libspeexdsp dependency + * Remove implicit declaration compilation warnings + * Fix links in the website, add release note + * Change capture for the website front page + * Add alsa devel dependency in build-depends control file field + * Clean up, indentation, try to handle latency problems in iax/pulseaudio + * Remove pjsip generated files from the repo + * Use the previous declared curAlias function in accountwindow + * Fix bug in history call duration when the call fails + * Remove runtime warning in the GTK+ client + * Add librsvg2-common dependency to load SVG under KDE + * Refresh .gitignore + * Update locales files + french translation + * Add configuration panel for future noise reduction + * Add configuration panel for audio record module + * Daemon less verbose; accounts don't try to access STUn options anymore + * Fix typo in configwindow + * Add content in the official website + * use a GTK_STOCK icon for the record button + * Complete description text in the assistant manager + * Add libtool flags in client configure.ac + * Remove unuseful dependency (snd) + * Fix SIP transfer problems + * Remove previous version of PJSIP from the repo + * Upgrade PJSIP to version 1.0.1 + * Add the new website source in the repository + * Use libspeexdsp for silence detection only if available + + [ Loïc Faure-Lacroix ] + * Ajout du logo gpl3 + * Ajout des images + * Ajout de la section screenshot pour le site + * Ajout du favicon dans le header + * Modification des cartes + + [ Alexandre Savard ] + * Clean up <speex/libspeexdsp> + * Small cleanup + * Save Wave fixed + * Fix new call button when recording + * libspeexdsp added + * Recording: default home folder at startup + * Minor changes to config window + * IAX recording fixed + * Set / get recording path, still need some GTK for client + * AudioRecord file name format + * Now recording in HOME folder + + [ Cyrille Béraud ] + * Fix bug in reqaccount.c + + [ Maxime Chambreuil ] + * Update spanish translation + + [Yun Liu ] + * Update chinese translation + + [ Hussein Abdallah ] + * Update russian translation + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Sat, 14 Feb 2009 13:29:15 -0500 + +sflphone (0.9.3-0ubuntu1) %system%; urgency=low * Remove debug * Join thread before leaving @@ -11,7 +105,7 @@ sflphone (0.9.3-0ubuntu1) intrepid; urgency=low -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 06 Feb 2009 19:17:32 -0500 -sflphone (0.9.2-2ubuntu9) intrepid; urgency=low +sflphone (0.9.2-2ubuntu9) %system%; urgency=low [ Alexandre Savard ] * Speex audio codec preprocessing initialization @@ -39,7 +133,7 @@ sflphone (0.9.2-2ubuntu9) intrepid; urgency=low -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 05 Feb 2009 18:27:53 -0500 -sflphone (0.9.2-2ubuntu8) intrepid; urgency=low +sflphone (0.9.2-2ubuntu8) %system%; urgency=low [ Emmanuel Milou ] * Update changelogs @@ -83,7 +177,7 @@ sflphone (0.9.2-2ubuntu8) intrepid; urgency=low -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 04 Feb 2009 14:00:30 -0500 -sflphone (0.9.2-2ubuntu7) intrepid; urgency=low +sflphone (0.9.2-2ubuntu7) %system%; urgency=low [ Emmanuel Milou ] * Update changelog to 0.9.2-6 @@ -105,7 +199,7 @@ sflphone (0.9.2-2ubuntu7) intrepid; urgency=low -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 23 Jan 2009 17:48:13 -0500 -sflphone (0.9.2-2ubuntu6) intrepid; urgency=low +sflphone (0.9.2-2ubuntu6) %system%; urgency=low [ Emmanuel Milou ] * Migrate STUN configuration to the main config window @@ -139,7 +233,7 @@ sflphone (0.9.2-2ubuntu6) intrepid; urgency=low -- Emmanuel Milou <manu@sulfur.inside.savoirfairelinux.net> Fri, 16 Jan 2009 18:19:05 -0500 -sflphone (0.9.2-2ubuntu5) intrepid; urgency=low +sflphone (0.9.2-2ubuntu5) %system%; urgency=low * Fix memory leak in the pulseaudio callback * Update debian package generation script @@ -155,7 +249,7 @@ sflphone (0.9.2-2ubuntu5) intrepid; urgency=low -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 14 Jan 2009 21:17:20 -0500 -sflphone (0.9.2-2ubuntu4) intrepid; urgency=low +sflphone (0.9.2-2ubuntu4) %system%; urgency=low [ Emmanuel Milou ] * add german translation @@ -165,7 +259,7 @@ sflphone (0.9.2-2ubuntu4) intrepid; urgency=low -- Yun Liu <yun.liu@savoirfairelinux.com> Thu, 08 Jan 2009 13:08:51 -0500 -sflphone (0.9.2-2ubuntu3) intrepid; urgency=low +sflphone (0.9.2-2ubuntu3) %system%; urgency=low [ Emmanuel Milou ] * The main thread synchronizes the ringtone thread @@ -177,13 +271,13 @@ sflphone (0.9.2-2ubuntu3) intrepid; urgency=low -- Yun Liu <yun.liu@savoirfairelinux.com> Tue, 06 Jan 2009 16:18:38 -0500 -sflphone (0.9.2-2ubuntu2) intrepid; urgency=low +sflphone (0.9.2-2ubuntu2) %system%; urgency=low * Fix bug ticket #129 -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 5 Jan 2009 15:54:53 -0500 -sflphone (0.9.2-2ubuntu1) intrepid; urgency=low +sflphone (0.9.2-2ubuntu1) %system%; urgency=low * Migrate from eXosip library to pjsip * Add multiple SIP accounts support diff --git a/debian/changelog.hardy b/debian/changelog.hardy deleted file mode 100644 index 009a6ff89b698c4c6619f79732fc1d102a145add..0000000000000000000000000000000000000000 --- a/debian/changelog.hardy +++ /dev/null @@ -1,266 +0,0 @@ -sflphone (0.9.3-0ubuntu1) hardy; urgency=low - - * Remove debug - * Join thread before leaving - * Fix implicit declaration in reqaccount - * Add REST code to build the request to server - * Fix GValue initialization warnings - * Update version number, fix implicit declaration, fix GTK markup - warnings - * Apply patch to create custom SIP account from our own server - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 06 Feb 2009 19:17:32 -0500 - -sflphone (0.9.2-2ubuntu9) hardy; urgency=low - - [ Alexandre Savard ] - * Speex audio codec preprocessing initialization - * peer hung up segmentation fault solved - * Stop recording when transfering - * Terminate only one call - * Add isRecording() function - * Fix call_icon GTK client - * Fix SIPCallClose() function, recorded file now close properly - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Fix thread destructor - * setRecordingOption function implement in audiorecord - * Record now implemented in Call class - * Record interface complete (on hold erase previous recording) - * Added recButton in client - * Added: record button related icons - * Record button added - * Overload AudioRecord::recData to get mic and speaker data mixed - * Recording now in audiortp::run() method - * Audio recording working in AudioRTP: receiveSessionForSpeaker - * Open/close a wave file when pulse audio stream start/stop - - [ Emmanuel Milou ] - * Fix path for GTK+ icons; clean up - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 05 Feb 2009 18:27:53 -0500 - -sflphone (0.9.2-2ubuntu8) hardy; urgency=low - - [ Emmanuel Milou ] - * Update changelogs - * Fix bug in merge and in Makefile.am - * Terminate only one call - * Disable PJsip shutdown when changing STUN parameters - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Add a timer to the alsa thread to not jam the CPU load - * Fix bug in sipvoiplink.cpp - * Clean shutdown of pulseaudio on quiting - * Fix DTMF at first start with Pulseaudio - * Remove zeroconf from the build system - * Add a library manager + exception handling - * Clean up in the working directory - * Better handling of capture XRUNs - * Restore mic adjust volume on ALSA layer - * Protect device ALSA operation if not opened - * Fix the switching layer bug - * Use dynamic_cast<> to use audiolayer-specific methods - * Open the audio devices only once at startup - * Refactoring of the ALSA part - * Functional plug-in manager - * Use a C++ thread to handle tones and DTMF in ALSA - * Restore IAXVoIPLink, restore Mutex - * Make the plugins registering against the plugin manager - * Migrate to 1->N relationship between voiplink and accounts - * API plugin for registration - * Use C++ thread in SIP, move everything in sipvoiplink - * Complete singleton pattern for the plugin manager - * Add -Wno-return-type compilation flag to remove warnings; Update - version number in configure.ac - * Add the dynamic loading for the plugin framework; integate unit - * Fix jaunty control file dependency problems - tests - - [ Yun Liu ] - * Update rpm spec file - * modify build package script and spec file for suse - - [ Alexandre Savard ] - * Add audiorecorder plugin and testaudiorecorder - * Add audio Recording class, edit global.h - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 04 Feb 2009 14:00:30 -0500 - -sflphone (0.9.2-2ubuntu7) hardy; urgency=low - - [ Emmanuel Milou ] - * Update changelog to 0.9.2-6 - * Fix some dbus-glib implementation details on the client side - * Init history after dbus initialization - * Add error checking in useragent; Clean sipvoiplink - * Prevent crash when trying to call an empty number - * Set the volume of the playback stream to PA_VOLUME_NORM at startup - * Fix GTK+ generic value double initialization - * Fix jaunty control file dependency problems - * Fix jaunty control file dependency problems - - [ Yun Liu ] - * Fix bug ticket # 137 - * Tolerant to gsm library of OpenSuse 11 - - [ Sven Werlen ] - * Update german translation - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 23 Jan 2009 17:48:13 -0500 - -sflphone (0.9.2-2ubuntu6) hardy; urgency=low - - [ Emmanuel Milou ] - * Migrate STUN configuration to the main config window - * Update french translation - * Other tiny memory leaks - * Fix memory leak in sampleconverter.cpp - * Generate packages from the release branch - * update the build package script - * modify the control files with architecture=any - * Remove valgring uninitialized value - * IAX and SIP use the same global variables to set account - configuration ; fix broken code - - [ Maxime Chambreuil ] - * Update spanish translation - - [ Hussein Abdallah ] - * Update russian translation - - [ Yun Liu ] - * Update translation files - * Fix the bug when user uncheck the account which fails in the - previous registration - * Add stun error status - * Fix bug ticket #143 - * Script for auto-install dependencies - * Fix bug ticket #140 - * Fix bug ticket 141 - * Fix the reregister process when user change the details of an - account - - -- Emmanuel Milou <manu@sulfur.inside.savoirfairelinux.net> Fri, 16 Jan 2009 18:19:05 -0500 - -sflphone (0.9.2-2ubuntu5) hardy; urgency=low - - * Fix memory leak in the pulseaudio callback - * Update debian package generation script - * Warnings removal in GTK+ client - * Clean adjust volume method in alsalayer - * Plug the sflphone playback volume control to the pulseaudio volume - manager - * Display the date in history according to the current locale - * Generate the changelog according to the git commit messages - * Complete header in chinese translation file - * Use the right gpg key to sign the packages - * add debian jaunty jackalope support - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 14 Jan 2009 21:17:20 -0500 - -sflphone (0.9.2-2ubuntu4) hardy; urgency=low - - [ Emmanuel Milou ] - * add german translation - - [ Yun Liu ] - * Fix GUI crash in Ubuntu8.10 64bit system - - -- Yun Liu <yun.liu@savoirfairelinux.com> Thu, 08 Jan 2009 13:08:51 -0500 - -sflphone (0.9.2-2ubuntu3) hardy; urgency=low - - [ Emmanuel Milou ] - * The main thread synchronizes the ringtone thread - * disable custom ringtone for the ALSA layer - * Fix the Makefile.am in man directory, add a SEE ALSO section - - [ Yun Liu ] - * Fix daemon crash caused by the previous patch ( for bug ticket #129) - - -- Yun Liu <yun.liu@savoirfairelinux.com> Tue, 06 Jan 2009 16:18:38 -0500 - -sflphone (0.9.2-2ubuntu2) hardy; urgency=low - - * Fix bug ticket #129 - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 5 Jan 2009 15:54:53 -0500 - -sflphone (0.9.2-2ubuntu1) hardy; urgency=low - - * Migrate from eXosip library to pjsip - * Add multiple SIP accounts support - * Fix ringtones problems - * Add a pulseaudio support - * Improve audio quality with ALSA - * Add chinese translation - * Improve spanish translation - * Migrate to a maintained C++ DBus bindings - * Clean and improve the build system - * Add build-dependency on Perl because we need pod2man to generate manpages - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 26 Nov 2008 09:47:53 -0500 - -sflphone (0.9.1) unstable; urgency=low - * Add a search tool in the history - * Migrate some gtk_entry_new to sexy_icon_entry_new - * Bug fix (Ticket #78): The voicemail password isn't displayed anymore in - the history tab - * Add the SIP registration expire value in the user file. - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 22 May 2008 11:14:25 -0500 - -sflphone (0.9.0) unstable; urgency=low - * Add history features - * Call date - * Call duration - * Mouse events in the history tab - * Smooth switch from the history tab to the calls tab - * Remove most of GTK-Critical warnings - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 13 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-06-06) unstable; urgency=low - * Audio bug correction: capture stopped after a few minutes of conversation - with USB Plantronics sound card - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Tue, 06 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-05-06) unstable; urgency=low - * Bug correction: account creation with the assistant - * GTK+ warnings removal - * libnotify warnings removal - * Remove aliasing on the SFLphone logo - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Mon, 05 May 2008 16:58:25 -0500 - -sflphone (0.9) unstable; urgency=low - * Clean dependencies ( removal of libboost ) - * Several GTK improvement and updates - -account window - -configuration window - * Migrate from GtkCheckMenuItem to GtkImageMenuItem - * ALSA standard I/O transfers: MMAP instead of R/W - * Fix speex audio quality - * IAX2 protocol - -Fix hold/unhold situation - -Add on hold music - * SIP protocol - -Ringtone on incoming call - -Fix transfer situation - * Add desktop notification ( libnotify ) - * Improve the system tray icon behaviour - * Improve registration error handling - * Register/unregister from the account window takes effect without starting back SFLphone - * Compilation warnings removal - * Call history - * Add an account configuration wizard - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 30 Apr 2008 16:58:25 -0500 - -sflphone (0.8.2) unstable; urgency=low - * Internationalization of the GTK GUI - * English / French - * STUN support - * Slight modifications of the graphical interface ( tooltips, dialpad, ...) - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 21 Mar 2008 11:37:53 -0500 diff --git a/debian/changelog.intrepid b/debian/changelog.intrepid deleted file mode 100644 index 07720471d4796a869cbd99823765b5404a6e8474..0000000000000000000000000000000000000000 --- a/debian/changelog.intrepid +++ /dev/null @@ -1,266 +0,0 @@ -sflphone (0.9.3-0ubuntu1) intrepid; urgency=low - - * Remove debug - * Join thread before leaving - * Fix implicit declaration in reqaccount - * Add REST code to build the request to server - * Fix GValue initialization warnings - * Update version number, fix implicit declaration, fix GTK markup - warnings - * Apply patch to create custom SIP account from our own server - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 06 Feb 2009 19:17:32 -0500 - -sflphone (0.9.2-2ubuntu9) intrepid; urgency=low - - [ Alexandre Savard ] - * Speex audio codec preprocessing initialization - * peer hung up segmentation fault solved - * Stop recording when transfering - * Terminate only one call - * Add isRecording() function - * Fix call_icon GTK client - * Fix SIPCallClose() function, recorded file now close properly - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Fix thread destructor - * setRecordingOption function implement in audiorecord - * Record now implemented in Call class - * Record interface complete (on hold erase previous recording) - * Added recButton in client - * Added: record button related icons - * Record button added - * Overload AudioRecord::recData to get mic and speaker data mixed - * Recording now in audiortp::run() method - * Audio recording working in AudioRTP: receiveSessionForSpeaker - * Open/close a wave file when pulse audio stream start/stop - - [ Emmanuel Milou ] - * Fix path for GTK+ icons; clean up - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 05 Feb 2009 18:27:53 -0500 - -sflphone (0.9.2-2ubuntu8) intrepid; urgency=low - - [ Emmanuel Milou ] - * Update changelogs - * Fix bug in merge and in Makefile.am - * Terminate only one call - * Disable PJsip shutdown when changing STUN parameters - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Add a timer to the alsa thread to not jam the CPU load - * Fix bug in sipvoiplink.cpp - * Clean shutdown of pulseaudio on quiting - * Fix DTMF at first start with Pulseaudio - * Remove zeroconf from the build system - * Add a library manager + exception handling - * Clean up in the working directory - * Better handling of capture XRUNs - * Restore mic adjust volume on ALSA layer - * Protect device ALSA operation if not opened - * Fix the switching layer bug - * Use dynamic_cast<> to use audiolayer-specific methods - * Open the audio devices only once at startup - * Refactoring of the ALSA part - * Functional plug-in manager - * Use a C++ thread to handle tones and DTMF in ALSA - * Restore IAXVoIPLink, restore Mutex - * Make the plugins registering against the plugin manager - * Migrate to 1->N relationship between voiplink and accounts - * API plugin for registration - * Use C++ thread in SIP, move everything in sipvoiplink - * Complete singleton pattern for the plugin manager - * Add -Wno-return-type compilation flag to remove warnings; Update - version number in configure.ac - * Add the dynamic loading for the plugin framework; integate unit - * Fix jaunty control file dependency problems - tests - - [ Yun Liu ] - * Update rpm spec file - * modify build package script and spec file for suse - - [ Alexandre Savard ] - * Add audiorecorder plugin and testaudiorecorder - * Add audio Recording class, edit global.h - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 04 Feb 2009 14:00:30 -0500 - -sflphone (0.9.2-2ubuntu7) intrepid; urgency=low - - [ Emmanuel Milou ] - * Update changelog to 0.9.2-6 - * Fix some dbus-glib implementation details on the client side - * Init history after dbus initialization - * Add error checking in useragent; Clean sipvoiplink - * Prevent crash when trying to call an empty number - * Set the volume of the playback stream to PA_VOLUME_NORM at startup - * Fix GTK+ generic value double initialization - * Fix jaunty control file dependency problems - * Fix jaunty control file dependency problems - - [ Yun Liu ] - * Fix bug ticket # 137 - * Tolerant to gsm library of OpenSuse 11 - - [ Sven Werlen ] - * Update german translation - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 23 Jan 2009 17:48:13 -0500 - -sflphone (0.9.2-2ubuntu6) intrepid; urgency=low - - [ Emmanuel Milou ] - * Migrate STUN configuration to the main config window - * Update french translation - * Other tiny memory leaks - * Fix memory leak in sampleconverter.cpp - * Generate packages from the release branch - * update the build package script - * modify the control files with architecture=any - * Remove valgring uninitialized value - * IAX and SIP use the same global variables to set account - configuration ; fix broken code - - [ Maxime Chambreuil ] - * Update spanish translation - - [ Hussein Abdallah ] - * Update russian translation - - [ Yun Liu ] - * Update translation files - * Fix the bug when user uncheck the account which fails in the - previous registration - * Add stun error status - * Fix bug ticket #143 - * Script for auto-install dependencies - * Fix bug ticket #140 - * Fix bug ticket 141 - * Fix the reregister process when user change the details of an - account - - -- Emmanuel Milou <manu@sulfur.inside.savoirfairelinux.net> Fri, 16 Jan 2009 18:19:05 -0500 - -sflphone (0.9.2-2ubuntu5) intrepid; urgency=low - - * Fix memory leak in the pulseaudio callback - * Update debian package generation script - * Warnings removal in GTK+ client - * Clean adjust volume method in alsalayer - * Plug the sflphone playback volume control to the pulseaudio volume - manager - * Display the date in history according to the current locale - * Generate the changelog according to the git commit messages - * Complete header in chinese translation file - * Use the right gpg key to sign the packages - * add debian jaunty jackalope support - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 14 Jan 2009 21:17:20 -0500 - -sflphone (0.9.2-2ubuntu4) intrepid; urgency=low - - [ Emmanuel Milou ] - * add german translation - - [ Yun Liu ] - * Fix GUI crash in Ubuntu8.10 64bit system - - -- Yun Liu <yun.liu@savoirfairelinux.com> Thu, 08 Jan 2009 13:08:51 -0500 - -sflphone (0.9.2-2ubuntu3) intrepid; urgency=low - - [ Emmanuel Milou ] - * The main thread synchronizes the ringtone thread - * disable custom ringtone for the ALSA layer - * Fix the Makefile.am in man directory, add a SEE ALSO section - - [ Yun Liu ] - * Fix daemon crash caused by the previous patch ( for bug ticket #129) - - -- Yun Liu <yun.liu@savoirfairelinux.com> Tue, 06 Jan 2009 16:18:38 -0500 - -sflphone (0.9.2-2ubuntu2) intrepid; urgency=low - - * Fix bug ticket #129 - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 5 Jan 2009 15:54:53 -0500 - -sflphone (0.9.2-2ubuntu1) intrepid; urgency=low - - * Migrate from eXosip library to pjsip - * Add multiple SIP accounts support - * Fix ringtones problems - * Add a pulseaudio support - * Improve audio quality with ALSA - * Add chinese translation - * Improve spanish translation - * Migrate to a maintained C++ DBus bindings - * Clean and improve the build system - * Add build-dependency on Perl because we need pod2man to generate manpages - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 26 Nov 2008 09:47:53 -0500 - -sflphone (0.9.1) unstable; urgency=low - * Add a search tool in the history - * Migrate some gtk_entry_new to sexy_icon_entry_new - * Bug fix (Ticket #78): The voicemail password isn't displayed anymore in - the history tab - * Add the SIP registration expire value in the user file. - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 22 May 2008 11:14:25 -0500 - -sflphone (0.9.0) unstable; urgency=low - * Add history features - * Call date - * Call duration - * Mouse events in the history tab - * Smooth switch from the history tab to the calls tab - * Remove most of GTK-Critical warnings - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 13 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-06-06) unstable; urgency=low - * Audio bug correction: capture stopped after a few minutes of conversation - with USB Plantronics sound card - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Tue, 06 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-05-06) unstable; urgency=low - * Bug correction: account creation with the assistant - * GTK+ warnings removal - * libnotify warnings removal - * Remove aliasing on the SFLphone logo - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Mon, 05 May 2008 16:58:25 -0500 - -sflphone (0.9) unstable; urgency=low - * Clean dependencies ( removal of libboost ) - * Several GTK improvement and updates - -account window - -configuration window - * Migrate from GtkCheckMenuItem to GtkImageMenuItem - * ALSA standard I/O transfers: MMAP instead of R/W - * Fix speex audio quality - * IAX2 protocol - -Fix hold/unhold situation - -Add on hold music - * SIP protocol - -Ringtone on incoming call - -Fix transfer situation - * Add desktop notification ( libnotify ) - * Improve the system tray icon behaviour - * Improve registration error handling - * Register/unregister from the account window takes effect without starting back SFLphone - * Compilation warnings removal - * Call history - * Add an account configuration wizard - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 30 Apr 2008 16:58:25 -0500 - -sflphone (0.8.2) unstable; urgency=low - * Internationalization of the GTK GUI - * English / French - * STUN support - * Slight modifications of the graphical interface ( tooltips, dialpad, ...) - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 21 Mar 2008 11:37:53 -0500 diff --git a/debian/changelog.jaunty b/debian/changelog.jaunty deleted file mode 100644 index 2cf73d7ff811c684bb4b8e3a7fb7dd9b2ce66f01..0000000000000000000000000000000000000000 --- a/debian/changelog.jaunty +++ /dev/null @@ -1,266 +0,0 @@ -sflphone (0.9.3-0ubuntu1) jaunty; urgency=low - - * Remove debug - * Join thread before leaving - * Fix implicit declaration in reqaccount - * Add REST code to build the request to server - * Fix GValue initialization warnings - * Update version number, fix implicit declaration, fix GTK markup - warnings - * Apply patch to create custom SIP account from our own server - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 06 Feb 2009 19:17:32 -0500 - -sflphone (0.9.2-2ubuntu9) jaunty; urgency=low - - [ Alexandre Savard ] - * Speex audio codec preprocessing initialization - * peer hung up segmentation fault solved - * Stop recording when transfering - * Terminate only one call - * Add isRecording() function - * Fix call_icon GTK client - * Fix SIPCallClose() function, recorded file now close properly - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Fix thread destructor - * setRecordingOption function implement in audiorecord - * Record now implemented in Call class - * Record interface complete (on hold erase previous recording) - * Added recButton in client - * Added: record button related icons - * Record button added - * Overload AudioRecord::recData to get mic and speaker data mixed - * Recording now in audiortp::run() method - * Audio recording working in AudioRTP: receiveSessionForSpeaker - * Open/close a wave file when pulse audio stream start/stop - - [ Emmanuel Milou ] - * Fix path for GTK+ icons; clean up - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 05 Feb 2009 18:27:53 -0500 - -sflphone (0.9.2-2ubuntu8) jaunty; urgency=low - - [ Emmanuel Milou ] - * Update changelogs - * Fix bug in merge and in Makefile.am - * Terminate only one call - * Disable PJsip shutdown when changing STUN parameters - * Function terminateSIPCall added in sipvoiplink and managerimpl - * Add a timer to the alsa thread to not jam the CPU load - * Fix bug in sipvoiplink.cpp - * Clean shutdown of pulseaudio on quiting - * Fix DTMF at first start with Pulseaudio - * Remove zeroconf from the build system - * Add a library manager + exception handling - * Clean up in the working directory - * Better handling of capture XRUNs - * Restore mic adjust volume on ALSA layer - * Protect device ALSA operation if not opened - * Fix the switching layer bug - * Use dynamic_cast<> to use audiolayer-specific methods - * Open the audio devices only once at startup - * Refactoring of the ALSA part - * Functional plug-in manager - * Use a C++ thread to handle tones and DTMF in ALSA - * Restore IAXVoIPLink, restore Mutex - * Make the plugins registering against the plugin manager - * Migrate to 1->N relationship between voiplink and accounts - * API plugin for registration - * Use C++ thread in SIP, move everything in sipvoiplink - * Complete singleton pattern for the plugin manager - * Add -Wno-return-type compilation flag to remove warnings; Update - version number in configure.ac - * Add the dynamic loading for the plugin framework; integate unit - * Fix jaunty control file dependency problems - tests - - [ Yun Liu ] - * Update rpm spec file - * modify build package script and spec file for suse - - [ Alexandre Savard ] - * Add audiorecorder plugin and testaudiorecorder - * Add audio Recording class, edit global.h - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 04 Feb 2009 14:00:30 -0500 - -sflphone (0.9.2-2ubuntu7) jaunty; urgency=low - - [ Emmanuel Milou ] - * Update changelog to 0.9.2-6 - * Fix some dbus-glib implementation details on the client side - * Init history after dbus initialization - * Add error checking in useragent; Clean sipvoiplink - * Prevent crash when trying to call an empty number - * Set the volume of the playback stream to PA_VOLUME_NORM at startup - * Fix GTK+ generic value double initialization - * Fix jaunty control file dependency problems - * Fix jaunty control file dependency problems - - [ Yun Liu ] - * Fix bug ticket # 137 - * Tolerant to gsm library of OpenSuse 11 - - [ Sven Werlen ] - * Update german translation - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 23 Jan 2009 17:48:13 -0500 - -sflphone (0.9.2-2ubuntu6) jaunty; urgency=low - - [ Emmanuel Milou ] - * Migrate STUN configuration to the main config window - * Update french translation - * Other tiny memory leaks - * Fix memory leak in sampleconverter.cpp - * Generate packages from the release branch - * update the build package script - * modify the control files with architecture=any - * Remove valgring uninitialized value - * IAX and SIP use the same global variables to set account - configuration ; fix broken code - - [ Maxime Chambreuil ] - * Update spanish translation - - [ Hussein Abdallah ] - * Update russian translation - - [ Yun Liu ] - * Update translation files - * Fix the bug when user uncheck the account which fails in the - previous registration - * Add stun error status - * Fix bug ticket #143 - * Script for auto-install dependencies - * Fix bug ticket #140 - * Fix bug ticket 141 - * Fix the reregister process when user change the details of an - account - - -- Emmanuel Milou <manu@sulfur.inside.savoirfairelinux.net> Fri, 16 Jan 2009 18:19:05 -0500 - -sflphone (0.9.2-2ubuntu5) jaunty; urgency=low - - * Fix memory leak in the pulseaudio callback - * Update debian package generation script - * Warnings removal in GTK+ client - * Clean adjust volume method in alsalayer - * Plug the sflphone playback volume control to the pulseaudio volume - manager - * Display the date in history according to the current locale - * Generate the changelog according to the git commit messages - * Complete header in chinese translation file - * Use the right gpg key to sign the packages - * add debian jaunty jackalope support - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 14 Jan 2009 21:17:20 -0500 - -sflphone (0.9.2-2ubuntu4) jaunty; urgency=low - - [ Emmanuel Milou ] - * add german translation - - [ Yun Liu ] - * Fix GUI crash in Ubuntu8.10 64bit system - - -- Yun Liu <yun.liu@savoirfairelinux.com> Thu, 08 Jan 2009 13:08:51 -0500 - -sflphone (0.9.2-2ubuntu3) jaunty; urgency=low - - [ Emmanuel Milou ] - * The main thread synchronizes the ringtone thread - * disable custom ringtone for the ALSA layer - * Fix the Makefile.am in man directory, add a SEE ALSO section - - [ Yun Liu ] - * Fix daemon crash caused by the previous patch ( for bug ticket #129) - - -- Yun Liu <yun.liu@savoirfairelinux.com> Tue, 06 Jan 2009 16:18:38 -0500 - -sflphone (0.9.2-2ubuntu2) jaunty; urgency=low - - * Fix bug ticket #129 - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 5 Jan 2009 15:54:53 -0500 - -sflphone (0.9.2-2ubuntu1) jaunty; urgency=low - - * Migrate from eXosip library to pjsip - * Add multiple SIP accounts support - * Fix ringtones problems - * Add a pulseaudio support - * Improve audio quality with ALSA - * Add chinese translation - * Improve spanish translation - * Migrate to a maintained C++ DBus bindings - * Clean and improve the build system - * Add build-dependency on Perl because we need pod2man to generate manpages - - -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 26 Nov 2008 09:47:53 -0500 - -sflphone (0.9.1) unstable; urgency=low - * Add a search tool in the history - * Migrate some gtk_entry_new to sexy_icon_entry_new - * Bug fix (Ticket #78): The voicemail password isn't displayed anymore in - the history tab - * Add the SIP registration expire value in the user file. - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 22 May 2008 11:14:25 -0500 - -sflphone (0.9.0) unstable; urgency=low - * Add history features - * Call date - * Call duration - * Mouse events in the history tab - * Smooth switch from the history tab to the calls tab - * Remove most of GTK-Critical warnings - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 13 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-06-06) unstable; urgency=low - * Audio bug correction: capture stopped after a few minutes of conversation - with USB Plantronics sound card - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Tue, 06 May 2008 16:58:25 -0500 - -sflphone (0.9-2008-05-06) unstable; urgency=low - * Bug correction: account creation with the assistant - * GTK+ warnings removal - * libnotify warnings removal - * Remove aliasing on the SFLphone logo - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Mon, 05 May 2008 16:58:25 -0500 - -sflphone (0.9) unstable; urgency=low - * Clean dependencies ( removal of libboost ) - * Several GTK improvement and updates - -account window - -configuration window - * Migrate from GtkCheckMenuItem to GtkImageMenuItem - * ALSA standard I/O transfers: MMAP instead of R/W - * Fix speex audio quality - * IAX2 protocol - -Fix hold/unhold situation - -Add on hold music - * SIP protocol - -Ringtone on incoming call - -Fix transfer situation - * Add desktop notification ( libnotify ) - * Improve the system tray icon behaviour - * Improve registration error handling - * Register/unregister from the account window takes effect without starting back SFLphone - * Compilation warnings removal - * Call history - * Add an account configuration wizard - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 30 Apr 2008 16:58:25 -0500 - -sflphone (0.8.2) unstable; urgency=low - * Internationalization of the GTK GUI - * English / French - * STUN support - * Slight modifications of the graphical interface ( tooltips, dialpad, ...) - - -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 21 Mar 2008 11:37:53 -0500 diff --git a/debian/control.hardy b/debian/control.hardy index 5f3325d28296677b588b36e77a96a0f21e6ac1eb..62a95771912ac053345e9e54bb6442e9ac14e3e0 100644 --- a/debian/control.hardy +++ b/debian/control.hardy @@ -1,14 +1,14 @@ Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> +Maintainer: SavoirFaireLinux Inc <emmanuel.milou@savoirfairelinux.com> Section: gnome Priority: optional -Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev +Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev Standards-Version: 3.7.3 Package: sflphone Priority: optional Architecture: any -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>=2.22.2), libspeexdsp1 +Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 ,libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>=2.22.2) Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone SFLphone is meant to be a robust enterprise-class desktop phone. diff --git a/debian/control.intrepid b/debian/control.intrepid index 20d43bdf7175e57024c749afc715c0172dcce874..efcff9811b55723f4e4cf5e7ea66d40fd9a1a374 100644 --- a/debian/control.intrepid +++ b/debian/control.intrepid @@ -1,14 +1,14 @@ Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> +Maintainer: SavoirFaireLinux Inc <emmanuel.milou@savoirfairelinux.com> Section: gnome Priority: optional -Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev +Build-Depends: debhelper (>= 5), autoconf, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev Standards-Version: 3.8.0 Package: sflphone Priority: optional Architecture: any -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>= 2.22.2), libspeexdsp1 +Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>= 2.22.2), libspeexdsp1 Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone SFLphone is meant to be a robust enterprise-class desktop phone. diff --git a/debian/control.jaunty b/debian/control.jaunty index fa0f561ccbd5cf15378ec2acc586007de622e76b..e1d859266bfa82acbb19c706427ce25bd8f3680f 100644 --- a/debian/control.jaunty +++ b/debian/control.jaunty @@ -1,14 +1,14 @@ Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> +Maintainer: SavoirFaireLinux Inc <emmanuel.milou@savoirfairelinux.com> Section: gnome Priority: optional -Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev +Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev, libasound2-dev, libspeexdsp-dev Standards-Version: 3.7.3 Package: sflphone Priority: optional Architecture: any -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>=2.22.2), libspeexdsp1 +Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8), librsvg2-common (>=2.22.2), libspeexdsp1 Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone SFLphone is meant to be a robust enterprise-class desktop phone. diff --git a/debian/copyright b/debian/copyright index 7e3038998d78e72f705cee4fa1abc90f4c712518..b2b1db618faada9f059816c127e00d081dbf17bf 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,17 +1,17 @@ -This package was debianized by Yun Liu <yun.liu@savoirfairelinux.com> on +This package was debianized by Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> on Wed, 26 Nov 2008 09:47:53 -0500. It was downloaded from the git repository of SFLphone: git://sflphone.org/git/sflphone.git -Upstream Author: Yun Liu <yun.liu@savoirfairelinux.com> +Upstream Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Copyright: -SavoirFaire Linux Inc. +Savoir-Faire Linux Inc. License: -This software is copyright (c) 2004-2008 Savoir-Faire Linux inc. +This software is copyright (c) 2004-2009 Savoir-Faire Linux inc. You are free to distribute this software under the terms of the GNU General Public License version 3. diff --git a/debian/rules b/debian/rules index 0c28f46b62d90841a60769068831f7647eb560bb..fd00d4698a8c5990de34d79b2a027973d7334c2f 100755 --- a/debian/rules +++ b/debian/rules @@ -22,8 +22,10 @@ configure-stamp: # Add here commands to configure the package. ./autogen.sh --prefix=/usr --with-debug cd sflphone-gtk; ./autogen.sh --prefix=/usr - cd libs/pjproject-1.0; ./configure + cd libs/pjproject-1.0.1; ./configure touch configure-stamp + cd libs/dbus-c++; ./configure + cd libs/libiax2; ./configure #Architecture @@ -35,8 +37,10 @@ build-arch-stamp: configure-stamp # Add here commands to compile the arch part of the package. $(MAKE) cd sflphone-gtk; make - cd libs/pjproject-1.0; $(MAKE) dep; $(MAKE) + cd libs/pjproject-1.0.1; $(MAKE) dep; $(MAKE) touch $@ + cd libs/dbus-c++; $(MAKE) + cd libs/libiax2; $(MAKE) build-indep: build-indep-stamp build-indep-stamp: configure-stamp @@ -76,7 +80,9 @@ install-arch: # debian/tmp. $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install cd sflphone-gtk; $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install - cd libs/pjproject-1.0; $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install + cd libs/pjproject-1.0.1; $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install + cd libs/dbus-c++; $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install + cd libs/libiax2; $(MAKE) prefix=$(CURDIR)/debian/$(package)/usr install rm -rf $(CURDIR)/debian/$(package)/usr/include dh_install -s # Must not depend on anything. This is to be called by diff --git a/libs/dbus-c++/AUTHORS b/libs/dbus-c++/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..d9c8833559ba2c6f650242249c6b4bb98138c7bd --- /dev/null +++ b/libs/dbus-c++/AUTHORS @@ -0,0 +1 @@ +Paolo Durante <shackan@gmail.com> diff --git a/libs/dbus-c++/COPYING b/libs/dbus-c++/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..5ab7695ab8cabe0c5c8a814bb0ab1e8066578fbb --- /dev/null +++ b/libs/dbus-c++/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/libs/dbus-c++/ChangeLog b/libs/dbus-c++/ChangeLog new file mode 100644 index 0000000000000000000000000000000000000000..e1aa57adee9c4266d17b694d9e8966116aeee71e --- /dev/null +++ b/libs/dbus-c++/ChangeLog @@ -0,0 +1,4 @@ +dbus-c++-1 (0.5.1-1) unstable; urgency=low + * Debian package (no warning version) + + -- Yun Liu <yun.liu@savoirfairelinux.com> Mon, 01 Dec 2008 10:29:29 -0500 diff --git a/libs/dbus-c++/INSTALL b/libs/dbus-c++/INSTALL new file mode 100644 index 0000000000000000000000000000000000000000..23e5f25d0e5f85798dcfb368ecb2f04f59777f61 --- /dev/null +++ b/libs/dbus-c++/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libs/dbus-c++/Makefile.am b/libs/dbus-c++/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..29bb7c9bb72b0e73a77594019c38280345c20cf2 --- /dev/null +++ b/libs/dbus-c++/Makefile.am @@ -0,0 +1,22 @@ +SUBDIRS = src tools data doc examples + +EXTRA_DIST = autogen.sh libdbus-c++.spec libdbus-c++.spec.in + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = dbus-c++-1.pc + +MAINTAINERCLEANFILES = \ + configure \ + Makefile.in \ + aclocal.m4 \ + compile \ + config.guess \ + config.sub \ + depcomp \ + install-sh \ + ltmain.sh \ + mdate-sh \ + missing \ + mkinstalldirs \ + libdbus-c++.spec + diff --git a/libs/dbus-c++/NEWS b/libs/dbus-c++/NEWS new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/libs/dbus-c++/README b/libs/dbus-c++/README new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/libs/dbus-c++/SConscript b/libs/dbus-c++/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..d7b235898951800d2de2cb1470266aa63daad1df --- /dev/null +++ b/libs/dbus-c++/SConscript @@ -0,0 +1,85 @@ +# +# library +# + +env = WengoGetEnvironment() + +env.ParseConfig('pkg-config --cflags --libs dbus-1') + +libs = [ + 'expat' +] +lib_path = [] +include_path = [ + 'include' +] +defines = { + 'DBUS_API_SUBJECT_TO_CHANGE':1, + 'DEBUG':1 +} +headers = [] +sources = [ + 'src/connection.cpp', + 'src/debug.cpp', + 'src/dispatcher.cpp', + 'src/error.cpp', + 'src/eventloop.cpp', + 'src/interface.cpp', + 'src/introspection.cpp', + 'src/property.cpp', + 'src/message.cpp', + 'src/object.cpp', + 'src/pendingcall.cpp', + 'src/server.cpp', + 'src/types.cpp', + 'src/xml.cpp' +] + +env.WengoAddDefines(defines) +env.WengoAddIncludePath(include_path) +env.WengoUseLibraries(libs) +env.WengoStaticLibrary('dbus-c++', sources) + +# +# tools +# + +tools_env = WengoGetEnvironment() + +tools_libs = [ + 'dbus-c++' +] +tools_defines = { + 'DBUS_API_SUBJECT_TO_CHANGE':1, +} +introspect_sources = [ + 'tools/introspect.cpp', +] + +xml2cpp_sources = [ + 'tools/xml2cpp.cpp' +] + +#tools_env.Append(LINKFLAGS = '-z origin') +#tools_env.Append(RPATH = env.Literal('\\$$ORIGIN\.')) + +tools_env.WengoAddDefines(tools_defines) +tools_env.WengoAddIncludePath(include_path) +tools_env.WengoUseLibraries(tools_libs) + +dbusxx_introspect = tools_env.WengoProgram('dbusxx-introspect', introspect_sources) +dbusxx_xml2cpp = tools_env.WengoProgram('dbusxx-xml2cpp', xml2cpp_sources) + +# +# xml translator +# + +def dbusxx_xml2cpp_emitter(target, source, env): + env.Depends(target, dbusxx_xml2cpp) + return (target, source) + +dbusxx_xml2cpp_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --adaptor=$TARGET', + emitter = dbusxx_xml2cpp_emitter, + suffix = '.h', src_suffix = '.xml') + +Export('dbusxx_xml2cpp_builder') diff --git a/libs/dbus-c++/TODO b/libs/dbus-c++/TODO new file mode 100644 index 0000000000000000000000000000000000000000..f975a80a45241239e7a50bbb859bdc26de54d1c2 --- /dev/null +++ b/libs/dbus-c++/TODO @@ -0,0 +1,8 @@ +* Implement asynchronous method calls (hint: start from DBus::PendingCall) +* ...and patch the codegen to generate stubs for them +* Implement continuations in a saner way +* Find time for some hardcore valgrinding +* Make DBus::Server free an incoming connection when it's disconnected, not when freeing the server +* More examples +* Inline (Doxygen-style) documentation +* Native protocol implementation (as an alternative to libdbus) diff --git a/libs/dbus-c++/autogen.sh b/libs/dbus-c++/autogen.sh new file mode 100755 index 0000000000000000000000000000000000000000..4af86e25d4b4dde140668ab04805c9f0c3a8018e --- /dev/null +++ b/libs/dbus-c++/autogen.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +function autocmd() +{ + echo "Running ${1}..." + $* || { + echo "Error running ${1}" + exit 1 + } +} + +autocmd libtoolize --force --copy +autocmd aclocal +autocmd autoheader +autocmd automake --add-missing --force-missing --copy -Wall +autocmd autoconf + +echo "Autogen done, now you can ./configure" diff --git a/libs/dbus-c++/config.guess b/libs/dbus-c++/config.guess new file mode 100755 index 0000000000000000000000000000000000000000..f32079abda668e5fc8f8de6f226e7b26384e8a03 --- /dev/null +++ b/libs/dbus-c++/config.guess @@ -0,0 +1,1526 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-23' + +# This file 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 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libs/dbus-c++/config.sub b/libs/dbus-c++/config.sub new file mode 100755 index 0000000000000000000000000000000000000000..6759825a5b7fcf64476b4398dc0e30b3090b925c --- /dev/null +++ b/libs/dbus-c++/config.sub @@ -0,0 +1,1658 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2008-01-16' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libs/dbus-c++/configure.ac b/libs/dbus-c++/configure.ac new file mode 100644 index 0000000000000000000000000000000000000000..8517c67c2fce4a43b36a61a59d0b28b69aee6df8 --- /dev/null +++ b/libs/dbus-c++/configure.ac @@ -0,0 +1,196 @@ +# Autojunk script for libdbus-c++ + +AC_PREREQ(2.59) +AC_INIT([libdbus-c++], 0.5.0, [shackan@gmail.com]) + +AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) +AM_CONFIG_HEADER([include/dbus-c++/config.h]) + +AC_CANONICAL_HOST + +AC_SUBST(PACKAGE_VERSION) + + +# Set configuration options + +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], + [enable debugging support]), + [enable_debug=$enableval], + [enable_debug=no] +) + +AC_ARG_ENABLE(glib, + AS_HELP_STRING([--enable-glib], + [enable glib integration]), + [enable_glib=$enableval], + [enable_glib=no] +) + +AC_ARG_ENABLE(doxygen-docs, + AS_HELP_STRING([--enable-doxygen-docs], + [build DOXYGEN documentation (requires Doxygen)]), + [enable_doxygen_docs=$enableval], + [enable_doxygen_docs=no] +) + +# Check for programs + +AC_LANG_CPLUSPLUS + +AC_PROG_CC +AC_PROG_CXX + +CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}} +AC_SUBST(CXX_FOR_BUILD) + +AM_PROG_LIBTOOL + +PKG_PROG_PKG_CONFIG + + +AC_MSG_CHECKING([whether $CXX supports symbol visibility]) + +vtest=`$CXX --help --verbose 2>&1 | grep fvisibility` + +if test -n "$vtest"; then + AC_MSG_RESULT(yes) + + AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols]) + CXXFLAGS="-fvisibility=hidden" +else + AC_MSG_RESULT(no) +fi + + +# Check for dependencies + +DBUS_REQUIRED_VERSION=0.60 +PKG_CHECK_MODULES(dbus, [dbus-1 >= $DBUS_REQUIRED_VERSION],, + AC_MSG_ERROR([You need the DBus libraries (version 0.6 or better)] + [http://www.freedesktop.org/wiki/Software_2fdbus]) +) +AC_SUBST(dbus_CFLAGS) +AC_SUBST(dbus_LIBS) + +DBUS_API_STABLE_VERSION=1.0.0 +PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION], + [AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])] +) + +DBUS_THREADS_INIT_DEFAULT_VERSION=0.93 +PKG_CHECK_EXISTS([dbus-1 >= $DBUS_THREADS_INIT_DEFAULT_VERSION], + [AC_DEFINE(DBUS_HAS_THREADS_INIT_DEFAULT, , [dbus_threads_init_default (needs DBus >= 0.93)])] +) + +DBUS_RECURSIVE_MUTEX_VERSION=0.95 +PKG_CHECK_EXISTS([dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION], + [AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])] +) + + +if test "$enable_glib" = "yes" ; then +PKG_CHECK_MODULES([glib], glib-2.0) +AC_SUBST(glib_CFLAGS) +AC_SUBST(glib_LIBS) +AM_CONDITIONAL(ENABLE_GLIB, test 1 = 1) +PKG_CHECK_MODULES([gtkmm], gtkmm-2.4, + AM_CONDITIONAL(HAVE_GTKMM, test 1 = 1), + AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1) +) +AC_SUBST(gtkmm_CFLAGS) +AC_SUBST(gtkmm_LIBS) +else +AM_CONDITIONAL(ENABLE_GLIB, test 0 = 1) +AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1) +fi + +AC_CHECK_LIB([expat], XML_ParserCreate_MM, + [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)], + have_expat=false) + +if ! $have_expat; then + AC_MSG_ERROR([You need the eXpat xml parser] + [http://expat.sourceforge.net/]) +fi + +xml_CFLAGS= +xml_LIBS=-lexpat + +AC_SUBST(xml_CFLAGS) +AC_SUBST(xml_LIBS) + +AC_CHECK_LIB([pthread], pthread_create, + [AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)], + have_pthread=false) + +if test "$have_pthread" = "false"; then + AC_MSG_ERROR([You need the POSIX Thread library (pthreads)]) +fi + +if test "$enable_debug" = "yes" ; then + CXXFLAGS="$CXXFLAGS -Wall -ggdb -O0 -DDEBUG -Wfatal-errors -Werror" +else + CXXFLAGS="$CXXFLAGS -Wall -O3" +fi + + +# Doxygen Documentation + +AC_PATH_PROG(DOXYGEN, doxygen, no) + +AC_MSG_CHECKING([whether to build Doxygen documentation]) + +if test "$DOXYGEN" = "no" ; then + have_doxygen=no +else + have_doxygen=yes +fi + +if test "$enable_doxygen_docs" = "auto" ; then + enable_doxygen_docs=no + + AC_MSG_RESULT(no) +fi + +if test "$enable_doxygen_docs" = "yes" ; then + if test "$have_doxygen" = "no"; then + AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found]) + fi + + AC_MSG_RESULT(yes) +fi + +AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes") + +# For the tools/, we need libdbus-c++ for the "build" architecture as well + +AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") + +AC_ARG_WITH(build-libdbus-cxx, + AS_HELP_STRING([--with-build-libdbus-cxx], + [For cross compilation: path to libdbus-cxx which was compiled for the 'build' system.]), + [ BUILD_LIBDBUS_CXX_DIR=${withval} ], + [ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ] +) +AC_SUBST(BUILD_LIBDBUS_CXX_DIR) + + +# Save processed files + +AC_OUTPUT( + Makefile + src/Makefile + tools/Makefile + data/Makefile + doc/Makefile + doc/Doxyfile + examples/Makefile + examples/properties/Makefile + examples/echo/Makefile + examples/hal/Makefile + examples/glib/Makefile + dbus-c++-1.pc + dbus-c++-1-uninstalled.pc + libdbus-c++.spec +) diff --git a/libs/dbus-c++/data/Makefile.am b/libs/dbus-c++/data/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..23df86ec8db8fe4cc2cfd00328f5edc0d1097fae --- /dev/null +++ b/libs/dbus-c++/data/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = org.freedesktop.DBus.xml + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/data/org.freedesktop.DBus.xml b/libs/dbus-c++/data/org.freedesktop.DBus.xml new file mode 100644 index 0000000000000000000000000000000000000000..cbb38abfff52d715d60941907e759189101dc576 --- /dev/null +++ b/libs/dbus-c++/data/org.freedesktop.DBus.xml @@ -0,0 +1,90 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="org.freedesktop.DBus.Introspectable"> + <method name="Introspect"> + <arg name="data" direction="out" type="s"/> + </method> + </interface> + <interface name="org.freedesktop.DBus.Properties"> + <method name="Get"> + <arg name="interface_name" direction="in" type="s"/> + <arg name="property_name" direction="in" type="s"/> + <arg name="value" direction="out" type="v"/> + </method> + <method name="Set"> + <arg name="interface_name" direction="in" type="s"/> + <arg name="property_name" direction="in" type="s"/> + <arg name="value" direction="in" type="v"/> + </method> + <method name="GetAll"> + <arg name="interface_name" direction="in" type="s"/> + <arg name="props" direction="out" type="a{sv}"/> + </method> + </interface> + <interface name="org.freedesktop.DBus"> + <method name="RequestName"> + <arg direction="in" type="s"/> + <arg direction="in" type="u"/> + <arg direction="out" type="u"/> + </method> + <method name="ReleaseName"> + <arg direction="in" type="s"/> + <arg direction="out" type="u"/> + </method> + <method name="StartServiceByName"> + <arg direction="in" type="s"/> + <arg direction="in" type="u"/> + <arg direction="out" type="u"/> + </method> + <method name="Hello"> + <arg direction="out" type="s"/> + </method> + <method name="NameHasOwner"> + <arg direction="in" type="s"/> + <arg direction="out" type="b"/> + </method> + <method name="ListNames"> + <arg direction="out" type="as"/> + </method> + <method name="AddMatch"> + <arg direction="in" type="s"/> + </method> + <method name="RemoveMatch"> + <arg direction="in" type="s"/> + </method> + <method name="GetNameOwner"> + <arg direction="in" type="s"/> + <arg direction="out" type="s"/> + </method> + <method name="ListQueuedOwners"> + <arg direction="in" type="s"/> + <arg direction="out" type="as"/> + </method> + <method name="GetConnectionUnixUser"> + <arg direction="in" type="s"/> + <arg direction="out" type="u"/> + </method> + <method name="GetConnectionUnixProcessID"> + <arg direction="in" type="s"/> + <arg direction="out" type="u"/> + </method> + <method name="GetConnectionSELinuxSecurityContext"> + <arg direction="in" type="s"/> + <arg direction="out" type="ay"/> + </method> + <method name="ReloadConfig"> + </method> + <signal name="NameOwnerChanged"> + <arg type="s"/> + <arg type="s"/> + <arg type="s"/> + </signal> + <signal name="NameLost"> + <arg type="s"/> + </signal> + <signal name="NameAcquired"> + <arg type="s"/> + </signal> + </interface> +</node> diff --git a/libs/dbus-c++/dbus-c++-1-uninstalled.pc.in b/libs/dbus-c++/dbus-c++-1-uninstalled.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..839fa86ab6375c46cf961ad5dca2c9789eecca2e --- /dev/null +++ b/libs/dbus-c++/dbus-c++-1-uninstalled.pc.in @@ -0,0 +1,13 @@ +prefix= +exec_prefix= +libdir=src +includedir=include + +Name: @PACKAGE@ +Description: Native C++ bindings for D-Bus, Not Installed +Version: @VERSION@ +Requires: +Conflicts: +Libs: ${pcfiledir}/${libdir}/libdbus-c++-1.la +Cflags: -I${pcfiledir}/${includedir} + diff --git a/libs/dbus-c++/dbus-c++-1.pc.in b/libs/dbus-c++/dbus-c++-1.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..bc5860a95594e9bd30af8687b7c1e162f6fd79bb --- /dev/null +++ b/libs/dbus-c++/dbus-c++-1.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: dbus-c++ +Description: Native C++ bindings for D-Bus. +Requires: dbus-1 +Version: @VERSION@ +Libs: -L${libdir} -ldbus-c++-1 +Cflags: -I${includedir}/dbus-c++-1 -DDBUS_API_SUBJECT_TO_CHANGE diff --git a/libs/dbus-c++/debian/changelog b/libs/dbus-c++/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..488f083fd5c443302e812b0d20cebf369b67161e --- /dev/null +++ b/libs/dbus-c++/debian/changelog @@ -0,0 +1,4 @@ +dbus-c++-1 (0.5.1-2ubuntu1) intrepid; urgency=low + * Debian package (no warning version) + + -- Yun Liu <yun.liu@savoirfairelinux.com> Mon, 01 Dec 2008 10:29:29 -0500 diff --git a/libs/dbus-c++/debian/compat b/libs/dbus-c++/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/libs/dbus-c++/debian/compat @@ -0,0 +1 @@ +5 diff --git a/libs/dbus-c++/debian/control b/libs/dbus-c++/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..f74909f987ff1269fbed34daf06a8e1b5d5944f5 --- /dev/null +++ b/libs/dbus-c++/debian/control @@ -0,0 +1,30 @@ +Source: dbus-c++-1 +Priority: optional +Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.3 +Section: libs + +Package: dbus-c++-1-dev +Section: libdevel +Architecture: amd64 +Depends: libc6 (>=2.6.1-1), dbus-c++-1 (>= 0.5.1) +Homepage: http://www.sflphone.org +Description: SFLphone C++ DBus Bindings + It is a C++ interface for DBus. It has the ability to reflect DBus methods + and signals into a more natural C++ object system. + SFLphone is being developed by the global community, and maintained by + Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. + This package is only for the development use. + +Package: dbus-c++-1 +Section: libs +Architecture: amd64 +Homepage: http://www.sflphone.org +Depends: libc6 (>=2.6.1-1),${shlibs:Depends} +Description: SFLphone C++ DBus Bindings + It is a C++ interface for DBus. It has the ability to reflect DBus methods + and signals into a more natural C++ object system. + SFLphone is being developed by the global community, and maintained by + Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. + This package is only the library. diff --git a/libs/dbus-c++/debian/copyright b/libs/dbus-c++/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..db09a6388967aac83978355137f74cd4b558da86 --- /dev/null +++ b/libs/dbus-c++/debian/copyright @@ -0,0 +1,12 @@ +This package was debianized by Yun Liu <yun.liu@savoirfairelinux.com> on +Mon, 01 Dec 2008 10:29:29 -0500. + +It was download from: svn --username guest --password guest --non-interactive co http://dev.openwengo.org/svn/openwengo/wengophone-ng/branches/wengophone-dbus-api/libs/dbus/ +Copyright: + Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + +License: + Lesser General Public License ( LGPL ) + +On Debian systems, the complete text of the licenses can be found in the +/usr/share/common-licenses/LGPL and /usr/share/common-licenses/GPL files. diff --git a/libs/dbus-c++/debian/dbus-c++-1-dev.install b/libs/dbus-c++/debian/dbus-c++-1-dev.install new file mode 100644 index 0000000000000000000000000000000000000000..9f564627cb728e01b56c09bde90457cfa304ed7a --- /dev/null +++ b/libs/dbus-c++/debian/dbus-c++-1-dev.install @@ -0,0 +1,6 @@ +usr/include/* +usr/lib/*.a +usr/lib/*.so +usr/lib/*.la +usr/lib/pkgconfig/* + diff --git a/libs/dbus-c++/debian/dbus-c++-1.install b/libs/dbus-c++/debian/dbus-c++-1.install new file mode 100644 index 0000000000000000000000000000000000000000..0bfc1fdb18d1d52aed647ca1c36cc243e7c7b496 --- /dev/null +++ b/libs/dbus-c++/debian/dbus-c++-1.install @@ -0,0 +1,2 @@ +usr/lib/*.so.* +usr/bin/* diff --git a/libs/dbus-c++/debian/docs b/libs/dbus-c++/debian/docs new file mode 100644 index 0000000000000000000000000000000000000000..7d96d4e7e64707836831fa81886c7a44ec116fcb --- /dev/null +++ b/libs/dbus-c++/debian/docs @@ -0,0 +1,2 @@ +AUTHORS +TODO diff --git a/libs/dbus-c++/debian/rules b/libs/dbus-c++/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..a0a20bfc24a08bfa1ec480b5004c840efee4f5d1 --- /dev/null +++ b/libs/dbus-c++/debian/rules @@ -0,0 +1,99 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + +# shared library versions, option 1 +version=0.5.1 +major=1 +# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so +#version=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +#major=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + ./autogen.sh + ./configure --prefix=/usr + touch configure-stamp + + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) distclean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_install --sourcedir debian/tmp +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/libs/dbus-c++/depcomp b/libs/dbus-c++/depcomp new file mode 100755 index 0000000000000000000000000000000000000000..04701da536f33a7c39d7bb01b87a70ae3a776df5 --- /dev/null +++ b/libs/dbus-c++/depcomp @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program 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 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/libs/dbus-c++/doc/Doxyfile.in b/libs/dbus-c++/doc/Doxyfile.in new file mode 100644 index 0000000000000000000000000000000000000000..a2b3d4415fe2026b0f0e520d88934377bda6ff9a --- /dev/null +++ b/libs/dbus-c++/doc/Doxyfile.in @@ -0,0 +1,251 @@ +# Doxyfile 1.4.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = @PACKAGE@ +PROJECT_NUMBER = @VERSION@ +OUTPUT_DIRECTORY = @top_srcdir@/doc/ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = YES +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @top_srcdir@/src/ @top_srcdir@/include/ +FILE_PATTERNS = *.cpp \ + *.h +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = Makefile.* \ + ChangeLog \ + CHANGES \ + CHANGES.* \ + README \ + README.* \ + *.png \ + AUTHORS \ + DESIGN \ + DESIGN.* \ + *.desktop \ + DESKTOP* \ + COMMENTS \ + HOWTO \ + magic \ + NOTES \ + TODO \ + THANKS +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = NO +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 640 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/libs/dbus-c++/doc/Makefile.am b/libs/dbus-c++/doc/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..39fd9b9deb140ecfadc9dde627dc835de95fb335 --- /dev/null +++ b/libs/dbus-c++/doc/Makefile.am @@ -0,0 +1,15 @@ +if DBUS_DOXYGEN_DOCS_ENABLED + +EXTRA_DIST = Doxyfile.in + +noinst_PROGRAMS = index.html + +index_html_SOURCES = Doxyfile + +index.html: Doxyfile + doxygen Doxyfile + +endif + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/doc/html/Makefile.am b/libs/dbus-c++/doc/html/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..8eb67f86574b1821e66ddf261e6c7de2eaa46546 --- /dev/null +++ b/libs/dbus-c++/doc/html/Makefile.am @@ -0,0 +1,4 @@ +CLEANFILES = *.html *.css *.png *.gif + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/examples/Makefile.am b/libs/dbus-c++/examples/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b346604bad07e6aabfc20c1e3a581325446085f1 --- /dev/null +++ b/libs/dbus-c++/examples/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = properties echo hal glib + +MAINTAINERCLEANFILES = \ + Makefile.in + diff --git a/libs/dbus-c++/examples/echo/Makefile.am b/libs/dbus-c++/examples/echo/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..565fb1a0136bd9eaaa6fcfe4d0119438dd7e1041 --- /dev/null +++ b/libs/dbus-c++/examples/echo/Makefile.am @@ -0,0 +1,28 @@ +EXTRA_DIST = README echo-introspect.xml + +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include + +noinst_PROGRAMS = echo-server + +echo_server_SOURCES = echo-server-glue.h echo-server.h echo-server.cpp +echo_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la + +echo-server-glue.h: echo-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@ + +noinst_PROGRAMS += echo-client-mt + +echo_client_mt_SOURCES = echo-client-glue.h echo-client.h echo-client.cpp +echo_client_mt_LDADD = $(top_builddir)/src/libdbus-c++-1.la -lpthread + +echo-client-glue.h: echo-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@ + +BUILT_SOURCES = echo-server-glue.h echo-client-glue.h +CLEANFILES = $(BUILT_SOURCES) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/examples/echo/README b/libs/dbus-c++/examples/echo/README new file mode 100644 index 0000000000000000000000000000000000000000..74e1d6d16c59858237e98e5186000951397d95d5 --- /dev/null +++ b/libs/dbus-c++/examples/echo/README @@ -0,0 +1,23 @@ +This is probably the most simple D-Bus program you could conceive + +To test, run `DBUSXX_VERBOSE=1 ./echo-server` and try the following commands: + +dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Random + +dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Hello string:"world" + +dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Sum array:int32:10,100,250 + +dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Info + +or, using python instead + +$ python +import dbus +bus = dbus.SessionBus() +object = bus.get_object('org.freedesktop.DBus.Examples.Echo','/org/freedesktop/DBus/Examples/Echo') +echo = dbus.Interface(object, dbus_interface='org.freedesktop.DBus.EchoDemo') +echo.Random() +echo.Hello("world") +echo.Sum([123, 234, 95, 520]) +echo.Info() diff --git a/libs/dbus-c++/examples/echo/echo-client.cpp b/libs/dbus-c++/examples/echo/echo-client.cpp new file mode 100644 index 0000000000000000000000000000000000000000..287206671d08f5d98be3df7e151f876660a2883f --- /dev/null +++ b/libs/dbus-c++/examples/echo/echo-client.cpp @@ -0,0 +1,94 @@ +#include "echo-client.h" +#include <iostream> +#include <pthread.h> +#include <signal.h> + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +using namespace std; + +static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo"; +static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo"; + +EchoClient::EchoClient(DBus::Connection &connection, const char *path, const char *name) +: DBus::ObjectProxy(connection, path, name) +{ +} + +void EchoClient::Echoed(const DBus::Variant &value) +{ + cout << "!"; +} + +/* + * For some strange reason, libdbus frequently dies with an OOM + */ + +static const int THREADS = 3; + +static bool spin = true; + +void *greeter_thread(void *arg) +{ + DBus::Connection *conn = reinterpret_cast<DBus::Connection *>(arg); + + EchoClient client(*conn, ECHO_SERVER_PATH, ECHO_SERVER_NAME); + + char idstr[16]; + + snprintf(idstr, sizeof(idstr), "%lu", pthread_self()); + + for (int i = 0; i < 30 && spin; ++i) + { + cout << client.Hello(idstr) << endl; + } + + cout << idstr << " done " << endl; + + return NULL; +} + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + spin = false; + + dispatcher.leave(); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + +#ifdef DBUS_HAS_THREADS_INIT_DEFAULT + DBus::_init_threading(); +#else + cerr << "Thread support is not enabled! your D-Bus version is too old" << endl; +#endif + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SessionBus(); + + pthread_t threads[THREADS]; + + for (int i = 0; i < THREADS; ++i) + { + pthread_create(threads+i, NULL, greeter_thread, &conn); + } + + dispatcher.enter(); + + cout << "terminating" << endl; + + for (int i = 0; i < THREADS; ++i) + { + pthread_join(threads[i], NULL); + } + + return 0; +} diff --git a/libs/dbus-c++/examples/echo/echo-client.h b/libs/dbus-c++/examples/echo/echo-client.h new file mode 100644 index 0000000000000000000000000000000000000000..54401eca4152e03a5621e6b947a3062eb911d702 --- /dev/null +++ b/libs/dbus-c++/examples/echo/echo-client.h @@ -0,0 +1,19 @@ +#ifndef __DEMO_ECHO_CLIENT_H +#define __DEMO_ECHO_CLIENT_H + +#include <dbus-c++/dbus.h> +#include "echo-client-glue.h" + +class EchoClient +: public org::freedesktop::DBus::EchoDemo_proxy, + public DBus::IntrospectableProxy, + public DBus::ObjectProxy +{ +public: + + EchoClient(DBus::Connection &connection, const char *path, const char *name); + + void Echoed(const DBus::Variant &value); +}; + +#endif//__DEMO_ECHO_CLIENT_H diff --git a/libs/dbus-c++/examples/echo/echo-introspect.xml b/libs/dbus-c++/examples/echo/echo-introspect.xml new file mode 100644 index 0000000000000000000000000000000000000000..7d415abdd4c17c9bd653bb9d619fc9dff22f5264 --- /dev/null +++ b/libs/dbus-c++/examples/echo/echo-introspect.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" ?> +<node name="/org/freedesktop/DBus/Examples/Echo"> + <interface name="org.freedesktop.DBus.EchoDemo"> + <method name="Random"> + <arg type="i" name="version" direction="out"/> + </method> + <method name="Hello"> + <arg type="s" name="name" direction="in"/> + <arg type="s" name="greeting" direction="out"/> + </method> + <method name="Echo"> + <arg type="v" name="input" direction="in"/> + <arg type="v" name="output" direction="out"/> + </method> + <method name="Cat"> + <arg type="s" name="file" direction="in"/> + <arg type="ay" name="stream" direction="out"/> + </method> + <method name="Sum"> + <arg type="ai" name="ints" direction="in"/> + <arg type="i" names="sum" direction="out"/> + </method> + <signal name="Echoed"> + <arg type="v" name="value"/> + </signal> + <method name="Info"> + <arg type="a{ss}" name="info" direction="out"/> + </method> + </interface> +</node> diff --git a/libs/dbus-c++/examples/echo/echo-server.cpp b/libs/dbus-c++/examples/echo/echo-server.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d69333b56141167eaf2599b346edfe14c70648dc --- /dev/null +++ b/libs/dbus-c++/examples/echo/echo-server.cpp @@ -0,0 +1,92 @@ +#include "echo-server.h" +#include <unistd.h> +#include <stdlib.h> +#include <signal.h> +#include <stdio.h> +#include <limits.h> + +static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo"; +static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo"; + +EchoServer::EchoServer(DBus::Connection &connection) +: DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH) +{ +} + +int32_t EchoServer::Random() +{ + return rand(); +} + +std::string EchoServer::Hello(const std::string &name) +{ + return "Hello " + name + "!"; +} + +DBus::Variant EchoServer::Echo(const DBus::Variant &value) +{ + this->Echoed(value); + + return value; +} + +std::vector< uint8_t > EchoServer::Cat(const std::string &file) +{ + FILE *handle = fopen(file.c_str(), "rb"); + + if (!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found"); + + uint8_t buff[1024]; + + size_t nread = fread(buff, 1, sizeof(buff), handle); + + fclose(handle); + + return std::vector< uint8_t > (buff, buff + nread); +} + +int32_t EchoServer::Sum(const std::vector<int32_t>& ints) +{ + int32_t sum = 0; + + for (size_t i = 0; i < ints.size(); ++i) sum += ints[i]; + + return sum; +} + +std::map< std::string, std::string > EchoServer::Info() +{ + std::map< std::string, std::string > info; + char hostname[HOST_NAME_MAX]; + + gethostname(hostname, sizeof(hostname)); + info["hostname"] = hostname; + info["username"] = getlogin(); + + return info; +} + + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + dispatcher.leave(); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SessionBus(); + conn.request_name(ECHO_SERVER_NAME); + + EchoServer server(conn); + + dispatcher.enter(); + + return 0; +} diff --git a/libs/dbus-c++/examples/echo/echo-server.h b/libs/dbus-c++/examples/echo/echo-server.h new file mode 100644 index 0000000000000000000000000000000000000000..3f0be5811733e4439ff9a80fa762266b1a9df974 --- /dev/null +++ b/libs/dbus-c++/examples/echo/echo-server.h @@ -0,0 +1,29 @@ +#ifndef __DEMO_ECHO_SERVER_H +#define __DEMO_ECHO_SERVER_H + +#include <dbus-c++/dbus.h> +#include "echo-server-glue.h" + +class EchoServer +: public org::freedesktop::DBus::EchoDemo_adaptor, + public DBus::IntrospectableAdaptor, + public DBus::ObjectAdaptor +{ +public: + + EchoServer(DBus::Connection &connection); + + int32_t Random(); + + std::string Hello(const std::string &name); + + DBus::Variant Echo(const DBus::Variant &value); + + std::vector< uint8_t > Cat(const std::string &file); + + int32_t Sum(const std::vector<int32_t> & ints); + + std::map< std::string, std::string > Info(); +}; + +#endif//__DEMO_ECHO_SERVER_H diff --git a/libs/dbus-c++/examples/glib/Makefile.am b/libs/dbus-c++/examples/glib/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..42a33d8edb4959e50ea54e7edca045f79e5ca783 --- /dev/null +++ b/libs/dbus-c++/examples/glib/Makefile.am @@ -0,0 +1,22 @@ +EXTRA_DIST = + +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(gtkmm_CFLAGS) -I$(top_srcdir)/tools + +if HAVE_GTKMM +noinst_PROGRAMS = dbus-browser +endif + +dbus_browser_SOURCES = dbus-glue.h dbus-browser.h dbus-browser.cpp $(top_srcdir)/tools/xml.cpp +dbus_browser_LDADD = $(top_builddir)/src/libdbus-c++-1.la $(gtkmm_LIBS) + +dbus-glue.h: $(top_srcdir)/data/org.freedesktop.DBus.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@ + +BUILT_SOURCES = dbus-glue.h +CLEANFILES = $(BUILT_SOURCES) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/examples/glib/dbus-browser.cpp b/libs/dbus-c++/examples/glib/dbus-browser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..382d07f17a1dae20f200a445c18ae5e5b687278a --- /dev/null +++ b/libs/dbus-c++/examples/glib/dbus-browser.cpp @@ -0,0 +1,136 @@ +#include "dbus-browser.h" + +#include <xml.h> +#include <iostream> + +using namespace std; + +static const char *DBUS_SERVER_NAME = "org.freedesktop.DBus"; +static const char *DBUS_SERVER_PATH = "/org/freedesktop/DBus"; + +DBusBrowser::DBusBrowser(::DBus::Connection &conn) +: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME) +{ + set_title("D-Bus Browser"); + set_border_width(5); + set_default_size(400, 500); + + typedef std::vector< std::string > Names; + + Names names = ListNames(); + + for (Names::iterator it = names.begin(); it != names.end(); ++it) + { + _cb_busnames.append_text(*it); + } + + _cb_busnames.signal_changed().connect(sigc::mem_fun(*this, &DBusBrowser::on_select_busname)); + + _tm_inspect = Gtk::TreeStore::create(_records); + _tv_inspect.set_model(_tm_inspect); + _tv_inspect.append_column("Node", _records.name); + + _sc_tree.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _sc_tree.add(_tv_inspect); + + _vbox.pack_start(_cb_busnames, Gtk::PACK_SHRINK); + _vbox.pack_start(_sc_tree); + + add(_vbox); + + show_all_children(); +} + +void DBusBrowser::NameOwnerChanged( + const std::string &name, const std::string &old_owner, const std::string &new_owner) +{ + cout << name << ": " << old_owner << " -> " << new_owner << endl; +} + +void DBusBrowser::NameLost(const std::string &name) +{ + cout << name << " lost" << endl; +} + +void DBusBrowser::NameAcquired(const std::string &name) +{ + cout << name << " acquired" << endl; +} + +void DBusBrowser::on_select_busname() +{ + Glib::ustring busname = _cb_busnames.get_active_text(); + if (busname.empty()) return; + + _tm_inspect->clear(); + _inspect_append(NULL, "", busname); +} + +void DBusBrowser::_inspect_append(Gtk::TreeModel::Row *row, const std::string &buspath, const std::string &busname) +{ + DBusInspector inspector(conn(), buspath.empty() ? "/" : buspath.c_str(), busname.c_str()); + + ::DBus::Xml::Document doc(inspector.Introspect()); + ::DBus::Xml::Node &root = *(doc.root); + + ::DBus::Xml::Nodes ifaces = root["interface"]; + + for (::DBus::Xml::Nodes::iterator ii = ifaces.begin(); ii != ifaces.end(); ++ii) + { + ::DBus::Xml::Node &iface = **ii; + + Gtk::TreeModel::Row i_row = row + ? *(_tm_inspect->append(row->children())) + : *(_tm_inspect->append()); + i_row[_records.name] = "interface: " + iface.get("name"); + + ::DBus::Xml::Nodes methods = iface["method"]; + + for (::DBus::Xml::Nodes::iterator im = methods.begin(); im != methods.end(); ++im) + { + Gtk::TreeModel::Row m_row = *(_tm_inspect->append(i_row.children())); + m_row[_records.name] = "method: " + (*im)->get("name"); + } + + ::DBus::Xml::Nodes signals = iface["signal"]; + + for (::DBus::Xml::Nodes::iterator is = signals.begin(); is != signals.end(); ++is) + { + Gtk::TreeModel::Row s_row = *(_tm_inspect->append(i_row.children())); + s_row[_records.name] = "signal: " + (*is)->get("name"); + } + } + + ::DBus::Xml::Nodes nodes = root["node"]; + + for (::DBus::Xml::Nodes::iterator in = nodes.begin(); in != nodes.end(); ++in) + { + std::string name = (*in)->get("name"); + + Gtk::TreeModel::Row n_row = row + ? *(_tm_inspect->append(row->children())) + : *(_tm_inspect->append()); + n_row[_records.name] = name; + + _inspect_append(&n_row, buspath + "/" + name, busname); + } +} + +DBus::Glib::BusDispatcher dispatcher; + +int main(int argc, char *argv[]) +{ + Gtk::Main kit(argc, argv); + + DBus::default_dispatcher = &dispatcher; + + dispatcher.attach(NULL); + + DBus::Connection conn = DBus::Connection::SessionBus(); + + DBusBrowser browser(conn); + + Gtk::Main::run(browser); + + return 0; +} diff --git a/libs/dbus-c++/examples/glib/dbus-browser.h b/libs/dbus-c++/examples/glib/dbus-browser.h new file mode 100644 index 0000000000000000000000000000000000000000..9bbefbf084d9188376439b36e4294653f7787660 --- /dev/null +++ b/libs/dbus-c++/examples/glib/dbus-browser.h @@ -0,0 +1,62 @@ +#ifndef __DEMO_DBUS_BROWSER_H +#define __DEMO_DBUS_BROWSER_H + +#include <dbus-c++/dbus.h> +#include <dbus-c++/glib-integration.h> +#include <gtkmm.h> + +#include "dbus-glue.h" + +class DBusInspector +: public DBus::IntrospectableProxy, + public DBus::ObjectProxy +{ +public: + + DBusInspector(DBus::Connection &conn, const char *path, const char *service) + : DBus::ObjectProxy(conn, path, service) + {} +}; + +class DBusBrowser +: public org::freedesktop::DBus_proxy, + public DBus::IntrospectableProxy, + public DBus::ObjectProxy, + public Gtk::Window +{ +public: + + DBusBrowser(::DBus::Connection &); + +private: + + void NameOwnerChanged(const std::string &, const std::string &, const std::string &); + + void NameLost(const std::string &); + + void NameAcquired(const std::string &); + + void on_select_busname(); + + void _inspect_append(Gtk::TreeModel::Row *, const std::string &, const std::string &); + +private: + + class InspectRecord : public Gtk::TreeModel::ColumnRecord + { + public: + + InspectRecord() { add(name); } + + Gtk::TreeModelColumn<Glib::ustring> name; + }; + + Gtk::VBox _vbox; + Gtk::ScrolledWindow _sc_tree; + Gtk::ComboBoxText _cb_busnames; + Gtk::TreeView _tv_inspect; + Glib::RefPtr<Gtk::TreeStore> _tm_inspect; + InspectRecord _records; +}; + +#endif//__DEMO_DBUS_BROWSER_H diff --git a/libs/dbus-c++/examples/hal/Makefile.am b/libs/dbus-c++/examples/hal/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..22868c80fa8c8bb5e5579ce4089c09b8044e401a --- /dev/null +++ b/libs/dbus-c++/examples/hal/Makefile.am @@ -0,0 +1,9 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include + +noinst_PROGRAMS = hal-listen + +hal_listen_SOURCES = hal-listen.h hal-listen.cpp +hal_listen_LDADD = $(top_builddir)/src/libdbus-c++-1.la + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/examples/hal/hal-listen.cpp b/libs/dbus-c++/examples/hal/hal-listen.cpp new file mode 100644 index 0000000000000000000000000000000000000000..11e18de300343891da03a76ee71348cc5c29ef5a --- /dev/null +++ b/libs/dbus-c++/examples/hal/hal-listen.cpp @@ -0,0 +1,125 @@ +#include "hal-listen.h" + +#include <signal.h> +#include <iostream> + +HalManagerProxy::HalManagerProxy(DBus::Connection &connection) +: DBus::InterfaceProxy("org.freedesktop.Hal.Manager"), + DBus::ObjectProxy(connection, "/org/freedesktop/Hal/Manager", "org.freedesktop.Hal") +{ + connect_signal(HalManagerProxy, DeviceAdded, DeviceAddedCb); + connect_signal(HalManagerProxy, DeviceRemoved, DeviceRemovedCb); + + std::vector< std::string > devices = GetAllDevices(); + + std::vector< std::string >::iterator it; + for (it = devices.begin(); it != devices.end(); ++it) + { + DBus::Path udi = *it; + + std::cout << "found device " << udi << std::endl; + + _devices[udi] = new HalDeviceProxy(connection, udi); + } +} + +std::vector< std::string > HalManagerProxy::GetAllDevices() +{ + std::vector< std::string > udis; + DBus::CallMessage call; + + call.member("GetAllDevices"); + + DBus::Message reply = invoke_method(call); + DBus::MessageIter it = reply.reader(); + + it >> udis; + return udis; +} + +void HalManagerProxy::DeviceAddedCb(const DBus::SignalMessage &sig) +{ + DBus::MessageIter it = sig.reader(); + std::string devname; + + it >> devname; + + DBus::Path udi(devname); + + _devices[devname] = new HalDeviceProxy(conn(), udi); + std::cout << "added device " << udi << std::endl; +} + +void HalManagerProxy::DeviceRemovedCb(const DBus::SignalMessage &sig) +{ + DBus::MessageIter it = sig.reader(); + std::string devname; + + it >> devname; + + std::cout << "removed device " << devname << std::endl; + + _devices.erase(devname); +} + +HalDeviceProxy::HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi) +: DBus::InterfaceProxy("org.freedesktop.Hal.Device"), + DBus::ObjectProxy(connection, udi, "org.freedesktop.Hal") +{ + connect_signal(HalDeviceProxy, PropertyModified, PropertyModifiedCb); + connect_signal(HalDeviceProxy, Condition, ConditionCb); +} + +void HalDeviceProxy::PropertyModifiedCb(const DBus::SignalMessage &sig) +{ + typedef DBus::Struct< std::string, bool, bool > HalProperty; + + DBus::MessageIter it = sig.reader(); + int32_t number; + + it >> number; + + DBus::MessageIter arr = it.recurse(); + + for (int i = 0; i < number; ++i, ++arr) + { + HalProperty hp; + + arr >> hp; + + std::cout << "modified property " << hp._1 << " in " << path() << std::endl; + } +} + +void HalDeviceProxy::ConditionCb(const DBus::SignalMessage &sig) +{ + DBus::MessageIter it = sig.reader(); + std::string condition; + + it >> condition; + + std::cout << "encountered condition " << condition << " in " << path() << std::endl; +} + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + dispatcher.leave(); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SystemBus(); + + HalManagerProxy hal(conn); + + dispatcher.enter(); + + return 0; +} diff --git a/libs/dbus-c++/examples/hal/hal-listen.h b/libs/dbus-c++/examples/hal/hal-listen.h new file mode 100644 index 0000000000000000000000000000000000000000..12862e617e9e97679bbd403cba6f68122004e6c0 --- /dev/null +++ b/libs/dbus-c++/examples/hal/hal-listen.h @@ -0,0 +1,44 @@ +#ifndef __DEMO_HAL_LISTEN_H +#define __DEMO_HAL_LISTEN_H + +#include <dbus-c++/dbus.h> +#include <vector> +#include <map> + +class HalDeviceProxy; + +class HalManagerProxy +: public DBus::InterfaceProxy, + public DBus::ObjectProxy +{ +public: + + HalManagerProxy(DBus::Connection &connection); + + std::vector< std::string > GetAllDevices(); + +private: + + void DeviceAddedCb(const DBus::SignalMessage &sig); + + void DeviceRemovedCb(const DBus::SignalMessage &sig); + + std::map< std::string, DBus::RefPtr< HalDeviceProxy > > _devices; +}; + +class HalDeviceProxy +: public DBus::InterfaceProxy, + public DBus::ObjectProxy +{ +public: + + HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi); + +private: + + void PropertyModifiedCb(const DBus::SignalMessage &sig); + + void ConditionCb(const DBus::SignalMessage &sig); +}; + +#endif//__DEMO_HAL_LISTEN_H diff --git a/libs/dbus-c++/examples/properties/Makefile.am b/libs/dbus-c++/examples/properties/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..a99749a19f191c29b6d6b350e32449b871b5135b --- /dev/null +++ b/libs/dbus-c++/examples/properties/Makefile.am @@ -0,0 +1,26 @@ +EXTRA_DIST = propsgs-introspect.xml + +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include + +noinst_PROGRAMS = propsgs-server propsgs-client + +propsgs_server_SOURCES = propsgs-glue-adaptor.h propsgs-server.h propsgs-server.cpp +propsgs_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la + +propsgs_client_SOURCES = propsgs-glue-proxy.h propsgs-client.h propsgs-client.cpp +propsgs_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la -lpthread + +propsgs-glue-adaptor.h: propsgs-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@ -- + +propsgs-glue-proxy.h: propsgs-introspect.xml + $(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@ -- + +BUILT_SOURCES = propsgs-glue-adaptor.h propsgs-glue-proxy.h +CLEANFILES = $(BUILT_SOURCES) + +dist-hook: + cd $(distdir); rm -f $(BUILT_SOURCES) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/examples/properties/propsgs-client.cpp b/libs/dbus-c++/examples/properties/propsgs-client.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d4b51f4bd258afdacd966b613456ad4e8b572599 --- /dev/null +++ b/libs/dbus-c++/examples/properties/propsgs-client.cpp @@ -0,0 +1,72 @@ +#include "propsgs-client.h" +#include <iostream> +#include <signal.h> +#include <pthread.h> + +using namespace org::freedesktop::DBus; + +static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties"; +static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties"; + +PropsClient::PropsClient(DBus::Connection &connection, const char *path, const char *name) +: DBus::ObjectProxy(connection, path, name) +{ +} + +void PropsClient::MessageChanged(const std::string& message) +{ + std::cout << "MessageChanged signal, new value: " << message << "\n"; +}; + +void PropsClient::DataChanged(const double& data) +{ + std::cout << "DataChanged signal, new value:" << data << "\n"; +}; + +void *test_property_proxy(void * input) +{ + PropsClient *client = static_cast<PropsClient*>(input); + + std::cout << "read property 'Version', value:" << client->Version() << "\n"; + + std::cout << "read property 'Message', value:" << client->Message() << "\n"; + + client->Message("message set by property access"); + std::cout << "wrote property 'Message'\n"; + + std::cout << "read property 'Message', value:" << client->Message() << "\n"; + + client->Data(1.1); + std::cout << "wrote property 'Data'\n"; + + return NULL; +} + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + dispatcher.leave(); + pthread_exit(NULL); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::_init_threading(); + + DBus::Connection conn = DBus::Connection::SessionBus(); + + PropsClient client (conn, PROPS_SERVER_PATH, PROPS_SERVER_NAME); + + pthread_t thread; + pthread_create(&thread, NULL, test_property_proxy, &client); + + dispatcher.enter(); + + return 0; +} diff --git a/libs/dbus-c++/examples/properties/propsgs-client.h b/libs/dbus-c++/examples/properties/propsgs-client.h new file mode 100644 index 0000000000000000000000000000000000000000..99b70c500c4f9098c691ba6e11ef58a74349decc --- /dev/null +++ b/libs/dbus-c++/examples/properties/propsgs-client.h @@ -0,0 +1,22 @@ +#ifndef __DEMO_PROPS_SERVER_H +#define __DEMO_PROPS_SERVER_H + +#include <dbus-c++/dbus.h> +#include "propsgs-glue-proxy.h" + +class PropsClient +: public org::freedesktop::DBus::PropsGSDemo_proxy, + public DBus::IntrospectableProxy, + public DBus::PropertiesProxy, + public DBus::ObjectProxy +{ +public: + + PropsClient(DBus::Connection &connection, const char *path, const char *name); + + void MessageChanged(const std::string& message); + + void DataChanged(const double& data); +}; + +#endif//__DEMO_PROPS_SERVER_H diff --git a/libs/dbus-c++/examples/properties/propsgs-introspect.xml b/libs/dbus-c++/examples/properties/propsgs-introspect.xml new file mode 100644 index 0000000000000000000000000000000000000000..10459308fc3b0e5118e09dcefe6d6241eadc4b46 --- /dev/null +++ b/libs/dbus-c++/examples/properties/propsgs-introspect.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<node name="/org/freedesktop/DBus/Examples/Properties"> + <interface name="org.freedesktop.DBus.PropsGSDemo"> + <property name="Version" type="i" access="read"/> + <property name="Message" type="s" access="readwrite"/> + <property name="Data" type="d" access="write"/> + <signal name="MessageChanged"> + <arg name="message" type="s"/> + </signal> + <signal name="DataChanged"> + <arg name="Data" type="d"/> + </signal> + </interface> +</node> diff --git a/libs/dbus-c++/examples/properties/propsgs-server.cpp b/libs/dbus-c++/examples/properties/propsgs-server.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3ff23f645bc6d986f05ed0d894b3de998596d7f --- /dev/null +++ b/libs/dbus-c++/examples/properties/propsgs-server.cpp @@ -0,0 +1,56 @@ +#include "propsgs-server.h" +#include <iostream> +#include <signal.h> + +static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties"; +static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties"; + +PropsServer::PropsServer(DBus::Connection &connection) +: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH) +{ + Version = 1; + Message = "default message"; +} + +void PropsServer::on_set_property + (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value) +{ + if (property == "Message") + { + std::cout << "'Message' has been changed\n"; + + std::string msg = value; + this->MessageChanged(msg); + } + if (property == "Data") + { + std::cout << "'Data' has been changed\n"; + + double data = value; + this->DataChanged(data); + } +} + +DBus::BusDispatcher dispatcher; + +void niam(int sig) +{ + dispatcher.leave(); +} + +int main() +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + + DBus::default_dispatcher = &dispatcher; + + DBus::Connection conn = DBus::Connection::SessionBus(); + conn.request_name(PROPS_SERVER_NAME); + + PropsServer server(conn); + + dispatcher.enter(); + + return 0; +} diff --git a/libs/dbus-c++/examples/properties/propsgs-server.h b/libs/dbus-c++/examples/properties/propsgs-server.h new file mode 100644 index 0000000000000000000000000000000000000000..a3169d629f9c857bd4a307c3a54e34b3886a8ae6 --- /dev/null +++ b/libs/dbus-c++/examples/properties/propsgs-server.h @@ -0,0 +1,21 @@ +#ifndef __DEMO_PROPS_SERVER_H +#define __DEMO_PROPS_SERVER_H + +#include <dbus-c++/dbus.h> +#include "propsgs-glue-adaptor.h" + +class PropsServer +: public org::freedesktop::DBus::PropsGSDemo_adaptor, + public DBus::IntrospectableAdaptor, + public DBus::PropertiesAdaptor, + public DBus::ObjectAdaptor +{ +public: + + PropsServer(DBus::Connection &connection); + + void on_set_property + (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value); +}; + +#endif//__DEMO_PROPS_SERVER_H diff --git a/libs/dbus-c++/include/dbus-c++/api.h b/libs/dbus-c++/include/dbus-c++/api.h new file mode 100644 index 0000000000000000000000000000000000000000..9afe229bd6f65a2ae695b5a056424a971b2a3a79 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/api.h @@ -0,0 +1,42 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_API_H +#define __DBUSXX_API_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#ifdef GCC_HASCLASSVISIBILITY +# define DXXAPILOCAL __attribute__ ((visibility("hidden"))) +# define DXXAPIPUBLIC __attribute__ ((visibility("default"))) +#else +# define DXXAPILOCAL +# define DXXAPIPUBLIC +#endif + +#define DXXAPI DXXAPIPUBLIC + +#endif//__DBUSXX_API_H diff --git a/libs/dbus-c++/include/dbus-c++/config.h.in b/libs/dbus-c++/include/dbus-c++/config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..1a0f11c74ce7a993a40a76c25ed1dd11e981f6c6 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/config.h.in @@ -0,0 +1,77 @@ +/* include/dbus-c++/config.h.in. Generated from configure.ac by autoheader. */ + +/* unstable DBus */ +#undef DBUS_API_SUBJECT_TO_CHANGE + +/* DBus supports recursive mutexes (needs DBus >= 0.95) */ +#undef DBUS_HAS_RECURSIVE_MUTEX + +/* dbus_threads_init_default (needs DBus >= 0.93) */ +#undef DBUS_HAS_THREADS_INIT_DEFAULT + +/* to enable hidden symbols */ +#undef GCC_HASCLASSVISIBILITY + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <expat.h> header file. */ +#undef HAVE_EXPAT_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <pthread.h> header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/libs/dbus-c++/include/dbus-c++/connection.h b/libs/dbus-c++/include/dbus-c++/connection.h new file mode 100644 index 0000000000000000000000000000000000000000..c2bc4ede396b67b65b6e7393781ba837ff20d691 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/connection.h @@ -0,0 +1,126 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_CONNECTION_H +#define __DBUSXX_CONNECTION_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <list> + +#include "api.h" +#include "types.h" +#include "util.h" +#include "message.h" +#include "pendingcall.h" + +namespace DBus { + +class Connection; + +typedef Slot<bool, const Message &> MessageSlot; + +typedef std::list<Connection> ConnectionList; + +class ObjectAdaptor; +class Dispatcher; + +class DXXAPI Connection +{ +public: + + static Connection SystemBus(); + + static Connection SessionBus(); + + static Connection ActivationBus(); + + struct Private; + + typedef std::list<Private *> PrivatePList; + + Connection(Private *); + + Connection(const char *address, bool priv = true); + + Connection(const Connection &c); + + virtual ~Connection(); + + Dispatcher *setup(Dispatcher *); + + bool operator == (const Connection &) const; + + void add_match(const char *rule); + + void remove_match(const char *rule); + + bool add_filter(MessageSlot &); + + void remove_filter(MessageSlot &); + + bool unique_name(const char *n); + + const char *unique_name() const; + + bool register_bus(); + + bool connected() const; + + void disconnect(); + + void exit_on_disconnect(bool exit); + + void flush(); + + bool send(const Message &, unsigned int *serial = NULL); + + Message send_blocking(Message &msg, int timeout = -1); + + PendingCall send_async(Message &msg, int timeout); + + void request_name(const char *name, int flags = 0); + + bool has_name(const char *name); + + bool start_service(const char *name, unsigned long flags); + + const std::vector<std::string>& names(); + +private: + + DXXAPILOCAL void init(); + +private: + + RefPtrI<Private> _pvt; + +friend class ObjectAdaptor; // needed in order to register object paths for a connection +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_CONNECTION_H diff --git a/libs/dbus-c++/include/dbus-c++/dbus.h b/libs/dbus-c++/include/dbus-c++/dbus.h new file mode 100644 index 0000000000000000000000000000000000000000..0e05e6a57fa109ec2eccdb741131a48f29d2d1cd --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/dbus.h @@ -0,0 +1,49 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_DBUS_H +#define __DBUSXX_DBUS_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "types.h" +#include "interface.h" +#include "object.h" +#include "property.h" +#include "connection.h" +#include "server.h" +#include "error.h" +#include "message.h" +#include "debug.h" +#include "pendingcall.h" +#include "server.h" +#include "util.h" +#include "dispatcher.h" +#include "eventloop.h" +#include "eventloop-integration.h" +#include "introspection.h" + +#endif//__DBUSXX_DBUS_H diff --git a/libs/dbus-c++/include/dbus-c++/debug.h b/libs/dbus-c++/include/dbus-c++/debug.h new file mode 100644 index 0000000000000000000000000000000000000000..6b871f612869e4084fa68406ea07f5f9bbd338e0 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/debug.h @@ -0,0 +1,42 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_DEBUG_H +#define __DBUSXX_DEBUG_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" + +namespace DBus { + +typedef void (*LogFunction)(const char *format, ...); + +extern DXXAPI LogFunction debug_log; + +} /* namespace DBus */ + +#endif diff --git a/libs/dbus-c++/include/dbus-c++/dispatcher.h b/libs/dbus-c++/include/dbus-c++/dispatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..c6f4d125de3381dad3852cad405d1d1171d89024 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/dispatcher.h @@ -0,0 +1,260 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_DISPATCHER_H +#define __DBUSXX_DISPATCHER_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "connection.h" +#include "eventloop.h" + +namespace DBus { + +class DXXAPI Timeout +{ +public: + + class Internal; + + Timeout(Internal *i); + + virtual ~Timeout(){} + + int interval() const; + + bool enabled() const; + + bool handle(); + + virtual void toggle() = 0; + +private: + + DXXAPILOCAL Timeout(const Timeout &); + +private: + + Internal *_int; +}; + +class DXXAPI Watch +{ +public: + + class Internal; + + Watch(Internal *i); + + virtual ~Watch(){} + + int descriptor() const; + + int flags() const; + + bool enabled() const; + + bool handle(int flags); + + virtual void toggle() = 0; + +private: + + DXXAPILOCAL Watch(const Watch &); + +private: + + Internal *_int; +}; + +class DXXAPI Dispatcher +{ +public: + + virtual ~Dispatcher() + {} + + void queue_connection(Connection::Private *); + + void dispatch_pending(); + + virtual void enter() = 0; + + virtual void leave() = 0; + + virtual Timeout *add_timeout(Timeout::Internal *) = 0; + + virtual void rem_timeout(Timeout *) = 0; + + virtual Watch *add_watch(Watch::Internal *) = 0; + + virtual void rem_watch(Watch *) = 0; + + struct Private; + +private: + + DefaultMutex _mutex_p; + Connection::PrivatePList _pending_queue; +}; + +extern DXXAPI Dispatcher *default_dispatcher; + +/* classes for multithreading support +*/ + +class DXXAPI Mutex +{ +public: + + virtual ~Mutex() {} + + virtual void lock() = 0; + + virtual void unlock() = 0; + + struct Internal; + +protected: + + Internal *_int; +}; + +class DXXAPI CondVar +{ +public: + + virtual ~CondVar() {} + + virtual void wait(Mutex *) = 0; + + virtual bool wait_timeout(Mutex *, int timeout) = 0; + + virtual void wake_one() = 0; + + virtual void wake_all() = 0; + + struct Internal; + +protected: + + Internal *_int; +}; + +#ifndef DBUS_HAS_RECURSIVE_MUTEX +typedef Mutex *(*MutexNewFn)(); +typedef bool (*MutexFreeFn)(Mutex *mx); +typedef bool (*MutexLockFn)(Mutex *mx); +typedef void (*MutexUnlockFn)(Mutex *mx); +#else +typedef Mutex *(*MutexNewFn)(); +typedef void (*MutexFreeFn)(Mutex *mx); +typedef void (*MutexLockFn)(Mutex *mx); +typedef void (*MutexUnlockFn)(Mutex *mx); +#endif//DBUS_HAS_RECURSIVE_MUTEX + +typedef CondVar *(*CondVarNewFn)(); +typedef void (*CondVarFreeFn)(CondVar *cv); +typedef void (*CondVarWaitFn)(CondVar *cv, Mutex *mx); +typedef bool (*CondVarWaitTimeoutFn)(CondVar *cv, Mutex *mx, int timeout); +typedef void (*CondVarWakeOneFn)(CondVar *cv); +typedef void (*CondVarWakeAllFn)(CondVar *cv); + +#ifdef DBUS_HAS_THREADS_INIT_DEFAULT +void DXXAPI _init_threading(); +#endif//DBUS_HAS_THREADS_INIT_DEFAULT + +void DXXAPI _init_threading( + MutexNewFn, MutexFreeFn, MutexLockFn, MutexUnlockFn, + CondVarNewFn, CondVarFreeFn, CondVarWaitFn, CondVarWaitTimeoutFn, CondVarWakeOneFn, CondVarWakeAllFn +); + +template<class Mx, class Cv> +struct Threading +{ + static void init() + { + _init_threading( + mutex_new, mutex_free, mutex_lock, mutex_unlock, + condvar_new, condvar_free, condvar_wait, condvar_wait_timeout, condvar_wake_one, condvar_wake_all + ); + } + + static Mutex *mutex_new() + { + return new Mx; + } + + static void mutex_free(Mutex *mx) + { + delete mx; + } + + static void mutex_lock(Mutex *mx) + { + mx->lock(); + } + + static void mutex_unlock(Mutex *mx) + { + mx->unlock(); + } + + static CondVar *condvar_new() + { + return new Cv; + } + + static void condvar_free(CondVar *cv) + { + delete cv; + } + + static void condvar_wait(CondVar *cv, Mutex *mx) + { + cv->wait(mx); + } + + static bool condvar_wait_timeout(CondVar *cv, Mutex *mx, int timeout) + { + return cv->wait_timeout(mx, timeout); + } + + static void condvar_wake_one(CondVar *cv) + { + cv->wake_one(); + } + + static void condvar_wake_all(CondVar *cv) + { + cv->wake_all(); + } +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_DISPATCHER_H diff --git a/libs/dbus-c++/include/dbus-c++/error.h b/libs/dbus-c++/include/dbus-c++/error.h new file mode 100644 index 0000000000000000000000000000000000000000..9339e5ef06be08724a4d205f6290e7de933a5ea0 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/error.h @@ -0,0 +1,289 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_ERROR_H +#define __DBUSXX_ERROR_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "util.h" + +#include <exception> + +namespace DBus { + +class Message; +class InternalError; + +class DXXAPI Error : public std::exception +{ +public: + + Error(); + + Error(InternalError &); + + Error(const char *name, const char *message); + + Error(Message &); + + ~Error() throw(); + + const char *what() const throw(); + + const char *name() const; + + const char *message() const; + + void set(const char *name, const char *message); + // parameters MUST be static strings + + bool is_set() const; + + operator bool() const + { + return is_set(); + } + +private: + + RefPtrI<InternalError> _int; +}; + +struct DXXAPI ErrorFailed : public Error +{ + ErrorFailed(const char *message) + : Error("org.freedesktop.DBus.Error.Failed", message) + {} +}; + +struct DXXAPI ErrorNoMemory : public Error +{ + ErrorNoMemory(const char *message) + : Error("org.freedesktop.DBus.Error.NoMemory", message) + {} +}; + +struct DXXAPI ErrorServiceUnknown : public Error +{ + ErrorServiceUnknown(const char *message) + : Error("org.freedesktop.DBus.Error.ServiceUnknown", message) + {} +}; + +struct DXXAPI ErrorNameHasNoOwner : public Error +{ + ErrorNameHasNoOwner(const char *message) + : Error("org.freedesktop.DBus.Error.NameHasNoOwner", message) + {} +}; + +struct DXXAPI ErrorNoReply : public Error +{ + ErrorNoReply(const char *message) + : Error("org.freedesktop.DBus.Error.NoReply", message) + {} +}; + +struct DXXAPI ErrorIOError : public Error +{ + ErrorIOError(const char *message) + : Error("org.freedesktop.DBus.Error.IOError", message) + {} +}; + +struct DXXAPI ErrorBadAddress : public Error +{ + ErrorBadAddress(const char *message) + : Error("org.freedesktop.DBus.Error.BadAddress", message) + {} +}; + +struct DXXAPI ErrorNotSupported : public Error +{ + ErrorNotSupported(const char *message) + : Error("org.freedesktop.DBus.Error.NotSupported", message) + {} +}; + +struct DXXAPI ErrorLimitsExceeded : public Error +{ + ErrorLimitsExceeded(const char *message) + : Error("org.freedesktop.DBus.Error.LimitsExceeded", message) + {} +}; + +struct DXXAPI ErrorAccessDenied : public Error +{ + ErrorAccessDenied(const char *message) + : Error("org.freedesktop.DBus.Error.AccessDenied", message) + {} +}; + +struct DXXAPI ErrorAuthFailed : public Error +{ + ErrorAuthFailed(const char *message) + : Error("org.freedesktop.DBus.Error.AuthFailed", message) + {} +}; + +struct DXXAPI ErrorNoServer : public Error +{ + ErrorNoServer(const char *message) + : Error("org.freedesktop.DBus.Error.NoServer", message) + {} +}; + +struct DXXAPI ErrorTimeout : public Error +{ + ErrorTimeout(const char *message) + : Error("org.freedesktop.DBus.Error.Timeout", message) + {} +}; + +struct DXXAPI ErrorNoNetwork : public Error +{ + ErrorNoNetwork(const char *message) + : Error("org.freedesktop.DBus.Error.NoNetwork", message) + {} +}; + +struct DXXAPI ErrorAddressInUse : public Error +{ + ErrorAddressInUse(const char *message) + : Error("org.freedesktop.DBus.Error.AddressInUse", message) + {} +}; + +struct DXXAPI ErrorDisconnected : public Error +{ + ErrorDisconnected(const char *message) + : Error("org.freedesktop.DBus.Error.Disconnected", message) + {} +}; + +struct DXXAPI ErrorInvalidArgs : public Error +{ + ErrorInvalidArgs(const char *message) + : Error("org.freedesktop.DBus.Error.InvalidArgs", message) + {} +}; + +struct DXXAPI ErrorFileNotFound : public Error +{ + ErrorFileNotFound(const char *message) + : Error("org.freedesktop.DBus.Error.FileNotFound", message) + {} +}; + +struct DXXAPI ErrorUnknownMethod : public Error +{ + ErrorUnknownMethod(const char *message) + : Error("org.freedesktop.DBus.Error.UnknownMethod", message) + {} +}; + +struct DXXAPI ErrorTimedOut : public Error +{ + ErrorTimedOut(const char *message) + : Error("org.freedesktop.DBus.Error.TimedOut", message) + {} +}; + +struct DXXAPI ErrorMatchRuleNotFound : public Error +{ + ErrorMatchRuleNotFound(const char *message) + : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message) + {} +}; + +struct DXXAPI ErrorMatchRuleInvalid : public Error +{ + ErrorMatchRuleInvalid(const char *message) + : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message) + {} +}; + +struct DXXAPI ErrorSpawnExecFailed : public Error +{ + ErrorSpawnExecFailed(const char *message) + : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message) + {} +}; + +struct DXXAPI ErrorSpawnForkFailed : public Error +{ + ErrorSpawnForkFailed(const char *message) + : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message) + {} +}; + +struct DXXAPI ErrorSpawnChildExited : public Error +{ + ErrorSpawnChildExited(const char *message) + : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message) + {} +}; + +struct DXXAPI ErrorSpawnChildSignaled : public Error +{ + ErrorSpawnChildSignaled(const char *message) + : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message) + {} +}; + +struct DXXAPI ErrorSpawnFailed : public Error +{ + ErrorSpawnFailed(const char *message) + : Error("org.freedesktop.DBus.Error.Spawn.Failed", message) + {} +}; + +struct DXXAPI ErrorInvalidSignature : public Error +{ + ErrorInvalidSignature(const char *message) + : Error("org.freedesktop.DBus.Error.InvalidSignature", message) + {} +}; + +struct DXXAPI ErrorUnixProcessIdUnknown : public Error +{ + ErrorUnixProcessIdUnknown(const char *message) + : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message) + {} +}; + +struct DXXAPI ErrorSELinuxSecurityContextUnknown : public Error +{ + ErrorSELinuxSecurityContextUnknown(const char *message) + : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message) + {} +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_ERROR_H diff --git a/libs/dbus-c++/include/dbus-c++/eventloop-integration.h b/libs/dbus-c++/include/dbus-c++/eventloop-integration.h new file mode 100644 index 0000000000000000000000000000000000000000..4a5289e59a376070ba0d7492d8f1170b9d1b0f29 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/eventloop-integration.h @@ -0,0 +1,98 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H +#define __DBUSXX_EVENTLOOP_INTEGRATION_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "dispatcher.h" +#include "util.h" +#include "eventloop.h" + +namespace DBus { + +/* + * Glue between the event loop and the DBus library + */ + +class BusDispatcher; + +class DXXAPI BusTimeout : public Timeout, public DefaultTimeout +{ + BusTimeout(Timeout::Internal *, BusDispatcher *); + + void toggle(); + +friend class BusDispatcher; +}; + +class DXXAPI BusWatch : public Watch, public DefaultWatch +{ + BusWatch(Watch::Internal *, BusDispatcher *); + + void toggle(); + +friend class BusDispatcher; +}; + +class DXXAPI BusDispatcher : public Dispatcher, public DefaultMainLoop +{ +public: + + BusDispatcher() : _running(false) + {} + + ~BusDispatcher() + {} + + virtual void enter(); + + virtual void leave(); + + virtual void do_iteration(); + + virtual Timeout *add_timeout(Timeout::Internal *); + + virtual void rem_timeout(Timeout *); + + virtual Watch *add_watch(Watch::Internal *); + + virtual void rem_watch(Watch *); + + void watch_ready(DefaultWatch &); + + void timeout_expired(DefaultTimeout &); + +private: + + bool _running; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_EVENTLOOP_INTEGRATION_H diff --git a/libs/dbus-c++/include/dbus-c++/eventloop.h b/libs/dbus-c++/include/dbus-c++/eventloop.h new file mode 100644 index 0000000000000000000000000000000000000000..42d66b16c8e8b9f704beaa0e30d9e350f8b284ab --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/eventloop.h @@ -0,0 +1,170 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_EVENTLOOP_H +#define __DBUSXX_EVENTLOOP_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <pthread.h> +#include <list> + +#include "api.h" +#include "util.h" + +namespace DBus { + +/* + * these Default *classes implement a very simple event loop which + * is used here as the default main loop, if you want to hook + * a different one use the Bus *classes in eventloop-integration.h + * or the Glib::Bus *classes as a reference + */ + +class DefaultMainLoop; + +class DXXAPI DefaultTimeout +{ +public: + + DefaultTimeout(int interval, bool repeat, DefaultMainLoop *); + + virtual ~DefaultTimeout(); + + bool enabled(){ return _enabled; } + void enabled(bool e){ _enabled = e; } + + int interval(){ return _interval; } + void interval(int i){ _interval = i; } + + bool repeat(){ return _repeat; } + void repeat(bool r){ _repeat = r; } + + void *data(){ return _data; } + void data(void *d){ _data = d; } + + Slot<void, DefaultTimeout &> expired; + +private: + + bool _enabled; + + int _interval; + bool _repeat; + + double _expiration; + + void *_data; + + DefaultMainLoop *_disp; + +friend class DefaultMainLoop; +}; + +typedef std::list< DefaultTimeout *> DefaultTimeouts; + +class DXXAPI DefaultWatch +{ +public: + + DefaultWatch(int fd, int flags, DefaultMainLoop *); + + virtual ~DefaultWatch(); + + bool enabled(){ return _enabled; } + void enabled(bool e){ _enabled = e; } + + int descriptor(){ return _fd; } + + int flags(){ return _flags; } + void flags(int f){ _flags = f; } + + int state(){ return _state; } + + void *data(){ return _data; } + void data(void *d){ _data = d; } + + Slot<void, DefaultWatch &> ready; + +private: + + bool _enabled; + + int _fd; + int _flags; + int _state; + + void *_data; + + DefaultMainLoop *_disp; + +friend class DefaultMainLoop; +}; + +typedef std::list< DefaultWatch *> DefaultWatches; + +class DXXAPI DefaultMutex +{ +public: + + DefaultMutex(); + + ~DefaultMutex(); + + void lock(); + + void unlock(); + +private: + + pthread_mutex_t _mutex; +}; + +class DXXAPI DefaultMainLoop +{ +public: + + DefaultMainLoop(); + + virtual ~DefaultMainLoop(); + + virtual void dispatch(); + +private: + + DefaultMutex _mutex_t; + DefaultTimeouts _timeouts; + + DefaultMutex _mutex_w; + DefaultWatches _watches; + +friend class DefaultTimeout; +friend class DefaultWatch; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_EVENTLOOP_H diff --git a/libs/dbus-c++/include/dbus-c++/glib-integration.h b/libs/dbus-c++/include/dbus-c++/glib-integration.h new file mode 100644 index 0000000000000000000000000000000000000000..82f8178a991bea95dff0ffda19d3475603f6d567 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/glib-integration.h @@ -0,0 +1,125 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_GLIB_INTEGRATION_H +#define __DBUSXX_GLIB_INTEGRATION_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <glib.h> + +#include "api.h" +#include "dispatcher.h" + +namespace DBus { + +namespace Glib { + +class BusDispatcher; + +class DXXAPI BusTimeout : public Timeout +{ +private: + + BusTimeout(Timeout::Internal *, GMainContext *, int); + + ~BusTimeout(); + + void toggle(); + + static gboolean timeout_handler(gpointer); + + void _enable(); + + void _disable(); + +private: + + GSource *_source; + GMainContext *_ctx; + int _priority; + +friend class BusDispatcher; +}; + +class DXXAPI BusWatch : public Watch +{ +private: + + BusWatch(Watch::Internal *, GMainContext *, int); + + ~BusWatch(); + + void toggle(); + + static gboolean watch_handler(gpointer); + + void _enable(); + + void _disable(); + +private: + + GSource *_source; + GMainContext *_ctx; + int _priority; + +friend class BusDispatcher; +}; + +class DXXAPI BusDispatcher : public Dispatcher +{ +public: + + BusDispatcher() : _ctx(NULL), _priority(G_PRIORITY_DEFAULT) {} + + void attach(GMainContext *); + + void enter() {} + + void leave() {} + + Timeout *add_timeout(Timeout::Internal *); + + void rem_timeout(Timeout *); + + Watch *add_watch(Watch::Internal *); + + void rem_watch(Watch *); + + void set_priority(int priority); + +private: + + GMainContext *_ctx; + int _priority; +}; + +} /* namespace Glib */ + +} /* namespace DBus */ + +#endif//__DBUSXX_GLIB_INTEGRATION_H diff --git a/libs/dbus-c++/include/dbus-c++/interface.h b/libs/dbus-c++/include/dbus-c++/interface.h new file mode 100644 index 0000000000000000000000000000000000000000..00da7c2a909dbba05832d37a81a1dcb9dfb25055 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/interface.h @@ -0,0 +1,195 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_INTERFACE_H +#define __DBUSXX_INTERFACE_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <string> +#include <map> +#include "api.h" +#include "util.h" +#include "types.h" + +#include "message.h" + +namespace DBus { + +//todo: this should belong to to properties.h +struct DXXAPI PropertyData +{ + bool read; + bool write; + std::string sig; + Variant value; +}; + +typedef std::map<std::string, PropertyData> PropertyTable; + +class IntrospectedInterface; + +class ObjectAdaptor; +class InterfaceAdaptor; +class SignalMessage; + +typedef std::map<std::string, InterfaceAdaptor *> InterfaceAdaptorTable; + +class DXXAPI AdaptorBase +{ +public: + + virtual const ObjectAdaptor *object() const = 0 ; + +protected: + + InterfaceAdaptor *find_interface(const std::string &name); + + virtual ~AdaptorBase() + {} + + virtual void _emit_signal(SignalMessage &) = 0; + + InterfaceAdaptorTable _interfaces; +}; + +/* +*/ + +class ObjectProxy; +class InterfaceProxy; +class CallMessage; + +typedef std::map<std::string, InterfaceProxy *> InterfaceProxyTable; + +class DXXAPI ProxyBase +{ +public: + + virtual const ObjectProxy *object() const = 0 ; + +protected: + + InterfaceProxy *find_interface(const std::string &name); + + virtual ~ProxyBase() + {} + + virtual Message _invoke_method(CallMessage &) = 0; + + InterfaceProxyTable _interfaces; +}; + +class DXXAPI Interface +{ +public: + + Interface(const std::string &name); + + virtual ~Interface(); + + inline const std::string &name() const; + +private: + + std::string _name; +}; + +/* +*/ + +const std::string &Interface::name() const +{ + return _name; +} + +/* +*/ + +typedef std::map< std::string, Slot<Message, const CallMessage &> > MethodTable; + +class DXXAPI InterfaceAdaptor : public Interface, public virtual AdaptorBase +{ +public: + + InterfaceAdaptor(const std::string &name); + + Message dispatch_method(const CallMessage &); + + void emit_signal(const SignalMessage &); + + Variant *get_property(const std::string &name); + + void set_property(const std::string &name, Variant &value); + + virtual IntrospectedInterface *const introspect() const + { + return NULL; + } + +protected: + + MethodTable _methods; + PropertyTable _properties; +}; + +/* +*/ + +typedef std::map< std::string, Slot<void, const SignalMessage &> > SignalTable; + +class DXXAPI InterfaceProxy : public Interface, public virtual ProxyBase +{ +public: + + InterfaceProxy(const std::string &name); + + Message invoke_method(const CallMessage &); + + bool dispatch_signal(const SignalMessage &); + +protected: + + SignalTable _signals; +}; + +# define register_method(interface, method, callback) \ + InterfaceAdaptor::_methods[ #method ] = \ + new ::DBus::Callback< interface, ::DBus::Message, const ::DBus::CallMessage &>(this, & interface :: callback); + +# define bind_property(variable, type, can_read, can_write) \ + InterfaceAdaptor::_properties[ #variable ].read = can_read; \ + InterfaceAdaptor::_properties[ #variable ].write = can_write; \ + InterfaceAdaptor::_properties[ #variable ].sig = type; \ + variable.bind(InterfaceAdaptor::_properties[ #variable ]); + +# define connect_signal(interface, signal, callback) \ + InterfaceProxy::_signals[ #signal ] = \ + new ::DBus::Callback< interface, void, const ::DBus::SignalMessage &>(this, & interface :: callback); + +} /* namespace DBus */ + +#endif//__DBUSXX_INTERFACE_H diff --git a/libs/dbus-c++/include/dbus-c++/introspection.h b/libs/dbus-c++/include/dbus-c++/introspection.h new file mode 100644 index 0000000000000000000000000000000000000000..8bb4ee9892af50ce6c3bfd7cef8aad7d1021b3f5 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/introspection.h @@ -0,0 +1,90 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_INTROSPECTION_H +#define __DBUSXX_INTROSPECTION_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "interface.h" + +namespace DBus { + +struct DXXAPI IntrospectedArgument +{ + const char *name; + const char *type; + const bool in; +}; + +struct DXXAPI IntrospectedMethod +{ + const char *name; + const IntrospectedArgument *args; +}; + +struct DXXAPI IntrospectedProperty +{ + const char *name; + const char *type; + const bool read; + const bool write; +}; + +struct DXXAPI IntrospectedInterface +{ + const char *name; + const IntrospectedMethod *methods; + const IntrospectedMethod *signals; + const IntrospectedProperty *properties; +}; + +class DXXAPI IntrospectableAdaptor : public InterfaceAdaptor +{ +public: + + IntrospectableAdaptor(); + + Message Introspect(const CallMessage &); + +protected: + + IntrospectedInterface *const introspect() const; +}; + +class DXXAPI IntrospectableProxy : public InterfaceProxy +{ +public: + + IntrospectableProxy(); + + std::string Introspect(); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_INTROSPECTION_H diff --git a/libs/dbus-c++/include/dbus-c++/message.h b/libs/dbus-c++/include/dbus-c++/message.h new file mode 100644 index 0000000000000000000000000000000000000000..3b27fdd425a9c4725f9a683d2941321de70f7777 --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/message.h @@ -0,0 +1,312 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_MESSAGE_H +#define __DBUSXX_MESSAGE_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <string> +#include <map> + +#include "api.h" +#include "util.h" + +namespace DBus { + +class Message; +class ErrorMessage; +class SignalMessage; +class ReturnMessage; +class Error; +class Connection; + +class DXXAPI MessageIter +{ +public: + + MessageIter() {} + + int type(); + + bool at_end(); + + bool has_next(); + + MessageIter &operator ++(); + + MessageIter operator ++(int); + + bool append_byte(unsigned char byte); + + unsigned char get_byte(); + + bool append_bool(bool b); + + bool get_bool(); + + bool append_int16(signed short i); + + signed short get_int16(); + + bool append_uint16(unsigned short u); + + unsigned short get_uint16(); + + bool append_int32(signed int i); + + signed int get_int32(); + + bool append_uint32(unsigned int u); + + unsigned int get_uint32(); + + bool append_int64(signed long long i); + + signed long long get_int64(); + + bool append_uint64(unsigned long long i); + + unsigned long long get_uint64(); + + bool append_double(double d); + + double get_double(); + + bool append_string(const char *chars); + + const char *get_string(); + + bool append_path(const char *chars); + + const char *get_path(); + + bool append_signature(const char *chars); + + const char *get_signature(); + + char *signature() const; //returned string must be manually free()'d + + MessageIter recurse(); + + bool append_array(char type, const void *ptr, size_t length); + + int array_type(); + + int get_array(void *ptr); + + bool is_array(); + + bool is_dict(); + + MessageIter new_array(const char *sig); + + MessageIter new_variant(const char *sig); + + MessageIter new_struct(); + + MessageIter new_dict_entry(); + + void close_container(MessageIter &container); + + void copy_data(MessageIter &to); + + Message &msg() const + { + return *_msg; + } + +private: + + DXXAPILOCAL MessageIter(Message &msg) : _msg(&msg) {} + + DXXAPILOCAL bool append_basic(int type_id, void *value); + + DXXAPILOCAL void get_basic(int type_id, void *ptr); + +private: + + /* I'm sorry, but don't want to include dbus.h in the public api + */ + unsigned char _iter[sizeof(void *)*3+sizeof(int)*11]; + + Message *_msg; + +friend class Message; +}; + +class DXXAPI Message +{ +public: + + struct Private; + + Message(Private *, bool incref = true); + + Message(const Message &m); + + ~Message(); + + Message &operator = (const Message &m); + + Message copy(); + + int type() const; + + int serial() const; + + int reply_serial() const; + + bool reply_serial(int); + + const char *sender() const; + + bool sender(const char *s); + + const char *destination() const; + + bool destination(const char *s); + + bool is_error() const; + + bool is_signal(const char *interface, const char *member) const; + + MessageIter reader() const; + + MessageIter writer(); + + bool append(int first_type, ...); + + void terminate(); + +protected: + + Message(); + +protected: + + RefPtrI<Private> _pvt; + +/* classes who need to read `_pvt` directly +*/ +friend class ErrorMessage; +friend class ReturnMessage; +friend class MessageIter; +friend class Error; +friend class Connection; +}; + +/* +*/ + +class DXXAPI ErrorMessage : public Message +{ +public: + + ErrorMessage(); + + ErrorMessage(const Message &, const char *name, const char *message); + + const char *name() const; + + bool name(const char *n); + + bool operator == (const ErrorMessage &) const; +}; + +/* +*/ + +class DXXAPI SignalMessage : public Message +{ +public: + + SignalMessage(const char *name); + + SignalMessage(const char *path, const char *interface, const char *name); + + const char *interface() const; + + bool interface(const char *i); + + const char *member() const; + + bool member(const char *m); + + const char *path() const; + + char ** path_split() const; + + bool path(const char *p); + + bool operator == (const SignalMessage &) const; +}; + +/* +*/ + +class DXXAPI CallMessage : public Message +{ +public: + + CallMessage(); + + CallMessage(const char *dest, const char *path, const char *iface, const char *method); + + const char *interface() const; + + bool interface(const char *i); + + const char *member() const; + + bool member(const char *m); + + const char *path() const; + + char ** path_split() const; + + bool path(const char *p); + + const char *signature() const; + + bool operator == (const CallMessage &) const; +}; + +/* +*/ + +class DXXAPI ReturnMessage : public Message +{ +public: + + ReturnMessage(const CallMessage &callee); + + const char *signature() const; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_MESSAGE_H diff --git a/libs/dbus-c++/include/dbus-c++/object.h b/libs/dbus-c++/include/dbus-c++/object.h new file mode 100644 index 0000000000000000000000000000000000000000..a7ed84d43f0be2d5ea0c91d63561135ddccde10b --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/object.h @@ -0,0 +1,226 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_OBJECT_H +#define __DBUSXX_OBJECT_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <string> +#include <list> + +#include "api.h" +#include "interface.h" +#include "connection.h" +#include "message.h" +#include "types.h" + +namespace DBus { + +class DXXAPI Object +{ +protected: + + Object(Connection &conn, const Path &path, const char *service); + +public: + + virtual ~Object(); + + inline const DBus::Path &path() const; + + inline const std::string &service() const; + + inline Connection &conn(); + +private: + + DXXAPILOCAL virtual bool handle_message(const Message &) = 0; + DXXAPILOCAL virtual void register_obj() = 0; + DXXAPILOCAL virtual void unregister_obj() = 0; + +private: + + Connection _conn; + DBus::Path _path; + std::string _service; +}; + +/* +*/ + +Connection &Object::conn() +{ + return _conn; +} + +const DBus::Path &Object::path() const +{ + return _path; +} + +const std::string &Object::service() const +{ + return _service; +} + +/* +*/ + +class DXXAPI Tag +{ +public: + + virtual ~Tag() + {} +}; + +/* +*/ + +class ObjectAdaptor; + +typedef std::list<ObjectAdaptor *> ObjectAdaptorPList; +typedef std::list<std::string> ObjectPathList; + +class DXXAPI ObjectAdaptor : public Object, public virtual AdaptorBase +{ +public: + + static ObjectAdaptor *from_path(const Path &path); + + static ObjectAdaptorPList from_path_prefix(const std::string &prefix); + + static ObjectPathList child_nodes_from_prefix(const std::string &prefix); + + struct Private; + + ObjectAdaptor(Connection &conn, const Path &path); + + ~ObjectAdaptor(); + + inline const ObjectAdaptor *object() const; + +protected: + + class DXXAPI Continuation + { + public: + + inline MessageIter &writer(); + + inline Tag *tag(); + + private: + + Continuation(Connection &conn, const CallMessage &call, const Tag *tag); + + Connection _conn; + CallMessage _call; + MessageIter _writer; + ReturnMessage _return; + const Tag *_tag; + + friend class ObjectAdaptor; + }; + + void return_later(const Tag *tag); + + void return_now(Continuation *ret); + + void return_error(Continuation *ret, const Error error); + + Continuation *find_continuation(const Tag *tag); + +private: + + void _emit_signal(SignalMessage &); + + bool handle_message(const Message &); + + void register_obj(); + void unregister_obj(); + + typedef std::map<const Tag *, Continuation *> ContinuationMap; + ContinuationMap _continuations; + +friend struct Private; +}; + +const ObjectAdaptor *ObjectAdaptor::object() const +{ + return this; +} + +Tag *ObjectAdaptor::Continuation::tag() +{ + return const_cast<Tag *>(_tag); +} + +MessageIter &ObjectAdaptor::Continuation::writer() +{ + return _writer; +} + +/* +*/ + +class ObjectProxy; + +typedef std::list<ObjectProxy *> ObjectProxyPList; + +class DXXAPI ObjectProxy : public Object, public virtual ProxyBase +{ +public: + + ObjectProxy(Connection &conn, const Path &path, const char *service = ""); + + ~ObjectProxy(); + + inline const ObjectProxy *object() const; + +private: + + Message _invoke_method(CallMessage &); + + bool handle_message(const Message &); + + void register_obj(); + void unregister_obj(); + +private: + + MessageSlot _filtered; +}; + +const ObjectProxy *ObjectProxy::object() const +{ + return this; +} + +} /* namespace DBus */ + +#endif//__DBUSXX_OBJECT_H diff --git a/libs/dbus-c++/include/dbus-c++/pendingcall.h b/libs/dbus-c++/include/dbus-c++/pendingcall.h new file mode 100644 index 0000000000000000000000000000000000000000..1ba28568479d2d168c9d26dd2dfb26c72d386baf --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/pendingcall.h @@ -0,0 +1,78 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_PENDING_CALL_H +#define __DBUSXX_PENDING_CALL_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "util.h" +#include "message.h" + +namespace DBus { + +class Connection; + +class DXXAPI PendingCall +{ +public: + + struct Private; + + PendingCall(Private *); + + PendingCall(const PendingCall &); + + virtual ~PendingCall(); + + PendingCall &operator = (const PendingCall &); + + bool completed(); + + void cancel(); + + void block(); + + void data(void *); + + void *data(); + + Slot<void, PendingCall &>& slot(); + + Message steal_reply(); + +private: + + RefPtrI<Private> _pvt; + +friend struct Private; +friend class Connection; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_PENDING_CALL_H diff --git a/libs/dbus-c++/include/dbus-c++/property.h b/libs/dbus-c++/include/dbus-c++/property.h new file mode 100644 index 0000000000000000000000000000000000000000..c9755e1fd32fa9c5e425636c5755dbfda3fac61b --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/property.h @@ -0,0 +1,106 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_PROPERTY_H +#define __DBUSXX_PROPERTY_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "types.h" +#include "interface.h" + +namespace DBus { + +template <typename T> +class PropertyAdaptor +{ +public: + + PropertyAdaptor() : _data(0) + {} + + void bind(PropertyData &data) + { + _data = &data; + } + + T operator() (void) const + { + return (T)_data->value; + } + + PropertyAdaptor &operator = (const T &t) + { + _data->value.clear(); + MessageIter wi = _data->value.writer(); + wi << t; + return *this; + } + +private: + + PropertyData *_data; +}; + +struct IntrospectedInterface; + +class DXXAPI PropertiesAdaptor : public InterfaceAdaptor +{ +public: + + PropertiesAdaptor(); + + Message Get(const CallMessage &); + + Message Set(const CallMessage &); + +protected: + + virtual void on_get_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, Variant &/*value*/) + {} + + virtual void on_set_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, const Variant &/*value*/) + {} + + IntrospectedInterface *const introspect() const; +}; + +class DXXAPI PropertiesProxy : public InterfaceProxy +{ +public: + + PropertiesProxy(); + + Variant Get(const std::string &interface, const std::string &property); + + void Set(const std::string &interface, const std::string &property, const Variant &value); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_PROPERTY_H + diff --git a/libs/dbus-c++/include/dbus-c++/refptr_impl.h b/libs/dbus-c++/include/dbus-c++/refptr_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..d35d8349ed1e9c1b6d254e94132655aa0149049a --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/refptr_impl.h @@ -0,0 +1,50 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_REFPTR_IMPL_H +#define __DBUSXX_REFPTR_IMPL_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "util.h" + +namespace DBus { + +template <class T> +RefPtrI<T>::RefPtrI(T *ptr) +: __ptr(ptr) +{} + +template <class T> +RefPtrI<T>::~RefPtrI() +{ + if (__cnt.one()) delete __ptr; +} + +} /* namespace DBus */ + +#endif//__DBUSXX_REFPTR_IMPL_H diff --git a/libs/dbus-c++/include/dbus-c++/server.h b/libs/dbus-c++/include/dbus-c++/server.h new file mode 100644 index 0000000000000000000000000000000000000000..adc6edef264612c1f42b93cbbd32161304e9961b --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/server.h @@ -0,0 +1,78 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_SERVER_H +#define __DBUSXX_SERVER_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <list> + +#include "api.h" +#include "error.h" +#include "connection.h" +#include "util.h" +#include "dispatcher.h" + +namespace DBus { + +class Server; + +typedef std::list<Server> ServerList; + +class DXXAPI Server +{ +public: + + Server(const char *address); + + Dispatcher *setup(Dispatcher *); + + virtual ~Server(); + + bool listening() const; + + bool operator == (const Server &) const; + + void disconnect(); + + struct Private; + +protected: + + Server(const Server & /* s */) + {} + + virtual void on_new_connection(Connection &c) = 0; + +private: + + RefPtrI<Private> _pvt; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_SERVER_H diff --git a/libs/dbus-c++/include/dbus-c++/types.h b/libs/dbus-c++/include/dbus-c++/types.h new file mode 100644 index 0000000000000000000000000000000000000000..a2b6b830a023de5bca4c54ac819bdf27f32b830b --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/types.h @@ -0,0 +1,504 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_TYPES_H +#define __DBUSXX_TYPES_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include <stdint.h> +#include <string> +#include <vector> +#include <map> + +#include "api.h" +#include "util.h" +#include "message.h" +#include "error.h" + +namespace DBus { + +struct DXXAPI Path : public std::string +{ + Path() {} + Path(const std::string &s) : std::string(s) {} + Path(const char *c) : std::string(c) {} + Path &operator = (std::string &s) + { + std::string::operator = (s); + return *this; + } +}; + +struct DXXAPI Signature : public std::string +{ + Signature() {} + Signature(const std::string &s) : std::string(s) {} + Signature(const char *c) : std::string(c) {} + Signature &operator = (std::string &s) + { + std::string::operator = (s); + return *this; + } +}; + +struct DXXAPI Invalid {}; + +class DXXAPI Variant +{ +public: + + Variant(); + + Variant(MessageIter &it); + + Variant &operator = (const Variant &v); + + const Signature signature() const; + + void clear(); + + MessageIter reader() const + { + return _msg.reader(); + } + + MessageIter writer() + { + return _msg.writer(); + } + + template <typename T> + operator T() const + { + T cast; + MessageIter ri = _msg.reader(); + ri >> cast; + return cast; + } + +private: + + Message _msg; +}; + +template < + typename T1, + typename T2 = Invalid, + typename T3 = Invalid, + typename T4 = Invalid, + typename T5 = Invalid, + typename T6 = Invalid, + typename T7 = Invalid, + typename T8 = Invalid // who needs more than eight? +> +struct Struct +{ + T1 _1; T2 _2; T3 _3; T4 _4; T5 _5; T6 _6; T7 _7; T8 _8; +}; + +template<typename K, typename V> +inline bool dict_has_key(const std::map<K,V>& map, const K &key) +{ + return map.find(key) != map.end(); +} + +template <typename T> +struct type +{ + static std::string sig() + { + throw ErrorInvalidArgs("unknown type"); + return ""; + } +}; + +template <> struct type<Variant> { static std::string sig(){ return "v"; } }; +template <> struct type<uint8_t> { static std::string sig(){ return "y"; } }; +template <> struct type<bool> { static std::string sig(){ return "b"; } }; +template <> struct type<int16_t> { static std::string sig(){ return "n"; } }; +template <> struct type<uint16_t> { static std::string sig(){ return "q"; } }; +template <> struct type<int32_t> { static std::string sig(){ return "i"; } }; +template <> struct type<uint32_t> { static std::string sig(){ return "u"; } }; +template <> struct type<int64_t> { static std::string sig(){ return "x"; } }; +template <> struct type<uint64_t> { static std::string sig(){ return "t"; } }; +template <> struct type<double> { static std::string sig(){ return "d"; } }; +template <> struct type<std::string> { static std::string sig(){ return "s"; } }; +template <> struct type<Path> { static std::string sig(){ return "o"; } }; +template <> struct type<Signature> { static std::string sig(){ return "g"; } }; +template <> struct type<Invalid> { static std::string sig(){ return ""; } }; + +template <typename E> +struct type< std::vector<E> > +{ static std::string sig(){ return "a" + type<E>::sig(); } }; + +template <typename K, typename V> +struct type< std::map<K,V> > +{ static std::string sig(){ return "a{" + type<K>::sig() + type<V>::sig() + "}"; } }; + +template < + typename T1, + typename T2, + typename T3, + typename T4, + typename T5, + typename T6, + typename T7, + typename T8 // who needs more than eight? +> +struct type< Struct<T1,T2,T3,T4,T5,T6,T7,T8> > +{ + static std::string sig() + { + return "(" + + type<T1>::sig() + + type<T2>::sig() + + type<T3>::sig() + + type<T4>::sig() + + type<T5>::sig() + + type<T6>::sig() + + type<T7>::sig() + + type<T8>::sig() + + ")"; + } +}; + +} /* namespace DBus */ + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Invalid &) +{ + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint8_t &val) +{ + iter.append_byte(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const bool &val) +{ + iter.append_bool(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int16_t& val) +{ + iter.append_int16(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint16_t& val) +{ + iter.append_uint16(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int32_t& val) +{ + iter.append_int32(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint32_t& val) +{ + iter.append_uint32(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int64_t& val) +{ + iter.append_int64(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint64_t& val) +{ + iter.append_uint64(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const double &val) +{ + iter.append_double(val); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::string &val) +{ + iter.append_string(val.c_str()); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Path &val) +{ + iter.append_path(val.c_str()); + return iter; +} + +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Signature &val) +{ + iter.append_signature(val.c_str()); + return iter; +} + +template<typename E> +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::vector<E>& val) +{ + const std::string sig = DBus::type<E>::sig(); + DBus::MessageIter ait = iter.new_array(sig.c_str()); + + typename std::vector<E>::const_iterator vit; + for (vit = val.begin(); vit != val.end(); ++vit) + { + ait << *vit; + } + + iter.close_container(ait); + return iter; +} + +template<> +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::vector<uint8_t>& val) +{ + DBus::MessageIter ait = iter.new_array("y"); + ait.append_array('y', &val.front(), val.size()); + iter.close_container(ait); + return iter; +} + +template<typename K, typename V> +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::map<K,V>& val) +{ + const std::string sig = "{" + DBus::type<K>::sig() + DBus::type<V>::sig() + "}"; + DBus::MessageIter ait = iter.new_array(sig.c_str()); + + typename std::map<K,V>::const_iterator mit; + for (mit = val.begin(); mit != val.end(); ++mit) + { + DBus::MessageIter eit = ait.new_dict_entry(); + + eit << mit->first << mit->second; + + ait.close_container(eit); + } + + iter.close_container(ait); + return iter; +} + +template < + typename T1, + typename T2, + typename T3, + typename T4, + typename T5, + typename T6, + typename T7, + typename T8 +> +inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Struct<T1,T2,T3,T4,T5,T6,T7,T8>& val) +{ +/* const std::string sig = + DBus::type<T1>::sig() + DBus::type<T2>::sig() + DBus::type<T3>::sig() + DBus::type<T4>::sig() + + DBus::type<T5>::sig() + DBus::type<T6>::sig() + DBus::type<T7>::sig() + DBus::type<T8>::sig(); +*/ + DBus::MessageIter sit = iter.new_struct(/*sig.c_str()*/); + + sit << val._1 << val._2 << val._3 << val._4 << val._5 << val._6 << val._7 << val._8; + + iter.close_container(sit); + + return iter; +} + +extern DXXAPI DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Variant &val); + +/* + */ + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Invalid &) +{ + return iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint8_t &val) +{ + val = iter.get_byte(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, bool &val) +{ + val = iter.get_bool(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int16_t& val) +{ + val = iter.get_int16(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint16_t& val) +{ + val = iter.get_uint16(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int32_t& val) +{ + val = iter.get_int32(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint32_t& val) +{ + val = iter.get_uint32(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int64_t& val) +{ + val = iter.get_int64(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint64_t& val) +{ + val = iter.get_uint64(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, double &val) +{ + val = iter.get_double(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::string &val) +{ + val = iter.get_string(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Path &val) +{ + val = iter.get_path(); + return ++iter; +} + +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Signature &val) +{ + val = iter.get_signature(); + return ++iter; +} + +template<typename E> +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::vector<E>& val) +{ + if (!iter.is_array()) + throw DBus::ErrorInvalidArgs("array expected"); + + DBus::MessageIter ait = iter.recurse(); + + while (!ait.at_end()) + { + E elem; + + ait >> elem; + + val.push_back(elem); + } + return ++iter; +} + +template<> +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::vector<uint8_t>& val) +{ + if (!iter.is_array()) + throw DBus::ErrorInvalidArgs("array expected"); + + if (iter.array_type() != 'y') + throw DBus::ErrorInvalidArgs("byte-array expected"); + + DBus::MessageIter ait = iter.recurse(); + + uint8_t *array; + size_t length = ait.get_array(&array); + + val.insert(val.end(), array, array+length); + + return ++iter; +} + +template<typename K, typename V> +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::map<K,V>& val) +{ + if (!iter.is_dict()) + throw DBus::ErrorInvalidArgs("dictionary value expected"); + + DBus::MessageIter mit = iter.recurse(); + + while (!mit.at_end()) + { + K key; V value; + + DBus::MessageIter eit = mit.recurse(); + + eit >> key >> value; + + val[key] = value; + + ++mit; + } + + return ++iter; +} + +template < + typename T1, + typename T2, + typename T3, + typename T4, + typename T5, + typename T6, + typename T7, + typename T8 +> +inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Struct<T1,T2,T3,T4,T5,T6,T7,T8>& val) +{ + DBus::MessageIter sit = iter.recurse(); + + sit >> val._1 >> val._2 >> val._3 >> val._4 >> val._5 >> val._6 >> val._7 >> val._8; + + return ++iter; +} + +extern DXXAPI DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Variant &val); + +#endif//__DBUSXX_TYPES_H + diff --git a/libs/dbus-c++/include/dbus-c++/util.h b/libs/dbus-c++/include/dbus-c++/util.h new file mode 100644 index 0000000000000000000000000000000000000000..071ad306c27da5d31964256441e9c9329fb9e84b --- /dev/null +++ b/libs/dbus-c++/include/dbus-c++/util.h @@ -0,0 +1,277 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_UTIL_H +#define __DBUSXX_UTIL_H + +#ifdef HAVE_CONFIG_H +#include <dbus-c++/config.h> +#endif + +#include "api.h" +#include "debug.h" + +namespace DBus { + +/* + * Very simple reference counting + */ + +class DXXAPI RefCnt +{ +public: + + RefCnt() + { + __ref = new int; + (*__ref) = 1; + } + + RefCnt(const RefCnt &rc) + { + __ref = rc.__ref; + ref(); + } + + virtual ~RefCnt() + { + unref(); + } + + RefCnt &operator = (const RefCnt &ref) + { + ref.ref(); + unref(); + __ref = ref.__ref; + return *this; + } + + bool noref() const + { + return (*__ref) == 0; + } + + bool one() const + { + return (*__ref) == 1; + } + +private: + + DXXAPILOCAL void ref() const + { + ++ (*__ref); + } + DXXAPILOCAL void unref() const + { + -- (*__ref); + + if ((*__ref) < 0) + { + debug_log("%p: refcount dropped below zero!", __ref); + } + + if (noref()) + { + delete __ref; + } + } + +private: + + int *__ref; +}; + +/* + * Reference counting pointers (emulate boost::shared_ptr) + */ + +template <class T> +class RefPtrI // RefPtr to incomplete type +{ +public: + + RefPtrI(T *ptr = 0); + + ~RefPtrI(); + + RefPtrI &operator = (const RefPtrI &ref) + { + if (this != &ref) + { + if (__cnt.one()) delete __ptr; + + __ptr = ref.__ptr; + __cnt = ref.__cnt; + } + return *this; + } + + T &operator *() const + { + return *__ptr; + } + + T *operator ->() const + { + if (__cnt.noref()) return 0; + + return __ptr; + } + + T *get() const + { + if (__cnt.noref()) return 0; + + return __ptr; + } + +private: + + T *__ptr; + RefCnt __cnt; +}; + +template <class T> +class RefPtr +{ +public: + + RefPtr(T *ptr = 0) + : __ptr(ptr) + {} + + ~RefPtr() + { + if (__cnt.one()) delete __ptr; + } + + RefPtr &operator = (const RefPtr &ref) + { + if (this != &ref) + { + if (__cnt.one()) delete __ptr; + + __ptr = ref.__ptr; + __cnt = ref.__cnt; + } + return *this; + } + + T &operator *() const + { + return *__ptr; + } + + T *operator ->() const + { + if (__cnt.noref()) return 0; + + return __ptr; + } + + T *get() const + { + if (__cnt.noref()) return 0; + + return __ptr; + } + +private: + + T *__ptr; + RefCnt __cnt; +}; + +/* + * Typed callback template + */ + +template <class R, class P> +class Callback_Base +{ +public: + + virtual R call(P param) const = 0; + + virtual ~Callback_Base() + {} +}; + +template <class R, class P> +class Slot +{ +public: + + Slot &operator = (Callback_Base<R,P>* s) + { + _cb = s; + + return *this; + } + + R operator()(P param) const + { + /*if (_cb.get())*/ return _cb->call(param); + } + + R call(P param) const + { + /*if (_cb.get())*/ return _cb->call(param); + } + + bool empty() + { + return _cb.get() == 0; + } + +private: + + RefPtr< Callback_Base<R,P> > _cb; +}; + +template <class C, class R, class P> +class Callback : public Callback_Base<R,P> +{ +public: + + typedef R (C::*M)(P); + + Callback(C *c, M m) + : _c(c), _m(m) + {} + + R call(P param) const + { + /*if (_c)*/ return (_c->*_m)(param); + } + +private: + + C *_c; M _m; +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_UTIL_H diff --git a/libs/dbus-c++/install-sh b/libs/dbus-c++/install-sh new file mode 100755 index 0000000000000000000000000000000000000000..4d4a9519eaf88b18fb157dfe5fae59c1c5d005c7 --- /dev/null +++ b/libs/dbus-c++/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/libs/dbus-c++/libdbus-c++.spec.in b/libs/dbus-c++/libdbus-c++.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..264e02f23bebf974e676610721d4d16601e529fc --- /dev/null +++ b/libs/dbus-c++/libdbus-c++.spec.in @@ -0,0 +1,62 @@ + + + + +Summary: C++ Interface for DBus +Name: libdbus-c++ +Version: @PACKAGE_VERSION@ +Release: 70001 +URL: http://dev.openwengo.org/trac/openwengo/trac.fcgi/browser/wengophone-ng/branches/wengophone-dbus-api/libs/dbus/src +Source0: %{name}-%{version}.tar.gz +License: LGPL +Group: Libraries +BuildRoot: %{_tmppath}/%{name}-root +Prefix: /usr + +%description + +Ability to reflect dbus methods and signals into a more natural C++ object system. + +%package devel +Requires: libdbus-c++ = %{version} +Group: Development/Libraries +Summary: Header files for libdbus-c++ + +%description devel +Header files for libdbus-c++ + + +%prep +%setup -q + +%build +./configure --prefix=/usr +make -j 4 + +%install +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(755,root,root) +%{prefix}/lib/libdbus-c++*.so* + + + +%files devel +%defattr(-,root,root) +%{prefix}/bin/dbusxx-xml2cpp +%{prefix}/bin/dbusxx-introspect +%{prefix}/lib/libdbus-c*.a +%{prefix}/include/dbus-c++-1 +%{prefix}/lib/pkgconfig/*.pc + +%changelog +* Thu Feb 8 2007 Ben Martin +- initial spec file diff --git a/libs/dbus-c++/ltmain.sh b/libs/dbus-c++/ltmain.sh new file mode 100755 index 0000000000000000000000000000000000000000..6d056ecf33a3e754e0e901b202f911d48854236f --- /dev/null +++ b/libs/dbus-c++/ltmain.sh @@ -0,0 +1,7880 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.4 +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu4 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to <bug-libtool@gnu.org>. + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.4 Debian-2.2.4-0ubuntu4" +TIMESTAMP="" +package_revision=1.2976 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit $EXIT_SUCCESS +fi + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +# $mode is unset +nonopt= +execute_dlfiles= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +opt_dry_run=false +opt_duplicate_deps=false +opt_silent=false +opt_debug=: + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + $ECHO "host: $host" + if test "$build_libtool_libs" = yes; then + $ECHO "enable shared libraries" + else + $ECHO "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $ECHO "enable static libraries" + else + $ECHO "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <<EOF +# $write_libobj - a libtool object file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object=$write_lobj + +# Name of the non-PIC object +non_pic_object=$write_oldobj + +EOF + $MV "${write_libobj}T" "${write_libobj}" + } +} + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + pie_flag="$pie_flag $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_quote_for_eval "$arg" + lastarg="$lastarg $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_quote_for_eval "$lastarg" + base_compile="$base_compile $func_quote_for_eval_result" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.obj | *.sx) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper arg +# +# emit a libtool wrapper script on stdout +# don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variable +# set therein. +# +# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the '.lib' directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. + + Currently, it simply execs the wrapper *script* "$SHELL $output", + but could eventually absorb all of the scripts functionality and + exec $objdir/$outputname directly. +*/ +EOF + cat <<"EOF" +#include <stdio.h> +#include <stdlib.h> +#ifdef _MSC_VER +# include <direct.h> +# include <process.h> +# include <io.h> +# define setmode _setmode +#else +# include <unistd.h> +# include <stdint.h> +# ifdef __CYGWIN__ +# include <io.h> +# endif +#endif +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/stat.h> + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); + +static const char *script_text = +EOF + + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + + cat <<EOF +const char * MAGIC_EXE = "$magic_exe"; + +int +main (int argc, char *argv[]) +{ + char **newargz; + char *tmp_pathspec; + char *actual_cwrapper_path; + char *shwrapper_name; + intptr_t rval = 127; + FILE *shwrapper; + + const char *dumpscript_opt = "--lt-dump-script"; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); + LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); + + /* very simple arg parsing; don't want to rely on getopt */ + for (i = 1; i < argc; i++) + { + if (strcmp (argv[i], dumpscript_opt) == 0) + { +EOF + case "$host" in + *mingw* | *cygwin* ) + # make stdout use "unix" line endings + echo " setmode(1,_O_BINARY);" + ;; + esac + + cat <<EOF + printf ("%s", script_text); + return 0; + } + } + + newargz = XMALLOC (char *, argc + 2); +EOF + + if test -n "$TARGETSHELL" ; then + # no path translation at all + lt_newargv0=$TARGETSHELL + else + case "$host" in + *mingw* ) + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL` + case $lt_newargv0 in + *.exe | *.EXE) ;; + *) lt_newargv0=$lt_newargv0.exe ;; + esac + ;; + * ) lt_newargv0=$SHELL ;; + esac + fi + + cat <<EOF + newargz[0] = (char *) xstrdup ("$lt_newargv0"); +EOF + + cat <<"EOF" + tmp_pathspec = find_executable (argv[0]); + if (tmp_pathspec == NULL) + lt_fatal ("Couldn't find %s", argv[0]); + LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", + tmp_pathspec)); + + actual_cwrapper_path = chase_symlinks (tmp_pathspec); + LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", + actual_cwrapper_path)); + XFREE (tmp_pathspec); + + shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path)); + strendzap (actual_cwrapper_path, shwrapper_name); + + /* shwrapper_name transforms */ + strendzap (shwrapper_name, ".exe"); + tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) + + strlen ("_ltshwrapperTMP") + 1)); + strcpy (tmp_pathspec, shwrapper_name); + strcat (tmp_pathspec, "_ltshwrapperTMP"); + XFREE (shwrapper_name); + shwrapper_name = tmp_pathspec; + tmp_pathspec = 0; + LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n", + shwrapper_name)); +EOF + + cat <<EOF + newargz[1] = + XMALLOC (char, (strlen (actual_cwrapper_path) + + strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1)); + strcpy (newargz[1], actual_cwrapper_path); + strcat (newargz[1], "$objdir"); + strcat (newargz[1], "/"); + strcat (newargz[1], shwrapper_name); +EOF + + + case $host_os in + mingw*) + cat <<"EOF" + { + char* p; + while ((p = strchr (newargz[1], '\\')) != NULL) + { + *p = '/'; + } + } +EOF + ;; + esac + + cat <<"EOF" + XFREE (shwrapper_name); + XFREE (actual_cwrapper_path); + + /* always write in binary mode */ + if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0) + { + lt_fatal ("Could not open %s for writing", newargz[1]); + } + fprintf (shwrapper, "%s", script_text); + fclose (shwrapper); + + make_executable (newargz[1]); + + for (i = 1; i < argc; i++) + newargz[i + 1] = xstrdup (argv[i]); + newargz[argc + 1] = NULL; + + for (i = 0; i < argc + 1; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i])); + } + +EOF + + case $host_os in + mingw*) + cat <<EOF + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno)); + return 127; + } + return rval; +} +EOF + ;; + *) + cat <<EOF + execv ("$lt_newargv0", newargz); + return rval; /* =127, but avoids unused variable warning */ +} +EOF + ;; + esac + + cat <<"EOF" + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then + ldd_output=`ldd conftest` + for i in $deplibs; do + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $ECHO + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which I believe you do not have" + $ECHO "*** because a test_compile did reveal that the linker did not use it for" + $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + ;; + *) + newdeplibs="$newdeplibs $i" + ;; + esac + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + case $i in + -l*) + func_stripname -l '' "$i" + name=$func_stripname_result + $opt_dry_run || $RM conftest + if $LTCC $LTCFLAGS -o conftest conftest.c $i; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` + set dummy $deplib_matches; shift + deplib_match=$1 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $ECHO + $ECHO "*** Warning: dynamic linker does not accept needed library $i." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because a test_compile did reveal that the linker did not use this one" + $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + fi + else + droppeddeps=yes + $ECHO + $ECHO "*** Warning! Library $i is needed by this library but I was not able to" + $ECHO "*** make it link in! You will probably need to install it or some" + $ECHO "*** library that it depends on before this library will be fully" + $ECHO "*** functional. Installing it before continuing would be even better." + fi + ;; + *) + newdeplibs="$newdeplibs $i" + ;; + esac + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method; shift + file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/libs/dbus-c++/missing b/libs/dbus-c++/missing new file mode 100755 index 0000000000000000000000000000000000000000..894e786e16c1d0d94dfc08d6b475270fe1418d6a --- /dev/null +++ b/libs/dbus-c++/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program 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 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/libs/dbus-c++/src/Makefile.am b/libs/dbus-c++/src/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..f449e9db9eb9e68ee8f2ec809b8e8c14e75f2643 --- /dev/null +++ b/libs/dbus-c++/src/Makefile.am @@ -0,0 +1,46 @@ +AM_CPPFLAGS = \ + $(dbus_CFLAGS) \ + $(glib_CFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include + +if ENABLE_GLIB +GLIB_H = $(HEADER_DIR)/glib-integration.h +GLIB_CPP = glib-integration.cpp +endif + +CONFIG_H = $(top_builddir)/include/dbus-c++/config.h + +HEADER_DIR = $(top_srcdir)/include/dbus-c++ +HEADER_FILES = \ + $(CONFIG_H) \ + $(HEADER_DIR)/dbus.h \ + $(HEADER_DIR)/types.h \ + $(HEADER_DIR)/connection.h \ + $(HEADER_DIR)/property.h \ + $(HEADER_DIR)/debug.h \ + $(HEADER_DIR)/error.h \ + $(HEADER_DIR)/interface.h \ + $(HEADER_DIR)/message.h \ + $(HEADER_DIR)/dispatcher.h \ + $(HEADER_DIR)/object.h \ + $(HEADER_DIR)/pendingcall.h \ + $(HEADER_DIR)/server.h \ + $(HEADER_DIR)/debug.h \ + $(HEADER_DIR)/util.h \ + $(HEADER_DIR)/refptr_impl.h \ + $(HEADER_DIR)/introspection.h \ + $(HEADER_DIR)/api.h \ + $(HEADER_DIR)/eventloop.h \ + $(HEADER_DIR)/eventloop-integration.h \ + $(GLIB_H) + +lib_includedir=$(includedir)/dbus-c++-1/dbus-c++/ +lib_include_HEADERS = $(HEADER_FILES) + +lib_LTLIBRARIES = libdbus-c++-1.la +libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h eventloop.cpp eventloop-integration.cpp $(GLIB_CPP) +libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(glib_LIBS) $(pthread_LIBS) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/src/connection.cpp b/libs/dbus-c++/src/connection.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08f573a070c8876fb823ca9d8f967dc035ca2672 --- /dev/null +++ b/libs/dbus-c++/src/connection.cpp @@ -0,0 +1,413 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/debug.h> +#include <dbus-c++/connection.h> + +#include <dbus/dbus.h> +#include <string> + +#include "internalerror.h" + +#include "connection_p.h" +#include "dispatcher_p.h" +#include "server_p.h" +#include "message_p.h" +#include "pendingcall_p.h" + +using namespace DBus; + +Connection::Private::Private(DBusConnection *c, Server::Private *s) +: conn(c) , dispatcher(0), server(s) +{ + init(); +} + +Connection::Private::Private(DBusBusType type) +{ + InternalError e; + + conn = dbus_bus_get_private(type, e); + + if (e) throw Error(e); + + init(); +} + +Connection::Private::~Private() +{ + debug_log("terminating connection 0x%08x", conn); + + detach_server(); + + if (dbus_connection_get_is_connected(conn)) + { + std::vector<std::string>::iterator i = names.begin(); + + while (i != names.end()) + { + debug_log("%s: releasing bus name %s", dbus_bus_get_unique_name(conn), i->c_str()); + dbus_bus_release_name(conn, i->c_str(), NULL); + ++i; + } + dbus_connection_close(conn); + } + dbus_connection_unref(conn); +} + +void Connection::Private::init() +{ + dbus_connection_ref(conn); + dbus_connection_ref(conn); //todo: the library has to own another reference + + disconn_filter = new Callback<Connection::Private, bool, const Message &>( + this, &Connection::Private::disconn_filter_function + ); + + dbus_connection_add_filter(conn, message_filter_stub, &disconn_filter, NULL); + + dbus_connection_set_dispatch_status_function(conn, dispatch_status_stub, this, 0); + dbus_connection_set_exit_on_disconnect(conn, false); //why was this set to true?? +} + +void Connection::Private::detach_server() +{ +/* Server::Private *tmp = server; + + server = NULL; + + if (tmp) + { + ConnectionList::iterator i; + + for (i = tmp->connections.begin(); i != tmp->connections.end(); ++i) + { + if (i->_pvt.get() == this) + { + tmp->connections.erase(i); + break; + } + } + }*/ +} + +bool Connection::Private::do_dispatch() +{ + debug_log("dispatching on %p", conn); + + if (!dbus_connection_get_is_connected(conn)) + { + debug_log("connection terminated"); + + detach_server(); + + return true; + } + + return dbus_connection_dispatch(conn) != DBUS_DISPATCH_DATA_REMAINS; +} + +void Connection::Private::dispatch_status_stub(DBusConnection *dc, DBusDispatchStatus status, void *data) +{ + Private *p = static_cast<Private *>(data); + + switch (status) + { + case DBUS_DISPATCH_DATA_REMAINS: + debug_log("some dispatching to do on %p", dc); + p->dispatcher->queue_connection(p); + break; + + case DBUS_DISPATCH_COMPLETE: + debug_log("all dispatching done on %p", dc); + break; + + case DBUS_DISPATCH_NEED_MEMORY: //uh oh... + debug_log("connection %p needs memory", dc); + break; + } +} + +DBusHandlerResult Connection::Private::message_filter_stub(DBusConnection *conn, DBusMessage *dmsg, void *data) +{ + MessageSlot *slot = static_cast<MessageSlot *>(data); + + Message msg = Message(new Message::Private(dmsg)); + + return slot && !slot->empty() && slot->call(msg) + ? DBUS_HANDLER_RESULT_HANDLED + : DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + +bool Connection::Private::disconn_filter_function(const Message &msg) +{ + if (msg.is_signal(DBUS_INTERFACE_LOCAL,"Disconnected")) + { + debug_log("%p disconnected by local bus", conn); + dbus_connection_close(conn); + + return true; + } + return false; +} + +Connection Connection::SystemBus() +{ + return Connection(new Private(DBUS_BUS_SYSTEM)); +} + +Connection Connection::SessionBus() +{ + return Connection(new Private(DBUS_BUS_SESSION)); +} + +Connection Connection::ActivationBus() +{ + return Connection(new Private(DBUS_BUS_STARTER)); +} + +Connection::Connection(const char *address, bool priv) +{ + InternalError e; + DBusConnection *conn = priv + ? dbus_connection_open_private(address, e) + : dbus_connection_open(address, e); + + if (e) throw Error(e); + + _pvt = new Private(conn); + + setup(default_dispatcher); + + debug_log("connected to %s", address); +} + +Connection::Connection(Connection::Private *p) +: _pvt(p) +{ + setup(default_dispatcher); +} + +Connection::Connection(const Connection &c) +: _pvt(c._pvt) +{ + dbus_connection_ref(_pvt->conn); +} + +Connection::~Connection() +{ + dbus_connection_unref(_pvt->conn); +} + +Dispatcher *Connection::setup(Dispatcher *dispatcher) +{ + debug_log("registering stubs for connection %p", _pvt->conn); + + if (!dispatcher) dispatcher = default_dispatcher; + + if (!dispatcher) throw ErrorFailed("no default dispatcher set for new connection"); + + Dispatcher *prev = _pvt->dispatcher; + + _pvt->dispatcher = dispatcher; + + dispatcher->queue_connection(_pvt.get()); + + dbus_connection_set_watch_functions( + _pvt->conn, + Dispatcher::Private::on_add_watch, + Dispatcher::Private::on_rem_watch, + Dispatcher::Private::on_toggle_watch, + dispatcher, + 0 + ); + + dbus_connection_set_timeout_functions( + _pvt->conn, + Dispatcher::Private::on_add_timeout, + Dispatcher::Private::on_rem_timeout, + Dispatcher::Private::on_toggle_timeout, + dispatcher, + 0 + ); + + return prev; +} + +bool Connection::operator == (const Connection &c) const +{ + return _pvt->conn == c._pvt->conn; +} + +bool Connection::register_bus() +{ + InternalError e; + + bool r = dbus_bus_register(_pvt->conn, e); + + if (e) throw (e); + + return r; +} + +bool Connection::connected() const +{ + return dbus_connection_get_is_connected(_pvt->conn); +} + +void Connection::disconnect() +{ +// dbus_connection_disconnect(_pvt->conn); // disappeared in 0.9x + dbus_connection_close(_pvt->conn); +} + +void Connection::exit_on_disconnect(bool exit) +{ + dbus_connection_set_exit_on_disconnect(_pvt->conn, exit); +} + +bool Connection::unique_name(const char *n) +{ + return dbus_bus_set_unique_name(_pvt->conn, n); +} + +const char *Connection::unique_name() const +{ + return dbus_bus_get_unique_name(_pvt->conn); +} + +void Connection::flush() +{ + dbus_connection_flush(_pvt->conn); +} + +void Connection::add_match(const char *rule) +{ + InternalError e; + + dbus_bus_add_match(_pvt->conn, rule, e); + + debug_log("%s: added match rule %s", unique_name(), rule); + + if (e) throw Error(e); +} + +void Connection::remove_match(const char *rule) +{ + InternalError e; + + dbus_bus_remove_match(_pvt->conn, rule, e); + + debug_log("%s: removed match rule %s", unique_name(), rule); + + if (e) throw Error(e); +} + +bool Connection::add_filter(MessageSlot &s) +{ + debug_log("%s: adding filter", unique_name()); + return dbus_connection_add_filter(_pvt->conn, Private::message_filter_stub, &s, NULL); +} + +void Connection::remove_filter(MessageSlot &s) +{ + debug_log("%s: removing filter", unique_name()); + dbus_connection_remove_filter(_pvt->conn, Private::message_filter_stub, &s); +} + +bool Connection::send(const Message &msg, unsigned int *serial) +{ + return dbus_connection_send(_pvt->conn, msg._pvt->msg, serial); +} + +Message Connection::send_blocking(Message &msg, int timeout) +{ + DBusMessage *reply; + InternalError e; + + reply = dbus_connection_send_with_reply_and_block(_pvt->conn, msg._pvt->msg, timeout, e); + + if (e) throw Error(e); + + return Message(new Message::Private(reply), false); +} + +PendingCall Connection::send_async(Message &msg, int timeout) +{ + DBusPendingCall *pending; + + if (!dbus_connection_send_with_reply(_pvt->conn, msg._pvt->msg, &pending, timeout)) + { + throw ErrorNoMemory("Unable to start asynchronous call"); + } + return PendingCall(new PendingCall::Private(pending)); +} + +void Connection::request_name(const char *name, int flags) +{ + InternalError e; + + debug_log("%s: registering bus name %s", unique_name(), name); + + dbus_bus_request_name(_pvt->conn, name, flags, e); //we deliberately don't check return value + + if (e) throw Error(e); + +// this->remove_match("destination"); + + if (name) + { + _pvt->names.push_back(name); + std::string match = "destination='" + _pvt->names.back() + "'"; + add_match(match.c_str()); + } +} + +bool Connection::has_name(const char *name) +{ + InternalError e; + + bool b = dbus_bus_name_has_owner(_pvt->conn, name, e); + + if (e) throw Error(e); + + return b; +} + +const std::vector<std::string>& Connection::names() +{ + return _pvt->names; +} + +bool Connection::start_service(const char *name, unsigned long flags) +{ + InternalError e; + + bool b = dbus_bus_start_service_by_name(_pvt->conn, name, flags, NULL, e); + + if (e) throw Error(e); + + return b; +} + diff --git a/libs/dbus-c++/src/connection_p.h b/libs/dbus-c++/src/connection_p.h new file mode 100644 index 0000000000000000000000000000000000000000..21643829b808faf4b891733eeb08e921b74b4e48 --- /dev/null +++ b/libs/dbus-c++/src/connection_p.h @@ -0,0 +1,73 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_CONNECTION_P_H +#define __DBUSXX_CONNECTION_P_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/connection.h> +#include <dbus-c++/server.h> +#include <dbus-c++/dispatcher.h> +#include <dbus-c++/refptr_impl.h> + +#include <dbus/dbus.h> + +#include <string> + +namespace DBus { + +struct DXXAPILOCAL Connection::Private +{ + DBusConnection * conn; + + std::vector<std::string> names; + + Dispatcher *dispatcher; + bool do_dispatch(); + + MessageSlot disconn_filter; + bool disconn_filter_function(const Message &); + + Server::Private *server; + void detach_server(); + + Private(DBusConnection *, Server::Private * = NULL); + + Private(DBusBusType); + + ~Private(); + + void init(); + + static void dispatch_status_stub(DBusConnection *, DBusDispatchStatus, void *); + + static DBusHandlerResult message_filter_stub(DBusConnection *, DBusMessage *, void *); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_CONNECTION_P_H diff --git a/libs/dbus-c++/src/debug.cpp b/libs/dbus-c++/src/debug.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4ca2c782ce57e4b6cebd888c58938c3c17c577b0 --- /dev/null +++ b/libs/dbus-c++/src/debug.cpp @@ -0,0 +1,53 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/debug.h> + +#include <stdarg.h> +#include <cstdio> +#include <stdlib.h> + +static void _debug_log_default(const char *format, ...) +{ +#ifdef DEBUG + + static int debug_env = getenv("DBUSXX_VERBOSE") ? 1 : 0; + + if (debug_env) + { + va_list args; + va_start(args, format); + + fprintf(stderr, "dbus-c++: "); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + + va_end(args); + } + +#endif//DEBUG +} + +DBus::LogFunction DBus::debug_log = _debug_log_default; + diff --git a/libs/dbus-c++/src/dispatcher.cpp b/libs/dbus-c++/src/dispatcher.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68c4412c3d5171e1452f43edbcd1aa0fff4cb364 --- /dev/null +++ b/libs/dbus-c++/src/dispatcher.cpp @@ -0,0 +1,245 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/dispatcher.h> + +#include <dbus/dbus.h> + +#include "dispatcher_p.h" +#include "server_p.h" +#include "connection_p.h" + +DBus::Dispatcher *DBus::default_dispatcher = NULL; + +using namespace DBus; + +Timeout::Timeout(Timeout::Internal *i) +: _int(i) +{ + dbus_timeout_set_data((DBusTimeout *)i, this, NULL); +} + +int Timeout::interval() const +{ + return dbus_timeout_get_interval((DBusTimeout *)_int); +} + +bool Timeout::enabled() const +{ + return dbus_timeout_get_enabled((DBusTimeout *)_int); +} + +bool Timeout::handle() +{ + return dbus_timeout_handle((DBusTimeout *)_int); +} + +/* +*/ + +Watch::Watch(Watch::Internal *i) +: _int(i) +{ + dbus_watch_set_data((DBusWatch *)i, this, NULL); +} + +int Watch::descriptor() const +{ + return dbus_watch_get_fd((DBusWatch *)_int); +} + +int Watch::flags() const +{ + return dbus_watch_get_flags((DBusWatch *)_int); +} + +bool Watch::enabled() const +{ + return dbus_watch_get_enabled((DBusWatch *)_int); +} + +bool Watch::handle(int flags) +{ + return dbus_watch_handle((DBusWatch *)_int, flags); +} + +/* +*/ + +dbus_bool_t Dispatcher::Private::on_add_watch(DBusWatch *watch, void *data) +{ + Dispatcher *d = static_cast<Dispatcher *>(data); + + Watch::Internal *w = reinterpret_cast<Watch::Internal *>(watch); + + d->add_watch(w); + + return true; +} + +void Dispatcher::Private::on_rem_watch(DBusWatch *watch, void *data) +{ + Dispatcher *d = static_cast<Dispatcher *>(data); + + Watch *w = static_cast<Watch *>(dbus_watch_get_data(watch)); + + d->rem_watch(w); +} + +void Dispatcher::Private::on_toggle_watch(DBusWatch *watch, void *data) +{ + Watch *w = static_cast<Watch *>(dbus_watch_get_data(watch)); + + w->toggle(); +} + +dbus_bool_t Dispatcher::Private::on_add_timeout(DBusTimeout *timeout, void *data) +{ + Dispatcher *d = static_cast<Dispatcher *>(data); + + Timeout::Internal *t = reinterpret_cast<Timeout::Internal *>(timeout); + + d->add_timeout(t); + + return true; +} + +void Dispatcher::Private::on_rem_timeout(DBusTimeout *timeout, void *data) +{ + Dispatcher *d = static_cast<Dispatcher *>(data); + + Timeout *t = static_cast<Timeout *>(dbus_timeout_get_data(timeout)); + + d->rem_timeout(t); +} + +void Dispatcher::Private::on_toggle_timeout(DBusTimeout *timeout, void *data) +{ + Timeout *t = static_cast<Timeout *>(dbus_timeout_get_data(timeout)); + + t->toggle(); +} + +void Dispatcher::queue_connection(Connection::Private *cp) +{ + _mutex_p.lock(); + _pending_queue.push_back(cp); + _mutex_p.unlock(); +} + +void Dispatcher::dispatch_pending() +{ + _mutex_p.lock(); + + while (_pending_queue.size() > 0) + { + Connection::PrivatePList::iterator i, j; + + i = _pending_queue.begin(); + + while (i != _pending_queue.end()) + { + j = i; + + ++j; + + if ((*i)->do_dispatch()) + _pending_queue.erase(i); + + i = j; + } + } + _mutex_p.unlock(); +} + +#ifdef DBUS_HAS_THREADS_INIT_DEFAULT +void DBus::_init_threading() +{ + dbus_threads_init_default(); +} +#endif//DBUS_HAS_THREADS_INIT_DEFAULT + +void DBus::_init_threading( + MutexNewFn m1, + MutexFreeFn m2, + MutexLockFn m3, + MutexUnlockFn m4, + CondVarNewFn c1, + CondVarFreeFn c2, + CondVarWaitFn c3, + CondVarWaitTimeoutFn c4, + CondVarWakeOneFn c5, + CondVarWakeAllFn c6 +) +{ +#ifndef DBUS_HAS_RECURSIVE_MUTEX + DBusThreadFunctions functions = { + DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK | + DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK | + DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK | + DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK| + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK, + (DBusMutexNewFunction) m1, + (DBusMutexFreeFunction) m2, + (DBusMutexLockFunction) m3, + (DBusMutexUnlockFunction) m4, + (DBusCondVarNewFunction) c1, + (DBusCondVarFreeFunction) c2, + (DBusCondVarWaitFunction) c3, + (DBusCondVarWaitTimeoutFunction) c4, + (DBusCondVarWakeOneFunction) c5, + (DBusCondVarWakeAllFunction) c6 + }; +#else + DBusThreadFunctions functions = { + DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK | + DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK | + DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK | + DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK| + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK, + 0, 0, 0, 0, + (DBusCondVarNewFunction) c1, + (DBusCondVarFreeFunction) c2, + (DBusCondVarWaitFunction) c3, + (DBusCondVarWaitTimeoutFunction) c4, + (DBusCondVarWakeOneFunction) c5, + (DBusCondVarWakeAllFunction) c6, + (DBusRecursiveMutexNewFunction) m1, + (DBusRecursiveMutexFreeFunction) m2, + (DBusRecursiveMutexLockFunction) m3, + (DBusRecursiveMutexUnlockFunction) m4 + }; +#endif//DBUS_HAS_RECURSIVE_MUTEX + dbus_threads_init(&functions); +} diff --git a/libs/dbus-c++/src/dispatcher_p.h b/libs/dbus-c++/src/dispatcher_p.h new file mode 100644 index 0000000000000000000000000000000000000000..ece33b7be80d8ef2cda3cf9a500674fc44d2b0a8 --- /dev/null +++ b/libs/dbus-c++/src/dispatcher_p.h @@ -0,0 +1,57 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_DISPATCHER_P_H +#define __DBUSXX_DISPATCHER_P_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/dispatcher.h> + +#include <dbus/dbus.h> + +#include "internalerror.h" + +namespace DBus { + +struct DXXAPILOCAL Dispatcher::Private +{ + static dbus_bool_t on_add_watch(DBusWatch *watch, void *data); + + static void on_rem_watch(DBusWatch *watch, void *data); + + static void on_toggle_watch(DBusWatch *watch, void *data); + + static dbus_bool_t on_add_timeout(DBusTimeout *timeout, void *data); + + static void on_rem_timeout(DBusTimeout *timeout, void *data); + + static void on_toggle_timeout(DBusTimeout *timeout, void *data); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_DISPATCHER_P_H diff --git a/libs/dbus-c++/src/error.cpp b/libs/dbus-c++/src/error.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23f7bec71b1e7d2b67176876a740b1215f910299 --- /dev/null +++ b/libs/dbus-c++/src/error.cpp @@ -0,0 +1,86 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/message.h> +#include <dbus-c++/error.h> + +#include <dbus/dbus.h> + +#include "message_p.h" +#include "internalerror.h" + +using namespace DBus; + +/* +*/ + +Error::Error() +: _int(new InternalError) +{} + +Error::Error(InternalError &i) +: _int(new InternalError(i)) +{} + +Error::Error(const char *name, const char *message) +: _int(new InternalError) +{ + set(name, message); +} + +Error::Error(Message &m) +: _int(new InternalError) +{ + dbus_set_error_from_message(&(_int->error), m._pvt->msg); +} + +Error::~Error() throw() +{ +} + +const char *Error::name() const +{ + return _int->error.name; +} + +const char *Error::message() const +{ + return _int->error.message; +} + +bool Error::is_set() const +{ + return *(_int); +} + +void Error::set(const char *name, const char *message) +{ + dbus_set_error_const(&(_int->error), name, message); +} + +const char *Error::what() const throw() +{ + return _int->error.message; +} + diff --git a/libs/dbus-c++/src/eventloop-integration.cpp b/libs/dbus-c++/src/eventloop-integration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b1075672e0cf8482ea6c2c230dd63880a1751e45 --- /dev/null +++ b/libs/dbus-c++/src/eventloop-integration.cpp @@ -0,0 +1,163 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/eventloop-integration.h> +#include <dbus-c++/debug.h> + +#include <sys/poll.h> + +#include <dbus/dbus.h> + +using namespace DBus; + +BusTimeout::BusTimeout(Timeout::Internal *ti, BusDispatcher *bd) +: Timeout(ti), DefaultTimeout(Timeout::interval(), true, bd) +{ + DefaultTimeout::enabled(Timeout::enabled()); +} + +void BusTimeout::toggle() +{ + debug_log("timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off"); + + DefaultTimeout::enabled(Timeout::enabled()); +} + +BusWatch::BusWatch(Watch::Internal *wi, BusDispatcher *bd) +: Watch(wi), DefaultWatch(Watch::descriptor(), 0, bd) +{ + int flags = POLLHUP | POLLERR; + + if (Watch::flags() & DBUS_WATCH_READABLE) + flags |= POLLIN; + if (Watch::flags() & DBUS_WATCH_WRITABLE) + flags |= POLLOUT; + + DefaultWatch::flags(flags); + DefaultWatch::enabled(Watch::enabled()); +} + +void BusWatch::toggle() +{ + debug_log("watch %p toggled (%s)", this, Watch::enabled() ? "on":"off"); + + DefaultWatch::enabled(Watch::enabled()); +} + +void BusDispatcher::enter() +{ + debug_log("entering dispatcher %p", this); + + _running = true; + + while (_running) + { + do_iteration(); + } + + debug_log("leaving dispatcher %p", this); +} + +void BusDispatcher::leave() +{ + _running = false; +} + +void BusDispatcher::do_iteration() +{ + dispatch_pending(); + dispatch(); +} + +Timeout *BusDispatcher::add_timeout(Timeout::Internal *ti) +{ + BusTimeout *bt = new BusTimeout(ti, this); + + bt->expired = new Callback<BusDispatcher, void, DefaultTimeout &>(this, &BusDispatcher::timeout_expired); + bt->data(bt); + + debug_log("added timeout %p (%s) interval=%d", + bt, ((Timeout *)bt)->enabled() ? "on":"off", ((Timeout *)bt)->interval()); + + return bt; +} + +void BusDispatcher::rem_timeout(Timeout *t) +{ + debug_log("removed timeout %p", t); + + delete t; +} + +Watch *BusDispatcher::add_watch(Watch::Internal *wi) +{ + BusWatch *bw = new BusWatch(wi, this); + + bw->ready = new Callback<BusDispatcher, void, DefaultWatch &>(this, &BusDispatcher::watch_ready); + bw->data(bw); + + debug_log("added watch %p (%s) fd=%d flags=%d", + bw, ((Watch *)bw)->enabled() ? "on":"off", ((Watch *)bw)->descriptor(), ((Watch *)bw)->flags()); + + return bw; +} + +void BusDispatcher::rem_watch(Watch *w) +{ + debug_log("removed watch %p", w); + + delete w; +} + +void BusDispatcher::timeout_expired(DefaultTimeout &et) +{ + debug_log("timeout %p expired", &et); + + BusTimeout *timeout = reinterpret_cast<BusTimeout *>(et.data()); + + timeout->handle(); +} + +void BusDispatcher::watch_ready(DefaultWatch &ew) +{ + BusWatch *watch = reinterpret_cast<BusWatch *>(ew.data()); + + debug_log("watch %p ready, flags=%d state=%d", + watch, ((Watch *)watch)->flags(), watch->state() + ); + + int flags = 0; + + if (watch->state() & POLLIN) + flags |= DBUS_WATCH_READABLE; + if (watch->state() & POLLOUT) + flags |= DBUS_WATCH_WRITABLE; + if (watch->state() & POLLHUP) + flags |= DBUS_WATCH_HANGUP; + if (watch->state() & POLLERR) + flags |= DBUS_WATCH_ERROR; + + watch->handle(flags); +} + diff --git a/libs/dbus-c++/src/eventloop.cpp b/libs/dbus-c++/src/eventloop.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d4aa2a19c44409eeb7b7d3161f3195633521c8d --- /dev/null +++ b/libs/dbus-c++/src/eventloop.cpp @@ -0,0 +1,227 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/eventloop.h> +#include <dbus-c++/debug.h> + +#include <sys/poll.h> +#include <sys/time.h> + +#include <dbus/dbus.h> + +using namespace DBus; + +static double millis(timeval tv) +{ + return (tv.tv_sec *1000.0 + tv.tv_usec/1000.0); +} + +DefaultTimeout::DefaultTimeout(int interval, bool repeat, DefaultMainLoop *ed) +: _enabled(true), _interval(interval), _repeat(repeat), _expiration(0), _data(0), _disp(ed) +{ + timeval now; + gettimeofday(&now, NULL); + + _expiration = millis(now) + interval; + + _disp->_mutex_t.lock(); + _disp->_timeouts.push_back(this); + _disp->_mutex_t.unlock(); +} + +DefaultTimeout::~DefaultTimeout() +{ + _disp->_mutex_t.lock(); + _disp->_timeouts.remove(this); + _disp->_mutex_t.unlock(); +} + +DefaultWatch::DefaultWatch(int fd, int flags, DefaultMainLoop *ed) +: _enabled(true), _fd(fd), _flags(flags), _state(0), _data(0), _disp(ed) +{ + _disp->_mutex_w.lock(); + _disp->_watches.push_back(this); + _disp->_mutex_w.unlock(); +} + +DefaultWatch::~DefaultWatch() +{ + _disp->_mutex_w.lock(); + _disp->_watches.remove(this); + _disp->_mutex_w.unlock(); +} + +DefaultMutex::DefaultMutex() +{ + pthread_mutex_init(&_mutex, NULL); +} + +DefaultMutex::~DefaultMutex() +{ + pthread_mutex_destroy(&_mutex); +} + +void DefaultMutex::lock() +{ + pthread_mutex_lock(&_mutex); +} + +void DefaultMutex::unlock() +{ + pthread_mutex_unlock(&_mutex); +} + +DefaultMainLoop::DefaultMainLoop() +{ +} + +DefaultMainLoop::~DefaultMainLoop() +{ + _mutex_w.lock(); + + DefaultWatches::iterator wi = _watches.begin(); + while (wi != _watches.end()) + { + DefaultWatches::iterator wmp = wi; + ++wmp; + _mutex_w.unlock(); + delete (*wi); + _mutex_w.lock(); + wi = wmp; + } + _mutex_w.unlock(); + + _mutex_t.lock(); + + DefaultTimeouts::iterator ti = _timeouts.begin(); + while (ti != _timeouts.end()) + { + DefaultTimeouts::iterator tmp = ti; + ++tmp; + _mutex_t.unlock(); + delete (*ti); + _mutex_t.lock(); + ti = tmp; + } + _mutex_t.unlock(); +} + +void DefaultMainLoop::dispatch() +{ + _mutex_w.lock(); + + int nfd = _watches.size(); + + pollfd fds[nfd]; + + DefaultWatches::iterator wi = _watches.begin(); + + for (nfd = 0; wi != _watches.end(); ++wi) + { + if ((*wi)->enabled()) + { + fds[nfd].fd = (*wi)->descriptor(); + fds[nfd].events = (*wi)->flags(); + fds[nfd].revents = 0; + + ++nfd; + } + } + _mutex_w.unlock(); + + int wait_min = 10000; + + DefaultTimeouts::iterator ti; + + _mutex_t.lock(); + + for (ti = _timeouts.begin(); ti != _timeouts.end(); ++ti) + { + if ((*ti)->enabled() && (*ti)->interval() < wait_min) + wait_min = (*ti)->interval(); + } + + _mutex_t.unlock(); + + poll(fds, nfd, wait_min); + + timeval now; + gettimeofday(&now, NULL); + + double now_millis = millis(now); + + _mutex_t.lock(); + + ti = _timeouts.begin(); + + while (ti != _timeouts.end()) + { + DefaultTimeouts::iterator tmp = ti; + ++tmp; + + if ((*ti)->enabled() && now_millis >= (*ti)->_expiration) + { + (*ti)->expired(*(*ti)); + + if ((*ti)->_repeat) + { + (*ti)->_expiration = now_millis + (*ti)->_interval; + } + + } + + ti = tmp; + } + + _mutex_t.unlock(); + + _mutex_w.lock(); + + for (int j = 0; j < nfd; ++j) + { + DefaultWatches::iterator wi; + + for (wi = _watches.begin(); wi != _watches.end();) + { + DefaultWatches::iterator tmp = wi; + ++tmp; + + if ((*wi)->enabled() && (*wi)->_fd == fds[j].fd) + { + if (fds[j].revents) + { + (*wi)->_state = fds[j].revents; + + (*wi)->ready(*(*wi)); + + fds[j].revents = 0; + } + } + + wi = tmp; + } + } + _mutex_w.unlock(); +} + diff --git a/libs/dbus-c++/src/glib-integration.cpp b/libs/dbus-c++/src/glib-integration.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bde3c7afe0937c43fe9407024e274f6c4120be5a --- /dev/null +++ b/libs/dbus-c++/src/glib-integration.cpp @@ -0,0 +1,225 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/glib-integration.h> + +#include <dbus/dbus.h> // for DBUS_WATCH_* + +using namespace DBus; + +Glib::BusTimeout::BusTimeout(Timeout::Internal *ti, GMainContext *ctx, int priority) +: Timeout(ti), _ctx(ctx), _priority(priority) +{ + _enable(); +} + +Glib::BusTimeout::~BusTimeout() +{ + _disable(); +} + +void Glib::BusTimeout::toggle() +{ + debug_log("glib: timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off"); + + if (Timeout::enabled()) _enable(); + else _disable(); +} + +gboolean Glib::BusTimeout::timeout_handler(gpointer data) +{ + Glib::BusTimeout *t = reinterpret_cast<Glib::BusTimeout *>(data); + + t->handle(); + + return TRUE; +} + +void Glib::BusTimeout::_enable() +{ + _source = g_timeout_source_new(Timeout::interval()); + g_source_set_priority(_source, _priority); + g_source_set_callback(_source, timeout_handler, this, NULL); + g_source_attach(_source, _ctx); +} + +void Glib::BusTimeout::_disable() +{ + g_source_destroy(_source); +} + +struct BusSource +{ + GSource source; + GPollFD poll; +}; + +static gboolean watch_prepare(GSource *source, gint *timeout) +{ +// debug_log("glib: watch_prepare"); + + *timeout = -1; + return FALSE; +} + +static gboolean watch_check(GSource *source) +{ +// debug_log("glib: watch_check"); + + BusSource *io = (BusSource *)source; + return io->poll.revents ? TRUE : FALSE; +} + +static gboolean watch_dispatch(GSource *source, GSourceFunc callback, gpointer data) +{ + debug_log("glib: watch_dispatch"); + + gboolean cb = callback(data); + DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers + return cb; +} + +static GSourceFuncs watch_funcs = { + watch_prepare, + watch_check, + watch_dispatch, + NULL +}; + +Glib::BusWatch::BusWatch(Watch::Internal *wi, GMainContext *ctx, int priority) +: Watch(wi), _ctx(ctx), _priority(priority) +{ + _enable(); +} + +Glib::BusWatch::~BusWatch() +{ + _disable(); +} + +void Glib::BusWatch::toggle() +{ + debug_log("glib: watch %p toggled (%s)", this, Watch::enabled() ? "on":"off"); + + if (Watch::enabled()) _enable(); + else _disable(); +} + +gboolean Glib::BusWatch::watch_handler(gpointer data) +{ + Glib::BusWatch *w = reinterpret_cast<Glib::BusWatch *>(data); + + BusSource *io = (BusSource *)(w->_source); + + int flags = 0; + if (io->poll.revents &G_IO_IN) + flags |= DBUS_WATCH_READABLE; + if (io->poll.revents &G_IO_OUT) + flags |= DBUS_WATCH_WRITABLE; + if (io->poll.revents &G_IO_ERR) + flags |= DBUS_WATCH_ERROR; + if (io->poll.revents &G_IO_HUP) + flags |= DBUS_WATCH_HANGUP; + + w->handle(flags); + + return TRUE; +} + +void Glib::BusWatch::_enable() +{ + _source = g_source_new(&watch_funcs, sizeof(BusSource)); + g_source_set_priority(_source, _priority); + g_source_set_callback(_source, watch_handler, this, NULL); + + int flags = Watch::flags(); + int condition = 0; + + if (flags &DBUS_WATCH_READABLE) + condition |= G_IO_IN; +// if (flags &DBUS_WATCH_WRITABLE) +// condition |= G_IO_OUT; + if (flags &DBUS_WATCH_ERROR) + condition |= G_IO_ERR; + if (flags &DBUS_WATCH_HANGUP) + condition |= G_IO_HUP; + + GPollFD *poll = &(((BusSource *)_source)->poll); + poll->fd = Watch::descriptor(); + poll->events = condition; + poll->revents = 0; + + g_source_add_poll(_source, poll); + g_source_attach(_source, _ctx); +} + +void Glib::BusWatch::_disable() +{ + GPollFD *poll = &(((BusSource *)_source)->poll); + g_source_remove_poll(_source, poll); + g_source_destroy(_source); +} + +void Glib::BusDispatcher::attach(GMainContext *ctx) +{ + _ctx = ctx ? ctx : g_main_context_default(); +} + +Timeout *Glib::BusDispatcher::add_timeout(Timeout::Internal *wi) +{ + Timeout *t = new Glib::BusTimeout(wi, _ctx, _priority); + + debug_log("glib: added timeout %p (%s)", t, t->enabled() ? "on":"off"); + + return t; +} + +void Glib::BusDispatcher::rem_timeout(Timeout *t) +{ + debug_log("glib: removed timeout %p", t); + + delete t; +} + +Watch *Glib::BusDispatcher::add_watch(Watch::Internal *wi) +{ + Watch *w = new Glib::BusWatch(wi, _ctx, _priority); + + debug_log("glib: added watch %p (%s) fd=%d flags=%d", + w, w->enabled() ? "on":"off", w->descriptor(), w->flags() + ); + return w; +} + +void Glib::BusDispatcher::rem_watch(Watch *w) +{ + debug_log("glib: removed watch %p", w); + + delete w; +} + +void Glib::BusDispatcher::set_priority(int priority) +{ + _priority = priority; +} diff --git a/libs/dbus-c++/src/interface.cpp b/libs/dbus-c++/src/interface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a47cf631c022cb6d81a248ba5de8c88a47f5457 --- /dev/null +++ b/libs/dbus-c++/src/interface.cpp @@ -0,0 +1,156 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/debug.h> +#include <dbus-c++/interface.h> + +#include "internalerror.h" + +using namespace DBus; + +Interface::Interface(const std::string &name) +: _name(name) +{} + +Interface::~Interface() +{} + +InterfaceAdaptor *AdaptorBase::find_interface(const std::string &name) +{ + InterfaceAdaptorTable::const_iterator ii = _interfaces.find(name); + + return ii != _interfaces.end() ? ii->second : NULL; +} + +InterfaceAdaptor::InterfaceAdaptor(const std::string &name) +: Interface(name) +{ + debug_log("adding interface %s", name.c_str()); + + _interfaces[name] = this; +} + +Message InterfaceAdaptor::dispatch_method(const CallMessage &msg) +{ + const char *name = msg.member(); + + MethodTable::iterator mi = _methods.find(name); + if (mi != _methods.end()) + { + return mi->second.call(msg); + } + else + { + return ErrorMessage(msg, DBUS_ERROR_UNKNOWN_METHOD, name); + } +} + +void InterfaceAdaptor::emit_signal(const SignalMessage &sig) +{ + SignalMessage &sig2 = const_cast<SignalMessage &>(sig); + + if (sig2.interface() == NULL) + sig2.interface(name().c_str()); + + _emit_signal(sig2); +} + +Variant *InterfaceAdaptor::get_property(const std::string &name) +{ + PropertyTable::iterator pti = _properties.find(name); + + if (pti != _properties.end()) + { + if (!pti->second.read) + throw ErrorAccessDenied("property is not readable"); + + return &(pti->second.value); + } + return NULL; +} + +void InterfaceAdaptor::set_property(const std::string &name, Variant &value) +{ + PropertyTable::iterator pti = _properties.find(name); + + if (pti != _properties.end()) + { + if (!pti->second.write) + throw ErrorAccessDenied("property is not writeable"); + + Signature sig = value.signature(); + + if (pti->second.sig != sig) + throw ErrorInvalidSignature("property expects a different type"); + + pti->second.value = value; + return; + } + throw ErrorFailed("requested property not found"); +} + +InterfaceProxy *ProxyBase::find_interface(const std::string &name) +{ + InterfaceProxyTable::const_iterator ii = _interfaces.find(name); + + return ii != _interfaces.end() ? ii->second : NULL; +} + +InterfaceProxy::InterfaceProxy(const std::string &name) +: Interface(name) +{ + debug_log("adding interface %s", name.c_str()); + + _interfaces[name] = this; +} + +bool InterfaceProxy::dispatch_signal(const SignalMessage &msg) +{ + const char *name = msg.member(); + + SignalTable::iterator si = _signals.find(name); + if (si != _signals.end()) + { + si->second.call(msg); + // Here we always return false because there might be + // another InterfaceProxy listening for the same signal. + // This way we instruct libdbus-1 to go on dispatching + // the signal. + return false; + } + else + { + return false; + } +} + +Message InterfaceProxy::invoke_method(const CallMessage &call) +{ + CallMessage &call2 = const_cast<CallMessage &>(call); + + if (call.interface() == NULL) + call2.interface(name().c_str()); + + return _invoke_method(call2); +} diff --git a/libs/dbus-c++/src/internalerror.h b/libs/dbus-c++/src/internalerror.h new file mode 100644 index 0000000000000000000000000000000000000000..1cc1fcaec14712a63e4ea06efb5ed1dd4406c386 --- /dev/null +++ b/libs/dbus-c++/src/internalerror.h @@ -0,0 +1,77 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_INTERNALERROR_H +#define __DBUSXX_INTERNALERROR_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/error.h> + +#include <dbus/dbus.h> + +namespace DBus { + +struct DXXAPI InternalError +{ + DBusError error; + + InternalError() + { + dbus_error_init(&error); + } + + explicit InternalError(DBusError *e) + { + dbus_error_init(&error); + dbus_move_error(e, &error); + } + + InternalError(const InternalError &ie) + { + dbus_error_init(&error); + dbus_move_error(const_cast<DBusError *>(&(ie.error)), &error); + } + + ~InternalError() + { + dbus_error_free(&error); + } + + operator DBusError *() + { + return &error; + } + + operator bool() + { + return dbus_error_is_set(&error); + } +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_INTERNALERROR_H diff --git a/libs/dbus-c++/src/introspection.cpp b/libs/dbus-c++/src/introspection.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88b61a14b245f284685a6a626a74755cea673247 --- /dev/null +++ b/libs/dbus-c++/src/introspection.cpp @@ -0,0 +1,190 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/introspection.h> +#include <dbus-c++/object.h> +#include <dbus-c++/message.h> + +#include <dbus/dbus.h> + +#include <sstream> + +using namespace DBus; + +static const char *introspectable_name = "org.freedesktop.DBus.Introspectable"; + +IntrospectableAdaptor::IntrospectableAdaptor() +: InterfaceAdaptor(introspectable_name) +{ + register_method(IntrospectableAdaptor, Introspect, Introspect); +} + +Message IntrospectableAdaptor::Introspect(const CallMessage &call) +{ + debug_log("requested introspection data"); + + std::ostringstream xml; + + xml << DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE; + + const std::string path = object()->path(); + + xml << "<node name=\"" << path << "\">"; + + InterfaceAdaptorTable::const_iterator iti; + + for (iti = _interfaces.begin(); iti != _interfaces.end(); ++iti) + { + debug_log("introspecting interface %s", iti->first.c_str()); + + IntrospectedInterface *const intro = iti->second->introspect(); + if (intro) + { + xml << "\n\t<interface name=\"" << intro->name << "\">"; + + for (const IntrospectedProperty *p = intro->properties; p->name; ++p) + { + std::string access; + + if (p->read) access += "read"; + if (p->write) access += "write"; + + xml << "\n\t\t<property name=\"" << p->name << "\"" + << " type=\"" << p->type << "\"" + << " access=\"" << access << "\"/>"; + } + + for (const IntrospectedMethod *m = intro->methods; m->args; ++m) + { + xml << "\n\t\t<method name=\"" << m->name << "\">"; + + for (const IntrospectedArgument *a = m->args; a->type; ++a) + { + xml << "\n\t\t\t<arg direction=\"" << (a->in ? "in" : "out") << "\"" + << " type=\"" << a->type << "\""; + + if (a->name) xml << " name=\"" << a->name << "\""; + + xml << "/>"; + } + + xml << "\n\t\t</method>"; + } + + for (const IntrospectedMethod *m = intro->signals; m->args; ++m) + { + xml << "\n\t\t<signal name=\"" << m->name << "\">"; + + for (const IntrospectedArgument *a = m->args; a->type; ++a) + { + xml << "<arg type=\"" << a->type << "\""; + + if (a->name) xml << " name=\"" << a->name << "\""; + + xml << "/>"; + } + xml << "\n\t\t</signal>"; + } + + xml << "\n\t</interface>"; + } + } + + const ObjectPathList nodes = ObjectAdaptor::child_nodes_from_prefix(path + '/'); + ObjectPathList::const_iterator oni; + + for (oni = nodes.begin(); oni != nodes.end(); ++oni) + { + xml << "\n\t<node name=\"" << (*oni) << "\"/>"; + } + + /* broken + const ObjectAdaptorPList children = ObjectAdaptor::from_path_prefix(path + '/'); + + ObjectAdaptorPList::const_iterator oci; + + for (oci = children.begin(); oci != children.end(); ++oci) + { + std::string name = (*oci)->path().substr(path.length()+1); + name.substr(name.find('/')); + + xml << "<node name=\"" << name << "\"/>"; + } + */ + + xml << "\n</node>"; + + ReturnMessage reply(call); + MessageIter wi = reply.writer(); + wi.append_string(xml.str().c_str()); + return reply; +} + +IntrospectedInterface *const IntrospectableAdaptor::introspect() const +{ + static IntrospectedArgument Introspect_args[] = + { + { "data", "s", false }, + { 0, 0, 0 } + }; + static IntrospectedMethod Introspectable_methods[] = + { + { "Introspect", Introspect_args }, + { 0, 0 } + }; + static IntrospectedMethod Introspectable_signals[] = + { + { 0, 0 } + }; + static IntrospectedProperty Introspectable_properties[] = + { + { 0, 0, 0, 0 } + }; + static IntrospectedInterface Introspectable_interface = + { + introspectable_name, + Introspectable_methods, + Introspectable_signals, + Introspectable_properties + }; + return &Introspectable_interface; +} + +IntrospectableProxy::IntrospectableProxy() +: InterfaceProxy(introspectable_name) +{} + +std::string IntrospectableProxy::Introspect() +{ + DBus::CallMessage call; + + call.member("Introspect"); + + DBus::Message ret = invoke_method(call); + + DBus::MessageIter ri = ret.reader(); + const char *str = ri.get_string(); + + return str; +} diff --git a/libs/dbus-c++/src/message.cpp b/libs/dbus-c++/src/message.cpp new file mode 100644 index 0000000000000000000000000000000000000000..119bff8e312b8325864ff8dfa98c1d1e0543cb43 --- /dev/null +++ b/libs/dbus-c++/src/message.cpp @@ -0,0 +1,639 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/message.h> + +#include <dbus/dbus.h> +#include <cstdlib> + +#include "internalerror.h" +#include "message_p.h" + +using namespace DBus; + +/* +*/ + +int MessageIter::type() +{ + return dbus_message_iter_get_arg_type((DBusMessageIter *)&_iter); +} + +bool MessageIter::at_end() +{ + return type() == DBUS_TYPE_INVALID; +} + +bool MessageIter::has_next() +{ + return dbus_message_iter_has_next((DBusMessageIter *)&_iter); +} + +MessageIter &MessageIter::operator ++() +{ + dbus_message_iter_next((DBusMessageIter *)&_iter); + return (*this); +} + +MessageIter MessageIter::operator ++(int) +{ + MessageIter copy(*this); + ++(*this); + return copy; +} + +bool MessageIter::append_basic(int type_id, void *value) +{ + return dbus_message_iter_append_basic((DBusMessageIter *)&_iter, type_id, value); +} + +void MessageIter::get_basic(int type_id, void *ptr) +{ + if (type() != type_id) + throw ErrorInvalidArgs("type mismatch"); + + dbus_message_iter_get_basic((DBusMessageIter *)_iter, ptr); +} + +bool MessageIter::append_byte(unsigned char b) +{ + return append_basic(DBUS_TYPE_BYTE, &b); +} + +unsigned char MessageIter::get_byte() +{ + unsigned char b; + get_basic(DBUS_TYPE_BYTE, &b); + return b; +} + +bool MessageIter::append_bool(bool b) +{ + dbus_bool_t db = b; + return append_basic(DBUS_TYPE_BOOLEAN, &db); +} + +bool MessageIter::get_bool() +{ + dbus_bool_t db; + get_basic(DBUS_TYPE_BOOLEAN, &db); + return (bool)db; +} + +bool MessageIter::append_int16(signed short i) +{ + return append_basic(DBUS_TYPE_INT16, &i); +} + +signed short MessageIter::get_int16() +{ + signed short i; + get_basic(DBUS_TYPE_INT16, &i); + return i; +} + +bool MessageIter::append_uint16(unsigned short u) +{ + return append_basic(DBUS_TYPE_UINT16, &u); +} + +unsigned short MessageIter::get_uint16() +{ + unsigned short u; + get_basic(DBUS_TYPE_UINT16, &u); + return u; +} + +bool MessageIter::append_int32(signed int i) +{ + return append_basic(DBUS_TYPE_INT32, &i); +} + +signed int MessageIter::get_int32() +{ + signed int i; + get_basic(DBUS_TYPE_INT32, &i); + return i; +} + +bool MessageIter::append_uint32(unsigned int u) +{ + return append_basic(DBUS_TYPE_UINT32, &u); +} + +unsigned int MessageIter::get_uint32() +{ + unsigned int u; + get_basic(DBUS_TYPE_UINT32, &u); + return u; +} + +signed long long MessageIter::get_int64() +{ + signed long long i; + get_basic(DBUS_TYPE_INT64, &i); + return i; +} + +bool MessageIter::append_int64(signed long long i) +{ + return append_basic(DBUS_TYPE_INT64, &i); +} + +unsigned long long MessageIter::get_uint64() +{ + unsigned long long u; + get_basic(DBUS_TYPE_UINT64, &u); + return u; +} + +bool MessageIter::append_uint64(unsigned long long u) +{ + return append_basic(DBUS_TYPE_UINT64, &u); +} + +double MessageIter::get_double() +{ + double d; + get_basic(DBUS_TYPE_DOUBLE, &d); + return d; +} + +bool MessageIter::append_double(double d) +{ + return append_basic(DBUS_TYPE_DOUBLE, &d); +} + +bool MessageIter::append_string(const char *chars) +{ + return append_basic(DBUS_TYPE_STRING, &chars); +} + +const char *MessageIter::get_string() +{ + char *chars; + get_basic(DBUS_TYPE_STRING, &chars); + return chars; +} + +bool MessageIter::append_path(const char *chars) +{ + return append_basic(DBUS_TYPE_OBJECT_PATH, &chars); +} + +const char *MessageIter::get_path() +{ + char *chars; + get_basic(DBUS_TYPE_OBJECT_PATH, &chars); + return chars; +} + +bool MessageIter::append_signature(const char *chars) +{ + return append_basic(DBUS_TYPE_SIGNATURE, &chars); +} + +const char *MessageIter::get_signature() +{ + char *chars; + get_basic(DBUS_TYPE_SIGNATURE, &chars); + return chars; +} + +MessageIter MessageIter::recurse() +{ + MessageIter iter(msg()); + dbus_message_iter_recurse((DBusMessageIter *)&_iter, (DBusMessageIter *)&(iter._iter)); + return iter; +} + +char *MessageIter::signature() const +{ + return dbus_message_iter_get_signature((DBusMessageIter *)&_iter); +} + +bool MessageIter::append_array(char type, const void *ptr, size_t length) +{ + return dbus_message_iter_append_fixed_array((DBusMessageIter *)&_iter, type, &ptr, length); +} + +int MessageIter::array_type() +{ + return dbus_message_iter_get_element_type((DBusMessageIter *)&_iter); +} + +int MessageIter::get_array(void *ptr) +{ + int length; + dbus_message_iter_get_fixed_array((DBusMessageIter *)&_iter, ptr, &length); + return length; +} + +bool MessageIter::is_array() +{ + return dbus_message_iter_get_arg_type((DBusMessageIter *)&_iter) == DBUS_TYPE_ARRAY; +} + +bool MessageIter::is_dict() +{ + return is_array() && dbus_message_iter_get_element_type((DBusMessageIter *)_iter) == DBUS_TYPE_DICT_ENTRY; +} + +MessageIter MessageIter::new_array(const char *sig) +{ + MessageIter arr(msg()); + dbus_message_iter_open_container( + (DBusMessageIter *)&_iter, DBUS_TYPE_ARRAY, sig, (DBusMessageIter *)&(arr._iter) + ); + return arr; +} + +MessageIter MessageIter::new_variant(const char *sig) +{ + MessageIter var(msg()); + dbus_message_iter_open_container( + (DBusMessageIter *)_iter, DBUS_TYPE_VARIANT, sig, (DBusMessageIter *)&(var._iter) + ); + return var; +} + +MessageIter MessageIter::new_struct() +{ + MessageIter stu(msg()); + dbus_message_iter_open_container( + (DBusMessageIter *)_iter, DBUS_TYPE_STRUCT, NULL, (DBusMessageIter *)&(stu._iter) + ); + return stu; +} + +MessageIter MessageIter::new_dict_entry() +{ + MessageIter ent(msg()); + dbus_message_iter_open_container( + (DBusMessageIter *)_iter, DBUS_TYPE_DICT_ENTRY, NULL, (DBusMessageIter *)&(ent._iter) + ); + return ent; +} + +void MessageIter::close_container(MessageIter &container) +{ + dbus_message_iter_close_container((DBusMessageIter *)&_iter, (DBusMessageIter *)&(container._iter)); +} + +static bool is_basic_type(int typecode) +{ + switch (typecode) + { + case 'y': + case 'b': + case 'n': + case 'q': + case 'i': + case 'u': + case 'x': + case 't': + case 'd': + case 's': + case 'o': + case 'g': + return true; + default: + return false; + } +} + +void MessageIter::copy_data(MessageIter &to) +{ + for (MessageIter &from = *this; !from.at_end(); ++from) + { + if (is_basic_type(from.type())) + { + debug_log("copying basic type: %c", from.type()); + + unsigned char value[8]; + from.get_basic(from.type(), &value); + to.append_basic(from.type(), &value); + } + else + { + MessageIter from_container = from.recurse(); + char *sig = from_container.signature(); + + debug_log("copying compound type: %c[%s]", from.type(), sig); + + MessageIter to_container (to.msg()); + dbus_message_iter_open_container + ( + (DBusMessageIter *)&(to._iter), + from.type(), + from.type() == DBUS_TYPE_VARIANT ? NULL : sig, + (DBusMessageIter *)&(to_container._iter) + ); + + from_container.copy_data(to_container); + to.close_container(to_container); + free(sig); + } + } +} + +/* +*/ + +Message::Message() +: _pvt(new Private) +{ +} + +Message::Message(Message::Private *p, bool incref) +: _pvt(p) +{ + if (_pvt->msg && incref) dbus_message_ref(_pvt->msg); +} + +Message::Message(const Message &m) +: _pvt(m._pvt) +{ + dbus_message_ref(_pvt->msg); +} + +Message::~Message() +{ + dbus_message_unref(_pvt->msg); +} + +Message &Message::operator = (const Message &m) +{ + if (&m != this) + { + dbus_message_unref(_pvt->msg); + _pvt = m._pvt; + dbus_message_ref(_pvt->msg); + } + return *this; +} + +Message Message::copy() +{ + Private *pvt = new Private(dbus_message_copy(_pvt->msg)); + return Message(pvt); +} + +bool Message::append(int first_type, ...) +{ + va_list vl; + va_start(vl, first_type); + + bool b = dbus_message_append_args_valist(_pvt->msg, first_type, vl); + + va_end(vl); + return b; +} + +void Message::terminate() +{ + dbus_message_append_args(_pvt->msg, DBUS_TYPE_INVALID); +} + +int Message::type() const +{ + return dbus_message_get_type(_pvt->msg); +} + +int Message::serial() const +{ + return dbus_message_get_serial(_pvt->msg); +} + +int Message::reply_serial() const +{ + return dbus_message_get_reply_serial(_pvt->msg); +} + +bool Message::reply_serial(int s) +{ + return dbus_message_set_reply_serial(_pvt->msg, s); +} + +const char *Message::sender() const +{ + return dbus_message_get_sender(_pvt->msg); +} + +bool Message::sender(const char *s) +{ + return dbus_message_set_sender(_pvt->msg, s); +} + +const char *Message::destination() const +{ + return dbus_message_get_destination(_pvt->msg); +} + +bool Message::destination(const char *s) +{ + return dbus_message_set_destination(_pvt->msg, s); +} + +bool Message::is_error() const +{ + return type() == DBUS_MESSAGE_TYPE_ERROR; +} + +bool Message::is_signal(const char *interface, const char *member) const +{ + return dbus_message_is_signal(_pvt->msg, interface, member); +} + +MessageIter Message::writer() +{ + MessageIter iter(*this); + dbus_message_iter_init_append(_pvt->msg, (DBusMessageIter *)&(iter._iter)); + return iter; +} + +MessageIter Message::reader() const +{ + MessageIter iter(const_cast<Message &>(*this)); + dbus_message_iter_init(_pvt->msg, (DBusMessageIter *)&(iter._iter)); + return iter; +} + +/* +*/ + +ErrorMessage::ErrorMessage() +{ + _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_ERROR); +} + +ErrorMessage::ErrorMessage(const Message &to_reply, const char *name, const char *message) +{ + _pvt->msg = dbus_message_new_error(to_reply._pvt->msg, name, message); +} + +bool ErrorMessage::operator == (const ErrorMessage &m) const +{ + return dbus_message_is_error(_pvt->msg, m.name()); +} + +const char *ErrorMessage::name() const +{ + return dbus_message_get_error_name(_pvt->msg); +} + +bool ErrorMessage::name(const char *n) +{ + return dbus_message_set_error_name(_pvt->msg, n); +} + +/* +*/ + +SignalMessage::SignalMessage(const char *name) +{ + _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL); + member(name); +} + +SignalMessage::SignalMessage(const char *path, const char *interface, const char *name) +{ + _pvt->msg = dbus_message_new_signal(path, interface, name); +} + +bool SignalMessage::operator == (const SignalMessage &m) const +{ + return dbus_message_is_signal(_pvt->msg, m.interface(), m.member()); +} + +const char *SignalMessage::interface() const +{ + return dbus_message_get_interface(_pvt->msg); +} + +bool SignalMessage::interface(const char *i) +{ + return dbus_message_set_interface(_pvt->msg, i); +} + +const char *SignalMessage::member() const +{ + return dbus_message_get_member(_pvt->msg); +} + +bool SignalMessage::member(const char *m) +{ + return dbus_message_set_member(_pvt->msg, m); +} + +const char *SignalMessage::path() const +{ + return dbus_message_get_path(_pvt->msg); +} + +char ** SignalMessage::path_split() const +{ + char ** p; + dbus_message_get_path_decomposed(_pvt->msg, &p); //todo: return as a std::vector ? + return p; +} + +bool SignalMessage::path(const char *p) +{ + return dbus_message_set_path(_pvt->msg, p); +} + +/* +*/ + +CallMessage::CallMessage() +{ + _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL); +} + +CallMessage::CallMessage(const char *dest, const char *path, const char *iface, const char *method) +{ + _pvt->msg = dbus_message_new_method_call(dest, path, iface, method); +} + +bool CallMessage::operator == (const CallMessage &m) const +{ + return dbus_message_is_method_call(_pvt->msg, m.interface(), m.member()); +} + +const char *CallMessage::interface() const +{ + return dbus_message_get_interface(_pvt->msg); +} + +bool CallMessage::interface(const char *i) +{ + return dbus_message_set_interface(_pvt->msg, i); +} + +const char *CallMessage::member() const +{ + return dbus_message_get_member(_pvt->msg); +} + +bool CallMessage::member(const char *m) +{ + return dbus_message_set_member(_pvt->msg, m); +} + +const char *CallMessage::path() const +{ + return dbus_message_get_path(_pvt->msg); +} + +char ** CallMessage::path_split() const +{ + char ** p; + dbus_message_get_path_decomposed(_pvt->msg, &p); + return p; +} + +bool CallMessage::path(const char *p) +{ + return dbus_message_set_path(_pvt->msg, p); +} + +const char *CallMessage::signature() const +{ + return dbus_message_get_signature(_pvt->msg); +} + +/* +*/ + +ReturnMessage::ReturnMessage(const CallMessage &callee) +{ + _pvt = new Private(dbus_message_new_method_return(callee._pvt->msg)); +} + +const char *ReturnMessage::signature() const +{ + return dbus_message_get_signature(_pvt->msg); +} + diff --git a/libs/dbus-c++/src/message_p.h b/libs/dbus-c++/src/message_p.h new file mode 100644 index 0000000000000000000000000000000000000000..af421bc10ed81493f4b814d0a996737891ec602c --- /dev/null +++ b/libs/dbus-c++/src/message_p.h @@ -0,0 +1,52 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_MESSAGE_P_H +#define __DBUSXX_MESSAGE_P_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/message.h> +#include <dbus-c++/refptr_impl.h> + +#include <dbus/dbus.h> + +namespace DBus { + +struct DXXAPILOCAL Message::Private +{ + DBusMessage *msg; + + Private() : msg(0) + {} + + Private(DBusMessage *m) : msg(m) + {} +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_MESSAGE_P_H diff --git a/libs/dbus-c++/src/object.cpp b/libs/dbus-c++/src/object.cpp new file mode 100644 index 0000000000000000000000000000000000000000..970fcf7b28269fccb6498463bb0ee1865eb6566a --- /dev/null +++ b/libs/dbus-c++/src/object.cpp @@ -0,0 +1,363 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/debug.h> +#include <dbus-c++/object.h> +#include "internalerror.h" + +#include <cstring> +#include <map> +#include <dbus/dbus.h> + +#include "message_p.h" +#include "server_p.h" +#include "connection_p.h" + +using namespace DBus; + +Object::Object(Connection &conn, const Path &path, const char *service) +: _conn(conn), _path(path), _service(service ? service : "") +{ +} + +Object::~Object() +{ +} + +struct ObjectAdaptor::Private +{ + static void unregister_function_stub(DBusConnection *, void *); + static DBusHandlerResult message_function_stub(DBusConnection *, DBusMessage *, void *); +}; + +static DBusObjectPathVTable _vtable = +{ + ObjectAdaptor::Private::unregister_function_stub, + ObjectAdaptor::Private::message_function_stub, + NULL, NULL, NULL, NULL +}; + +void ObjectAdaptor::Private::unregister_function_stub(DBusConnection *conn, void *data) +{ + //TODO: what do we have to do here ? +} + +DBusHandlerResult ObjectAdaptor::Private::message_function_stub(DBusConnection *, DBusMessage *dmsg, void *data) +{ + ObjectAdaptor *o = static_cast<ObjectAdaptor *>(data); + + if (o) + { + Message msg(new Message::Private(dmsg)); + + debug_log("in object %s", o->path().c_str()); + debug_log(" got message #%d from %s to %s", + msg.serial(), + msg.sender(), + msg.destination() + ); + + return o->handle_message(msg) + ? DBUS_HANDLER_RESULT_HANDLED + : DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + else + { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } +} + +typedef std::map<Path, ObjectAdaptor *> ObjectAdaptorTable; +static ObjectAdaptorTable _adaptor_table; + +ObjectAdaptor *ObjectAdaptor::from_path(const Path &path) +{ + ObjectAdaptorTable::iterator ati = _adaptor_table.find(path); + + if (ati != _adaptor_table.end()) + return ati->second; + + return NULL; +} + +ObjectAdaptorPList ObjectAdaptor::from_path_prefix(const std::string &prefix) +{ + ObjectAdaptorPList ali; + + ObjectAdaptorTable::iterator ati = _adaptor_table.begin(); + + size_t plen = prefix.length(); + + while (ati != _adaptor_table.end()) + { + if (!strncmp(ati->second->path().c_str(), prefix.c_str(), plen)) + ali.push_back(ati->second); + + ++ati; + } + + return ali; +} + +ObjectPathList ObjectAdaptor::child_nodes_from_prefix(const std::string &prefix) +{ + ObjectPathList ali; + + ObjectAdaptorTable::iterator ati = _adaptor_table.begin(); + + size_t plen = prefix.length(); + + while (ati != _adaptor_table.end()) + { + if (!strncmp(ati->second->path().c_str(), prefix.c_str(), plen)) + { + std::string p = ati->second->path().substr(plen); + p = p.substr(0,p.find('/')); + ali.push_back(p); + } + ++ati; + } + + ali.sort(); + ali.unique(); + + return ali; +} + +ObjectAdaptor::ObjectAdaptor(Connection &conn, const Path &path) +: Object(conn, path, conn.unique_name()) +{ + register_obj(); +} + +ObjectAdaptor::~ObjectAdaptor() +{ + unregister_obj(); +} + +void ObjectAdaptor::register_obj() +{ + debug_log("registering local object %s", path().c_str()); + + if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_str(), &_vtable, this)) + { + throw ErrorNoMemory("unable to register object path"); + } + + _adaptor_table[path()] = this; +} + +void ObjectAdaptor::unregister_obj() +{ + _adaptor_table.erase(path()); + + debug_log("unregistering local object %s", path().c_str()); + + dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str()); +} + +void ObjectAdaptor::_emit_signal(SignalMessage &sig) +{ + sig.path(path().c_str()); + + conn().send(sig); +} + +struct ReturnLaterError +{ + const Tag *tag; +}; + +bool ObjectAdaptor::handle_message(const Message &msg) +{ + switch (msg.type()) + { + case DBUS_MESSAGE_TYPE_METHOD_CALL: + { + const CallMessage &cmsg = reinterpret_cast<const CallMessage &>(msg); + const char *member = cmsg.member(); + const char *interface = cmsg.interface(); + + debug_log(" invoking method %s.%s", interface, member); + + InterfaceAdaptor *ii = find_interface(interface); + if (ii) + { + try + { + Message ret = ii->dispatch_method(cmsg); + conn().send(ret); + } + catch(Error &e) + { + ErrorMessage em(cmsg, e.name(), e.message()); + conn().send(em); + } + catch(ReturnLaterError &rle) + { + _continuations[rle.tag] = new Continuation(conn(), cmsg, rle.tag); + } + return true; + } + else + { + return false; + } + } + default: + { + return false; + } + } +} + +void ObjectAdaptor::return_later(const Tag *tag) +{ + ReturnLaterError rle = { tag }; + throw rle; +} + +void ObjectAdaptor::return_now(Continuation *ret) +{ + ret->_conn.send(ret->_return); + + ContinuationMap::iterator di = _continuations.find(ret->_tag); + + delete di->second; + + _continuations.erase(di); +} + +void ObjectAdaptor::return_error(Continuation *ret, const Error error) +{ + ret->_conn.send(ErrorMessage(ret->_call, error.name(), error.message())); + + ContinuationMap::iterator di = _continuations.find(ret->_tag); + + delete di->second; + + _continuations.erase(di); +} + +ObjectAdaptor::Continuation *ObjectAdaptor::find_continuation(const Tag *tag) +{ + ContinuationMap::iterator di = _continuations.find(tag); + + return di != _continuations.end() ? di->second : NULL; +} + +ObjectAdaptor::Continuation::Continuation(Connection &conn, const CallMessage &call, const Tag *tag) +: _conn(conn), _call(call), _return(_call), _tag(tag) +{ + _writer = _return.writer(); //todo: verify +} + +/* +*/ + +ObjectProxy::ObjectProxy(Connection &conn, const Path &path, const char *service) +: Object(conn, path, service) +{ + register_obj(); +} + +ObjectProxy::~ObjectProxy() +{ + unregister_obj(); +} + +void ObjectProxy::register_obj() +{ + debug_log("registering remote object %s", path().c_str()); + + _filtered = new Callback<ObjectProxy, bool, const Message &>(this, &ObjectProxy::handle_message); + + conn().add_filter(_filtered); + + InterfaceProxyTable::const_iterator ii = _interfaces.begin(); + while (ii != _interfaces.end()) + { + std::string im = "type='signal',interface='"+ii->first+"',path='"+path()+"'"; + conn().add_match(im.c_str()); + ++ii; + } +} + +void ObjectProxy::unregister_obj() +{ + debug_log("unregistering remote object %s", path().c_str()); + + InterfaceProxyTable::const_iterator ii = _interfaces.begin(); + while (ii != _interfaces.end()) + { + std::string im = "type='signal',interface='"+ii->first+"',path='"+path()+"'"; + conn().remove_match(im.c_str()); + ++ii; + } + conn().remove_filter(_filtered); +} + +Message ObjectProxy::_invoke_method(CallMessage &call) +{ + if (call.path() == NULL) + call.path(path().c_str()); + + if (call.destination() == NULL) + call.destination(service().c_str()); + + return conn().send_blocking(call); +} + +bool ObjectProxy::handle_message(const Message &msg) +{ + switch (msg.type()) + { + case DBUS_MESSAGE_TYPE_SIGNAL: + { + const SignalMessage &smsg = reinterpret_cast<const SignalMessage &>(msg); + const char *interface = smsg.interface(); + const char *member = smsg.member(); + const char *objpath = smsg.path(); + + if (objpath != path()) return false; + + debug_log("filtered signal %s(in %s) from %s to object %s", + member, interface, msg.sender(), objpath); + + InterfaceProxy *ii = find_interface(interface); + if (ii) + { + return ii->dispatch_signal(smsg); + } + else + { + return false; + } + } + default: + { + return false; + } + } +} diff --git a/libs/dbus-c++/src/pendingcall.cpp b/libs/dbus-c++/src/pendingcall.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e55c174be575db3d632135e1209471b3c1d95a73 --- /dev/null +++ b/libs/dbus-c++/src/pendingcall.cpp @@ -0,0 +1,139 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/pendingcall.h> + +#include <dbus/dbus.h> + +#include "internalerror.h" +#include "pendingcall_p.h" +#include "message_p.h" + +using namespace DBus; + +PendingCall::Private::Private(DBusPendingCall *dpc) +: call(dpc), dataslot(-1) +{ + if (!dbus_pending_call_allocate_data_slot(&dataslot)) + { + throw ErrorNoMemory("Unable to allocate data slot"); + } +} + +PendingCall::Private::~Private() +{ + if (dataslot != -1) + { + dbus_pending_call_allocate_data_slot(&dataslot); + } +} + +void PendingCall::Private::notify_stub(DBusPendingCall *dpc, void *data) +{ + PendingCall::Private *pvt = static_cast<PendingCall::Private *>(data); + + PendingCall pc(pvt); + pvt->slot(pc); +} + +PendingCall::PendingCall(PendingCall::Private *p) +: _pvt(p) +{ + if (!dbus_pending_call_set_notify(_pvt->call, Private::notify_stub, p, NULL)) + { + throw ErrorNoMemory("Unable to initialize pending call"); + } +} + +PendingCall::PendingCall(const PendingCall &c) +: _pvt(c._pvt) +{ + dbus_pending_call_ref(_pvt->call); +} + +PendingCall::~PendingCall() +{ + dbus_pending_call_unref(_pvt->call); +} + +PendingCall &PendingCall::operator = (const PendingCall &c) +{ + if (&c != this) + { + dbus_pending_call_unref(_pvt->call); + _pvt = c._pvt; + dbus_pending_call_ref(_pvt->call); + } + return *this; +} + +bool PendingCall::completed() +{ + return dbus_pending_call_get_completed(_pvt->call); +} + +void PendingCall::cancel() +{ + dbus_pending_call_cancel(_pvt->call); +} + +void PendingCall::block() +{ + dbus_pending_call_block(_pvt->call); +} + +void PendingCall::data(void *p) +{ + if (!dbus_pending_call_set_data(_pvt->call, _pvt->dataslot, p, NULL)) + { + throw ErrorNoMemory("Unable to initialize data slot"); + } +} + +void *PendingCall::data() +{ + return dbus_pending_call_get_data(_pvt->call, _pvt->dataslot); +} + +Slot<void, PendingCall &>& PendingCall::slot() +{ + return _pvt->slot; +} + +Message PendingCall::steal_reply() +{ + DBusMessage *dmsg = dbus_pending_call_steal_reply(_pvt->call); + if (!dmsg) + { + dbus_bool_t callComplete = dbus_pending_call_get_completed(_pvt->call); + + if (callComplete) + throw ErrorNoReply("No reply available"); + else + throw ErrorNoReply("Call not complete"); + } + + return Message(new Message::Private(dmsg)); +} + diff --git a/libs/dbus-c++/src/pendingcall_p.h b/libs/dbus-c++/src/pendingcall_p.h new file mode 100644 index 0000000000000000000000000000000000000000..1768b52da544ecd101c848af7b3f5becbc4872bf --- /dev/null +++ b/libs/dbus-c++/src/pendingcall_p.h @@ -0,0 +1,54 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_PENDING_CALL_P_H +#define __DBUSXX_PENDING_CALL_P_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/pendingcall.h> +#include <dbus-c++/refptr_impl.h> + +#include <dbus/dbus.h> + +namespace DBus { + +struct DXXAPILOCAL PendingCall::Private +{ + DBusPendingCall *call; + int dataslot; + Slot<void, PendingCall &> slot; + + Private(DBusPendingCall *); + + ~Private(); + + static void notify_stub(DBusPendingCall *dpc, void *data); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_PENDING_CALL_P_H diff --git a/libs/dbus-c++/src/property.cpp b/libs/dbus-c++/src/property.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1bf6c6b1f0132e2985b89bccfb3629e35cd5a669 --- /dev/null +++ b/libs/dbus-c++/src/property.cpp @@ -0,0 +1,151 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include <dbus-c++/debug.h> +#include <dbus-c++/property.h> + +#include <dbus-c++/introspection.h> + +using namespace DBus; + +static const char *properties_name = "org.freedesktop.DBus.Properties"; + +PropertiesAdaptor::PropertiesAdaptor() +: InterfaceAdaptor(properties_name) +{ + register_method(PropertiesAdaptor, Get, Get); + register_method(PropertiesAdaptor, Set, Set); +} + +Message PropertiesAdaptor::Get(const CallMessage &call) +{ + MessageIter ri = call.reader(); + + std::string iface_name; + std::string property_name; + + ri >> iface_name >> property_name; + + debug_log("requesting property %s on interface %s", property_name.c_str(), iface_name.c_str()); + + InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name); + + if (!interface) + throw ErrorFailed("requested interface not found"); + + Variant *value = interface->get_property(property_name); + + if (!value) + throw ErrorFailed("requested property not found"); + + on_get_property(*interface, property_name, *value); + + ReturnMessage reply(call); + + MessageIter wi = reply.writer(); + + wi << *value; + return reply; +} + +Message PropertiesAdaptor::Set(const CallMessage &call) +{ + MessageIter ri = call.reader(); + + std::string iface_name; + std::string property_name; + Variant value; + + ri >> iface_name >> property_name >> value; + + InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name); + + if (!interface) + throw ErrorFailed("requested interface not found"); + + on_set_property(*interface, property_name, value); + + interface->set_property(property_name, value); + + ReturnMessage reply(call); + + return reply; +} + +IntrospectedInterface *const PropertiesAdaptor::introspect() const +{ + static IntrospectedArgument Get_args[] = + { + { "interface_name", "s", true }, + { "property_name", "s", true }, + { "value", "v", false }, + { 0, 0, 0 } + }; + static IntrospectedArgument Set_args[] = + { + { "interface_name", "s", true }, + { "property_name", "s", true }, + { "value", "v", true }, + { 0, 0, 0 } + }; + static IntrospectedMethod Properties_methods[] = + { + { "Get", Get_args }, + { "Set", Set_args }, + { 0, 0 } + }; + static IntrospectedMethod Properties_signals[] = + { + { 0, 0 } + }; + static IntrospectedProperty Properties_properties[] = + { + { 0, 0, 0, 0 } + }; + static IntrospectedInterface Properties_interface = + { + properties_name, + Properties_methods, + Properties_signals, + Properties_properties + }; + return &Properties_interface; +} + +PropertiesProxy::PropertiesProxy() +: InterfaceProxy(properties_name) +{ +} + +Variant PropertiesProxy::Get(const std::string &iface, const std::string &property) +{ +//todo + Variant v; + return v; +} + +void PropertiesProxy::Set(const std::string &iface, const std::string &property, const Variant &value) +{ +//todo +} + diff --git a/libs/dbus-c++/src/server.cpp b/libs/dbus-c++/src/server.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eae46d664c7f3be0d6416f15fa5d04a48b4de2bd --- /dev/null +++ b/libs/dbus-c++/src/server.cpp @@ -0,0 +1,126 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/debug.h> +#include <dbus-c++/server.h> + +#include "internalerror.h" +#include "server_p.h" +#include "connection_p.h" +#include "dispatcher_p.h" + +using namespace DBus; + +Server::Private::Private(DBusServer *s) +: server(s) +{ +} + +Server::Private::~Private() +{ +} + +void Server::Private::on_new_conn_cb(DBusServer *server, DBusConnection *conn, void *data) +{ + Server *s = static_cast<Server *>(data); + + Connection nc (new Connection::Private(conn, s->_pvt.get())); + + s->_pvt->connections.push_back(nc); + + s->on_new_connection(nc); + + debug_log("incoming connection 0x%08x", conn); +} + +Server::Server(const char *address) +{ + InternalError e; + DBusServer *server = dbus_server_listen(address, e); + + if (e) throw Error(e); + + debug_log("server 0x%08x listening on %s", server, address); + + _pvt = new Private(server); + + dbus_server_set_new_connection_function(_pvt->server, Private::on_new_conn_cb, this, NULL); + + setup(default_dispatcher); +} +/* +Server::Server(const Server &s) +: _pvt(s._pvt) +{ + dbus_server_ref(_pvt->server); +} +*/ +Server::~Server() +{ + dbus_server_unref(_pvt->server); +} + +Dispatcher *Server::setup(Dispatcher *dispatcher) +{ + debug_log("registering stubs for server %p", _pvt->server); + + Dispatcher *prev = _pvt->dispatcher; + + dbus_server_set_watch_functions( + _pvt->server, + Dispatcher::Private::on_add_watch, + Dispatcher::Private::on_rem_watch, + Dispatcher::Private::on_toggle_watch, + dispatcher, + 0 + ); + + dbus_server_set_timeout_functions( + _pvt->server, + Dispatcher::Private::on_add_timeout, + Dispatcher::Private::on_rem_timeout, + Dispatcher::Private::on_toggle_timeout, + dispatcher, + 0 + ); + + _pvt->dispatcher = dispatcher; + + return prev; +} + +bool Server::operator == (const Server &s) const +{ + return _pvt->server == s._pvt->server; +} + +bool Server::listening() const +{ + return dbus_server_get_is_connected(_pvt->server); +} +void Server::disconnect() +{ + dbus_server_disconnect(_pvt->server); +} + diff --git a/libs/dbus-c++/src/server_p.h b/libs/dbus-c++/src/server_p.h new file mode 100644 index 0000000000000000000000000000000000000000..6264ebf4d5db282e6d43ad4877b1557e78ed1c4b --- /dev/null +++ b/libs/dbus-c++/src/server_p.h @@ -0,0 +1,57 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_SERVER_P_H +#define __DBUSXX_SERVER_P_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/server.h> +#include <dbus-c++/dispatcher.h> +#include <dbus-c++/refptr_impl.h> + +#include <dbus/dbus.h> + +namespace DBus { + +struct DXXAPILOCAL Server::Private +{ + DBusServer *server; + + Dispatcher *dispatcher; + + ConnectionList connections; + + Private(DBusServer *); + + ~Private(); + + static void on_new_conn_cb(DBusServer *server, DBusConnection *conn, void *data); +}; + +} /* namespace DBus */ + +#endif//__DBUSXX_SERVER_P_H diff --git a/libs/dbus-c++/src/types.cpp b/libs/dbus-c++/src/types.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a144f789dbb7d29b323ad03299725a45eb45f5f9 --- /dev/null +++ b/libs/dbus-c++/src/types.cpp @@ -0,0 +1,103 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include <dbus-c++/types.h> +#include <dbus-c++/object.h> +#include <dbus/dbus.h> +#include <cstdlib> +#include <stdarg.h> + +#include "message_p.h" +#include "internalerror.h" + +using namespace DBus; + +Variant::Variant() +: _msg(CallMessage()) // dummy message used as temporary storage for variant data +{ +} + +Variant::Variant(MessageIter &it) +: _msg(CallMessage()) +{ + MessageIter vi = it.recurse(); + MessageIter mi = _msg.writer(); + vi.copy_data(mi); +} + +Variant &Variant::operator = (const Variant &v) +{ + if (&v != this) + { + _msg = v._msg; + } + return *this; +} + +void Variant::clear() +{ + CallMessage empty; + _msg = empty; +} + +const Signature Variant::signature() const +{ + char *sigbuf = reader().signature(); + + Signature signature = sigbuf; + + free(sigbuf); + + return signature; +} + +MessageIter &operator << (MessageIter &iter, const Variant &val) +{ + const Signature sig = val.signature(); + + MessageIter rit = val.reader(); + MessageIter wit = iter.new_variant(sig.c_str()); + + rit.copy_data(wit); + + iter.close_container(wit); + + return iter; +} + +MessageIter &operator >> (MessageIter &iter, Variant &val) +{ + if (iter.type() != DBUS_TYPE_VARIANT) + throw ErrorInvalidArgs("variant type expected"); + + val.clear(); + + MessageIter vit = iter.recurse(); + MessageIter mit = val.writer(); + + vit.copy_data(mit); + + return ++iter; +} + diff --git a/libs/dbus-c++/tools/Makefile.am b/libs/dbus-c++/tools/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..8ee021cf20fab1fe9432016d0a05df97be527f9e --- /dev/null +++ b/libs/dbus-c++/tools/Makefile.am @@ -0,0 +1,26 @@ +# hacky, but ... + +CXX = $(CXX_FOR_BUILD) + +AM_CPPFLAGS = \ + $(dbus_CFLAGS) \ + $(xml_CFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include + +if CROSS_COMPILING +libdbus_cxx_la = $(BUILD_LIBDBUS_CXX_DIR)/src/libdbus-c++-1.la +else +libdbus_cxx_la = $(top_builddir)/src/libdbus-c++-1.la +endif + +bin_PROGRAMS = dbusxx-xml2cpp dbusxx-introspect + +dbusxx_xml2cpp_SOURCES = xml.h xml.cpp xml2cpp.h xml2cpp.cpp +dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la) $(xml_LIBS) + +dbusxx_introspect_SOURCES = introspect.h introspect.cpp +dbusxx_introspect_LDADD = $(libdbus_cxx_la) + +MAINTAINERCLEANFILES = \ + Makefile.in diff --git a/libs/dbus-c++/tools/introspect.cpp b/libs/dbus-c++/tools/introspect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ce9f3a74c6c6faa4183164df49983789df8e0c1 --- /dev/null +++ b/libs/dbus-c++/tools/introspect.cpp @@ -0,0 +1,79 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include <cstring> +#include <signal.h> +#include <unistd.h> +#include <iostream> +#include "introspect.h" + +DBus::BusDispatcher dispatcher; +static bool systembus; +static char *path; +static char *service; + +void niam(int sig) +{ + DBus::Connection conn = systembus ? DBus::Connection::SystemBus() : DBus::Connection::SessionBus(); + + IntrospectedObject io(conn, path, service); + + std::cout << io.Introspect(); + + dispatcher.leave(); +} + +int main(int argc, char ** argv) +{ + signal(SIGTERM, niam); + signal(SIGINT, niam); + signal(SIGALRM, niam); + + if (argc == 1) + { + std::cerr << std::endl << "Usage: " << argv[0] << " [--system] <object_path> [<destination>]" << std::endl << std::endl; + } + else + { + if (strcmp(argv[1], "--system")) + { + systembus = false; + path = argv[1]; + service = argc > 2 ? argv[2] : 0; + } + else + { + systembus = true; + path = argv[2]; + service = argc > 3 ? argv[3] : 0; + } + + DBus::default_dispatcher = &dispatcher; + + alarm(1); + + dispatcher.enter(); + } + + return 0; +} diff --git a/libs/dbus-c++/tools/introspect.h b/libs/dbus-c++/tools/introspect.h new file mode 100644 index 0000000000000000000000000000000000000000..1c6e3264140ec507f9b5ec0d985e50cc48dd361c --- /dev/null +++ b/libs/dbus-c++/tools/introspect.h @@ -0,0 +1,44 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_TOOLS_INTROSPECT_H +#define __DBUSXX_TOOLS_INTROSPECT_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/dbus.h> +#include <string> + +class IntrospectedObject : public DBus::IntrospectableProxy, public DBus::ObjectProxy +{ +public: + + IntrospectedObject(DBus::Connection &conn, const char *path, const char *service) + : DBus::ObjectProxy(conn, path, service) + {} +}; + +#endif//__DBUSXX_TOOLS_INTROSPECT_H diff --git a/libs/dbus-c++/tools/xml.cpp b/libs/dbus-c++/tools/xml.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68ae5a64da68080330b5985673243a02a5dcf400 --- /dev/null +++ b/libs/dbus-c++/tools/xml.cpp @@ -0,0 +1,315 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include "xml.h" + +#include <dbus-c++/debug.h> + +#include <expat.h> + +std::istream &operator >> (std::istream &in, DBus::Xml::Document &doc) +{ + std::stringbuf xmlbuf; + in.get(xmlbuf, '\0'); + doc.from_xml(xmlbuf.str()); + + return in; +} + +std::ostream &operator << (std::ostream &out, const DBus::Xml::Document &doc) +{ + return out << doc.to_xml(); +} + +using namespace DBus; +using namespace DBus::Xml; + +Error::Error(const char *error, int line, int column) +{ + std::ostringstream estream; + + estream << "line " << line << ", column " << column << ": " << error; + + _error = estream.str(); +} + +Node::Node(const char *n, const char ** a) +: name(n) +{ + if (a) + for (int i = 0; a[i]; i += 2) + { + _attrs[a[i]] = a[i+1]; + + //debug_log("xml:\t%s = %s", a[i], a[i+1]); + } +} + +Nodes Nodes::operator[](const std::string &key) +{ + Nodes result; + + for (iterator i = begin(); i != end(); ++i) + { + Nodes part = (**i)[key]; + + result.insert(result.end(), part.begin(), part.end()); + } + return result; +} + +Nodes Nodes::select(const std::string &attr, const std::string &value) +{ + Nodes result; + + for (iterator i = begin(); i != end(); ++i) + { + if ((*i)->get(attr) == value) + result.insert(result.end(), *i); + } + return result; +} + +Nodes Node::operator[](const std::string &key) +{ + Nodes result; + + if (key.length() == 0) return result; + + for (Children::iterator i = children.begin(); i != children.end(); ++i) + { + if (i->name == key) + result.push_back(&(*i)); + } + return result; +} + +std::string Node::get(const std::string &attribute) +{ + if (_attrs.find(attribute) != _attrs.end()) + return _attrs[attribute]; + else + return ""; +} + +void Node::set(const std::string &attribute, std::string value) +{ + if (value.length()) + _attrs[attribute] = value; + else + _attrs.erase(value); +} + +std::string Node::to_xml() const +{ + std::string xml; + int depth = 0; + + _raw_xml(xml, depth); + + return xml; +} + +void Node::_raw_xml(std::string &xml, int &depth) const +{ + xml.append(depth *2, ' '); + xml.append("<"+name); + + for (Attributes::const_iterator i = _attrs.begin(); i != _attrs.end(); ++i) + { + xml.append(" "+i->first+"=\""+i->second+"\""); + } + + if (cdata.length() == 0 && children.size() == 0) + { + xml.append("/>\n"); + } + else + { + xml.append(">"); + + if (cdata.length()) + { + xml.append(cdata); + } + + if (children.size()) + { + xml.append("\n"); + depth++; + + for (Children::const_iterator i = children.begin(); i != children.end(); ++i) + { + i->_raw_xml(xml, depth); + } + + depth--; + xml.append(depth *2, ' '); + } + xml.append("</"+name+">\n"); + } +} + +Document::Document() +: root(0), _depth(0) +{ +} + +Document::Document(const std::string &xml) +: root(0), _depth(0) +{ + from_xml(xml); +} + +Document::~Document() +{ + delete root; +} + +struct Document::Expat +{ + static void start_doctype_decl_handler( + void *data, const XML_Char *name, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset + ); + static void end_doctype_decl_handler(void *data); + static void start_element_handler(void *data, const XML_Char *name, const XML_Char **atts); + static void character_data_handler(void *data, const XML_Char *chars, int len); + static void end_element_handler(void *data, const XML_Char *name); +}; + +void Document::from_xml(const std::string &xml) +{ + _depth = 0; + delete root; + root = 0; + + XML_Parser parser = XML_ParserCreate("UTF-8"); + + XML_SetUserData(parser, this); + + XML_SetDoctypeDeclHandler( + parser, + Document::Expat::start_doctype_decl_handler, + Document::Expat::end_doctype_decl_handler + ); + + XML_SetElementHandler( + parser, + Document::Expat::start_element_handler, + Document::Expat::end_element_handler + ); + + XML_SetCharacterDataHandler( + parser, + Document::Expat::character_data_handler + ); + + XML_Status status = XML_Parse(parser, xml.c_str(), xml.length(), true); + + if (status == XML_STATUS_ERROR) + { + const char *error = XML_ErrorString(XML_GetErrorCode(parser)); + int line = XML_GetCurrentLineNumber(parser); + int column = XML_GetCurrentColumnNumber(parser); + + XML_ParserFree(parser); + + throw Error(error, line, column); + } + else + { + XML_ParserFree(parser); + } +} + +std::string Document::to_xml() const +{ + return root->to_xml(); +} + +void Document::Expat::start_doctype_decl_handler( + void *data, const XML_Char *name, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset +) +{ +} + +void Document::Expat::end_doctype_decl_handler(void *data) +{ +} + +void Document::Expat::start_element_handler(void *data, const XML_Char *name, const XML_Char **atts) +{ + Document *doc = (Document *)data; + + //debug_log("xml:%d -> %s", doc->_depth, name); + + if (!doc->root) + { + doc->root = new Node(name, atts); + } + else + { + Node::Children *cld = &(doc->root->children); + + for (int i = 1; i < doc->_depth; ++i) + { + cld = &(cld->back().children); + } + cld->push_back(Node(name, atts)); + + //std::cerr << doc->to_xml() << std::endl; + } + doc->_depth++; +} + +void Document::Expat::character_data_handler(void *data, const XML_Char *chars, int len) +{ + Document *doc = (Document *)data; + + Node *nod = doc->root; + + for (int i = 1; i < doc->_depth; ++i) + { + nod = &(nod->children.back()); + } + int x, y; + + x = 0; + y = len-1; + + while (isspace(chars[y]) && y > 0) --y; + while (isspace(chars[x]) && x < y) ++x; + + nod->cdata = std::string(chars, x, y+1); +} + +void Document::Expat::end_element_handler(void *data, const XML_Char *name) +{ + Document *doc = (Document *)data; + + //debug_log("xml:%d <- %s", doc->_depth, name); + + doc->_depth--; +} + diff --git a/libs/dbus-c++/tools/xml.h b/libs/dbus-c++/tools/xml.h new file mode 100644 index 0000000000000000000000000000000000000000..6a8e69c19f2121002d0b418c68143f5084aee655 --- /dev/null +++ b/libs/dbus-c++/tools/xml.h @@ -0,0 +1,142 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_XML_H +#define __DBUSXX_XML_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <exception> +#include <string> +#include <vector> +#include <map> +#include <iostream> +#include <sstream> + +namespace DBus { + +namespace Xml { + +class Error : public std::exception +{ +public: + + Error(const char *error, int line, int column); + + ~Error() throw() + {} + + const char *what() const throw() + { + return _error.c_str(); + } + +private: + + std::string _error; +}; + +class Node; + +class Nodes : public std::vector<Node *> +{ +public: + + Nodes operator[](const std::string &key); + + Nodes select(const std::string &attr, const std::string &value); +}; + +class Node +{ +public: + + typedef std::map<std::string, std::string> Attributes; + + typedef std::vector<Node> Children; + + std::string name; + std::string cdata; + Children children; + + Node(std::string &n, Attributes &a) + : name(n), _attrs(a) + {} + + Node(const char *n, const char ** a = NULL); + + Nodes operator[](const std::string &key); + + std::string get(const std::string &attribute); + + void set(const std::string &attribute, std::string value); + + std::string to_xml() const; + + Node &add(Node child) + { + children.push_back(child); + return children.back(); + } + +private: + + void _raw_xml(std::string &xml, int &depth) const; + + Attributes _attrs; +}; + +class Document +{ +public: + + struct Expat; + + Node *root; + + Document(); + + Document(const std::string &xml); + + ~Document(); + + void from_xml(const std::string &xml); + + std::string to_xml() const; + +private: + + int _depth; +}; + +} /* namespace Xml */ + +} /* namespace DBus */ + +std::istream &operator >> (std::istream &, DBus::Xml::Document &); +std::ostream &operator << (std::ostream &, DBus::Xml::Document &); + +#endif//__DBUSXX_XML_H diff --git a/libs/dbus-c++/tools/xml2cpp.cpp b/libs/dbus-c++/tools/xml2cpp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..45c8dde1c3fcc9a0fee2b9df3bb89e7e63639cb3 --- /dev/null +++ b/libs/dbus-c++/tools/xml2cpp.cpp @@ -0,0 +1,1039 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#include "xml2cpp.h" + +#include <dbus/dbus.h> + +#include <cstdlib> +#include <cstring> +#include <string> +#include <map> +#include <iostream> +#include <fstream> +#include <sstream> + +using namespace std; +using namespace DBus; + +static const char *tab = " "; + +static const char *header = "\n\ +/*\n\ + * This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!\n\ + */\n\ +\n\ +"; + +static const char *dbus_includes = "\n\ +#include <dbus-c++/dbus.h>\n\ +\n\ +"; + +typedef map<string,string> TypeCache; + +void usage(const char *argv0) +{ + cerr << endl << "Usage: " << argv0 << " <xmlfile> [ --proxy=<outfile.h> ] [ --adaptor=<outfile.h> ]" + << endl << endl; + exit(-1); +} + +void underscorize(string &str) +{ + for (unsigned int i = 0; i < str.length(); ++i) + { + if (!isalpha(str[i]) && !isdigit(str[i])) str[i] = '_'; + } +} + +string stub_name(string name) +{ + underscorize(name); + + return "_" + name + "_stub"; +} + +int char_to_atomic_type(char t) +{ + if (strchr("ybnqiuxtdsgavre", t)) + return t; + + return DBUS_TYPE_INVALID; +} + +const char *atomic_type_to_string(char t) +{ + static struct { char type; const char *name; } atos[] = + { + { 'y', "uint8_t" }, + { 'b', "bool" }, + { 'n', "int16_t" }, + { 'q', "uint16_t" }, + { 'i', "int32_t" }, + { 'u', "uint32_t" }, + { 'x', "int64_t" }, + { 't', "uint64_t" }, + { 'd', "double" }, + { 's', "std::string" }, + { 'o', "::DBus::Path" }, + { 'g', "::DBus::Signature" }, + { 'v', "::DBus::Variant" }, + { '\0', "" } + }; + int i; + + for (i = 0; atos[i].type; ++i) + { + if (atos[i].type == t) break; + } + return atos[i].name; +} + +bool is_atomic_type(const string &type) +{ + return type.length() == 1 && char_to_atomic_type(type[0]) != DBUS_TYPE_INVALID; +} + +void _parse_signature(const string &signature, string &type, unsigned int &i) +{ + for (; i < signature.length(); ++i) + { + switch (signature[i]) + { + case 'a': + { + switch (signature[++i]) + { + case '{': + { + type += "std::map< "; + + const char *atom = atomic_type_to_string(signature[++i]); + if (!atom) + { + cerr << "invalid signature" << endl; + exit(-1); + } + type += atom; + type += ", "; + ++i; + break; + } + default: + { + type += "std::vector< "; + break; + } + } + _parse_signature(signature, type, i); + type += " >"; + continue; + } + case '(': + { + type += "::DBus::Struct< "; + ++i; + _parse_signature(signature, type, i); + type += " >"; + if (signature[i+1]) + { + type += ", "; + } + continue; + } + case ')': + case '}': + { + return; + } + default: + { + const char *atom = atomic_type_to_string(signature[i]); + if (!atom) + { + cerr << "invalid signature" << endl; + exit(-1); + } + type += atom; + + if (signature[i+1] != ')' && signature[i+1] != '}' && i+1 < signature.length()) + { + type += ", "; + } + break; + } + } + } +} + +string signature_to_type(const string &signature) +{ + string type; + unsigned int i = 0; + _parse_signature(signature, type, i); + return type; +} + +void generate_proxy(Xml::Document &doc, const char *filename) +{ + cerr << "writing " << filename << endl; + + ofstream file(filename); + if (file.bad()) + { + cerr << "unable to write file " << filename << endl; + exit(-1); + } + + file << header; + string filestring = filename; + underscorize(filestring); + + string cond_comp = "__dbusxx__" + filestring + "__PROXY_MARSHAL_H"; + + file << "#ifndef " << cond_comp << endl; + file << "#define " << cond_comp << endl; + + file << dbus_includes; + + Xml::Node &root = *(doc.root); + Xml::Nodes interfaces = root["interface"]; + + for (Xml::Nodes::iterator i = interfaces.begin(); i != interfaces.end(); ++i) + { + Xml::Node &iface = **i; + Xml::Nodes methods = iface["method"]; + Xml::Nodes signals = iface["signal"]; + Xml::Nodes properties = iface["property"]; + Xml::Nodes ms; + ms.insert(ms.end(), methods.begin(), methods.end()); + ms.insert(ms.end(), signals.begin(), signals.end()); + + string ifacename = iface.get("name"); + if (ifacename == "org.freedesktop.DBus.Introspectable" + ||ifacename == "org.freedesktop.DBus.Properties") + { + cerr << "skipping interface " << ifacename << endl; + continue; + } + + istringstream ss(ifacename); + string nspace; + unsigned int nspaces = 0; + + while (ss.str().find('.', ss.tellg()) != string::npos) + { + getline(ss, nspace, '.'); + + file << "namespace " << nspace << " {" << endl; + + ++nspaces; + } + file << endl; + + string ifaceclass; + + getline(ss, ifaceclass); + + ifaceclass += "_proxy"; + + cerr << "generating code for interface " << ifacename << "..." << endl; + + file << "class " << ifaceclass << endl + << " : public ::DBus::InterfaceProxy" << endl + << "{" << endl + << "public:" << endl + << endl + << tab << ifaceclass << "()" << endl + << tab << ": ::DBus::InterfaceProxy(\"" << ifacename << "\")" << endl + << tab << "{" << endl; + + for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si) + { + Xml::Node &signal = **si; + + string marshname = "_" + signal.get("name") + "_stub"; + + file << tab << tab << "connect_signal(" + << ifaceclass << ", " << signal.get("name") << ", " << stub_name(signal.get("name")) + << ");" << endl; + } + + file << tab << "}" << endl + << endl; +/// write properties + file << "public:" << endl << endl + << tab << "/* properties exported by this interface */" << endl; + + for (Xml::Nodes::iterator pi = properties.begin (); + pi != properties.end (); ++pi) + { + Xml::Node & property = **pi; + string prop_name = property.get ("name"); + string property_access = property.get ("access"); + if (property_access == "read" || property_access == "readwrite") + { + file << tab << tab << "const " << signature_to_type (property.get("type")) + << " " << prop_name << "() {" << endl; + file << tab << tab << tab << "::DBus::CallMessage call ;\n "; + file << tab << tab << tab + << "call.member(\"Get\"); call.interface(\"org.freedesktop.DBus.Properties\");" + << endl; + file << tab << tab << tab + << "::DBus::MessageIter wi = call.writer(); " << endl; + file << tab << tab << tab + << "const std::string interface_name = \"" << ifacename << "\";" + << endl; + file << tab << tab << tab + << "const std::string property_name = \"" << prop_name << "\";" + << endl; + file << tab << tab << tab << "wi << interface_name;" << endl; + file << tab << tab << tab << "wi << property_name;" << endl; + file << tab << tab << tab + << "::DBus::Message ret = this->invoke_method (call);" << endl; + file << tab << tab << tab + << "::DBus::MessageIter ri = ret.reader ();" << endl; + file << tab << tab << tab << "::DBus::Variant argout; " << endl; + file << tab << tab << tab << "ri >> argout;" << endl; + file << tab << tab << tab << "return argout;" << endl; + file << tab << tab << "};" << endl; + } + + if (property_access == "write" || property_access == "readwrite") + { + file << tab << tab << "void " << prop_name << "( const "<< signature_to_type (property.get("type")) << " & input" << ") {" << endl; + file << tab << tab << tab << "::DBus::CallMessage call ;\n "; + file << tab << tab << tab <<"call.member(\"Set\"); call.interface( \"org.freedesktop.DBus.Properties\");"<< endl; + file << tab << tab << tab <<"::DBus::MessageIter wi = call.writer(); " << endl; + file << tab << tab << tab <<"::DBus::Variant value;" << endl; + file << tab << tab << tab <<"::DBus::MessageIter vi = value.writer ();" << endl; + file << tab << tab << tab <<"vi << input;" << endl; + file << tab << tab << tab <<"const std::string interface_name = \"" << ifacename << "\";" << endl; + file << tab << tab << tab <<"const std::string property_name = \"" << prop_name << "\";"<< endl; + file << tab << tab << tab <<"wi << interface_name;" << endl; + file << tab << tab << tab <<"wi << property_name;" << endl; + file << tab << tab << tab <<"wi << value;" << endl; + file << tab << tab << tab <<"::DBus::Message ret = this->invoke_method (call);" << endl; + file << tab << tab << "};" << endl; + } + } + + file << "public:" << endl + << endl + << tab << "/* methods exported by this interface," << endl + << tab << " * this functions will invoke the corresponding methods on the remote objects" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi) + { + Xml::Node &method = **mi; + Xml::Nodes args = method["arg"]; + Xml::Nodes args_in = args.select("direction","in"); + Xml::Nodes args_out = args.select("direction","out"); + + if (args_out.size() == 0 || args_out.size() > 1) + { + file << tab << "void "; + } + else if (args_out.size() == 1) + { + file << tab << signature_to_type(args_out.front()->get("type")) << " "; + } + + file << method.get("name") << "("; + + unsigned int i = 0; + for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i) + { + Xml::Node &arg = **ai; + file << "const " << signature_to_type(arg.get("type")) << "& "; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << arg_name; + else + file << "argin" << i; + + if ((i+1 != args_in.size() || args_out.size() > 1)) + file << ", "; + } + + if (args_out.size() > 1) + { + unsigned int i = 0; + for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i) + { + Xml::Node &arg = **ao; + file << signature_to_type(arg.get("type")) << "&"; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << " " << arg_name; + else + file << " argout" << i; + + if (i+1 != args_out.size()) + file << ", "; + } + } + file << ")" << endl; + + file << tab << "{" << endl + << tab << tab << "::DBus::CallMessage call;" << endl; + + if (args_in.size() > 0) + { + file << tab << tab << "::DBus::MessageIter wi = call.writer();" << endl + << endl; + } + + unsigned int j = 0; + for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++j) + { + Xml::Node &arg = **ai; + string arg_name = arg.get("name"); + if (arg_name.length()) + file << tab << tab << "wi << " << arg_name << ";" << endl; + else + file << tab << tab << "wi << argin" << j << ";" << endl; + } + + file << tab << tab << "call.member(\"" << method.get("name") << "\");" << endl + << tab << tab << "::DBus::Message ret = invoke_method(call);" << endl; + + + if (args_out.size() > 0) + { + file << tab << tab << "::DBus::MessageIter ri = ret.reader();" << endl + << endl; + } + + if (args_out.size() == 1) + { + file << tab << tab << signature_to_type(args_out.front()->get("type")) << " argout;" << endl; + file << tab << tab << "ri >> argout;" << endl; + file << tab << tab << "return argout;" << endl; + } + else if (args_out.size() > 1) + { + unsigned int i = 0; + for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i) + { + Xml::Node &arg = **ao; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << tab << tab << "ri >> " << arg.get("name") << ";" << endl; + else + file << tab << tab << "ri >> argout" << i << ";" << endl; + } + } + + file << tab << "}" << endl + << endl; + } + + file << endl + << "public:" << endl + << endl + << tab << "/* signal handlers for this interface" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si) + { + Xml::Node &signal = **si; + Xml::Nodes args = signal["arg"]; + + file << tab << "virtual void " << signal.get("name") << "("; + + unsigned int i = 0; + for (Xml::Nodes::iterator ai = args.begin(); ai != args.end(); ++ai, ++i) + { + Xml::Node &arg = **ai; + file << "const " << signature_to_type(arg.get("type")) << "& "; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << arg_name; + else + file << "argin" << i; + + if ((ai+1 != args.end())) + file << ", "; + } + file << ") = 0;" << endl; + } + + file << endl + << "private:" << endl + << endl + << tab << "/* unmarshalers (to unpack the DBus message before calling the actual signal handler)" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si) + { + Xml::Node &signal = **si; + Xml::Nodes args = signal["arg"]; + + file << tab << "void " << stub_name(signal.get("name")) << "(const ::DBus::SignalMessage &sig)" << endl + << tab << "{" << endl; + + if (args.size() > 0) + { + file << tab << tab << "::DBus::MessageIter ri = sig.reader();" << endl + << endl; + } + + unsigned int i = 0; + for (Xml::Nodes::iterator ai = args.begin(); ai != args.end(); ++ai, ++i) + { + Xml::Node &arg = **ai; + file << tab << tab << signature_to_type(arg.get("type")) << " " ; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << arg_name << ";" << " ri >> " << arg_name << ";" << endl; + else + file << "arg" << i << ";" << " ri >> " << "arg" << i << ";" << endl; + } + + file << tab << tab << signal.get("name") << "("; + + unsigned int j = 0; + for (Xml::Nodes::iterator ai = args.begin(); ai != args.end(); ++ai, ++j) + { + Xml::Node &arg = **ai; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << arg_name; + else + file << "arg" << j; + + if (ai+1 != args.end()) + file << ", "; + } + + file << ");" << endl; + + file << tab << "}" << endl; + } + + + file << "};" << endl + << endl; + + for (unsigned int i = 0; i < nspaces; ++i) + { + file << "} "; + } + file << endl; + } + + file << "#endif//" << cond_comp << endl; + + file.close(); +} + +void generate_adaptor(Xml::Document &doc, const char *filename) +{ + cerr << "writing " << filename << endl; + + ofstream file(filename); + if (file.bad()) + { + cerr << "unable to write file " << filename << endl; + exit(-1); + } + + file << header; + string filestring = filename; + underscorize(filestring); + + string cond_comp = "__dbusxx__" + filestring + "__ADAPTOR_MARSHAL_H"; + + file << "#ifndef " << cond_comp << endl + << "#define " << cond_comp << endl; + + file << dbus_includes; + + Xml::Node &root = *(doc.root); + Xml::Nodes interfaces = root["interface"]; + + for (Xml::Nodes::iterator i = interfaces.begin(); i != interfaces.end(); ++i) + { + Xml::Node &iface = **i; + Xml::Nodes methods = iface["method"]; + Xml::Nodes signals = iface["signal"]; + Xml::Nodes properties = iface["property"]; + Xml::Nodes ms; + ms.insert(ms.end(), methods.begin(), methods.end()); + ms.insert(ms.end(), signals.begin(), signals.end()); + + string ifacename = iface.get("name"); + if (ifacename == "org.freedesktop.DBus.Introspectable" + ||ifacename == "org.freedesktop.DBus.Properties") + { + cerr << "skipping interface " << ifacename << endl; + continue; + } + + istringstream ss(ifacename); + string nspace; + unsigned int nspaces = 0; + + while (ss.str().find('.', ss.tellg()) != string::npos) + { + getline(ss, nspace, '.'); + + file << "namespace " << nspace << " {" << endl; + + ++nspaces; + } + file << endl; + + string ifaceclass; + + getline(ss, ifaceclass); + + ifaceclass += "_adaptor"; + + cerr << "generating code for interface " << ifacename << "..." << endl; + + file << "class " << ifaceclass << endl + << ": public ::DBus::InterfaceAdaptor" << endl + << "{" << endl + << "public:" << endl + << endl + << tab << ifaceclass << "()" << endl + << tab << ": ::DBus::InterfaceAdaptor(\"" << ifacename << "\")" << endl + << tab << "{" << endl; + + for (Xml::Nodes::iterator pi = properties.begin(); pi != properties.end(); ++pi) + { + Xml::Node &property = **pi; + + file << tab << tab << "bind_property(" + << property.get("name") << ", " + << "\"" << property.get("type") << "\", " + << (property.get("access").find("read") != string::npos + ? "true" + : "false") + << ", " + << (property.get("access").find("write") != string::npos + ? "true" + : "false") + << ");" << endl; + } + + for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi) + { + Xml::Node &method = **mi; + + file << tab << tab << "register_method(" + << ifaceclass << ", " << method.get("name") << ", "<< stub_name(method.get("name")) + << ");" << endl; + } + + file << tab << "}" << endl + << endl; + + file << tab << "::DBus::IntrospectedInterface *const introspect() const " << endl + << tab << "{" << endl; + + for (Xml::Nodes::iterator mi = ms.begin(); mi != ms.end(); ++mi) + { + Xml::Node &method = **mi; + Xml::Nodes args = method["arg"]; + + file << tab << tab << "static ::DBus::IntrospectedArgument " << method.get("name") << "_args[] = " << endl + << tab << tab << "{" << endl; + + for (Xml::Nodes::iterator ai = args.begin(); ai != args.end(); ++ai) + { + Xml::Node &arg = **ai; + + file << tab << tab << tab << "{ "; + + if (arg.get("name").length()) + { + file << "\"" << arg.get("name") << "\", "; + } + else + { + file << "0, "; + } + file << "\"" << arg.get("type") << "\", " + << (arg.get("direction") == "in" ? "true" : "false") + << " }," << endl; + } + file << tab << tab << tab << "{ 0, 0, 0 }" << endl + << tab << tab << "};" << endl; + } + + file << tab << tab << "static ::DBus::IntrospectedMethod " << ifaceclass << "_methods[] = " << endl + << tab << tab << "{" << endl; + + for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi) + { + Xml::Node &method = **mi; + + file << tab << tab << tab << "{ \"" << method.get("name") << "\", " << method.get("name") << "_args }," << endl; + } + + file << tab << tab << tab << "{ 0, 0 }" << endl + << tab << tab << "};" << endl; + + file << tab << tab << "static ::DBus::IntrospectedMethod " << ifaceclass << "_signals[] = " << endl + << tab << tab << "{" << endl; + + for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si) + { + Xml::Node &method = **si; + + file << tab << tab << tab << "{ \"" << method.get("name") << "\", " << method.get("name") << "_args }," << endl; + } + + file << tab << tab << tab << "{ 0, 0 }" << endl + << tab << tab << "};" << endl; + + file << tab << tab << "static ::DBus::IntrospectedProperty " << ifaceclass << "_properties[] = " << endl + << tab << tab << "{" << endl; + + for (Xml::Nodes::iterator pi = properties.begin(); pi != properties.end(); ++pi) + { + Xml::Node &property = **pi; + + file << tab << tab << tab << "{ " + << "\"" << property.get("name") << "\", " + << "\"" << property.get("type") << "\", " + << (property.get("access").find("read") != string::npos + ? "true" + : "false") + << ", " + << (property.get("access").find("write") != string::npos + ? "true" + : "false") + << " }," << endl; + } + + + file << tab << tab << tab << "{ 0, 0, 0, 0 }" << endl + << tab << tab << "};" << endl; + + file << tab << tab << "static ::DBus::IntrospectedInterface " << ifaceclass << "_interface = " << endl + << tab << tab << "{" << endl + << tab << tab << tab << "\"" << ifacename << "\"," << endl + << tab << tab << tab << ifaceclass << "_methods," << endl + << tab << tab << tab << ifaceclass << "_signals," << endl + << tab << tab << tab << ifaceclass << "_properties" << endl + << tab << tab << "};" << endl + << tab << tab << "return &" << ifaceclass << "_interface;" << endl + << tab << "}" << endl + << endl; + + file << "public:" << endl + << endl + << tab << "/* properties exposed by this interface, use" << endl + << tab << " * property() and property(value) to get and set a particular property" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator pi = properties.begin(); pi != properties.end(); ++pi) + { + Xml::Node &property = **pi; + string name = property.get("name"); + string type = property.get("type"); + string type_name = signature_to_type(type); + + file << tab << "::DBus::PropertyAdaptor< " << type_name << " > " << name << ";" << endl; + } + + file << endl; + + file << "public:" << endl + << endl + << tab << "/* methods exported by this interface," << endl + << tab << " * you will have to implement them in your ObjectAdaptor" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi) + { + Xml::Node &method = **mi; + Xml::Nodes args = method["arg"]; + Xml::Nodes args_in = args.select("direction","in"); + Xml::Nodes args_out = args.select("direction","out"); + + file << tab << "virtual "; + + if (args_out.size() == 0 || args_out.size() > 1) + { + file << "void "; + } + else if (args_out.size() == 1) + { + file << signature_to_type(args_out.front()->get("type")) << " "; + } + + file << method.get("name") << "("; + + unsigned int i = 0; + for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i) + { + Xml::Node &arg = **ai; + file << "const " << signature_to_type(arg.get("type")) << "& "; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << arg_name; + + if ((i+1 != args_in.size() || args_out.size() > 1)) + file << ", "; + } + + if (args_out.size() > 1) + { + unsigned int i = 0; + for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i) + { + Xml::Node &arg = **ao; + file << signature_to_type(arg.get("type")) << "&"; + + string arg_name = arg.get("name"); + if (arg_name.length()) + file << " " << arg_name; + + if (i+1 != args_out.size()) + file << ", "; + } + } + file << ") = 0;" << endl; + } + + file << endl + << "public:" << endl + << endl + << tab << "/* signal emitters for this interface" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si) + { + Xml::Node &signal = **si; + Xml::Nodes args = signal["arg"]; + + file << tab << "void " << signal.get("name") << "("; + + unsigned int i = 0; + for (Xml::Nodes::iterator a = args.begin(); a != args.end(); ++a, ++i) + { + Xml::Node &arg = **a; + + file << "const " << signature_to_type(arg.get("type")) << "& arg" << i+1; + + if (i+1 != args.size()) + file << ", "; + } + + file << ")" << endl + << tab << "{" << endl + << tab << tab << "::DBus::SignalMessage sig(\"" << signal.get("name") <<"\");" << endl;; + + + if (args.size() > 0) + { + file << tab << tab << "::DBus::MessageIter wi = sig.writer();" << endl; + + for (unsigned int i = 0; i < args.size(); ++i) + { + file << tab << tab << "wi << arg" << i+1 << ";" << endl; + } + } + + file << tab << tab << "emit_signal(sig);" << endl + << tab << "}" << endl; + } + + file << endl + << "private:" << endl + << endl + << tab << "/* unmarshalers (to unpack the DBus message before calling the actual interface method)" << endl + << tab << " */" << endl; + + for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi) + { + Xml::Node &method = **mi; + Xml::Nodes args = method["arg"]; + Xml::Nodes args_in = args.select("direction","in"); + Xml::Nodes args_out = args.select("direction","out"); + + file << tab << "::DBus::Message " << stub_name(method.get("name")) << "(const ::DBus::CallMessage &call)" << endl + << tab << "{" << endl + << tab << tab << "::DBus::MessageIter ri = call.reader();" << endl + << endl; + + unsigned int i = 1; + for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i) + { + Xml::Node &arg = **ai; + file << tab << tab << signature_to_type(arg.get("type")) << " argin" << i << ";" + << " ri >> argin" << i << ";" << endl; + } + + if (args_out.size() == 0) + { + file << tab << tab; + } + else if (args_out.size() == 1) + { + file << tab << tab << signature_to_type(args_out.front()->get("type")) << " argout1 = "; + } + else + { + unsigned int i = 1; + for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i) + { + Xml::Node &arg = **ao; + file << tab << tab << signature_to_type(arg.get("type")) << " argout" << i << ";" << endl; + } + file << tab << tab; + } + + file << method.get("name") << "("; + + for (unsigned int i = 0; i < args_in.size(); ++i) + { + file << "argin" << i+1; + + if ((i+1 != args_in.size() || args_out.size() > 1)) + file << ", "; + } + + if (args_out.size() > 1) + for (unsigned int i = 0; i < args_out.size(); ++i) + { + file << "argout" << i+1; + + if (i+1 != args_out.size()) + file << ", "; + } + + file << ");" << endl; + + file << tab << tab << "::DBus::ReturnMessage reply(call);" << endl; + + if (args_out.size() > 0) + { + file << tab << tab << "::DBus::MessageIter wi = reply.writer();" << endl; + + for (unsigned int i = 0; i < args_out.size(); ++i) + { + file << tab << tab << "wi << argout" << i+1 << ";" << endl; + } + } + + file << tab << tab << "return reply;" << endl; + + file << tab << "}" << endl; + } + + file << "};" << endl + << endl; + + for (unsigned int i = 0; i < nspaces; ++i) + { + file << "} "; + } + file << endl; + } + + file << "#endif//" << cond_comp << endl; + + file.close(); +} + +int main(int argc, char ** argv) +{ + if (argc < 2) + { + usage(argv[0]); + } + + bool proxy_mode, adaptor_mode; + char *proxy, *adaptor; + + proxy_mode = false; + proxy = 0; + + adaptor_mode = false; + adaptor = 0; + + for (int a = 1; a < argc; ++a) + { + if (!strncmp(argv[a], "--proxy=", 8)) + { + proxy_mode = true; + proxy = argv[a] +8; + } + else + if (!strncmp(argv[a], "--adaptor=", 10)) + { + adaptor_mode = true; + adaptor = argv[a] +10; + } + } + + if (!proxy_mode && !adaptor_mode) usage(argv[0]); + + ifstream xmlfile(argv[1]); + + if (xmlfile.bad()) + { + cerr << "unable to open file " << argv[1] << endl; + return -1; + } + + Xml::Document doc; + + try + { + xmlfile >> doc; + //cout << doc.to_xml(); + } + catch(Xml::Error &e) + { + cerr << "error parsing " << argv[1] << ": " << e.what() << endl; + return -1; + } + + if (!doc.root) + { + cerr << "empty document" << endl; + return -1; + } + + if (proxy_mode) generate_proxy(doc, proxy); + if (adaptor_mode) generate_adaptor(doc, adaptor); + + return 0; +} diff --git a/libs/dbus-c++/tools/xml2cpp.h b/libs/dbus-c++/tools/xml2cpp.h new file mode 100644 index 0000000000000000000000000000000000000000..84f53feacf4fc7f263f3802097e8ff45e9dea6bc --- /dev/null +++ b/libs/dbus-c++/tools/xml2cpp.h @@ -0,0 +1,37 @@ +/* + * + * D-Bus++ - C++ bindings for D-Bus + * + * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef __DBUSXX_TOOLS_XML2CPP_H +#define __DBUSXX_TOOLS_XML2CPP_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <dbus-c++/dbus.h> +#include <dbus/dbus.h> + +#include "xml.h" + +#endif//__DBUSXX_TOOLS_XML2CPP_H diff --git a/libs/libiax2/AUTHORS b/libs/libiax2/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/libs/libiax2/COPYING b/libs/libiax2/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..67572846722bcb54024d64bbfa6caf06213be6d2 --- /dev/null +++ b/libs/libiax2/COPYING @@ -0,0 +1,416 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + + + + + + + + + + + + + + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + + + + + + + + + + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + + + + + + + + + + + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + + + + + + + + + + + + + + + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program 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 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/libs/libiax2/COPYING.LIB b/libs/libiax2/COPYING.LIB new file mode 100644 index 0000000000000000000000000000000000000000..161a3d1d47b94f5d092b4c5fa316007c6f22fe81 --- /dev/null +++ b/libs/libiax2/COPYING.LIB @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/libs/libiax2/ChangeLog b/libs/libiax2/ChangeLog new file mode 100644 index 0000000000000000000000000000000000000000..311fecbd3830b243fbc3481b697febc59feb04fc --- /dev/null +++ b/libs/libiax2/ChangeLog @@ -0,0 +1,21 @@ +libiax +====== + +version 0.2.3: + * Allow password to be passed in connect + +version 0.2.2 (Nov 13th, 2001): + * HTML Unlink requests + * HTML Reject link requests + * Text frames + +version 0.2.1 (Oct 20th, 2001): + * More space for challenge in IAX + * Fixed strncpy security bug + * Accept larger packets + * Handle out of order packets better + * Implemented send_url + * Added an iax-config script :-) + +version 0.2.0 (Oct 10th, 2001): + * Initial Public Release diff --git a/libs/libiax2/INSTALL b/libs/libiax2/INSTALL new file mode 120000 index 0000000000000000000000000000000000000000..81fa6ffa451ee21fd1c60d4ba33acd5c36bc6865 --- /dev/null +++ b/libs/libiax2/INSTALL @@ -0,0 +1 @@ +/usr/share/automake-1.9/INSTALL \ No newline at end of file diff --git a/libs/libiax2/Makefile.am b/libs/libiax2/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..0c5a65136ce6f40bc02c4391c8ec6ebbc2527db3 --- /dev/null +++ b/libs/libiax2/Makefile.am @@ -0,0 +1,6 @@ +SUBDIRS = src + +bin_SCRIPTS=iax2-config +BUILT_SCOURCES=iax2-config +EXTRA_DIST=iax.spec libiax2.vcproj +iax2-config: iax2-config.in diff --git a/libs/libiax2/NEWS b/libs/libiax2/NEWS new file mode 100644 index 0000000000000000000000000000000000000000..233df649e23e419bfe8dd51383c0b67398fafc57 --- /dev/null +++ b/libs/libiax2/NEWS @@ -0,0 +1,12 @@ +libiax +====== + +0.2.3: + +0.2.2: + +0.2.1: + +0.2.0 (Oct 10th, 2001): + Initial Release. Hooray! Rejoice! :) + diff --git a/libs/libiax2/README b/libs/libiax2/README new file mode 100644 index 0000000000000000000000000000000000000000..72f5e9e795b133f6699a84c59751f4c63d47b082 --- /dev/null +++ b/libs/libiax2/README @@ -0,0 +1,4 @@ +libiax: An implementation of the Inter-Asterisk eXchange protocol distributed +under the terms of the GNU Lesser General Public License + +Written by Mark Spencer <markster@linux-support.net> diff --git a/libs/libiax2/bootstrap.sh b/libs/libiax2/bootstrap.sh new file mode 100755 index 0000000000000000000000000000000000000000..640caa72679d71e456e769dd960fe186baacb8f0 --- /dev/null +++ b/libs/libiax2/bootstrap.sh @@ -0,0 +1,6 @@ +echo If this fails you probably need to download the latest +echo libtool,aclocal,autoconf and automake +libtoolize --force +aclocal --force +autoconf -f +automake -acf diff --git a/libs/libiax2/build.sh b/libs/libiax2/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..9dfda77c387d94481431b8be7c477ab6cf861aef --- /dev/null +++ b/libs/libiax2/build.sh @@ -0,0 +1,13 @@ +echo configuring automake +./bootstrap.sh +echo configuring libiax2 +./configure --enable-newjb +echo building libiax2 +make +echo +echo +echo '##################################################################' +echo '# #' +echo '# If all is well, enter "make install" to complete installation. #' +echo '# #' +echo '##################################################################' diff --git a/libs/libiax2/configure.in b/libs/libiax2/configure.in new file mode 100644 index 0000000000000000000000000000000000000000..b07947603dd25250e89967ad58e1c35b86b25d85 --- /dev/null +++ b/libs/libiax2/configure.in @@ -0,0 +1,38 @@ +dnl Yo Yo Yo +AC_INIT(src/iax.c) +AM_INIT_AUTOMAKE([iax2], [0.2.3]) + + +dnl Check for various goodies +AC_PROG_CC +AM_PROG_LIBTOOL +dnl LIBTOOL="$LIBTOOL --silent" +AC_PROG_INSTALL + +dnl Check for libraries +dnl None available + +dnl Check header files +AC_HEADER_STDC + +AC_SUBST(LIBS) + +AC_ARG_ENABLE(snomhack, [ --enable-snomhack Use slower memset for SNOM phoneem ],,enable_snomhack=no) +AC_ARG_ENABLE(extreme_debug, [ --enable-extreme-debug Compile with extreme debugging code enabled ],,enable_extreme_debug=no) +if test "$enable_snomhack" = yes ; then + AC_DEFINE(SNOM_HACK) +fi + +if test "$enable_extreme_debug" = yes ; then + AC_DEFINE(EXTREME_DEBUG) +fi + +AC_SUBST(IAX_VERSION) + +AC_OUTPUT([ +Makefile +src/Makefile +iax.spec +iax2-config],[case "$CONFIG_FILES" in +*iax2-config*)chmod +x iax2-config;; +esac]) diff --git a/libs/libiax2/debian/changelog b/libs/libiax2/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..408f809179f044654f649b7a799b06e64109ee52 --- /dev/null +++ b/libs/libiax2/debian/changelog @@ -0,0 +1,6 @@ +sflphone-iax2 (0.2.3-2ubuntu1) intrepid; urgency=low + + * Debian package + + -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 03 Dec 2008 14:40:44 -0500 + diff --git a/libs/libiax2/debian/compat b/libs/libiax2/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/libs/libiax2/debian/compat @@ -0,0 +1 @@ +5 diff --git a/libs/libiax2/debian/control b/libs/libiax2/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..d70b8f677c9af0ea55dd0615716c9aadc9e5e623 --- /dev/null +++ b/libs/libiax2/debian/control @@ -0,0 +1,44 @@ +Source: sflphone-iax2 +Priority: optional +Maintainer: Yun Liu <yun.liu@savoirfairelinux.com> +Build-Depends: debhelper (>= 5), autotools-dev +Standards-Version: 3.8.0 +Section: libs + +Package: sflphone-iax2-dev +Section: libdevel +Architecture: amd64 +Depends: libc6 (>=2.6.1-1), sflphone-iax2(>= 0.2.3) +Homepage: http://www.sflphone.org +Description: IAX2 protocol support for SFLphone + Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the + protocol used by the Asterisk PBX system for inter-asterisk-communication. + Other applications may use libiax to communicate with each other and + other asterisk servers. + IAX is a high performance, feature rich protocol unrelated to SIP or H.323. + Its single-socket design allows it to interoperate with NAT and + PAT masquerade firewalls. It supports internationalization, remote dialplans, + and voice, HTML, image, DTMF, and video content. + This library is needed by SFLphone to support the IAX2 protocol. + SFLphone is being developed by the global community, and maintained by + Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. + This package is only the library development files. + +Package: sflphone-iax2 +Section: libs +Architecture: amd64 +Depends: libc6 (>=2.6.1-1), ${shlibs:Depends} +Homepage: http://www.sflphone.org +Description: IAX2 protocol support for SFLphone + Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the + protocol used by the Asterisk PBX system for inter-asterisk-communication. + Other applications may use libiax to communicate with each other and + other asterisk servers. + IAX is a high performance, feature rich protocol unrelated to SIP or H.323. + Its single-socket design allows it to interoperate with NAT and + PAT masquerade firewalls. It supports internationalization, remote dialplans, + and voice, HTML, image, DTMF, and video content. + This library is needed by SFLphone to support the IAX2 protocol. + SFLphone is being developed by the global community, and maintained by + Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. + This package is only the library files. diff --git a/libs/libiax2/debian/copyright b/libs/libiax2/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..573535600fca5c7135d26927434600ecefd5ad52 --- /dev/null +++ b/libs/libiax2/debian/copyright @@ -0,0 +1,28 @@ +This package was debianized by Yun Liu <yun.liu@savoirfairelinux.com> on +Wed, 03 Dec 2008 14:40:44 -0500. + +It was downloaded from: http://www.asterisk.org + +Upstream Author: Mark Spencer <markster@linux-support.net> + +Copyright Holder: Mark Spencer <markster@linux-support.net> + +License from the README file: + +libiax: An implementation of the Inter-Asterisk eXchange protocol distributed +under the terms of the GNU Lesser General Public License + +The following files are marked as being released under the LGPL: + src/frame.h + src/iax.c + +The following files are marked as being released under the GPL: + src/iax.h + src/iaxclient.h + +The following files are in the public domain: + src/md5.c + src/md5.h + +On Debian systems, the complete text of the licenses can be found in the +/usr/share/common-licenses/LGPL and /usr/share/common-licenses/GPL files. diff --git a/libs/libiax2/debian/docs b/libs/libiax2/debian/docs new file mode 100644 index 0000000000000000000000000000000000000000..eb9b151cc884877495df75b49ed1b6598646328c --- /dev/null +++ b/libs/libiax2/debian/docs @@ -0,0 +1,3 @@ +NEWS +README +AUTHORS diff --git a/libs/libiax2/debian/rules b/libs/libiax2/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..009c44a737ec878907fea5d3b03d799be7dda154 --- /dev/null +++ b/libs/libiax2/debian/rules @@ -0,0 +1,107 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +# shared library versions, option 1 +version=2.0.5 +major=2 +# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so +#version=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +#major=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +config.status: configure + dh_testdir + # Add here commands to configure the package. +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + ./bootstrap.sh + ./configure --prefix=/usr --enable-newjb + +build: build-stamp +build-stamp: config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) distclean + rm -f config.sub config.guess + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_install --sourcedir debian/tmp +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/libs/libiax2/debian/sflphone-iax2-dev.install b/libs/libiax2/debian/sflphone-iax2-dev.install new file mode 100644 index 0000000000000000000000000000000000000000..25f03e932537815e312b381c366d52d1b33a54d2 --- /dev/null +++ b/libs/libiax2/debian/sflphone-iax2-dev.install @@ -0,0 +1,4 @@ +usr/include/* +usr/lib/*.a +usr/lib/*.so +usr/lib/*.la diff --git a/libs/libiax2/debian/sflphone-iax2.install b/libs/libiax2/debian/sflphone-iax2.install new file mode 100644 index 0000000000000000000000000000000000000000..0bfc1fdb18d1d52aed647ca1c36cc243e7c7b496 --- /dev/null +++ b/libs/libiax2/debian/sflphone-iax2.install @@ -0,0 +1,2 @@ +usr/lib/*.so.* +usr/bin/* diff --git a/libs/libiax2/debian/shlibs.local b/libs/libiax2/debian/shlibs.local new file mode 100644 index 0000000000000000000000000000000000000000..50b1f00b0e195d709197808bf1da4404593661cc --- /dev/null +++ b/libs/libiax2/debian/shlibs.local @@ -0,0 +1 @@ +libsflphone-iax2 0.2.3 sflphone-iax2 (>> 0.2.3-0), sflphone-iax2 (<< 0.2.3-99) diff --git a/libs/libiax2/depcomp b/libs/libiax2/depcomp new file mode 120000 index 0000000000000000000000000000000000000000..73994f3c0ee9fd96c8cfe36c76746b1183bdddd7 --- /dev/null +++ b/libs/libiax2/depcomp @@ -0,0 +1 @@ +/usr/share/automake-1.9/depcomp \ No newline at end of file diff --git a/libs/libiax2/doc/Doxyfile-fullsource b/libs/libiax2/doc/Doxyfile-fullsource new file mode 100644 index 0000000000000000000000000000000000000000..9727eade64acd8de939d149cc5dc990a6b14d87e --- /dev/null +++ b/libs/libiax2/doc/Doxyfile-fullsource @@ -0,0 +1,1234 @@ +# Doxyfile 1.4.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "libiax2" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO +EXTRACT_LOCAL_METHODS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is YES. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the progam writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = src + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = *.cpp *.inl + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO +#FILTER_SOURCE_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = *.h *.hpp + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/libs/libiax2/gen.sh b/libs/libiax2/gen.sh new file mode 100755 index 0000000000000000000000000000000000000000..e22d8f797b944bd8c1f31c14fb9b390e9b4944b7 --- /dev/null +++ b/libs/libiax2/gen.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# +# Run this to generate a new configure script and such :) +# +# -- Rob +# + + +(libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have libtool installed to compile libiax"; + echo; + exit; +} + +autoreconf -vifs diff --git a/libs/libiax2/iax.spec.in b/libs/libiax2/iax.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..1fc057d83cd1a467e602bf3d56804a1498449673 --- /dev/null +++ b/libs/libiax2/iax.spec.in @@ -0,0 +1,91 @@ +%define name @PACKAGE@ +%define version @VERSION@ +%define release 1 +%define prefix /usr + +Summary: IAX (Inter Asterisk eXchange) Library +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: LGPL +Group: Development/Libraries +Source: %{name}-%{version}.tar.gz +URL: http://www.linux-support.net/ +Distribution: RedHat Linux +Vendor: Linux Support Services +Packager: Rob Flynn <rob@linux-support.net> +BuildRoot: /var/tmp/%{name}-%{version}-root + +%description +Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the protocol used by the Asterisk PBX +system for inter-asterisk-communication. Other applications may use libiax to communicate with each other +and other asterisk servers. IAX is a high performance, feature rich protocol unrelated +to SIP or H.323. Its single-socket design allows it to interoperate with NAT and PAT +masquerade firewalls. It supports internationalization, remote dialplans, +and voice, HTML, image, DTMF, and video content. For more information see +http://www.gnophone.com. + +%package devel +Summary: IAX (Inter Asterisk eXchange) Development Package +Group: Development/Libraries +Requires: iax + +%description devel +Inter Asterisk eXchange, lovingly called IAX (pronounced: eeks), is the protocol used by the Asterisk PBX +system for inter-asterisk-communication. Other applications may use libiax to communicate with each other +and other asterisk servers. IAX is a high performance, feature rich protocol unrelated +to SIP or H.323. Its single-socket design allows it to interoperate with NAT and PAT +masquerade firewalls. It supports internationalization, remote dialplans, +and voice, HTML, image, DTMF, and video content. For more information see +http://www.gnophone.com. + +This package contains all of the development files that you will need in order to compile IAX applications. + +%prep + +%setup + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --enable-autoupdate +make + +%install +rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{prefix} install-strip + +%files +%defattr(-,root,root) +%doc NEWS COPYING AUTHORS README +%{prefix}/lib + +%files devel +%defattr(-,root,root) +%{prefix}/include/iax +%{prefix}/bin/* + +%clean +rm -r $RPM_BUILD_ROOT + +%changelog +* Tue Nov 13 2001 Rob Flynn <rob@linux-support.net> (0.2.2 release) +- HTML Unlink requests +- HTML Reject link requests +- Text frames + +* Sat Oct 20 2001 Rob Flynn <rob@linux-support.net> (0.2.1 release) +- More space for challenge in IAX +- Fixed strncpy security bug +- Accept larger packets +- Handle out of order packets better +- Implemented send_url +- Added an iax-config script :-) + +* Wed Oct 10 2001 Rob Flynn <rob@linux-support.net> (0.2.0 release) +- Initial public release + +%post + +%preun + +%postun + diff --git a/libs/libiax2/iax2-config.in b/libs/libiax2/iax2-config.in new file mode 100644 index 0000000000000000000000000000000000000000..360b79f6d7b96c8b485d6a07e13d8e04b962bd4d --- /dev/null +++ b/libs/libiax2/iax2-config.in @@ -0,0 +1,74 @@ +#!/bin/sh +iax_libs="-L/usr/lib -liax2" +iax_cflags="" + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage="\ +Usage: iax2-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @VERSION@ + ;; + --cflags) +# if test ${prefix}/include/iax != /usr/include/iax ; then + includes=-I${prefix}/include/iax + for i in $iax_cflags ; do + if test $i = -I${prefix}/include ; then + includes="" + fi + done +# fi + echo $includes $iax_cflags + ;; + --libs) + my_iax_libs= + libdirs=-L${exec_prefix}/lib + for i in $iax_libs ; do + if test $i != -L${exec_prefix}/lib ; then + if test -z "$my_iax_libs" ; then + my_iax_libs="$i" + else + my_iax_libs="$my_iax_libs $i" + fi + fi + done + echo $libdirs $my_iax_libs + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff --git a/libs/libiax2/install-sh b/libs/libiax2/install-sh new file mode 120000 index 0000000000000000000000000000000000000000..50f91a41409b4f7fd323c68d49125ef1c516c6d0 --- /dev/null +++ b/libs/libiax2/install-sh @@ -0,0 +1 @@ +/usr/share/automake-1.9/install-sh \ No newline at end of file diff --git a/libs/libiax2/missing b/libs/libiax2/missing new file mode 120000 index 0000000000000000000000000000000000000000..0ba95d1b1c424d1a70b11b662138360d4f3d5c0a --- /dev/null +++ b/libs/libiax2/missing @@ -0,0 +1 @@ +/usr/share/automake-1.9/missing \ No newline at end of file diff --git a/libs/libiax2/mkinstalldirs b/libs/libiax2/mkinstalldirs new file mode 120000 index 0000000000000000000000000000000000000000..5285bc2cc8f46cd5fba83f36a53e6abc9cb15b0f --- /dev/null +++ b/libs/libiax2/mkinstalldirs @@ -0,0 +1 @@ +/usr/share/automake-1.9/mkinstalldirs \ No newline at end of file diff --git a/libs/libiax2/src/Makefile.am b/libs/libiax2/src/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..086fbd3659ac04aa984b8928d493af7633effc21 --- /dev/null +++ b/libs/libiax2/src/Makefile.am @@ -0,0 +1,25 @@ +AM_CFLAGS = -Wall -O2 +AM_CFLAGS += -g -Wall -Wstrict-prototypes -I . +AM_CFLAGS += -DLIBIAX +AM_CFLAGS += -fsigned-char +# -DDEBUG_SUPPORT (doesn't compile with it) +# -DDEBUG_DEFAULT +AM_CFLAGS += $(UCFLAGS) + + +pkgdir = $(libdir) +pkg_LTLIBRARIES=libiax2.la +libiax2_la_SOURCES = iax2-parser.c iax.c md5.c jitterbuf.c +EXTRA_DIST = md5.h frame.h iax-client.h iax2.h iax2-parser.h jitterbuf.h + +install-data-local: + mkdir -p $(DESTDIR)$(includedir)/iax2 + install -m 644 md5.h $(DESTDIR)$(includedir)/iax2 + install -m 644 frame.h $(DESTDIR)$(includedir)/iax2 + install -m 644 iax.h $(DESTDIR)$(includedir)/iax2 + install -m 644 iax2.h $(DESTDIR)$(includedir)/iax2 + install -m 644 iax2-parser.h $(DESTDIR)$(includedir)/iax2 + install -m 644 iax-client.h $(DESTDIR)$(includedir)/iax2 + +uninstall-local: + rm -rf $(DESTDIR)$(includedir)/iax2 diff --git a/libs/libiax2/src/answer.h b/libs/libiax2/src/answer.h new file mode 100644 index 0000000000000000000000000000000000000000..2a034204cf93d853bda3f65a40988ade2ed45a7b --- /dev/null +++ b/libs/libiax2/src/answer.h @@ -0,0 +1,237 @@ +/* + * Signed 16-bit audio data + * + * Source: answer.raw + * + * Copyright (C) 1999, Mark Spencer and Linux Support Services + * + * Distributed under the terms of the GNU General Public License + * + */ + +static signed short answer[] = { +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 0x19b7, 0x0245, 0xeee5, 0xb875, 0xd9a4, 0x6018, 0x660a, 0xc3c6, +0x8741, 0xff55, 0x4c2e, 0x2146, 0xfed2, 0xf079, 0xcbd4, 0xe561, 0x3c41, 0x3166, +0xd425, 0xdc59, 0x2748, 0x087d, 0xc72b, 0xfe3a, 0x4681, 0x14c6, 0xcf45, 0xdd38, +0xf8dd, 0x0a39, 0x3a5a, 0x32b9, 0xbfec, 0x957f, 0x15a3, 0x70f4, 0x1d95, 0xbfc4, +0xd367, 0xfda0, 0x0dc0, 0x29eb, 0x1fc2, 0xd684, 0xcab1, 0x19c7, 0x29ef, 0xe679, +0xe9d0, 0x2b82, 0x151a, 0xca9f, 0xdb68, 0x1f4a, 0x271c, 0x0e2a, 0xfb32, 0xd1b2, +0xc8ff, 0x2382, 0x6380, 0x0a52, 0xa118, 0xccbf, 0x2ddc, 0x33fd, 0x0964, 0xf2a4, +0xdd81, 0xe092, 0x1a00, 0x325c, 0xf5e3, 0xd6a1, 0x0b6c, 0x1c75, 0xe4f8, 0xe07c, +0x2082, 0x2b3e, 0xf445, 0xdaa9, 0xea13, 0xff3c, 0x245c, 0x35c1, 0xf308, 0xab53, +0xdf59, 0x4698, 0x3f3b, 0xe7f7, 0xca84, 0xed4d, 0x0c3f, 0x1e94, 0x1c2d, 0xf06f, +0xd4df, 0xff34, 0x23d8, 0x001e, 0xe3f1, 0x0b15, 0x2113, 0xf3fd, 0xd768, 0xf9a0, +0x1d31, 0x1c6e, 0x0797, 0xe3a0, 0xce6c, 0xfd7b, 0x422a, 0x2c4c, 0xd364, 0xbf42, +0x0278, 0x303e, 0x1c51, 0xf737, 0xe25a, 0xe75f, 0x0a8f, 0x22ab, 0x05f4, 0xe3f9, +0xf8c4, 0x1705, 0x0162, 0xe49f, 0xfb8b, 0x1e2b, 0x13ac, 0xf044, 0xe07b, 0xf01a, +0x1567, 0x2cbf, 0x0b75, 0xd01b, 0xd206, 0x1563, 0x38d7, 0x0f2e, 0xdb32, 0xdc30, +0x023b, 0x1e44, 0x16eb, 0xf5f7, 0xe425, 0xfa33, 0x14d5, 0x0968, 0xeff2, 0xf762, +0x1137, 0x0e59, 0xf13a, 0xe651, 0xff41, 0x1d60, 0x18fd, 0xf1e6, 0xd75f, 0xf097, +0x20ec, 0x27fa, 0xfba4, 0xd5b8, 0xe68e, 0x1657, 0x2518, 0x04f6, 0xe5a3, 0xe976, +0x0578, 0x18fa, 0x0a92, 0xec0a, 0xef2a, 0x111f, 0x12f4, 0xeec3, 0xe95e, 0x0d3a, +0x18fd, 0xff72, 0xeefc, 0xf114, 0xfaaa, 0x14ee, 0x21db, 0xf56e, 0xcb49, 0xf621, +0x3323, 0x1947, 0xe017, 0xe7e9, 0x0819, 0x0707, 0x084c, 0x0f57, 0xf152, 0xdf92, +0x104a, 0x28eb, 0xedcc, 0xd4ad, 0x1415, 0x296d, 0xed9a, 0xdf57, 0x0cc2, 0x0d95, +0xf7b5, 0x0deb, 0x0b34, 0xd713, 0xea08, 0x38d6, 0x216d, 0xc727, 0xdc32, 0x2cd2, +0x1822, 0xe2d5, 0xfeb3, 0x106c, 0xe6e5, 0xf81e, 0x2fe8, 0x01af, 0xc180, 0x037a, +0x42d8, 0xf88d, 0xc344, 0x0a4f, 0x2c4e, 0xf19d, 0xebeb, 0x162c, 0xf9e9, 0xde93, +0x1b56, 0x2c60, 0xd8aa, 0xce3e, 0x2a41, 0x2eeb, 0xdab1, 0xde32, 0x1c32, 0x0aba, +0xeabe, 0x1008, 0x136d, 0xda2f, 0xec3b, 0x31dd, 0x1130, 0xca79, 0xf5b8, 0x3423, +0x0274, 0xd27d, 0x035e, 0x1e68, 0xf641, 0xf904, 0x1691, 0xef7d, 0xd57a, 0x1c3b, +0x3c23, 0xe881, 0xc274, 0x0af5, 0x2962, 0xfa34, 0xf676, 0x0f71, 0xefcc, 0xe01f, +0x19e7, 0x276f, 0xe694, 0xe134, 0x1c3a, 0x0e8b, 0xd8e7, 0xfa81, 0x2f8b, 0x07c5, +0xd904, 0xf6fa, 0x0ca5, 0xf9a2, 0x0dc7, 0x2623, 0xec54, 0xbe23, 0x02b6, 0x4296, +0x10cd, 0xda61, 0xf11c, 0x0103, 0xf41c, 0x10b4, 0x2a03, 0xf63c, 0xce1a, 0xfdbd, +0x1fb4, 0xfc51, 0xf727, 0x1c8a, 0x04ff, 0xcf41, 0xec05, 0x2913, 0x1ce8, 0xf70c, +0xf744, 0xede8, 0xdd77, 0x0d99, 0x43f1, 0x119c, 0xc14f, 0xd60e, 0x17cb, 0x1e19, +0x0d4e, 0x0c95, 0xeed1, 0xcdf4, 0xf7a5, 0x331f, 0x1cd0, 0xeb17, 0xf082, 0xfb19, +0xe899, 0xfdeb, 0x323c, 0x2036, 0xdad3, 0xd134, 0xfd03, 0x1345, 0x1c10, 0x2239, +0xf656, 0xbc22, 0xdc3f, 0x3392, 0x3d59, 0xfd77, 0xdb4d, 0xe23f, 0xedbe, 0x0f7e, +0x35cc, 0x1947, 0xd5dc, 0xd1bf, 0x035d, 0x16fc, 0x1174, 0x1675, 0x0249, 0xd2d4, +0xd851, 0x184d, 0x32fe, 0x0f91, 0xee14, 0xe1e6, 0xdf9b, 0x016b, 0x3668, 0x2b2b, +0xe20c, 0xc554, 0xf257, 0x1c05, 0x1fc5, 0x14f0, 0xf891, 0xd41c, 0xdf83, 0x1865, +0x2de1, 0x0b16, 0xed58, 0xea0c, 0xea79, 0xfbd9, 0x22af, 0x2732, 0xf62f, 0xd389, +0xe7d9, 0x0b39, 0x1cdc, 0x1de3, 0x038a, 0xd809, 0xd5f7, 0x0b55, 0x305e, 0x1910, +0xf02e, 0xe089, 0xe7c7, 0x0195, 0x2265, 0x21da, 0xf743, 0xd8f2, 0xe978, 0x09a1, +0x190a, 0x17c5, 0x045a, 0xe46d, 0xdd06, 0xffb2, 0x2293, 0x1cfe, 0xfd4d, 0xe4f9, +0xe310, 0xfaf1, 0x1d22, 0x2376, 0x0113, 0xde3a, 0xe21b, 0x0204, 0x1ba1, 0x1bd6, +0x0333, 0xe563, 0xe104, 0xfd51, 0x1bc1, 0x1ccf, 0x0285, 0xe757, 0xe35e, 0xfaf2, +0x185d, 0x1d46, 0x06b7, 0xec13, 0xe108, 0xef6e, 0x121d, 0x2a17, 0x16a6, 0xe32c, +0xc9a9, 0xf070, 0x2f48, 0x3788, 0xfa4e, 0xc32a, 0xd9c2, 0x1fa1, 0x36fe, 0x07fa, +0xd9e4, 0xe577, 0x0e5e, 0x1755, 0xfb53, 0xed71, 0x0540, 0x19e0, 0x0301, 0xdc97, +0xe391, 0x1937, 0x367c, 0x0bc9, 0xca4c, 0xc96b, 0x105d, 0x461f, 0x2416, 0xd481, +0xbc97, 0xf8b7, 0x39af, 0x2ec9, 0xecc6, 0xcb50, 0xeee3, 0x1ffe, 0x1e8e, 0xf700, +0xe66a, 0xff58, 0x149f, 0x02e5, 0xe792, 0xf2d8, 0x1a4d, 0x225a, 0xf642, 0xce7f, +0xe6a6, 0x25e2, 0x38f5, 0x01d0, 0xc50f, 0xd243, 0x19bd, 0x3fc6, 0x14f0, 0xd2d7, +0xcdb6, 0x069a, 0x2ffe, 0x1847, 0xe6f8, 0xdf0a, 0x0337, 0x1a90, 0x067a, 0xeb5b, +0xf541, 0x143b, 0x14f2, 0xf092, 0xdc02, 0xfb91, 0x28a3, 0x2274, 0xeaa8, 0xc9e7, +0xef48, 0x2d01, 0x322e, 0xf6d2, 0xc7cb, 0xe13b, 0x1fda, 0x3217, 0x0458, 0xd690, +0xe2bf, 0x11c4, 0x21d5, 0x0291, 0xe5c8, 0xf3a9, 0x12ba, 0x11aa, 0xf22b, 0xe627, +0x03ec, 0x219a, 0x1036, 0xe2f2, 0xd93f, 0x059c, 0x2ed6, 0x1b75, 0xe227, 0xce55, +0xfb19, 0x2de0, 0x2477, 0xed08, 0xd148, 0xf307, 0x21d4, 0x2002, 0xf543, 0xdeac, +0xf7f9, 0x18a9, 0x11d6, 0xf0ef, 0xe8e4, 0x05ea, 0x1ba5, 0x0727, 0xe448, 0xe748, +0x100e, 0x265e, 0x07fc, 0xdbae, 0xde78, 0x0efa, 0x2ce0, 0x0f94, 0xddf1, 0xd9ea, +0x0797, 0x28f6, 0x12eb, 0xe60c, 0xdf46, 0x0469, 0x1fbb, 0x0ced, 0xe9f6, 0xe95f, +0x09fe, 0x1ab9, 0x02cb, 0xe5a4, 0xef2a, 0x1327, 0x1d7b, 0xfd07, 0xde3d, 0xed9c, +0x17e5, 0x22e7, 0xfe3a, 0xdb38, 0xe9b9, 0x161a, 0x2416, 0x0175, 0xde3d, 0xe9de, +0x1294, 0x1fc9, 0x00ea, 0xe2a7, 0xeee2, 0x1298, 0x1a7d, 0xfc1d, 0xe3bb, 0xf47a, +0x1642, 0x185e, 0xf727, 0xe1af, 0xf709, 0x19c3, 0x18e7, 0xf50d, 0xe010, 0xf75b, +0x1a9c, 0x18d8, 0xf4c5, 0xe0c9, 0xf865, 0x1a1c, 0x16d5, 0xf3a6, 0xe257, 0xfaf2, +0x1a44, 0x14d5, 0xf34f, 0xe4b6, 0xfc77, 0x17d5, 0x0ff8, 0xf133, 0xe8b7, 0x0344, +0x1a37, 0x0ad5, 0xe95e, 0xe61a, 0x08a5, 0x227e, 0x0e33, 0xe4a7, 0xdd70, 0x03b0, +0x25f4, 0x17b2, 0xec0a, 0xdb4e, 0xf898, 0x1ba3, 0x18f6, 0xf973, 0xe87f, 0xf77a, +0x0b93, 0x096c, 0xfb0e, 0xfb03, 0x0896, 0x0940, 0xf51d, 0xe904, 0xfdc7, 0x1dda, +0x1bf9, 0xf29b, 0xd37f, 0xea1b, 0x1f37, 0x3175, 0x07eb, 0xd3f7, 0xd46b, 0x077d, +0x2eeb, 0x1e67, 0xeeae, 0xd8c7, 0xef85, 0x1119, 0x18d3, 0x088e, 0xf953, 0xf5ad, +0xf556, 0xf63d, 0x0234, 0x167a, 0x19a1, 0xfbf9, 0xd873, 0xdd4b, 0x0f06, 0x3748, +0x21e6, 0xe181, 0xc032, 0xe79a, 0x2bec, 0x3e76, 0x0b1b, 0xce41, 0xcb23, 0xff96, +0x2d79, 0x26d1, 0xfcc7, 0xdf8a, 0xe525, 0xfd83, 0x10f1, 0x16d7, 0x0f50, 0xfaea, +0xe3f1, 0xe20f, 0x0158, 0x27d9, 0x2866, 0xf96f, 0xcb34, 0xd563, 0x11d6, 0x3d25, +0x2424, 0xe254, 0xc2c9, 0xe7cd, 0x248d, 0x34f5, 0x0c42, 0xdcd0, 0xd827, 0xfa65, +0x19eb, 0x1b50, 0x0721, 0xf396, 0xeb9c, 0xefde, 0x0016, 0x1594, 0x1cc1, 0x0658, +0xe22b, 0xd852, 0xfb3e, 0x2923, 0x2c78, 0xfc87, 0xcdb5, 0xd69c, 0x0e3c, 0x3527, +0x201f, 0xe993, 0xcf9e, 0xeb21, 0x183f, 0x25ea, 0x0c93, 0xed4d, 0xe5f9, 0xf548, +0x07fb, 0x117c, 0x0ff2, 0x0398, 0xf08c, 0xe628, 0xf489, 0x143b, 0x2419, 0x0ccf, +0xe2cc, 0xd5a6, 0xf861, 0x2615, 0x2a1b, 0xfeb4, 0xd543, 0xdc53, 0x09b4, 0x2901, +0x19ff, 0xf24a, 0xde86, 0xeec4, 0x0b7b, 0x1733, 0x0d0a, 0xfc24, 0xf1bb, 0xf110, +0xfa03, 0x0a0f, 0x15d4, 0x0e21, 0xf435, 0xe17e, 0xee90, 0x1225, 0x2527, 0x0efa, +0xe61f, 0xd916, 0xf7b8, 0x1f50, 0x2326, 0x0099, 0xe01e, 0xe473, 0x0491, 0x1b37, +0x1360, 0xfb17, 0xecd9, 0xf20d, 0x0051, 0x0aec, 0x0d4a, 0x073d, 0xfa5a, 0xeeb8, +0xf165, 0x0516, 0x17dc, 0x12da, 0xf71b, 0xe213, 0xed85, 0x0eef, 0x20c8, 0x0e09, +0xebcc, 0xe0d4, 0xf848, 0x1637, 0x19d6, 0x026b, 0xec09, 0xed00, 0xff9b, 0x0e5a, +0x0d6b, 0x026c, 0xf865, 0xf4da, 0xf888, 0x025a, 0x0cbb, 0x0d53, 0xff96, 0xeefa, +0xee80, 0x021c, 0x15d6, 0x126a, 0xf9c1, 0xe724, 0xf017, 0x0aa1, 0x18b6, 0x0b4e, +0xf2d7, 0xea91, 0xf957, 0x0cac, 0x1061, 0x03f4, 0xf6ad, 0xf476, 0xfbdf, 0x0489, +0x08b1, 0x06df, 0xffcf, 0xf766, 0xf537, 0xfddf, 0x0ad4, 0x0e15, 0x01da, 0xf205, +0xf0a0, 0x0082, 0x1066, 0x0e41, 0xfc71, 0xef1b, 0xf4ad, 0x05cd, 0x0f32, 0x07ed, +0xf9c8, 0xf401, 0xfa93, 0x04af, 0x088c, 0x04a7, 0xfe15, 0xf9f1, 0xfa64, 0xff1e, +0x0539, 0x078c, 0x02af, 0xfa1a, 0xf69d, 0xfd09, 0x075b, 0x0a3d, 0x01f2, 0xf761, +0xf642, 0xffa7, 0x08f3, 0x0830, 0xff05, 0xf7db, 0xf9bc, 0x0174, 0x068b, 0x04b2, +0xfeff, 0xfb39, 0xfc1a, 000000, 0x0371, 0x03d7, 0x00fe, 0xfd37, 0xfbe0, 0xfe78, +0x02af, 0x044a, 0x0180, 0xfd43, 0xfc00, 0xfed1, 0x02aa, 0x0346, 0x00dd, 0xfde0, +0xfbfe, 0x0114, 0x0987, 0x04bc, 0xf49d, 0xf23a, 0x06ab, 0x162e, 0x0544, 0xe76b, +0xea25, 0x1015, 0x2474, 0x0431, 0xd7d3, 0xe1ec, 0x1923, 0x2df5, 0x01cd, 0xd386, +0xe3d9, 0x1b9d, 0x2c62, 0xfeb8, 0xd31a, 0xe6ba, 0x1dbd, 0x2abb, 0xfbab, 0xd2ed, +0xe9ab, 0x1fa7, 0x28ef, 0xf8b3, 0xd2f5, 0xeca5, 0x2160, 0x26fd, 0xf5d7, 0xd334, +0xefa1, 0x22e5, 0x24ea, 0xf31b, 0xd3a9, 0xf29f, 0x2435, 0x22b6, 0xf07e, 0xd44e, +0xf59b, 0x2551, 0x2067, 0xee08, 0xd527, 0xf88e, 0x2639, 0x1e00, 0xebb6, 0xd62d, +0xfb77, 0x26eb, 0x1b85, 0xe98b, 0xd75f, 0xfe51, 0x276b, 0x18f9, 0xe78e, 0xd8b9, +0x011a, 0x27b6, 0x1660, 0xe5bb, 0xda3a, 0x03cc, 0x27cf, 0x13bd, 0xe415, 0xdbdf, +0x066a, 0x27b7, 0x1117, 0xe29e, 0xdda5, 0x08ec, 0x276e, 0x0e6d, 0xe154, 0xdf89, +0x0b52, 0x26f6, 0x0bc7, 0xe039, 0xe185, 0x0d96, 0x2653, 0x0924, 0xdf4e, 0xe399, +0x0fb9, 0x2584, 0x068b, 0xde93, 0xe5c0, 0x11b8, 0x248e, 0x03fd, 0xde08, 0xe7f8, +0x1390, 0x2372, 0x0180, 0xddaa, 0xea3c, 0x1544, 0x2231, 0xff12, 0xdd7a, 0xec89, +0x16cf, 0x20d0, 0xfcb9, 0xdd77, 0xeedb, 0x1831, 0x1f52, 0xfa77, 0xdd9f, 0xf132, +0x1969, 0x1db7, 0xf850, 0xddf1, 0xf385, 0x1a75, 0x1c06, 0xf645, 0xde6b, 0xf5d7, +0x1b5b, 0x1a3f, 0xf457, 0xdf0d, 0xf820, 0x1c13, 0x1867, 0xf288, 0xdfd2, 0xfa5f, +0x1ca1, 0x167f, 0xf0db, 0xe0ba, 0xfc92, 0x1d06, 0x148b, 0xef50, 0xe1c1, 0xfeb5, +0x1d43, 0x1290, 0xede9, 0xe2e6, 0x00c6, 0x1d58, 0x108e, 0xeca7, 0xe426, 0x02c4, +0x1d45, 0x0e8a, 0xeb8a, 0xe57f, 0x04a9, 0x1d0e, 0x0c87, 0xea92, 0xe6ec, 0x0677, +0x1cb2, 0x0a87, 0xe9be, 0xe86e, 0x082a, 0x1c34, 0x088b, 0xe912, 0xe9fe, 0x09c1, +0x1b95, 0x069c, 0xe88c, 0xeb9c, 0x0b3a, 0x1ad9, 0x04b6, 0xe82a, 0xed43, 0x0c96, +0x1a00, 0x02df, 0xe7eb, 0xeef3, 0x0dd0, 0x190d, 0x0116, 0xe7d0, 0xf0a8, 0x0eec, +0x1804, 0xff61, 0xe7d8, 0xf25d, 0x0fe6, 0x16e3, 0xfdc0, 0xe800, 0xf412, 0x10bf, +0x15b1, 0xfc36, 0xe848, 0xf5c5, 0x1176, 0x146e, 0xfac2, 0xe8ad, 0xf771, 0x120d, +0x1320, 0xf969, 0xe92e, 0xf913, 0x1282, 0x11c4, 0xf828, 0xe9cb, 0xfaac, 0x12d8, +0x1062, 0xf703, 0xea7e, 0xfc38, 0x130e, 0x0efa, 0xf5fb, 0xeb49, 0xfdb5, 0x1325, +0x0d8e, 0xf50e, 0xec26, 0xff20, 0x131e, 0x0c21, 0xf43f, 0xed15, 0x007a, 0x12fa, +0x0ab6, 0xf38d, 0xee15, 0x01be, 0x12bd, 0x094f, 0xf2f9, 0xef22, 0x02ef, 0x1265, +0x07f0, 0xf283, 0xf037, 0x0408, 0x11f6, 0x0699, 0xf226, 0xf156, 0x050a, 0x1170, +0x054b, 0xf1e8, 0xf27a, 0x05f4, 0x10d8, 0x040c, 0xf1c5, 0xf3a3, 0x06c2, 0x102c, +0x02da, 0xf1bc, 0xf4cc, 0x0779, 0x0f71, 0x01b7, 0xf1cc, 0xf5f5, 0x0815, 0x0ea7, +0x00a8, 0xf1f4, 0xf719, 0x0899, 0x0dd2, 0xffab, 0xf233, 0xf839, 0x0902, 0x0cf4, +0xfec0, 0xf288, 0xf950, 0x0952, 0x0c0e, 0xfdec, 0xf2ee, 0xfa5d, 0x0989, 0x0b23, +0xfd2d, 0xf368, 0xfb62, 0x09a7, 0x0a35, 0xfc85, 0xf3f1, 0xfc58, 0x09af, 0x0946, +0xfbf2, 0xf488, 0xfd3f, 0x09a1, 0x0859, 0xfb77, 0xf52c, 0xfe17, 0x097d, 0x076f, +0xfb14, 0xf5d8, 0xfede, 0x0945, 0x068a, 0xfac6, 0xf68d, 0xff93, 0x08fb, 0x05ad, +0xfa8e, 0xf747, 0x0034, 0x08a1, 0x04da, 0xfa6f, 0xf805, 0x00c2, 0x0836, 0x0410, +0xfa63, 0xf8c6, 0x013c, 0x07bf, 0x0354, 0xfa6c, 0xf985, 0x01a1, 0x073b, 0x02a4, +0xfa8a, 0xfa43, 0x01f1, 0x06af, 0x0204, 0xfab9, 0xfafc, 0x022c, 0x0619, 0x0175, +0xfafa, 0xfbae, 0x0252, 0x057f, 0x00f6, 0xfb4b, 0xfc5a, 0x0263, 0x04e0, 0x008b, +0xfbaa, 0xfcfa, 0x0262, 0x0440, 0x0032, 0xfc16, 0xfd90, 0x024b, 0x03a0, 0xffec, +0xfc8c, 0xfe19, 0x0225, 0x0301, 0xffb9, 0xfd0c, 0xfe93, 0x01ea, 0x0267, 0xff9c, +0xfd95, 0xfefe, 0x01a0, 0x01d3, 0xff90, 0xfe22, 0xff5a, 0x0147, 0x0145, 0xff99, +0xfeb3, 0xffa1, 0x00e0, 0x00c3, 0xffb6, 0xff46, 0xffd9, 0x006d, 0x004b, 0xffe5, +0xffda, 0xfffc, 000000, 0xfffe, 000000, 0xffff, 000000, 0xffff, 0xffff, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000 }; diff --git a/libs/libiax2/src/busy.h b/libs/libiax2/src/busy.h new file mode 100644 index 0000000000000000000000000000000000000000..2c642fae39e9d959201785e55b9e30be39e3425f --- /dev/null +++ b/libs/libiax2/src/busy.h @@ -0,0 +1,55 @@ +/* busy.h: Generated from frequencies 480 and 620 + by gensound. 400 samples */ +static short busy[400] = { + 0, 13697, 24766, 31109, 31585, 26222, 16198, 3569, + -9162, -19575, -25812, -26935, -23069, -15322, -5493, 4339, + 12277, 16985, 17934, 15440, 10519, 4585, -908, -4827, + -6592, -6269, -4489, -2220, -467, 30, -983, -3203, + -5839, -7844, -8215, -6301, -2035, 3975, 10543, 16141, + 19260, 18787, 14322, 6338, -3845, -14296, -22858, -27611, + -27309, -21691, -11585, 1213, 14285, 25068, 31388, 31915, + 26457, 16010, 2568, -11282, -22885, -30054, -31509, -27120, + -17908, -5805, 6760, 17379, 24147, 26028, 23020, 16094, + 6931, -2478, -10279, -15136, -16474, -14538, -10253, -4949, + 0, 3515, 5052, 4688, 3045, 1069, -268, -272, + 1269, 3996, 7067, 9381, 9889, 7910, 3365, -3123, + -10320, -16622, -20424, -20510, -16384, -8448, 2006, 13026, + 22383, 28040, 28613, 23696, 13996, 1232, -12193, -23670, + -30918, -32459, -27935, -18190, -5103, 8795, 20838, 28764, + 31164, 27753, 19395, 7893, -4412, -15136, -22342, -24909, + -22717, -16609, -8143, 780, 8361, 13272, 14909, 13455, + 9758, 5067, 678, -2387, -3624, -3133, -1538, 224, + 1209, 751, -1315, -4580, -8145, -10848, -11585, -9628, + -4878, 2038, 9844, 16867, 21403, 22124, 18429, 10638, + 0, -11524, -21643, -28211, -29702, -25561, -16364, -3737, + 9946, 22044, 30180, 32733, 29182, 20210, 7573, -6269, + -18655, -27259, -30558, -28117, -20645, -9807, 2148, 12878, + 20426, 23599, 22173, 16865, 9117, 731, -6552, -11426, + -13269, -12216, -9050, -4941, -1118, 1460, 2335, 1635, + 0, -1635, -2335, -1460, 1118, 4941, 9050, 12216, + 13269, 11426, 6552, -731, -9117, -16865, -22173, -23599, + -20426, -12878, -2148, 9807, 20645, 28117, 30558, 27259, + 18655, 6269, -7573, -20210, -29182, -32733, -30180, -22044, + -9946, 3737, 16364, 25561, 29702, 28211, 21643, 11524, + 0, -10638, -18429, -22124, -21403, -16867, -9844, -2038, + 4878, 9628, 11585, 10848, 8145, 4580, 1315, -751, + -1209, -224, 1538, 3133, 3624, 2387, -678, -5067, + -9758, -13455, -14909, -13272, -8361, -780, 8143, 16609, + 22717, 24909, 22342, 15136, 4412, -7893, -19395, -27753, + -31164, -28764, -20838, -8795, 5103, 18190, 27935, 32459, + 30918, 23670, 12193, -1232, -13996, -23696, -28613, -28040, + -22383, -13026, -2006, 8448, 16384, 20510, 20424, 16622, + 10320, 3123, -3365, -7910, -9889, -9381, -7067, -3996, + -1269, 272, 268, -1069, -3045, -4688, -5052, -3515, + 0, 4949, 10253, 14538, 16474, 15136, 10279, 2478, + -6931, -16094, -23020, -26028, -24147, -17379, -6760, 5805, + 17908, 27120, 31509, 30054, 22885, 11282, -2568, -16010, + -26457, -31915, -31388, -25068, -14285, -1213, 11585, 21691, + 27309, 27611, 22858, 14296, 3845, -6338, -14322, -18787, + -19260, -16141, -10543, -3975, 2035, 6301, 8215, 7844, + 5839, 3203, 983, -30, 467, 2220, 4489, 6269, + 6592, 4827, 908, -4585, -10519, -15440, -17934, -16985, + -12277, -4339, 5493, 15322, 23069, 26935, 25812, 19575, + 9162, -3569, -16198, -26222, -31585, -31109, -24766, -13697, + +}; diff --git a/libs/libiax2/src/dialtone.h b/libs/libiax2/src/dialtone.h new file mode 100644 index 0000000000000000000000000000000000000000..09b881487da06b420fd96c0b3e65dd697c927599 --- /dev/null +++ b/libs/libiax2/src/dialtone.h @@ -0,0 +1,105 @@ +/* dialtone.h: Generated from frequencies 350 and 440 + by gensound. 800 samples */ +static short dialtone[800] = { + 0, 9997, 19004, 26133, 30692, 32251, 30690, 26206, + 19286, 10657, 1206, -8116, -16396, -22848, -26895, -28221, + -26797, -22878, -16960, -9723, -1954, 5545, 12044, 16954, + 19887, 20687, 19434, 16420, 12107, 7061, 1881, -2866, + -6721, -9365, -10657, -10634, -9491, -7547, -5190, -2822, + -801, 607, 1263, 1168, 454, -633, -1784, -2669, + -2993, -2548, -1247, 855, 3558, 6538, 9388, 11665, + 12955, 12933, 11408, 8370, 3996, -1349, -7152, -12797, + -17635, -21060, -22583, -21895, -18914, -13807, -6985, 934, + 9180, 16913, 23309, 27654, 29422, 28342, 24429, 17998, + 9630, 123, -9589, -18538, -25813, -30667, -32588, -31360, + -27088, -20185, -11332, -1411, 8594, 17694, 24997, 29805, + 31675, 30473, 26374, 19844, 11585, 2455, -6618, -14745, + -21156, -25284, -26815, -25713, -22213, -16785, -10073, -2824, + 4203, 10318, 14969, 17794, 18653, 17628, 14998, 11197, + 6753, 2217, -1899, -5189, -7386, -8388, -8261, -7212, + -5555, -3657, -1881, -536, 169, 157, -515, -1664, + -3009, -4217, -4954, -4940, -3996, -2080, 697, 4081, + 7689, 11059, 13710, 15199, 15187, 13489, 10114, 5272, + -630, -7031, -13263, -18632, -22491, -24320, -23794, -20823, + -15582, -8498, -218, 8457, 16651, 23507, 28276, 30407, + 29606, 25876, 19524, 11134, 1511, -8401, -17616, -25208, + -30406, -32682, -31800, -27845, -21215, -12576, -2796, 7150, + 16278, 23700, 28713, 30868, 30015, 26312, 20199, 12351, + 3598, -5164, -13071, -19378, -23531, -25223, -24413, -21318, + -16384, -10218, -3526, 2980, 8655, 12985, 15642, 16505, + 15661, 13381, 10073, 6228, 2348, -1110, -3796, -5495, + -6152, -5863, -4853, -3434, -1954, -744, -62, -60, + -757, -2037, -3664, -5317, -6637, -7283, -6985, -5590, + -3096, 334, 4390, 8631, 12544, 15605, 17339, 17393, + 15582, 11928, 6672, 258, -6705, -13506, -19403, -23711, + -25879, -25558, -22653, -17341, -10061, -1480, 7570, 16185, + 23475, 28661, 31164, 30670, 27167, 20951, 12603, 2930, + -7116, -16540, -24401, -29915, -32533, -32003, -28391, -22075, + -13704, -4128, 5690, 14781, 22262, 27432, 29838, 29319, + 26014, 20339, 12940, 4614, -3777, -11401, -17540, -21660, + -23463, -22908, -20199, -15755, -10150, -4044, 1898, 7079, + 11030, 13459, 14268, 13555, 11585, 8745, 5487, 2268, + -511, -2559, -3716, -3975, -3468, -2440, -1206, -101, + 578, 618, -78, -1470, -3382, -5524, -7531, -9018, + -9630, -9103, -7308, -4280, -226, 4483, 9357, 13829, + 17329, 19352, 19524, 17659, 13788, 8177, 1302, -6184, + -13528, -19945, -24710, -27240, -27167, -24381, -19058, -11646, + -2830, 6539, 15528, 23219, 28806, 31685, 31520, 28282, + 22254, 14010, 4355, -5759, -15331, -23411, -29203, -32144, + -31966, -28714, -22748, -14695, -5384, 4241, 13228, 20707, + 25981, 28600, 28391, 25479, 20256, 13337, 5482, -2482, + -9761, -15668, -19694, -21556, -21215, -18865, -14902, -9864, + -4366, 975, 5614, 9130, 11270, 11967, 11332, 9628, + 7223, 4536, 1976, -113, -1495, -2071, -1882, -1102, + 0, 1102, 1882, 2071, 1495, 113, -1976, -4536, + -7223, -9628, -11332, -11967, -11270, -9130, -5614, -975, + 4366, 9864, 14902, 18865, 21215, 21556, 19694, 15668, + 9761, 2482, -5482, -13337, -20256, -25479, -28391, -28600, + -25981, -20707, -13228, -4241, 5384, 14695, 22748, 28714, + 31966, 32144, 29203, 23411, 15331, 5759, -4355, -14010, + -22254, -28282, -31520, -31685, -28806, -23219, -15528, -6539, + 2830, 11646, 19058, 24381, 27167, 27240, 24710, 19945, + 13528, 6184, -1302, -8177, -13788, -17659, -19524, -19352, + -17329, -13829, -9357, -4483, 226, 4280, 7308, 9103, + 9630, 9018, 7531, 5524, 3382, 1470, 78, -618, + -578, 101, 1206, 2440, 3468, 3975, 3716, 2559, + 511, -2268, -5487, -8745, -11585, -13555, -14268, -13459, + -11030, -7079, -1898, 4044, 10150, 15755, 20199, 22908, + 23463, 21660, 17540, 11401, 3777, -4614, -12940, -20339, + -26014, -29319, -29838, -27432, -22262, -14781, -5690, 4128, + 13704, 22075, 28391, 32003, 32533, 29915, 24401, 16540, + 7116, -2930, -12603, -20951, -27167, -30670, -31164, -28661, + -23475, -16185, -7570, 1480, 10061, 17341, 22653, 25558, + 25879, 23711, 19403, 13506, 6705, -258, -6672, -11928, + -15582, -17393, -17339, -15605, -12544, -8631, -4390, -334, + 3096, 5590, 6985, 7283, 6637, 5317, 3664, 2037, + 757, 60, 62, 744, 1954, 3434, 4853, 5863, + 6152, 5495, 3796, 1110, -2348, -6228, -10073, -13381, + -15661, -16505, -15642, -12985, -8655, -2980, 3526, 10218, + 16384, 21318, 24413, 25223, 23531, 19378, 13071, 5164, + -3598, -12351, -20199, -26312, -30015, -30868, -28713, -23700, + -16278, -7150, 2796, 12576, 21215, 27845, 31800, 32682, + 30406, 25208, 17616, 8401, -1511, -11134, -19524, -25876, + -29606, -30407, -28276, -23507, -16651, -8457, 218, 8498, + 15582, 20823, 23794, 24320, 22491, 18632, 13263, 7031, + 630, -5272, -10114, -13489, -15187, -15199, -13710, -11059, + -7689, -4081, -697, 2080, 3996, 4940, 4954, 4217, + 3009, 1664, 515, -157, -169, 536, 1881, 3657, + 5555, 7212, 8261, 8388, 7386, 5189, 1899, -2217, + -6753, -11197, -14998, -17628, -18653, -17794, -14969, -10318, + -4203, 2824, 10073, 16785, 22213, 25713, 26815, 25284, + 21156, 14745, 6618, -2455, -11585, -19844, -26374, -30473, + -31675, -29805, -24997, -17694, -8594, 1411, 11332, 20185, + 27088, 31360, 32588, 30667, 25813, 18538, 9589, -123, + -9630, -17998, -24429, -28342, -29422, -27654, -23309, -16913, + -9180, -934, 6985, 13807, 18914, 21895, 22583, 21060, + 17635, 12797, 7152, 1349, -3996, -8370, -11408, -12933, + -12955, -11665, -9388, -6538, -3558, -855, 1247, 2548, + 2993, 2669, 1784, 633, -454, -1168, -1263, -607, + 801, 2822, 5190, 7547, 9491, 10634, 10657, 9365, + 6721, 2866, -1881, -7061, -12107, -16420, -19434, -20687, + -19887, -16954, -12044, -5545, 1954, 9723, 16960, 22878, + 26797, 28221, 26895, 22848, 16396, 8116, -1206, -10657, + -19286, -26206, -30690, -32251, -30692, -26133, -19004, -9997, + +}; diff --git a/libs/libiax2/src/frame.h b/libs/libiax2/src/frame.h new file mode 100644 index 0000000000000000000000000000000000000000..efc91d6af9cdb1fd22aa9501ba36bce6951feb0a --- /dev/null +++ b/libs/libiax2/src/frame.h @@ -0,0 +1,148 @@ +/* + * libiax: An implementation of the Inter-Asterisk eXchange protocol + * + * Asterisk internal frame definitions. + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU Lesser General Public License. Other components of + * Asterisk are distributed under The GNU General Public License + * only. + */ + +#ifndef _LIBIAX_FRAME_H +#define _LIBIAX_FRAME_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* Frame types */ +#define AST_FRAME_DTMF 1 /* A DTMF digit, subclass is the digit */ +#define AST_FRAME_VOICE 2 /* Voice data, subclass is AST_FORMAT_* */ +#define AST_FRAME_VIDEO 3 /* Video frame, maybe?? :) */ +#define AST_FRAME_CONTROL 4 /* A control frame, subclass is AST_CONTROL_* */ +#define AST_FRAME_NULL 5 /* An empty, useless frame */ +#define AST_FRAME_IAX 6 /* Inter Aterisk Exchange private frame type */ +#define AST_FRAME_TEXT 7 /* Text messages */ +#define AST_FRAME_IMAGE 8 /* Image Frames */ +#define AST_FRAME_HTML 9 /* HTML Frames */ +#define AST_FRAME_CNG 10 /* Comfort Noise frame (subclass is level of CNG in -dBov) */ + +/* HTML subclasses */ +#define AST_HTML_URL 1 /* Sending a URL */ +#define AST_HTML_DATA 2 /* Data frame */ +#define AST_HTML_BEGIN 4 /* Beginning frame */ +#define AST_HTML_END 8 /* End frame */ +#define AST_HTML_LDCOMPLETE 16 /* Load is complete */ +#define AST_HTML_NOSUPPORT 17 /* Peer is unable to support HTML */ +#define AST_HTML_LINKURL 18 /* Send URL and track */ +#define AST_HTML_UNLINK 19 /* Request no more linkage */ +#define AST_HTML_LINKREJECT 20 /* Reject LINKURL */ + +/* Data formats for capabilities and frames alike */ +/*! G.723.1 compression */ +#define AST_FORMAT_G723_1 (1 << 0) + /*! GSM compression */ +#define AST_FORMAT_GSM (1 << 1) + /*! Raw mu-law data (G.711) */ +#define AST_FORMAT_ULAW (1 << 2) + /*! Raw A-law data (G.711) */ +#define AST_FORMAT_ALAW (1 << 3) + /*! ADPCM (G.726, 32kbps) */ +#define AST_FORMAT_G726 (1 << 4) + /*! ADPCM (IMA) */ +#define AST_FORMAT_ADPCM (1 << 5) + /*! Raw 16-bit Signed Linear (8000 Hz) PCM */ +#define AST_FORMAT_SLINEAR (1 << 6) + /*! LPC10, 180 samples/frame */ +#define AST_FORMAT_LPC10 (1 << 7) + /*! G.729A audio */ +#define AST_FORMAT_G729A (1 << 8) + /*! SpeeX Free Compression */ +#define AST_FORMAT_SPEEX (1 << 9) + /*! iLBC Free Compression */ +#define AST_FORMAT_ILBC (1 << 10) + /*! Maximum audio format */ +#define AST_FORMAT_MAX_AUDIO (1 << 15) + /*! JPEG Images */ +#define AST_FORMAT_JPEG (1 << 16) + /*! PNG Images */ +#define AST_FORMAT_PNG (1 << 17) + /*! H.261 Video */ +#define AST_FORMAT_H261 (1 << 18) + /*! H.263 Video */ +#define AST_FORMAT_H263 (1 << 19) + /*! H.263+ Video */ +#define AST_FORMAT_H263p (1 << 20) + /*! H.264 Video*/ +#define AST_FORMAT_H264 (1 << 21) + /*! MPEG4 Video*/ +#define AST_FORMAT_MPEG4 (1 << 22) + /*! Theora Video */ +#define AST_FORMAT_THEORA (1 << 24) + /*! Max one */ +#define AST_FORMAT_MAX_VIDEO (1 << 24) + +/* Control frame types */ +#define AST_CONTROL_HANGUP 1 /* Other end has hungup */ +#define AST_CONTROL_RING 2 /* Local ring */ +#define AST_CONTROL_RINGING 3 /* Remote end is ringing */ +#define AST_CONTROL_ANSWER 4 /* Remote end has answered */ +#define AST_CONTROL_BUSY 5 /* Remote end is busy */ +#define AST_CONTROL_TAKEOFFHOOK 6 /* Make it go off hook */ +#define AST_CONTROL_OFFHOOK 7 /* Line is off hook */ +#define AST_CONTROL_CONGESTION 8 /* Congestion (circuits busy) */ +#define AST_CONTROL_FLASH 9 /* Flash hook */ +#define AST_CONTROL_WINK 10 /* Wink */ +#define AST_CONTROL_OPTION 11 /* Set an option */ +#define AST_CONTROL_KEY_RADIO 12 /* Key Radio */ +#define AST_CONTROL_UNKEY_RADIO 13 /* Unkey Radio */ +#define AST_CONTROL_CALL_PROGRESS 14 /* Call is in progress */ +#define AST_CONTROL_CALL_PROCEEDING 15 /* Call is proceeding */ +#define AST_CONTROL_HOLD 16 /* Call is placed on hold */ +#define AST_CONTROL_UNHOLD 17 /* Call is taken off hold */ + +#define AST_FRIENDLY_OFFSET 64 /* Reserved header space */ + +struct ast_frame { + /*! Kind of frame */ + int frametype; + /*! Subclass, frame dependent */ + int subclass; + /*! Length of data */ + int datalen; + /*! Number of 8khz samples in this frame */ + int samples; + /*! Was the data malloc'd? i.e. should we free it when we discard the f +rame? */ + int mallocd; + /*! How far into "data" the data really starts */ + int offset; + /*! Optional source of frame for debugging */ + char *src; + /*! Pointer to actual data */ + void *data; + /*! Next/Prev for linking stand alone frames */ + struct ast_frame *prev; + /*! Next/Prev for linking stand alone frames */ + struct ast_frame *next; + /* Unused except + if debugging is turned on, but left + in the struct + so that it can be turned on without + requiring a r +ecompile of the whole thing */ +}; + + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + + +#endif diff --git a/libs/libiax2/src/iax-client.h b/libs/libiax2/src/iax-client.h new file mode 100644 index 0000000000000000000000000000000000000000..bd5bf609b768ef55b502e2ae00158f17fe78d5f4 --- /dev/null +++ b/libs/libiax2/src/iax-client.h @@ -0,0 +1,252 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Implementation of Inter-Asterisk eXchange + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU Lesser General Public License (LGPL) + */ + +#ifndef _ASTERISK_IAX_CLIENT_H +#define _ASTERISK_IAX_CLIENT_H + +#if defined(_MSC_VER) +/* disable zero-sized array in struct/union warning */ +#pragma warning(disable:4200) +#endif + +#ifndef LINUX +#define socklen_t int +#endif + +#include "frame.h" +#include "iax2.h" +#include "iax2-parser.h" + +#define MAXSTRLEN 80 + +#define IAX_AUTHMETHOD_PLAINTEXT IAX_AUTH_PLAINTEXT +#define IAX_AUTHMETHOD_MD5 IAX_AUTH_MD5 + +extern char iax_errstr[]; + +struct iax_session; + + +#define IAX_EVENT_CONNECT 0 /* Connect a new call */ +#define IAX_EVENT_ACCEPT 1 /* Accept a call */ +#define IAX_EVENT_HANGUP 2 /* Hang up a call */ +#define IAX_EVENT_REJECT 3 /* Rejected call */ +#define IAX_EVENT_VOICE 4 /* Voice Data */ +#define IAX_EVENT_DTMF 5 /* A DTMF Tone */ +#define IAX_EVENT_TIMEOUT 6 /* Connection timeout... session + will be a pointer to free()'d + memory! */ +#define IAX_EVENT_LAGRQ 7 /* Lag request -- Internal use only */ +#define IAX_EVENT_LAGRP 8 /* Lag Measurement. See event.lag */ +#define IAX_EVENT_RINGA 9 /* Announce we/they are ringing */ +#define IAX_EVENT_PING 10 /* Ping -- internal use only */ +#define IAX_EVENT_PONG 11 /* Pong -- internal use only */ +#define IAX_EVENT_BUSY 12 /* Report a line busy */ +#define IAX_EVENT_ANSWER 13 /* Answer the line */ + +#define IAX_EVENT_IMAGE 14 /* Send/Receive an image */ +#define IAX_EVENT_AUTHRQ 15 /* Authentication request */ +#define IAX_EVENT_AUTHRP 16 /* Authentication reply */ + +#define IAX_EVENT_REGREQ 17 /* Registration request */ +#define IAX_EVENT_REGACK 18 /* Registration reply */ +#define IAX_EVENT_URL 19 /* URL received */ +#define IAX_EVENT_LDCOMPLETE 20 /* URL loading complete */ + +#define IAX_EVENT_TRANSFER 21 /* Transfer has taken place */ + +#define IAX_EVENT_DPREQ 22 /* Dialplan request */ +#define IAX_EVENT_DPREP 23 /* Dialplan reply */ +#define IAX_EVENT_DIAL 24 /* Dial on a TBD call */ + +#define IAX_EVENT_QUELCH 25 /* Quelch Audio */ +#define IAX_EVENT_UNQUELCH 26 /* Unquelch Audio */ + +#define IAX_EVENT_UNLINK 27 /* Unlink */ +#define IAX_EVENT_LINKREJECT 28 /* Link Rejection */ +#define IAX_EVENT_TEXT 29 /* Text Frame :-) */ +#define IAX_EVENT_REGREJ 30 /* Registration reply */ +#define IAX_EVENT_LINKURL 31 /* Unlink */ +#define IAX_EVENT_CNG 32 /* Comfort-noise (almost silence) */ +#define IAX_EVENT_POKE 33 +#define IAX_EVENT_VIDEO 34 /* Send/receive video */ + + +/* moved from iax.c to support attended transfer */ +#define IAX_EVENT_REREQUEST 999 +#define IAX_EVENT_TXREPLY 1000 +#define IAX_EVENT_TXREJECT 1001 +#define IAX_EVENT_TXACCEPT 1002 +#define IAX_EVENT_TXREADY 1003 + +/* + * Null event. We use it to notify back the caller that a frame has been + * received and is queued for delivery + * Applciations should simply ignore it + */ +#define IAX_EVENT_NULL 65535 + +#define IAX_SCHEDULE_FUZZ 0 /* ms of fuzz to drop */ + +#if defined(WIN32) || defined(_WIN32_WCE) +#if defined(_MSC_VER) +typedef int (__stdcall *iax_sendto_t)(SOCKET, const void *, size_t, int, + const struct sockaddr *, socklen_t); +typedef int (__stdcall *iax_recvfrom_t)(SOCKET, void *, size_t, int, + struct sockaddr *, socklen_t *); +#else +typedef int PASCAL (*iax_sendto_t)(SOCKET, const char *, int, int, + const struct sockaddr *, int); +typedef int PASCAL (*iax_recvfrom_t)(SOCKET, char *, int, int, + struct sockaddr *, int *); +#endif +#else +typedef int (*iax_sendto_t)(int, const void *, size_t, int, + const struct sockaddr *, socklen_t); +typedef int (*iax_recvfrom_t)(int, void *, size_t, int, + struct sockaddr *, socklen_t *); +#endif + +struct iax_event { + int etype; /* Type of event */ + int subclass; /* Subclass data (event specific) */ + unsigned int ts; /* Timestamp */ + struct iax_session *session; /* Applicable session */ + int datalen; /* Length of raw data */ + struct iax_ies ies; /* IE's for IAX2 frames */ + unsigned char data[0]; /* Raw data if applicable */ +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* All functions return 0 on success and -1 on failure unless otherwise + specified */ + +/* Called to initialize IAX structures and sockets. Returns actual + portnumber (which it will try preferred portno first, but if not + take what it can get */ +extern int iax_init(int preferredportno); + +/* Get filedescriptor for IAX to use with select or gtk_input_add */ +extern int iax_get_fd(void); + +/* Find out how many milliseconds until the next scheduled event */ +extern int iax_time_to_next_event(void); + +/* Generate a new IAX session */ +extern struct iax_session *iax_session_new(void); + +/* Return exactly one iax event (if there is one pending). If blocking is + non-zero, IAX will block until some event is received */ +extern struct iax_event *iax_get_event(int blocking); + + +extern int iax_auth_reply(struct iax_session *session, char *password, + char *challenge, int methods); + +/* Free an event */ +extern void iax_event_free(struct iax_event *event); + +struct sockaddr_in; + +/* Front ends for sending events */ +extern int iax_send_dtmf(struct iax_session *session, char digit); +extern int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples); +extern int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen); +extern int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen); +extern int iax_send_url(struct iax_session *session, const char *url, int link); +extern int iax_send_text(struct iax_session *session, const char *text); +extern int iax_send_ping(struct iax_session *session); +extern int iax_load_complete(struct iax_session *session); +extern int iax_reject(struct iax_session *session, char *reason); +extern int iax_busy(struct iax_session *session); +extern int iax_congestion(struct iax_session *session); +extern int iax_hangup(struct iax_session *session, char *byemsg); +extern int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, const char *ich, const char *lang, int wait, int format, int capability); +extern int iax_accept(struct iax_session *session, int format); +extern int iax_answer(struct iax_session *session); +extern int iax_sendurl(struct iax_session *session, char *url); +extern int iax_send_unlink(struct iax_session *session); +extern int iax_send_link_reject(struct iax_session *session); +extern int iax_ring_announce(struct iax_session *session); +extern struct sockaddr_in iax_get_peer_addr(struct iax_session *session); +extern int iax_register(struct iax_session *session, const char *hostname, const char *peer, const char *secret, int refresh); +extern int iax_lag_request(struct iax_session *session); +extern int iax_dial(struct iax_session *session, char *number); /* Dial on a TBD call */ +extern int iax_dialplan_request(struct iax_session *session, char *number); /* Request dialplan status for number */ +extern int iax_quelch(struct iax_session *session); +extern int iax_unquelch(struct iax_session * session); +extern int iax_transfer(struct iax_session *session, const char *number); +extern int iax_quelch_moh(struct iax_session *session, int MOH); +extern int iax_send_video(struct iax_session *session, int format, unsigned char *data, int datalen, int fullframe); +extern int iax_send_video_trunk(struct iax_session *session, int format, char *data, int datalen, int fullframe, int ntrunk); + +extern void iax_destroy(struct iax_session * session); + +extern void iax_enable_debug(void); +extern void iax_disable_debug(void); + +/* For attended transfer, application create a new session, + * make a call on the new session. + * On answer of the new session, call iax_setup_transfer and wait for + * IAX_EVENT_TXREADY when both sides are completed succefully or + * IAX_EVENT_TXREJECT for either side. + * If there are music on hold the it will be stopped by this library. + */ +extern int iax_setup_transfer(struct iax_session *s0, struct iax_session *s1); + +struct iax_netstat { + int jitter; + int losspct; + int losscnt; + int packets; + int delay; + int dropped; + int ooo; +}; +/* fills in rtt, and an iax_netstat structure for each of local/remote directions of call */ +extern int iax_get_netstats(struct iax_session *s, int *rtt, struct iax_netstat *local, struct iax_netstat *remote); + + +extern void iax_set_private(struct iax_session *s, void *pvt); +extern void *iax_get_private(struct iax_session *s); +extern void iax_set_sendto(struct iax_session *s, iax_sendto_t sendto); + +/* to use application networking instead of internal, set call this instead of iax_init, + * and pass in sendto and recvfrom replacements. blocking reads may not be implemented */ +extern void iax_set_networking(iax_sendto_t st, iax_recvfrom_t rf); + +/* destroy an iax session */ +extern void iax_session_destroy(struct iax_session **session); + +/* To control use of jitter buffer for video event */ +int iax_video_bypass_jitter(struct iax_session*, int ); + +/* Handle externally received frames */ +struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin); +extern unsigned int iax_session_get_capability(struct iax_session *s); +extern char iax_pref_codec_add(struct iax_session *session, unsigned int format); +extern void iax_pref_codec_del(struct iax_session *session, unsigned int format); +extern int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len); + +/* Fine tune jitterbuffer */ +extern void iax_set_jb_target_extra( long value ); + +#if defined(__cplusplus) +} +#endif + +#endif /* _ASTERISK_IAX_CLIENT_H */ diff --git a/libs/libiax2/src/iax.c b/libs/libiax2/src/iax.c new file mode 100644 index 0000000000000000000000000000000000000000..5c184a1de6727ce75b0ed00ffa588b593cbeb4d1 --- /dev/null +++ b/libs/libiax2/src/iax.c @@ -0,0 +1,3384 @@ + /* + * libiax: An implementation of Inter-Asterisk eXchange + * + * Copyright (C) 2001, Linux Support Services, Inc. + * + * Mark Spencer <markster@linux-support.net> + * Frik Strecker <frik@gatherworks.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(WIN32) || defined(_WIN32_WCE) +#undef __STRICT_ANSI__ //for strdup with ms + +#if defined(_WIN32_WCE) +#define strdup _strdup +#else +#include <process.h> +#include <fcntl.h> +#include <io.h> +#include <errno.h> +#endif +#include <string.h> +#include <windows.h> +#include <winsock.h> +#include <time.h> +#include <stdlib.h> +#include <malloc.h> +#include <stdarg.h> +#include <stdio.h> +#include <limits.h> + + +#define snprintf _snprintf + +#if defined(_MSC_VER) +#define close closesocket +#if !defined(_WIN32_WCE) +#define inline __inline +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif +void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); +#ifdef __cplusplus +} +#endif + +#else + +#include <netdb.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/time.h> +#include <stdlib.h> +#ifdef __GNUC__ +#ifndef __USE_SVID +#define __USE_SVID +#endif +#endif +#include <string.h> +#include <stdarg.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/select.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <time.h> + +#ifndef MACOSX +#include <malloc.h> +#ifndef SOLARIS +#include <error.h> +#endif +#endif + +#endif + +#include "jitterbuf.h" +#include "iax-client.h" +#include "md5.h" + +/* Define socket options for IAX2 sockets, based on platform + * availability of flags */ +#if defined(WIN32) || defined(_WIN32_WCE) +#define IAX_SOCKOPTS 0 +#else +#ifdef MACOSX +#define IAX_SOCKOPTS MSG_DONTWAIT +#else +#ifdef SOLARIS +#define IAX_SOCKOPTS MSG_DONTWAIT +#else /* Linux and others */ +#define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL +#endif +#endif +#endif + + +#ifdef SNOM_HACK +/* The snom phone seems to improperly execute memset in some cases */ +#include "../../snom_phonecore2/include/snom_memset.h" +#endif + +/* Voice TS Prediction causes libiax2 to clean up the timestamps on + * outgoing frames. It works best with either continuous voice, or + * callers who call iax_send_cng to indicate DTX for silence */ +#define USE_VOICE_TS_PREDICTION + +#define MIN_RETRY_TIME 10 +#define MAX_RETRY_TIME 4000 +#define MEMORY_SIZE 1000 + +#define TRANSFER_NONE 0 +#define TRANSFER_BEGIN 1 +#define TRANSFER_READY 2 +#define TRANSFER_REL 3 + +/* Video frames bypass jitterbuffer */ +static int video_bypass_jitterbuffer = 0; + +/* UDP Socket (file descriptor) */ +static int netfd = -1; + +/* Max timeouts */ +static const int maxretries = 10; + +/* configurable jitterbuffer options */ +static long jb_target_extra = -1; + +/* external global networking replacements */ +static iax_sendto_t iax_sendto = (iax_sendto_t) sendto; +static iax_recvfrom_t iax_recvfrom = (iax_recvfrom_t) recvfrom; + +/* ping interval (seconds) */ +static int ping_time = 10; +static void send_ping(void *session); + +struct iax_session { + /** Private data */ + void *pvt; + /** session-local Sendto function */ + iax_sendto_t sendto; + /** Is voice quelched (e.g. hold) */ + int quelch; + /** Codec Pref Order */ + char codec_order[32]; + /** Codec Pref Order Index*/ + int codec_order_len; + /** Last received voice format */ + int voiceformat; + /** Last transmitted voice format */ + int svoiceformat; + /** Last received video format */ + int videoformat; + /** Last transmitted video format */ + int svideoformat; + /** Per session capability */ + int capability; + /** Last received timestamp */ + unsigned int last_ts; + /** Last transmitted timestamp */ + unsigned int lastsent; +#ifdef USE_VOICE_TS_PREDICTION + /** Next predicted voice ts */ + unsigned int nextpred; + /** True if the last voice we transmitted was not silence/CNG */ + int notsilenttx; +#endif + /** Our last measured ping time */ + unsigned int pingtime; + /** Address of peer */ + struct sockaddr_in peeraddr; + /** Our call number */ + int callno; + /** Peer's call number */ + int peercallno; + /** Our next outgoing sequence number */ + unsigned char oseqno; + /** Next sequence number they have not yet acknowledged */ + unsigned char rseqno; + /** Our last received incoming sequence number */ + unsigned char iseqno; + /** Last acknowledged sequence number */ + unsigned char aseqno; + /** Last sequence number we VNAKd */ + unsigned char lastvnak; + /** Time value that we base our transmission on */ + struct timeval offset; + /** Time value we base our delivery on */ + struct timeval rxcore; + /** Current link state */ + int state; + /** Expected Username */ + char username[MAXSTRLEN]; + /** Expected Secret */ + char secret[MAXSTRLEN]; + /** Refresh if applicable */ + int refresh; + + /** ping scheduler id */ + int pingid; + + /** Transfer stuff */ + struct sockaddr_in transfer; + int transferring; + int transfercallno; + int transferid; + int transferpeer; /** for attended transfer */ + int transfer_moh; /** for music on hold while performing attended transfer */ + + jitterbuf *jb; + + struct iax_netstat remote_netstats; + + /** For linking if there are multiple connections */ + struct iax_session *next; +}; + +char iax_errstr[256]; + + +#define IAXERROR snprintf(iax_errstr, sizeof(iax_errstr), + +#ifdef DEBUG_SUPPORT + +#ifdef DEBUG_DEFAULT +static int debug = 1; +#else +static int debug = 0; +#endif + +void iax_enable_debug(void) +{ + debug = 1; +} + +void iax_disable_debug(void) +{ + debug = 0; +} + + +/* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ +#if defined(WIN32) || defined(_WIN32_WCE) +#define G __FILE__, __LINE__, +#else +#define G __FILE__, __LINE__, __PRETTY_FUNCTION__, +#endif + +#define DEBU __debug +#if defined(WIN32) || defined(_WIN32_WCE) +static int __debug(char *file, int lineno, char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + if (debug) { + fprintf(stderr, "%s line %d: ", file, lineno); + vfprintf(stderr, fmt, args); + } + va_end(args); + return 0; +} +#else +static int __debug(char *file, int lineno, char *func, char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + if (debug) { + fprintf(stderr, "%s line %d in %s: ", file, lineno, func); + vfprintf(stderr, fmt, args); + } + va_end(args); + return 0; +} +#endif +#else /* No debug support */ + +#if defined(WIN32) || defined(_WIN32_WCE) +#define DEBU +#else +#define DEBU(fmt...) \ + do {} while(0) +#endif +#define G +#endif + +typedef void (*sched_func)(void *); + +struct iax_sched { + /** These are scheduled things to be delivered */ + struct timeval when; + /** If event is non-NULL then we're delivering an event */ + struct iax_event *event; + /** If frame is non-NULL then we're transmitting a frame */ + struct iax_frame *frame; + /** If func is non-NULL then we should call it */ + sched_func func; + /** and pass it this argument */ + void *arg; + /** Easy linking */ + struct iax_sched *next; +}; + +static struct iax_sched *schedq = NULL; +static struct iax_session *sessions = NULL; +static int callnums = 1; +static int transfer_id = 1; /** for attended transfer */ + + +void iax_set_private(struct iax_session *s, void *ptr) +{ + s->pvt = ptr; +} + +void *iax_get_private(struct iax_session *s) +{ + return s->pvt; +} + +void iax_set_sendto(struct iax_session *s, iax_sendto_t ptr) +{ + s->sendto = ptr; +} + + +unsigned int iax_session_get_capability(struct iax_session *s) +{ + return s->capability; +} + + +static int inaddrcmp(struct sockaddr_in *sin1, struct sockaddr_in *sin2) +{ + return (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) || (sin1->sin_port != sin2->sin_port); +} + +static int iax_sched_add(struct iax_event *event, struct iax_frame *frame, sched_func func, void *arg, int ms) +{ + + /* Schedule event to be delivered to the client + in ms milliseconds from now, or a reliable frame to be retransmitted */ + struct iax_sched *sched, *cur, *prev = NULL; + + if (!event && !frame && !func) { + DEBU(G "No event, no frame, no func? what are we scheduling?\n"); + return -1; + } + + //fprintf(stderr, "scheduling event %d ms from now\n", ms); + sched = (struct iax_sched*)malloc(sizeof(struct iax_sched)); + if (sched) { + memset(sched, 0, sizeof(struct iax_sched)); + gettimeofday(&sched->when, NULL); + sched->when.tv_sec += (ms / 1000); + ms = ms % 1000; + sched->when.tv_usec += (ms * 1000); + if (sched->when.tv_usec > 1000000) { + sched->when.tv_usec -= 1000000; + sched->when.tv_sec++; + } + sched->event = event; + sched->frame = frame; + sched->func = func; + sched->arg = arg; + /* Put it in the list, in order */ + cur = schedq; + while(cur && ((cur->when.tv_sec < sched->when.tv_sec) || + ((cur->when.tv_usec <= sched->when.tv_usec) && + (cur->when.tv_sec == sched->when.tv_sec)))) { + prev = cur; + cur = cur->next; + } + sched->next = cur; + if (prev) { + prev->next = sched; + } else { + schedq = sched; + } + return 0; + } else { + DEBU(G "Out of memory!\n"); + return -1; + } +} + +static int iax_sched_del(struct iax_event *event, struct iax_frame *frame, sched_func func, void *arg, int all) +{ + struct iax_sched *cur, *tmp, *prev = NULL; + + cur = schedq; + while (cur) { + if (cur->event == event && cur->frame == frame && cur->func == func && cur->arg == arg) { + if (prev) + prev->next = cur->next; + else + schedq = cur->next; + tmp = cur; + cur = cur->next; + free(tmp); + if (!all) + return -1; + } else { + prev = cur; + cur = cur->next; + } + } + return 0; +} + + +int iax_time_to_next_event(void) +{ + struct timeval tv; + struct iax_sched *cur = schedq; + int ms, min = 999999999; + + /* If there are no pending events, we don't need to timeout */ + if (!cur) + return -1; + gettimeofday(&tv, NULL); + while(cur) { + ms = (cur->when.tv_sec - tv.tv_sec) * 1000 + + (cur->when.tv_usec - tv.tv_usec) / 1000; + if (ms < min) + min = ms; + cur = cur->next; + } + if (min < 0) + min = 0; + return min; +} + +struct iax_session *iax_session_new(void) +{ + struct iax_session *s; + s = (struct iax_session *)malloc(sizeof(struct iax_session)); + if (s) { + jb_conf jbconf; + + memset(s, 0, sizeof(struct iax_session)); + /* Initialize important fields */ + s->voiceformat = -1; + s->svoiceformat = -1; + s->videoformat = -1; + /* Default pingtime to 100 ms -- should cover most decent net connections */ + s->pingtime = 100; + /* XXX Not quite right -- make sure it's not in use, but that won't matter + unless you've had at least 65k calls. XXX */ + s->callno = callnums++; + if (callnums > 32767) + callnums = 1; + s->peercallno = 0; + s->lastvnak = -1; + s->transferpeer = 0; /* for attended transfer */ + s->next = sessions; + s->sendto = iax_sendto; + s->pingid = -1; + + s->jb = jb_new(); + if ( !s->jb ) + { + free(s); + return 0; + } + jbconf.max_jitterbuf = 0; + jbconf.resync_threshold = 1000; + jbconf.max_contig_interp = 0; + jbconf.target_extra = jb_target_extra; + jb_setconf(s->jb, &jbconf); + + sessions = s; + } + return s; +} + +static int iax_session_valid(struct iax_session *session) +{ + /* Return -1 on a valid iax session pointer, 0 on a failure */ + struct iax_session *cur = sessions; + while(cur) { + if (session == cur) + return -1; + cur = cur->next; + } + return 0; +} + +int iax_get_netstats(struct iax_session *session, int *rtt, struct iax_netstat *local, struct iax_netstat *remote) +{ + jb_info stats; + + if(!iax_session_valid(session)) return -1; + + *rtt = session->pingtime; + + *remote = session->remote_netstats; + + jb_getinfo(session->jb, &stats); + + local->jitter = stats.jitter; + /* XXX: should be short-term loss pct.. */ + if(stats.frames_in == 0) stats.frames_in = 1; + local->losspct = stats.losspct/1000; + local->losscnt = stats.frames_lost; + local->packets = stats.frames_in; + local->delay = stats.current - stats.min; + local->dropped = stats.frames_dropped; + local->ooo = stats.frames_ooo; + + return 0; +} + +#ifdef USE_VOICE_TS_PREDICTION +static void add_ms(struct timeval *tv, int ms) +{ + tv->tv_usec += ms * 1000; + if(tv->tv_usec > 1000000) { + tv->tv_usec -= 1000000; + tv->tv_sec++; + } + if(tv->tv_usec < 0) { + tv->tv_usec += 1000000; + tv->tv_sec--; + } +} +#endif + +static int calc_timestamp(struct iax_session *session, unsigned int ts, struct ast_frame *f) +{ + int ms; + struct timeval tv; + int voice = 0; + int video = 0; + int genuine = 0; + + if ( f && f->frametype == AST_FRAME_VOICE ) + { + voice = 1; + } else if ( f && f->frametype == AST_FRAME_VIDEO ) + { + video = 1; + } else if (!f || f->frametype == AST_FRAME_IAX) + { + genuine = 1; + } + + /* If this is the first packet we're sending, get our + offset now. */ + if (!session->offset.tv_sec && !session->offset.tv_usec) + gettimeofday(&session->offset, NULL); + + /* If the timestamp is specified, just use their specified + timestamp no matter what. Usually this is done for + special cases. */ + if (ts) + { + if ( f && session ) + session->lastsent = ts; + return ts; + } + + /* Otherwise calculate the timestamp from the current time */ + gettimeofday(&tv, NULL); + + /* Calculate the number of milliseconds since we sent the first packet */ + ms = (tv.tv_sec - session->offset.tv_sec) * 1000 + + (tv.tv_usec - session->offset.tv_usec) / 1000; + + if (ms < 0) + ms = 0; + + if(voice) { +#ifdef USE_VOICE_TS_PREDICTION + /* If we haven't most recently sent silence, and we're + * close in time, use predicted time */ + if(session->notsilenttx && abs(ms - session->nextpred) <= 240) { + /* Adjust our txcore, keeping voice and non-voice + * synchronized */ + add_ms(&session->offset, (int)(ms - session->nextpred)/10); + + if(!session->nextpred) + session->nextpred = ms; + ms = session->nextpred; + } else { + /* in this case, just use the actual time, since + * we're either way off (shouldn't happen), or we're + * ending a silent period -- and seed the next predicted + * time. Also, round ms to the next multiple of + * frame size (so our silent periods are multiples + * of frame size too) */ + int diff = ms % (f->samples / 8); + if(diff) + ms += f->samples/8 - diff; + session->nextpred = ms; + } + session->notsilenttx = 1; +#else + if(ms <= session->lastsent) + ms = session->lastsent + 3; +#endif + } else if (video) { + if ((unsigned int)ms <= session->lastsent) + ms = session->lastsent + 3; + } else { + /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) + if appropriate unless it's a genuine frame */ + if (genuine) { + if ((unsigned int)ms <= session->lastsent) + ms = session->lastsent + 3; + } else if (abs(ms - session->lastsent) <= 240) { + ms = session->lastsent + 3; + } + + } + + /* Record the last sent packet for future reference */ + /* unless an AST_FRAME_IAX */ + if (!genuine) + session->lastsent = ms; + +#ifdef USE_VOICE_TS_PREDICTION + /* set next predicted ts based on 8khz samples */ + if(voice) + session->nextpred = session->nextpred + f->samples / 8; +#endif + + return ms; +} + +static unsigned char get_n_bits_at(unsigned char *data, int n, int bit) +{ + int byte = bit / 8; /* byte containing first bit */ + int rem = 8 - (bit % 8); /* remaining bits in first byte */ + unsigned char ret = 0; + + if (n <= 0 || n > 8) + return 0; + + if (rem < n) { + ret = (data[byte] << (n - rem)); + ret |= (data[byte + 1] >> (8 - n + rem)); + } else { + ret = (data[byte] >> (rem - n)); + } + + return (ret & (0xff >> (8 - n))); +} + +static int speex_get_wb_sz_at(unsigned char *data, int len, int bit) +{ + static int SpeexWBSubModeSz[] = { + 0, 36, 112, 192, + 352, 0, 0, 0 }; + int off = bit; + unsigned char c; + + /* skip up to two wideband frames */ + if (((len * 8 - off) >= 5) && + get_n_bits_at(data, 1, off)) { + c = get_n_bits_at(data, 3, off + 1); + off += SpeexWBSubModeSz[c]; + + if (((len * 8 - off) >= 5) && + get_n_bits_at(data, 1, off)) { + c = get_n_bits_at(data, 3, off + 1); + off += SpeexWBSubModeSz[c]; + + if (((len * 8 - off) >= 5) && + get_n_bits_at(data, 1, off)) { + /* too many in a row */ + DEBU(G "\tCORRUPT too many wideband streams in a row\n"); + return -1; + } + } + + } + return off - bit; +} + +static int speex_get_samples(unsigned char *data, int len) +{ + static int SpeexSubModeSz[] = { + 0, 43, 119, 160, + 220, 300, 364, 492, + 79, 0, 0, 0, + 0, 0, 0, 0 }; + static int SpeexInBandSz[] = { + 1, 1, 4, 4, + 4, 4, 4, 4, + 8, 8, 16, 16, + 32, 32, 64, 64 }; + int bit = 0; + int cnt = 0; + int off = 0; + unsigned char c; + + DEBU(G "speex_get_samples(%d)\n", len); + while ((len * 8 - bit) >= 5) { + /* skip wideband frames */ + off = speex_get_wb_sz_at(data, len, bit); + if (off < 0) { + DEBU(G "\tERROR reading wideband frames\n"); + break; + } + bit += off; + + if ((len * 8 - bit) < 5) { + DEBU(G "\tERROR not enough bits left after wb\n"); + break; + } + + /* get control bits */ + c = get_n_bits_at(data, 5, bit); + DEBU(G "\tCONTROL: %d at %d\n", c, bit); + bit += 5; + + if (c == 15) { + DEBU(G "\tTERMINATOR\n"); + break; + } else if (c == 14) { + /* in-band signal; next 4 bits contain signal id */ + c = get_n_bits_at(data, 4, bit); + bit += 4; + DEBU(G "\tIN-BAND %d bits\n", SpeexInBandSz[c]); + bit += SpeexInBandSz[c]; + } else if (c == 13) { + /* user in-band; next 5 bits contain msg len */ + c = get_n_bits_at(data, 5, bit); + bit += 5; + DEBU(G "\tUSER-BAND %d bytes\n", c); + bit += c * 8; + } else if (c > 8) { + DEBU(G "\tUNKNOWN sub-mode %d\n", c); + break; + } else { + /* skip number bits for submode (less the 5 control bits) */ + DEBU(G "\tSUBMODE %d %d bits\n", c, SpeexSubModeSz[c]); + bit += SpeexSubModeSz[c] - 5; + + cnt += 160; /* new frame */ + } + } + DEBU(G "\tSAMPLES: %d\n", cnt); + return cnt; +} + +static inline int get_interp_len(int format) +{ + return (format == AST_FORMAT_ILBC) ? 30 : 20; +} + +static int get_sample_cnt(struct iax_event *e) +{ + int cnt = 0; + + /* + * In the case of zero length frames, do not return a cnt of 0 + */ + if ( e->datalen == 0 ) { + return get_interp_len( e->subclass ) * 8; + } + + switch (e->subclass) { + case AST_FORMAT_SPEEX: + cnt = speex_get_samples(e->data, e->datalen); + break; + case AST_FORMAT_G723_1: + cnt = 240; /* FIXME Not always the case */ + break; + case AST_FORMAT_ILBC: + cnt = 240 * (e->datalen / 50); + break; + case AST_FORMAT_GSM: + cnt = 160 * (e->datalen / 33); + break; + case AST_FORMAT_G729A: + cnt = 160 * (e->datalen / 20); + break; + case AST_FORMAT_SLINEAR: + cnt = e->datalen / 2; + break; + case AST_FORMAT_LPC10: + cnt = 22 * 8 + (((char *)(e->data))[7] & 0x1) * 8; + break; + case AST_FORMAT_ULAW: + case AST_FORMAT_ALAW: + cnt = e->datalen; + break; + case AST_FORMAT_ADPCM: + case AST_FORMAT_G726: + cnt = e->datalen * 2; + break; + default: + return 0; + } + return cnt; +} + +static int iax_xmit_frame(struct iax_frame *f) +{ + int res; +#ifdef DEBUG_SUPPORT + struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)(f->data); + + if (ntohs(h->scallno) & IAX_FLAG_FULL) + iax_showframe(f, NULL, 0, f->transfer ? + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - sizeof(struct ast_iax2_full_hdr)); +#endif + /* Send the frame raw */ + res = f->session->sendto(netfd, (const char *) f->data, f->datalen, IAX_SOCKOPTS, + f->transfer ? (struct sockaddr *)&(f->session->transfer) : + (struct sockaddr *)&(f->session->peeraddr), + sizeof(f->session->peeraddr)); + return res; +} + +static int iax_reliable_xmit(struct iax_frame *f) +{ + struct iax_frame *fc; + struct ast_iax2_full_hdr *fh; + fh = (struct ast_iax2_full_hdr *) f->data; + if (!fh->type) { + return -2; + } + fc = (struct iax_frame *)malloc(sizeof(struct iax_frame)); + if (fc) { + /* Make a copy of the frame */ + memcpy(fc, f, sizeof(struct iax_frame)); + /* And a copy of the data if applicable */ + if (!fc->data || !fc->datalen) { + IAXERROR "No frame data?"); + DEBU(G "No frame data?\n"); + return -1; + } else { + fc->data = (char *)malloc(fc->datalen); + if (!fc->data) { + DEBU(G "Out of memory\n"); + IAXERROR "Out of memory\n"); + return -1; + } + memcpy(fc->data, f->data, f->datalen); + iax_sched_add(NULL, fc, NULL, NULL, fc->retrytime); + return iax_xmit_frame(fc); + } + } else + return -1; +} + +void iax_set_networking(iax_sendto_t st, iax_recvfrom_t rf) +{ + iax_sendto = st; + iax_recvfrom = rf; +} + +void iax_set_jb_target_extra( long value ) +{ + /* store in jb_target_extra, a static global */ + jb_target_extra = value ; +} + +int iax_init(int preferredportno) +{ + int portno = preferredportno; + + if (iax_recvfrom == (iax_recvfrom_t)recvfrom) + { + struct sockaddr_in sin; + socklen_t sinlen; + int flags; + int bufsize = 256 * 1024; + + if (netfd > -1) + { + /* Okay, just don't do anything */ + DEBU(G "Already initialized."); + return 0; + } + netfd = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); + if (netfd < 0) + { + DEBU(G "Unable to allocate UDP socket\n"); + IAXERROR "Unable to allocate UDP socket\n"); + return -1; + } + + if (preferredportno == 0) + preferredportno = IAX_DEFAULT_PORTNO; + + if (preferredportno < 0) + preferredportno = 0; + + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = 0; + sin.sin_port = htons((short)preferredportno); + if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) + { +#if defined(WIN32) || defined(_WIN32_WCE) + if (WSAGetLastError() == WSAEADDRINUSE) +#else + if (errno == EADDRINUSE) +#endif + { + /*the port is already in use, so bind to a free port chosen by the IP stack*/ + DEBU(G "Unable to bind to preferred port - port is in use. Trying to bind to a free one"); + sin.sin_port = htons((short)0); + if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) + { + IAXERROR "Unable to bind UDP socket\n"); + return -1; + } + } else + { + IAXERROR "Unable to bind UDP socket\n"); + return -1; + } + } + + sinlen = sizeof(sin); + if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) + { + close(netfd); + netfd = -1; + DEBU(G "Unable to figure out what I'm bound to."); + IAXERROR "Unable to determine bound port number."); + return -1; + } +#if defined(WIN32) || defined(_WIN32_WCE) + flags = 1; + if (ioctlsocket(netfd,FIONBIO,(unsigned long *) &flags)) + { + closesocket(netfd); + netfd = -1; + DEBU(G "Unable to set non-blocking mode."); + IAXERROR "Unable to set non-blocking mode."); + return -1; + } + +#else + if ((flags = fcntl(netfd, F_GETFL)) < 0) + { + close(netfd); + netfd = -1; + DEBU(G "Unable to retrieve socket flags."); + IAXERROR "Unable to retrieve socket flags."); + return -1; + } + if (fcntl(netfd, F_SETFL, flags | O_NONBLOCK) < 0) + { + close(netfd); + netfd = -1; + DEBU(G "Unable to set non-blocking mode."); + IAXERROR "Unable to set non-blocking mode."); + return -1; + } +#endif + /* Mihai: increase UDP socket buffers to avoid packet loss. */ + if (setsockopt(netfd, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, + sizeof(bufsize)) < 0) + { + DEBU(G "Unable to set buffer size."); + IAXERROR "Unable to set buffer size."); + } + + portno = ntohs(sin.sin_port); + DEBU(G "Started on port %d\n", portno); + } + + srand((unsigned int)time(0)); + callnums = rand() % 32767 + 1; + transfer_id = rand() % 32767 + 1; + + return portno; +} + +static void destroy_session(struct iax_session *session); + +static void convert_reply(char *out, unsigned char *in) +{ + int x; + for (x=0;x<16;x++) + out += sprintf(out, "%2.2x", (int)in[x]); +} + +static unsigned char compress_subclass(int subclass) +{ + int x; + int power=-1; + /* If it's 128 or smaller, just return it */ + if (subclass < IAX_FLAG_SC_LOG) + return subclass; + /* Otherwise find its power */ + for (x = 0; x < IAX_MAX_SHIFT; x++) { + if (subclass & (1 << x)) { + if (power > -1) { + DEBU(G "Can't compress subclass %d\n", subclass); + return 0; + } else + power = x; + } + } + return power | IAX_FLAG_SC_LOG; +} + +static int iax_send(struct iax_session *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final, int fullframe) +{ + /* Queue a packet for delivery on a given private structure. Use "ts" for + timestamp, or calculate if ts is 0. Send immediately without retransmission + or delayed, with retransmission */ + struct ast_iax2_full_hdr *fh; + struct ast_iax2_mini_hdr *mh; + struct ast_iax2_video_hdr *vh; + //unsigned char buf[5120]; //fd: changed max packet size[5120]; + unsigned char buf[32 * 1024]; //Mihai: let's see if this is where it crashes + + struct iax_frame *fr; + int res; + int sendmini=0; + unsigned int lastsent; + unsigned int fts; + + if (!pvt) + { + IAXERROR "No private structure for packet?\n"); + return -1; + } + + /* this must come before the next call to calc_timestamp() since + calc_timestamp() will change lastsent to the returned value */ + lastsent = pvt->lastsent; + + /* Calculate actual timestamp */ + fts = calc_timestamp(pvt, ts, f); + + if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) + /* High two bits are the same on timestamp, or sending on a trunk */ && + (f->frametype == AST_FRAME_VOICE) + /* is a voice frame */ && + (f->subclass == pvt->svoiceformat) + /* is the same type */ ) + { + /* Force immediate rather than delayed transmission */ + now = 1; + /* Mark that mini-style frame is appropriate */ + sendmini = 1; + } + + /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ + if ( f->frametype == AST_FRAME_VIDEO ) + { + if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + /* High two bits are the same on timestamp, or sending on a trunk */ && + ((f->subclass & ~0x01) == pvt->svideoformat) + /* is the same type */ ) + { + /* Force immediate rather than delayed transmission */ + now = 1; + /* Mark that mini-style frame is appropriate */ + sendmini = 1; + } else + { + /* we want to send a fullframe and be able to retransmit it */ + now = 0; + sendmini = 0; + } + } + + /* if requested, force a full frame */ + if ( fullframe ) + { + now = 0; + sendmini = 0; + } + + /* Allocate an iax_frame */ + if (now) + { + fr = (struct iax_frame *) buf; + } else + { + fr = iax_frame_new(DIRECTION_OUTGRESS, f->datalen); + if ( fr == NULL ) + { + IAXERROR "Out of memory\n"); + return -1; + } + } + + /* Copy our prospective frame into our immediate or retransmitted wrapper */ + iax_frame_wrap(fr, f); + + fr->ts = fts; + if (!fr->ts) + { + IAXERROR "timestamp is 0?\n"); + if (!now) + iax_frame_free(fr); + return -1; + } + + fr->callno = pvt->callno; + fr->transfer = transfer; + fr->final = final; + fr->session = pvt; + if (!sendmini) + { + /* We need a full frame */ + if (seqno > -1) + fr->oseqno = seqno; + else + fr->oseqno = pvt->oseqno++; + fr->iseqno = pvt->iseqno; + fh = (struct ast_iax2_full_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_full_hdr)); + fh->scallno = htons(fr->callno | IAX_FLAG_FULL); + fh->ts = htonl(fr->ts); + fh->oseqno = fr->oseqno; + if (transfer) + { + fh->iseqno = 0; + } else + fh->iseqno = fr->iseqno; + /* Keep track of the last thing we've acknowledged */ + pvt->aseqno = fr->iseqno; + fh->type = fr->af.frametype & 0xFF; + if (f->frametype == AST_FRAME_VIDEO) + fh->csub = compress_subclass(fr->af.subclass & ~0x1) | ((fr->af.subclass & 0x1) << 6); + else + fh->csub = compress_subclass(fr->af.subclass); + if (transfer) + { + fr->dcallno = pvt->transfercallno; + } else + fr->dcallno = pvt->peercallno; + fh->dcallno = htons(fr->dcallno); + fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_full_hdr); + fr->data = fh; + fr->retries = maxretries; + /* Retry after 2x the ping time has passed */ + fr->retrytime = pvt->pingtime * 2; + if (fr->retrytime < MIN_RETRY_TIME) + fr->retrytime = MIN_RETRY_TIME; + if (fr->retrytime > MAX_RETRY_TIME) + fr->retrytime = MAX_RETRY_TIME; + /* Acks' don't get retried */ + if ((f->frametype == AST_FRAME_IAX) && (f->subclass == IAX_COMMAND_ACK)) + fr->retries = -1; + if (f->frametype == AST_FRAME_VOICE) + { + pvt->svoiceformat = f->subclass; + } + else if (f->frametype == AST_FRAME_VIDEO) + { + pvt->svideoformat = f->subclass & ~0x1; + } + if (now) + { + res = iax_xmit_frame(fr); + } else + res = iax_reliable_xmit(fr); + } else + { + if (fr->af.frametype == AST_FRAME_VIDEO) + { + /* Video frame have no sequence number */ + fr->oseqno = -1; + fr->iseqno = -1; + vh = (struct ast_iax2_video_hdr *)(((char* )fr->af.data) - sizeof(struct ast_iax2_video_hdr)); + vh->zeros = 0; + vh->callno = htons(0x8000 | fr->callno); + vh->ts = htons((fr->ts & 0x7FFF) | (fr->af.subclass & 0x1 ? 0x8000 : 0)); + fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_video_hdr); + fr->data = vh; + fr->retries = -1; + res = iax_xmit_frame(fr); + } else + { + /* Mini-frames have no sequence number */ + fr->oseqno = -1; + fr->iseqno = -1; + /* Mini frame will do */ + mh = (struct ast_iax2_mini_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_mini_hdr)); + mh->callno = htons(fr->callno); + mh->ts = htons(fr->ts & 0xFFFF); + fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_mini_hdr); + fr->data = mh; + fr->retries = -1; + res = iax_xmit_frame(fr); + } + } + if( !now && fr!=NULL ) + iax_frame_free( fr ); + return res; +} + +#if 0 +static int iax_predestroy(struct iax_session *pvt) +{ + if (!pvt) { + return -1; + } + if (!pvt->alreadygone) { + /* No more pings or lagrq's */ + if (pvt->pingid > -1) + ast_sched_del(sched, pvt->pingid); + if (pvt->lagid > -1) + ast_sched_del(sched, pvt->lagid); + if (pvt->autoid > -1) + ast_sched_del(sched, pvt->autoid); + if (pvt->initid > -1) + ast_sched_del(sched, pvt->initid); + pvt->pingid = -1; + pvt->lagid = -1; + pvt->autoid = -1; + pvt->initid = -1; + pvt->alreadygone = 1; + } + return 0; +} +#endif + +static int __send_command(struct iax_session *i, char type, int command, + unsigned int ts, unsigned char *data, int datalen, int seqno, + int now, int transfer, int final, int fullframe, int samples) +{ + struct ast_frame f; + f.frametype = type; + f.subclass = command; + f.datalen = datalen; + f.samples = samples; + f.mallocd = 0; + f.offset = 0; +#ifdef __GNUC__ + f.src = (char *) __FUNCTION__; +#else + f.src = (char *) __FILE__; +#endif + f.data = data; + return iax_send(i, &f, ts, seqno, now, transfer, final, fullframe); +} + +static int send_command(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) +{ + return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, 0, 0); +} + +static int send_command_video(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int fullframe) +{ + return __send_command(i, type, command, ts, data, datalen, seqno, 1, 0, 0, fullframe, 0); +} + +static int send_command_final(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) +{ +#if 0 + /* It is assumed that the callno has already been locked */ + iax_predestroy(i); +#endif + int r; + r = __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1, 0, 0); + if (r >= 0) destroy_session(i); + return r; +} + +static int send_command_immediate(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) +{ + return __send_command(i, type, command, ts, data, datalen, seqno, 1, 0, 0, 0, 0); +} + +static int send_command_transfer(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen) +{ + return __send_command(i, type, command, ts, data, datalen, 0, 0, 1, 0, 0, 0); +} + +static int send_command_samples(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int samples) +{ + return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, 0, samples); +} + + +int iax_transfer(struct iax_session *session, const char *number) +{ + static int res; //Return Code + struct iax_ie_data ied; //IE Data Structure (Stuff To Send) + + // Clear The Memory Used For IE Buffer + memset(&ied, 0, sizeof(ied)); + + // Copy The Transfer Destination Into The IE Structure + iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, number); + + // Send The Transfer Command - Asterisk Will Handle The Rest! + res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1); + + // Return Success + return 0; +} + +static void stop_transfer(struct iax_session *session) +{ + struct iax_sched *sch; + + sch = schedq; + while(sch) { + if (sch->frame && (sch->frame->session == session)) + sch->frame->retries = -1; + sch = sch->next; + } +} /* stop_transfer */ + +static void complete_transfer(struct iax_session *session, int peercallno, int xfr2peer, int preserveSeq) +{ + jb_frame frame; + + session->peercallno = peercallno; + /* Change from transfer to session now */ + if (xfr2peer) { + memcpy(&session->peeraddr, &session->transfer, sizeof(session->peeraddr)); + memset(&session->transfer, 0, sizeof(session->transfer)); + session->transferring = TRANSFER_NONE; + session->transferpeer = 0; + session->transfer_moh = 0; + /* Force retransmission of a real voice packet, and reset all timing */ + session->svoiceformat = -1; + session->voiceformat = 0; + session->svideoformat = -1; + session->videoformat = 0; + } + + memset(&session->rxcore, 0, sizeof(session->rxcore)); + memset(&session->offset, 0, sizeof(session->offset)); + + /* Reset jitterbuffer */ + while(jb_getall(session->jb,&frame) == JB_OK) + iax_event_free((struct iax_event *)frame.data); + + jb_reset(session->jb); + + if (! preserveSeq) + { + /* Reset sequence numbers */ + session->aseqno = 0; + session->oseqno = 0; + session->iseqno = 0; + } + + session->lastsent = 0; + session->last_ts = 0; + session->pingtime = 30; + /* We have to dump anything we were going to (re)transmit now that we've been + transferred since they're all invalid and for the old host. */ + stop_transfer(session); +} /* complete_transfer */ + +int iax_setup_transfer(struct iax_session *org_session, struct iax_session *new_session) +{ + int res; + struct iax_ie_data ied0; + struct iax_ie_data ied1; + + struct iax_session *s0 = org_session; + struct iax_session *s1 = new_session; + + memset(&ied0, 0, sizeof(ied0)); + memset(&ied1, 0, sizeof(ied1)); + + /* reversed setup */ + iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr); + iax_ie_append_short(&ied0, IAX_IE_CALLNO, s1->peercallno); + iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, transfer_id); + + iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &s0->peeraddr); + iax_ie_append_short(&ied1, IAX_IE_CALLNO, s0->peercallno); + iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transfer_id); + + s0->transfer = s1->peeraddr; + s1->transfer = s0->peeraddr; + + s0->transferid = transfer_id; + s1->transferid = transfer_id; + + s0->transfercallno = s0->peercallno; + s1->transfercallno = s1->peercallno; + + s0->transferring = TRANSFER_BEGIN; + s1->transferring = TRANSFER_BEGIN; + + s0->transferpeer = s1->callno; + s1->transferpeer = s0->callno; + + transfer_id++; + + if (transfer_id > 32767) + transfer_id = 1; + + res = send_command(s0, AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1); + if (res < 0) { + return -1; + } + + res = send_command(s1, AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied1.buf, ied1.pos, -1); + if (res < 0) { + return -1; + } + + return 0; +} + +static int iax_finish_transfer(struct iax_session *s, short new_peer) +{ + int res; + struct iax_ie_data ied; + + memset(&ied, 0, sizeof(ied)); + + iax_ie_append_short(&ied, IAX_IE_CALLNO, new_peer); + + res = send_command(s, AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied.buf, ied.pos, -1); + + complete_transfer(s, new_peer, 0, 1); + + return res; + +} + +static struct iax_session *iax_find_session2(short callno) +{ + struct iax_session *cur = sessions; + + while(cur) { + if (callno == cur->callno && callno != 0) { + return cur; + } + cur = cur->next; + } + + return NULL; +} + +static int iax_handle_txready(struct iax_session *s) +{ + struct iax_session *s0, *s1; + short s0_org_peer, s1_org_peer; + + if (s->transfer_moh) { + s->transfer_moh = 0; + iax_unquelch(s); + } + + complete_transfer(s, s->peercallno, 0, 1); + + s->transferring = TRANSFER_REL; + + s0 = s; + s1 = iax_find_session2(s0->transferpeer); + + if (s1 != NULL && + s1->callno == s0->transferpeer && + s0->transferring == TRANSFER_REL && + s1->transferring == TRANSFER_REL) { + + s0_org_peer = s0->peercallno; + s1_org_peer = s1->peercallno; + + iax_finish_transfer(s0, s1_org_peer); + iax_finish_transfer(s1, s0_org_peer); + return 1; + } + + return 0; +} + +static void iax_handle_txreject(struct iax_session *s) +{ + struct iax_session *s0, *s1; + + s0 = s; + s1 = iax_find_session2(s0->transferpeer); + if (s1 != NULL && + s0->transferpeer == s1->callno && + s1->transferring) { + if (s1->transfer_moh) { + s1->transfer_moh = 0; + send_command_immediate(s1, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, s1->iseqno); + } + } + if (s0->transfer_moh) { + s0->transfer_moh = 0; + send_command_immediate(s0, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, s0->iseqno); + } + + memset(&s->transfer, 0, sizeof(s->transfer)); + s->transferring = TRANSFER_NONE; + s->transferpeer = 0; + s->transfer_moh = 0; +} + +static void destroy_session(struct iax_session *session) +{ + struct iax_session *cur, *prev=NULL; + struct iax_sched *curs, *prevs=NULL, *nexts=NULL; + int loop_cnt=0; + curs = schedq; + while(curs) { + nexts = curs->next; + if (curs->frame && curs->frame->session == session) { + /* Just mark these frames as if they've been sent */ + curs->frame->retries = -1; + } else if (curs->event && curs->event->session == session) { + if (prevs) + prevs->next = nexts; + else + schedq = nexts; + if (curs->event) + iax_event_free(curs->event); + free(curs); + } else { + prevs = curs; + } + curs = nexts; + loop_cnt++; + } + + cur = sessions; + while(cur) { + if (cur == session) { + jb_frame frame; + + if (prev) + prev->next = session->next; + else + sessions = session->next; + + while(jb_getall(session->jb,&frame) == JB_OK) + iax_event_free((struct iax_event *)frame.data); + + jb_destroy(session->jb); + + free(session); + return; + } + prev = cur; + cur = cur->next; + } +} + +static int iax_send_lagrp(struct iax_session *session, unsigned int ts); +static int iax_send_pong(struct iax_session *session, unsigned int ts); + +static struct iax_event *handle_event(struct iax_event *event) +{ + /* We have a candidate event to be delievered. Be sure + the session still exists. */ + if (event) + { + if ( event->etype == IAX_EVENT_NULL ) return event; + if (iax_session_valid(event->session)) + { + /* Lag requests are never actually sent to the client, but + other than that are handled as normal packets */ + switch(event->etype) + { + /* the user on the outside may need to look at the session so we will not free + it here anymore we will test for hangup event in iax_event_free and do it + there. + */ + case IAX_EVENT_REJECT: + case IAX_EVENT_HANGUP: + /* Destroy this session -- it's no longer valid */ + destroy_session(event->session); + return event; + case IAX_EVENT_LAGRQ: + event->etype = IAX_EVENT_LAGRP; + iax_send_lagrp(event->session, event->ts); + iax_event_free(event); + break; + case IAX_EVENT_PING: + event->etype = IAX_EVENT_PONG; + iax_send_pong(event->session, event->ts); + iax_event_free(event); + break; + case IAX_EVENT_POKE: + event->etype = IAX_EVENT_PONG; + iax_send_pong(event->session, event->ts); + destroy_session(event->session); + iax_event_free(event); + break; + default: + return event; + } + } else + iax_event_free(event); + } + return NULL; +} + +static int iax2_vnak(struct iax_session *session) +{ + /* send vnak just once for a given sequence number */ + if ( (unsigned char)(session->lastvnak - session->iseqno) < 128 ) + { + return 0; + } + + session->lastvnak = session->iseqno; + return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno); +} + +int iax_send_dtmf(struct iax_session *session, char digit) +{ + return send_command(session, AST_FRAME_DTMF, digit, 0, NULL, 0, -1); +} + +int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples) +{ + /* Send a (possibly compressed) voice frame */ + if (!session->quelch) + return send_command_samples(session, AST_FRAME_VOICE, format, 0, data, datalen, -1, samples); + return 0; +} + +int iax_send_cng(struct iax_session *session, int level, unsigned char *data, + int datalen) +{ +#ifdef USE_VOICE_TS_PREDICTION + session->notsilenttx = 0; +#endif + return send_command(session, AST_FRAME_CNG, level, 0, data, datalen, -1); +} + +int iax_send_image(struct iax_session *session, int format, unsigned char *data, + int datalen) +{ + /* Send an image frame */ + return send_command(session, AST_FRAME_IMAGE, format, 0, data, datalen, -1); +} + +int iax_send_video(struct iax_session *session, int format, unsigned char *data, + int datalen, int fullframe) +{ + if (!session->quelch) + { + int res = send_command_video(session, AST_FRAME_VIDEO, format, + 0, data, datalen, -1, fullframe); + return res; + } + return 0; +} + +int iax_send_video_trunk(struct iax_session *session, int format, + char *data, int datalen, int fullframe, int ntrunk) +{ + static int my_lastts = 0; + + if ( ntrunk == 0 ) + my_lastts = calc_timestamp(session, 0, NULL); + + if ( !session->quelch ) + { + return send_command_video(session, AST_FRAME_VIDEO, format, + my_lastts, (unsigned char *)data, datalen, -1, + fullframe); + } + return 0; +} + +int iax_video_bypass_jitter(struct iax_session *s, int mode) +{ + video_bypass_jitterbuffer = mode; + return 0; +} + +int iax_register(struct iax_session *session, const char *server, const char *peer, const char *secret, int refresh) +{ + /* Send a registration request */ + char tmp[256]; + char *p; + int res; + int portno = IAX_DEFAULT_PORTNO; + struct iax_ie_data ied; + struct hostent *hp; + + tmp[255] = '\0'; + strncpy(tmp, server, sizeof(tmp) - 1); + p = strchr(tmp, ':'); + if (p) { + *p = '\0'; + portno = atoi(p+1); + } + + memset(&ied, 0, sizeof(ied)); + if (secret) + strncpy(session->secret, secret, sizeof(session->secret) - 1); + else + strcpy(session->secret, ""); + + /* Connect first */ + hp = gethostbyname(tmp); + if (!hp) { + snprintf(iax_errstr, sizeof(iax_errstr), "Invalid hostname: %s", tmp); + return -1; + } + memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr)); + session->peeraddr.sin_port = htons(portno); + session->peeraddr.sin_family = AF_INET; + strncpy(session->username, peer, sizeof(session->username) - 1); + session->refresh = refresh; + iax_ie_append_str(&ied, IAX_IE_USERNAME, peer); + iax_ie_append_short(&ied, IAX_IE_REFRESH, refresh); + res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); + return res; +} + +int iax_reject(struct iax_session *session, char *reason) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? reason : "Unspecified"); + return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied.buf, ied.pos, -1); +} + +int iax_hangup(struct iax_session *session, char *byemsg) +{ + struct iax_ie_data ied; + iax_sched_del(NULL, NULL, send_ping, (void *) session, 1); + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_CAUSE, byemsg ? byemsg : "Normal clearing"); + return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1); +} + +int iax_sendurl(struct iax_session *session, char *url) +{ + return send_command(session, AST_FRAME_HTML, AST_HTML_URL, 0, + (unsigned char *)url, (int)strlen(url), -1); +} + +int iax_ring_announce(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_RINGING, 0, NULL, 0, -1); +} + +int iax_lag_request(struct iax_session *session) +{ + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1); +} + +int iax_busy(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_BUSY, 0, NULL, 0, -1); +} + +int iax_congestion(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_CONGESTION, 0, NULL, 0, -1); +} + + +int iax_accept(struct iax_session *session, int format) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_int(&ied, IAX_IE_FORMAT, format); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied.buf, ied.pos, -1); +} + +int iax_answer(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1); +} + +int iax_load_complete(struct iax_session *session) +{ + return send_command(session, AST_FRAME_HTML, AST_HTML_LDCOMPLETE, 0, NULL, 0, -1); +} + +int iax_send_url(struct iax_session *session, const char *url, int link) +{ + return send_command(session, AST_FRAME_HTML, + link ? AST_HTML_LINKURL : AST_HTML_URL, 0, + (unsigned char *)url, (int)strlen(url), -1); +} + +int iax_send_text(struct iax_session *session, const char *text) +{ + return send_command(session, AST_FRAME_TEXT, 0, 0, + (unsigned char *)text, (int)strlen(text) + 1, -1); +} + +int iax_send_unlink(struct iax_session *session) +{ + return send_command(session, AST_FRAME_HTML, AST_HTML_UNLINK, 0, NULL, 0, -1); +} + +int iax_send_link_reject(struct iax_session *session) +{ + return send_command(session, AST_FRAME_HTML, AST_HTML_LINKREJECT, 0, NULL, 0, -1); +} + +static int iax_send_pong(struct iax_session *session, unsigned int ts) +{ + struct iax_ie_data ied; + jb_info stats; + + memset(&ied, 0, sizeof(ied)); + + jb_getinfo(session->jb, &stats); + + iax_ie_append_int(&ied,IAX_IE_RR_JITTER, stats.jitter); + /* XXX: should be short-term loss pct.. */ + if(stats.frames_in == 0) stats.frames_in = 1; + iax_ie_append_int(&ied,IAX_IE_RR_LOSS, + ((0xff & (stats.losspct/1000)) << 24 | + (stats.frames_lost & 0x00ffffff))); + iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in); + iax_ie_append_short(&ied,IAX_IE_RR_DELAY, + (unsigned short)(stats.current - stats.min)); + iax_ie_append_int(&ied,IAX_IE_RR_DROPPED, stats.frames_dropped); + iax_ie_append_int(&ied,IAX_IE_RR_OOO, stats.frames_ooo); + + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PONG, ts, ied.buf, ied.pos, -1); +} + +/* external API; deprecated since we send pings ourselves now (finally) */ +int iax_send_ping(struct iax_session *session) +{ + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1); +} + +/* scheduled ping sender; sends ping, then reschedules */ +static void send_ping(void *s) +{ + struct iax_session *session = (struct iax_session *)s; + + /* important, eh? */ + if(!iax_session_valid(session)) return; + + send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1); + session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, ping_time * 1000); + return; +} + +static int iax_send_lagrp(struct iax_session *session, unsigned int ts) +{ + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRP, ts, NULL, 0, -1); +} + +static int iax_send_txcnt(struct iax_session *session) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid); + return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXCNT, 0, ied.buf, ied.pos); +} + +static int iax_send_txrej(struct iax_session *session) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid); + return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied.buf, ied.pos); +} + +static int iax_send_txaccept(struct iax_session *session) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid); + return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXACC, 0, ied.buf, ied.pos); +} + +static int iax_send_txready(struct iax_session *session) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + /* see asterisk chan_iax2.c */ + iax_ie_append_short(&ied, IAX_IE_CALLNO, session->callno); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied.buf, ied.pos, -1); +} + +int iax_auth_reply(struct iax_session *session, char *password, char *challenge, int methods) +{ + char reply[16]; + struct MD5Context md5; + char realreply[256]; + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + if ((methods & IAX_AUTH_MD5) && challenge) { + MD5Init(&md5); + MD5Update(&md5, (const unsigned char *) challenge, + (unsigned int)strlen(challenge)); + MD5Update(&md5, (const unsigned char *) password, + (unsigned int)strlen(password)); + MD5Final((unsigned char *) reply, &md5); + memset(realreply, 0, sizeof(realreply)); + convert_reply(realreply, (unsigned char *) reply); + iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); + } else { + iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + } + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_AUTHREP, 0, ied.buf, ied.pos, -1); +} + +static int iax_regauth_reply(struct iax_session *session, char *password, char *challenge, int methods) +{ + char reply[16]; + struct MD5Context md5; + char realreply[256]; + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_USERNAME, session->username); + iax_ie_append_short(&ied, IAX_IE_REFRESH, session->refresh); + if ((methods & IAX_AUTHMETHOD_MD5) && challenge) { + MD5Init(&md5); + MD5Update(&md5, (const unsigned char *) challenge, + (unsigned int)strlen(challenge)); + MD5Update(&md5, (const unsigned char *) password, + (unsigned int)strlen(password)); + MD5Final((unsigned char *) reply, &md5); + memset(realreply, 0, sizeof(realreply)); + convert_reply(realreply, (unsigned char *) reply); + iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); + } else { + iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + } + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); +} + + +int iax_dial(struct iax_session *session, char *number) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, number); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DIAL, 0, ied.buf, ied.pos, -1); +} + +int iax_quelch(struct iax_session *session) +{ + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, NULL, 0, -1); +} + +int iax_unquelch(struct iax_session *session) +{ + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, -1); +} + +int iax_dialplan_request(struct iax_session *session, char *number) +{ + struct iax_ie_data ied; + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, number); + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DPREQ, 0, ied.buf, ied.pos, -1); +} + +static inline int which_bit(unsigned int i) +{ + char x; + for(x = 0; x < 32; x++) { + if ((1U << x) == i) { + return x + 1; + } + } + return 0; +} + +char iax_pref_codec_add(struct iax_session *session, unsigned int format) +{ + int diff = (int) 'A'; + session->codec_order[session->codec_order_len++] = (which_bit(format)) + diff; + session->codec_order[session->codec_order_len] = '\0'; + return session->codec_order[session->codec_order_len-1]; +} + + +void iax_pref_codec_del(struct iax_session *session, unsigned int format) +{ + int diff = (int) 'A'; + int x; + char old[32]; + char remove = which_bit(format) + diff; + + strncpy(old, session->codec_order, sizeof(old)); + session->codec_order_len = 0; + + for (x = 0; x < (int) strlen(old); x++) { + if (old[x] != remove) { + session->codec_order[session->codec_order_len++] = old[x]; + } + } + session->codec_order[session->codec_order_len] = '\0'; +} + +int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len) +{ + int diff = (int) 'A'; + int x; + + for (x = 0; x < session->codec_order_len && x < len; x++) { + array[x] = (1 << (session->codec_order[x] - diff - 1)); + } + + return x; +} + +int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, const char *ich, const char *lang, int wait, int formats, int capabilities) +{ + char tmp[256]=""; + char *part1, *part2; + int res; + int portno; + char *username, *hostname, *secret, *context, *exten, *dnid; + struct iax_ie_data ied; + struct hostent *hp; + /* We start by parsing up the temporary variable which is of the form of: + [user@]peer[:portno][/exten[@context]] */ + if (!ich) { + IAXERROR "Invalid IAX Call Handle\n"); + DEBU(G "Invalid IAX Call Handle\n"); + return -1; + } + memset(&ied, 0, sizeof(ied)); + strncpy(tmp, ich, sizeof(tmp) - 1); + iax_ie_append_short(&ied, IAX_IE_VERSION, IAX_PROTO_VERSION); + if (cidnum) + iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, cidnum); + if (cidname) + iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, cidname); + + if (session->codec_order_len) { + iax_ie_append_str(&ied, IAX_IE_CODEC_PREFS, session->codec_order); + } + + session->capability = capabilities; + session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, 2 * 1000); + + /* XXX We should have a preferred format XXX */ + iax_ie_append_int(&ied, IAX_IE_FORMAT, formats); + iax_ie_append_int(&ied, IAX_IE_CAPABILITY, capabilities); + if (lang) + iax_ie_append_str(&ied, IAX_IE_LANGUAGE, lang); + + /* Part 1 is [user[:password]@]peer[:port] */ + part1 = strtok(tmp, "/"); + + /* Part 2 is exten[@context] if it is anything all */ + part2 = strtok(NULL, "/"); + + if (strchr(part1, '@')) { + username = strtok(part1, "@"); + hostname = strtok(NULL, "@"); + } else { + username = NULL; + hostname = part1; + } + + if (username && strchr(username, ':')) { + username = strtok(username, ":"); + secret = strtok(NULL, ":"); + } else + secret = NULL; + + if(username) + strncpy(session->username, username, sizeof(session->username) - 1); + + if(secret) + strncpy(session->secret, secret, sizeof(session->secret) - 1); + + if (strchr(hostname, ':')) { + strtok(hostname, ":"); + portno = atoi(strtok(NULL, ":")); + } else { + portno = IAX_DEFAULT_PORTNO; + } + if (part2) { + exten = strtok(part2, "@"); + dnid = exten; + context = strtok(NULL, "@"); + } else { + exten = NULL; + dnid = NULL; + context = NULL; + } + if (username) + iax_ie_append_str(&ied, IAX_IE_USERNAME, username); + if (exten && strlen(exten)) + iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, exten); + if (dnid && strlen(dnid)) + iax_ie_append_str(&ied, IAX_IE_DNID, dnid); + if (context && strlen(context)) + iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, context); + + /* Setup host connection */ + hp = gethostbyname(hostname); + if (!hp) { + snprintf(iax_errstr, sizeof(iax_errstr), "Invalid hostname: %s", hostname); + return -1; + } + memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr)); + session->peeraddr.sin_port = htons(portno); + session->peeraddr.sin_family = AF_INET; + res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_NEW, 0, ied.buf, ied.pos, -1); + if (res < 0) + return res; + if (wait) { + DEBU(G "Waiting not yet implemented\n"); + return -1; + } + return res; +} + +static int calc_rxstamp(struct iax_session *session) +{ + struct timeval tv; + int ms; + + if (!session->rxcore.tv_sec && !session->rxcore.tv_usec) { + gettimeofday(&session->rxcore, NULL); + } + gettimeofday(&tv, NULL); + + ms = (tv.tv_sec - session->rxcore.tv_sec) * 1000 + + (tv.tv_usec - session->rxcore.tv_usec) / 1000; + return ms; +} + +#ifdef notdef_cruft +static int match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) +{ + if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->peeraddr.sin_port == sin->sin_port)) { + /* This is the main host */ + if ((cur->peercallno == callno) || + ((dcallno == cur->callno) && !cur->peercallno)) { + /* That's us. Be sure we keep track of the peer call number */ + cur->peercallno = callno; + return 1; + } + } + if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) { + /* We're transferring */ + if (dcallno == cur->callno) + return 1; + } + return 0; +} +#endif + +/* splitted match into 2 passes otherwise causing problem of matching + up the wrong session using the dcallno and the peercallno because + during a transfer (2 IAX channels on the same client/system) the + same peercallno (from two different asterisks) exist in more than + one session. + */ +static int forward_match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) +{ + if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) { + /* We're transferring */ + if (dcallno == cur->callno) + { + return 1; + } + } + + if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->peeraddr.sin_port == sin->sin_port)) { + if (dcallno == cur->callno && dcallno != 0) { + /* That's us. Be sure we keep track of the peer call number */ + if (cur->peercallno == 0) { + cur->peercallno = callno; + } + else if ( cur->peercallno != callno ) + { + // print a warning when the callno's don't match + fprintf( stderr, "WARNING: peercallno does not match callno" + ", peercallno => %d, callno => %d, dcallno => %d", + cur->peercallno, callno, dcallno ) ; + return 0 ; + } + return 1; + } + } + + return 0; +} + +static int reverse_match(struct sockaddr_in *sin, short callno, struct iax_session *cur) +{ + if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) { + /* We're transferring */ + if (callno == cur->peercallno) { + return 1; + } + } + if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && + (cur->peeraddr.sin_port == sin->sin_port)) { + if (callno == cur->peercallno) { + return 1; + } + } + + return 0; +} + +static struct iax_session *iax_find_session(struct sockaddr_in *sin, + short callno, + short dcallno, + int makenew) +{ + struct iax_session *cur = sessions; + while(cur) { + if (forward_match(sin, callno, dcallno, cur)) { + return cur; + } + cur = cur->next; + } + + cur = sessions; + while(cur) { + if (reverse_match(sin, callno, cur)) { + return cur; + } + cur = cur->next; + } + + if (makenew && !dcallno) { + cur = iax_session_new(); + cur->peercallno = callno; + cur->peeraddr.sin_addr.s_addr = sin->sin_addr.s_addr; + cur->peeraddr.sin_port = sin->sin_port; + cur->peeraddr.sin_family = AF_INET; + cur->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)cur, 2 * 1000); + DEBU(G "Making new session, peer callno %d, our callno %d\n", callno, cur->callno); + } else { + DEBU(G "No session, peer = %d, us = %d\n", callno, dcallno); + } + return cur; +} + +#ifdef EXTREME_DEBUG +static int display_time(int ms) +{ + static int oldms = -1; + if (oldms < 0) { + DEBU(G "First measure\n"); + oldms = ms; + return 0; + } + DEBU(G "Time from last frame is %d ms\n", ms - oldms); + oldms = ms; + return 0; +} +#endif + +/* From chan_iax2/steve davies: need to get permission from steve or digium, I guess */ +static long unwrap_timestamp(long ts, long last) +{ + int x; + + if ( (ts & 0xFFFF0000) == (last & 0xFFFF0000) ) { + x = ts - last; + if (x < -50000) { + /* Sudden big jump backwards in timestamp: + What likely happened here is that miniframe + timestamp has circled but we haven't gotten the + update from the main packet. We'll just pretend + that we did, and update the timestamp + appropriately. */ + ts = ( (last & 0xFFFF0000) + 0x10000) | (ts & 0xFFFF); + DEBU(G "schedule_delivery: pushed forward timestamp\n"); + } + if (x > 50000) { + /* Sudden apparent big jump forwards in timestamp: + What's likely happened is this is an old miniframe + belonging to the previous top-16-bit timestamp that + has turned up out of order. Adjust the timestamp + appropriately. */ + ts = ( (last & 0xFFFF0000) - 0x10000) | (ts & 0xFFFF); + DEBU(G "schedule_delivery: pushed back timestamp\n"); + } + } + else if ( (ts & 0xFFFF8000L) == (last & 0xFFFF8000L) ) { + x = ts - last; + if (x < -50000) { + /* Sudden big jump backwards in timestamp: + What likely happened here is that miniframe + timestamp has circled but we haven't gotten the + update from the main packet. We'll just pretend + that we did, and update the timestamp + appropriately. */ + ts = ( (last & 0xFFFF8000L) + 0x10000) | (ts & 0xFFFF); + DEBU(G "schedule_delivery: pushed forward timestamp\n"); + } + if (x > 50000) { + /* Sudden apparent big jump forwards in timestamp: + * What's likely happened is this is an old miniframe + * belonging to the previous top-16-bit timestamp that + * has turned up out of order. Adjust the timestamp + * appropriately. */ + ts = ( (last & 0xFFFF8000L) - 0x10000) | (ts & 0xFFFF); + DEBU(G "schedule_delivery: pushed back timestamp\n"); + } + } + return ts; +} + + +static struct iax_event *schedule_delivery(struct iax_event *e, unsigned int ts, int updatehistory) +{ + /* + * This is the core of the IAX jitterbuffer delivery mechanism: + * Dynamically adjust the jitterbuffer and decide how long to wait + * before delivering the packet. + */ + +#ifdef EXTREME_DEBUG + DEBU(G "[%p] We are at %d, packet is for %d\n", e->session, calc_rxstamp(e->session), ts); +#endif + + /* insert into jitterbuffer */ + /* TODO: Perhaps we could act immediately if it's not droppable and late */ + if ( e->etype == IAX_EVENT_VIDEO && video_bypass_jitterbuffer ) + { + iax_sched_add(e, NULL, NULL, NULL, 0); + return NULL; + } else + { + int type = JB_TYPE_CONTROL; + int len = 0; + + if(e->etype == IAX_EVENT_VOICE) + { + type = JB_TYPE_VOICE; + /* The frame time only has an effect for voice */ + len = get_sample_cnt(e) / 8; + } else if(e->etype == IAX_EVENT_VIDEO) + { + type = JB_TYPE_VIDEO; + } else if(e->etype == IAX_EVENT_CNG) + { + type = JB_TYPE_SILENCE; + } + + /* unwrap timestamp */ + ts = unwrap_timestamp(ts,e->session->last_ts); + + /* move forward last_ts if it's greater. We do this _after_ + * unwrapping, because asterisk _still_ has cases where it + * doesn't send full frames when it ought to */ + if(ts > e->session->last_ts) + { + e->session->last_ts = ts; + } + + if(jb_put(e->session->jb, e, type, len, ts, + calc_rxstamp(e->session)) == JB_DROP) + { + iax_event_free(e); + } + } + + return NULL; +} + +static int uncompress_subclass(unsigned char csub) +{ + /* If the SC_LOG flag is set, return 2^csub otherwise csub */ + if (csub & IAX_FLAG_SC_LOG) + return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT); + else + return csub; +} + +static void iax_handle_vnak(struct iax_session *session, struct ast_iax2_full_hdr *fh) +{ + struct iax_sched *sch, *list, *l, *tmp; + + /* + * According to the IAX2 02 draft, we MUST immediately retransmit all frames + * with higher sequence number than the VNAK's iseqno + * However, it seems that the right thing to do would be to retransmit + * frames with sequence numbers higher OR EQUAL to VNAK's iseqno. + */ + sch = schedq; + list = NULL; + while ( sch != NULL ) + { + if ( sch->frame != NULL && + sch->frame->session == session + ) + { + /* + * We want to check if our frame's oseqno is greater or equal than + * the VNAK's iseqno, but we need to take into account sequence + * number wrap-arounds + * session->rseqno is our last acknowledged sequence number, so + * we use that as a base + */ + if ( (unsigned char)(fh->iseqno - session->rseqno) <= (unsigned char)(sch->frame->oseqno - session->rseqno) ) + { + /* + * We cannot retransmit immediately, since the frames are ordered by retransmit time + * We need to collect them and orrange them in ascending order of their oseqno + */ + tmp = (struct iax_sched *)calloc(1, sizeof(struct iax_sched)); + tmp->frame = sch->frame; + + if ( list == NULL || + (list->frame->oseqno - session->rseqno) > (tmp->frame->oseqno - session->rseqno) + ) + { + tmp->next = list; + list = tmp; + } else + { + l = list; + while ( l != NULL ) + { + if ( l->next == NULL || + (l->next->frame->oseqno - session->rseqno) > (tmp->frame->oseqno - session->rseqno) + ) + { + tmp->next = l->next; + l->next = tmp; + break; + } + l = l->next; + } + } + } + } + sch = sch->next; + } + + /* Transmit collected frames and free the space */ + while ( list != NULL ) + { + tmp = list; + iax_xmit_frame(tmp->frame); + list = list->next; + free(tmp); + } +} + +static struct iax_event *iax_header_to_event(struct iax_session *session, struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin) +{ + struct iax_event *e; + struct iax_sched *sch; + unsigned int ts; + int subclass; + int nowts; + int updatehistory = 1; + ts = ntohl(fh->ts); + + if (fh->type==AST_FRAME_VIDEO) + subclass = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1); + else + subclass = uncompress_subclass(fh->csub); + + /* don't run last_ts backwards; i.e. for retransmits and the like */ + if (ts > session->last_ts && + (fh->type == AST_FRAME_IAX && + subclass != IAX_COMMAND_ACK && + subclass != IAX_COMMAND_PONG && + subclass != IAX_COMMAND_LAGRP)) + { + session->last_ts = ts; + } + +#ifdef DEBUG_SUPPORT + iax_showframe(NULL, fh, 1, sin, datalen); +#endif + + /* Get things going with it, timestamp wise, if we + haven't already. */ + + /* Handle implicit ACKing unless this is an INVAL, and only if this is + from the real peer, not the transfer peer */ + if ( !inaddrcmp(sin, &session->peeraddr) && + ( subclass != IAX_COMMAND_INVAL || + fh->type != AST_FRAME_IAX + ) + ) + { + unsigned char x; + /* XXX This code is not very efficient. Surely there is a better way which still + properly handles boundary conditions? XXX */ + /* First we have to qualify that the ACKed value is within our window */ + for (x=session->rseqno; x != session->oseqno; x++) + if (fh->iseqno == x) + break; + if ((x != session->oseqno) || (session->oseqno == fh->iseqno)) + { + /* The acknowledgement is within our window. Time to acknowledge everything + that it says to */ + for (x=session->rseqno; x != fh->iseqno; x++) + { + /* Ack the packet with the given timestamp */ + DEBU(G "Cancelling transmission of packet %d\n", x); + sch = schedq; + while(sch) + { + if ( sch->frame && + sch->frame->session == session && + sch->frame->oseqno == x + ) + sch->frame->retries = -1; + sch = sch->next; + } + } + /* Note how much we've received acknowledgement for */ + session->rseqno = fh->iseqno; + } else + DEBU(G "Received iseqno %d not within window %d->%d\n", fh->iseqno, session->rseqno, session->oseqno); + } + + /* Check where we are */ + if ((ntohs(fh->dcallno) & IAX_FLAG_RETRANS) || + ((fh->type != AST_FRAME_VOICE) && (fh->type != AST_FRAME_VIDEO))) + updatehistory = 0; + if ((session->iseqno != fh->oseqno) && + (session->iseqno || + ((subclass != IAX_COMMAND_TXREADY) && + (subclass != IAX_COMMAND_TXREL) && + (subclass != IAX_COMMAND_TXCNT) && + (subclass != IAX_COMMAND_TXACC)) || + (fh->type != AST_FRAME_IAX))) + { + if ( + ((subclass != IAX_COMMAND_ACK) && + (subclass != IAX_COMMAND_INVAL) && + (subclass != IAX_COMMAND_TXREADY) && + (subclass != IAX_COMMAND_TXREL) && + (subclass != IAX_COMMAND_TXCNT) && + (subclass != IAX_COMMAND_TXACC) && + (subclass != IAX_COMMAND_VNAK)) || + (fh->type != AST_FRAME_IAX)) + { + /* If it's not an ACK packet, it's out of order. */ + DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", + session->iseqno, fh->oseqno, fh->type, subclass); + + /* + * Check if session->iseqno > fh->oseqno, accounting for possible wrap around + * This is correct if the two values are not equal (which, in this case, is guaranteed) + */ + if ( (unsigned char)(session->iseqno - fh->oseqno) < 128 ) + { + /* If we've already seen it, ack it XXX There's a border condition here XXX */ + if ((fh->type != AST_FRAME_IAX) || + ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) + { + DEBU(G "Acking anyway\n"); + /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if + we have anything to send, we'll retransmit and get an ACK back anyway XXX */ + send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0,fh->iseqno); + } + } else + { + /* Send a VNAK requesting retransmission */ + iax2_vnak(session); + } + return NULL; + } + } else + { + /* Increment unless it's an ACK or VNAK */ + if (((subclass != IAX_COMMAND_ACK) && + (subclass != IAX_COMMAND_INVAL) && + (subclass != IAX_COMMAND_TXCNT) && + (subclass != IAX_COMMAND_TXACC) && + (subclass != IAX_COMMAND_VNAK)) || + (fh->type != AST_FRAME_IAX)) + session->iseqno++; + } + + e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen + 1); + + if (e) { + memset(e, 0, sizeof(struct iax_event) + datalen); + /* Set etype to some unknown value so do not inavertently + sending IAX_EVENT_CONNECT event, which is 0 to application. + */ + e->etype = -1; + e->session = session; + switch(fh->type) { + case AST_FRAME_DTMF: + e->etype = IAX_EVENT_DTMF; + e->subclass = subclass; + /* + We want the DTMF event deliver immediately so all I/O can be + terminate quickly in an IVR system. + e = schedule_delivery(e, ts, updatehistory); */ + break; + case AST_FRAME_VOICE: + e->etype = IAX_EVENT_VOICE; + e->subclass = subclass; + e->ts = ts; + session->voiceformat = subclass; + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; + } + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_FRAME_CNG: + e->etype = IAX_EVENT_CNG; + e->subclass = subclass; + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; + } + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_FRAME_IAX: + /* Parse IE's */ + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; + } + if (iax_parse_ies(&e->ies, e->data, e->datalen)) { + IAXERROR "Unable to parse IE's"); + free(e); + e = NULL; + break; + } + switch(subclass) { + case IAX_COMMAND_NEW: + /* This is a new, incoming call */ + /* save the capability for validation */ + session->capability = e->ies.capability; + if (e->ies.codec_prefs) { + strncpy(session->codec_order, + e->ies.codec_prefs, + sizeof(session->codec_order)); + session->codec_order_len = + (int)strlen(session->codec_order); + } + e->etype = IAX_EVENT_CONNECT; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_AUTHREQ: + /* This is a request for a call */ + e->etype = IAX_EVENT_AUTHRQ; + if (strlen(session->username) && !strcmp(e->ies.username, session->username) && + strlen(session->secret)) { + /* Hey, we already know this one */ + iax_auth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods); + free(e); + e = NULL; + break; + } + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_HANGUP: + e->etype = IAX_EVENT_HANGUP; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_INVAL: + e->etype = IAX_EVENT_HANGUP; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_REJECT: + e->etype = IAX_EVENT_REJECT; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_ACK: + free(e); + e = NULL; + break; + case IAX_COMMAND_VNAK: + iax_handle_vnak(session, fh); + free(e); + e = NULL; + break; + case IAX_COMMAND_LAGRQ: + /* Pass this along for later handling */ + e->etype = IAX_EVENT_LAGRQ; + e->ts = ts; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_POKE: + e->etype = IAX_EVENT_POKE; + e->ts = ts; + break; + case IAX_COMMAND_PING: + /* PINGS and PONGS don't get scheduled; */ + e->etype = IAX_EVENT_PING; + e->ts = ts; + break; + case IAX_COMMAND_PONG: + e->etype = IAX_EVENT_PONG; + /* track weighted average of ping time */ + session->pingtime = ((2 * session->pingtime) + (calc_timestamp(session,0,NULL) - ts)) / 3; + session->remote_netstats.jitter = e->ies.rr_jitter; + session->remote_netstats.losspct = e->ies.rr_loss >> 24;; + session->remote_netstats.losscnt = e->ies.rr_loss & 0xffffff; + session->remote_netstats.packets = e->ies.rr_pkts; + session->remote_netstats.delay = e->ies.rr_delay; + session->remote_netstats.dropped = e->ies.rr_dropped; + session->remote_netstats.ooo = e->ies.rr_ooo; + break; + case IAX_COMMAND_ACCEPT: + if (e->ies.format & session->capability) { + e->etype = IAX_EVENT_ACCEPT; + } + else { + struct iax_ie_data ied; + /* Although this should not happen, we + * added this to make sure the + * negotiation protocol is enforced. + * For lack of event to notify the + * application we use the defined + * REJECT event. + */ + memset(&ied, 0, sizeof(ied)); + iax_ie_append_str(&ied, IAX_IE_CAUSE, "Unable to negotiate codec"); + send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied.buf, ied.pos, -1); + e->etype = IAX_EVENT_REJECT; + } + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_REGACK: + e->etype = IAX_EVENT_REGACK; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_REGAUTH: + iax_regauth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods); + free(e); + e = NULL; + break; + case IAX_COMMAND_REGREJ: + e->etype = IAX_EVENT_REGREJ; + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_LAGRP: + e->etype = IAX_EVENT_LAGRP; + nowts = calc_timestamp(session, 0, NULL); + e->ts = nowts - ts; + /* Can't call schedule_delivery since timestamp is non-normal */ + break;; + case IAX_COMMAND_TXREQ: + /* added check for defensive programming + * - in case the asterisk server + * or another client does not send the + * apparent transfer address + */ + if (e->ies.apparent_addr != NULL) { + /* so a full voice frame is sent on the + next voice output */ + session->svoiceformat = -1; + session->transfer = *e->ies.apparent_addr; + session->transfer.sin_family = AF_INET; + session->transfercallno = e->ies.callno; + session->transferring = TRANSFER_BEGIN; + session->transferid = e->ies.transferid; + iax_send_txcnt(session); + } + free(e); + e = NULL; + break; + case IAX_COMMAND_DPREP: + /* Received dialplan reply */ + e->etype = IAX_EVENT_DPREP; + /* Return immediately, makes no sense to schedule */ + break; + case IAX_COMMAND_TXCNT: + if (session->transferring) { + session->transfer = *sin; + iax_send_txaccept(session); + } + free(e); + e = NULL; + break; + case IAX_COMMAND_TXACC: + if (session->transferring) { + stop_transfer(session); + session->transferring = TRANSFER_READY; + iax_send_txready(session); + } + free(e); + e = NULL; + break; + case IAX_COMMAND_TXREL: + /* Release the transfer */ + send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno); + if (session->transferring) { + complete_transfer(session, e->ies.callno, 1, 0); + } + else { + complete_transfer(session, session->peercallno, 0, 1); + } + e->etype = IAX_EVENT_TRANSFER; + /* notify that asterisk no longer sitting between peers */ + e = schedule_delivery(e, ts, updatehistory); + break; + case IAX_COMMAND_QUELCH: + e->etype = IAX_EVENT_QUELCH; + session->quelch = 1; + break; + case IAX_COMMAND_UNQUELCH: + e->etype = IAX_EVENT_UNQUELCH; + session->quelch = 0; + break; + case IAX_COMMAND_TXREJ: + e->etype = IAX_EVENT_TXREJECT; + iax_handle_txreject(session); + break; + + case IAX_COMMAND_TXREADY: + send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno); + if (iax_handle_txready(session)) { + e->etype = IAX_EVENT_TXREADY; + } + else { + free(e); + e = NULL; + } + break; + default: + DEBU(G "Don't know what to do with IAX command %d\n", subclass); + free(e); + e = NULL; + } + break; + case AST_FRAME_CONTROL: + switch(subclass) { + case AST_CONTROL_ANSWER: + e->etype = IAX_EVENT_ANSWER; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_CONTROL_CONGESTION: + case AST_CONTROL_BUSY: + e->etype = IAX_EVENT_BUSY; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_CONTROL_RINGING: + e->etype = IAX_EVENT_RINGA; + e = schedule_delivery(e, ts, updatehistory); + break; + default: + DEBU(G "Don't know what to do with AST control %d\n", subclass); + free(e); + return NULL; + } + break; + case AST_FRAME_IMAGE: + e->etype = IAX_EVENT_IMAGE; + e->subclass = subclass; + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + } + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_FRAME_VIDEO: + e->etype = IAX_EVENT_VIDEO; + e->subclass = subclass; + e->ts = ts; + session->videoformat = e->subclass; + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_FRAME_TEXT: + e->etype = IAX_EVENT_TEXT; + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; + } + e = schedule_delivery(e, ts, updatehistory); + break; + + case AST_FRAME_HTML: + switch(fh->csub) { + case AST_HTML_LINKURL: + e->etype = IAX_EVENT_LINKURL; + /* Fall through */ + case AST_HTML_URL: + if (e->etype == -1) + e->etype = IAX_EVENT_URL; + e->subclass = fh->csub; + e->datalen = datalen; + if (datalen) { + memcpy(e->data, fh->iedata, datalen); + } + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_HTML_LDCOMPLETE: + e->etype = IAX_EVENT_LDCOMPLETE; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_HTML_UNLINK: + e->etype = IAX_EVENT_UNLINK; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_HTML_LINKREJECT: + e->etype = IAX_EVENT_LINKREJECT; + e = schedule_delivery(e, ts, updatehistory); + break; + default: + DEBU(G "Don't know how to handle HTML type %d frames\n", fh->csub); + free(e); + return NULL; + } + break; + default: + DEBU(G "Don't know what to do with frame type %d\n", fh->type); + free(e); + return NULL; + } + } else + DEBU(G "Out of memory\n"); + + /* Already ack'd iax frames */ + if (session->aseqno != session->iseqno) { + send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno); + } + return e; +} + +/* Some parts taken from iax_miniheader_to_event and from from chan_iax2.c. We must inform Mark Spencer? */ +static struct iax_event *iax_videoheader_to_event(struct iax_session *session, + struct ast_iax2_video_hdr *vh, int datalen) +{ + struct iax_event * e; + + if ( session->videoformat <= 0 ) + { + DEBU(G "No last video format received on session %d\n", + session->callno); + return 0; + } + + e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen); + + if ( !e ) + { + DEBU(G "Out of memory\n"); + return 0; + } + + e->etype = IAX_EVENT_VIDEO; + e->session = session; + e->subclass = session->videoformat | (ntohs(vh->ts) & 0x8000 ? 1 : 0); + e->datalen = datalen; + memcpy(e->data, vh->data, e->datalen); + e->ts = (session->last_ts & 0xFFFF8000L) | (ntohs(vh->ts) & 0x7fff); + + return schedule_delivery(e, e->ts, 1); +} + +static struct iax_event *iax_miniheader_to_event(struct iax_session *session, + struct ast_iax2_mini_hdr *mh, int datalen) +{ + struct iax_event * e; + + if ( session->voiceformat <= 0 ) + { + DEBU(G "No last format received on session %d\n", session->callno); + return 0; + } + + e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen); + + if ( !e ) + { + DEBU(G "Out of memory\n"); + return 0; + } + + e->etype = IAX_EVENT_VOICE; + e->session = session; + e->subclass = session->voiceformat; + e->datalen = datalen; + memcpy(e->data, mh->data, datalen); + e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); + + return schedule_delivery(e, e->ts, 1); +} + +void iax_destroy(struct iax_session *session) +{ + destroy_session(session); +} + +static struct iax_event *iax_net_read(void) +{ + unsigned char buf[65536]; + int res; + struct sockaddr_in sin; + socklen_t sinlen; + struct iax_event *event; + + sinlen = sizeof(sin); + res = iax_recvfrom(netfd, (char *)buf, sizeof(buf), 0, (struct sockaddr *) &sin, &sinlen); + if (res < 0) { +#if defined(_WIN32_WCE) + if (WSAGetLastError() != WSAEWOULDBLOCK) { + DEBU(G "Error on read: %d\n", WSAGetLastError()); + IAXERROR "Read error on network socket: ???"); + } +#elif defined(WIN32) || defined(_WIN32_WCE) + if (WSAGetLastError() != WSAEWOULDBLOCK) { + DEBU(G "Error on read: %d\n", WSAGetLastError()); + IAXERROR "Read error on network socket: %s", strerror(errno)); + } +#else + if (errno != EAGAIN) { + DEBU(G "Error on read: %s\n", strerror(errno)); + IAXERROR "Read error on network socket: %s", strerror(errno)); + } +#endif + return NULL; + } + event = iax_net_process(buf, res, &sin); + if ( event == NULL ) + { + // We have received a frame. The corresponding event is queued + // We need to motify the entire stack of calling functions so they + // don't go to sleep thinking there are no more frames to process + // TODO: this is buttugly from a design point of view. Basically we + // change libiax2 behavior to accomodate iaxclient. + // There must be a way to do it better. + event = (struct iax_event *)malloc(sizeof(struct iax_event)); + if ( event != NULL ) event->etype = IAX_EVENT_NULL; + } + return event; +} + +static struct iax_session *iax_txcnt_session(struct ast_iax2_full_hdr *fh, int datalen, + struct sockaddr_in *sin, short callno, short dcallno) +{ + int subclass = uncompress_subclass(fh->csub); + unsigned char buf[ 65536 ]; /* allocated on stack with same size as iax_net_read() */ + struct iax_ies ies; + struct iax_session *cur; + + if ((fh->type != AST_FRAME_IAX) || (subclass != IAX_COMMAND_TXCNT) || (!datalen)) { + return NULL; /* special handling for TXCNT only */ + } + memcpy(buf, fh->iedata, datalen); /* prepare local buf for iax_parse_ies() */ + + if (iax_parse_ies(&ies, buf, datalen)) { + return NULL; /* Unable to parse IE's */ + } + if (!ies.transferid) { + return NULL; /* TXCNT without proper IAX_IE_TRANSFERID */ + } + for( cur=sessions; cur; cur=cur->next ) { + if ((cur->transferring) && (cur->transferid == (int) ies.transferid) && + (cur->callno == dcallno) && (cur->transfercallno == callno)) { + /* We're transferring --- + * skip address/port checking which would fail while + * remote peer behind symmetric NAT, verify + * transferid instead + */ + cur->transfer.sin_addr.s_addr = sin->sin_addr.s_addr; /* setup for further handling */ + cur->transfer.sin_port = sin->sin_port; + break; + } + } + return cur; +} + +struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin) +{ + struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *)buf; + struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *)buf; + struct ast_iax2_video_hdr *vh = (struct ast_iax2_video_hdr *)buf; + struct iax_session *session; + + if (ntohs(fh->scallno) & IAX_FLAG_FULL) { + /* Full size header */ + if (len < sizeof(struct ast_iax2_full_hdr)) { + DEBU(G "Short header received from %s\n", inet_ntoa(sin->sin_addr)); + IAXERROR "Short header received from %s\n", inet_ntoa(sin->sin_addr)); + return NULL; + } + /* We have a full header, process appropriately */ + session = iax_find_session(sin, + ntohs(fh->scallno) & ~IAX_FLAG_FULL, + ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, 1); + if (!session) + session = iax_txcnt_session(fh, + len - sizeof(struct ast_iax2_full_hdr), + sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, + ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS); + if (session) + return iax_header_to_event(session, fh, len - sizeof(struct ast_iax2_full_hdr), sin); + DEBU(G "No session?\n"); + return NULL; + } else { + if (len < sizeof(struct ast_iax2_mini_hdr)) { + DEBU(G "Short header received from %s\n", inet_ntoa(sin->sin_addr)); + IAXERROR "Short header received from %s\n", inet_ntoa(sin->sin_addr)); + return NULL; + } + /* Miniature, voice frame */ + if ((vh->zeros == 0) && (ntohs(vh->callno) & 0x8000)) + { + session = iax_find_session(sin, ntohs(vh->callno) & ~0x8000, 0, 0); + + if (session) + return iax_videoheader_to_event(session, vh, + len - sizeof(struct ast_iax2_video_hdr)); + } else { + /* audio frame */ + session = iax_find_session(sin, ntohs(fh->scallno), 0, 0); + if (session) + return iax_miniheader_to_event(session, mh, + len - sizeof(struct ast_iax2_mini_hdr)); + } + DEBU(G "No session?\n"); + return NULL; + } +} + +static struct iax_sched *iax_get_sched(struct timeval tv) +{ + struct iax_sched *cur, *prev=NULL; + cur = schedq; + /* Check the event schedule first. */ + while(cur) { + if ((tv.tv_sec > cur->when.tv_sec) || + ((tv.tv_sec == cur->when.tv_sec) && + (tv.tv_usec >= cur->when.tv_usec))) { + /* Take it out of the event queue */ + if (prev) { + prev->next = cur->next; + } else { + schedq = cur->next; + } + return cur; + } + cur = cur->next; + } + return NULL; +} + +struct iax_event *iax_get_event(int blocking) +{ + struct iax_event *event; + struct iax_frame *frame; + struct timeval tv; + struct iax_sched *cur; + struct iax_session *session; + + gettimeofday(&tv, NULL); + + while((cur = iax_get_sched(tv))) + { + event = cur->event; + frame = cur->frame; + if (event) + { + /* See if this is an event we need to handle */ + event = handle_event(event); + if (event) + { + free(cur); + return event; + } + } else if(frame) + { + /* It's a frame, transmit it and schedule a retry */ + if (frame->retries < 0) + { + /* It's been acked. No need to send it. Destroy the old + frame. If final, destroy the session. */ + if (frame->final) + destroy_session(frame->session); + if (frame->data) + free(frame->data); + free(frame); + } else if (frame->retries == 0) + { + if (frame->transfer) + { + /* Send a transfer reject since we weren't able to connect */ + iax_send_txrej(frame->session); + if (frame->data) + free(frame->data); + free(frame); + free(cur); + break; + } else + { + /* We haven't been able to get an ACK on this packet. If a + final frame, destroy the session, otherwise, pass up timeout */ + if (frame->final) + { + destroy_session(frame->session); + if (frame->data) + free(frame->data); + free(frame); + } else + { + event = (struct iax_event *)malloc(sizeof(struct iax_event)); + if (event) + { + event->etype = IAX_EVENT_TIMEOUT; + event->session = frame->session; + if (frame->data) + free(frame->data); + free(frame); + free(cur); + return handle_event(event); + } + } + } + } else + { + struct ast_iax2_full_hdr *fh; + /* Decrement remaining retries */ + frame->retries--; + /* Multiply next retry time by 4, not above MAX_RETRY_TIME though */ + frame->retrytime *= 4; + /* Keep under 1000 ms if this is a transfer packet */ + if (!frame->transfer) + { + if (frame->retrytime > MAX_RETRY_TIME) + frame->retrytime = MAX_RETRY_TIME; + } else if (frame->retrytime > 1000) + frame->retrytime = 1000; + fh = (struct ast_iax2_full_hdr *)(frame->data); + fh->dcallno = htons(IAX_FLAG_RETRANS | frame->dcallno); + iax_xmit_frame(frame); + /* Schedule another retransmission */ + DEBU(G "Scheduling retransmission %d\n", frame->retries); + iax_sched_add(NULL, frame, NULL, NULL, frame->retrytime); + } + } else if (cur->func) + { + cur->func(cur->arg); + } + free(cur); + } + + /* get jitterbuffer-scheduled events */ + for ( session = sessions; session; session = session->next ) + { + int ret; + long now; + long next; + jb_frame frame; + + now = (tv.tv_sec - session->rxcore.tv_sec) * 1000 + + (tv.tv_usec - session->rxcore.tv_usec) / 1000; + + if ( now <= (next = jb_next(session->jb)) ) + continue; + + /* interp len no longer hardcoded, now determined by get_interp_len */ + ret = jb_get(session->jb,&frame,now,get_interp_len(session->voiceformat)); + + switch(ret) { + case JB_OK: + event = (struct iax_event *)frame.data; + event = handle_event(event); + if (event) { + return event; + } + break; + case JB_INTERP: + /* create an interpolation frame */ + //fprintf(stderr, "Making Interpolation frame\n"); + event = (struct iax_event *)malloc(sizeof(struct iax_event)); + if (event) { + event->etype = IAX_EVENT_VOICE; + event->subclass = session->voiceformat; + /* XXX: ??? applications probably ignore this anyway */ + event->ts = now; + event->session = session; + event->datalen = 0; + event = handle_event(event); + if(event) + return event; + } + break; + case JB_DROP: + iax_event_free((struct iax_event *)frame.data); + break; + case JB_NOFRAME: + case JB_EMPTY: + /* do nothing */ + break; + default: + /* shouldn't happen */ + break; + } + } + + /* Now look for networking events */ + if (blocking) { + /* Block until there is data if desired */ + fd_set fds; + int nextEventTime; + + FD_ZERO(&fds); + FD_SET(netfd, &fds); + + nextEventTime = iax_time_to_next_event(); + + if(nextEventTime < 0) select(netfd + 1, &fds, NULL, NULL, NULL); + else + { + struct timeval nextEvent; + + nextEvent.tv_sec = nextEventTime / 1000; + nextEvent.tv_usec = (nextEventTime % 1000) * 1000; + + select(netfd + 1, &fds, NULL, NULL, &nextEvent); + } + + } + event = iax_net_read(); + + return handle_event(event); +} + +struct sockaddr_in iax_get_peer_addr(struct iax_session *session) +{ + return session->peeraddr; +} + +void iax_session_destroy(struct iax_session **session) +{ + destroy_session(*session); + *session = NULL; +} + +void iax_event_free(struct iax_event *event) +{ + /* We gave the user a chance to play with the session now we need to + * destroy it if you are not calling this function on every event you + * read you are now going to leak sessions as well as events! + */ + switch(event->etype) { + case IAX_EVENT_REJECT: + case IAX_EVENT_HANGUP: + /* Destroy this session -- it's no longer valid */ + if (event->session) { /* maybe the user did it already */ + destroy_session(event->session); + } + break; + } + free(event); +} + +int iax_get_fd(void) +{ + /* Return our network file descriptor. The client can select on this + * (probably with other things, or can add it to a network add sort + * of gtk_input_add for example */ + return netfd; +} + +int iax_quelch_moh(struct iax_session *session, int MOH) +{ + struct iax_ie_data ied; //IE Data Structure (Stuff To Send) + memset(&ied, 0, sizeof(ied)); + + // You can't quelch the quelched + if (session->quelch == 1) + return -1; + + if (MOH) { + iax_ie_append(&ied, IAX_IE_MUSICONHOLD); + session->transfer_moh = 1; + } + + return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1); +} diff --git a/libs/libiax2/src/iax.h b/libs/libiax2/src/iax.h new file mode 100644 index 0000000000000000000000000000000000000000..8a0e3fe3d370d9d4e754e316a7d8066ccff35ac7 --- /dev/null +++ b/libs/libiax2/src/iax.h @@ -0,0 +1,86 @@ +/* + * libIAX + * + * Implementation of Inter-IAXerisk eXchange + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + */ + +#ifndef _IAX_H +#define _IAX_H + +/* Max version of IAX protocol we support */ +#define IAX_PROTO_VERSION 1 + +#define IAX_MAX_CALLS 32768 + +#define IAX_FLAG_FULL 0x8000 + +#define IAX_FLAG_SC_LOG 0x80 + +#define IAX_MAX_SHIFT 0x1F + +/* Maximum size of an IAX frame (max size of UDP frame) */ +#define IAX_MAX_BUF_SIZE 65536 + +/* Subclass for IAX_FRAME_IAX */ +#define IAX_COMMAND_NEW 1 +#define IAX_COMMAND_PING 2 +#define IAX_COMMAND_PONG 3 +#define IAX_COMMAND_ACK 4 +#define IAX_COMMAND_HANGUP 5 +#define IAX_COMMAND_REJECT 6 +#define IAX_COMMAND_ACCEPT 7 +#define IAX_COMMAND_AUTHREQ 8 +#define IAX_COMMAND_AUTHREP 9 +#define IAX_COMMAND_INVAL 10 +#define IAX_COMMAND_LAGRQ 11 +#define IAX_COMMAND_LAGRP 12 +#define IAX_COMMAND_REGREQ 13 /* Registration request */ +#define IAX_COMMAND_REGAUTH 14 /* Registration authentication required */ +#define IAX_COMMAND_REGACK 15 /* Registration accepted */ +#define IAX_COMMAND_REGREJ 16 /* Registration rejected */ +#define IAX_COMMAND_REGREL 17 /* Force release of registration */ +#define IAX_COMMAND_VNAK 18 /* If we receive voice before valid first voice frame, send this */ +#define IAX_COMMAND_DPREQ 19 /* Request status of a dialplan entry */ +#define IAX_COMMAND_DPREP 20 /* Request status of a dialplan entry */ +#define IAX_COMMAND_DIAL 21 /* Request a dial on channel brought up TBD */ +#define IAX_COMMAND_TXREQ 22 /* Transfer Request */ +#define IAX_COMMAND_TXCNT 23 /* Transfer Connect */ +#define IAX_COMMAND_TXACC 24 /* Transfer Accepted */ +#define IAX_COMMAND_TXREADY 25 /* Transfer ready */ +#define IAX_COMMAND_TXREL 26 /* Transfer release */ +#define IAX_COMMAND_TXREJ 27 /* Transfer reject */ +#define IAX_COMMAND_QUELCH 28 /* Stop audio/video transmission */ +#define IAX_COMMAND_UNQUELCH 29 /* Resume audio/video transmission */ + +#define IAX_DEFAULT_REG_EXPIRE 60 + +#define IAX_DEFAULT_PORTNO 5036 + +/* Full frames are always delivered reliably */ +struct iax_full_hdr { + short callno; /* Source call number -- high bit must be 1 */ + short dcallno; /* Destination call number */ + unsigned int ts; /* 32-bit timestamp in milliseconds */ + unsigned short seqno; /* Packet number */ + char type; /* Frame type */ + unsigned char csub; /* Compressed subclass */ + char data[0]; +}; + +/* Mini header is used only for voice frames -- delivered unreliably */ +struct iax_mini_hdr { + short callno; /* Source call number -- high bit must be 0 */ + unsigned short ts; /* 16-bit Timestamp (high 16 bits from last IAX_full_hdr) */ + /* Frametype implicitly VOICE_FRAME */ + /* subclass implicit from last IAX_full_hdr */ + char data[0]; +}; + +#endif diff --git a/libs/libiax2/src/iax2-parser.c b/libs/libiax2/src/iax2-parser.c new file mode 100644 index 0000000000000000000000000000000000000000..b8e62a84a12a487dd3c87fdec760d178c7a8dab3 --- /dev/null +++ b/libs/libiax2/src/iax2-parser.c @@ -0,0 +1,818 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Implementation of Inter-Asterisk eXchange + * + * Copyright (C) 2003-2004, Digium + * + * Mark Spencer <markster@digium.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + */ + +#if defined(WIN32) || defined(_WIN32_WCE) +#include <winsock.h> +#define snprintf _snprintf +#else +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#endif + +#ifndef _MSC_VER +#include <unistd.h> +#endif + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#include "frame.h" +#include "iax2.h" +#include "iax2-parser.h" + +static int frames = 0; +static int iframes = 0; +static int oframes = 0; + +#ifdef ALIGN32 +static unsigned int get_uint32(unsigned char *p) +{ + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; +} + +static unsigned short get_uint16(unsigned char *p) +{ + return (p[0] << 8) | p[1] ; +} + +#else +#define get_uint32(p) (*((unsigned int *)(p))) +#define get_uint16(p) (*((unsigned short *)(p))) +#endif + + +static void internaloutput(const char *str) +{ + printf(str); +} + +static void internalerror(const char *str) +{ + fprintf(stderr, "WARNING: %s", str); +} + +static void (*outputf)(const char *str) = internaloutput; +static void (*errorf)(const char *str) = internalerror; + +static void dump_addr(char *output, int maxlen, void *value, int len) +{ + struct sockaddr_in sin; + if (len == sizeof(sin)) { + memcpy(&sin, value, len); + snprintf(output, maxlen, "IPV4 %s:%d", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port)); + } else { + snprintf(output, maxlen, "Invalid Address"); + } +} + +static void dump_string(char *output, int maxlen, void *value, int len) +{ + maxlen--; + if (maxlen > len) + maxlen = len; + strncpy(output,(const char *)value, maxlen); + output[maxlen] = '\0'; +} + +static void dump_int(char *output, int maxlen, void *value, int len) +{ + if (len == (int)sizeof(unsigned int)) + snprintf(output, maxlen, "%lu", (unsigned long)ntohl(get_uint32(value))); + else + snprintf(output, maxlen, "Invalid INT"); +} + +static void dump_short(char *output, int maxlen, void *value, int len) +{ + if (len == (int)sizeof(unsigned short)) + snprintf(output, maxlen, "%d", ntohs(get_uint16(value))); + else + snprintf(output, maxlen, "Invalid SHORT"); +} + +static void dump_byte(char *output, int maxlen, void *value, int len) +{ + if (len == (int)sizeof(unsigned char)) + snprintf(output, maxlen, "%d", *((unsigned char *)value)); + else + snprintf(output, maxlen, "Invalid BYTE"); +} + +static void dump_samprate(char *output, int maxlen, void *value, int len) +{ + char tmp[256]=""; + int sr; + if (len == (int)sizeof(unsigned short)) { + sr = ntohs(*((unsigned short *)value)); + if (sr & IAX_RATE_8KHZ) + strcat(tmp, ",8khz"); + if (sr & IAX_RATE_11KHZ) + strcat(tmp, ",11.025khz"); + if (sr & IAX_RATE_16KHZ) + strcat(tmp, ",16khz"); + if (sr & IAX_RATE_22KHZ) + strcat(tmp, ",22.05khz"); + if (sr & IAX_RATE_44KHZ) + strcat(tmp, ",44.1khz"); + if (sr & IAX_RATE_48KHZ) + strcat(tmp, ",48khz"); + if (strlen(tmp)) + strncpy(output, &tmp[1], maxlen - 1); + else + strncpy(output, "None specified!\n", maxlen - 1); + } else + snprintf(output, maxlen, "Invalid SHORT"); + +} + +static void dump_prov_ies(char *output, int maxlen, unsigned char *iedata, int len); +static void dump_prov(char *output, int maxlen, void *value, int len) +{ + dump_prov_ies(output, maxlen, (unsigned char *)value, len); +} + +static struct iax2_ie { + int ie; + char *name; + void (*dump)(char *output, int maxlen, void *value, int len); +} ies[] = { + { IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string }, + { IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string }, + { IAX_IE_CALLING_ANI, "ANI", dump_string }, + { IAX_IE_CALLING_NAME, "CALLING NAME", dump_string }, + { IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string }, + { IAX_IE_USERNAME, "USERNAME", dump_string }, + { IAX_IE_PASSWORD, "PASSWORD", dump_string }, + { IAX_IE_CAPABILITY, "CAPABILITY", dump_int }, + { IAX_IE_FORMAT, "FORMAT", dump_int }, + { IAX_IE_LANGUAGE, "LANGUAGE", dump_string }, + { IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string }, + { IAX_IE_VERSION, "VERSION", dump_short }, + { IAX_IE_ADSICPE, "ADSICPE", dump_short }, + { IAX_IE_DNID, "DNID", dump_string }, + { IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short }, + { IAX_IE_CHALLENGE, "CHALLENGE", dump_string }, + { IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string }, + { IAX_IE_RSA_RESULT, "RSA RESULT", dump_string }, + { IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr }, + { IAX_IE_REFRESH, "REFRESH", dump_short }, + { IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short }, + { IAX_IE_CALLNO, "CALL NUMBER", dump_short }, + { IAX_IE_CAUSE, "CAUSE", dump_string }, + { IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte }, + { IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short }, + { IAX_IE_AUTOANSWER, "AUTO ANSWER REQ" }, + { IAX_IE_TRANSFERID, "TRANSFER ID", dump_int }, + { IAX_IE_RDNIS, "REFERRING DNIS", dump_string }, + { IAX_IE_PROVISIONING, "PROVISIONING", dump_prov }, + { IAX_IE_AESPROVISIONING, "AES PROVISIONG" }, + { IAX_IE_DATETIME, "DATE TIME", dump_int }, + { IAX_IE_DEVICETYPE, "DEVICE TYPE", dump_string }, + { IAX_IE_SERVICEIDENT, "SERVICE IDENT", dump_string }, + { IAX_IE_FIRMWAREVER, "FIRMWARE VER", dump_short }, + { IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int }, + { IAX_IE_FWBLOCKDATA, "FW BLOCK DATA" }, + { IAX_IE_PROVVER, "PROVISIONG VER", dump_int }, + { IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte }, + { IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte }, + { IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short }, + { IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate }, + { IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string }, + { IAX_IE_RR_JITTER, "RR_JITTER", dump_int }, + { IAX_IE_RR_LOSS, "RR_LOSS", dump_int }, + { IAX_IE_RR_PKTS, "RR_PKTS", dump_int }, + { IAX_IE_RR_DELAY, "RR_DELAY", dump_short }, + { IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int }, + { IAX_IE_RR_OOO, "RR_OOO", dump_int }, +}; + +const char *iax_ie2str(int ie) +{ + int x; + for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) { + if (ies[x].ie == ie) + return ies[x].name; + } + return "Unknown IE"; +} + + +static void dump_prov_ies(char *output, int maxlen, unsigned char *iedata, int len) +{ + int ielen; + int ie; + int found; + char tmp[256]; + if (len < 2) + return; + strcpy(output, "\n"); + maxlen -= (int)strlen(output); output += strlen(output); + while(len > 2) { + ie = iedata[0]; + ielen = iedata[1]; + if (ielen + 2> len) { + snprintf(tmp, (int)sizeof(tmp), "Total Prov IE length of %d bytes exceeds remaining prov frame length of %d bytes\n", ielen + 2, len); + strncpy(output, tmp, maxlen - 1); + maxlen -= (int)strlen(output); output += strlen(output); + return; + } + found = 0; + if (!found) { + snprintf(tmp, (int)sizeof(tmp), " Unknown Prov IE %03d : Present\n", ie); + strncpy(output, tmp, maxlen - 1); + maxlen -= (int)strlen(output); output += strlen(output); + } + iedata += (2 + ielen); + len -= (2 + ielen); + } +} + +static void dump_ies(unsigned char *iedata, int len) +{ + int ielen; + int ie; + int x; + int found; + char interp[1024]; + char tmp[1024]; + if (len < 2) + return; + while(len > 2) { + ie = iedata[0]; + ielen = iedata[1]; + if (ielen + 2> len) { + snprintf(tmp, (int)sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len); + outputf(tmp); + return; + } + found = 0; + for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) { + if (ies[x].ie == ie) { + if (ies[x].dump) { + ies[x].dump(interp, (int)sizeof(interp), iedata + 2, ielen); + snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp); + outputf(tmp); + } else { + if (ielen) + snprintf(interp, (int)sizeof(interp), "%d bytes", ielen); + else + strcpy(interp, "Present"); + snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp); + outputf(tmp); + } + found++; + } + } + if (!found) { + snprintf(tmp, (int)sizeof(tmp), " Unknown IE %03d : Present\n", ie); + outputf(tmp); + } + iedata += (2 + ielen); + len -= (2 + ielen); + } + outputf("\n"); +} + +void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen) +{ + const char *frames[] = { + "(0?)", + "DTMF ", + "VOICE ", + "VIDEO ", + "CONTROL", + "NULL ", + "IAX ", + "TEXT ", + "IMAGE " }; + const char *iaxs[] = { + "(0?)", + "NEW ", + "PING ", + "PONG ", + "ACK ", + "HANGUP ", + "REJECT ", + "ACCEPT ", + "AUTHREQ", + "AUTHREP", + "INVAL ", + "LAGRQ ", + "LAGRP ", + "REGREQ ", + "REGAUTH", + "REGACK ", + "REGREJ ", + "REGREL ", + "VNAK ", + "DPREQ ", + "DPREP ", + "DIAL ", + "TXREQ ", + "TXCNT ", + "TXACC ", + "TXREADY", + "TXREL ", + "TXREJ ", + "QUELCH ", + "UNQULCH", + "POKE", + "PAGE", + "MWI", + "UNSUPPORTED", + "TRANSFER", + "PROVISION", + "FWDOWNLD", + "FWDATA" + }; + const char *cmds[] = { + "(0?)", + "HANGUP ", + "RING ", + "RINGING", + "ANSWER ", + "BUSY ", + "TKOFFHK ", + "OFFHOOK" }; + struct ast_iax2_full_hdr *fh; + char retries[20]; + char class2[20]; + char subclass2[20]; + const char *clas; + const char *subclass; + char tmp[256]; + + if (f) { + fh = (struct ast_iax2_full_hdr *)f->data; + snprintf(retries, (int)sizeof(retries), "%03d", f->retries); + } else { + fh = fhi; + if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS) + strcpy(retries, "Yes"); + else + strcpy(retries, " No"); + } + if (!(ntohs(fh->scallno) & IAX_FLAG_FULL)) { + /* Don't mess with mini-frames */ + return; + } + if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) { + snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type); + clas = class2; + } else { + clas = frames[(int)fh->type]; + } + if (fh->type == AST_FRAME_DTMF) { + sprintf(subclass2, "%c", fh->csub); + subclass = subclass2; + } else if (fh->type == AST_FRAME_IAX) { + if (fh->csub >= (int)sizeof(iaxs)/(int)sizeof(iaxs[0])) { + snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub); + subclass = subclass2; + } else { + subclass = iaxs[(int)fh->csub]; + } + } else if (fh->type == AST_FRAME_CONTROL) { + if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) { + snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub); + subclass = subclass2; + } else { + subclass = cmds[(int)fh->csub]; + } + } else { + snprintf(subclass2, (int)sizeof(subclass2), "%d", fh->csub); + subclass = subclass2; + } +snprintf(tmp, (int)sizeof(tmp), +"%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n", + (rx ? "Rx" : "Tx"), + retries, fh->oseqno, fh->iseqno, clas, subclass); + outputf(tmp); +snprintf(tmp, (int)sizeof(tmp), +" Timestamp: %05lums SCall: %5.5d DCall: %5.5d [%s:%d]\n", + (unsigned long)ntohl(fh->ts), + ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, + inet_ntoa(sin->sin_addr), ntohs(sin->sin_port)); + outputf(tmp); + if (fh->type == AST_FRAME_IAX) + dump_ies(fh->iedata, datalen); +} + +int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen) +{ + char tmp[256]; + if (datalen > ((int)sizeof(ied->buf) - ied->pos)) { + snprintf(tmp, (int)sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen, (int)sizeof(ied->buf) - ied->pos); + errorf(tmp); + return -1; + } + ied->buf[ied->pos++] = ie; + ied->buf[ied->pos++] = datalen; + memcpy(ied->buf + ied->pos, data, datalen); + ied->pos += datalen; + return 0; +} + +int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin) +{ + return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in)); +} + +int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value) +{ + unsigned int newval; + newval = htonl(value); + return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval)); +} + +int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value) +{ + unsigned short newval; + newval = htons(value); + return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval)); +} + +int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str) +{ + return iax_ie_append_raw(ied, ie, str, (int)strlen(str)); +} + +int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat) +{ + return iax_ie_append_raw(ied, ie, &dat, 1); +} + +int iax_ie_append(struct iax_ie_data *ied, unsigned char ie) +{ + return iax_ie_append_raw(ied, ie, NULL, 0); +} + +void iax_set_output(void (*func)(const char *)) +{ + outputf = func; +} + +void iax_set_error(void (*func)(const char *)) +{ + errorf = func; +} + +int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen) +{ + /* Parse data into information elements */ + int len; + int ie; + char tmp[256]; + memset(ies, 0, (int)sizeof(struct iax_ies)); + ies->msgcount = -1; + ies->firmwarever = -1; + ies->calling_ton = -1; + ies->calling_tns = -1; + ies->calling_pres = -1; + ies->samprate = IAX_RATE_8KHZ; + while(datalen >= 2) { + ie = data[0]; + len = data[1]; + if (len > datalen - 2) { + errorf("Information element length exceeds message size\n"); + return -1; + } + switch(ie) { + case IAX_IE_CALLED_NUMBER: + ies->called_number = (char *) data + 2; + break; + case IAX_IE_CALLING_NUMBER: + ies->calling_number = (char *) data + 2; + break; + case IAX_IE_CALLING_ANI: + ies->calling_ani = (char *) data + 2; + break; + case IAX_IE_CALLING_NAME: + ies->calling_name = (char *) data + 2; + break; + case IAX_IE_CALLED_CONTEXT: + ies->called_context = (char *) data + 2; + break; + case IAX_IE_USERNAME: + ies->username = (char *) data + 2; + break; + case IAX_IE_PASSWORD: + ies->password = (char *) data + 2; + break; + case IAX_IE_CAPABILITY: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else + ies->capability = ntohl(get_uint32(data + 2)); + break; + case IAX_IE_FORMAT: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else + ies->format = ntohl(get_uint32(data + 2)); + break; + case IAX_IE_LANGUAGE: + ies->language = (char *) data + 2; + break; + case IAX_IE_CODEC_PREFS: + ies->codec_prefs = (char *) data + 2; + break; + case IAX_IE_VERSION: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting version to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->version = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_ADSICPE: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->adsicpe = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_SAMPLINGRATE: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->samprate = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_DNID: + ies->dnid = (char *) data + 2; + break; + case IAX_IE_RDNIS: + ies->rdnis = (char *) data + 2; + break; + case IAX_IE_AUTHMETHODS: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->authmethods = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_CHALLENGE: + ies->challenge = (char *) data + 2; + break; + case IAX_IE_MD5_RESULT: + ies->md5_result = (char *) data + 2; + break; + case IAX_IE_RSA_RESULT: + ies->rsa_result = (char *) data + 2; + break; + case IAX_IE_APPARENT_ADDR: + ies->apparent_addr = ((struct sockaddr_in *)(data + 2)); + break; + case IAX_IE_REFRESH: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting refresh to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->refresh = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_DPSTATUS: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting dpstatus to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->dpstatus = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_CALLNO: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting callno to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->callno = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_CAUSE: + ies->cause = (char *) data + 2; + break; + case IAX_IE_CAUSECODE: + if (len != 1) { + snprintf(tmp, (int)sizeof(tmp), "Expecting causecode to be single byte but was %d\n", len); + errorf(tmp); + } else { + ies->causecode = data[2]; + } + break; + case IAX_IE_IAX_UNKNOWN: + if (len == 1) + ies->iax_unknown = data[2]; + else { + snprintf(tmp, (int)sizeof(tmp), "Expected single byte Unknown command, but was %d long\n", len); + errorf(tmp); + } + break; + case IAX_IE_MSGCOUNT: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->msgcount = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_AUTOANSWER: + ies->autoanswer = 1; + break; + case IAX_IE_MUSICONHOLD: + ies->musiconhold = 1; + break; + case IAX_IE_TRANSFERID: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else + ies->transferid = ntohl(get_uint32(data + 2)); + break; + case IAX_IE_DATETIME: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else + ies->datetime = ntohl(get_uint32(data + 2)); + break; + case IAX_IE_FIRMWAREVER: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->firmwarever = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_DEVICETYPE: + ies->devicetype = (char *) data + 2; + break; + case IAX_IE_SERVICEIDENT: + ies->serviceident = (char *) data + 2; + break; + case IAX_IE_FWBLOCKDESC: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else + ies->fwdesc = ntohl(get_uint32(data + 2)); + break; + case IAX_IE_FWBLOCKDATA: + ies->fwdata = data + 2; + ies->fwdatalen = len; + break; + case IAX_IE_PROVVER: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected provisioning version to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->provverpres = 1; + ies->provver = ntohl(get_uint32(data + 2)); + } + break; + case IAX_IE_CALLINGPRES: + if (len == 1) + ies->calling_pres = data[2]; + else { + snprintf(tmp, (int)sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len); + errorf(tmp); + } + break; + case IAX_IE_CALLINGTON: + if (len == 1) + ies->calling_ton = data[2]; + else { + snprintf(tmp, (int)sizeof(tmp), "Expected single byte callington, but was %d long\n", len); + errorf(tmp); + } + break; + case IAX_IE_CALLINGTNS: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else + ies->calling_tns = ntohs(get_uint16(data + 2)); + break; + case IAX_IE_RR_JITTER: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected jitter rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->rr_jitter = ntohl(get_uint32(data + 2)); + } + break; + case IAX_IE_RR_LOSS: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->rr_loss = ntohl(get_uint32(data + 2)); + } + break; + case IAX_IE_RR_PKTS: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->rr_pkts = ntohl(get_uint32(data + 2)); + } + break; + case IAX_IE_RR_DELAY: + if (len != (int)sizeof(unsigned short)) { + snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len); + errorf(tmp); + } else { + ies->rr_delay = ntohs(get_uint16(data + 2)); + } + break; + case IAX_IE_RR_DROPPED: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->rr_dropped = ntohl(get_uint32(data + 2)); + } + break; + case IAX_IE_RR_OOO: + if (len != (int)sizeof(unsigned int)) { + snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len); + errorf(tmp); + } else { + ies->rr_ooo = ntohl(get_uint32(data + 2)); + } + break; + default: + snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len); + outputf(tmp); + } + /* Overwrite information element with 0, to null terminate previous portion */ + data[0] = 0; + datalen -= (len + 2); + data += (len + 2); + } + /* Null-terminate last field */ + *data = '\0'; + if (datalen) { + errorf("Invalid information element contents, strange boundary\n"); + return -1; + } + return 0; +} + +void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f) +{ + fr->af.frametype = f->frametype; + fr->af.subclass = f->subclass; + fr->af.mallocd = 0; /* Our frame is static relative to the container */ + fr->af.datalen = f->datalen; + fr->af.samples = f->samples; + fr->af.offset = AST_FRIENDLY_OFFSET; + fr->af.src = f->src; + fr->af.data = fr->afdata; + if (fr->af.datalen) + memcpy(fr->af.data, f->data, fr->af.datalen); +} + +struct iax_frame *iax_frame_new(int direction, int datalen) +{ + struct iax_frame *fr; + fr = (struct iax_frame *)malloc((int)sizeof(struct iax_frame) + datalen); + if (fr) { + fr->direction = direction; + fr->retrans = -1; + frames++; + if (fr->direction == DIRECTION_INGRESS) + iframes++; + else + oframes++; + } + return fr; +} + +void iax_frame_free(struct iax_frame *fr) +{ + /* Note: does not remove from scheduler! */ + if (fr->direction == DIRECTION_INGRESS) + iframes--; + else if (fr->direction == DIRECTION_OUTGRESS) + oframes--; + else { + errorf("Attempt to double free frame detected\n"); + return; + } + fr->direction = 0; + free(fr); + frames--; +} + +int iax_get_frames(void) { return frames; } +int iax_get_iframes(void) { return iframes; } +int iax_get_oframes(void) { return oframes; } diff --git a/libs/libiax2/src/iax2-parser.h b/libs/libiax2/src/iax2-parser.h new file mode 100644 index 0000000000000000000000000000000000000000..8238b2f4691c1557f63108547d6ecf621475cec4 --- /dev/null +++ b/libs/libiax2/src/iax2-parser.h @@ -0,0 +1,146 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Implementation of Inter-Asterisk eXchange + * + * Copyright (C) 2003, Digium + * + * Mark Spencer <markster@digium.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + */ + +#ifndef _IAX2_PARSER_H +#define _IAX2_PARSER_H + +struct iax_ies { + char *called_number; + char *calling_number; + char *calling_ani; + char *calling_name; + int calling_ton; + int calling_tns; + int calling_pres; + char *called_context; + char *username; + char *password; + unsigned int capability; + unsigned int format; + char *codec_prefs; + char *language; + int version; + unsigned short adsicpe; + char *dnid; + char *rdnis; + unsigned int authmethods; + char *challenge; + char *md5_result; + char *rsa_result; + struct sockaddr_in *apparent_addr; + unsigned short refresh; + unsigned short dpstatus; + unsigned short callno; + char *cause; + unsigned char causecode; + unsigned char iax_unknown; + int msgcount; + int autoanswer; + int musiconhold; + unsigned int transferid; + unsigned int datetime; + char *devicetype; + char *serviceident; + int firmwarever; + unsigned int fwdesc; + unsigned char *fwdata; + unsigned char fwdatalen; + unsigned int provver; + unsigned short samprate; + unsigned int provverpres; + unsigned int rr_jitter; + unsigned int rr_loss; + unsigned int rr_pkts; + unsigned short rr_delay; + unsigned int rr_dropped; + unsigned int rr_ooo; +}; + +#define DIRECTION_INGRESS 1 +#define DIRECTION_OUTGRESS 2 + +struct iax_frame { +#ifdef LIBIAX + struct iax_session *session; + struct iax_event *event; +#endif + + /* /Our/ call number */ + unsigned short callno; + /* /Their/ call number */ + unsigned short dcallno; + /* Start of raw frame (outgoing only) */ + void *data; + /* Length of frame (outgoing only) */ + int datalen; + /* How many retries so far? */ + int retries; + /* Outgoing relative timestamp (ms) */ + unsigned int ts; + /* How long to wait before retrying */ + int retrytime; + /* Are we received out of order? */ + int outoforder; + /* Have we been sent at all yet? */ + int sentyet; + /* Outgoing Packet sequence number */ + int oseqno; + /* Next expected incoming packet sequence number */ + int iseqno; + /* Non-zero if should be sent to transfer peer */ + int transfer; + /* Non-zero if this is the final message */ + int final; + /* Ingress or outgres */ + int direction; + /* Retransmission ID */ + int retrans; + /* Easy linking */ + struct iax_frame *next; + struct iax_frame *prev; + /* Actual, isolated frame header */ + struct ast_frame af; + unsigned char unused[AST_FRIENDLY_OFFSET]; + unsigned char afdata[0]; /* Data for frame */ +}; + +struct iax_ie_data { + unsigned char buf[1024]; + int pos; +}; + +/* Choose a different function for output */ +extern void iax_set_output(void (*output)(const char *data)); +/* Choose a different function for errors */ +extern void iax_set_error(void (*output)(const char *data)); +extern void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen); + +extern const char *iax_ie2str(int ie); + +extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen); +extern int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin); +extern int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value); +extern int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value); +extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str); +extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat); +extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie); +extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen); + +extern int iax_get_frames(void); +extern int iax_get_iframes(void); +extern int iax_get_oframes(void); + +extern void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f); +extern struct iax_frame *iax_frame_new(int direction, int datalen); +extern void iax_frame_free(struct iax_frame *fr); +#endif diff --git a/libs/libiax2/src/iax2.h b/libs/libiax2/src/iax2.h new file mode 100644 index 0000000000000000000000000000000000000000..1be78757a457975f31b9c02e81fdf86935289a4e --- /dev/null +++ b/libs/libiax2/src/iax2.h @@ -0,0 +1,222 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Implementation of Inter-Asterisk eXchange + * + * Copyright (C) 2003, Digium + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + */ + +#ifndef _IAX2_H +#define _IAX2_H + +/* Max version of IAX protocol we support */ +#define IAX_PROTO_VERSION 2 + +#define IAX_MAX_CALLS 32768 + +#define IAX_FLAG_FULL 0x8000 + +#define IAX_FLAG_RETRANS 0x8000 + +#define IAX_FLAG_SC_LOG 0x80 + +#define IAX_MAX_SHIFT 0x1F + +#define IAX_WINDOW 64 + +/* Subclass for AST_FRAME_IAX */ +#define IAX_COMMAND_NEW 1 /** Initiate a new call */ +#define IAX_COMMAND_PING 2 /** Ping request */ +#define IAX_COMMAND_PONG 3 /** Ping or poke reply */ +#define IAX_COMMAND_ACK 4 /** Explicit acknowledgment */ +#define IAX_COMMAND_HANGUP 5 /** Initiate call teardown */ +#define IAX_COMMAND_REJECT 6 /** Reject a call */ +#define IAX_COMMAND_ACCEPT 7 /** Accept a call */ +#define IAX_COMMAND_AUTHREQ 8 /** Authentication request */ +#define IAX_COMMAND_AUTHREP 9 /** Authentication reply */ +#define IAX_COMMAND_INVAL 10 /** Invalid message */ +#define IAX_COMMAND_LAGRQ 11 /** Lag request */ +#define IAX_COMMAND_LAGRP 12 /** Lag reply */ +#define IAX_COMMAND_REGREQ 13 /** Registration request */ +#define IAX_COMMAND_REGAUTH 14 /** Registration authentication required */ +#define IAX_COMMAND_REGACK 15 /** Registration accepted */ +#define IAX_COMMAND_REGREJ 16 /** Registration rejected */ +#define IAX_COMMAND_REGREL 17 /** Force release of registration */ +#define IAX_COMMAND_VNAK 18 /** If we receive voice before valid first voice frame, send this */ +#define IAX_COMMAND_DPREQ 19 /** Request status of a dialplan entry */ +#define IAX_COMMAND_DPREP 20 /** Request status of a dialplan entry */ +#define IAX_COMMAND_DIAL 21 /** Request a dial on channel brought up TBD */ +#define IAX_COMMAND_TXREQ 22 /** Transfer Request */ +#define IAX_COMMAND_TXCNT 23 /** Transfer Connect */ +#define IAX_COMMAND_TXACC 24 /** Transfer Accepted */ +#define IAX_COMMAND_TXREADY 25 /** Transfer ready */ +#define IAX_COMMAND_TXREL 26 /** Transfer release */ +#define IAX_COMMAND_TXREJ 27 /** Transfer reject */ +#define IAX_COMMAND_QUELCH 28 /** Stop audio/video transmission */ +#define IAX_COMMAND_UNQUELCH 29 /** Resume audio/video transmission */ +#define IAX_COMMAND_POKE 30 /** Like ping, but does not require an open connection */ +#define IAX_COMMAND_PAGE 31 /** Paging description */ +#define IAX_COMMAND_MWI 32 /** Stand-alone message waiting indicator */ +#define IAX_COMMAND_UNSUPPORT 33 /** Unsupported message received */ +#define IAX_COMMAND_TRANSFER 34 /** Request remote transfer */ +#define IAX_COMMAND_PROVISION 35 /** Provision an IAX2 device */ +#define IAX_COMMAND_FWDOWNL 36 /** Download firmware request */ +#define IAX_COMMAND_FWDATA 37 /** Transmit firmware data */ + +#define IAX_DEFAULT_REG_EXPIRE 60 /** By default require re-registration once per minute */ + +#define IAX_LINGER_TIMEOUT 10 /** How long to wait before closing bridged call */ + +#define IAX_DEFAULT_PORTNO 4569 + +/* IAX Information elements */ +#define IAX_IE_CALLED_NUMBER 1 /** Number/extension being called - string */ +#define IAX_IE_CALLING_NUMBER 2 /** Calling number - string */ +#define IAX_IE_CALLING_ANI 3 /** Calling number ANI for billing - string */ +#define IAX_IE_CALLING_NAME 4 /** Name of caller - string */ +#define IAX_IE_CALLED_CONTEXT 5 /** Context for number - string */ +#define IAX_IE_USERNAME 6 /** Username (peer or user) for authentication - string */ +#define IAX_IE_PASSWORD 7 /** Password for authentication - string */ +#define IAX_IE_CAPABILITY 8 /** Actual codec capability - unsigned int */ +#define IAX_IE_FORMAT 9 /** Desired codec format - unsigned int */ +#define IAX_IE_LANGUAGE 10 /** Desired language - string */ +#define IAX_IE_VERSION 11 /** Protocol version - short */ +#define IAX_IE_ADSICPE 12 /** CPE ADSI capability - short */ +#define IAX_IE_DNID 13 /** Originally dialed DNID - string */ +#define IAX_IE_AUTHMETHODS 14 /** Authentication method(s) - short */ +#define IAX_IE_CHALLENGE 15 /** Challenge data for MD5/RSA - string */ +#define IAX_IE_MD5_RESULT 16 /** MD5 challenge result - string */ +#define IAX_IE_RSA_RESULT 17 /** RSA challenge result - string */ +#define IAX_IE_APPARENT_ADDR 18 /** Apparent address of peer - struct sockaddr_in */ +#define IAX_IE_REFRESH 19 /** When to refresh registration - short */ +#define IAX_IE_DPSTATUS 20 /** Dialplan status - short */ +#define IAX_IE_CALLNO 21 /** Call number of peer - short */ +#define IAX_IE_CAUSE 22 /** Cause - string */ +#define IAX_IE_IAX_UNKNOWN 23 /** Unknown IAX command - byte */ +#define IAX_IE_MSGCOUNT 24 /** How many messages waiting - short */ +#define IAX_IE_AUTOANSWER 25 /** Request auto-answering -- none */ +#define IAX_IE_MUSICONHOLD 26 /** Request musiconhold with QUELCH -- none or string */ +#define IAX_IE_TRANSFERID 27 /** Transfer Request Identifier -- int */ +#define IAX_IE_RDNIS 28 /** Referring DNIS -- string */ +#define IAX_IE_PROVISIONING 29 /** Provisioning info */ +#define IAX_IE_AESPROVISIONING 30 /** AES Provisioning info */ +#define IAX_IE_DATETIME 31 /** Date/Time */ +#define IAX_IE_DEVICETYPE 32 /** Device Type -- string */ +#define IAX_IE_SERVICEIDENT 33 /** Service Identifier -- string */ +#define IAX_IE_FIRMWAREVER 34 /** Firmware revision -- u16 */ +#define IAX_IE_FWBLOCKDESC 35 /** Firmware block description -- u32 */ +#define IAX_IE_FWBLOCKDATA 36 /** Firmware block of data -- raw */ +#define IAX_IE_PROVVER 37 /** Provisioning Version (u32) */ +#define IAX_IE_CALLINGPRES 38 /** Calling presentation (u8) */ +#define IAX_IE_CALLINGTON 39 /** Calling type of number (u8) */ +#define IAX_IE_CALLINGTNS 40 /** Calling transit network select (u16) */ +#define IAX_IE_SAMPLINGRATE 41 /** Supported sampling rates (u16) */ +#define IAX_IE_CAUSECODE 42 /** Hangup cause (u8) */ +#define IAX_IE_ENCRYPTION 43 /** Encryption format (u16) */ +#define IAX_IE_ENCKEY 44 /** Encryption key (raw) */ +#define IAX_IE_CODEC_PREFS 45 /** Codec Negotiation */ +#define IAX_IE_RR_JITTER 46 /** Received jitter (as in RFC1889) u32 */ +#define IAX_IE_RR_LOSS 47 /** Received loss (high byte loss pct, low 24 bits loss count, as in rfc1889 */ +#define IAX_IE_RR_PKTS 48 /** Received frames (total frames received) u32 */ +#define IAX_IE_RR_DELAY 49 /** Max playout delay for received frames (in ms) u16 */ +#define IAX_IE_RR_DROPPED 50 /** Dropped frames (presumably by jitterbuf) u32 */ +#define IAX_IE_RR_OOO 51 /** Frames received Out of Order u32 */ + + + +#define IAX_AUTH_PLAINTEXT (1 << 0) +#define IAX_AUTH_MD5 (1 << 1) +#define IAX_AUTH_RSA (1 << 2) + +#define IAX_META_TRUNK 1 /** Trunk meta-message */ +#define IAX_META_VIDEO 2 /** Video frame */ + +#define IAX_RATE_8KHZ (1 << 0) /** 8khz sampling (default if absent) */ +#define IAX_RATE_11KHZ (1 << 1) /** 11.025khz sampling */ +#define IAX_RATE_16KHZ (1 << 2) /** 16khz sampling */ +#define IAX_RATE_22KHZ (1 << 3) /** 22.05khz sampling */ +#define IAX_RATE_44KHZ (1 << 4) /** 44.1khz sampling */ +#define IAX_RATE_48KHZ (1 << 5) /** 48khz sampling */ + +#define IAX_DPSTATUS_EXISTS (1 << 0) +#define IAX_DPSTATUS_CANEXIST (1 << 1) +#define IAX_DPSTATUS_NONEXISTANT (1 << 2) +#define IAX_DPSTATUS_IGNOREPAT (1 << 14) +#define IAX_DPSTATUS_MATCHMORE (1 << 15) + +#if defined(_MSC_VER) +#pragma pack(push,1) +#define __PACKED +#else +#define __PACKED __attribute__ ((__packed__)) +#endif + +/* Full frames are always delivered reliably */ +struct ast_iax2_full_hdr { + unsigned short scallno; /**< Source call number -- high bit must be 1 */ + unsigned short dcallno; /**< Destination call number -- high bit is 1 if retransmission */ + unsigned int ts; /**< 32-bit timestamp in milliseconds (from 1st transmission) */ + unsigned char oseqno; /**< Packet number (outgoing) */ + unsigned char iseqno; /**< Packet number (next incoming expected) */ + char type; /**< Frame type */ + unsigned char csub; /**< Compressed subclass */ + unsigned char iedata[0]; +} __PACKED; + +/* Mini header is used only for voice frames -- delivered unreliably */ +struct ast_iax2_mini_hdr { + unsigned short callno; /**< Source call number -- high bit must be 0, rest must be non-zero */ + unsigned short ts; /**< 16-bit Timestamp (high 16 bits from last ast_iax2_full_hdr) */ + /**< Frametype implicitly VOICE_FRAME */ + /**< subclass implicit from last ast_iax2_full_hdr */ + unsigned char data[0]; +} __PACKED; + +struct ast_iax2_meta_hdr { + unsigned short zeros; /**< Zeros field -- must be zero */ + unsigned char metacmd; /**< Meta command */ + unsigned char cmddata; /**< Command Data */ + unsigned char data[0]; +} __PACKED; + +struct ast_iax2_video_hdr { + unsigned short zeros; /**< Zeros field -- must be zero */ + unsigned short callno; /**< Video call number */ + unsigned short ts; /**< Timestamp and mark if present */ + unsigned char data[0]; +} __PACKED; + +struct ast_iax2_meta_trunk_hdr { + unsigned int ts; /**< 32-bit timestamp for all messages */ + unsigned char data[0]; +} __PACKED; + +struct ast_iax2_meta_trunk_entry { + unsigned short callno; /**< Call number */ + unsigned short len; /**< Length of data for this callno */ +} __PACKED; + +#define IAX_FIRMWARE_MAGIC 0x69617879 + +struct ast_iax2_firmware_header { + unsigned int magic; /**< Magic number */ + unsigned short version; /**< Software version */ + unsigned char devname[16]; /**< Device */ + unsigned int datalen; /**< Data length of file beyond header */ + unsigned char chksum[16]; /**< Checksum of all data */ + unsigned char data[0]; +} __PACKED; + + +#if defined(_MSC_VER) +#pragma pack(pop) +#endif + +#undef __PACKED + +#endif diff --git a/libs/libiax2/src/jitterbuf.c b/libs/libiax2/src/jitterbuf.c new file mode 100644 index 0000000000000000000000000000000000000000..0d450240c15e8db21ed4923743b6b9468de458c9 --- /dev/null +++ b/libs/libiax2/src/jitterbuf.c @@ -0,0 +1,833 @@ +/* + * jitterbuf: an application-independent jitterbuffer + * + * Copyrights: + * Copyright (C) 2004-2005, Horizon Wimba, Inc. + * + * Contributors: + * Steve Kann <stevek@stevek.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + * + * Copyright on this file is disclaimed to Digium for inclusion in Asterisk + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +#include "jitterbuf.h" + +/* define these here, just for ancient compiler systems */ +#define JB_LONGMAX 2147483647L +#define JB_LONGMIN (-JB_LONGMAX - 1L) + +/* MS VC can't do __VA_ARGS__ */ +#if (defined(WIN32) || defined(_WIN32_WCE)) && defined(_MSC_VER) +#define jb_warn if (warnf) warnf +#define jb_err if (errf) errf +#define jb_dbg if (dbgf) dbgf + +#ifdef DEEP_DEBUG + #define jb_dbg2 if (dbgf) dbgf +#else + #define jb_dbg2 if (0) dbgf +#endif + +#else + +#define jb_warn(...) (warnf ? warnf(__VA_ARGS__) : (void)0) +#define jb_err(...) (errf ? errf(__VA_ARGS__) : (void)0) +#define jb_dbg(...) (dbgf ? dbgf(__VA_ARGS__) : (void)0) + +#ifdef DEEP_DEBUG +#define jb_dbg2(...) (dbgf ? dbgf(__VA_ARGS__) : (void)0) +#else +#define jb_dbg2(...) ((void)0) +#endif + +#endif + +static jb_output_function_t warnf, errf, dbgf; + +void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg) +{ + errf = err; + warnf = warn; + dbgf = dbg; +} + +static void increment_losspct(jitterbuf *jb) +{ + jb->info.losspct = (100000 + 499 * jb->info.losspct)/500; +} + +static void decrement_losspct(jitterbuf *jb) +{ + jb->info.losspct = (499 * jb->info.losspct)/500; +} + +void jb_reset(jitterbuf *jb) +{ + /* only save settings */ + jb_conf s = jb->info.conf; + memset(jb, 0, sizeof(*jb)); + jb->info.conf = s; + + /* initialize length, using the configured value */ + jb->info.current = jb->info.target = jb->info.conf.target_extra; + jb->info.silence_begin_ts = -1; +} + +jitterbuf * jb_new() +{ + jitterbuf *jb; + + if (!(jb = (jitterbuf *)malloc(sizeof(*jb)))) + return NULL; + + jb->info.conf.target_extra = JB_TARGET_EXTRA; + + jb_reset(jb); + + jb_dbg2("jb_new() = %x\n", jb); + return jb; +} + +void jb_destroy(jitterbuf *jb) +{ + jb_frame *frame; + jb_dbg2("jb_destroy(%x)\n", jb); + + /* free all the frames on the "free list" */ + frame = jb->free; + while (frame != NULL) { + jb_frame *next = frame->next; + free(frame); + frame = next; + } + + /* free ourselves! */ + free(jb); +} + + + +#if 0 +static int longcmp(const void *a, const void *b) +{ + return *(long *)a - *(long *)b; +} +#endif + +/* simple history manipulation */ +/* maybe later we can make the history buckets variable size, or something? */ +/* drop parameter determines whether we will drop outliers to minimize + * delay */ +static int history_put(jitterbuf *jb, long ts, long now, long ms) +{ + long delay = now - (ts - jb->info.resync_offset); + long threshold = 2 * jb->info.jitter + jb->info.conf.resync_threshold; + long kicked; + + /* don't add special/negative times to history */ + if (ts <= 0) + return 0; + + /* check for drastic change in delay */ + if (jb->info.conf.resync_threshold != -1) { + if (abs(delay - jb->info.last_delay) > threshold) { + jb->info.cnt_delay_discont++; + if (jb->info.cnt_delay_discont > 3) { + /* resync the jitterbuffer */ + jb->info.cnt_delay_discont = 0; + jb->hist_ptr = 0; + jb->hist_maxbuf_valid = 0; + + jb_warn("Resyncing the jb. last_delay %ld, this delay %ld, threshold %ld, new offset %ld\n", jb->info.last_delay, delay, threshold, ts - now); + jb->info.resync_offset = ts - now; + jb->info.last_delay = delay = 0; /* after resync, frame is right on time */ + } else { + return -1; + } + } else { + jb->info.last_delay = delay; + jb->info.cnt_delay_discont = 0; + } + } + + kicked = jb->history[jb->hist_ptr % JB_HISTORY_SZ]; + + jb->history[(jb->hist_ptr++) % JB_HISTORY_SZ] = delay; + + /* optimization; the max/min buffers don't need to be recalculated, + * if this packet's entry doesn't change them. This happens if this + * packet is not involved, _and_ any packet that got kicked out of + * the history is also not involved. We do a number of comparisons, + * but it's probably still worthwhile, because it will usually + * succeed, and should be a lot faster than going through all 500 + * packets in history */ + if (!jb->hist_maxbuf_valid) + return 0; + + /* don't do this until we've filled history + * (reduces some edge cases below) */ + if (jb->hist_ptr < JB_HISTORY_SZ) + goto invalidate; + + /* if the new delay would go into min */ + if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) + goto invalidate; + + /* or max.. */ + if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) + goto invalidate; + + /* or the kicked delay would be in min */ + if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) + goto invalidate; + + if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) + goto invalidate; + + /* if we got here, we don't need to invalidate, 'cause this delay didn't + * affect things */ + return 0; + /* end optimization */ + + +invalidate: + jb->hist_maxbuf_valid = 0; + return 0; +} + +static void history_calc_maxbuf(jitterbuf *jb) +{ + int i,j; + + if (jb->hist_ptr == 0) + return; + + + /* initialize maxbuf/minbuf to the latest value */ + for (i=0;i<JB_HISTORY_MAXBUF_SZ;i++) { + /* + * jb->hist_maxbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ]; + * jb->hist_minbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ]; + */ + jb->hist_maxbuf[i] = JB_LONGMIN; + jb->hist_minbuf[i] = JB_LONGMAX; + } + + /* use insertion sort to populate maxbuf */ + /* we want it to be the top "n" values, in order */ + + /* start at the beginning, or JB_HISTORY_SZ frames ago */ + i = (jb->hist_ptr > JB_HISTORY_SZ) ? (jb->hist_ptr - JB_HISTORY_SZ) : 0; + + for (;i<jb->hist_ptr;i++) { + long toins = jb->history[i % JB_HISTORY_SZ]; + + /* if the maxbuf should get this */ + if (toins > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) { + + /* insertion-sort it into the maxbuf */ + for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) { + /* found where it fits */ + if (toins > jb->hist_maxbuf[j]) { + /* move over */ + memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0])); + /* insert */ + jb->hist_maxbuf[j] = toins; + + break; + } + } + } + + /* if the minbuf should get this */ + if (toins < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) { + + /* insertion-sort it into the maxbuf */ + for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) { + /* found where it fits */ + if (toins < jb->hist_minbuf[j]) { + /* move over */ + memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0])); + /* insert */ + jb->hist_minbuf[j] = toins; + + break; + } + } + } + + if (0) { + int k; + fprintf(stderr, "toins = %ld\n", toins); + fprintf(stderr, "maxbuf ="); + for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++) + fprintf(stderr, "%ld ", jb->hist_maxbuf[k]); + fprintf(stderr, "\nminbuf ="); + for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++) + fprintf(stderr, "%ld ", jb->hist_minbuf[k]); + fprintf(stderr, "\n"); + } + } + + jb->hist_maxbuf_valid = 1; +} + +static void history_get(jitterbuf *jb) +{ + long max, min, jitter; + int index; + int count; + + if (!jb->hist_maxbuf_valid) + history_calc_maxbuf(jb); + + /* count is how many items in history we're examining */ + count = (jb->hist_ptr < JB_HISTORY_SZ) ? jb->hist_ptr : JB_HISTORY_SZ; + + /* index is the "n"ths highest/lowest that we'll look for */ + index = count * JB_HISTORY_DROPPCT / 100; + + /* sanity checks for index */ + if (index > (JB_HISTORY_MAXBUF_SZ - 1)) + index = JB_HISTORY_MAXBUF_SZ - 1; + + + if (index < 0) { + jb->info.min = 0; + jb->info.jitter = 0; + return; + } + + max = jb->hist_maxbuf[index]; + min = jb->hist_minbuf[index]; + + jitter = max - min; + + /* these debug stmts compare the difference between looking at the absolute jitter, and the + * values we get by throwing away the outliers */ + /* + fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", index, min, max, jitter); + fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", 0, jb->hist_minbuf[0], jb->hist_maxbuf[0], jb->hist_maxbuf[0]-jb->hist_minbuf[0]); + */ + + jb->info.min = min; + jb->info.jitter = jitter; +} + +/* returns 1 if frame was inserted into head of queue, 0 otherwise */ +static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts) +{ + jb_frame *frame; + jb_frame *p; + int head = 0; + long resync_ts = ts - jb->info.resync_offset; + + if ((frame = jb->free)) { + jb->free = frame->next; + } else if (!(frame = (jb_frame *)malloc(sizeof(*frame)))) { + jb_err("cannot allocate frame\n"); + return 0; + } + + jb->info.frames_cur++; + + frame->data = data; + frame->ts = resync_ts; + frame->ms = ms; + frame->type = type; + + /* + * frames are a circular list, jb-frames points to to the lowest ts, + * jb->frames->prev points to the highest ts + */ + + if (!jb->frames) { /* queue is empty */ + jb->frames = frame; + frame->next = frame; + frame->prev = frame; + head = 1; + } else if (resync_ts < jb->frames->ts) { + frame->next = jb->frames; + frame->prev = jb->frames->prev; + + frame->next->prev = frame; + frame->prev->next = frame; + + /* frame is out of order */ + jb->info.frames_ooo++; + + jb->frames = frame; + head = 1; + } else { + p = jb->frames; + + /* frame is out of order */ + if (resync_ts < p->prev->ts) jb->info.frames_ooo++; + + while (resync_ts < p->prev->ts && p->prev != jb->frames) + p = p->prev; + + frame->next = p; + frame->prev = p->prev; + + frame->next->prev = frame; + frame->prev->next = frame; + } + return head; +} + +static long queue_next(jitterbuf *jb) +{ + if (jb->frames) + return jb->frames->ts; + else + return -1; +} + +static long queue_last(jitterbuf *jb) +{ + if (jb->frames) + return jb->frames->prev->ts; + else + return -1; +} + +static jb_frame *_queue_get(jitterbuf *jb, long ts, int all) +{ + jb_frame *frame; + frame = jb->frames; + + if (!frame) + return NULL; + + /*jb_warn("queue_get: ASK %ld FIRST %ld\n", ts, frame->ts); */ + + if (all || ts >= frame->ts) { + /* remove this frame */ + frame->prev->next = frame->next; + frame->next->prev = frame->prev; + + if (frame->next == frame) + jb->frames = NULL; + else + jb->frames = frame->next; + + + /* insert onto "free" single-linked list */ + frame->next = jb->free; + jb->free = frame; + + jb->info.frames_cur--; + + /* we return the frame pointer, even though it's on free list, + * but caller must copy data */ + return frame; + } + + return NULL; +} + +static jb_frame *queue_get(jitterbuf *jb, long ts) +{ + return _queue_get(jb,ts,0); +} + +static jb_frame *queue_getall(jitterbuf *jb) +{ + return _queue_get(jb,0,1); +} + +#if 0 +/* some diagnostics */ +static void jb_dbginfo(jitterbuf *jb) +{ + if (dbgf == NULL) + return; + + jb_dbg("\njb info: fin=%ld fout=%ld flate=%ld flost=%ld fdrop=%ld fcur=%ld\n", + jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur); + + jb_dbg("jitter=%ld current=%ld target=%ld min=%ld sil=%d len=%d len/fcur=%ld\n", + jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min, + jb->info.frames_cur ? (jb->info.current - jb->info.min)/jb->info.frames_cur : -8); + if (jb->info.frames_in > 0) + jb_dbg("jb info: Loss PCT = %ld%%, Late PCT = %ld%%\n", + jb->info.frames_lost * 100/(jb->info.frames_in + jb->info.frames_lost), + jb->info.frames_late * 100/jb->info.frames_in); + jb_dbg("jb info: queue %d -> %d. last_ts %d (queue len: %d) last_ms %d\n", + queue_next(jb), + queue_last(jb), + jb->info.next_voice_ts, + queue_last(jb) - queue_next(jb), + jb->info.last_voice_ms); +} +#endif + +#ifdef DEEP_DEBUG +static void jb_chkqueue(jitterbuf *jb) +{ + int i=0; + jb_frame *p = jb->frames; + + if (!p) { + return; + } + + do { + if (p->next == NULL) { + jb_err("Queue is BROKEN at item [%d]", i); + } + i++; + p=p->next; + } while (p->next != jb->frames); +} + +static void jb_dbgqueue(jitterbuf *jb) +{ + int i=0; + jb_frame *p = jb->frames; + + jb_dbg("queue: "); + + if (!p) { + jb_dbg("EMPTY\n"); + return; + } + + do { + jb_dbg("[%d]=%ld ", i++, p->ts); + p=p->next; + } while (p->next != jb->frames); + + jb_dbg("\n"); +} +#endif + +enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now) +{ + jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now); + + jb->info.frames_in++; + + if (type == JB_TYPE_VOICE) { + /* presently, I'm only adding VOICE frames to history and drift + * calculations; mostly because with the IAX integrations, I'm + * sending retransmitted control frames with their awkward + * timestamps through + */ + if (history_put(jb,ts,now,ms)) + return JB_DROP; + } + + /* if put into head of queue, caller needs to reschedule */ + if (queue_put(jb,data,type,ms,ts)) { + return JB_SCHED; + } + + return JB_OK; +} + + +static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl) +{ + jb_frame *frame; + long diff; + + /*if ((now - jb_next(jb)) > 2 * jb->info.last_voice_ms) jb_warn("SCHED: %ld", (now - jb_next(jb))); */ + /* get jitter info */ + history_get(jb); + + + /* target */ + jb->info.target = jb->info.jitter + jb->info.min + jb->info.conf.target_extra; + + /* if a hard clamp was requested, use it */ + if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) { + jb_dbg("clamping target from %d to %d\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf); + jb->info.target = jb->info.min + jb->info.conf.max_jitterbuf; + } + + diff = jb->info.target - jb->info.current; + + /* jb_warn("diff = %d lms=%d last = %d now = %d\n", diff, */ + /* jb->info.last_voice_ms, jb->info.last_adjustment, now); */ + + /* let's work on non-silent case first */ + if (!jb->info.silence_begin_ts) { + /* we want to grow */ + if ((diff > 0) && + /* we haven't grown in the delay length */ + (((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) || + /* we need to grow more than the "length" we have left */ + (diff > queue_last(jb) - queue_next(jb)) ) ) { + /* grow by interp frame length */ + jb->info.current += interpl; + jb->info.next_voice_ts += interpl; + jb->info.last_voice_ms = interpl; + jb->info.last_adjustment = now; + jb->info.cnt_contig_interp++; + /* assume silence instead of continuing to interpolate */ + if (jb->info.conf.max_contig_interp && jb->info.cnt_contig_interp >= jb->info.conf.max_contig_interp) { + jb->info.silence_begin_ts = jb->info.next_voice_ts - jb->info.current; + } + jb_dbg("G"); + return JB_INTERP; + } + + frame = queue_get(jb, jb->info.next_voice_ts - jb->info.current); + + /* not a voice frame; just return it. */ + if (frame && frame->type != JB_TYPE_VOICE) { + /* track start of silence */ + if (frame->type == JB_TYPE_SILENCE) { + jb->info.silence_begin_ts = frame->ts; + jb->info.cnt_contig_interp = 0; + } + + *frameout = *frame; + jb->info.frames_out++; + jb_dbg("o"); + return JB_OK; + } + + /* voice frame is later than expected */ + if (frame && frame->ts + jb->info.current < jb->info.next_voice_ts) { + if (frame->ts + jb->info.current > jb->info.next_voice_ts - jb->info.last_voice_ms) { + /* either we interpolated past this frame in the last jb_get */ + /* or the frame is still in order, but came a little too quick */ + *frameout = *frame; + /* reset expectation for next frame */ + jb->info.next_voice_ts = frame->ts + jb->info.current + frame->ms; + jb->info.frames_out++; + decrement_losspct(jb); + jb->info.cnt_contig_interp = 0; + jb_dbg("v"); + return JB_OK; + } else { + /* voice frame is late */ + *frameout = *frame; + jb->info.frames_out++; + decrement_losspct(jb); + jb->info.frames_late++; + jb->info.frames_lost--; + jb_dbg("l"); + /*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb)); + jb_warninfo(jb); */ + return JB_DROP; + } + } + + /* keep track of frame sizes, to allow for variable sized-frames */ + if (frame && frame->ms > 0) { + jb->info.last_voice_ms = frame->ms; + } + + /* we want to shrink; shrink at 1 frame / 500ms */ + /* unless we don't have a frame, then shrink 1 frame */ + /* every 80ms (though perhaps we can shrink even faster */ + /* in this case) */ + if (diff < -jb->info.conf.target_extra && + ((!frame && jb->info.last_adjustment + 80 < now) || + (jb->info.last_adjustment + 500 < now))) { + + jb->info.last_adjustment = now; + jb->info.cnt_contig_interp = 0; + + if (frame) { + *frameout = *frame; + /* shrink by frame size we're throwing out */ + jb->info.current -= frame->ms; + jb->info.frames_out++; + decrement_losspct(jb); + jb->info.frames_dropped++; + jb_dbg("s"); + return JB_DROP; + } else { + /* shrink by last_voice_ms */ + jb->info.current -= jb->info.last_voice_ms; + jb->info.frames_lost++; + increment_losspct(jb); + jb_dbg("S"); + return JB_NOFRAME; + } + } + + /* lost frame */ + if (!frame) { + /* this is a bit of a hack for now, but if we're close to + * target, and we find a missing frame, it makes sense to + * grow, because the frame might just be a bit late; + * otherwise, we presently get into a pattern where we return + * INTERP for the lost frame, then it shows up next, and we + * throw it away because it's late */ + /* I've recently only been able to replicate this using + * iaxclient talking to app_echo on asterisk. In this case, + * my outgoing packets go through asterisk's (old) + * jitterbuffer, and then might get an unusual increasing delay + * there if it decides to grow?? */ + /* Update: that might have been a different bug, that has been fixed.. + * But, this still seemed like a good idea, except that it ended up making a single actual + * lost frame get interpolated two or more times, when there was "room" to grow, so it might + * be a bit of a bad idea overall */ + /*if (diff > -1 * jb->info.last_voice_ms) { + jb->info.current += jb->info.last_voice_ms; + jb->info.last_adjustment = now; + jb_warn("g"); + return JB_INTERP; + } */ + jb->info.frames_lost++; + increment_losspct(jb); + jb->info.next_voice_ts += interpl; + jb->info.last_voice_ms = interpl; + jb->info.cnt_contig_interp++; + /* assume silence instead of continuing to interpolate */ + if (jb->info.conf.max_contig_interp && jb->info.cnt_contig_interp >= jb->info.conf.max_contig_interp) { + jb->info.silence_begin_ts = jb->info.next_voice_ts - jb->info.current; + } + jb_dbg("L"); + return JB_INTERP; + } + + /* normal case; return the frame, increment stuff */ + *frameout = *frame; + jb->info.next_voice_ts += frame->ms; + jb->info.frames_out++; + jb->info.cnt_contig_interp = 0; + decrement_losspct(jb); + jb_dbg("v"); + return JB_OK; + } else { + /* TODO: after we get the non-silent case down, we'll make the + * silent case -- basically, we'll just grow and shrink faster + * here, plus handle next_voice_ts a bit differently */ + + /* to disable silent special case altogether, just uncomment this: */ + /* jb->info.silence_begin_ts = 0; */ + + /* shrink interpl len every 10ms during silence */ + if (diff < -jb->info.conf.target_extra && + jb->info.last_adjustment + 10 <= now) { + jb->info.current -= interpl; + jb->info.last_adjustment = now; + } + + frame = queue_get(jb, now - jb->info.current); + if (!frame) { + return JB_NOFRAME; + } else if (frame->type != JB_TYPE_VOICE) { + /* normal case; in silent mode, got a non-voice frame */ + *frameout = *frame; + jb->info.frames_out++; + return JB_OK; + } + if (frame->ts < jb->info.silence_begin_ts) { + /* voice frame is late */ + *frameout = *frame; + jb->info.frames_out++; + decrement_losspct(jb); + jb->info.frames_late++; + jb->info.frames_lost--; + jb_dbg("l"); + /*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb)); + jb_warninfo(jb); */ + return JB_DROP; + } else { + /* voice frame */ + /* try setting current to target right away here */ + jb->info.current = jb->info.target; + jb->info.silence_begin_ts = 0; + jb->info.next_voice_ts = frame->ts + jb->info.current + frame->ms; + jb->info.last_voice_ms = frame->ms; + jb->info.frames_out++; + decrement_losspct(jb); + *frameout = *frame; + jb_dbg("V"); + return JB_OK; + } + } +} + +long jb_next(jitterbuf *jb) +{ + if (jb->info.silence_begin_ts) { + if (jb->frames) { + long next = queue_next(jb); + history_get(jb); + /* shrink during silence */ + if (jb->info.target - jb->info.current < -jb->info.conf.target_extra) + return jb->info.last_adjustment + 10; + return next + jb->info.target; + } + else + return JB_LONGMAX; + } else { + return jb->info.next_voice_ts; + } +} + +enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, long now, long interpl) +{ + enum jb_return_code ret = _jb_get(jb, frameout, now, interpl); +#if 0 + static int lastts=0; + int thists = ((ret == JB_OK) || (ret == JB_DROP)) ? frameout->ts : 0; + jb_warn("jb_get(%x,%x,%ld) = %d (%d)\n", jb, frameout, now, ret, thists); + if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n"); + lastts = thists; +#endif + return ret; +} + +enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout) +{ + jb_frame *frame; + frame = queue_getall(jb); + + if (!frame) { + return JB_NOFRAME; + } + + *frameout = *frame; + return JB_OK; +} + + +enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats) +{ + history_get(jb); + + *stats = jb->info; + + return JB_OK; +} + +enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf) +{ + /* take selected settings from the struct */ + + jb->info.conf.max_jitterbuf = conf->max_jitterbuf; + jb->info.conf.resync_threshold = conf->resync_threshold; + jb->info.conf.max_contig_interp = conf->max_contig_interp; + + /* -1 indicates use of the default JB_TARGET_EXTRA value */ + jb->info.conf.target_extra = ( conf->target_extra == -1 ) + ? JB_TARGET_EXTRA + : conf->target_extra + ; + + /* update these to match new target_extra setting */ + jb->info.current = jb->info.conf.target_extra; + jb->info.target = jb->info.conf.target_extra; + + return JB_OK; +} + + diff --git a/libs/libiax2/src/jitterbuf.h b/libs/libiax2/src/jitterbuf.h new file mode 100644 index 0000000000000000000000000000000000000000..293c92d4d3a7342c74500ac2c96feae35e15bad9 --- /dev/null +++ b/libs/libiax2/src/jitterbuf.h @@ -0,0 +1,164 @@ +/* + * jitterbuf: an application-independent jitterbuffer + * + * Copyrights: + * Copyright (C) 2004-2005, Horizon Wimba, Inc. + * + * Contributors: + * Steve Kann <stevek@stevek.com> + * + * This program is free software, distributed under the terms of + * the GNU Lesser (Library) General Public License + * + * Copyright on this file is disclaimed to Digium for inclusion in Asterisk + */ + +#ifndef _JITTERBUF_H_ +#define _JITTERBUF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* configuration constants */ + /* Number of historical timestamps to use in calculating jitter and drift */ +#define JB_HISTORY_SZ 500 + /* what percentage of timestamps should we drop from the history when we examine it; + * this might eventually be something made configurable */ +#define JB_HISTORY_DROPPCT 3 + /* the maximum droppct we can handle (say it was configurable). */ +#define JB_HISTORY_DROPPCT_MAX 4 + /* the size of the buffer we use to keep the top and botton timestamps for dropping */ +#define JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100 + /* amount of additional jitterbuffer adjustment */ +#define JB_TARGET_EXTRA 40 + /* ms between growing and shrinking; may not be honored if jitterbuffer runs out of space */ +#define JB_ADJUST_DELAY 40 + +enum jb_return_code { + /* return codes */ + JB_OK, /* 0 */ + JB_EMPTY, /* 1 */ + JB_NOFRAME, /* 2 */ + JB_INTERP, /* 3 */ + JB_DROP, /* 4 */ + JB_SCHED /* 5 */ +}; + +enum jb_frame_type { +/* frame types */ + JB_TYPE_CONTROL, /* 0 */ + JB_TYPE_VOICE, /* 1 */ + JB_TYPE_VIDEO, /* 2 - reserved */ + JB_TYPE_SILENCE /* 3 */ +}; + +typedef struct jb_conf { + /* settings */ + long max_jitterbuf; /**< defines a hard clamp to use in setting the jitter buffer delay */ + long resync_threshold; /**< the jb will resync when delay increases to (2 * jitter) + this param */ + long max_contig_interp; /**< the max interp frames to return in a row */ + long target_extra; /**< amount of additional jitterbuffer adjustment, overrides JB_TARGET_EXTRA */ +} jb_conf; + +typedef struct jb_info { + jb_conf conf; + + /* statistics */ + long frames_in; /**< number of frames input to the jitterbuffer.*/ + long frames_out; /**< number of frames output from the jitterbuffer.*/ + long frames_late; /**< number of frames which were too late, and dropped.*/ + long frames_lost; /**< number of missing frames.*/ + long frames_dropped; /**< number of frames dropped (shrinkage) */ + long frames_ooo; /**< number of frames received out-of-order */ + long frames_cur; /**< number of frames presently in jb, awaiting delivery.*/ + long jitter; /**< jitter measured within current history interval*/ + long min; /**< minimum lateness within current history interval */ + long current; /**< the present jitterbuffer adjustment */ + long target; /**< the target jitterbuffer adjustment */ + long losspct; /**< recent lost frame percentage (* 1000) */ + long next_voice_ts; /**< the ts of the next frame to be read from the jb - in receiver's time */ + long last_voice_ms; /**< the duration of the last voice frame */ + long silence_begin_ts; /**< the time of the last CNG frame, when in silence */ + long last_adjustment; /**< the time of the last adjustment */ + long last_delay; /**< the last now added to history */ + long cnt_delay_discont; /**< the count of discontinuous delays */ + long resync_offset; /**< the amount to offset ts to support resyncs */ + long cnt_contig_interp; /**< the number of contiguous interp frames returned */ +} jb_info; + +typedef struct jb_frame { + void *data; /**< the frame data */ + long ts; /**< the relative delivery time expected */ + long ms; /**< the time covered by this frame, in sec/8000 */ + enum jb_frame_type type; /**< the type of frame */ + struct jb_frame *next, *prev; +} jb_frame; + +typedef struct jitterbuf { + jb_info info; + + /* history */ + long history[JB_HISTORY_SZ]; /**< history */ + int hist_ptr; /**< points to index in history for next entry */ + long hist_maxbuf[JB_HISTORY_MAXBUF_SZ]; /**< a sorted buffer of the max delays (highest first) */ + long hist_minbuf[JB_HISTORY_MAXBUF_SZ]; /**< a sorted buffer of the min delays (lowest first) */ + int hist_maxbuf_valid; /**< are the "maxbuf"/minbuf valid? */ + + jb_frame *frames; /**< queued frames */ + jb_frame *free; /**< free frames (avoid malloc?) */ +} jitterbuf; + + +/** new jitterbuf */ +jitterbuf * jb_new(void); + +/** destroy jitterbuf */ +void jb_destroy(jitterbuf *jb); + +/** reset jitterbuf */ +/* NOTE: The jitterbuffer should be empty before you call this, otherwise + * you will leak queued frames, and some internal structures */ +void jb_reset(jitterbuf *jb); + +/** queue a frame data=frame data, timings (in ms): ms=length of frame (for voice), ts=ts (sender's time) + * + * now=now (in receiver's time) return value is one of + * JB_OK: Frame added. Last call to jb_next() still valid + * JB_DROP: Drop this frame immediately + * JB_SCHED: Frame added. Call jb_next() to get a new time for the next frame + */ +enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now); + +/** get a frame for time now (receiver's time) return value is one of + * + * JB_OK: You've got frame! + * JB_DROP: Here's an audio frame you should just drop. Ask me again for this time.. + * JB_NOFRAME: There's no frame scheduled for this time. + * JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame) + * JB_EMPTY: The jb is empty. + */ +enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frame, long now, long interpl); + +/** unconditionally get frames from jitterbuf until empty */ +enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout); + +/* when is the next frame due out, in receiver's time (0=EMPTY) + * This value may change as frames are added (esp non-audio frames) */ +long jb_next(jitterbuf *jb); + +/* get jitterbuf info: only "statistics" may be valid */ +enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats); + +/* set jitterbuf conf */ +enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf); + +typedef void (*jb_output_function_t)(const char *fmt, ...); +extern void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libs/libiax2/src/md5.c b/libs/libiax2/src/md5.c new file mode 100644 index 0000000000000000000000000000000000000000..401216ee27167b9e048cdcaa7831e65aed7bb303 --- /dev/null +++ b/libs/libiax2/src/md5.c @@ -0,0 +1,285 @@ +/* MD5 checksum routines used for authentication. Not covered by GPL, but + in the public domain as per the copyright below */ + +#ifdef FREEBSD +# include <machine/endian.h> +#elif defined(LINUX) +# include <endian.h> +# include <features.h> +# include <sys/types.h> +#elif defined(SOLARIS) + /* each solaris is different -- this won't work on 2.6 or 2.7 */ +# include <sys/isa_defs.h> /* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */ +# define __BIG_ENDIAN 4321 +# define __LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 +# define LITTLE_ENDIAN 1234 +# ifdef _LITTLE_ENDIAN +# define __BYTE_ORDER __LITTLE_ENDIAN +# define BYTE_ORDER LITTLE_ENDIAN +# else +# define __BYTE_ORDER __BIG_ENDIAN +# define BYTE_ORDER BIG_ENDIAN +# endif +#endif + +#if __BYTE_ORDER == __BIG_ENDIAN || BYTE_ORDER == BIG_ENDIAN +# define HIGHFIRST 1 +#elif __BYTE_ORDER == __LITTLE_ENDIAN || BYTE_ORDER == LITLE_ENDIAN +# undef HIGHFIRST +#else +# error "Please fix <bits/endian.h>" +#endif + +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ +#include <string.h> /* for memcpy() */ +#include "md5.h" + +#ifndef HIGHFIRST +#define byteReverse(buf, len) /* Nothing */ +#else +void byteReverse(uint8_t *buf, unsigned int longs); + +#ifndef ASM_MD5 +/* + * Note: this code is harmless on little-endian machines. + */ +void byteReverse(uint8_t *buf, unsigned int longs) +{ + uint32_t t; + do { + t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32_t *) buf = t; + buf += 4; + } while (--longs); +} +#endif +#endif + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(struct MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(struct MD5Context *ctx, uint8_t const *buf, unsigned int len) +{ + uint32_t t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + uint8_t *p = (uint8_t *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Final(uint8_t digest[16], struct MD5Context *ctx) +{ + unsigned int count; + uint8_t *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32_t *) ctx->in)[14] = ctx->bits[0]; + ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse((uint8_t *) ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + +#ifndef ASM_MD5 + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void MD5Transform(uint32_t buf[4], uint32_t const in[16]) +{ + uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +#endif diff --git a/libs/libiax2/src/md5.h b/libs/libiax2/src/md5.h new file mode 100644 index 0000000000000000000000000000000000000000..81c9e30613b890f34e38663f9cc536dfa7cb4b0a --- /dev/null +++ b/libs/libiax2/src/md5.h @@ -0,0 +1,27 @@ +#ifndef MD5_H +#define MD5_H + +#ifndef _MSC_VER +#include <inttypes.h> +#else +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +#endif + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + uint8_t in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, uint8_t const *buf, unsigned int len); +void MD5Final(uint8_t digest[16], struct MD5Context *context); +void MD5Transform(uint32_t buf[4], uint32_t const in[16]); + +/* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +typedef struct MD5Context MD5_CTX; + +#endif /* !MD5_H */ diff --git a/libs/libiax2/src/miniphone.c b/libs/libiax2/src/miniphone.c new file mode 100644 index 0000000000000000000000000000000000000000..ab0dd8463c7504246be307919724db1959fea4a9 --- /dev/null +++ b/libs/libiax2/src/miniphone.c @@ -0,0 +1,776 @@ +/* + * Miniphone: A simple, command line telephone + * + * IAX Support for talking to Asterisk and other Gnophone clients + * + * Copyright (C) 1999, Linux Support Services, Inc. + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <stdio.h> +#include <errno.h> +#include <sys/ioctl.h> +#include <iax-client.h> +#include <linux/soundcard.h> +#include <errno.h> +#include <sys/time.h> +#include <sys/signal.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <gsm.h> +#include <miniphone.h> +#include <time.h> + +#include "busy.h" +#include "dialtone.h" +#include "answer.h" +#include "ringtone.h" +#include "ring10.h" +#include "options.h" + +#define FRAME_SIZE 160 + +static char callerid[80]; + +struct peer { + int time; + gsm gsmin; + gsm gsmout; + + struct iax_session *session; + struct peer *next; +}; + +static char *audiodev = "/dev/dsp"; +static int audiofd = -1; +static struct peer *peers; +static int answered_call = 0; + +static struct peer *find_peer(struct iax_session *); +static int audio_setup(char *); +static void sighandler(int); +static void parse_args(FILE *, unsigned char *); +void do_iax_event(FILE *); +void call(FILE *, char *); +void answer_call(void); +void reject_call(void); +static void handle_event(FILE *, struct iax_event *e, struct peer *p); +void parse_cmd(FILE *, int, char **); +void issue_prompt(FILE *); +void dump_array(FILE *, char **); + +struct sound { + short *data; + int datalen; + int samplen; + int silencelen; + int repeat; +}; + +static int cursound = -1; + +static int sampsent = 0; +static int offset = 0; +static int silencelen = 0; +static int nosound = 0; + +static int offhook = 0; +static int ringing = 0; + +static int writeonly = 0; + +static struct iax_session *registry = NULL; +static struct timeval regtime; + +#define TONE_NONE -1 +#define TONE_RINGTONE 0 +#define TONE_BUSY 1 +#define TONE_CONGEST 2 +#define TONE_RINGER 3 +#define TONE_ANSWER 4 +#define TONE_DIALTONE 5 + +#define OUTPUT_NONE 0 +#define OUTPUT_SPEAKER 1 +#define OUTPUT_HANDSET 2 +#define OUTPUT_BOTH 3 + +static struct sound sounds[] = { + { ringtone, sizeof(ringtone)/2, 16000, 32000, 1 }, + { busy, sizeof(busy)/2, 4000, 4000, 1 }, + { busy, sizeof(busy)/2, 2000, 2000, 1 }, + { ring10, sizeof(ring10)/2, 16000, 32000, 1 }, + { answer, sizeof(answer)/2, 2200, 0, 0 }, + { dialtone, sizeof(dialtone)/2, 8000, 0, 1 }, +}; + +static char *help[] = { +"Welcome to the miniphone telephony client, the commands are as follows:\n", +"Help\t\t-\tDisplays this screen.", +"Help <Command>\t-\tInqueries specific information on a command.", +"Dial <Number>\t-\tDials the number supplied in the first arguement", +"Status\t\t-\tLists the current sessions and their current status.", +"Quit\t\t-\tShuts down the client.", +"", +0 +}; + +static short silence[FRAME_SIZE]; + +static struct peer *most_recent_answer; +static struct iax_session *newcall = 0; + +static struct peer *find_peer(struct iax_session *session) +{ + struct peer *cur = peers; + while(cur) { + if (cur->session == session) + return cur; + cur = cur->next; + } + return NULL; +} + +static int audio_setup(char *dev) +{ + int fd; + int fmt = AFMT_S16_LE; + int channels = 1; + int speed = 8000; + int fragsize = (40 << 16) | 6; + if ( (fd = open(dev, O_RDWR | O_NONBLOCK)) < 0) { + fprintf(stderr, "Unable to open audio device %s: %s\n", dev, strerror(errno)); + return -1; + } + if (ioctl(fd, SNDCTL_DSP_SETFMT, &fmt) || (fmt != AFMT_S16_LE)) { + fprintf(stderr, "Unable to set in signed linear format.\n"); + return -1; + } + if (ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0)) { + fprintf(stderr, "Unable to set full duplex operation.\n"); + writeonly = 1; + /* return -1; */ + } + if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) || (channels != 1)) { + fprintf(stderr, "Unable to set to mono\n"); + return -1; + } + if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) || (speed != 8000)) { + fprintf(stderr, "Unable to set speed to 8000 hz\n"); + return -1; + } + if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fragsize)) { + fprintf(stderr, "Unable to set fragment size...\n"); + return -1; + } + + return fd; +} + +static int send_sound(int soundfd) +{ + /* Send FRAME_SIZE samples of whatever */ + short myframe[FRAME_SIZE]; + short *frame = NULL; + int total = FRAME_SIZE; + int amt=0; + int res; + int myoff; + audio_buf_info abi; + if (cursound > -1) { + res = ioctl(soundfd, SNDCTL_DSP_GETOSPACE ,&abi); + if (res) { + fprintf(stderr,"Unable to read output space\n"); + return -1; + } + /* Calculate how many samples we can send, max */ + if (total > (abi.fragments * abi.fragsize / 2)) + total = abi.fragments * abi.fragsize / 2; + res = total; + if (sampsent < sounds[cursound].samplen) { + myoff=0; + while(total) { + amt = total; + if (amt > (sounds[cursound].datalen - offset)) + amt = sounds[cursound].datalen - offset; + memcpy(myframe + myoff, sounds[cursound].data + offset, amt * 2); + total -= amt; + offset += amt; + sampsent += amt; + myoff += amt; + if (offset >= sounds[cursound].datalen) + offset = 0; + } + /* Set it up for silence */ + if (sampsent >= sounds[cursound].samplen) + silencelen = sounds[cursound].silencelen; + frame = myframe; + } else { + if (silencelen > 0) { + frame = silence; + silencelen -= res; + } else { + if (sounds[cursound].repeat) { + /* Start over */ + sampsent = 0; + offset = 0; + } else { + cursound = -1; + nosound = 0; + } + } + } +#if 0 + if (frame) + printf("res is %d, frame[0] is %d\n", res, frame[0]); +#endif + res = write(soundfd, frame, res * 2); + if (res > 0) + return 0; + return res; + } + return 0; +} + +static int iax_regtimeout(int timeout) +{ + if (timeout) { + gettimeofday(®time, NULL); + regtime.tv_sec += timeout; + } else { + regtime.tv_usec = 0; + regtime.tv_sec = 0; + } + return 0; +} + +static int check_iax_register(void) +{ + int res; + if (strlen(regpeer) && strlen(server)) { + registry = iax_session_new(); + + res = iax_register(registry, server,regpeer,regsecret, refresh); + + if (res) { + fprintf(stderr, "Failed registration: %s\n", iax_errstr); + return -1; + } + iax_regtimeout(5 * refresh / 6); + } else { + iax_regtimeout(0); + refresh = 60; + } + return 0; +} + +static int check_iax_timeout(void) +{ + struct timeval tv; + int ms; + if (!regtime.tv_usec || !regtime.tv_sec) + return -1; + gettimeofday(&tv, NULL); + if ((tv.tv_usec >= regtime.tv_usec) && (tv.tv_sec >= regtime.tv_sec)) { + check_iax_register(); + /* Have it check again soon */ + return 100; + } + ms = (regtime.tv_sec - tv.tv_sec) * 1000 + (regtime.tv_usec - tv.tv_usec) / 1000; + return ms; +} + +static int gentone(int sound, int uninterruptible) +{ + cursound = sound; + sampsent = 0; + offset = 0; + silencelen = 0; + nosound = uninterruptible; + printf("Sending tone %d\n", sound); + return 0; +} + +void +sighandler(int sig) +{ + if(sig == SIGHUP) { + puts("rehashing!"); + } else if(sig == SIGINT) { + static int prev = 0; + int cur; + + if ( (cur = time(0))-prev <= 5) { + printf("Terminating!\n"); + exit(0); + } else { + prev = cur; + printf("Press interrupt key again in the next %d seconds to really terminate\n", 5-(cur-prev)); + } + } +} + +void +parse_args(FILE *f, unsigned char *cmd) +{ + static char *argv[MAXARGS]; + unsigned char *parse = cmd; + int argc = 0, t = 0; + + // Don't mess with anything that doesn't exist... + if(!*parse) + return; + + bzero(argv, sizeof(argv)); + while(*parse) { + if(*parse < 33 || *parse > 128) { + *parse = 0, t++; + if(t > MAXARG) { + fprintf(f, "Warning: Argument exceeds maximum argument size, command ignored!\n"); + return; + } + } else if(t || !argc) { + if(argc == MAXARGS) { + fprintf(f, "Warning: Command ignored, too many arguments\n"); + return; + } + argv[argc++] = parse; + t = 0; + } + + parse++; + } + + if(argc) + parse_cmd(f, argc, argv); +} + +int +main(int argc, char *argv[]) +{ + int port; + int netfd; + int c, h=0, m, regm; + FILE *f; + int fd = STDIN_FILENO; + char rcmd[RBUFSIZE]; + fd_set readfd; + fd_set writefd; + struct timeval timer; + struct timeval *timerptr = NULL; + gsm_frame fo; + + load_options(); + + if (!strlen(callerid)) + gethostname(callerid, sizeof(callerid)); + + signal(SIGHUP, sighandler); + signal(SIGINT, sighandler); + + if ( !(f = fdopen(fd, "w+"))) { + fprintf(stderr, "Unable to create file on fd %d\n", fd); + return -1; + } + + if ( (audiofd = audio_setup(audiodev)) == -1) { + fprintf(stderr, "Fatal error: failed to open sound device"); + return -1; + } + + if ( (port = iax_init(0) < 0)) { + fprintf(stderr, "Fatal error: failed to initialize iax with port %d\n", port); + return -1; + } + + iax_set_formats(AST_FORMAT_GSM); + netfd = iax_get_fd(); + + check_iax_register(); + + fprintf(f, "Text Based Telephony Client.\n\n"); + issue_prompt(f); + + timer.tv_sec = 0; + timer.tv_usec = 0; + + while(1) { + FD_ZERO(&readfd); + FD_ZERO(&writefd); + FD_SET(fd, &readfd); + if(fd > h) + h = fd; + if(answered_call && !writeonly) { + FD_SET(audiofd, &readfd); + if(audiofd > h) + h = audiofd; + } + if (cursound > -1) { + FD_SET(audiofd, &writefd); + if (audiofd > h) + h = audiofd; + } + FD_SET(netfd, &readfd); + if(netfd > h) + h = netfd; + + if ( (c = select(h+1, &readfd, &writefd, 0, timerptr)) >= 0) { + if(FD_ISSET(fd, &readfd)) { + if ( ( fgets(&*rcmd, 256, f))) { + rcmd[strlen(rcmd)-1] = 0; + parse_args(f, &*rcmd); + } else fprintf(f, "Fatal error: failed to read data!\n"); + + issue_prompt(f); + } + if(answered_call) { + if(FD_ISSET(audiofd, &readfd)) { + static int ret, rlen = 0; + static short rbuf[FRAME_SIZE]; + + if ( (ret = read(audiofd, rbuf + rlen, 2 * (FRAME_SIZE-rlen))) == -1) { + puts("Failed to read audio."); + return -1; + } + rlen += ret/2; + if(rlen == FRAME_SIZE) { + rlen = 0; + + if(!most_recent_answer->gsmout) + most_recent_answer->gsmout = gsm_create(); + + gsm_encode(most_recent_answer->gsmout, rbuf, fo); + if(iax_send_voice(most_recent_answer->session, + AST_FORMAT_GSM, (char *)fo, sizeof(fo)) == -1) + puts("Failed to send voice!"); + } + } + } + do_iax_event(f); + m = iax_time_to_next_event(); + if(m > -1) { + timerptr = &timer; + timer.tv_sec = m /1000; + timer.tv_usec = (m % 1000) * 1000; + } else + timerptr = 0; + regm = check_iax_timeout(); + if (!timerptr || (m > regm)) { + timerptr = &timer; + timer.tv_sec = regm /1000; + timer.tv_usec = (regm % 1000) * 1000; + } + if (FD_ISSET(audiofd, &writefd)) { + send_sound(audiofd); + } + } else { + if(errno == EINTR) + continue; + fprintf(stderr, "Fatal error in select(): %s\n", strerror(errno)); + return -1; + } + } + return 0; +} + +void +do_iax_event(FILE *f) { + int sessions = 0; + struct iax_event *e = 0; + struct peer *peer; + + while ( (e = iax_get_event(0))) { + peer = find_peer(e->session); + if(peer) { + handle_event(f, e, peer); + } else if (e->session == registry) { + fprintf(stderr, "Registration complete: %s (%d)\n", + (e->event.regreply.status == IAX_REG_SUCCESS) ? "Success" : "Failed", + e->event.regreply.status); + registry = NULL; + } else { + if(e->etype != IAX_EVENT_CONNECT) { + fprintf(stderr, "Huh? This is an event for a non-existant session?\n"); + continue; + } + sessions++; + + if(sessions >= MAX_SESSIONS) { + fprintf(f, "Missed a call... too many sessions open.\n"); + } + + + if(e->event.connect.callerid && e->event.connect.dnid) + fprintf(f, "Call from '%s' for '%s'", e->event.connect.callerid, + e->event.connect.dnid); + else if(e->event.connect.dnid) { + fprintf(f, "Call from '%s'", e->event.connect.dnid); + } else if(e->event.connect.callerid) { + fprintf(f, "Call from '%s'", e->event.connect.callerid); + } else printf("Call from"); + fprintf(f, " (%s)\n", inet_ntoa(iax_get_peer_addr(e->session).sin_addr)); + + if(most_recent_answer) { + fprintf(f, "Incoming call ignored, there's already a call waiting for answer... \ +please accept or reject first\n"); + iax_reject(e->session, "Too many calls, we're busy!"); + } else { + if ( !(peer = malloc(sizeof(struct peer)))) { + fprintf(f, "Warning: Unable to allocate memory!\n"); + return; + } + + peer->time = time(0); + peer->session = e->session; + if (peer->gsmin) + free(peer->gsmin); + peer->gsmin = 0; + if (peer->gsmout) + free(peer->gsmout); + peer->gsmout = 0; + + peer->next = peers; + peers = peer; + + iax_accept(peer->session); + iax_ring_announce(peer->session); + most_recent_answer = peer; + ringing = 1; + gentone(TONE_RINGER, 0); + fprintf(f, "Incoming call!\n"); + } + issue_prompt(f); + } + iax_event_free(e); + } +} + +void +call(FILE *f, char *num) +{ + struct peer *peer; + + if(!newcall) + newcall = iax_session_new(); + else { + fprintf(f, "Already attempting to call somewhere, please cancel first!\n"); + return; + } + + if ( !(peer = malloc(sizeof(struct peer)))) { + fprintf(f, "Warning: Unable to allocate memory!\n"); + return; + } + + peer->time = time(0); + peer->session = newcall; + peer->gsmin = 0; + peer->gsmout = 0; + + peer->next = peers; + peers = peer; + + most_recent_answer = peer; + + offhook = 1; + + iax_call(peer->session, callerid, num, NULL, 10); +} + +void +answer_call(void) +{ + if(most_recent_answer) + iax_answer(most_recent_answer->session); + printf("Answering call!\n"); + answered_call = 1; + offhook = 1; + ringing = 0; + gentone(TONE_ANSWER, 1); +} + +void +reject_call(void) +{ + iax_reject(most_recent_answer->session, "Call rejected manually."); + most_recent_answer = 0; + ringing = 0; + gentone(TONE_NONE, 1); +} + +void +handle_event(FILE *f, struct iax_event *e, struct peer *p) +{ + short fr[FRAME_SIZE]; + int len; + + switch(e->etype) { + case IAX_EVENT_HANGUP: + iax_hangup(most_recent_answer->session, "Byeee!"); + fprintf(f, "Call disconnected by peer\n"); + free(most_recent_answer); + most_recent_answer = 0; + answered_call = 0; + peers = 0; + newcall = 0; + if (offhook) + gentone(TONE_CONGEST, 0); + break; + + case IAX_EVENT_REJECT: + fprintf(f, "Authentication was rejected\n"); + break; + case IAX_EVENT_ACCEPT: + fprintf(f, "Accepted...\n"); + issue_prompt(f); + break; + case IAX_EVENT_RINGA: + fprintf(f, "Ringing...\n"); + issue_prompt(f); + gentone(TONE_RINGTONE, 0); + break; + case IAX_EVENT_ANSWER: + answer_call(); + gentone(TONE_ANSWER, 1); + break; + case IAX_EVENT_VOICE: + switch(e->event.voice.format) { + case AST_FORMAT_GSM: + if(e->event.voice.datalen % 33) { + fprintf(stderr, "Weird gsm frame, not a multiple of 33.\n"); + break; + } + + if (!p->gsmin) + p->gsmin = gsm_create(); + + len = 0; + while(len < e->event.voice.datalen) { + if(gsm_decode(p->gsmin, e->event.voice.data + len, fr)) { + fprintf(stderr, "Bad GSM data\n"); + break; + } else { + int res; + + res = write(audiofd, fr, sizeof(fr)); + if (res < 0) + fprintf(f, "Write failed: %s\n", strerror(errno)); + } + len += 33; + } + break; + default : + fprintf(f, "Don't know how to handle that format %d\n", e->event.voice.format); + } + break; + default: + fprintf(f, "Unknown event: %d\n", e->etype); + } +} + +void +dump_call(void) +{ + if(most_recent_answer) + { + printf("Dumping call!\n"); + iax_hangup(most_recent_answer->session,""); + free(most_recent_answer); + } + answered_call = 0; + most_recent_answer = 0; + answered_call = 0; + peers = 0; + newcall = 0; + offhook = 0; + ringing = 0; + gentone(TONE_NONE, 0); +} + +void +parse_cmd(FILE *f, int argc, char **argv) +{ + if(!strcasecmp(argv[0], "HELP")) { + if(argc == 1) + dump_array(f, help); + else if(argc == 2) { + if(!strcasecmp(argv[1], "HELP")) + fprintf(f, "Help <Command>\t-\tDisplays general help or specific help on command if supplied an arguement\n"); + else if(!strcasecmp(argv[1], "QUIT")) + fprintf(f, "Quit\t\t-\tShuts down the miniphone\n"); + else fprintf(f, "No help available on %s\n", argv[1]); + } else { + fprintf(f, "Too many arguements for command help.\n"); + } + } else if(!strcasecmp(argv[0], "STATUS")) { + if(argc == 1) { + int c = 0; + struct peer *peerptr = peers; + + if(!peerptr) + fprintf(f, "No session matches found.\n"); + else while(peerptr) { + fprintf(f, "Listing sessions:\n\n"); + fprintf(f, "Session %d\n", ++c); + fprintf(f, "Session existed for %d seconds\n", (int)time(0)-peerptr->time); + if(answered_call) + fprintf(f, "Call answered.\n"); + else fprintf(f, "Call ringing.\n"); + + peerptr = peerptr->next; + } + } else fprintf(f, "Too many arguments for command status.\n"); + } else if(!strcasecmp(argv[0], "ANSWER")) { + if(argc > 1) + fprintf(f, "Too many arguements for command answer\n"); + else answer_call(); + } else if(!strcasecmp(argv[0], "REJECT")) { + if(argc > 1) + fprintf(f, "Too many arguements for command reject\n"); + else { + fprintf(f, "Rejecting current phone call.\n"); + reject_call(); + } + } else if (!strcasecmp(argv[0], "DUMP")) { + dump_call(); + } else if (!strcasecmp(argv[0], "HANGUP")) { + dump_call(); + } else if(!strcasecmp(argv[0], "CALL")) { + if(argc > 2) + fprintf(f, "Too many arguements for command call\n"); + else { + call(f, argv[1]); + } + } else if(!strcasecmp(argv[0], "QUIT")) { + if(argc > 1) + fprintf(f, "Too many arguements for command quit\n"); + else { + fprintf(f, "Good bye!\n"); + exit(1); + } + } else fprintf(f, "Unknown command of %s\n", argv[0]); +} + +void +issue_prompt(FILE *f) +{ + fprintf(f, "TeleClient> "); + fflush(f); +} + +void +dump_array(FILE *f, char **array) { + while(*array) + fprintf(f, "%s\n", *array++); +} diff --git a/libs/libiax2/src/miniphone.h b/libs/libiax2/src/miniphone.h new file mode 100644 index 0000000000000000000000000000000000000000..6e3677a3cf4d0e4719e447e5e984c5db2e924264 --- /dev/null +++ b/libs/libiax2/src/miniphone.h @@ -0,0 +1,6 @@ +#define RBUFSIZE 256 +#define MAXARGS 10 +#define MAXARG 256 +#define MAX_SESSIONS 4 + +extern void parse_cmd(FILE *, int, char **); diff --git a/libs/libiax2/src/options.c b/libs/libiax2/src/options.c new file mode 100644 index 0000000000000000000000000000000000000000..a01e3f88141fcdc2ed71e5c460d8b7da606368b3 --- /dev/null +++ b/libs/libiax2/src/options.c @@ -0,0 +1,137 @@ +/* + * Snomphone: IAX software for SNOM 100 Phone + * + * IAX Support for talking to Asterisk and other Gnophone clients + * + * Copyright (C) 1999, Linux Support Services, Inc. + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#define CONFIG_FILE "/etc/miniphone.conf" +#define USER_FILE "%s/.miniphone-conf" + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> + +char regpeer[256]; +char regsecret[256]; +char server[256]; +int refresh = 60; +char context[256]; +char language[256]; + +#define TYPE_STRING 0 +#define TYPE_INT 1 + +struct opt { + char *name; + void *where; + int len; + int type; +}; + +static struct opt opts[] = { + { "regpeer", regpeer, sizeof(regpeer), TYPE_STRING }, + { "regsecret", regsecret, sizeof(regsecret), TYPE_STRING }, + { "server", server, sizeof(server), TYPE_STRING }, + { "context", context, sizeof(context), TYPE_STRING }, + { "language", language, sizeof(language), TYPE_STRING }, + { "refresh", &refresh, sizeof(refresh), TYPE_INT }, +}; + +static int __load_options(char *filename) +{ + FILE *f; + int lineno = 0; + char buf[256]; + char *var, *value; + int x; + char *c; + f = fopen(filename, "r"); + if (!f) { + fprintf(stderr, "Failed to open '%s': %s\n", filename, strerror(errno)); + return -1; + } + while(!feof(f)) { + fgets(buf, sizeof(buf), f); + if (!feof(f)) { + /* Ditch comments */ + if ((c = strchr(buf, '#'))) + *c = 0; + lineno++; + /* Strip CR */ + buf[strlen(buf)-1] = '\0'; + if (strlen(buf)) { + var = strtok(buf, "="); + value = strtok(NULL, "="); + if (!var || !value) { + fprintf(stderr, "Syntax error line %d\n", lineno); + continue; + } + for (x=0;x<sizeof(opts) / sizeof(opts[0]); x++) { + if (!strcasecmp(var, opts[x].name)) { + switch(opts[x].type) { + case TYPE_STRING: + strncpy((char *)opts[x].where, value, opts[x].len); + break; + case TYPE_INT: + if (sscanf(value, "%i", (int *)opts[x].where) != 1) { + fprintf(stderr, "Not a number at line %d\n", lineno); + } + break; + default: + fprintf(stderr, "Don't know what to do about type %d\n", opts[x].type); + } + break; + } + } + if (!(x < sizeof(opts) / sizeof(opts[0]))) { + fprintf(stderr, "Dunno keyword '%s'\n", var); + continue; + } + } + } + } + fclose(f); + return 0; +} + +int load_options(void) +{ + char fn[256]; + __load_options(CONFIG_FILE); + if (getenv("HOME")) { + snprintf(fn, sizeof(fn), USER_FILE, getenv("HOME")); + __load_options(fn); + } + return 0; +} + +static int __save_options(char *filename) +{ + FILE *f; + f = fopen(filename, "w"); + if (!f) { + fprintf(stderr, "Failed to open '%s': %s\n", filename, strerror(errno)); + return -1; + } + fclose(f); + return 0; +} + +int save_options(void) +{ + char fn[256]; + if (getenv("HOME")) { + snprintf(fn, sizeof(fn), USER_FILE, getenv("HOME")); + return __save_options(fn); + } else + return __save_options(CONFIG_FILE); + +} diff --git a/libs/libiax2/src/options.h b/libs/libiax2/src/options.h new file mode 100644 index 0000000000000000000000000000000000000000..b9f791d479793524805b083bb8333dd9ee931a4e --- /dev/null +++ b/libs/libiax2/src/options.h @@ -0,0 +1,23 @@ +/* + * Snomphone: IAX software for SNOM 100 Phone + * + * IAX Support for talking to Asterisk and other Gnophone clients + * + * Copyright (C) 1999, Linux Support Services, Inc. + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +extern char regpeer[256]; +extern char regsecret[256]; +extern char regpeer[256]; +extern char server[256]; +extern int refresh; +extern char context[256]; +extern char language[256]; + +int save_options(void); +int load_options(void); diff --git a/libs/libiax2/src/ring10.h b/libs/libiax2/src/ring10.h new file mode 100644 index 0000000000000000000000000000000000000000..13fce373e7418f204f61893394f9e87ee0666141 --- /dev/null +++ b/libs/libiax2/src/ring10.h @@ -0,0 +1,1752 @@ +/* + * Signed 16-bit audio data + * + * Source: /home/markster/ring10.raw + * + * Copyright (C) 1999, Mark Spencer and Linux Support Services + * + * Distributed under the terms of the GNU General Public License + * + */ + +static signed short ring10[] = { +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 0x82a0, 0x8dc7, 0x607e, 0xc0c6, 0x2bd3, +0x8df5, 0x828d, 0x0716, 0xaca6, 0xcefe, 0x41df, 0xd185, 0x8aa3, 0x8b1a, 0x789b, +0x82a2, 0x804f, 0x7ea8, 0x8113, 0x7f7d, 0x7fff, 0x801e, 0x801d, 0x7f32, 0x82ec, +0x83e1, 0x7fb0, 0x7f71, 0x80de, 0x7f3d, 0x7fe3, 0x81b4, 0x7c37, 0x8553, 0x7b29, +0x7ede, 0xde6e, 0x0e64, 0xf9f4, 0x015e, 0x00f6, 0xfe56, 0x0019, 0xf8bb, 0xfd90, +0x08cc, 0x05ab, 0xfd0b, 0xf9c6, 0xf875, 0xf789, 0xfc74, 0x032e, 0xf97a, 0xf4bb, +0x0212, 0x006e, 0x03df, 0x17c5, 0x0f50, 0xfb23, 0xfdbd, 0xf7cf, 0xdf5b, 0xe2d3, +0xf111, 0xef27, 0x11c5, 0x33a4, 0x168d, 0x0145, 0x0494, 0xe85c, 0xdac3, 0xf0c7, +0xeea8, 0x0023, 0x3036, 0x252a, 0xffb7, 0x01d1, 0xf637, 0xd506, 0xe8eb, 0xf5ff, +0xe5ca, 0x1ec5, 0x3fa4, 0x0e3c, 0x1570, 0x2b37, 0xea23, 0xca43, 0xf392, 0xdf0e, +0xde40, 0x2e7c, 0x276f, 0x035c, 0x2ccc, 0x1acf, 0xcf4a, 0xeb5b, 0x0fb1, 0xe01a, +0x0c69, 0x3a97, 0xfb54, 0x0751, 0x20f1, 0xdce9, 0xd2a2, 0x19b3, 0x096f, 0xf1b6, +0x38de, 0x1f70, 0xf32b, 0x2569, 0x0650, 0xc3d7, 0xf1ad, 0x1aa5, 0xe87e, 0x0c7f, +0x406d, 0xffaa, 0x0ba8, 0x2e02, 0xe545, 0xcebb, 0x10fc, 0x0102, 0xded8, 0x2b7c, +0x2053, 0xec6f, 0x266e, 0x1770, 0xcb63, 0xf18e, 0x2015, 0xe6ef, 0xfe64, 0x3700, +0xf628, 0xfb00, 0x2e43, 0xee48, 0xcd4a, 0x1867, 0x0ec3, 0xdd77, 0x2291, 0x1c80, +0xe325, 0x19b7, 0x1719, 0xcb88, 0xeded, 0x258c, 0xe7e8, 0xf0c6, 0x2d21, 0xf3d5, +0xf494, 0x290d, 0xef7b, 0xca28, 0x12c8, 0x0d8d, 0xd5f3, 0x171d, 0x1994, 0xe0c0, +0x1348, 0x1929, 0xcf9b, 0xe6fb, 0x20ae, 0xe921, 0xed2b, 0x2c54, 0xf96e, 0xf19f, +0x21b6, 0xf12e, 0xc8b4, 0x0907, 0x0964, 0xd049, 0x0eb8, 0x1fa6, 0xe6b5, 0x0cec, +0x16b6, 0xcd0c, 0xda57, 0x17c9, 0xe440, 0xe2a2, 0x2b4d, 0xffa2, 0xec7e, 0x1ee9, +0xf674, 0xbfcb, 0xf769, 0x0402, 0xcfe8, 0x104b, 0x2734, 0xe7e9, 0x07d9, 0x19f4, +0xd032, 0xd00b, 0x0e46, 0xe17d, 0xe2d8, 0x3456, 0x0781, 0xed01, 0x238d, 0xfa72, +0xbb51, 0xf543, 0x050b, 0xccd5, 0x1491, 0x3358, 0xedad, 0x10c4, 0x283b, 0xd051, +0xc9e9, 0x11f8, 0xe2cb, 0xe534, 0x43aa, 0x1090, 0xf11b, 0x3267, 0x02c3, 0xb72d, +0xf9ac, 0x0fbd, 0xce45, 0x1d7b, 0x4389, 0xef2e, 0x1593, 0x348e, 0xd0cb, 0xca8c, +0x1f61, 0xe981, 0xdef7, 0x4774, 0x15ae, 0xefab, 0x3b28, 0x0a9e, 0xb2f6, 0xf9e9, +0x1976, 0xcc08, 0x15ab, 0x4534, 0xee6c, 0x159b, 0x3753, 0xcf09, 0xc69a, 0x2270, +0xf15c, 0xdee6, 0x48ce, 0x1af4, 0xf169, 0x3da0, 0x0d68, 0xb573, 0xff9e, 0x20ba, +0xcbfe, 0x142d, 0x4879, 0xed49, 0x1434, 0x3d96, 0xd714, 0xca99, 0x298b, 0xf708, +0xd92c, 0x4632, 0x1acc, 0xea6e, 0x3d2c, 0x1412, 0xb534, 0xfbfa, 0x24f9, 0xcd72, +0x0df9, 0x48f8, 0xeb87, 0x0bca, 0x3dd5, 0xd6cc, 0xc015, 0x2605, 0xfa87, 0xd1a9, +0x40d0, 0x1c59, 0xe0de, 0x34f9, 0x14c6, 0xaf61, 0xf2a5, 0x23e6, 0xc929, 0x01be, +0x4423, 0xe53b, 0x0182, 0x3c3a, 0xd758, 0xbb9d, 0x1fa9, 0xf454, 0xc611, 0x36e8, +0x18f7, 0xdac9, 0x2e8a, 0x126d, 0xac14, 0xead6, 0x2215, 0xc990, 0xf9f5, 0x43cb, +0xea01, 0xfcbf, 0x38fd, 0xd9f3, 0xb7cd, 0x1bc4, 0xfd41, 0xca56, 0x31e3, 0x1d4b, +0xdca2, 0x2a9f, 0x1c24, 0xb8aa, 0xeb59, 0x25d5, 0xd2d0, 0xfa10, 0x44fa, 0xefe0, +0xfced, 0x3ef4, 0xe9a1, 0xbdf0, 0x19ac, 0x0198, 0xca6f, 0x2f04, 0x25b6, 0xe187, +0x29ba, 0x250a, 0xbe42, 0xe40e, 0x24ef, 0xd75d, 0xf476, 0x44f8, 0xf719, 0xf7a1, +0x3c94, 0xf20e, 0xbcdf, 0x16a3, 0x07e8, 0xc8d4, 0x2a3e, 0x2b3f, 0xdf4e, 0x235d, +0x2c92, 0xc2c7, 0xdf39, 0x2873, 0xd790, 0xea2a, 0x47fd, 0xfd0e, 0xf0e3, 0x3bd8, +0xf4e9, 0xb265, 0x0c2c, 0x0751, 0xc302, 0x29bb, 0x37bd, 0xe138, 0x1e0c, 0x2d09, +0xbddb, 0xd246, 0x24c4, 0xd87a, 0xe5df, 0x4ff6, 0x08d6, 0xf0d8, 0x3d61, 0xf8bf, +0xaede, 0x0a36, 0x0df3, 0xc0f5, 0x23ec, 0x3e92, 0xe3d7, 0x1cad, 0x348e, 0xc0d6, +0xcd4e, 0x265c, 0xd9b6, 0xdf83, 0x510e, 0x0c41, 0xeece, 0x4153, 0xfeeb, 0xa9f6, +0x04b3, 0x12a4, 0xbf2f, 0x20d1, 0x42f4, 0xe1b1, 0x1b1e, 0x3980, 0xc2b4, 0xcb50, +0x2b74, 0xded0, 0xd835, 0x4e7a, 0x0b46, 0xe555, 0x4015, 0x0517, 0xaa54, 0x0504, +0x1932, 0xbc34, 0x1a77, 0x48b1, 0xe0bb, 0x149b, 0x3ba7, 0xc34a, 0xc481, 0x2bc2, +0xe401, 0xd20e, 0x4f53, 0x1389, 0xe3b7, 0x418b, 0x0a15, 0xa70d, 0x0024, 0x1f9f, +0xbf65, 0x142d, 0x4a81, 0xe0ca, 0x1152, 0x4325, 0xcb03, 0xc18a, 0x2b95, 0xeb45, +0xcf92, 0x4c54, 0x18ad, 0xe08b, 0x3f12, 0x1264, 0xa9fc, 0xfd97, 0x246f, 0xbf86, +0x0ce2, 0x4e7c, 0xe4f3, 0x0c20, 0x44e0, 0xd069, 0xbdcb, 0x2b8e, 0xf32d, 0xcad4, +0x464f, 0x1e76, 0xdf62, 0x3b07, 0x17ea, 0xaafb, 0xf5a0, 0x2835, 0xc7c2, 0x0842, +0x4d2b, 0xe634, 0x03ef, 0x42bc, 0xd7f2, 0xbb73, 0x2662, 0xf892, 0xc8b3, 0x3e30, +0x1f20, 0xdcca, 0x354a, 0x1c6b, 0xaf75, 0xf0f7, 0x2963, 0xc908, 0xfdbf, 0x4c3c, +0xebe5, 0x00e3, 0x44c4, 0xdf15, 0xb9e9, 0x243b, 0x00e9, 0xcb76, 0x3b53, 0x248e, +0xdc27, 0x2fcb, 0x22e5, 0xb66c, 0xec96, 0x2b19, 0xd0ef, 0xf97b, 0x48ae, 0xecc0, +0xf8b4, 0x411d, 0xe769, 0xb9f7, 0x1c41, 0x0022, 0xc369, 0x2ced, 0x23ac, 0xd8eb, +0x2522, 0x232a, 0xb611, 0xe19f, 0x2738, 0xd013, 0xece5, 0x434c, 0xf00e, 0xefcc, +0x3b79, 0xeb32, 0xb19c, 0x135e, 0x04ef, 0xc1b9, 0x27a8, 0x2992, 0xd7b3, 0x1ba5, +0x2481, 0xb8c5, 0xd97d, 0x246f, 0xd113, 0xe45d, 0x4486, 0xf7f7, 0xeb36, 0x395a, +0xf122, 0xaea5, 0x0c28, 0x05eb, 0xbde4, 0x2585, 0x36a2, 0xde67, 0x1b86, 0x2dac, +0xbd03, 0xd2b8, 0x2624, 0xd8b8, 0xe802, 0x521b, 0x0855, 0xefbc, 0x4048, 0xfad2, +0xafe2, 0x0fb1, 0x12b2, 0xc62c, 0x2c2a, 0x43f5, 0xe562, 0x1fcb, 0x3791, 0xc2ac, +0xd4d1, 0x2dfd, 0xde0a, 0xe53f, 0x5578, 0x0f49, 0xf2b6, 0x4609, 0x0105, 0xabf5, +0x09a8, 0x157e, 0xc286, 0x23e7, 0x425f, 0xe36a, 0x1d93, 0x3580, 0xbf80, 0xcaf2, +0x2a04, 0xf16e, 0xd92b, 0x0eaa, 0xf1a7, 0x1ddb, 0x5b52, 0x0665, 0xd2e3, 0x15f8, +0xf606, 0x9d42, 0xdba7, 0xf312, 0xd349, 0x21ed, 0x576a, 0x34e8, 0x2450, 0x2679, +0xdc01, 0xb506, 0xcb0f, 0xa454, 0xccf3, 0x2c13, 0x1673, 0xf8ca, 0x4ff1, 0x63ac, +0xec26, 0xd77c, 0xf1f9, 0xc268, 0xb11a, 0xdfe4, 0x02e7, 0x10f5, 0x3512, 0x19dd, +0x0edc, 0x3568, 0xf6f7, 0xbe10, 0xda93, 0xf4fe, 0xda03, 0xe293, 0x15dd, 0x15f3, +0x1ba5, 0x1521, 0x12e8, 0x23ab, 0x0fc3, 0xdb3e, 0xb671, 0xe960, 0xe13c, 0xc695, +0x1a81, 0x3d23, 0x1c56, 0x190d, 0x4234, 0x1970, 0xd784, 0xd86b, 0xb5e8, 0xc9f3, +0xeb89, 0xe344, 0x17ae, 0x5713, 0x37fc, 0xffe2, 0x36b3, 0x1dfe, 0xb963, 0xbf9c, +0xc9a1, 0xcc7b, 0xe409, 0x08a6, 0x2077, 0x3b4d, 0x3cba, 0x0553, 0x220e, 0x226e, +0xd219, 0xb7ec, 0xcb8b, 0xdf2a, 0xd0c7, 0xf5be, 0x2ff0, 0x42a6, 0x3c24, 0x25ae, +0x2d6d, 0x0d94, 0xde80, 0xb78b, 0xb12b, 0xdf7a, 0xde33, 0x0046, 0x47b1, 0x5170, +0x29c0, 0x2945, 0x3ab5, 0xf08f, 0xc806, 0xc229, 0xbbf4, 0xe40d, 0xf365, 0x0bfe, +0x448d, 0x5cd8, 0x1e52, 0x10ba, 0x3908, 0xefa4, 0xc243, 0xcf89, 0xd02d, 0xde92, +0xf8e0, 0x191e, 0x2f7b, 0x48e6, 0x1e38, 0x1074, 0x3785, 0xf8be, 0xbd1c, 0xc06b, +0xdc36, 0xdb97, 0xe3c0, 0x2042, 0x37c5, 0x36ff, 0x1b73, 0x2064, 0x2c9a, 0xefa2, +0xbf0c, 0xb7f0, 0xe221, 0xe243, 0xd998, 0x2263, 0x4bae, 0x3596, 0x18aa, 0x3763, +0x27d0, 0xdcc6, 0xcacc, 0xc06f, 0xd83d, 0xecfe, 0xeefa, 0x1ffa, 0x5052, 0x393f, +0x0af5, 0x3c9e, 0x316b, 0xd2df, 0xc575, 0xd3c8, 0xddd2, 0xdf98, 0xfbd7, 0x2929, +0x4879, 0x4052, 0x160c, 0x3708, 0x2b31, 0xdac6, 0xc0c3, 0xcfc0, 0xe71d, 0xddec, +0x0145, 0x3847, 0x457c, 0x356b, 0x214a, 0x3a5f, 0x1474, 0xd892, 0xc579, 0xc6a7, +0xe77a, 0xe4dc, 0x00ab, 0x3b89, 0x4eba, 0x290a, 0x16ea, 0x3dc6, 0x0956, 0xcc12, +0xc3bd, 0xc9e9, 0xe4be, 0xe60b, 0x0561, 0x3707, 0x4c82, 0x2444, 0x1406, 0x3a8e, +0xff5b, 0xc494, 0xbf9f, 0xcb26, 0xdfef, 0xe755, 0x1060, 0x334f, 0x40e5, 0x1f87, +0x16b9, 0x33e8, 0xfa6e, 0xc670, 0xb774, 0xcc17, 0xe18f, 0xdd0f, 0x102c, 0x3f0d, +0x4098, 0x1b95, 0x24b2, 0x315a, 0xe9d8, 0xc459, 0xb314, 0xc524, 0xe2a6, 0xe1cf, +0x100a, 0x44af, 0x455c, 0x1551, 0x264f, 0x2ab1, 0xd681, 0xb90c, 0xb4d6, 0xc68d, +0xddac, 0xef74, 0x1f57, 0x4357, 0x4192, 0x0e60, 0x1bcb, 0x20fd, 0xd477, 0xb435, +0xb3e3, 0xcdc3, 0xd9c4, 0xef97, 0x2384, 0x3b60, 0x34c9, 0x119d, 0x1f15, 0x0fb3, +0xd15d, 0xb30d, 0xa9e3, 0xd431, 0xdc02, 0xe98a, 0x2987, 0x4204, 0x290c, 0x1181, +0x2d0c, 0x0800, 0xcb55, 0xb8f5, 0xaaa6, 0xd49f, 0xe57c, 0xf063, 0x281c, 0x4c65, +0x2d19, 0x0cd2, 0x2ddb, 0xfefe, 0xc171, 0xbd4c, 0xb7c2, 0xd4c5, 0xe6f3, 0x0040, +0x2b86, 0x4b6d, 0x2ed1, 0x0ce3, 0x2d97, 0x01f9, 0xc2ad, 0xb8fc, 0xc53e, 0xe1cf, +0xea35, 0x0eb0, 0x38b8, 0x4a3b, 0x2a1e, 0x1457, 0x2a1e, 0xfbca, 0xcdf1, 0xbc93, +0xcc0b, 0xec27, 0xeb05, 0x144b, 0x4443, 0x496d, 0x2233, 0x2180, 0x30b2, 0xf03c, +0xcced, 0xbf0d, 0xcc55, 0xeec3, 0xf367, 0x186f, 0x45cd, 0x4e7d, 0x215a, 0x2485, +0x3122, 0xe7a8, 0xc40a, 0xbf85, 0xd4dd, 0xebe8, 0xf32b, 0x2121, 0x49bb, 0x4c61, +0x1af5, 0x1f88, 0x2c32, 0xe8c5, 0xc512, 0xc0b7, 0xdbf9, 0xe9ea, 0xf2f4, 0x2584, +0x43e2, 0x3e1b, 0x19cf, 0x28d2, 0x2442, 0xe27b, 0xc589, 0xbe8a, 0xdddc, 0xe567, +0xed4e, 0x27f2, 0x48cd, 0x3505, 0x0e88, 0x2cd5, 0x207d, 0xda54, 0xc1cf, 0xb8c1, +0xd925, 0xe569, 0xefd0, 0x2723, 0x4dd1, 0x38b2, 0x0de5, 0x2d90, 0x155b, 0xca06, +0xbab6, 0xbf37, 0xdd46, 0xe3fd, 0xfb50, 0x2e5d, 0x487b, 0x343e, 0x0abe, 0x25e9, +0x0f65, 0xcb83, 0xb474, 0xbc50, 0xe2ab, 0xe1df, 0xfd3e, 0x3672, 0x458b, 0x294e, +0x10fd, 0x2afa, 0x027f, 0xcae8, 0xb95b, 0xbc6f, 0xe536, 0xe3af, 0xfd1c, 0x3b18, +0x4cb1, 0x23ff, 0x13eb, 0x3353, 0xfb34, 0xc4aa, 0xb71a, 0xb9f2, 0xe1d7, 0xe97f, +0x058d, 0x3a0f, 0x4fcd, 0x2408, 0x11a3, 0x2fb9, 0xf271, 0xbb7f, 0xb447, 0xc317, +0xde44, 0xe56a, 0x110a, 0x3ccc, 0x494a, 0x1f80, 0x11af, 0x26a1, 0xeb09, 0xbcd0, +0xaf90, 0xc8d4, 0xe63f, 0xe47d, 0x1435, 0x3f4f, 0x3fbe, 0x17c7, 0x1a4f, 0x2393, +0xe191, 0xbfa1, 0xb0e4, 0xc7c9, 0xe2d9, 0xe363, 0x1625, 0x4320, 0x3da9, 0x11c4, +0x1e02, 0x1d1b, 0xd6be, 0xbe96, 0xb123, 0xc8a4, 0xe6ce, 0xef2e, 0x1c03, 0x4584, +0x3fd1, 0x1006, 0x20d8, 0x197b, 0xcf64, 0xb99e, 0xb693, 0xd396, 0xe8eb, 0xfb01, +0x2aca, 0x4b38, 0x3f87, 0x0de0, 0x1f2f, 0x1503, 0xd574, 0xba46, 0xb72d, 0xf07a, +0xfa16, 0xf608, 0x29c0, 0x3a7e, 0x42a7, 0x43ac, 0x2717, 0xec6f, 0xd732, 0xc1ac, +0xa146, 0xef37, 0x122b, 0x05c1, 0x5c67, 0x8e8c, 0x3d5e, 0x0043, 0x00d0, 0xb9ef, +0xa38d, 0xc8dd, 0xc921, 0x15c9, 0x5fe3, 0x531a, 0x477d, 0x5852, 0x1b9f, 0xb930, +0xd1b6, 0xde60, 0xbcce, 0xe7f7, 0x16b1, 0x2aeb, 0x4605, 0x3592, 0xfe8c, 0x0c1d, +0x1b24, 0xd084, 0xd667, 0x2736, 0x06f7, 0xdfa7, 0x1976, 0x0df9, 0xc5e8, 0x032b, +0x324e, 0xea0e, 0x1ab4, 0x46e4, 0xf72e, 0x0369, 0x0ef3, 0xbe35, 0xbd17, 0x10fd, +0xfb35, 0xeb3f, 0x4e43, 0x2da4, 0xfe31, 0x2f50, 0xf64c, 0xafd6, 0xe267, 0xfd01, +0xca77, 0x1087, 0x48c1, 0xfcf4, 0x1bb0, 0x31af, 0xd234, 0xc0cb, 0x054e, 0xec6b, +0xce29, 0x29db, 0x1bb4, 0xf0fd, 0x3608, 0x12eb, 0xbb40, 0xeaa8, 0x190f, 0xce00, +0xed59, 0x39ef, 0xf1f0, 0xfb2a, 0x3535, 0xe3b3, 0xbf33, 0x1a9b, 0x013b, 0xc2ab, +0x2976, 0x21e0, 0xd3d8, 0x1ca6, 0x14ae, 0xb242, 0xe538, 0x2958, 0xd98c, 0xf279, +0x4106, 0xf13e, 0xf68b, 0x3379, 0xe023, 0xb4a8, 0x104b, 0x0685, 0xcca4, 0x2e61, +0x2d96, 0xe2b8, 0x26ac, 0x2510, 0xc114, 0xd9e5, 0x1f91, 0xdbc9, 0xe515, 0x40bd, +0x0693, 0xff44, 0x3c5e, 0xf664, 0xb8dc, 0x0b37, 0x1314, 0xc29c, 0x161f, 0x3582, +0xe32e, 0x17c0, 0x2de6, 0xc7c1, 0xcfeb, 0x23a6, 0xe644, 0xe65f, 0x4256, 0xf765, +0xe698, 0x4148, 0xfbe1, 0xa6b4, 0x03fa, 0x1c92, 0xcb85, 0x1a54, 0x37af, 0xe830, +0x1b0b, 0x255d, 0xc13f, 0xd3d9, 0x205e, 0xde69, 0xe2ab, 0x48d5, 0x0931, 0xee2f, +0x3d79, 0x0658, 0xb36c, 0xf59e, 0x11f4, 0xd042, 0x110b, 0x2e1b, 0xe763, 0x2269, +0x3bda, 0xcefb, 0xd37b, 0x2d7f, 0xe9d7, 0xd48e, 0x3fd2, 0x0e86, 0xea62, 0x3cd5, +0x11e0, 0xc1dc, 0x08e0, 0x1f68, 0xd3f1, 0x1fc8, 0x3da6, 0xe12f, 0x1d62, 0x4060, +0xccb6, 0xd211, 0x316f, 0xf370, 0xe20e, 0x4657, 0x1280, 0xf30a, 0x3df0, 0x07fc, +0xb956, 0x023e, 0x1978, 0xcbba, 0x137d, 0x3ff7, 0xecbc, 0x1698, 0x3f29, 0xdf9f, +0xcc1c, 0x1bdc, 0xef17, 0xd3da, 0x346b, 0x1296, 0xeb25, 0x3885, 0x190f, 0xbf13, +0xfb71, 0x1df2, 0xc509, 0xffa2, 0x3a66, 0xe5fd, 0x04f6, 0x36be, 0xda99, 0xc67e, +0x1fc2, 0xef95, 0xcfa8, 0x39df, 0x0f1a, 0xd986, 0x2d7b, 0x0e88, 0xb2a2, 0xf40f, +0x1bd3, 0xc95c, 0x0511, 0x408d, 0xec48, 0x03d2, 0x3281, 0xd7a0, 0xb9a0, 0x13ab, +0xf02d, 0xc92c, 0x3af6, 0x26c0, 0xe5f8, 0x2de7, 0x18b9, 0xafd8, 0xddbf, 0x15bc, +0xc4d3, 0xf6dc, 0x4b73, 0xf89f, 0x018a, 0x3c4e, 0xdf11, 0xb20d, 0x12d7, 0xf511, +0xbf7e, 0x33aa, 0x286f, 0xe309, 0x3107, 0x1f74, 0xb1c3, 0xe10f, 0x1fd3, 0xc7d4, +0xef6e, 0x4b78, 0xf32f, 0xf8e5, 0x43cb, 0xe7da, 0xaf46, 0x115a, 0xfeb2, 0xbf7a, +0x2e9a, 0x2ed7, 0xde2f, 0x2807, 0x259c, 0xb09f, 0xd3d4, 0x2606, 0xd544, 0xeb3d, +0x5107, 0xfecf, 0xf63f, 0x4304, 0xedfe, 0xae0d, 0x0d7f, 0x0957, 0xc47d, 0x2f62, +0x3b51, 0xdfea, 0x2a01, 0x3390, 0xb825, 0xd3e9, 0x29f1, 0xd82e, 0xe2e3, 0x509a, +0x061c, 0xf530, 0x48b1, 0xf740, 0xabeb, 0x0d93, 0x0ed4, 0xbed0, 0x274e, 0x3e3b, +0xddc2, 0x2168, 0x35a1, 0xbbb0, 0xcedb, 0x2b94, 0xdd5b, 0xdd2d, 0x4e6a, 0x068d, +0xe741, 0x3eef, 0xfe34, 0xad12, 0x0bb7, 0x1a73, 0xbea5, 0x1c31, 0x4269, 0xdc1a, +0x1611, 0x37d6, 0xc048, 0xcaa3, 0x2f7e, 0xe59c, 0xd94c, 0x4ed8, 0x0af6, 0xe225, +0x3c84, 0xfd49, 0xa4b2, 0x048d, 0x1ed5, 0xc496, 0x1caa, 0x4641, 0xddd4, 0x1578, +0x37dc, 0xc13b, 0xcab7, 0x30dc, 0xfec0, 0xd462, 0x1387, 0x07dd, 0x14c1, 0x4b92, +0x0d74, 0xda49, 0x12de, 0x02fe, 0xb8fe, 0xeaae, 0x0363, 0xdab0, 0x23b0, 0x68fb, +0x3681, 0x1351, 0x29fc, 0xf22e, 0xb781, 0xd225, 0xc11d, 0xd7d8, 0x354d, 0x26b8, +0x09af, 0x60fa, 0x5f8c, 0xe302, 0xde80, 0xff6a, 0xbb95, 0xafec, 0x029f, 0x161d, +0x0fee, 0x3924, 0x2b6c, 0x1ed5, 0x24fe, 0xec7b, 0xc1fe, 0xe22b, 0xfbcd, 0xdc4d, +0xf3f7, 0x210f, 0x1d01, 0x1305, 0x1342, 0x1f6c, 0x0852, 0xfea5, 0xdd42, 0xc083, +0xf243, 0xde95, 0xd818, 0x23f7, 0x3eab, 0x0891, 0x1381, 0x52fd, 0xff10, 0xc983, +0xe091, 0xc3b8, 0xcafc, 0xe7d7, 0xfc8d, 0x2043, 0x559d, 0x2c2e, 0x0418, 0x4485, +0x0b4c, 0xb4e5, 0xc68e, 0xddbf, 0xd0b6, 0xdc81, 0x1e4b, 0x2d10, 0x365b, 0x2c50, +0x170a, 0x303e, 0x0a60, 0xcc89, 0xb88a, 0xdbc7, 0xe3e7, 0xcdd2, 0x0b38, 0x3c7e, +0x392b, 0x254c, 0x3272, 0x2fc9, 0xf0ee, 0xd4d8, 0xb5b4, 0xc03b, 0xdef0, 0xd8e9, +0x0edc, 0x533e, 0x46e4, 0x0fc4, 0x358a, 0x34b8, 0xd1c3, 0xbf29, 0xbb64, 0xbeea, +0xdb1c, 0xf31b, 0x17f1, 0x44fa, 0x4bfb, 0x0a36, 0x1fe2, 0x2ce9, 0xcf0d, 0xb605, +0xc6c6, 0xcc96, 0xcf30, 0xf9cd, 0x25fb, 0x36d1, 0x4086, 0x1499, 0x21d8, 0x287f, +0xde77, 0xb0fd, 0xba6d, 0xe0f5, 0xd3e4, 0xee77, 0x3561, 0x4077, 0x2baa, 0x1d38, +0x3753, 0x1587, 0xd2e2, 0xb252, 0xb44b, 0xe5a7, 0xdbb5, 0xe778, 0x3790, 0x55cb, +0x234e, 0x10ab, 0x42e9, 0x083e, 0xc15a, 0xc2a9, 0xbe30, 0xd7d1, 0xe76a, 0xfa22, +0x2b37, 0x53cb, 0x29a6, 0x0950, 0x4086, 0x0f68, 0xbba0, 0xb824, 0xcc9c, 0xd743, +0xd665, 0x06ae, 0x3597, 0x44f1, 0x2854, 0x19d4, 0x3395, 0xfe8f, 0xc1b9, 0xad2d, +0xc39d, 0xde05, 0xd850, 0x0bf2, 0x4266, 0x457f, 0x1d4b, 0x2284, 0x337f, 0xe442, +0xbc43, 0xb8ba, 0xc33a, 0xe0e4, 0xe8f8, 0x10b5, 0x4262, 0x4afc, 0x1744, 0x1d2b, +0x3125, 0xe2b5, 0xbcb6, 0xbdea, 0xccfd, 0xdfe5, 0xefed, 0x1bae, 0x3f5e, 0x451d, +0x167c, 0x1ea7, 0x2848, 0xdf70, 0xbb35, 0xbbfc, 0xd959, 0xe266, 0xec2b, 0x20e3, +0x435c, 0x3878, 0x0fee, 0x25e8, 0x1ba1, 0xdaf0, 0xc061, 0xb76f, 0xdd9c, 0xe727, +0xece4, 0x247e, 0x48ee, 0x303d, 0x099a, 0x320b, 0x19b9, 0xd0b8, 0xc508, 0xbe20, +0xd52c, 0xe430, 0xf5f1, 0x21d1, 0x4aae, 0x3670, 0x0bc4, 0x349a, 0x16c6, 0xc9e1, +0xbb8f, 0xc44e, 0xdbed, 0xde26, 0x03b2, 0x34c9, 0x4689, 0x30a8, 0x17ea, 0x33bd, +0x0b87, 0xcd79, 0xb9b9, 0xc3c1, 0xe227, 0xdffc, 0x07ae, 0x3deb, 0x4732, 0x25e8, +0x1ef9, 0x370f, 0xfb29, 0xcc78, 0xbf32, 0xc5c0, 0xe807, 0xe571, 0x074b, 0x4121, +0x4902, 0x1968, 0x206c, 0x3da5, 0xf467, 0xc9c7, 0xc240, 0xc6d8, 0xe2b1, 0xeca9, +0x0f7d, 0x3a80, 0x4ac1, 0x1bda, 0x1cdc, 0x3836, 0xee35, 0xc32e, 0xc0a2, 0xce3e, +0xdfd7, 0xe9c8, 0x162c, 0x3eb5, 0x48b0, 0x1a61, 0x1e8f, 0x2cf5, 0xe5c6, 0xbb80, +0xb378, 0xd228, 0xe3dd, 0xeba5, 0x2266, 0x46f5, 0x3e1f, 0x13fa, 0x26ea, 0x21ec, +0xd925, 0xbdc7, 0xb66d, 0xd76b, 0xe81e, 0xf025, 0x269d, 0x4d69, 0x3d40, 0x1027, +0x2c58, 0x1cc9, 0xd265, 0xbfd4, 0xbabe, 0xd919, 0xe822, 0xf931, 0x2bc9, 0x4c69, +0x3d20, 0x158d, 0x31ca, 0x1821, 0xce8a, 0xb8af, 0xba0f, 0xdfb6, 0xe677, 0xfd3b, +0x385e, 0x53d9, 0x3764, 0x14a8, 0x30af, 0x0a51, 0xcb95, 0xbad7, 0xbc48, 0xe366, +0xea7e, 0x06cf, 0x3f08, 0x53c7, 0x2fe0, 0x189d, 0x383f, 0x00fd, 0xc5f3, 0xbf0d, +0xc38f, 0xe4a3, 0xecee, 0x0ef5, 0x432c, 0x54a7, 0x2a15, 0x190d, 0x3675, 0xf7bc, +0xc3e0, 0xbc22, 0xc381, 0xe210, 0xec59, 0x15ed, 0x4300, 0x4fd8, 0x269c, 0x1bda, +0x324a, 0xed57, 0xbb9c, 0xb705, 0xceb8, 0xeb30, 0xed72, 0x1baa, 0x48ad, 0x4bd3, +0x1fde, 0x1ea9, 0x2826, 0xe505, 0xc2b3, 0xb577, 0xceec, 0xeeb9, 0xef73, 0x1fd5, +0x4c99, 0x41f7, 0x12c7, 0x24ad, 0x22eb, 0xd504, 0xbfe3, 0xba2a, 0xd063, 0xea6f, +0xf037, 0x1c9c, 0x4acf, 0x430c, 0x0b68, 0x200d, 0x1c9e, 0xcce4, 0xb9ad, 0xbc29, +0xd211, 0xe475, 0xfc21, 0x2910, 0x443b, 0x3a83, 0x0ef1, 0x2295, 0x15ac, 0xd00d, +0xb774, 0xbaff, 0xded3, 0xe41e, 0xf945, 0x331e, 0x49b7, 0x3276, 0x128d, 0x28c7, +0x08f2, 0xce8e, 0xbb2e, 0xb907, 0xe4c0, 0xe9f8, 0xf98a, 0x3323, 0x4a75, 0x2718, +0x0ddc, 0x3369, 0x0795, 0xc936, 0xc192, 0xc3cc, 0xe2b9, 0xe583, 0xfce9, 0x312f, +0x4951, 0x266f, 0x0ffe, 0x3698, 0x0679, 0xca63, 0xc301, 0xc844, 0xde4c, 0xe26e, +0x076e, 0x3283, 0x4507, 0x259a, 0x11af, 0x30ff, 0xfd1c, 0xc1b2, 0xb384, 0xc924, +0xe414, 0xde8f, 0x0781, 0x295f, 0x51b4, 0x5b09, 0x17c9, 0xf17b, 0xd9cd, 0xb11a, +0x8396, 0xbd98, 0x073f, 0x0598, 0x5258, 0x7bf8, 0x3dd3, 0x096d, 0xe7f8, 0xa966, +0x9271, 0xc3c7, 0xb173, 0xf5d9, 0x6db2, 0x3b89, 0x2231, 0x4aaf, 0x1c3b, 0xc115, +0xcb06, 0xd460, 0xbb98, 0x03f6, 0xf9d7, 0xecaf, 0x4aa5, 0x27cf, 0xcf8c, 0x0764, +0x3489, 0xd9cb, 0xf31b, 0x39b5, 0xebc3, 0xeb7f, 0x1192, 0xceee, 0xbd72, 0x16f9, +0x1b5a, 0xf888, 0x4a44, 0x34a8, 0xedd8, 0x18bb, 0xf8d6, 0xa74c, 0xd19c, 0x139c, +0xeaf7, 0x0d0b, 0x5317, 0x0e81, 0x0c44, 0x35bd, 0xe010, 0xb51d, 0x075b, 0xfc77, +0xc9ae, 0x2b95, 0x35a1, 0xf0e8, 0x2c61, 0x2481, 0xc370, 0xe826, 0x20b5, 0xd95a, +0xf832, 0x43e0, 0xf261, 0xf7ef, 0x414e, 0xf14b, 0xbf9e, 0x1c6c, 0x1380, 0xd3d1, +0x2650, 0x1f52, 0xd592, 0x1ddb, 0x2414, 0xc347, 0xebd1, 0x3e70, 0xf240, 0xeb89, +0x3d66, 0xf738, 0xe57b, 0x2fe8, 0xf22d, 0xbd68, 0x1e7b, 0x2466, 0xd858, 0x2613, +0x3122, 0xdc86, 0x16b9, 0x277b, 0xc324, 0xdb13, 0x2c78, 0xe8ab, 0xed0b, 0x49bb, +0x0342, 0xf02a, 0x3b6c, 0xf7d9, 0xb9c6, 0x0fd8, 0x1192, 0xc763, 0x12e5, 0x2738, +0xe26c, 0x1a89, 0x2a72, 0xcd72, 0xdca7, 0x27a9, 0xe962, 0xd98a, 0x271e, 0xf948, +0xe783, 0x29f0, 0x000e, 0xc137, 0x064c, 0x17e6, 0xcd48, 0x0efb, 0x329b, 0xdc50, +0xf9d6, 0x28fd, 0xd866, 0xc34b, 0x13df, 0xefa3, 0xdcbf, 0x3578, 0x09a7, 0xe33f, +0x2c3f, 0x02a6, 0xaa76, 0xf3eb, 0x1870, 0xc21d, 0x029e, 0x3d07, 0xedbb, 0x0a92, +0x33dc, 0xd94f, 0xc985, 0x15a5, 0xdf1c, 0xd3f5, 0x3f5e, 0x0fca, 0xe50f, 0x3b04, +0x1a3d, 0xb99b, 0xf6d1, 0x1c75, 0xcc21, 0x0987, 0x3e95, 0xed51, 0x0dcf, 0x3b32, +0xd980, 0xc6f7, 0x280e, 0xf587, 0xd3c2, 0x4871, 0x233c, 0xe02f, 0x3039, 0x183d, +0xaecf, 0xf137, 0x2776, 0xcc66, 0x0bf0, 0x5162, 0xeddf, 0x088c, 0x4536, 0xd457, +0xb205, 0x2315, 0xf51a, 0xc60d, 0x4281, 0x2682, 0xe5d9, 0x3aad, 0x1cab, 0xb02d, +0xf294, 0x20af, 0xbecb, 0x0084, 0x4c16, 0xeaf2, 0x054e, 0x449f, 0xdf02, 0xbd48, +0x25bf, 0xfda9, 0xcb15, 0x3a93, 0x1e9b, 0xddd4, 0x3408, 0x1f70, 0xb333, 0xf3df, +0x32ab, 0xd133, 0x014e, 0x52b2, 0xf138, 0xfe00, 0x4260, 0xe1f2, 0xbbac, 0x28bf, +0x0404, 0xcc81, 0x4649, 0x2e56, 0xdee8, 0x3677, 0x23ef, 0xabc0, 0xea62, 0x3159, +0xcf59, 0xfdcf, 0x575a, 0xf403, 0xfe40, 0x4759, 0xe094, 0xb225, 0x1ffa, 0xfefc, +0xc26f, 0x3a61, 0x2be1, 0xdb44, 0x2efe, 0x2504, 0xadcb, 0xe074, 0x2713, 0xc6d3, +0xecc2, 0x48d6, 0xea4d, 0xf2ec, 0x43a0, 0xe1fc, 0xaa5f, 0x1825, 0xffd7, 0xba38, +0x2bdb, 0x24a3, 0xce10, 0x1cd8, 0x1cfc, 0xab2e, 0xdc4d, 0x276d, 0xca22, 0xeb01, +0x4a08, 0xeb0e, 0xe94c, 0x3cd7, 0xe45f, 0xa6c6, 0x0f8c, 0x066f, 0xc2d2, 0x2a01, +0x2aea, 0xd9bf, 0x251a, 0x2933, 0xb64d, 0xd9b5, 0x26a1, 0xd2ba, 0xe822, 0x4af1, +0xfec7, 0xf323, 0x3fdf, 0xf78e, 0xb4c1, 0x0f7f, 0x0e1c, 0xc7ce, 0x25fb, 0x3129, +0xdeb5, 0x2268, 0x3385, 0xc266, 0xd9b6, 0x2efc, 0xddb0, 0xe00f, 0x45ac, 0x0168, +0xea8d, 0x3cd9, 0xfeda, 0xb603, 0x13c5, 0x166b, 0xc192, 0x1f5a, 0x3804, 0xda94, +0x15a3, 0x35b3, 0xc729, 0xd3ae, 0x2e68, 0xe359, 0xde70, 0x4764, 0x0725, 0xe6b1, +0x3882, 0xfed4, 0xad23, 0x0819, 0x16c2, 0xc15b, 0x1c91, 0x4358, 0xe49c, 0x1162, +0x35d1, 0xc8f8, 0xc74f, 0x2676, 0xe0e9, 0xd0d7, 0x4b09, 0x1cea, 0xedea, 0x3f3b, +0x11f4, 0xb09a, 0xfc73, 0x177b, 0xba40, 0x109f, 0x4fcb, 0xf285, 0x1d0f, 0x3dc2, +0xc588, 0xc98d, 0x329a, 0xfd8a, 0xcc33, 0x1573, 0x1810, 0x1532, 0x434e, 0x102d, +0xd555, 0x08d4, 0x0011, 0xb77c, 0xec37, 0x098c, 0xd4fc, 0x2033, 0x7926, 0x32be, +0xfe95, 0x28ab, 0xef9c, 0xa428, 0xcffc, 0xcbdf, 0xd07c, 0x3681, 0x2f87, 0x0680, +0x626e, 0x5e9c, 0xd624, 0xd9e4, 0x080a, 0xadfe, 0xa2f5, 0x12af, 0x142c, 0xffde, +0x3703, 0x3570, 0x269e, 0x24fb, 0xe8a1, 0xb7ec, 0xe753, 0xf82a, 0xce4d, 0x001a, +0x2e98, 0x1f84, 0x0eb8, 0x1beb, 0x2603, 0xfcff, 0xfd98, 0xd8c0, 0xc719, 0xfc52, +0xddd2, 0xe3ec, 0x2ee0, 0x4393, 0x042b, 0x1929, 0x569a, 0xef83, 0xc35d, 0xd9e5, +0xc6ce, 0xd1e0, 0xed86, 0x0b2a, 0x23b2, 0x504c, 0x20ad, 0x029d, 0x3b72, 0xf5a5, +0xad6b, 0xbe54, 0xddfc, 0xd162, 0xddcd, 0x2952, 0x324b, 0x3156, 0x1d3f, 0x12f5, +0x235b, 0xf27f, 0xc001, 0xb250, 0xdfdd, 0xe3f3, 0xd455, 0x14e4, 0x3c06, 0x3326, +0x1a60, 0x30e7, 0x24a0, 0xe2c3, 0xcd08, 0xb21c, 0xc75c, 0xdc66, 0xe088, 0x1e09, +0x54ef, 0x4197, 0x0dca, 0x356f, 0x22ce, 0xcaf2, 0xc0ce, 0xbc3d, 0xcfda, 0xe59b, +0xfe5c, 0x27b1, 0x4caa, 0x45a1, 0x0add, 0x274f, 0x1c6c, 0xcde6, 0xc343, 0xd011, +0xdf48, 0xe021, 0x0b0c, 0x335a, 0x3c8e, 0x345d, 0x0d86, 0x278e, 0x1b8f, 0xdc12, +0xbc28, 0xc6ff, 0xead3, 0xdba0, 0xfdee, 0x39b8, 0x3f03, 0x2143, 0x1858, 0x376b, +0x021b, 0xcaa8, 0xbb59, 0xc6f6, 0xef67, 0xe041, 0xf9ba, 0x3cd7, 0x4cfd, 0x168d, +0x1037, 0x3fec, 0xf71d, 0xbed3, 0xc8d6, 0xcbc6, 0xdd8f, 0xea8c, 0x09b1, 0x2e92, +0x4701, 0x1829, 0x091c, 0x3ad7, 0xfd4b, 0xb999, 0xbe68, 0xdc50, 0xdc39, 0xd663, +0x1009, 0x330e, 0x37f3, 0x1ad3, 0x1cca, 0x3476, 0xf66a, 0xc5e8, 0xbb6f, 0xd5e8, +0xe008, 0xd5ea, 0x10b5, 0x3f63, 0x3725, 0x1102, 0x2911, 0x3855, 0xe9cb, 0xc610, +0xc44b, 0xd547, 0xdd89, 0xe4aa, 0x195d, 0x4084, 0x3d9b, 0x10ab, 0x2a1f, 0x3667, +0xe38c, 0xc1a0, 0xc4c5, 0xdd94, 0xe21b, 0xe99c, 0x1f49, 0x4312, 0x3b69, 0x0f14, +0x2b3d, 0x2eaa, 0xdeab, 0xc00a, 0xc634, 0xe225, 0xe0e3, 0xf311, 0x2b9a, 0x44fd, +0x3881, 0x11ee, 0x2f2a, 0x2428, 0xdc87, 0xc347, 0xc2d0, 0xe6e0, 0xe5b0, 0xf196, +0x2d4e, 0x4a97, 0x3366, 0x1388, 0x3ae0, 0x1bf8, 0xd058, 0xc212, 0xc09b, 0xdbf3, +0xe25c, 0xfa1f, 0x3093, 0x4e94, 0x31f0, 0x12fe, 0x3bde, 0x11ad, 0xc841, 0xb8bd, +0xbe0b, 0xdd25, 0xdd7e, 0x0138, 0x3ac9, 0x4ccb, 0x2ba2, 0x1359, 0x3033, 0xfbc6, +0xc14d, 0xb543, 0xbd7e, 0xdcf8, 0xde2b, 0x0754, 0x388b, 0x409a, 0x1e0d, 0x134a, +0x2ba8, 0xeee4, 0xbe5b, 0xafaf, 0xbb90, 0xe059, 0xde74, 0x0736, 0x3d1c, 0x4310, +0x16f1, 0x1686, 0x2f2a, 0xe9de, 0xbe17, 0xb446, 0xc0ca, 0xdd27, 0xe1a0, 0x0ccd, +0x3c13, 0x4661, 0x1949, 0x196a, 0x2a50, 0xdf8d, 0xb6a7, 0xb25a, 0xc8aa, 0xdf0e, +0xe6dc, 0x19c8, 0x411d, 0x423f, 0x15db, 0x1a0d, 0x2316, 0xdf69, 0xba97, 0xb2a9, +0xd092, 0xe29a, 0xebf2, 0x2556, 0x4a3b, 0x3fb1, 0x16cb, 0x2603, 0x1c1b, 0xd67d, +0xbcf3, 0xb765, 0xdad1, 0xea4b, 0xf176, 0x27e4, 0x4d31, 0x3b4c, 0x0fab, 0x2ad5, +0x1a4d, 0xd10b, 0xbc49, 0xba78, 0xda1f, 0xe903, 0xffda, 0x308c, 0x4a2f, 0x38ce, +0x11cc, 0x299c, 0x105c, 0xcdc3, 0xba31, 0xc03e, 0xe616, 0xe849, 0xfec7, 0x37e1, +0x4e98, 0x3198, 0x12d8, 0x2aeb, 0x03e5, 0xcb29, 0xbccb, 0xc232, 0xe734, 0xeb9c, +0x07ed, 0x3d12, 0x4b48, 0x2515, 0x14e8, 0x330c, 0xfd19, 0xc86d, 0xc241, 0xca17, +0xe64b, 0xe918, 0x09ed, 0x3ba3, 0x4eee, 0x25e2, 0x167a, 0x38a6, 0xffcf, 0xcb0e, +0xc615, 0xd055, 0xe3d3, 0xeafc, 0x1602, 0x3e86, 0x49c2, 0x257e, 0x2166, 0x3bcd, +0xfc55, 0xc4ad, 0xbb87, 0xd6e3, 0xe7a1, 0xe64f, 0x1ddd, 0x4682, 0x4516, 0x1dee, +0x1dc5, 0x2b0d, 0xed86, 0xc590, 0xb97d, 0xd84f, 0xec06, 0xe368, 0x1c7f, 0x4cee, +0x3f07, 0x13c3, 0x289d, 0x28fb, 0xdcf0, 0xc5b7, 0xbdb7, 0xd4a7, 0xec46, 0xecd0, +0x1bda, 0x48cc, 0x4019, 0x0cd7, 0x23a7, 0x2698, 0xd5be, 0xbc3e, 0xb90e, 0xcc6c, +0xddf3, 0xf12b, 0x24f1, 0x4448, 0x3b5c, 0x118e, 0x2441, 0x1c2b, 0xd270, 0xb368, +0xb6c7, 0xdd46, 0xdf51, 0xefbb, 0x3138, 0x49d2, 0x3667, 0x1864, 0x2b86, 0x1073, +0xd35e, 0xbbf4, 0xb47a, 0xdfb4, 0xe8bb, 0xf6b2, 0x353a, 0x4fd4, 0x2e9f, 0x12a8, +0x323d, 0x07c8, 0xcb04, 0xc1fa, 0xbd57, 0xdf17, 0xe6e8, 0xfa82, 0x3052, 0x4c63, +0x2d83, 0x12bf, 0x3366, 0x0318, 0xc6dd, 0xbd85, 0xbc4f, 0xd9e1, 0xe604, 0x0814, +0x34df, 0x4a09, 0x2d9d, 0x148f, 0x2e79, 0xfba1, 0xc12c, 0xb277, 0xbf95, 0xdeb7, +0xe211, 0x10bc, 0x423c, 0x4956, 0x24f7, 0x1571, 0x2434, 0xebbb, 0xc333, 0xb587, +0xc733, 0xedc0, 0xebba, 0x0854, 0x3f2e, 0x6f7e, 0x4a81, 0x0e5e, 0x03fe, 0xcb43, +0xa313, 0xa8c3, 0xd5fe, 0x0fe0, 0x3ce3, 0x6922, 0x5cb3, 0x4541, 0x10b8, 0xc5c1, +0xb7c8, 0xca44, 0xca38, 0xd7f7, 0x38e7, 0x4e53, 0x1cb5, 0x3dfb, 0x3d19, 0x06ab, +0xeda0, 0xe9ef, 0xd83d, 0xf9bf, 0x0ebe, 0xca2a, 0x0a79, 0x510e, 0xf01d, 0xe7eb, +0x3be6, 0x1a2e, 0xf989, 0x353e, 0x099c, 0xe538, 0x16d7, 0xd697, 0xa93c, 0x0407, +0x1bee, 0xf75f, 0x46c6, 0x50e3, 0xf430, 0x1813, 0x169b, 0xaf5d, 0xc57c, 0x0fb5, +0xe638, 0xf7e9, 0x459c, 0x122e, 0x0654, 0x352e, 0xfc93, 0xc262, 0xf99c, 0x072c, +0xc8f1, 0x0bf2, 0x32cd, 0xf85b, 0x1790, 0x25c1, 0xde96, 0xd882, 0x18ea, 0xe834, +0xd77c, 0x3995, 0x1231, 0xeab1, 0x28e3, 0x0cfc, 0xc5ef, 0xf7bd, 0x18f1, 0xd03e, +0x057e, 0x320a, 0xe5e4, 0x07c7, 0x2d5d, 0xd88a, 0xc884, 0x2072, 0xfd6c, 0xd3d0, +0x2a59, 0x1066, 0xe564, 0x22a2, 0x047a, 0xb2ee, 0xeaad, 0x1c28, 0xcc6c, 0xf7e5, +0x3c36, 0xee88, 0xfbfb, 0x3085, 0xddf6, 0xb28a, 0x0aaf, 0xf456, 0xbc45, 0x223a, +0x21ed, 0xe31c, 0x2214, 0x1882, 0xb51a, 0xdbdc, 0x18ba, 0xc1ce, 0xe1c3, 0x397c, +0xed39, 0xf426, 0x3690, 0xe68c, 0xb498, 0x0e83, 0x00c5, 0xc494, 0x1ef7, 0x1b31, +0xdc33, 0x1f84, 0x1b7f, 0xb9c1, 0xdc07, 0x2246, 0xd5fb, 0xeaf7, 0x4a41, 0x042a, +0xed8c, 0x29a9, 0xf4c4, 0xbbf5, 0xffbd, 0x02b3, 0xd089, 0x2a98, 0x349a, 0xe5f4, +0x231d, 0x3682, 0xc042, 0xc757, 0x28ee, 0xe56b, 0xda47, 0x3eac, 0x0d7c, 0xfc17, +0x4512, 0x05d1, 0xbb63, 0x0fc8, 0x0da5, 0xb98f, 0x1ecc, 0x3aea, 0xdbbd, 0x1bd6, +0x4041, 0xd007, 0xd35e, 0x2aaf, 0xea38, 0xe711, 0x3e4a, 0xfa47, 0xef65, 0x3f02, +0xf730, 0xae98, 0x0fae, 0x1e19, 0xc953, 0x1ea3, 0x3db2, 0xe20d, 0x1043, 0x2d87, +0xc8ab, 0xca8a, 0x2270, 0xe769, 0xe021, 0x4751, 0x0a42, 0xed5b, 0x468e, 0x0a0e, +0xa823, 0xfc1e, 0x19ce, 0xc19e, 0x0fd8, 0x3c33, 0xe854, 0x1d91, 0x3f3f, 0xd03c, +0xd290, 0x2d60, 0xe292, 0xd443, 0x4229, 0x0590, 0xe446, 0x3c78, 0x0d2e, 0xbba0, +0x0b10, 0x1fdc, 0xccc6, 0x142f, 0x3174, 0xdc18, 0x1061, 0x371b, 0xd368, 0xd200, +0x2d59, 0xf1a5, 0xdc23, 0x3edd, 0x0fb6, 0xe812, 0x2f6f, 0x0a77, 0xb941, 0xfe00, +0x1d36, 0xcc9c, 0x11f2, 0x404a, 0xe70a, 0x0abc, 0x3965, 0xd3be, 0xbed2, 0x1fe7, +0xee09, 0xd03e, 0x3f07, 0x1799, 0xe33b, 0x342f, 0x1443, 0xb44b, 0xf906, 0x1979, +0xbeaf, 0x0a9f, 0x45b3, 0xe73c, 0x0a6f, 0x3e78, 0xd655, 0xc03d, 0x2087, 0xeb0b, +0xcf7a, 0x4395, 0x1915, 0xe1a6, 0x34d0, 0x134e, 0xac96, 0xeeeb, 0x1aa0, 0xc459, +0x0965, 0x4852, 0xe8bd, 0x0151, 0x3569, 0xd16f, 0xb855, 0x1c6f, 0xed54, 0xcabb, +0x428e, 0x1dfb, 0xdf3c, 0x323b, 0x15f0, 0xab84, 0xe597, 0x18a2, 0xc34f, 0x0120, +0x48dd, 0xedf1, 0x07d1, 0x3f6b, 0xd521, 0xb0ac, 0x1903, 0xf0c7, 0xc122, 0x3959, +0x22ad, 0xe010, 0x2ec7, 0x1837, 0xaaf6, 0xe170, 0x1e2b, 0xc7b9, 0xfdb5, 0x4c53, +0xebef, 0xfb34, 0x3ee4, 0xdef9, 0xb297, 0x1b34, 0xfd76, 0xc42a, 0x391e, 0x2b29, +0xde3f, 0x2dc8, 0x2491, 0xb2a5, 0xe544, 0x2b06, 0xcad8, 0xf507, 0x54ba, 0xf673, +0xfa92, 0x48ca, 0xe9a8, 0xafd3, 0x1ef7, 0x084a, 0xc383, 0x3a6e, 0x3354, 0xdbff, +0x2c3f, 0x2b2a, 0xb115, 0xe1c4, 0x348d, 0xd2d5, 0xf3b1, 0x5801, 0xf84b, 0xf5dc, +0x4897, 0xeba9, 0xac5a, 0x1d11, 0x0bb4, 0xbcd7, 0x32ed, 0x3809, 0xdc0a, 0x2aa8, +0x3035, 0xb63c, 0xddf9, 0x3359, 0xe1e6, 0xdc8c, 0x1666, 0xf007, 0x2428, 0x5dbe, +0x00c2, 0xd781, 0x22f0, 0xf405, 0xa1af, 0xed74, 0xf64b, 0xd808, 0x304e, 0x5c2f, +0x2e87, 0x2aaf, 0x32b5, 0xdc5e, 0xbf90, 0xd852, 0xad5b, 0xdde3, 0x38e2, 0x1923, +0x04d1, 0x62c4, 0x5bb8, 0xe529, 0xeaaf, 0xfd61, 0xc422, 0xc0df, 0xfa6b, 0x0d7b, +0x16ff, 0x3f3e, 0x1d78, 0x1a46, 0x3b1d, 0xf55f, 0xc829, 0xeeb5, 0x0157, 0xdd55, +0xf41a, 0x20b5, 0x1533, 0x2329, 0x1f7c, 0x1523, 0x1e43, 0x1419, 0xdc00, 0xbfc2, +0xfbcf, 0xe187, 0xd1ef, 0x2a18, 0x3c8b, 0x1862, 0x2179, 0x4380, 0x06a1, 0xdc67, +0xe0e4, 0xb854, 0xda4e, 0xf2b5, 0xe744, 0x1f54, 0x57ea, 0x2932, 0xfa55, 0x3961, +0x0fd9, 0xbac6, 0xcdda, 0xd258, 0xcf89, 0xe3ab, 0x0707, 0x1a3e, 0x3967, 0x30cc, +0x0264, 0x2d4f, 0x1e6c, 0xcc01, 0xb70b, 0xd1c4, 0xdac0, 0xca7b, 0xfba8, 0x26c2, +0x371b, 0x359b, 0x23c6, 0x2fb4, 0x0da1, 0xd9bd, 0xae9d, 0xb89c, 0xdb61, 0xcb90, +0x0132, 0x482d, 0x42cd, 0x1e49, 0x2e1f, 0x3691, 0xe7fa, 0xc93c, 0xba66, 0xbb0a, +0xe251, 0xe472, 0x0383, 0x3f08, 0x4cc8, 0x1215, 0x1c80, 0x3b71, 0xe4f3, 0xc431, +0xcbb0, 0xc403, 0xd2f9, 0xf12b, 0x1313, 0x2f50, 0x4774, 0x1313, 0x18c4, 0x4058, +0xed5d, 0xb643, 0xc25a, 0xd92a, 0xcdc3, 0xe267, 0x25f0, 0x37bf, 0x38e3, 0x1db0, +0x2909, 0x2dab, 0xe635, 0xb3fb, 0xb52f, 0xe71a, 0xdad1, 0xdbe5, 0x2dd4, 0x4a45, +0x2f11, 0x15fc, 0x375b, 0x1edc, 0xd95e, 0xc7dd, 0xb91d, 0xdb9a, 0xe8d2, 0xea7d, +0x243c, 0x50aa, 0x347a, 0x0b10, 0x3f2c, 0x24ae, 0xc984, 0xc48d, 0xccec, 0xd726, +0xda77, 0xf845, 0x2782, 0x491b, 0x3bb7, 0x1233, 0x3698, 0x200c, 0xcd29, 0xb25f, +0xc2ef, 0xdd85, 0xd457, 0xfe96, 0x3830, 0x43f0, 0x2e94, 0x1a60, 0x3369, 0x07e9, +0xcb4f, 0xb645, 0xba73, 0xdbb8, 0xdb8f, 0xffae, 0x3a33, 0x48d7, 0x2211, 0x15da, +0x362f, 0xfbd5, 0xc39a, 0xb7fb, 0xc2cf, 0xe1cd, 0xe2d2, 0x0604, 0x36c9, 0x495d, +0x209d, 0x15d2, 0x37e6, 0xf91a, 0xc431, 0xbe00, 0xccf7, 0xe3be, 0xe90a, 0x14f8, +0x3bed, 0x4775, 0x22c5, 0x1a55, 0x2eb8, 0xf7ab, 0xcbee, 0xbb0a, 0xd4b7, 0xea3e, +0xe43a, 0x18fd, 0x455e, 0x429e, 0x1d75, 0x27b4, 0x2e04, 0xeadd, 0xca0c, 0xb834, +0xcf7e, 0xebe8, 0xec12, 0x1d2b, 0x4ce6, 0x4388, 0x1410, 0x2882, 0x2863, 0xdbfa, +0xc201, 0xbc64, 0xd1a8, 0xe40d, 0xf23c, 0x21f6, 0x44ac, 0x3ed5, 0x105b, 0x1f33, +0x1ab9, 0xd393, 0xb879, 0xb8a2, 0xd559, 0xdf87, 0xf31b, 0x2555, 0x3b7c, 0x3066, +0x0f9b, 0x206c, 0x1043, 0xd352, 0xb6fe, 0xb4ae, 0xdacb, 0xdd79, 0xed28, 0x2944, +0x40cc, 0x26e3, 0x1073, 0x2c6d, 0x0a8e, 0xd1fe, 0xbe7c, 0xb79c, 0xdbb0, 0xe28f, +0xf1b8, 0x2782, 0x45d6, 0x288a, 0x146e, 0x3752, 0x08d7, 0xccea, 0xc003, 0xbd89, +0xda98, 0xe4f4, 0x0193, 0x3341, 0x4c65, 0x29eb, 0x1665, 0x385c, 0x0502, 0xcaf3, +0xbfdd, 0xc859, 0xe1b4, 0xe85f, 0x0f40, 0x394b, 0x49b1, 0x2907, 0x1adb, 0x324c, +0xf922, 0xc6e9, 0xb961, 0xcbdd, 0xe7b2, 0xe6bd, 0x11f6, 0x3fef, 0x46fb, 0x1df6, +0x1d0f, 0x2f40, 0xeef5, 0xc4a6, 0xb575, 0xcb9f, 0xe637, 0xea22, 0x1afc, 0x450f, +0x486c, 0x1ca2, 0x2081, 0x27c1, 0xe170, 0xbe81, 0xb610, 0xd4bd, 0xe951, 0xed82, +0x22d8, 0x4920, 0x44fd, 0x1967, 0x24be, 0x230d, 0xdd5b, 0xbd48, 0xb2b2, 0xd74f, +0xebd6, 0xf51e, 0x2d0e, 0x4f15, 0x406d, 0x18ea, 0x2d32, 0x1b37, 0xd68b, 0xc044, +0xb935, 0xdd2b, 0xe8ca, 0xf474, 0x309b, 0x54b6, 0x3c42, 0x14ba, 0x347b, 0x1910, +0xd0a8, 0xbcba, 0xb8c9, 0xdc46, 0xe9fe, 0xfff4, 0x3532, 0x5389, 0x3988, 0x14af, +0x3504, 0x102d, 0xc848, 0xb929, 0xbe6f, 0xdd0e, 0xe430, 0x059c, 0x3ba7, 0x4f58, +0x2e33, 0x10f0, 0x2a2f, 0xfdb9, 0xc2f6, 0xafbb, 0xbb99, 0xe4f6, 0xe5f2, 0x07f0, +0x3ce6, 0x4606, 0x2206, 0x1803, 0x2b80, 0xee52, 0xc24f, 0xb46d, 0xbb4a, 0xe32e, +0xe633, 0x0953, 0x4238, 0x4b00, 0x1a28, 0x1723, 0x280d, 0xe191, 0xbf29, 0xb512, +0xbb95, 0xe083, 0xee77, 0x11e1, 0x3d02, 0x4905, 0x18fb, 0x175c, 0x25d3, 0xdaba, +0xb4bd, 0xb51c, 0xcc2b, 0xe1c5, 0xed1f, 0x1d15, 0x42ae, 0x42e0, 0x12aa, 0x15c7, +0x1ce6, 0xdd86, 0xbb2e, 0xb339, 0xd4c6, 0xe6a3, 0xee5c, 0x246d, 0x4599, 0x378a, +0x117f, 0x247f, 0x1587, 0xd40f, 0xc211, 0xba12, 0xda04, 0xe9d2, 0xf097, 0x2593, +0x4a0d, 0x33f2, 0x0e58, 0x2f92, 0x1796, 0xd23e, 0xc5d1, 0xbd1d, 0xd6a8, 0xea03, +0xfd4b, 0x2b76, 0x4d07, 0x372b, 0x12c1, 0x3610, 0x1455, 0xc9fa, 0xc082, 0xc65f, +0xdbf3, 0xe5fa, 0x0864, 0x3695, 0x4d6d, 0x3441, 0x13be, 0x2f2f, 0x090c, 0xce34, +0xb830, 0xc505, 0xfada, 0xec81, 0xfb68, 0x2eba, 0x319e, 0x3ce2, 0x44fb, 0x1d01, +0xdd9d, 0xd66a, 0xb232, 0xa016, 0xf64b, 0xfff6, 0x09d5, 0x7376, 0x8570, 0x20f6, +0xfe82, 0xf200, 0x9a52, 0xa325, 0xc4f5, 0xcbde, 0x2c79, 0x67bb, 0x4c8f, 0x46a8, +0x523c, 0xf79d, 0xabd0, 0xda12, 0xcc15, 0xb71c, 0xf62d, 0x1e60, 0x327a, 0x4b18, +0x2770, 0xf598, 0x157f, 0x094e, 0xbe89, 0xebf7, 0x2a77, 0xf098, 0xe9ee, 0x28e2, +0xf32a, 0xc056, 0x237c, 0x271d, 0xe4a4, 0x3978, 0x35ba, 0xe536, 0x10f5, 0xfdaa, +0xa68b, 0xd3ea, 0x212f, 0xea07, 0x08a6, 0x5e96, 0x0ae2, 0x07c6, 0x37b6, 0xd70c, +0xb092, 0xfe7d, 0xf21a, 0xcad9, 0x34d2, 0x36e9, 0xf083, 0x37da, 0x22a5, 0xbc01, +0xdc00, 0x1395, 0xd553, 0xe5e3, 0x3bac, 0xfd08, 0xfe92, 0x3f5c, 0xee23, 0xbc45, +0x0d39, 0x0a9c, 0xc61a, 0x146f, 0x2951, 0xdb39, 0x171e, 0x293d, 0xc2e7, 0xdd20, +0x32b9, 0xe330, 0xd7b9, 0x3cc5, 0xf7d9, 0xdcad, 0x311b, 0xf1df, 0xb0b8, 0x105b, +0x1a8c, 0xca51, 0x1be5, 0x2f80, 0xd616, 0x11ca, 0x2652, 0xbc4e, 0xcb96, 0x21a7, +0xe4b4, 0xe253, 0x4487, 0x0196, 0xe674, 0x3516, 0xfb04, 0xb3bc, 0xfeb8, 0x1079, +0xc24e, 0x088e, 0x3298, 0xe80b, 0x14c1, 0x2ed3, 0xd1a8, 0xcf82, 0x2207, 0xee50, +0xcf02, 0x2dec, 0x08af, 0xe42a, 0x344d, 0x0fb2, 0xb971, 0xfa3f, 0x1df7, 0xd32e, +0x11cc, 0x3722, 0xda30, 0x07ac, 0x3d3f, 0xd7ab, 0xc34d, 0x271b, 0xfe76, 0xdbb3, +0x3d61, 0x18ed, 0xed9b, 0x3389, 0x0c14, 0xba7c, 0xf987, 0x187e, 0xcd50, 0x1066, +0x476b, 0xf480, 0x1314, 0x42bb, 0xe5fe, 0xc3be, 0x1389, 0xf39f, 0xd575, 0x3648, +0x1e47, 0xf2fa, 0x3e74, 0x234a, 0xbf4c, 0xf288, 0x221b, 0xc710, 0xfa3c, 0x5035, +0xfb9e, 0x0502, 0x44eb, 0xeee6, 0xc43e, 0x1d61, 0xfb1c, 0xc9de, 0x3c74, 0x2aae, +0xe190, 0x3674, 0x2619, 0xaff2, 0xe8b6, 0x2937, 0xc78c, 0xf5df, 0x540b, 0xfb05, +0x020b, 0x434b, 0xe0e6, 0xacc1, 0x10fc, 0xf91d, 0xbcee, 0x3592, 0x3566, 0xe36e, +0x337d, 0x30bf, 0xb32f, 0xd426, 0x2162, 0xc820, 0xe042, 0x4c56, 0xfe46, 0xf61f, +0x4a89, 0xf803, 0xad4d, 0x11a6, 0x0a6c, 0xb6d1, 0x253a, 0x3311, 0xd5a0, 0x2667, +0x3498, 0xb800, 0xd872, 0x2f83, 0xd41e, 0xe4e1, 0x5463, 0xf738, 0xea30, 0x492c, +0xf007, 0xaab2, 0x16ec, 0x11da, 0xc262, 0x2e37, 0x3e3b, 0xdd03, 0x22dd, 0x30e8, +0xb674, 0xd170, 0x2e2c, 0xdcd6, 0xe399, 0x56b9, 0x04f1, 0xea52, 0x4a44, 0xfd31, +0xa60d, 0x09bf, 0x162d, 0xbcc9, 0x1f55, 0x4352, 0xde68, 0x1cd9, 0x3c0d, 0xbf98, +0xc8d8, 0x2a1f, 0xdc64, 0xd503, 0x4d6c, 0x0785, 0xe7a8, 0x476e, 0xff01, 0xa5cd, +0x064f, 0x17bf, 0xbe55, 0x1800, 0x3b7b, 0xd4d9, 0x10f0, 0x3690, 0xbf8d, 0xc71e, +0x297a, 0xe393, 0xd729, 0x47fe, 0x0285, 0xda51, 0x391b, 0xfeb3, 0xa48e, 0xfbc3, +0x19a9, 0xc3a0, 0x108e, 0x3eae, 0xdebc, 0x0f12, 0x36a2, 0xc4c0, 0xbf91, 0x1e2f, +0xe5de, 0xd395, 0x4354, 0x10d5, 0xe319, 0x39c0, 0x0a87, 0xace4, 0xf7d2, 0x18b7, +0xc582, 0x0b6f, 0x3da5, 0xe290, 0x0dde, 0x3c3e, 0xcfe6, 0xc55b, 0x253d, 0xeca1, +0xcf94, 0x3b7a, 0x0f41, 0xdf74, 0x366b, 0x1370, 0xb644, 0xfb14, 0x1f1e, 0xc7c9, +0x07b4, 0x41e9, 0xe70d, 0x071d, 0x3d77, 0xdb66, 0xc478, 0x265f, 0xf916, 0xd180, +0x3ee6, 0x1beb, 0xdeb9, 0x31d9, 0x191a, 0xb479, 0xf52c, 0x2801, 0xccf7, 0x03d4, +0x4bd7, 0xedac, 0x016a, 0x3a65, 0xd6fc, 0xbe27, 0x2266, 0x07f4, 0xd0c6, 0x0dcf, +0x1281, 0x0eb0, 0x45e8, 0x1d9a, 0xd8e3, 0x05c1, 0x084a, 0xb5be, 0xdaec, 0x09a2, +0xe1b9, 0x11ee, 0x6086, 0x43d5, 0x17db, 0x2892, 0xfb50, 0xb60e, 0xc9f7, 0xc054, +0xc68d, 0x23e0, 0x2ffe, 0x062b, 0x4e99, 0x701f, 0xf80e, 0xd329, 0xff2c, 0xcb90, +0xa2d6, 0xed8c, 0x1910, 0x0699, 0x2f80, 0x3089, 0x1d1c, 0x374f, 0x03b2, 0xc14c, +0xd8b6, 0xfb3d, 0xd617, 0xe1a7, 0x22a2, 0x2021, 0x1a55, 0x1dcb, 0x2025, 0x150c, +0x0753, 0xe11c, 0xb5ad, 0xeb4f, 0xe450, 0xcc01, 0x1b1d, 0x3faa, 0x18aa, 0x0e6d, +0x4970, 0x17e5, 0xcba3, 0xd80b, 0xbb23, 0xc5d9, 0xe755, 0xf01c, 0x158e, 0x5028, +0x3e7d, 0xfcdb, 0x3482, 0x21eb, 0xbae5, 0xbfbe, 0xd2fb, 0xcfc4, 0xd821, 0x0aca, +0x27bb, 0x3924, 0x3d1e, 0x0e86, 0x271a, 0x205b, 0xd16c, 0xaf53, 0xc9df, 0xe377, +0xce6f, 0xfa21, 0x34f1, 0x4083, 0x3410, 0x259d, 0x319d, 0x06b6, 0xd9dc, 0xb750, +0xb2df, 0xde42, 0xd8e4, 0xfe96, 0x4970, 0x54f6, 0x25ba, 0x2520, 0x3c2e, 0xedea, +0xc061, 0xba0d, 0xba48, 0xde9c, 0xeb84, 0x0af2, 0x401e, 0x56b2, 0x1aa5, 0x0f66, +0x36cf, 0xe844, 0xb80e, 0xc1dd, 0xc246, 0xcece, 0xe9fe, 0x177a, 0x32d2, 0x4547, +0x1818, 0x0c52, 0x30b6, 0xec12, 0xaf1a, 0xb2f2, 0xcfa8, 0xd2b1, 0xdf9e, 0x2116, +0x3ab2, 0x35ab, 0x1b48, 0x247c, 0x25e1, 0xdedd, 0xb1e5, 0xaf2b, 0xdb4a, 0xe17b, +0xdfc7, 0x27da, 0x4f71, 0x34be, 0x0ed1, 0x2d58, 0x1ef5, 0xd091, 0xc1bb, 0xbe47, +0xd524, 0xeaee, 0xf469, 0x2112, 0x4cf4, 0x3d3e, 0x0aff, 0x304c, 0x281a, 0xcdc7, +0xbbed, 0xd088, 0xe04a, 0xdeea, 0xfee9, 0x2f94, 0x47fc, 0x3dff, 0x1a27, 0x31e9, +0x1deb, 0xd894, 0xbec6, 0xc6e8, 0xe5fc, 0xe340, 0x014d, 0x3cd1, 0x4e2f, 0x32bd, +0x1d0c, 0x372e, 0x0af1, 0xce88, 0xc502, 0xc97d, 0xe495, 0xeb9c, 0x0798, 0x374a, +0x4e4d, 0x2a7e, 0x16b3, 0x3ddd, 0x08ed, 0xc949, 0xc5ee, 0xce08, 0xdf28, 0xe8b7, +0x0fe9, 0x3689, 0x490a, 0x2817, 0x1714, 0x38c1, 0x0109, 0xc527, 0xc1af, 0xd087, +0xdced, 0xe41e, 0x12dc, 0x3476, 0x3cd2, 0x201b, 0x1cbb, 0x2e40, 0xf269, 0xc5fe, +0xb844, 0xcaac, 0xdf7f, 0xe02f, 0x0f09, 0x373a, 0x383b, 0x13eb, 0x21ef, 0x2cbc, +0xe41a, 0xc568, 0xb82e, 0xc319, 0xdca2, 0xe63b, 0x0f93, 0x3ca2, 0x4202, 0x11af, +0x2392, 0x2ac6, 0xd906, 0xb7d3, 0xb715, 0xce35, 0xdb89, 0xef49, 0x2213, 0x3ff6, +0x3f4b, 0x14d9, 0x2398, 0x1f27, 0xd7ab, 0xb866, 0xb50a, 0xd74b, 0xe11e, 0xf58b, +0x2ece, 0x467f, 0x3963, 0x1933, 0x2caa, 0x1426, 0xd5d8, 0xbe81, 0xb620, 0xdf76, +0xe789, 0xf65e, 0x349f, 0x505c, 0x3366, 0x16ea, 0x3646, 0x0f5a, 0xd18a, 0xc1b2, +0xb7f7, 0xdd2a, 0xeb2f, 0xfd79, 0x30f5, 0x516e, 0x31d6, 0x12af, 0x388a, 0x0be7, +0xca82, 0xbdf0, 0xbc89, 0xda3c, 0xe687, 0x06e8, 0x3695, 0x5204, 0x3323, 0x158c, +0x3447, 0x05f1, 0xca02, 0xb88d, 0xc1cf, 0xe381, 0xea5c, 0x110d, 0x40c6, 0x4e27, +0x2a69, 0x1e8c, 0x30b5, 0xf349, 0xc5eb, 0xb6f0, 0xc440, 0xe7cd, 0xebf2, 0x1281, +0x4308, 0x4ce7, 0x1f25, 0x1bf5, 0x2d5c, 0xe897, 0xc291, 0xb85f, 0xc6be, 0xe556, +0xf257, 0x1cc0, 0x442d, 0x4d14, 0x200a, 0x1f36, 0x26a6, 0xdf96, 0xbef2, 0xb898, +0xd0e1, 0xe9a1, 0xf513, 0x2536, 0x486a, 0x4666, 0x1bd4, 0x216e, 0x1a61, 0xd966, +0xbfd6, 0xb46f, 0xd414, 0xeb0f, 0xf5c1, 0x2917, 0x4b03, 0x3b01, 0x120a, 0x279d, +0x127b, 0xce60, 0xc0b2, 0xbaa1, 0xd93a, 0xea16, 0xf79d, 0x29e1, 0x4e28, 0x3952, +0x0c9b, 0x2918, 0x0da3, 0xc8e3, 0xbf5d, 0xbd5b, 0xd7be, 0xe6b5, 0xff78, 0x2bfe, +0x474e, 0x30ea, 0x0afb, 0x2996, 0x09da, 0xc618, 0xb66b, 0xc002, 0xde8f, 0xe009, +0x0068, 0x34b1, 0x479e, 0x290d, 0x1057, 0x2cf4, 0x0037, 0xc901, 0xba19, 0xc161, +0xe4c1, 0xe626, 0x06b7, 0x3bce, 0x46e6, 0x1fc6, 0x1c43, 0x37dd, 0xf4a3, 0xc6e9, +0xc0da, 0xc57a, 0xe45d, 0xe96e, 0x0b68, 0x3e09, 0x4c53, 0x1c9e, 0x1978, 0x350c, +0xec82, 0xc2fd, 0xc069, 0xc683, 0xdf64, 0xee42, 0x1619, 0x39da, 0x4685, 0x1dc8, +0x1c78, 0x2de4, 0xe52f, 0xbb56, 0xb88c, 0xd10f, 0xe424, 0xed39, 0x226e, 0x45c9, +0x4373, 0x1798, 0x1d16, 0x2213, 0xe050, 0xbf9c, 0xb315, 0xd32f, 0xe7c5, 0xec31, +0x23d2, 0x48dd, 0x38f4, 0x0de0, 0x25fc, 0x1996, 0xcef8, 0xbc82, 0xb55a, 0xd59c, +0xe89f, 0xefe0, 0x23a4, 0x4993, 0x37a4, 0x0c32, 0x2be5, 0x17d1, 0xcddd, 0xc07a, +0xb8e9, 0xd329, 0xe54b, 0xfb4e, 0x2cfc, 0x4d3a, 0x3bad, 0x0fee, 0x2b2b, 0x1047, +0xc712, 0xb4f7, 0xbbf0, 0xdc5f, 0xe2f3, 0xfef6, 0x224e, 0x4c36, 0x6c76, 0x2b5c, +0xfa57, 0xe594, 0xbdb1, 0x8b0a, 0xa7ca, 0x0160, 0x0786, 0x400c, 0x8424, 0x5796, +0x1be9, 0xf540, 0xbdf9, 0x9768, 0xc4df, 0xbd3d, 0xdd3d, 0x63d3, 0x4e65, 0x1fea, +0x4e57, 0x38bb, 0xd91b, 0xcd56, 0xe3ad, 0xbffd, 0xfbd6, 0x0607, 0xdb8e, 0x3ccb, +0x4192, 0xd6b0, 0xf73b, 0x42bf, 0xeff1, 0xe330, 0x3dbd, 0xfa84, 0xdccf, 0x13df, +0xde74, 0xb718, 0x0b45, 0x28d2, 0xfb25, 0x3fa0, 0x4276, 0xedb2, 0x1335, 0x0954, +0xadc9, 0xc6fc, 0x1522, 0xf53c, 0xfe45, 0x4b87, 0x18e7, 0x04a7, 0x3412, 0xee3f, +0xb321, 0xfd48, 0x04c9, 0xc508, 0x15a8, 0x372c, 0xeb2f, 0x165c, 0x2ca0, 0xce55, +0xd34d, 0x1c95, 0xe2fd, 0xdd7e, 0x3294, 0xf905, 0xe452, 0x34a4, 0x04d0, 0xbdd7, +0x0a01, 0x1d14, 0xce45, 0x0c02, 0x2888, 0xd716, 0x03dc, 0x2b4a, 0xd5cd, 0xd68c, +0x2ef2, 0xfc10, 0xda6f, 0x316f, 0x0773, 0xda8e, 0x2215, 0x0507, 0xb6f3, 0xfe70, +0x2a5d, 0xd6c8, 0x0b84, 0x4188, 0xe8c4, 0xfdd0, 0x2ec5, 0xd794, 0xc3a2, 0x2279, +0xf779, 0xd09d, 0x423d, 0x27fc, 0xe6f8, 0x2f40, 0x1b5a, 0xbc8b, 0xf157, 0x1fb4, +0xcaa0, 0xfa3a, 0x4232, 0xf922, 0x0ecb, 0x3f09, 0xe3ee, 0xc318, 0x1cef, 0xfdc1, +0xca4c, 0x2a22, 0x20f1, 0xe87d, 0x279c, 0x1afc, 0xbe72, 0xe720, 0x2220, 0xd1d4, +0xf6a7, 0x4e3e, 0xf5f4, 0xecca, 0x3b54, 0xf567, 0xb06f, 0x0a45, 0x0b98, 0xc973, +0x28f0, 0x2f21, 0xdfeb, 0x24a0, 0x2810, 0xaef4, 0xd207, 0x2ab3, 0xcd51, 0xdc82, +0x4ca3, 0xfdde, 0xef82, 0x40ab, 0xf143, 0xac33, 0x082b, 0xfdac, 0xb9b7, 0x28f3, +0x2b71, 0xd054, 0x2723, 0x3651, 0xb6cf, 0xd176, 0x2ba8, 0xd75d, 0xdb92, 0x450f, +0xfd8f, 0xec9c, 0x3e23, 0xf598, 0xaf02, 0x111a, 0x135a, 0xbd2d, 0x2334, 0x3d0a, +0xd3d8, 0x1768, 0x3bb0, 0xbab9, 0xc676, 0x311a, 0xe06f, 0xd889, 0x5018, 0x070b, +0xe756, 0x4942, 0xfd09, 0x9d71, 0x0bcc, 0x1bed, 0xb4ce, 0x1c66, 0x47ec, 0xdc5f, +0x1b74, 0x4238, 0xc481, 0xcf1b, 0x32f5, 0xe1ce, 0xda85, 0x4e4d, 0x0437, 0xe474, +0x4777, 0x07ed, 0xaff9, 0x127d, 0x24cd, 0xc370, 0x199d, 0x3e29, 0xd8bf, 0x14fd, +0x3d8b, 0xc8ea, 0xd1b6, 0x3766, 0xecd3, 0xda6f, 0x4fa7, 0x0ce7, 0xdddd, 0x4019, +0x0c05, 0xaedb, 0x0dbc, 0x2b4c, 0xcdd3, 0x1ddc, 0x470d, 0xe283, 0x1764, 0x40d4, +0xcabb, 0xcd66, 0x3585, 0xf1c2, 0xdda9, 0x4ffb, 0x11e4, 0xe28a, 0x415d, 0x12d2, +0xb486, 0x055e, 0x1fd4, 0xc66e, 0x12ca, 0x417e, 0xe4e2, 0x1229, 0x3e2a, 0xd10c, +0xc800, 0x29e0, 0xed4e, 0xd10c, 0x3fcc, 0x11a3, 0xe1f9, 0x3ad7, 0x16ca, 0xb727, +0x0155, 0x2400, 0xc8c6, 0x0c22, 0x40bf, 0xe1dc, 0x06e9, 0x3e89, 0xd924, 0xc59a, +0x27a2, 0xf22c, 0xcfad, 0x3f51, 0x14cd, 0xda51, 0x2f15, 0x1235, 0xae68, 0xedef, +0x1983, 0xc602, 0x06d9, 0x46e6, 0xe9de, 0x01cd, 0x3928, 0xd470, 0xb512, 0x15ff, +0xec31, 0xc9cd, 0x3f78, 0x243a, 0xe15e, 0x29ed, 0x1245, 0xaba1, 0xe5e9, 0x199e, +0xc296, 0xfe39, 0x4ac5, 0xeb5f, 0xfa56, 0x3c11, 0xd94f, 0xae50, 0x1511, 0xf001, +0xbde3, 0x36c2, 0x230d, 0xd7fe, 0x2c17, 0x1e3a, 0xaa06, 0xe31f, 0x226e, 0xc144, +0xf626, 0x4f4e, 0xeb1e, 0xf4dd, 0x3e8c, 0xdc0a, 0xaf47, 0x1e56, 0xfed8, 0xc48e, +0x3d56, 0x2b0f, 0xd682, 0x2918, 0x1dec, 0xa955, 0xe5bb, 0x2b6b, 0xc9b8, 0xfa77, +0x56f8, 0xf481, 0xfb61, 0x4479, 0xdf2e, 0xabca, 0x1c70, 0xffe7, 0xbc88, 0x3a59, +0x3826, 0xe054, 0x2f4b, 0x2c11, 0xb1dd, 0xe03e, 0x2b29, 0xc998, 0xf18d, 0x59ee, +0xf7ac, 0xf73d, 0x4d8e, 0xed67, 0xb1d8, 0x21a9, 0x1848, 0xccda, 0x07a8, 0xffcd, +0xfa23, 0x5aea, 0x3797, 0xd62f, 0x0ab0, 0x245e, 0xb225, 0xc27c, 0x09d2, 0xd863, +0xfe56, 0x5bb6, 0x4ddb, 0x2aa0, 0x3bda, 0x0b4a, 0xc172, 0xdcc2, 0xc178, 0xb04a, +0x211f, 0x3a69, 0xf99a, 0x3316, 0x7dfa, 0x1afe, 0xd954, 0x046d, 0xdf49, 0xb051, +0xdb3e, 0x09de, 0x0f9f, 0x347e, 0x2f84, 0x0af2, 0x3895, 0x1ade, 0xc5b6, 0xd468, +0xfe63, 0xe6d0, 0xddae, 0x14b5, 0x175e, 0x16c3, 0x1fae, 0x122e, 0x1fcb, 0x16f5, +0xef7f, 0xbe99, 0xdd8a, 0xf61b, 0xc6ce, 0x019a, 0x43c3, 0x2909, 0x1168, 0x39ad, +0x2f76, 0xde14, 0xddd2, 0xc963, 0xbd2a, 0xea45, 0xea62, 0x0266, 0x4616, 0x4e1c, +0x015e, 0x18de, 0x36f6, 0xcf20, 0xb656, 0xd210, 0xd017, 0xd8b3, 0xfb2f, 0x1950, +0x2b27, 0x3c69, 0x095e, 0x0ec5, 0x2d9c, 0xe85e, 0xb75b, 0xc4ac, 0xe1a3, 0xcfe0, +0xdf2a, 0x1a10, 0x3183, 0x376b, 0x1d4c, 0x237d, 0x185c, 0xe4f3, 0xbf7b, 0xab18, +0xcfc2, 0xd346, 0xe11c, 0x2903, 0x45ea, 0x24aa, 0x102b, 0x353d, 0x080f, 0xc677, +0xbdeb, 0xb32e, 0xd477, 0xe331, 0xef66, 0x2325, 0x4c5c, 0x27b3, 0xfaf5, 0x3106, +0x1252, 0xc709, 0xca81, 0xcbe5, 0xd04d, 0xdd4e, 0xfd3c, 0x1a5f, 0x3c21, 0x2935, +0x0252, 0x3750, 0x1e8e, 0xc8e4, 0xb83e, 0xd48f, 0xdc6e, 0xce04, 0x0585, 0x31bc, +0x360a, 0x2009, 0x14c2, 0x394e, 0x10a3, 0xc93d, 0xafa5, 0xd6b1, 0xef04, 0xcd94, +0x0467, 0x48be, 0x4051, 0x1437, 0x1fb5, 0x3cd3, 0xf79e, 0xcc8f, 0xc153, 0xcd1f, +0xeeb7, 0xe37c, 0x03cf, 0x4174, 0x4958, 0x1000, 0x1d3b, 0x4853, 0xf289, 0xbea9, +0xc9e2, 0xd4e7, 0xde7b, 0xe633, 0x1461, 0x3e75, 0x4911, 0x1b5a, 0x2106, 0x4059, +0xf467, 0xbf92, 0xc1f8, 0xd995, 0xdcf6, 0xe0ba, 0x1eb5, 0x4600, 0x4167, 0x1d25, +0x2ef9, 0x3639, 0xe56b, 0xc105, 0xc027, 0xd70a, 0xe1eb, 0xea01, 0x247e, 0x4c66, +0x3f10, 0x14c8, 0x3245, 0x3094, 0xdd32, 0xc132, 0xc147, 0xd9a1, 0xe18c, 0xeeb8, +0x2824, 0x4a69, 0x395c, 0x1015, 0x3040, 0x238d, 0xd48a, 0xc21b, 0xc53b, 0xdc6d, +0xe1ce, 0xf6ef, 0x2ad6, 0x46b7, 0x34da, 0x1114, 0x34eb, 0x1e8c, 0xd361, 0xbe8c, +0xc1c6, 0xe012, 0xdf71, 0xf81f, 0x3359, 0x4a06, 0x2d71, 0x1454, 0x38da, 0x0f58, +0xccf4, 0xbea1, 0xbbb5, 0xdb25, 0xe2c4, 0xfd77, 0x3627, 0x5121, 0x2c35, 0x15a0, +0x3989, 0x0018, 0xc03f, 0xbaf5, 0xc3cd, 0xe02b, 0xe6c9, 0x0e3d, 0x3eb5, 0x4d58, +0x26cb, 0x1318, 0x2fe0, 0xf891, 0xc27d, 0xb828, 0xc71e, 0xe21d, 0xe699, 0x15c5, +0x4058, 0x45ef, 0x2262, 0x1985, 0x28bc, 0xeca7, 0xc32c, 0xb7e4, 0xcfc1, 0xea07, +0xe4ac, 0x173a, 0x461c, 0x3eba, 0x15fa, 0x2087, 0x2703, 0xe29a, 0xc4b3, 0xb600, +0xc8f7, 0xe687, 0xe9ba, 0x15c4, 0x426b, 0x3e74, 0x0edd, 0x1f75, 0x23b8, 0xd925, +0xc0ab, 0xba1f, 0xcb2d, 0xe095, 0xeca2, 0x1990, 0x40e5, 0x3c5d, 0x1023, 0x24d2, +0x1ebd, 0xd280, 0xbab7, 0xba30, 0xd226, 0xe0d0, 0xf39a, 0x22d6, 0x4063, 0x34fc, +0x0f3b, 0x2825, 0x190f, 0xd310, 0xbcd9, 0xbd2e, 0xd80b, 0xdd5a, 0xf3ce, 0x2b22, +0x4783, 0x32fb, 0x13a4, 0x3361, 0x1484, 0xcf84, 0xc067, 0xc184, 0xdb6a, 0xe3e8, +0x0230, 0x3122, 0x4768, 0x320a, 0x16c1, 0x3427, 0x0aed, 0xc9bb, 0xba81, 0xc328, +0xe12c, 0xe1e3, 0x07e1, 0x3ec1, 0x4f67, 0x2ddc, 0x15f0, 0x2f32, 0xfe24, 0xc964, +0xbbfd, 0xc754, 0xe848, 0xe9ef, 0x1196, 0x41b3, 0x4b5f, 0x2760, 0x1f91, 0x35ce, +0xf3d5, 0xc722, 0xbfad, 0xcade, 0xe85a, 0xeaa5, 0x1660, 0x4809, 0x4c60, 0x1f11, +0x212f, 0x36b0, 0xefd1, 0xc764, 0xbc28, 0xc837, 0xe455, 0xec50, 0x1c88, 0x4b3c, +0x4de3, 0x2041, 0x28c6, 0x32d7, 0xe1ea, 0xbea7, 0xbd29, 0xd1a9, 0xe60c, 0xf02d, +0x2433, 0x4c51, 0x4811, 0x1816, 0x23ce, 0x292b, 0xdf35, 0xbcec, 0xb6b3, 0xd50d, +0xe49a, 0xee6a, 0x2b0c, 0x4b27, 0x39f9, 0x15f5, 0x29d8, 0x1859, 0xd36e, 0xc04c, +0xb5ab, 0xd4b0, 0xe461, 0xec0c, 0x2803, 0x4fb2, 0x371f, 0x0f49, 0x2de8, 0x1063, +0xc7dd, 0xbbcc, 0xb195, 0xcdad, 0xe2b5, 0xf6ed, 0x29d0, 0x4ac5, 0x31e4, 0x0aa9, +0x2acb, 0x0735, 0xbe72, 0xb39c, 0xb620, 0xd1d9, 0xdc5c, 0xfcdd, 0x307a, 0x46be, +0x2c7c, 0x0a2b, 0x22ab, 0xfca8, 0xc0ac, 0xafc4, 0xb815, 0xde74, 0xe13f, 0x0269, +0x370e, 0x4107, 0x21c4, 0x13c8, 0x26a3, 0xf061, 0xc3ac, 0xb5ad, 0xbbea, 0xe2b6, +0xe314, 0x03cd, 0x3a8a, 0x453e, 0x1c0b, 0x167a, 0x2afd, 0xe8ae, 0xc330, 0xbb1d, +0xbd71, 0xdff6, 0xea8c, 0x0cd6, 0x3cc1, 0x4b59, 0x1e08, 0x1762, 0x288a, 0xe327, +0xbcf5, 0xbc04, 0xcc41, 0xe3b8, 0xf214, 0x1f63, 0x40b7, 0x4556, 0x1932, 0x14e9, +0x22d4, 0xe5af, 0xc176, 0xbaf1, 0xd516, 0xeaa3, 0xed1a, 0x10a5, 0x4490, 0x6d0e, +0x387d, 0x06ad, 0xf979, 0xc011, 0x9e3c, 0xad92, 0xe582, 0x1234, 0x4531, 0x6a71, +0x4d3b, 0x3443, 0xfe14, 0xbf35, 0xb76f, 0xcbe7, 0xc8b4, 0xe9aa, 0x501f, 0x43d8, +0x1d18, 0x4560, 0x2e0d, 0xf4de, 0xea75, 0xe7b7, 0xd73f, 0x0fdc, 0x11cd, 0xd145, +0x29c3, 0x44d4, 0xdad6, 0xf4f0, 0x3e51, 0x092e, 0x07b6, 0x43ce, 0xfd5a, 0xf591, +0x1f19, 0xc2ea, 0xb2d7, 0x198e, 0x140f, 0xfa53, 0x5e12, 0x4564, 0xf1ae, 0x2e33, +0x0b49, 0xa4bb, 0xdaed, 0x1485, 0xdc90, 0x0cbf, 0x4f0d, 0x0854, 0x15b5, 0x3b75, +0xe6b5, 0xbe4e, 0x0981, 0xfc23, 0xc6c6, 0x22a2, 0x2984, 0xf1db, 0x27f9, 0x1ab0, +0xc60e, 0xe49e, 0x21a8, 0xd681, 0xe953, 0x41f4, 0xf337, 0xeb9d, 0x3560, 0xf514, +0xbd12, 0x135a, 0x1144, 0xc99f, 0x21e0, 0x2271, 0xd155, 0x1a35, 0x25a3, 0xbec7, +0xdc7d, 0x31ed, 0xe802, 0xe46d, 0x3ef6, 0xfc72, 0xeb7d, 0x2fc5, 0xecf1, 0xb132, +0x0d6d, 0x171d, 0xcaf3, 0x20be, 0x36cd, 0xdeff, 0x1430, 0x2c97, 0xc49c, 0xcab8, +0x247c, 0xe2b5, 0xd3f1, 0x3d93, 0x0c22, 0xee37, 0x3907, 0x01ea, 0xb32c, 0x07e5, +0x153f, 0xb7d0, 0x0a61, 0x333d, 0xdb8a, 0x1138, 0x3892, 0xcfca, 0xccd1, 0x2831, +0xeb12, 0xd73f, 0x357e, 0xfe1d, 0xe21b, 0x300a, 0xfded, 0xaf91, 0xffaf, 0x1ba1, +0xc5b1, 0x0c52, 0x3c73, 0xe33f, 0xfac8, 0x2338, 0xd7bc, 0xc7f4, 0x0f99, 0xe739, +0xd9e0, 0x3980, 0x0e6d, 0xe382, 0x335e, 0x15f9, 0xae82, 0xe698, 0x1c86, 0xca1d, +0xf6f1, 0x34d2, 0xf14d, 0x0fec, 0x3c9a, 0xdef1, 0xc8df, 0x20f3, 0xea68, 0xc50a, +0x33ef, 0x1185, 0xd7d4, 0x2ebc, 0x2178, 0xc1c1, 0xf72b, 0x2354, 0xd2eb, 0x0168, +0x30db, 0xe0a6, 0x05a6, 0x3bad, 0xdc09, 0xc45f, 0x276d, 0xfd11, 0xcf0a, 0x363e, +0x204b, 0xe4d0, 0x2851, 0x199c, 0xbc3c, 0xe9df, 0x1c38, 0xcf05, 0x03b3, 0x4c0e, +0xf6ee, 0x068d, 0x44a0, 0xe3e0, 0xb163, 0x17fa, 0xfdee, 0xc709, 0x37cd, 0x2e63, +0xea1c, 0x3531, 0x2ca0, 0xbf9e, 0xeeec, 0x2b06, 0xc5f7, 0xf1c8, 0x5385, 0xfc84, +0x0002, 0x49cb, 0xf52b, 0xbfbf, 0x204d, 0x04c6, 0xc649, 0x35e9, 0x30b9, 0xe658, +0x31b2, 0x2cb7, 0xb96b, 0xe5a8, 0x2f24, 0xd410, 0xf6ab, 0x5771, 0x04b9, 0xfc36, +0x3ec2, 0xecd7, 0xb28a, 0x1904, 0x0954, 0xc24d, 0x3764, 0x3ade, 0xddf2, 0x29ce, +0x3445, 0xb4d5, 0xd352, 0x2d79, 0xd037, 0xe09a, 0x535a, 0x01a5, 0xf095, 0x48ef, +0xf767, 0xa8aa, 0x11b3, 0x097b, 0xb15c, 0x2a36, 0x3db4, 0xd6cd, 0x24b8, 0x3712, +0xb430, 0xcdb4, 0x2b60, 0xd3aa, 0xe09b, 0x53eb, 0xfc4a, 0xea6b, 0x4b2a, 0xf90e, +0xa8c8, 0x1124, 0x129b, 0xbaac, 0x269d, 0x4030, 0xda96, 0x20e1, 0x3a2e, 0xbd1c, +0xd0d8, 0x3158, 0xdd88, 0xdee5, 0x57dc, 0x0a22, 0xeb70, 0x4be8, 0x027e, 0xa602, +0x0680, 0x1714, 0xbfed, 0x242e, 0x47b1, 0xe011, 0x1d8e, 0x3eca, 0xc029, 0xc616, +0x2e06, 0xe28f, 0xd4aa, 0x4f9e, 0x0f06, 0xe649, 0x438d, 0x0564, 0xa6f1, 0x02f6, +0x1bd3, 0xc020, 0x18b7, 0x4204, 0xd71b, 0x0fc8, 0x3e52, 0xc2b8, 0xbf78, 0x2bd7, +0xe6d3, 0xce7b, 0x47d7, 0x0a5d, 0xd7d4, 0x39c7, 0x074e, 0xa273, 0xfc77, 0x1fef, +0xbcf9, 0x0cec, 0x426a, 0xd4f2, 0x044f, 0x3d93, 0xc6ea, 0xbcdf, 0x2bd1, 0xed0b, +0xce10, 0x43d0, 0x0ca2, 0xd5d2, 0x35c4, 0x0c15, 0xa646, 0xfa2d, 0x2097, 0xc0dd, +0x0c2b, 0x439b, 0xdc9c, 0x059f, 0x3b30, 0xca4a, 0xbbcb, 0x2337, 0xe7a3, 0xc717, +0x3dae, 0x1491, 0xdc09, 0x3229, 0x0f3e, 0xac38, 0xf62a, 0x25d7, 0xcda9, 0xe86a, +0x0ccd, 0xe87d, 0x2a51, 0x46ee, 0xea42, 0xe40d, 0x22b1, 0xd631, 0xa84b, 0xf868, +0xe4f9, 0xdc35, 0x395d, 0x50be, 0x1fd6, 0x25ac, 0x1e57, 0xc641, 0xc358, 0xd0f2, +0xac56, 0xf1aa, 0x385d, 0x08e0, 0x0c0c, 0x6c90, 0x3d9a, 0xd534, 0xf575, 0xf32f, +0xb660, 0xc715, 0x00c3, 0x060a, 0x1cc0, 0x3bee, 0x0fef, 0x2648, 0x390e, 0xe520, +0xcaa4, 0xfc07, 0xfa8c, 0xcfc3, 0xff3b, 0x2146, 0x0eaa, 0x22f7, 0x21eb, 0x22a5, +0x2b3f, 0x140f, 0xd035, 0xce0d, 0x018b, 0xcdfd, 0xe402, 0x4024, 0x35a0, 0x11b4, +0x30f7, 0x48c6, 0xfc36, 0xe429, 0xd9e4, 0xb819, 0xe9ae, 0xecf6, 0xeaac, 0x339b, +0x5af6, 0x18c2, 0x0a7d, 0x49f9, 0xfaf8, 0xba8d, 0xd5ae, 0xd0dc, 0xd43b, 0xee6d, +0x117b, 0x23d1, 0x46ee, 0x29ad, 0x0339, 0x3a96, 0x1314, 0xc110, 0xbad0, 0xd9cf, +0xd706, 0xcd74, 0x0d91, 0x315e, 0x3f9c, 0x359b, 0x2190, 0x2aef, 0x0433, 0xcdb2, +0xa574, 0xc711, 0xe12e, 0xcf40, 0x197f, 0x5324, 0x3d77, 0x20a5, 0x375c, 0x2d03, +0xe262, 0xca54, 0xb0b0, 0xc640, 0xed6e, 0xe3a9, 0x14a7, 0x559a, 0x4789, 0x0af5, +0x2c0d, 0x3078, 0xd574, 0xc8f1, 0xc60c, 0xc4a3, 0xddbb, 0xf434, 0x12bf, 0x3a4f, +0x46b5, 0x0de9, 0x28f8, 0x3a3e, 0xd862, 0xb36e, 0xc4b9, 0xd290, 0xcc9e, 0xf150, +0x28e5, 0x36b7, 0x3727, 0x1942, 0x296a, 0x1f3b, 0xd304, 0xaa50, 0xb7e0, 0xe064, +0xcd60, 0xe774, 0x36d2, 0x4354, 0x256f, 0x16b9, 0x32a9, 0x04e9, 0xc94b, 0xbd89, +0xb4e8, 0xde63, 0xe6b3, 0xefc2, 0x2c99, 0x4d30, 0x244c, 0x0dd9, 0x4013, 0x0a25, +0xbf81, 0xc647, 0xc8d3, 0xd098, 0xddd7, 0x0729, 0x2f46, 0x49fe, 0x3186, 0x11dd, +0x33c9, 0x0a1a, 0xc455, 0xb4fe, 0xcbf9, 0xe01f, 0xd9c3, 0x0d63, 0x3ca9, 0x40e4, +0x2597, 0x1f85, 0x2fee, 0xf6c7, 0xc763, 0xb733, 0xcbd2, 0xe734, 0xe337, 0x11ef, +0x4379, 0x4377, 0x1865, 0x216c, 0x32c8, 0xee0c, 0xca47, 0xc04a, 0xd076, 0xe70b, +0xebed, 0x16a9, 0x3f81, 0x44ae, 0x16f6, 0x2266, 0x31f0, 0xe6d6, 0xc30d, 0xc333, +0xd87e, 0xe495, 0xf14b, 0x1f91, 0x3ab4, 0x3a37, 0x1822, 0x291b, 0x2bcf, 0xea2c, +0xc762, 0xbf57, 0xdd08, 0xe181, 0xec7b, 0x28f2, 0x456d, 0x366d, 0x1d72, 0x3891, +0x2266, 0xe229, 0xcd55, 0xbe26, 0xdad8, 0xe6b2, 0xf1ad, 0x2a59, 0x4ce7, 0x346f, +0x18da, 0x3eb3, 0x1a5c, 0xd0e6, 0xc45c, 0xbfe1, 0xd4d3, 0xe11f, 0x014a, 0x2f81, +0x4863, 0x3408, 0x1268, 0x31f4, 0x0ec8, 0xca3c, 0xb9fc, 0xc1dc, 0xdd52, 0xe093, +0x05ff, 0x33c3, 0x43d7, 0x2da7, 0x1671, 0x2bf0, 0x0034, 0xc97d, 0xb0c3, 0xbe5e, +0xe43b, 0xdb68, 0x0387, 0x3ae6, 0x3ee7, 0x1b43, 0x174b, 0x2d76, 0xf26e, 0xc68d, +0xb289, 0xbb76, 0xe0fe, 0xde57, 0x0305, 0x3b0e, 0x44f7, 0x17e8, 0x1ae0, 0x2e9e, +0xe6b9, 0xc23e, 0xb5b3, 0xbe35, 0xde8a, 0xe55c, 0x0e04, 0x3e2d, 0x4749, 0x1891, +0x1cce, 0x2c46, 0xe31a, 0xbc10, 0xb2be, 0xc7d4, 0xe1b0, 0xec58, 0x1b5f, 0x42a4, +0x4577, 0x18af, 0x206d, 0x2610, 0xe0cf, 0xbee7, 0xb63b, 0xd3ec, 0xe4ab, 0xed6c, +0x253f, 0x4a99, 0x42a8, 0x18da, 0x2a90, 0x2130, 0xd967, 0xc013, 0xb623, 0xd3d0, +0xe7d4, 0xf7c7, 0x2d1b, 0x4df4, 0x3dfe, 0x18d3, 0x2e94, 0x12e1, 0xceb7, 0xbc8b, +0xb721, 0xd9e6, 0xe7b6, 0xfe42, 0x37c7, 0x5256, 0x3916, 0x14fa, 0x2b19, 0x0829, +0xcbbc, 0xbc11, 0xba4e, 0xe0c8, 0xec3c, 0x04ba, 0x39d7, 0x4f48, 0x314f, 0x1b2a, +0x320f, 0xfbd4, 0xc7ad, 0xbe46, 0xbcb0, 0xdfec, 0xea9d, 0x0a76, 0x3eae, 0x51ce, +0x28b8, 0x15c7, 0x32b1, 0xf736, 0xc436, 0xbbe2, 0xc2bd, 0xe357, 0xecf4, 0x10c4, +0x40f6, 0x524e, 0x25cd, 0x19ce, 0x301e, 0xec1e, 0xbc6a, 0xbace, 0xd1d8, 0xe825, +0xec23, 0x1b1b, 0x4400, 0x482a, 0x1bce, 0x1896, 0x260d, 0xe7f6, 0xc325, 0xb5e4, +0xd101, 0xeabf, 0xea0d, 0x1d52, 0x47b3, 0x3cf0, 0x1282, 0x235d, 0x2050, 0xd9ae, +0xc4d9, 0xb970, 0xd086, 0xe87d, 0xea86, 0x1b23, 0x48b1, 0x3c02, 0x0e92, 0x2cb2, +0x2472, 0xd2cb, 0xbff8, 0xbc43, 0xce22, 0xe2d3, 0xf745, 0x2364, 0x47bb, 0x3e11, +0x1209, 0x2f53, 0x1fb0, 0xcfac, 0xba0d, 0xbeea, 0xd8e3, 0xde1c, 0xf854, 0x2f24, +0x49ea, 0x387f, 0x14be, 0x2de7, 0x1304, 0xd01b, 0xb948, 0xbc56, 0xe0d1, 0xe484, +0xff93, 0x3655, 0x488a, 0x2bf5, 0x16ba, 0x3637, 0x07aa, 0xcf32, 0xc24d, 0xc063, +0xe449, 0xe713, 0x01e8, 0x3b25, 0x4f83, 0x26c5, 0x1640, 0x3ab8, 0xff8c, 0xc83c, +0xbf7c, 0xc052, 0xdf32, 0xe807, 0x09ef, 0x390f, 0x4d01, 0x25f5, 0x19b1, 0x3685, +0xf201, 0xbb2e, 0xb561, 0xc59a, 0xdeac, 0xe81d, 0x110d, 0x2f0d, 0x5faf, 0x5bc4, +0x12fe, 0xf615, 0xda50, 0xa9ae, 0x886f, 0xcd18, 0x0718, 0x09f1, 0x5bb7, 0x7af7, +0x3e15, 0x0a73, 0xe799, 0xa715, 0x9c71, 0xc971, 0xb0a1, 0x07a7, 0x6f82, 0x3163, +0x2a82, 0x5398, 0x14c9, 0xbfc2, 0xd8b3, 0xd540, 0xc5ce, 0x0fda, 0xf099, 0xf1a7, +0x518e, 0x1c60, 0xcd84, 0x19da, 0x35b8, 0xd346, 0x03a1, 0x377b, 0xdf14, 0xefc5, +0x0c59, 0xc206, 0xc448, 0x2196, 0x11ee, 0xfe70, 0x4f48, 0x1fa8, 0xeb2d, 0x1d5b, +0xeaf2, 0x9f51, 0xdaef, 0x10e0, 0xe2b8, 0x140e, 0x4a7c, 0x0548, 0x11c6, 0x2b5c, +0xd063, 0xb9e9, 0x0c49, 0xee9f, 0xcd6b, 0x32da, 0x2204, 0xe702, 0x2c36, 0x195d, +0xbc4d, 0xef56, 0x1ea6, 0xd1a8, 0xfb24, 0x33f8, 0xe2fa, 0xffb5, 0x3ccd, 0xe4cb, +0xca25, 0x2563, 0x0355, 0xd2da, 0x2bb0, 0x137a, 0xd6ec, 0x2218, 0x1b95, 0xc3b7, +0xf854, 0x3722, 0xe6e8, 0xf671, 0x3596, 0xec18, 0xf030, 0x2d9c, 0xe6e7, 0xc2e9, +0x26d5, 0x1a49, 0xd733, 0x2bbd, 0x26a1, 0xdab2, 0x1ba0, 0x23f0, 0xc355, 0xe703, +0x2bce, 0xdc49, 0xf190, 0x496d, 0xfc6e, 0xf386, 0x3dfc, 0xf7e9, 0xbcff, 0x1444, +0x0996, 0xc579, 0x1fc6, 0x2a9c, 0xe722, 0x261f, 0x2af6, 0xc74c, 0xe3b8, 0x2a8b, +0xe105, 0xe8c4, 0x3bef, 0xfd9f, 0xefc2, 0x313f, 0xf888, 0xbeed, 0x0f0d, 0x10ba, +0xcf13, 0x2814, 0x3a0d, 0xdf51, 0x0dca, 0x2f8f, 0xccfa, 0xc831, 0x1d1f, 0xe940, +0xe8cf, 0x4a93, 0x0d52, 0xef83, 0x3c76, 0xfaba, 0xa5dd, 0x0126, 0x112f, 0xbdc7, +0x1a61, 0x422a, 0xe9fb, 0x1b1a, 0x3694, 0xc9c9, 0xce2b, 0x1ef2, 0xd732, 0xdc7b, +0x46da, 0xff7f, 0xe9fc, 0x46e1, 0x05ac, 0xaeb6, 0x0663, 0x159d, 0xc012, 0x1316, +0x34ba, 0xdd94, 0x12fd, 0x31f6, 0xc596, 0xcbff, 0x2ae2, 0xe4d5, 0xd6c1, 0x4927, +0x0b3d, 0xdd77, 0x3926, 0x07d1, 0xa2d2, 0xfb2e, 0x211d, 0xc317, 0x1769, 0x4b14, +0xe280, 0x1326, 0x411c, 0xc1e2, 0xbac5, 0x2cf6, 0xe603, 0xcb4b, 0x4ed8, 0x191b, +0xe401, 0x458d, 0x1545, 0xac87, 0x005f, 0x1e4a, 0xba9b, 0x0cc0, 0x467e, 0xe1cf, +0x11da, 0x478e, 0xd350, 0xc70d, 0x31c1, 0xf201, 0xce1e, 0x434c, 0x12d6, 0xdd0b, +0x3986, 0x1337, 0xaf6d, 0x006c, 0x2ca7, 0xc8ff, 0x0c23, 0x4bde, 0xe11d, 0x0318, +0x41ef, 0xd0e5, 0xbd29, 0x3042, 0xf8a0, 0xd014, 0x4ad2, 0x1b53, 0xda3d, 0x3aa3, +0x14be, 0xa4bb, 0xf7a1, 0x2b27, 0xc43a, 0x0948, 0x507e, 0xe296, 0x0297, 0x45db, +0xd510, 0xb990, 0x273a, 0xf430, 0xc750, 0x3f4c, 0x1a85, 0xdb6a, 0x3993, 0x1ab4, +0xadf3, 0xf5f6, 0x280d, 0xc5fc, 0xfe8a, 0x4668, 0xe58d, 0x011c, 0x457a, 0xdfc7, +0xbebe, 0x255e, 0xfae1, 0xcb02, 0x3a3a, 0x1b49, 0xd635, 0x2c90, 0x1a6d, 0xb0f1, +0xf0b7, 0x2851, 0xcb11, 0xfd3b, 0x4815, 0xe902, 0xf73a, 0x3af3, 0xde3a, 0xb633, +0x1a27, 0xfae7, 0xc8e7, 0x3373, 0x1efa, 0xdab3, 0x2af8, 0x1f54, 0xb3a4, 0xe5bd, +0x2010, 0xc657, 0xef33, 0x4332, 0xf32a, 0xf8bc, 0x3a43, 0xe716, 0xb380, 0x1025, +0xf94b, 0xbff8, 0x2cbe, 0x2722, 0xd958, 0x2238, 0x24de, 0xb4e0, 0xd8e0, 0x219f, +0xcbf4, 0xec3e, 0x4cc4, 0xf5db, 0xee65, 0x3cb1, 0xe88f, 0xad6b, 0x15fb, 0x0312, +0xbe65, 0x3207, 0x3441, 0xd731, 0x1ee6, 0x2923, 0xb321, 0xd7af, 0x26e1, 0xce3a, +0xeb73, 0x52d6, 0xfb3a, 0xed11, 0x3fa2, 0xeb93, 0xa537, 0x0fde, 0x078b, 0xbcc7, +0x2dd2, 0x39bf, 0xde73, 0x2216, 0x2ba5, 0xb204, 0xd113, 0x2873, 0xd059, 0xe433, +0x5331, 0x00f5, 0xede6, 0x41c9, 0xf3f8, 0xaa8c, 0x0f24, 0x06be, 0xb5e6, 0x29e9, +0x39f4, 0xda5d, 0x25b6, 0x2b84, 0xb07f, 0xd942, 0x36fe, 0xe8ec, 0xcdd1, 0x1733, +0x0849, 0x1aa1, 0x4558, 0xfb48, 0xd3ef, 0x11bd, 0xef48, 0xb142, 0xf697, 0xfdea, +0xd64a, 0x32a6, 0x6fed, 0x25f8, 0x0b17, 0x2a5c, 0xdff3, 0xaef4, 0xd4ec, 0xbcba, +0xe25d, 0x44cb, 0x234b, 0x1321, 0x73ba, 0x4da9, 0xced4, 0xe817, 0x007f, 0xa908, +0xb5df, 0x1df6, 0x1875, 0x0e2c, 0x3ec1, 0x2fcd, 0x272d, 0x2290, 0xe25c, 0xc07e, +0xf134, 0xfb4d, 0xd6f2, 0x0ad3, 0x3447, 0x223c, 0x13f1, 0x2272, 0x269f, 0x025a, +0x0161, 0xd722, 0xd224, 0x0308, 0xde38, 0xef78, 0x3c18, 0x42ed, 0x0555, 0x290a, +0x5400, 0xe6be, 0xca2d, 0xdae9, 0xc68f, 0xd7d0, 0xf47c, 0x10ed, 0x3184, 0x5941, +0x1cf6, 0x0891, 0x3a35, 0xeb6f, 0xae39, 0xc817, 0xe6f7, 0xd6ef, 0xebb0, 0x3372, +0x35f1, 0x34dd, 0x1e90, 0x16f7, 0x21a1, 0xf074, 0xc287, 0xb8c4, 0xe82d, 0xe6eb, +0xdb90, 0x1e19, 0x40af, 0x3208, 0x1a9a, 0x320f, 0x1b9a, 0xdeff, 0xcf46, 0xb4a3, +0xcbd7, 0xdf68, 0xe59a, 0x22fe, 0x55b5, 0x3892, 0x0be2, 0x396b, 0x1a98, 0xc635, +0xc146, 0xc092, 0xd361, 0xe7eb, 0x0383, 0x2879, 0x4c6a, 0x3c0d, 0x05ca, 0x2976, +0x14a9, 0xc798, 0xc116, 0xd2d8, 0xdd50, 0xdcd3, 0x0b09, 0x2bce, 0x3653, 0x2ab8, +0x0a52, 0x2aa9, 0x14b7, 0xd401, 0xb890, 0xcc60, 0xea88, 0xd5e4, 0xfe7d, 0x383b, +0x3ade, 0x1b88, 0x1ad7, 0x3ed1, 0x075f, 0xcd9c, 0xbbc4, 0xcbe8, 0xeb85, 0xd822, +0xfbc3, 0x3e44, 0x459b, 0x10ea, 0x17ee, 0x43df, 0xf7f9, 0xc0a0, 0xc419, 0xcf1f, +0xdea4, 0xe05f, 0x0678, 0x330f, 0x42d4, 0x111c, 0x0fba, 0x3f57, 0xf9a8, 0xb669, +0xbe1b, 0xe146, 0xdd9a, 0xd4be, 0x11a3, 0x389d, 0x37d6, 0x13b2, 0x1c70, 0x3370, +0xf10c, 0xc063, 0xb6e6, 0xd48a, 0xdc66, 0xd809, 0x1789, 0x3f92, 0x3566, 0x0e0f, +0x231e, 0x2ea3, 0xde28, 0xbb31, 0xba09, 0xcf05, 0xd866, 0xdfc8, 0x18f1, 0x3ecd, +0x369b, 0x0a8f, 0x2386, 0x2af2, 0xda2a, 0xb79e, 0xb7d0, 0xd687, 0xde35, 0xe721, +0x22ba, 0x4574, 0x3572, 0x0dd3, 0x2e06, 0x263b, 0xd7ab, 0xbfc7, 0xc2f6, 0xdf1b, +0xe1c3, 0xf1d5, 0x2cb4, 0x4e1c, 0x37cd, 0x115d, 0x35cd, 0x1fe6, 0xd779, 0xc301, +0xc58e, 0xe72d, 0xe5ce, 0xf960, 0x335a, 0x4fb4, 0x357b, 0x1898, 0x426e, 0x1cc2, +0xd473, 0xc727, 0xc831, 0xe1fb, 0xe68f, 0x072e, 0x3da1, 0x58d4, 0x39ac, 0x1d25, +0x4338, 0x1401, 0xcf2b, 0xbee6, 0xca41, 0xe875, 0xe64f, 0x1316, 0x4982, 0x5236, +0x2f67, 0x2085, 0x38b8, 0xfd01, 0xc7c8, 0xba93, 0xc979, 0xebc7, 0xea26, 0x168d, +0x477d, 0x4817, 0x212b, 0x1fdd, 0x335a, 0xef3e, 0xc484, 0xb895, 0xc9b8, 0xec42, +0xe805, 0x136b, 0x4a61, 0x4971, 0x17b6, 0x1f6a, 0x2f97, 0xe4b1, 0xc086, 0xb999, +0xcac9, 0xe5fd, 0xee0c, 0x1807, 0x412f, 0x460f, 0x166d, 0x1f4c, 0x29b3, 0xdc64, +0xb965, 0xb861, 0xd211, 0xe147, 0xeb99, 0x2193, 0x450f, 0x3ce4, 0x113e, 0x1f63, +0x1c84, 0xd769, 0xb874, 0xb487, 0xd682, 0xe1c9, 0xed74, 0x24b0, 0x43a4, 0x33ba, +0x0e1c, 0x2413, 0x10f7, 0xcdd3, 0xb977, 0xb8d7, 0xdbc4, 0xe37c, 0xf175, 0x272e, +0x457d, 0x2d0a, 0x07d0, 0x297e, 0x0f41, 0xca51, 0xb9f7, 0xbc9a, 0xdaa7, 0xddfe, +0xf766, 0x2c64, 0x4532, 0x2d7b, 0x0dd9, 0x2cf4, 0x0c17, 0xc90f, 0xb4bc, 0xc07f, +0xe270, 0xdce1, 0xfc63, 0x371a, 0x4749, 0x2579, 0x1187, 0x2dc1, 0xff1f, 0xc7eb, +0xb7f0, 0xc150, 0xe209, 0xe0bb, 0x0562, 0x39a6, 0x419b, 0x18df, 0x11d0, 0x32b0, +0xf640, 0xc162, 0xbaa8, 0xc92a, 0xe355, 0xdf42, 0x07ce, 0x3de6, 0x485f, 0x1a8d, +0x15e0, 0x345d, 0xf2a7, 0xc2b4, 0xbc48, 0xcb43, 0xe331, 0xe771, 0x171d, 0x41c7, +0x46e8, 0x1e6a, 0x1d99, 0x3169, 0xea47, 0xbb34, 0xb612, 0xcfe5, 0xe372, 0xe4f4, +0x1dce, 0x4978, 0x4538, 0x1abb, 0x1ff9, 0x2726, 0xe2ee, 0xbf5a, 0xb642, 0xd6a7, +0xeb65, 0xe981, 0x26c2, 0x5246, 0x3d0f, 0x142e, 0x2f6c, 0x28fc, 0xda88, 0xc3aa, +0xbdbe, 0xd749, 0xeb54, 0xf1e0, 0x25cd, 0x526c, 0x41ba, 0x10bf, 0x2fe6, 0x2449, +0xd374, 0xbfc4, 0xbbe2, 0xd283, 0xe25c, 0xf99f, 0x2cef, 0x4ac7, 0x3ddf, 0x17d9, +0x3082, 0x1925, 0xce89, 0xb6a1, 0xbc50, 0xe283, 0xe474, 0xfd8d, 0x3bcc, 0x4e96, +0x33c3, 0x167a, 0x2e47, 0x0a43, 0xcef1, 0xbc29, 0xba3d, 0xe1a3, 0xe5f7, 0xfe7c, +0x39db, 0x4bea, 0x270e, 0x128b, 0x30de, 0xfb59, 0xc505, 0xbdab, 0xbd60, 0xe0c5, +0xe64a, 0x0171, 0x35c3, 0x47fc, 0x21b5, 0x11b5, 0x30fa, 0xf4fc, 0xc06e, 0xbaa3, +0xbc7a, 0xd83f, 0xe4e1, 0x0b66, 0x373d, 0x497a, 0x2421, 0x109c, 0x26f1, 0xecb6, +0xbadf, 0xb11f, 0xc45d, 0xdf59, 0xe4b2, 0x1641, 0x3f59, 0x42bc, 0x1c1c, 0x129c, +0x1bee, 0xe133, 0xbe64, 0xb1ad, 0xcc9f, 0xec32, 0xe986, 0x19ae, 0x44e5, 0x3a19, +0x0e88, 0x1ade, 0x1f2c, 0xdec4, 0xc3cc, 0xb2ef, 0xdaab, 0xfd08, 0xe6a7, 0x1123, +0x3704, 0x3898, 0x3ad4, 0x346f, 0xfe92, 0xd1d3, 0xcc04, 0x9cbd, 0xc135, 0x02eb, +0xf63b, 0x365b, 0x8b58, 0x58ad, 0x0415, 0x0488, 0xcf1c, 0x8e64, 0xb611, 0xc2c4, +0xeda1, 0x4ea8, 0x63da, 0x49bb, 0x50ec, 0x3618, 0xc859, 0xb818, 0xe010, 0xbc83, +0xd14a, 0x1ad8, 0x32a9, 0x4030, 0x4434, 0x0f51, 0xf80f, 0x1895, 0xeaf8, 0xc48d, +0x175a, 0x2702, 0xe895, 0x0fd2, 0x2756, 0xcf30, 0xdfad, 0x3a11, 0xfb80, 0xfa5f, +0x565f, 0x121d, 0xf290, 0x2352, 0xddf3, 0xa5f4, 0xfe06, 0x187b, 0xde96, 0x3a13, +0x5105, 0xf698, 0x255a, 0x212e, 0xb7a3, 0xc5a7, 0x10d7, 0xdeff, 0xe90b, 0x551a, +0x1708, 0xfd81, 0x42e8, 0xf9ae, 0xb328, 0xf8c8, 0x0cd4, 0xc910, 0x1398, 0x3cf8, +0xe89b, 0x1c9d, 0x36c1, 0xcb0b, 0xcca6, 0x2759, 0xf1e2, 0xd264, 0x3d80, 0x146d, +0xe372, 0x36c2, 0x0ab3, 0xb2ef, 0x0a0e, 0x2e96, 0xc7be, 0x0dcf, 0x4ba5, 0xdcd8, +0xff1f, 0x391f, 0xcf51, 0xc4c3, 0x314b, 0xfef3, 0xd680, 0x41c6, 0x156e, 0xdd3b, +0x2eeb, 0x0886, 0xa9c9, 0xf3a6, 0x247e, 0xc927, 0x069f, 0x4a37, 0xe895, 0x0061, +0x378e, 0xd6a1, 0xb348, 0x1688, 0xf810, 0xc498, 0x323f, 0x1fc5, 0xe066, 0x29b3, +0x139d, 0xadbb, 0xe71a, 0x2c44, 0xcae3, 0xe8e1, 0x3f89, 0xe822, 0xf034, 0x367a, +0xdf30, 0xb32c, 0x1aba, 0x0281, 0xcc1b, 0x36c4, 0x14ca, 0xc6d5, 0x2590, 0x1c08, +0xa351, 0xd7ce, 0x2a74, 0xd59f, 0xf3fa, 0x477e, 0xf4e0, 0xf8ff, 0x3121, 0xdc01, +0xb775, 0x150c, 0xfcd8, 0xcc0d, 0x38c8, 0x2ece, 0xe423, 0x2849, 0x29b5, 0xc302, +0xda74, 0x1f47, 0xdd2f, 0xf247, 0x3ab2, 0xf2d7, 0x006a, 0x4787, 0xf2b8, 0xbc9f, +0x1f1c, 0x0ac7, 0xbde9, 0x23df, 0x2b4d, 0xd869, 0x1cf2, 0x2e59, 0xc8ac, 0xe6ca, +0x2cef, 0xd907, 0xf197, 0x4b23, 0xf20c, 0xef15, 0x4469, 0xf156, 0xb2a9, 0x1bfd, +0x127b, 0xca28, 0x306d, 0x3438, 0xdf08, 0x20cf, 0x27a1, 0xb9c7, 0xd8d7, 0x2741, +0xd309, 0xe588, 0x5056, 0x03d5, 0xef96, 0x4207, 0xfd8d, 0xae5f, 0x03b5, 0x0589, +0xbd38, 0x23af, 0x3a76, 0xe095, 0x2023, 0x3839, 0xc165, 0xd4ca, 0x2de1, 0xd781, +0xe09b, 0x50bd, 0x0340, 0xea0c, 0x4022, 0xf840, 0xad2c, 0x1331, 0x12e3, 0xc260, +0x2f2a, 0x3b6c, 0xd12c, 0x18a4, 0x3197, 0xb77c, 0xd13d, 0x2bd2, 0xd972, 0xe616, +0x52eb, 0x041e, 0xeb26, 0x3bdc, 0xf119, 0xa2b2, 0x06d5, 0x1049, 0xbd97, 0x289f, +0x44ee, 0xdf14, 0x1d7f, 0x34ac, 0xb7bb, 0xc690, 0x278a, 0xda25, 0xdff9, 0x579a, +0x080c, 0xe6ec, 0x4374, 0xfcbd, 0xa5be, 0x078c, 0x146b, 0xbb5b, 0x2164, 0x4262, +0xdc47, 0x1e50, 0x39f8, 0xbce7, 0xcbb4, 0x2afe, 0xdc45, 0xdb5e, 0x5409, 0x0b3a, +0xe53c, 0x4358, 0x02ae, 0xa896, 0x0857, 0x1af8, 0xc23a, 0x2352, 0x496b, 0xdfb5, +0x197e, 0x3ce3, 0xbe54, 0xc506, 0x3012, 0xe677, 0xd704, 0x5217, 0x11ee, 0xe2e7, +0x3fe4, 0x06fa, 0xa5a3, 0xfdcd, 0x181f, 0xbb44, 0x1747, 0x4a1f, 0xdca9, 0x10d6, +0x4291, 0xc4a6, 0xbd25, 0x2a87, 0xe605, 0xcbf6, 0x4b38, 0x15fb, 0xe0ad, 0x3f35, +0x0d36, 0xa652, 0x0068, 0x234a, 0xbde1, 0x11e2, 0x4aeb, 0xdbe0, 0x0a9d, 0x4344, +0xcb41, 0xbfb5, 0x3005, 0xef5d, 0xcc1b, 0x497b, 0x1516, 0xd825, 0x3b8a, 0x1677, +0xabc7, 0xfeb9, 0x2dcb, 0xc484, 0x08d9, 0x4f69, 0xe275, 0x041d, 0x4846, 0xd81a, +0xc055, 0x3307, 0xfcca, 0xce29, 0x4a68, 0x20cb, 0xd8f3, 0x379a, 0x1b24, 0xaf02, +0xfaf5, 0x36a2, 0xdc0c, 0xf2c4, 0x1be5, 0xefab, 0x3121, 0x54a4, 0xf198, 0xe7b1, +0x2ba4, 0xe144, 0xad6e, 0x0105, 0xf0a8, 0xe331, 0x4379, 0x5911, 0x2529, 0x2cc9, +0x279d, 0xcce3, 0xc4aa, 0xd6d0, 0xaebe, 0xee7a, 0x3b83, 0x0e08, 0x0c23, 0x6c6b, +0x4249, 0xd2d0, 0xee99, 0xf0dc, 0xb1d9, 0xc315, 0x0097, 0x05b2, 0x198e, 0x3a21, +0x0a87, 0x19af, 0x3001, 0xda73, 0xbf3b, 0xf320, 0xf1e8, 0xce48, 0xfde9, 0x1c97, +0x092a, 0x1c03, 0x1996, 0x174f, 0x1e06, 0x0784, 0xc7d4, 0xc266, 0xf6c0, 0xcc3e, +0xdd41, 0x35c9, 0x3070, 0x0e9b, 0x2df6, 0x46cc, 0xf777, 0xdb3b, 0xd86d, 0xb2ad, +0xdad5, 0xea97, 0xeb13, 0x2dfd, 0x5bf5, 0x1d45, 0x0c80, 0x4c6b, 0xf9d2, 0xb332, +0xd3b1, 0xcca7, 0xc90a, 0xeeb9, 0x1637, 0x2142, 0x4501, 0x2b65, 0x034c, 0x35ee, +0x0df0, 0xbcaf, 0xb962, 0xda48, 0xd509, 0xd169, 0x125a, 0x2f7e, 0x3ce9, 0x31e9, +0x1f9f, 0x25c3, 0xf9ce, 0xc7fa, 0xa4bc, 0xc4e4, 0xde14, 0xd114, 0x1820, 0x4ec1, +0x3955, 0x1716, 0x2ffb, 0x23e1, 0xd401, 0xc118, 0xaea8, 0xc267, 0xe761, 0xe650, +0x166b, 0x5317, 0x4508, 0x02ef, 0x256f, 0x2a58, 0xc9bf, 0xbfb1, 0xc690, 0xc4c0, +0xdb5a, 0xfc3e, 0x1d56, 0x406f, 0x4672, 0x07f9, 0x258b, 0x3563, 0xd0af, 0xad4b, +0xc62c, 0xd7ec, 0xd118, 0xfacb, 0x32c8, 0x3cf8, 0x3893, 0x1827, 0x2a88, 0x2056, +0xd2e0, 0xa9a8, 0xbc95, 0xe82d, 0xd209, 0xed42, 0x4049, 0x4bca, 0x27a4, 0x17b5, +0x33c7, 0x048c, 0xc896, 0xbbc4, 0xb5e8, 0xde55, 0xe670, 0xf26e, 0x319d, 0x5284, +0x20bb, 0x0a37, 0x3f54, 0x0425, 0xb7b6, 0xbeac, 0xc4a7, 0xd10a, 0xdf90, 0x067a, +0x32d8, 0x4def, 0x29e9, 0x0de0, 0x33b8, 0x00f9, 0xbb53, 0xb44c, 0xca99, 0xdcb3, +0xdf0d, 0x140a, 0x4211, 0x47c0, 0x2741, 0x1ffe, 0x3026, 0xf2ee, 0xc44d, 0xb8c2, +0xcbde, 0xe86b, 0xed77, 0x1b4d, 0x47ee, 0x4766, 0x1ae9, 0x2386, 0x33e9, 0xea57, +0xc4ae, 0xc182, 0xd3ec, 0xeae1, 0xf2fa, 0x1c99, 0x46ce, 0x4849, 0x16e5, 0x2357, +0x2d0d, 0xe171, 0xc2b4, 0xc619, 0xdb43, 0xe861, 0xf96a, 0x2580, 0x41a1, 0x3fcc, +0x14f6, 0x245e, 0x2692, 0xe3d9, 0xc4b2, 0xc084, 0xdcfb, 0xe481, 0xf277, 0x26e8, +0x4453, 0x3677, 0x1401, 0x2eb5, 0x1c61, 0xda3a, 0xc536, 0xbbc2, 0xd95f, 0xe409, +0xf088, 0x24e3, 0x4a50, 0x36ef, 0x1343, 0x3794, 0x1bd7, 0xd0b1, 0xbf04, 0xc0c0, +0xd999, 0xe102, 0xfe57, 0x307b, 0x4c60, 0x3446, 0x110b, 0x34af, 0x1719, 0xd246, +0xbe92, 0xc661, 0xdf01, 0xde95, 0x04b9, 0x34ae, 0x44b2, 0x2c3e, 0x140f, 0x311d, +0x09e5, 0xcd57, 0xb673, 0xc4ea, 0xe8e6, 0xdfae, 0x02f2, 0x3c51, 0x460d, 0x2037, +0x160e, 0x33a4, 0xffd5, 0xd044, 0xbb77, 0xbff6, 0xe547, 0xe2d3, 0x02a5, 0x3927, +0x483e, 0x1e84, 0x18a8, 0x35a4, 0xf428, 0xc4b4, 0xb810, 0xbe31, 0xdf3f, 0xe3b9, +0x070a, 0x3a6e, 0x4a01, 0x1d3d, 0x19b7, 0x312f, 0xe9ed, 0xb9d2, 0xb185, 0xc27d, +0xdf74, 0xeaac, 0x163c, 0x40b2, 0x480f, 0x196b, 0x1a68, 0x2946, 0xe387, 0xbd44, +0xb687, 0xcdd3, 0xe1c0, 0xe73f, 0x19c6, 0x454e, 0x4471, 0x1517, 0x1f37, 0x2415, +0xde12, 0xbc28, 0xb193, 0xce92, 0xe199, 0xeb2a, 0x208d, 0x45c9, 0x3dfd, 0x140f, +0x2554, 0x1b8d, 0xd3e4, 0xb631, 0xaeee, 0xd2a0, 0xe032, 0xeefc, 0x2bad, 0x4d46, +0x3a27, 0x0f3b, 0x24c9, 0x111e, 0xcdbf, 0xb6b5, 0xb194, 0xd7c9, 0xe60a, 0xf93b, +0x2f30, 0x4968, 0x3246, 0x1306, 0x2d46, 0x06e7, 0xc785, 0xba49, 0xb9ab, 0xde3a, +0xe629, 0xff26, 0x3a02, 0x5456, 0x30f0, 0x10ea, 0x3149, 0x0578, 0xc92c, 0xbe07, +0xc00c, 0xe26f, 0xec57, 0x0aaf, 0x3ec0, 0x560f, 0x2fbd, 0x16da, 0x3543, 0xfe12, +0xc441, 0xbe1e, 0xce80, 0xec2a, 0xeeda, 0x1761, 0x467e, 0x531c, 0x2945, 0x16f3, +0x30b3, 0xfa85, 0xc82a, 0xb95b, 0xd0b9, 0xf0bf, 0xecf0, 0x1a23, 0x4acc, 0x48e2, +0x1c65, 0x1e4d, 0x2902, 0xe8e0, 0xc9c2, 0xbc2f, 0xd2c0, 0xf22e, 0xed1c, 0x1844, +0x4b01, 0x4776, 0x146e, 0x2125, 0x2832, 0xde1c, 0xc52b, 0xbd52, 0xcf76, 0xec76, +0xf496, 0x1c9f, 0x4726, 0x432c, 0x116f, 0x25e7, 0x2766, 0xd731, 0xbc99, 0xc162, +0xd7c6, 0xe12d, 0xf3c2, 0x27ac, 0x489f, 0x3fb7, 0x11f9, 0x23e3, 0x1dd1, 0xd9f9, +0xbc81, 0xbc41, 0xe051, 0xe6f9, 0xf6af, 0x2df2, 0x4613, 0x2fe6, 0x12b9, 0x303c, +0x120f, 0xd130, 0xc1da, 0xbc62, 0xdb80, 0xe279, 0xf4be, 0x2c52, 0x4660, 0x275e, +0x0d1c, 0x3149, 0x075f, 0xc931, 0xbf24, 0xbaf3, 0xd888, 0xe2cc, 0xfb8b, 0x2cb6, +0x4a52, 0x29ea, 0x0caa, 0x3097, 0xff78, 0xbdf9, 0xb45b, 0xc1cb, 0xdd4e, 0xe310, +0x068a, 0x24f2, 0x54ac, 0x60d2, 0x1650, 0xf4c6, 0xe059, 0xb014, 0x83b1, 0xbc91, +0x02f9, 0x0157, 0x4fca, 0x7cb3, 0x41bb, 0x0df7, 0xea9f, 0xace6, 0x957f, 0xc6c1, +0xb25c, 0xf25c, 0x6d4a, 0x3c23, 0x2274, 0x5314, 0x2754, 0xc59a, 0xd13d, 0xdf25, +0xc110, 0x097d, 0xfee9, 0xe7e9, 0x4a58, 0x3073, 0xd0cf, 0x0834, 0x3f47, 0xde37, +0xefad, 0x3de0, 0xef24, 0xe80f, 0x1519, 0xd4ff, 0xbae7, 0x160b, 0x1ed5, 0xf6f3, +0x4a32, 0x391f, 0xed02, 0x1a95, 0x0194, 0xa798, 0xcdb4, 0x1870, 0xed7d, 0x0805, +0x5609, 0x1649, 0x0c10, 0x37fb, 0xe698, 0xb602, 0x0ab1, 0x02bc, 0xc982, 0x29a0, +0x3592, 0xeb4c, 0x26a0, 0x2b39, 0xc51e, 0xe028, 0x25df, 0xdd3d, 0xeb89, 0x3c7d, +0xf25b, 0xf2a8, 0x40cd, 0xf67a, 0xbd91, 0x18e1, 0x1367, 0xcbf7, 0x1e2b, 0x2469, +0xd608, 0x16f8, 0x2a0b, 0xc927, 0xe2cc, 0x37b1, 0xf346, 0xe694, 0x382d, 0xf93e, +0xe10a, 0x2a89, 0xf6d1, 0xba9a, 0x1681, 0x2591, 0xd24e, 0x187c, 0x2fad, 0xd8f6, +0x0b46, 0x2ae5, 0xc8c2, 0xd38a, 0x2a7a, 0xe7b1, 0xdcb3, 0x3e95, 0x03d8, 0xe5e1, +0x3718, 0x0451, 0xb6fc, 0x05d7, 0x1636, 0xc589, 0x0c0d, 0x2d31, 0xe2a5, 0x145e, +0x2ff3, 0xd16c, 0xd748, 0x2961, 0xeee4, 0xd89a, 0x2f77, 0x0413, 0xe432, 0x2a18, +0x07e4, 0xbf90, 0xffac, 0x1a5c, 0xce43, 0x0eae, 0x3e2a, 0xe525, 0xfcdf, 0x3412, +0xe19f, 0xc0d0, 0x160c, 0xf679, 0xdaf7, 0x3d0f, 0x184f, 0xe643, 0x3314, 0x0d97, +0xa9d1, 0xf210, 0x1e09, 0xc374, 0x0591, 0x4995, 0xef24, 0x05bf, 0x3aa6, 0xdaf6, +0xc1a1, 0x198b, 0xe5e1, 0xce1f, 0x40dc, 0x134c, 0xddc5, 0x3b68, 0x1d73, 0xb2c0, +0xf385, 0x2228, 0xc6a9, 0xff0d, 0x4056, 0xea16, 0x071a, 0x3ca3, 0xd74b, 0xbcb1, +0x210f, 0xf2c1, 0xcb2c, 0x414d, 0x1f07, 0xd958, 0x2f24, 0x195a, 0xa747, 0xe84d, +0x2605, 0xc501, 0xff0e, 0x4e0a, 0xea48, 0x02a4, 0x46c5, 0xd723, 0xafda, 0x23af, +0xf6a4, 0xbc7c, 0x3c45, 0x26f8, 0xdc74, 0x367d, 0x2543, 0xb0bd, 0xed3e, 0x27e5, +0xc333, 0xf8e2, 0x4d51, 0xeb5f, 0xfefc, 0x4865, 0xe34b, 0xb937, 0x2748, 0x0266, +0xc562, 0x3a6b, 0x25b1, 0xd774, 0x2daa, 0x2313, 0xb311, 0xef4a, 0x32e8, 0xcf60, +0xf8b2, 0x51fb, 0xee07, 0xf368, 0x44ab, 0xe548, 0xb2da, 0x24f2, 0x07b3, 0xc446, +0x3bc4, 0x2db3, 0xd779, 0x2ee4, 0x281e, 0xace1, 0xe4c5, 0x335a, 0xceab, 0xf17b, +0x55c7, 0xf4d4, 0xf24d, 0x4603, 0xeb3d, 0xaf65, 0x1bbf, 0x08f3, 0xbf31, 0x300f, +0x30d1, 0xd9cf, 0x29ba, 0x2ead, 0xb5b6, 0xdd53, 0x2dff, 0xcf0d, 0xe2d2, 0x4b14, +0xf7cf, 0xf104, 0x48fe, 0xf5f9, 0xb102, 0x175c, 0x0bd9, 0xbcb2, 0x27b4, 0x336a, +0xd7be, 0x2088, 0x3408, 0xbf37, 0xdc20, 0x3264, 0xdb9f, 0xe60e, 0x5013, 0xffb1, +0xe856, 0x4281, 0xff01, 0xb10f, 0x1094, 0x176a, 0xc863, 0x243b, 0x390b, 0xdf6d, +0x1d95, 0x3900, 0xc65f, 0xd25c, 0x2c3a, 0xe187, 0xdbeb, 0x465f, 0x0986, 0xeb79, +0x4044, 0x0711, 0xb0da, 0x0496, 0x1513, 0xc287, 0x187b, 0x3c78, 0xe032, 0x1521, +0x3c5f, 0xccc3, 0xcce1, 0x2b96, 0xe4ca, 0xd2ba, 0x430a, 0x0aa2, 0xdffc, 0x3ad9, +0x0be5, 0xaea0, 0x03b6, 0x1ba6, 0xbbed, 0x0db5, 0x4113, 0xdc05, 0x05bb, 0x3a65, +0xcc55, 0xc14b, 0x25ec, 0xe783, 0xd1d2, 0x4965, 0x1616, 0xdbb4, 0x3263, 0x0a8b, +0xa569, 0xf7cf, 0x1f57, 0xc4d2, 0x1559, 0x517f, 0xea47, 0x0848, 0x3a1f, 0xc9f1, +0xbb1e, 0x266f, 0xea60, 0xcd1c, 0x4d59, 0x23a6, 0xe328, 0x3b46, 0x19d2, 0xabe2, +0xf47d, 0x1e1a, 0xbcd3, 0x09ed, 0x4fb3, 0xe964, 0x0dbc, 0x485b, 0xd3bb, 0xbbbe, +0x2722, 0xffc5, 0xce39, 0x0d09, 0xfe2c, 0x112d, 0x596c, 0x16f5, 0xd170, 0x12a7, +0x07ab, 0xa521, 0xd945, 0x0290, 0xcf7b, 0x0c60, 0x5af6, 0x3c64, 0x1c78, 0x2c17, +0xf082, 0xb62e, 0xcf0c, 0xac7d, 0xba75, 0x27ac, 0x23af, 0xf129, 0x473d, 0x6f3b, +0xefd4, 0xd0fc, 0xfcb5, 0xc5fa, 0xa532, 0xe2aa, 0x08ff, 0x0704, 0x304a, 0x21e6, +0x0f85, 0x38c1, 0x010f, 0xbcdf, 0xd894, 0xf8ab, 0xd8c7, 0xe36a, 0x1b7a, 0x178e, +0x1a72, 0x1741, 0x157f, 0x1dd4, 0x0dfe, 0xe47e, 0xbdd3, 0xf139, 0xe9ae, 0xc861, +0x198e, 0x432e, 0x1c93, 0x1246, 0x4ca3, 0x23d4, 0xd5a3, 0xdda1, 0xc097, 0xcd1a, +0xeddd, 0xed1a, 0x1738, 0x5658, 0x41b1, 0xfba0, 0x3319, 0x2a1d, 0xc048, 0xc0cf, +0xd583, 0xd4c9, 0xdb7a, 0x070a, 0x2588, 0x3798, 0x3aa9, 0x0add, 0x25af, 0x2337, +0xd4c2, 0xb504, 0xca8a, 0xe4dd, 0xd039, 0xf1df, 0x2bb9, 0x3c1d, 0x3426, 0x22ac, +0x331f, 0x0f10, 0xdc7d, 0xbbe1, 0xb47c, 0xdb63, 0xd984, 0xfcbd, 0x450f, 0x5431, +0x271a, 0x210b, 0x3c62, 0xf43d, 0xc565, 0xc201, 0xc114, 0xe4f6, 0xee9b, 0x085b, +0x3cf5, 0x5653, 0x1e82, 0x0d52, 0x38a8, 0xf608, 0xc456, 0xce8b, 0xcfd1, 0xda08, +0xf0f6, 0x16f4, 0x3014, 0x4610, 0x1a46, 0x0c35, 0x36d1, 0xfb60, 0xbc9c, 0xbcea, +0xdb0c, 0xda74, 0xdb6c, 0x17ce, 0x3715, 0x33b3, 0x13c8, 0x1e7d, 0x290c, 0xe55b, +0xb756, 0xb135, 0xdad6, 0xde70, 0xd336, 0x1782, 0x43a0, 0x29e5, 0x03f8, 0x2c8f, +0x2768, 0xd396, 0xc0e1, 0xbc23, 0xccce, 0xdf32, 0xe829, 0x16bf, 0x4610, 0x3567, +0x012e, 0x312c, 0x3059, 0xcf4c, 0xbc48, 0xcf7d, 0xdb0c, 0xd4f7, 0xefe3, 0x2327, +0x3f5e, 0x34bf, 0x11d9, 0x3885, 0x2a09, 0xd700, 0xbd59, 0xc753, 0xde26, 0xd765, +0xf612, 0x31cc, 0x45d3, 0x2d56, 0x17c3, 0x3e94, 0x16b7, 0xce82, 0xc389, 0xc8ab, +0xdd9d, 0xdd82, 0xfe36, 0x3550, 0x4d5b, 0x2a45, 0x1384, 0x3ff2, 0x0ef3, 0xc81d, +0xbe61, 0xcce9, 0xe4aa, 0xe0ab, 0x0699, 0x385e, 0x486b, 0x2294, 0x15f0, 0x3d85, +0x01db, 0xc686, 0xc116, 0xcff5, 0xe34d, 0xe14b, 0x10c9, 0x3f07, 0x466b, 0x1f0d, +0x1d05, 0x3ab5, 0xf8ef, 0xc8ce, 0xc05e, 0xd357, 0xe7d4, 0xe29f, 0x13df, 0x471a, +0x4a47, 0x1c4c, 0x297f, 0x3e3f, 0xed74, 0xc6f8, 0xbfdc, 0xccde, 0xe3d5, 0xeaa0, +0x19ee, 0x4b1b, 0x4d49, 0x1865, 0x2976, 0x37a0, 0xe1a2, 0xb9e8, 0xba35, 0xd299, +0xde2b, 0xecfc, 0x27c6, 0x4ae2, 0x4564, 0x19a4, 0x28b5, 0x2426, 0xd885, 0xbc0a, +0xb90e, 0xd777, 0xe284, 0xf34a, 0x2d9a, 0x4813, 0x38b9, 0x14ee, 0x2c67, 0x1894, +0xd324, 0xbc7e, 0xb3bc, 0xda55, 0xe3e2, 0xef0a, 0x2fd7, 0x4da0, 0x2e6a, 0x0ee2, +0x326e, 0x0fc1, 0xcb23, 0xbee7, 0xb82c, 0xdaac, 0xe70d, 0xf676, 0x2c96, 0x4efe, +0x3180, 0x0f59, 0x3430, 0x0900, 0xc464, 0xbdf3, 0xbfd4, 0xdc18, 0xe54f, 0x02ac, +0x346a, 0x4ca2, 0x2bdb, 0x0ba0, 0x2ca5, 0x00e4, 0xc0c2, 0xb4ae, 0xbea2, 0xdd3b, +0xe1b5, 0x05e5, 0x36cd, 0x455d, 0x228c, 0x0f39, 0x2721, 0xf06a, 0xbe3c, 0xb625, +0xc315, 0xe0db, 0xe130, 0x0824, 0x3af9, 0x4450, 0x1a04, 0x1254, 0x2a20, 0xeab7, +0xbec0, 0xb857, 0xc3f1, 0xdf5a, 0xe831, 0x122e, 0x3daa, 0x44fa, 0x18f6, 0x1739, +0x28bb, 0xe41d, 0xbbf3, 0xb89c, 0xcff6, 0xe5c1, 0xea00, 0x1c60, 0x45d5, 0x43ef, +0x1c06, 0x2434, 0x292a, 0xe39e, 0xc2cb, 0xbd71, 0xd5c4, 0xe95c, 0xf5d3, 0x2a36, +0x4b75, 0x403d, 0x1c75, 0x32bf, 0x27ef, 0xdda2, 0xcb76, 0xc7c5, 0xdb1a, 0xe84b, +0xf612, 0x2b74, 0x5112, 0x4137, 0x18a7, 0x3889, 0x2791, 0xd8ed, 0xc90a, 0xc6c8, +0xd83c, 0xe5cf, 0x01d1, 0x32e1, 0x4e08, 0x3e77, 0x1bcc, 0x39cc, 0x1bcb, 0xcf7c, +0xbfad, 0xc693, 0xe1af, 0xe44a, 0x0379, 0x3b80, 0x5122, 0x34da, 0x12cd, 0x2ff7, +0x0b3f, 0xcb7c, 0xb95e, 0xc0f4, 0xe555, 0xe1ce, 0x01a1, 0x3cc9, 0x475e, 0x2196, +0x156a, 0x33d5, 0xf97d, 0xc4c1, 0xb9ed, 0xbd90, 0xe1db, 0xe24b, 0x021d, 0x3cfa, +0x4dca, 0x1ea3, 0x12f7, 0x33e9, 0xf159, 0xbf15, 0xb984, 0xbdf4, 0xd9dc, 0xe483, +0x0d28, 0x3bb5, 0x4aee, 0x1fcf, 0x1792, 0x2e75, 0xe773, 0xb55d, 0xaeed, 0xc525, +0xdc07, 0xe07a, 0x162d, 0x403a, 0x41df, 0x18e6, 0x1816, 0x22ca, 0xe0d7, 0xba3f, +0xab7d, 0xc6d9, 0xe296, 0xe464, 0x1a6b, 0x45ec, 0x3cb4, 0x1203, 0x21d7, 0x1e19, +0xd553, 0xc042, 0xb44a, 0xca17, 0xe29f, 0xe893, 0x1a35, 0x457e, 0x3ca4, 0x0eee, +0x274f, 0x1dc0, 0xd010, 0xbe2a, 0xb43a, 0xca4c, 0xe2e4, 0xf448, 0x246d, 0x4965, +0x3fdb, 0x10f7, 0x25b8, 0x162e, 0xcca7, 0xb882, 0xb947, 0xd7a5, 0xe438, 0xfea1, +0x33b7, 0x4cfe, 0x3b14, 0x1175, 0x24b7, 0x0bf7, 0xcecd, 0xbc06, 0xbdfc, 0xe81e, +0xee24, 0x01b0, 0x3af8, 0x476e, 0x28b0, 0x20d9, 0x3412, 0xf8f1, 0xc8c9, 0xbcf1, +0xbe75, 0xed66, 0xf061, 0x0477, 0x2e04, 0x4a13, 0x58d9, 0x3473, 0x0a86, 0xde23, +0xc927, 0xa391, 0xa85a, 0xfd01, 0x01c0, 0x26a1, 0x8016, 0x6b60, 0x1f2e, 0x05f0, +0xdab1, 0x948b, 0xb8c2, 0xc47d, 0xcb07, 0x3e6c, 0x61b3, 0x38d1, 0x421e, 0x423b, +0xe147, 0xbac6, 0xe0e9, 0xbe22, 0xd9dd, 0x0b3a, 0x03de, 0x31f4, 0x40dc, 0xf8e0, +0xf398, 0x2cdd, 0xec3a, 0xc582, 0x25ea, 0x1c58, 0xd8cd, 0x0700, 0x13d5, 0xbffb, +0xdfbf, 0x2eeb, 0xf5a6, 0x0a90, 0x5506, 0x0dfc, 0xf5d4, 0x194f, 0xd0b1, 0xa469, +0xf944, 0x0659, 0xe225, 0x3e8d, 0x4455, 0xf804, 0x285d, 0x16e8, 0xac54, 0xcbe6, +0x0dc1, 0xcfa2, 0xef3a, 0x51ba, 0x0cea, 0x02d9, 0x4169, 0xec8e, 0xb42c, 0x04b3, +0xfdcb, 0xc5c1, 0x233b, 0x2fa0, 0xe530, 0x27ec, 0x2937, 0xc096, 0xdeaa, 0x2435, +0xe010, 0xe6f7, 0x3e0a, 0xfd91, 0xeb2e, 0x333b, 0xf30c, 0xb2be, 0x1250, 0x1fd9, +0xc7fa, 0x1877, 0x3b5d, 0xdbdb, 0x0644, 0x23bb, 0xbdc0, 0xcc54, 0x2f0c, 0xf1f3, +0xe57b, 0x48e5, 0x082c, 0xe598, 0x360e, 0xf80f, 0xa876, 0x0659, 0x1b42, 0xc57b, +0x1fb9, 0x48cb, 0xe657, 0x1591, 0x3682, 0xcb26, 0xccd4, 0x2692, 0xe8fa, 0xda38, +0x445f, 0x1220, 0xf0e0, 0x3d8f, 0x09d0, 0xb6bc, 0x00e1, 0x260a, 0xd188, 0x0576, +0x3935, 0xef31, 0x1179, 0x33e9, 0xd401, 0xcde0, 0x2d56, 0xfa21, 0xdbb0, 0x4a3c, +0x1c17, 0xdc92, 0x334e, 0x1ceb, 0xb17d, 0xebbf, 0x27e0, 0xd919, 0x0f7e, 0x4a4b, +0xf20c, 0x107b, 0x3a20, 0xcab0, 0xba0a, 0x24cb, 0xf1fa, 0xcaf2, 0x3f6a, 0x2005, +0xe495, 0x30ba, 0x16ef, 0xb7a7, 0xec01, 0x1401, 0xc9b7, 0x05b6, 0x393b, 0xe12d, +0x07bf, 0x44cb, 0xdee8, 0xbd85, 0x23f1, 0xfc20, 0xc5f2, 0x2bd6, 0x194b, 0xdfc0, +0x26e3, 0x160b, 0xba3e, 0xf25d, 0x2457, 0xcdc4, 0x004b, 0x4634, 0xe4dc, 0xf4a7, +0x3d04, 0xdcc3, 0xb397, 0x1fb0, 0x0021, 0xcbc7, 0x37a0, 0x223d, 0xdd2e, 0x2e4a, +0x1e22, 0xae9d, 0xea89, 0x28db, 0xc94f, 0xf4c9, 0x4a0c, 0xf565, 0xfefa, 0x4525, +0xee89, 0xbfb1, 0x1b8b, 0xfa5c, 0xc436, 0x2f51, 0x24ca, 0xdfcd, 0x2cf4, 0x2a31, +0xbd55, 0xe94e, 0x2b96, 0xd147, 0xee2f, 0x4235, 0xf2bf, 0xf601, 0x3b75, 0xe821, +0xb876, 0x1f6c, 0x056a, 0xc597, 0x378b, 0x2e60, 0xd377, 0x1e9d, 0x283c, 0xb892, +0xdee1, 0x2781, 0xd1f0, 0xf4ba, 0x554c, 0x0123, 0xf9be, 0x420b, 0xea52, 0xaa76, +0x121d, 0x04f0, 0xbdca, 0x333f, 0x4315, 0xe753, 0x27d8, 0x325a, 0xb873, 0xd272, +0x2388, 0xcf65, 0xe913, 0x57fe, 0x07f4, 0xf542, 0x4773, 0xf6c7, 0xab18, 0x11a2, +0x0c42, 0xb926, 0x2816, 0x3c96, 0xde7c, 0x28fb, 0x3ab1, 0xb843, 0xd1f6, 0x2e08, +0xd30e, 0xdd67, 0x552d, 0x04b1, 0xe6f1, 0x4408, 0xfac7, 0xa436, 0x0956, 0x1138, +0xb9e0, 0x267a, 0x42e3, 0xd676, 0x199d, 0x3443, 0xb086, 0xc200, 0x28e5, 0xda7a, +0xd827, 0x53d9, 0x0bab, 0xe3c1, 0x40a6, 0xfc98, 0xa29e, 0x018f, 0x1105, 0xb6e7, +0x1b43, 0x498c, 0xdd00, 0x1541, 0x4138, 0xc0de, 0xbf2e, 0x283d, 0xe09c, 0xce50, +0x4aa8, 0x1053, 0xdfdb, 0x3f0a, 0x0676, 0xa0c4, 0xfe21, 0x1b86, 0xb753, 0x10a7, +0x4958, 0xd934, 0x0821, 0x3f0a, 0xc34f, 0xba57, 0x2b9e, 0xe817, 0xc7b8, 0x46a9, +0x0faa, 0xd39d, 0x38e6, 0x0b67, 0x9f2e, 0xfa87, 0x2298, 0xbafd, 0x0a31, 0x466b, +0xd41d, 0xfd51, 0x3a2b, 0xc101, 0xb40d, 0x2b20, 0xef1f, 0xc9c0, 0x46b9, 0x10a8, +0xce9c, 0x3371, 0x097d, 0x9c55, 0xf5c4, 0x3090, 0xd2df, 0xecd4, 0x147e, 0xe806, +0x2e2d, 0x4ebd, 0xe525, 0xe179, 0x26a7, 0xd61d, 0xaa44, 0x0053, 0xe8dc, 0xe136, +0x46b6, 0x57fc, 0x24b5, 0x2da9, 0x235d, 0xcd31, 0xca81, 0xd1c7, 0xaf26, 0xfdb0, +0x3bad, 0x09ac, 0x1da0, 0x74cf, 0x3a9c, 0xd9e6, 0xf662, 0xf1b3, 0xb74e, 0xc78b, +0x079d, 0x1303, 0x25f7, 0x3f88, 0x14f4, 0x2459, 0x2c9b, 0xdd69, 0xc8da, 0xfb0c, +0xfc56, 0xd94a, 0x0b6d, 0x29c0, 0x150a, 0x22e5, 0x1d92, 0x18ef, 0x1cfc, 0x0c23, +0xcdc3, 0xcd7b, 0x0116, 0xd225, 0xea05, 0x3ecf, 0x321c, 0x114b, 0x3429, 0x4818, +0xf80f, 0xe0f6, 0xd86d, 0xb88f, 0xe34c, 0xec85, 0xf335, 0x37f0, 0x5dfb, 0x1c42, +0x11db, 0x4f23, 0xfc26, 0xba44, 0xd5aa, 0xd324, 0xd1fd, 0xf17c, 0x1856, 0x276a, +0x4692, 0x286a, 0x0ba3, 0x3d7b, 0x1150, 0xc1ac, 0xbdf0, 0xe136, 0xd542, 0xcf26, +0x1384, 0x2faf, 0x3870, 0x2e2c, 0x2318, 0x28d4, 0xfdee, 0xcb16, 0xa730, 0xc88d, +0xdb00, 0xceb6, 0x1995, 0x4d9d, 0x384a, 0x1a5c, 0x3253, 0x2473, 0xd8f1, 0xc53c, +0xafa7, 0xc440, 0xe9ed, 0xe807, 0x176e, 0x51f8, 0x4372, 0x074b, 0x2912, 0x2b6d, +0xcf1e, 0xc37a, 0xc518, 0xc3a3, 0xdc9c, 0xfa3e, 0x1a98, 0x40fa, 0x4783, 0x0983, +0x2539, 0x3545, 0xd15a, 0xad3e, 0xc7ca, 0xd8f8, 0xd06d, 0xf96a, 0x3340, 0x3d0f, +0x375f, 0x19a1, 0x2cbe, 0x2480, 0xd619, 0xaa0f, 0xbfde, 0xe9c8, 0xd157, 0xf05e, +0x42af, 0x4a8c, 0x2ada, 0x1e55, 0x372a, 0x09e1, 0xcd35, 0xbbbe, 0xb8fb, 0xe193, +0xe480, 0xf329, 0x3476, 0x51aa, 0x233d, 0x1102, 0x44ce, 0x08c4, 0xbbca, 0xc158, +0xc692, 0xd1e1, 0xdde2, 0x0656, 0x33cd, 0x4f74, 0x2ddc, 0x0f4d, 0x394e, 0x09e6, +0xbe5c, 0xb5ad, 0xcc4d, 0xdc27, 0xdab2, 0x1043, 0x3ea4, 0x479b, 0x2b41, 0x1d61, +0x308b, 0xf8bb, 0xc464, 0xb735, 0xcd64, 0xe75e, 0xe437, 0x161f, 0x4870, 0x48ad, +0x1c9b, 0x1ea2, 0x33d1, 0xf0d7, 0xc828, 0xc0cf, 0xd2aa, 0xe99c, 0xeb83, 0x1a23, +0x47fe, 0x4a7b, 0x1905, 0x1e38, 0x324a, 0xe958, 0xc1e9, 0xc325, 0xd7e4, 0xe635, +0xf2dc, 0x2267, 0x3faa, 0x415f, 0x1a59, 0x202f, 0x2852, 0xe889, 0xc4bd, 0xbe6c, +0xdab6, 0xe56a, 0xef10, 0x26eb, 0x4556, 0x3a6e, 0x180a, 0x2a09, 0x1fb9, 0xde8b, +0xc5cf, 0xb9e8, 0xd7a7, 0xe7b9, 0xedd9, 0x2300, 0x49df, 0x37d1, 0x12a8, 0x2f9a, +0x18aa, 0xce1b, 0xbdb0, 0xbc6b, 0xd29e, 0xdeee, 0xf71a, 0x2781, 0x45f4, 0x339d, +0x0ccf, 0x2b8f, 0x12d6, 0xc8e8, 0xb6b6, 0xbda1, 0xd3af, 0xd912, 0xfe42, 0x2d6d, +0x3ef8, 0x304b, 0x1689, 0x29cf, 0x067c, 0xcba1, 0xb57d, 0xbede, 0xdf90, 0xdc36, +0xfffb, 0x3465, 0x3c40, 0x2128, 0x1a44, 0x31e1, 0xfd23, 0xcc9c, 0xbac3, 0xbc48, +0xdd17, 0xde23, 0xfd31, 0x3137, 0x4362, 0x1eee, 0x18fc, 0x32b8, 0xf20e, 0xc5cc, +0xbb44, 0xbdcc, 0xd9bd, 0xe2e3, 0x076b, 0x353c, 0x4892, 0x1e7b, 0x18f6, 0x30cf, +0xea76, 0xbae7, 0xb387, 0xc4fa, 0xdcc0, 0xe7b8, 0x15fe, 0x3d5b, 0x45ed, 0x199f, +0x192d, 0x2670, 0xe39c, 0xbd23, 0xb49a, 0xce79, 0xe000, 0xe7b3, 0x1c0b, 0x42fb, +0x4231, 0x1500, 0x214f, 0x24b7, 0xddd0, 0xbdaf, 0xb443, 0xd1d6, 0xe488, 0xf035, +0x248c, 0x481a, 0x412e, 0x17e3, 0x2a09, 0x1e55, 0xd730, 0xbb6d, 0xb458, 0xd6fe, +0xe4f4, 0xf65d, 0x30dd, 0x50e1, 0x3ee0, 0x15ff, 0x2a77, 0x133f, 0xd208, 0xbb41, +0xb5d0, 0xdc9b, 0xea0f, 0xfe2e, 0x33e8, 0x4ec6, 0x3729, 0x17b0, 0x327e, 0x0ae7, +0xcbb1, 0xbd40, 0xbbb0, 0xe021, 0xe92f, 0x0274, 0x3a54, 0x53fa, 0x3201, 0x1417, +0x340a, 0x073d, 0xcaf8, 0xbd21, 0xbddc, 0xdfe9, 0xebda, 0x0cee, 0x3df0, 0x5410, +0x3025, 0x16c7, 0x32e0, 0xfb90, 0xc1f6, 0xbac8, 0xcb01, 0xe852, 0xeb00, 0x14bb, +0x4362, 0x4e09, 0x267e, 0x175e, 0x2ea6, 0xf673, 0xc679, 0xb7ca, 0xce42, 0xef38, +0xea88, 0x19da, 0x4c19, 0x4976, 0x1f9b, 0x2155, 0x2984, 0xe747, 0xc939, 0xbc60, +0xced0, 0xf05b, 0xef4a, 0x1a1b, 0x4d06, 0x49db, 0x1707, 0x21a4, 0x261f, 0xdb58, +0xc42f, 0xbd07, 0xcd03, 0xeb57, 0xf6f1, 0x1fe4, 0x4885, 0x45cb, 0x1391, 0x2121, +0x232c, 0xd7ec, 0xbd29, 0xbf59, 0xd799, 0xe575, 0xf6b7, 0x28c6, 0x4774, 0x3e39, +0x1137, 0x1ef7, 0x1744, 0xd610, 0xbc35, 0xb9e4, 0xdd70, 0xe860, 0xf41e, 0x2929, +0x4423, 0x2e1c, 0x110a, 0x2d77, 0x0e41, 0xced2, 0xc1cd, 0xbb1d, 0xd9b8, 0xe41e, +0xf4ed, 0x2b8f, 0x4959, 0x2b92, 0x0f36, 0x32ac, 0x0962, 0xc983, 0xc063, 0xbadd, +0xd65d, 0xe557, 0xfe42, 0x2c4a, 0x49b0, 0x2cc4, 0x11af, 0x335e, 0x0099, 0xbfb6, +0xb950, 0xc282, 0xda13, 0xe2c3, 0x0c6b, 0x2301, 0x3d0d, 0x5b32, 0x2bf1, 0xf816, +0xd811, 0xc694, 0x94e5, 0xa76b, 0x02b3, 0xf90f, 0x23f0, 0x863b, 0x6a8b, 0x1164, +0xf826, 0xd412, 0x8d7c, 0xade7, 0xbb44, 0xce06, 0x446e, 0x60cd, 0x37d3, 0x464b, +0x4603, 0xdb1a, 0xadc9, 0xd748, 0xbb79, 0xd2d1, 0x0130, 0x0928, 0x3b0a, 0x4390, +0x0002, 0xef18, 0x25c7, 0xf662, 0xbcac, 0x1201, 0x1f14, 0xda32, 0xff28, 0x1fbe, +0xd1ed, 0xd6db, 0x389e, 0x0dbf, 0xf3fb, 0x488e, 0x1c7e, 0xe70e, 0x1374, 0xed9e, +0xa6a3, 0xedff, 0x24fa, 0xe3d7, 0x2454, 0x55ff, 0xfbf6, 0x19ad, 0x27e2, 0xbe48, +0xc206, 0x1296, 0xe45b, 0xdd35, 0x4db6, 0x1c33, 0xef46, 0x4348, 0x0b24, 0xb5eb, +0xf732, 0x126a, 0xcd2b, 0x063c, 0x37c5, 0xec01, 0x18d9, 0x3cc8, 0xd616, 0xd2bc, +0x273a, 0xf84b, 0xd381, 0x30e7, 0x1385, 0xdff9, 0x30f4, 0x18b0, 0xc10e, 0x0696, +0x364d, 0xd762, 0xfbf8, 0x3d8c, 0xe397, 0xf63d, 0x3932, 0xe0e0, 0xc7fb, 0x31c6, +0x0e47, 0xd472, 0x33f1, 0x19cb, 0xd9b6, 0x297e, 0x174d, 0xb770, 0xf385, 0x2b80, +0xd844, 0x020b, 0x44ae, 0xecdc, 0xffc6, 0x3c84, 0xe59b, 0xc239, 0x1b9c, 0x03d8, +0xcdfc, 0x284d, 0x2050, 0xe856, 0x29ba, 0x1da6, 0xc79c, 0xf13e, 0x2a8b, 0xdb89, +0xe7cf, 0x315a, 0xf321, 0xf5f9, 0x332c, 0xf230, 0xc508, 0x1566, 0x093d, 0xce9a, +0x23e7, 0x1dac, 0xd1bc, 0x1aa1, 0x2c3b, 0xbf9a, 0xd5cb, 0x286f, 0xe374, 0xeccb, +0x3bb8, 0xfa4b, 0xf5e8, 0x2f2d, 0xe9fe, 0xbb23, 0x0ce2, 0xff3a, 0xc469, 0x2484, +0x2c01, 0xe186, 0x1b3d, 0x26db, 0xc966, 0xd43c, 0x0cf6, 0xd3cc, 0xeaf1, 0x349d, +0xf49e, 0xfa1b, 0x3da3, 0xf2ae, 0xb5a2, 0x09f1, 0x0303, 0xbee6, 0x1c15, 0x2f77, +0xe137, 0x187e, 0x2a96, 0xc3d0, 0xd414, 0x1e88, 0xd685, 0xe774, 0x4a59, 0xfa19, +0xe6e2, 0x3f71, 0xf365, 0xa657, 0x0aac, 0x0b27, 0xbbf9, 0x22a4, 0x3896, 0xdde2, +0x1ea6, 0x2ddb, 0xb6a3, 0xcf13, 0x234d, 0xd209, 0xdfcd, 0x4de4, 0x0530, 0xf235, +0x458e, 0xfe1c, 0xaf9c, 0x04ff, 0x0ba8, 0xc04a, 0x1dfe, 0x3a8f, 0xe44e, 0x1ebd, +0x3786, 0xc838, 0xd340, 0x2d49, 0xe462, 0xdc75, 0x4606, 0x05e5, 0xe8d6, 0x3e07, +0x0367, 0xb349, 0x0d09, 0x1be3, 0xc56a, 0x2148, 0x4004, 0xd8d7, 0x1595, 0x3a7d, +0xc56d, 0xd126, 0x3261, 0xe7bb, 0xe124, 0x5308, 0x0eb8, 0xeb26, 0x437a, 0x042c, +0xaf26, 0x0eb2, 0x218d, 0xc6ad, 0x22c2, 0x4ab9, 0xe2d2, 0x1874, 0x40cd, 0xca8d, +0xc838, 0x2e68, 0xedb9, 0xd7fa, 0x4c7a, 0x1526, 0xe7cb, 0x4150, 0x0c9e, 0xae99, +0x0430, 0x20bb, 0xc1b5, 0x1187, 0x47d4, 0xe4da, 0x1440, 0x42ec, 0xcdff, 0xc6df, +0x2c13, 0xec08, 0xd2d5, 0x46ed, 0x0ef1, 0xdd36, 0x3d9e, 0x0f6f, 0xadf9, 0x0331, +0x2434, 0xc516, 0x0f43, 0x4485, 0xde32, 0x0700, 0x3d61, 0xce91, 0xbeff, 0x2926, +0xf4fa, 0xd134, 0x41a9, 0x1664, 0xdc49, 0x34e2, 0x1333, 0xace3, 0xf361, 0x1f70, +0xc693, 0x0699, 0x47e9, 0xe934, 0x0537, 0x4024, 0xd7ae, 0xba09, 0x1da8, 0xf1cd, +0xcbb4, 0x3981, 0x188e, 0xddeb, 0x326b, 0x1892, 0xb095, 0xf130, 0x20bc, 0xc29d, +0xf9a7, 0x3f9b, 0xe3d4, 0xfb7a, 0x3e64, 0xdf3d, 0xbe59, 0x2395, 0xf6d6, 0xc4b9, +0x3386, 0x1936, 0xd767, 0x2b7a, 0x1dd1, 0xb547, 0xeefe, 0x2814, 0xcaa5, 0xf817, +0x487c, 0xeb89, 0xf26b, 0x397c, 0xdf7f, 0xb39b, 0x1c04, 0xfe68, 0xc54d, 0x349f, +0x2a68, 0xdbdd, 0x22d6, 0x1ddd, 0xb0a0, 0xe0fa, 0x21cc, 0xc993, 0xf898, 0x52ec, +0xf689, 0xf70a, 0x426a, 0xe741, 0xaf61, 0x151d, 0xf921, 0xc0cc, 0x3886, 0x3002, +0xdf54, 0x2dc5, 0x25fe, 0xb022, 0xe019, 0x2b01, 0xdc46, 0xdf34, 0x113b, 0xf3ef, +0x2b9e, 0x5380, 0xf6a9, 0xdedb, 0x2143, 0xe2d9, 0xa1ed, 0xf09b, 0xf0dc, 0xdb67, +0x3407, 0x5e55, 0x32ca, 0x27e1, 0x25c5, 0xd709, 0xc36a, 0xcfc9, 0xa7f8, 0xea51, +0x3bd7, 0x0e16, 0x0801, 0x6978, 0x4f5b, 0xdcee, 0xefc1, 0xfe47, 0xbe36, 0xbc03, +0xf6fb, 0x0a54, 0x1b49, 0x3bd0, 0x15ec, 0x2382, 0x3cb2, 0xeb19, 0xc5aa, 0xedb7, +0xf957, 0xd7a6, 0xf768, 0x22e7, 0x17a3, 0x2061, 0x1ba7, 0x1fd9, 0x23d8, 0x0c01, +0xd667, 0xc4b5, 0xfb1e, 0xd994, 0xd7e9, 0x3398, 0x3e92, 0x166b, 0x27af, 0x4ec2, +0x0515, 0xd7d3, 0xde1a, 0xb994, 0xdcbe, 0xf079, 0xeced, 0x2d31, 0x5f61, 0x253a, +0x040a, 0x4aa6, 0x0dcf, 0xb7f1, 0xcf3e, 0xd1b1, 0xcf61, 0xe63f, 0x105c, 0x26cc, +0x431a, 0x31ef, 0x089d, 0x3279, 0x1505, 0xc9c8, 0xbc77, 0xd253, 0xdbe3, 0xd185, +0x028c, 0x2ef7, 0x3d5b, 0x2ff3, 0x2436, 0x2ecc, 0xffae, 0xd27d, 0xae72, 0xb7bb, +0xda8b, 0xd2ea, 0x0b5f, 0x4d03, 0x43e6, 0x19f3, 0x2a63, 0x2e3d, 0xdc83, 0xc2d3, +0xb8a6, 0xbf1e, 0xe681, 0xe9fe, 0x0c02, 0x47ed, 0x4b9b, 0x0b96, 0x1c09, 0x3193, +0xdad3, 0xc2e7, 0xcba3, 0xc7a2, 0xd979, 0xf765, 0x1768, 0x34eb, 0x4272, 0x0e6d, +0x1cba, 0x35bf, 0xe2f7, 0xb4ec, 0xc2dc, 0xdbc9, 0xd4b0, 0xeaf5, 0x2a04, 0x3d45, +0x3135, 0x163c, 0x29bf, 0x1de9, 0xd862, 0xb512, 0xbc25, 0xe60f, 0xdb2d, 0xe4e1, +0x2e4c, 0x46ed, 0x2280, 0x0c95, 0x3390, 0x0dba, 0xc912, 0xc227, 0xbe99, 0xd9c1, +0xe290, 0xed33, 0x2239, 0x44f4, 0x1ed4, 0x0166, 0x3720, 0x122c, 0xc1e5, 0xbe0b, +0xcc00, 0xd5f1, 0xd17f, 0xf3b3, 0x23a2, 0x3db4, 0x2624, 0x0cc4, 0x33e1, 0x1023, +0xc9ae, 0xb631, 0xc8cd, 0xdd8a, 0xceea, 0xfaf7, 0x3621, 0x3ded, 0x1ca5, 0x1b0d, +0x3ba6, 0x0216, 0xce92, 0xc394, 0xc90e, 0xdd1a, 0xd9c7, 0x0438, 0x3a3b, 0x43f5, +0x193b, 0x1b93, 0x427f, 0xfe8c, 0xc66d, 0xc591, 0xd58c, 0xe393, 0xe1bc, 0x0fe2, +0x3df6, 0x448e, 0x1c8a, 0x21c0, 0x3e71, 0xf9bd, 0xc96f, 0xc456, 0xd5d9, 0xe4b5, +0xe922, 0x1ce5, 0x418b, 0x417b, 0x1d09, 0x2518, 0x341d, 0xf03a, 0xcbea, 0xc1e1, +0xd6e8, 0xe7f3, 0xe55f, 0x1d2e, 0x4954, 0x3f9e, 0x1b23, 0x31e7, 0x3163, 0xe580, +0xcb7b, 0xbe90, 0xd27b, 0xe98e, 0xede5, 0x22f3, 0x51cc, 0x440f, 0x174a, 0x3744, +0x308b, 0xdab4, 0xc2e8, 0xc03f, 0xd50d, 0xe3f9, 0xf766, 0x2e0e, 0x4fbc, 0x4269, +0x17f2, 0x2ec2, 0x1f55, 0xd524, 0xbca2, 0xbb93, 0xda21, 0xe34e, 0xfad1, 0x31b6, +0x47da, 0x36e7, 0x19ff, 0x2ef6, 0x0ef3, 0xd0a0, 0xb94c, 0xb54a, 0xdd97, 0xe171, +0xf86b, 0x35bc, 0x47ba, 0x2983, 0x1694, 0x3324, 0x023b, 0xc961, 0xbc03, 0xb2d4, +0xd7d9, 0xe2e7, 0xf9f7, 0x3391, 0x4b1a, 0x23f3, 0x1255, 0x2f9f, 0xf2dd, 0xbf1b, +0xb8c8, 0xb595, 0xd67b, 0xe49e, 0x04eb, 0x3553, 0x491e, 0x20bc, 0x101c, 0x2d09, +0xefb9, 0xbc9b, 0xb456, 0xbc74, 0xdcb8, 0xe7e3, 0x1085, 0x3e2d, 0x4862, 0x20a4, +0x178e, 0x24e7, 0xe5be, 0xbfc5, 0xb5ac, 0xc6ce, 0xe4c1, 0xe9df, 0x156b, 0x41e6, +0x4347, 0x169b, 0x1dcf, 0x2537, 0xdbdb, 0xbd60, 0xb4ac, 0xc74f, 0xe58f, 0xf1d1, +0x1bdb, 0x438d, 0x41e3, 0x1215, 0x1c5f, 0x197b, 0xd34e, 0xbb05, 0xb7f2, 0xd3b2, +0xe362, 0xf0f9, 0x2581, 0x46a8, 0x3c22, 0x115f, 0x2009, 0x122f, 0xd304, 0xbd34, +0xb54b, 0xd890, 0xe911, 0xf7d8, 0x2be6, 0x4644, 0x3124, 0x11c4, 0x2d7b, 0x0ee0, +0xcfc2, 0xc445, 0xbf59, 0xdf01, 0xe6a3, 0xf6fe, 0x2fa7, 0x4f24, 0x32c6, 0x10fe, +0x360f, 0x14d0, 0xd1fe, 0xc5f6, 0xc3cd, 0xdf16, 0xe84d, 0x00f9, 0x3302, 0x4f34, +0x330f, 0x190f, 0x3c38, 0x0f70, 0xcd2f, 0xc1c9, 0xccf8, 0xe5e1, 0xe528, 0x0d0a, +0x3fdc, 0x4c89, 0x2965, 0x1572, 0x3558, 0x0773, 0xcf30, 0xbe56, 0xcfa1, 0xeeb4, +0xe390, 0x0d40, 0x446b, 0x47d6, 0x22c9, 0x1f4d, 0x33f7, 0xf611, 0xcd9c, 0xbd57, +0xc66d, 0xec7d, 0xe7bf, 0x0df9, 0x474d, 0x4b43, 0x1b2f, 0x1f2d, 0x35f1, 0xea3c, +0xc455, 0xbc6b, 0xc16f, 0xe41e, 0xef9d, 0x16e5, 0x457b, 0x4d9b, 0x1df1, 0x2052, +0x310e, 0xe35e, 0xbd3b, 0xbe4a, 0xd17b, 0xe63a, 0xf0dd, 0x2445, 0x4bde, 0x4c1f, +0x20d2, 0x25a1, 0x2da1, 0xe9a8, 0xc288, 0xb909, 0xd9c6, 0xee3e, 0xf6a6, 0x2ef9, +0x50a3, 0x43ee, 0x1dd3, 0x2eed, 0x2309, 0xe027, 0xcabc, 0xbd16, 0xdbde, 0xee25, +0xf339, 0x2c27, 0x5390, 0x40a0, 0x1b96, 0x375c, 0x1d2b, 0xd734, 0xc78b, 0xb807, +0xd541, 0xecee, 0xfe54, 0x2fa0, 0x5361, 0x3f28, 0x1522, 0x3393, 0x1266, 0xc88d, +0xbc85, 0xb8d2, 0xd4a8, 0xe5ab, 0x0438, 0x3396, 0x4c0c, 0x33cd, 0x0a79, 0x2169, +0xfe45, 0xc2f1, 0xb2f9, 0xb954, 0xe0e9, 0xe165, 0x029e, 0x2aa5, 0x318e, 0x465f, +0x33d0, 0x0444, 0xd0f3, 0xc734, 0xa46c, 0x9309, 0xec1b, 0xfbdf, 0x010e, 0x6440, +0x7e13, 0x1ed8, 0xeedd, 0xe7dd, 0x9c36, 0x94bd, 0xaeea, 0xb4e6, 0x08d9, 0x4ccc, +0x44d3, 0x3995, 0x43b3, 0xfbc8, 0xa9f8, 0xbc47, 0xb7e9, 0xb05c, 0xd4b9, 0x0205, +0x2fad, 0x38f1, 0x145d, 0xf759, 0x0aec, 0xf6cf, 0xb93a, 0xdb0a, 0x14b9, 0xe52f, +0xdb64, 0x2275, 0xfc04, 0xc169, 0x1482, 0x2708, 0xda58, 0x13ad, 0x34f3, 0xe68c, +0xf5c6, 0x0b27, 0xbfca, 0xc11f, 0x1a39, 0xf895, 0xf15a, 0x535e, 0x1fbe, 0xfd1c, +0x2fab, 0xeb46, 0xb207, 0xf114, 0xfe7d, 0xd0f4, 0x2a5f, 0x4be3, 0xf98f, 0x2db3, +0x365b, 0xcbe5, 0xd12f, 0x160e, 0xe93e, 0xe29c, 0x4478, 0x1d6f, 0x0413, 0x49f1, +0x0cdb, 0xc582, 0x08ff, 0x1ce3, 0xd295, 0x10d4, 0x44fb, 0xeff9, 0x15bb, 0x4310, +0xddfd, 0xd8c9, 0x34f7, 0xfaaf, 0xd716, 0x4457, 0x1cff, 0xe28a, 0x3514, 0x1237, +0xb5a9, 0x01cc, 0x3075, 0xd90a, 0x1130, 0x4b8f, 0xf1cd, 0x0fee, 0x37f4, 0xcf77, +0xc32c, 0x262d, 0xfb1f, 0xde11, 0x4cfa, 0x220f, 0xe7b6, 0x379f, 0x1630, 0xb473, +0xeb2b, 0x1f40, 0xcdde, 0xfb49, 0x44ba, 0xf7a8, 0x0b44, 0x3ad4, 0xdf56, 0xbc11, +0x192e, 0xfdae, 0xc1e6, 0x2be2, 0x260a, 0xe13b, 0x285b, 0x1e09, 0xb912, 0xe471, +0x2223, 0xd36d, 0xfe2f, 0x46c5, 0xe36b, 0xf7a8, 0x4755, 0xdf55, 0xa7b3, 0x1a23, +0x0b84, 0xc893, 0x2faf, 0x2991, 0xe2bb, 0x2481, 0x13cb, 0xb383, 0xe0a3, 0x1702, +0xc7e4, 0xf45d, 0x4b67, 0xf6a6, 0xf97a, 0x3e6f, 0xecd9, 0xadf3, 0xfeb4, 0xfd06, +0xc788, 0x1f7a, 0x200a, 0xe5ba, 0x31ba, 0x2511, 0xb3da, 0xe100, 0x2776, 0xc990, +0xe1ba, 0x44f0, 0xef0a, 0xe6e3, 0x3c2c, 0xf024, 0xb397, 0x1376, 0x054e, 0xc2a5, +0x2c7f, 0x2067, 0xc5d1, 0x227f, 0x2507, 0xa6ee, 0xd8b4, 0x2da2, 0xd0d2, 0xe5d2, +0x4ae3, 0xf3c8, 0xec01, 0x3d1d, 0xe4c8, 0xa76d, 0x0cd7, 0x02fe, 0xc051, 0x2a3f, +0x2ff4, 0xd96d, 0x206e, 0x2cdb, 0xbcc2, 0xcfce, 0x1d9e, 0xd936, 0xe286, 0x3c62, +0xf899, 0xf161, 0x4188, 0xfacc, 0xb89c, 0x13b2, 0x0f18, 0xbfc2, 0x1908, 0x2b9b, +0xdd40, 0x1c58, 0x31c8, 0xcc18, 0xe1de, 0x3029, 0xe1a2, 0xeab8, 0x4814, 0xf8bb, +0xec3b, 0x41cd, 0xfd3d, 0xbb42, 0x1ab1, 0x1bc5, 0xd03f, 0x2b94, 0x39e6, 0xe56b, +0x20f6, 0x302f, 0xc7e3, 0xe07e, 0x304b, 0xe35d, 0xef37, 0x556b, 0x0a77, 0xf3f3, +0x471e, 0x0715, 0xb6bf, 0x0a15, 0x15a7, 0xc8f0, 0x27ce, 0x49e1, 0xef3f, 0x24d8, +0x3fc8, 0xcf85, 0xd3a9, 0x2981, 0xe391, 0xe1e2, 0x5568, 0x1a44, 0xf6f8, 0x47a5, +0x0bb1, 0xb4f6, 0x0758, 0x180f, 0xc264, 0x1c7f, 0x4997, 0xe7b6, 0x1790, 0x3eec, +0xcc71, 0xc989, 0x25c5, 0xe0ff, 0xd5eb, 0x4cb5, 0x1585, 0xe9fb, 0x3f4e, 0x079f, +0xa4e8, 0xf8b6, 0x18b7, 0xbe0e, 0x140f, 0x4dcd, 0xe6f8, 0x106e, 0x3e48, 0xc659, +0xb8d1, 0x1fc6, 0xe2f7, 0xcafc, 0x4b21, 0x1aac, 0xddf9, 0x38ef, 0x0d86, 0xa172, +0xefb8, 0x1ae3, 0xb8b9, 0x022b, 0x4952, 0xe3b7, 0x0763, 0x3fb6, 0xcaa1, 0xb546, +0x2034, 0xe7b3, 0xc26e, 0x4341, 0x1b44, 0xd872, 0x37f9, 0x158c, 0xa302, 0xed16, +0x212e, 0xbda6, 0x0112, 0x4eb5, 0xe481, 0x0180, 0x448c, 0xd2be, 0xb34a, 0x2659, +0xf969, 0xc3e7, 0x4253, 0x2498, 0xd3ac, 0x2f84, 0x1c93, 0xa86a, 0xeae4, 0x2be9, +0xc824, 0xfb1e, 0x5254, 0xeb1f, 0xf85a, 0x40c6, 0xd602, 0xacc6, 0x20d2, 0xfcc1, +0xbfa1, 0x3d9b, 0x2b83, 0xd669, 0x2fcc, 0x202d, 0xa65f, 0xe170, 0x2e20, 0xdd4c, +0xe4e8, 0x1128, 0xe9c6, 0x2b2e, 0x54f5, 0xec68, 0xd881, 0x25b3, 0xe44f, 0x9e7f, +0xf130, 0xeb8e, 0xd492, 0x3413, 0x5451, 0x26e6, 0x289d, 0x2623, 0xcf51, 0xbd9d, +0xcfb5, 0xa20d, 0xdfe7, 0x36b7, 0x0cc4, 0x056d, 0x65fe, 0x4dbe, 0xdc03, 0xeb0b, +0xf3c5, 0xb95e, 0xbfab, 0xf463, 0x0575, 0x1cd4, 0x3d59, 0x1332, 0x1c9e, 0x36b2, +0xe6ff, 0xc1d2, 0xebab, 0xf875, 0xd9ed, 0xf751, 0x1ec8, 0x177a, 0x1fdf, 0x14b0, +0x158a, 0x1d8b, 0x09a1, 0xd3cc, 0xc301, 0xfa03, 0xda41, 0xd913, 0x31d2, 0x3bcd, +0x1398, 0x2276, 0x47f0, 0x04ad, 0xdb13, 0xde05, 0xbc40, 0xe0b4, 0xf233, 0xedf8, +0x2b4d, 0x5c62, 0x258d, 0x04db, 0x4756, 0x0b9d, 0xbaa9, 0xd2dc, 0xd3e6, 0xd2e5, +0xeb10, 0x1044, 0x260b, 0x4492, 0x307c, 0x0989, 0x37e3, 0x1952, 0xc9b1, 0xbe5d, +0xd980, 0xdd51, 0xcfb1, 0x0665, 0x3440, 0x3f66, 0x32e5, 0x2caa, 0x3828, 0x04a2, +0xd6f3, 0xb98c, 0xc152, 0xdc75, 0xd7fc, 0x131d, 0x50a8, 0x4584, 0x218f, 0x39e9, +0x3a8c, 0xe3c0, 0xca56, 0xc147, 0xc3c0, 0xe3a0, 0xec33, 0x13df, 0x4aaa, 0x4c83, +0x117c, 0x2896, 0x399a, 0xdc86, 0xc6f6, 0xcd47, 0xc6ce, 0xd9cc, 0xf86e, 0x19ad, +0x3a91, 0x491f, 0x123e, 0x24d9, 0x3cde, 0xe11b, 0xb37c, 0xc2df, 0xd7a4, 0xd130, +0xef29, 0x2c49, 0x3d20, 0x37d9, 0x16ea, 0x291c, 0x26ac, 0xda1f, 0xaaed, 0xb607, +0xe686, 0xd568, 0xe17d, 0x337f, 0x4b43, 0x2881, 0x1389, 0x38c7, 0x12c8, 0xcd26, +0xbcc3, 0xb56e, 0xdd1b, 0xe483, 0xea42, 0x2a90, 0x51ed, 0x261e, 0x0805, 0x4126, +0x1494, 0xbddc, 0xbaf3, 0xc450, 0xd324, 0xd5cd, 0xf712, 0x2ef6, 0x4d20, 0x2af3, +0x0e0c, 0x3762, 0x0ac6, 0xbe79, 0xae49, 0xc076, 0xd8d1, 0xd3ec, 0x0029, 0x3a43, +0x4756, 0x22ca, 0x1958, 0x35d2, 0xf721, 0xbeb2, 0xb3fe, 0xbef0, 0xda1f, 0xdc92, +0x07d3, 0x4050, 0x4bd0, 0x19d3, 0x154a, 0x3522, 0xefeb, 0xbbc4, 0xb715, 0xc994, +0xdf48, 0xe0b3, 0x1046, 0x40b6, 0x462c, 0x16f6, 0x1aab, 0x3230, 0xe981, 0xbd2a, +0xbab3, 0xd2a2, 0xe5c9, 0xe97f, 0x1c0b, 0x466f, 0x4272, 0x167d, 0x2642, 0x3042, +0xe930, 0xc684, 0xbe13, 0xdccc, 0xed63, 0xea9d, 0x2413, 0x5441, 0x43f9, 0x180c, +0x36e2, 0x2e3f, 0xdd7b, 0xc957, 0xc358, 0xdaa2, 0xeec1, 0xf6ba, 0x27c0, 0x5560, +0x448c, 0x1635, 0x38ef, 0x285a, 0xd524, 0xc336, 0xc6ef, 0xdd82, 0xe86a, 0x024a, +0x3514, 0x5243, 0x4024, 0x1679, 0x30ad, 0x19cb, 0xd2e3, 0xbea4, 0xc57f, 0xe4e0, +0xe5d6, 0xfff4, 0x3873, 0x4af7, 0x2f8e, 0x188b, 0x3243, 0x0881, 0xcd5e, 0xbb93, +0xbf31, 0xe52f, 0xe3f9, 0xfc94, 0x39c7, 0x4714, 0x1d41, 0x169d, 0x38c9, 0xfecd, +0xcb1a, 0xc0fc, 0xbdbe, 0xdc75, 0xe1b5, 0xfaa7, 0x3213, 0x48a1, 0x1b68, 0x15dc, +0x3a99, 0xf55f, 0xc01b, 0xbf71, 0xc2a6, 0xd4e4, 0xdf4d, 0x066a, 0x3170, 0x40f1, +0x1a26, 0x18e0, 0x342c, 0xedf9, 0xba41, 0xb3b4, 0xc38e, 0xd795, 0xe02b, 0x10cf, +0x387d, 0x3bf9, 0x151b, 0x1afe, 0x254b, 0xde99, 0xbc43, 0xb3bd, 0xc921, 0xde4a, +0xe189, 0x1332, 0x3ec6, 0x3af6, 0x0d82, 0x1fcf, 0x23ba, 0xd6bf, 0xb847, 0xb180, +0xcc73, 0xe0cc, 0xeb2b, 0x1cb5, 0x417e, 0x395b, 0x0e37, 0x260e, 0x1c37, 0xceea, +0xb693, 0xb466, 0xd44d, 0xde55, 0xeccf, 0x28e9, 0x4c64, 0x3a26, 0x1085, 0x2a16, +0x12d5, 0xcc04, 0xb7f6, 0xb4e4, 0xda25, 0xe424, 0xf801, 0x3387, 0x4c82, 0x2ff0, +0x133d, 0x33da, 0x0a6a, 0xc653, 0xba9f, 0xb9a4, 0xdb0d, 0xe2d3, 0xfd70, 0x3932, +0x535b, 0x2ec6, 0x131d, 0x36f2, 0x041c, 0xc4de, 0xbc13, 0xbb88, 0xdb49, 0xe632, +0x0792, 0x3bf9, 0x5215, 0x2df5, 0x197b, 0x38ba, 0xfc1c, 0xc000, 0xb9c1, 0xc559, +0xe3b9, 0xea55, 0x13bb, 0x45e0, 0x506f, 0x2598, 0x1a8a, 0x31d4, 0xf25d, 0xc2c1, +0xb752, 0xc926, 0xeaa3, 0xebad, 0x18ac, 0x4b3a, 0x4b14, 0x1dc9, 0x246e, 0x2f24, +0xe2ff, 0xc4be, 0xbca8, 0xccb7, 0xee7a, 0xf1d7, 0x1fad, 0x5446, 0x4e8c, 0x1a55, +0x2bfd, 0x2de3, 0xdbcc, 0xc7c4, 0xc19e, 0xcdf0, 0xeebf, 0x0347, 0x2b46, 0x50aa, +0x4efc, 0x1ae7, 0x2bc2, 0x29fc, 0xd661, 0xbcdd, 0xc496, 0xddc3, 0xe917, 0xff6c, +0x336f, 0x4f83, 0x433f, 0x1820, 0x2877, 0x176c, 0xd63d, 0xbf37, 0xbd41, 0xe3e4, +0xec70, 0xfccc, 0x35e8, 0x4cad, 0x2f68, 0x12a7, 0x2fac, 0x08d7, 0xcd76, 0xc4f5, +0xbf59, 0xdfbb, 0xe9f3, 0xfd34, 0x3194, 0x4aa3, 0x2767, 0x0f36, 0x33c2, 0x0048, +0xc54f, 0xc2fd, 0xbd10, 0xd605, 0xe41c, 0xff51, 0x2a83, 0x4801, 0x28e6, 0x0aff, +0x2f62, 0xfdb7, 0xbd39, 0xb775, 0xc18e, 0xd7dc, 0xe021, 0x0a7d, 0x33af, 0x423a, +0x2081, 0x0d26, 0x28f2, 0xf6aa, 0xc604, 0xb20f, 0xca22, 0xf929, 0xe0c9, 0xfe41, +0x2c91, 0x285c, 0x3479, 0x40e1, 0x11dd, 0xd23c, 0xd207, 0xa861, 0xa807, 0xfe96, +0xf904, 0x0d6b, 0x7934, 0x78f8, 0x0f08, 0xfce1, 0xe859, 0x8e1b, 0xa714, 0xc4a3, +0xd05d, 0x3229, 0x6379, 0x4af3, 0x48ea, 0x4a2d, 0xe67d, 0xa875, 0xd782, 0xc120, +0xb7cb, 0xfb9f, 0x1f2e, 0x34e8, 0x4bf0, 0x20cd, 0xf0b2, 0x1643, 0x0563, 0xbcd0, +0xf27f, 0x2741, 0xe7cd, 0xef58, 0x2d5f, 0xebc6, 0xc657, 0x2de0, 0x1cb6, 0xe47e, +0x4360, 0x2d6e, 0xe23e, 0x16ee, 0xf98d, 0xa445, 0xddbb, 0x207f, 0xe2c0, 0x123e, +0x5bce, 0x016d, 0x1099, 0x3582, 0xc93d, 0xb242, 0x0573, 0xeaa3, 0xcd42, 0x3ec8, +0x2edf, 0xedf6, 0x39f9, 0x19b8, 0xb85b, 0xe3bc, 0x1369, 0xd1a8, 0xf1db, 0x3e71, +0xf679, 0x05fa, 0x4211, 0xe5a8, 0xbfbb, 0x17fb, 0x0686, 0xc767, 0x1e4b, 0x24e5, +0xdea8, 0x2460, 0x26bf, 0xbfbf, 0xebef, 0x3662, 0xdb5b, 0xe735, 0x478f, 0xf36f, +0xe6aa, 0x3a12, 0xedab, 0xb885, 0x2168, 0x1a11, 0xd137, 0x2b7c, 0x29a9, 0xd6be, +0x2004, 0x24d0, 0xb744, 0xddad, 0x2f52, 0xe201, 0xeeef, 0x4b3b, 0xfc02, 0xef7b, +0x3d92, 0xf6b9, 0xb6be, 0x0b17, 0x0d77, 0xc534, 0x191c, 0x30b3, 0xe945, 0x23b0, +0x2f3b, 0xc9bb, 0xd7dc, 0x269c, 0xe46c, 0xd902, 0x3766, 0x0212, 0xeb25, 0x39af, +0x03e0, 0xb8e7, 0x077c, 0x169d, 0xcc6f, 0x1b10, 0x2e0e, 0xd19a, 0x0fd8, 0x38f6, +0xca91, 0xc8f9, 0x29d6, 0xf078, 0xdd5c, 0x3b96, 0x09ef, 0xf001, 0x3507, 0xfbb1, +0xb660, 0x03d5, 0x0e0a, 0xc387, 0x17f0, 0x3e5b, 0xe93c, 0x15a4, 0x38a5, 0xd46a, +0xc5fe, 0x1360, 0xe4bc, 0xda9b, 0x39bc, 0x0c8d, 0xef2a, 0x3f9f, 0x0fdb, 0xb193, +0xf8d2, 0x1694, 0xb855, 0xffea, 0x4558, 0xed39, 0x083b, 0x3cd1, 0xda45, 0xc36d, +0x1e6e, 0xe476, 0xc765, 0x430f, 0x19a5, 0xde45, 0x3c55, 0x16d3, 0xa619, 0xf171, +0x1f0a, 0xbe1b, 0x04f9, 0x4d9d, 0xeec4, 0x0d1f, 0x3e78, 0xccbe, 0xb49f, 0x1d9b, +0xeb29, 0xc2b6, 0x448d, 0x28e1, 0xe2a4, 0x3aab, 0x21b9, 0xad2c, 0xe5d9, 0x1d14, +0xbe21, 0xf5ec, 0x4db1, 0xef99, 0x030b, 0x4e45, 0xe3cc, 0xb105, 0x20c5, 0xfc50, +0xb9ac, 0x35e2, 0x2898, 0xd9cf, 0x3397, 0x236d, 0xace6, 0xea90, 0x2c38, 0xc65d, +0xf7eb, 0x5313, 0xe39f, 0xf211, 0x477a, 0xdbe9, 0xad7a, 0x1ffa, 0x0017, 0xc201, +0x3906, 0x27ff, 0xd56a, 0x2d70, 0x20b7, 0xa843, 0xe22b, 0x2d3a, 0xc8d1, 0xeff9, +0x5809, 0xf171, 0xf1ca, 0x4aa1, 0xe752, 0xa7f6, 0x1531, 0x03a8, 0xbd38, 0x3515, +0x35e4, 0xd873, 0x2cec, 0x2fa3, 0xaedb, 0xd92e, 0x2cc6, 0xccea, 0xe531, 0x5116, +0xf947, 0xf6dd, 0x4ce8, 0xef45, 0xaeac, 0x190f, 0x0bfc, 0xbc68, 0x2afb, 0x3612, +0xd723, 0x2687, 0x3899, 0xbdfb, 0xda26, 0x3069, 0xdbaf, 0xe6bf, 0x5016, 0x0057, +0xf1d5, 0x480e, 0xf64b, 0xad29, 0x13a0, 0x16f4, 0xc33e, 0x2614, 0x4041, 0xe193, +0x201a, 0x3648, 0xc1be, 0xd35e, 0x2aee, 0xe031, 0xe3b6, 0x52de, 0x0b18, 0xedc3, +0x4b67, 0x084a, 0xaf95, 0x0ccc, 0x1af7, 0xc089, 0x19da, 0x4369, 0xe6d2, 0x1d97, +0x422d, 0xcfe2, 0xd1f7, 0x2e93, 0xe6d4, 0xd904, 0x4acc, 0x0d46, 0xe47d, 0x425b, +0x0eb4, 0xb1bb, 0x06af, 0x2009, 0xc469, 0x12a4, 0x3fee, 0xdd98, 0x0e0f, 0x3d40, +0xcdb1, 0xc9b2, 0x2f38, 0xedc8, 0xcf7d, 0x42ef, 0x1026, 0xd9af, 0x3710, 0x1033, +0xad12, 0xfd62, 0x2285, 0xc358, 0x0c72, 0x48be, 0xe51c, 0x0a9a, 0x2ff8, 0xbdc8, +0xc28d, 0x2cc9, 0xfec9, 0xc7ca, 0x13e5, 0x17e1, 0x02ca, 0x35c6, 0x0fac, 0xcd93, +0xf8c0, 0xfbac, 0xbba6, 0xe67f, 0x0735, 0xd6a6, 0x1bde, 0x7350, 0x2eb9, 0xfad9, +0x2334, 0xeee4, 0xa104, 0xc9e5, 0xcf89, 0xd376, 0x2f8b, 0x2f58, 0x13f9, 0x6199, +0x5172, 0xd760, 0xdae6, 0x0109, 0xaaab, 0x9f01, 0x11f6, 0x1c74, 0xff8b, 0x303b, +0x3d89, 0x2a49, 0x1900, 0xe5d6, 0xbb94, 0xe00a, 0xeeb6, 0xce23, 0x0253, 0x3291, +0x20e8, 0x0d77, 0x2650, 0x2ac1, 0xf46d, 0xf971, 0xdbe5, 0xc599, 0xf13a, 0xdd86, +0xebfb, 0x30a4, 0x422d, 0x0726, 0x20e1, 0x53cf, 0xe990, 0xbf8d, 0xd717, 0xc738, +0xcc12, 0xed69, 0x1207, 0x2679, 0x4b59, 0x2072, 0x0f6e, 0x3b3c, 0xef93, 0xaf82, +0xc07e, 0xdcf5, 0xccea, 0xe17b, 0x31b5, 0x3ad1, 0x3673, 0x24ae, 0x1fad, 0x2260, +0xf0dd, 0xc29e, 0xb494, 0xe43c, 0xe377, 0xdb2b, 0x2318, 0x45fc, 0x34e0, 0x20c4, +0x3ea5, 0x232d, 0xdb31, 0xcc1d, 0xb320, 0xc65a, 0xdf18, 0xea47, 0x25f0, 0x5cd4, +0x4386, 0x10e7, 0x3d78, 0x214b, 0xc538, 0xbca9, 0xbe8b, 0xcd16, 0xe049, 0x05f5, +0x2fe8, 0x5197, 0x45f2, 0x0fc2, 0x2f2f, 0x1971, 0xc5a7, 0xb7fc, 0xca80, 0xd975, +0xd7df, 0x0c99, 0x3a4e, 0x3fc6, 0x30e6, 0x13a0, 0x2b87, 0x0f79, 0xcd82, 0xaf27, +0xc107, 0xe381, 0xd5f3, 0x035c, 0x44e6, 0x44fc, 0x1db9, 0x1e95, 0x3a4e, 0xf713, +0xc17f, 0xb545, 0xc44b, 0xea43, 0xe0b2, 0x034f, 0x458e, 0x4e96, 0x1557, 0x1819, +0x3caa, 0xeb53, 0xb81f, 0xc29d, 0xcb34, 0xd827, 0xea2e, 0x153f, 0x3683, 0x4599, +0x17a8, 0x1025, 0x3238, 0xefae, 0xb3df, 0xb7d0, 0xd811, 0xd6f7, 0xd85a, 0x1792, +0x3a94, 0x35ea, 0x1657, 0x21c8, 0x243d, 0xdfb1, 0xbb30, 0xb0e9, 0xceed, 0xddbf, +0xdff2, 0x1be1, 0x44e0, 0x3265, 0x0879, 0x260d, 0x1f6a, 0xcd4c, 0xba1b, 0xbafd, +0xcb3d, 0xd899, 0xeb07, 0x19d6, 0x3c13, 0x3544, 0x08ed, 0x2407, 0x1daa, 0xcd68, +0xb792, 0xbf01, 0xd1c2, 0xd611, 0xf34b, 0x259b, 0x3b2f, 0x2f39, 0x1053, 0x2d78, +0x1a05, 0xd265, 0xba97, 0xc02a, 0xdab7, 0xd903, 0xf86d, 0x2ff9, 0x403d, 0x28d3, +0x14a1, 0x34af, 0x0a0e, 0xcda4, 0xc3ac, 0xc13a, 0xdd8d, 0xe2ea, 0xfd27, 0x2eb2, +0x45ac, 0x26be, 0x14ec, 0x3dd9, 0x06bc, 0xc81d, 0xc6e2, 0xc719, 0xd8c3, 0xe5c7, +0x0b66, 0x32c9, 0x4b92, 0x2cb4, 0x19ce, 0x3c10, 0x0272, 0xc5eb, 0xbb96, 0xccd7, +0xe07a, 0xdfbb, 0x160a, 0x4341, 0x4749, 0x2676, 0x21c7, 0x2fd3, 0xf0d0, 0xc6ee, +0xb624, 0xcad8, 0xe85f, 0xe7c5, 0x1d81, 0x4b84, 0x45af, 0x1eba, 0x2c0d, 0x30c1, +0xe4ba, 0xca8d, 0xbdbe, 0xcc89, 0xed50, 0xf3dd, 0x2203, 0x5159, 0x4cd1, 0x1b22, +0x2e08, 0x3255, 0xe28f, 0xc7e6, 0xc2e3, 0xd510, 0xe8de, 0xfa14, 0x2846, 0x4a33, +0x4c04, 0x1fed, 0x2f64, 0x2cdb, 0xe195, 0xc51d, 0xc13f, 0xdb62, 0xe696, 0xfa3e, +0x31bd, 0x4d3c, 0x4355, 0x2150, 0x33b3, 0x204a, 0xe0d7, 0xc877, 0xbdd9, 0xdeff, +0xeb46, 0x0024, 0x3a0c, 0x5485, 0x3c57, 0x1fe4, 0x3a57, 0x110e, 0xd1f0, 0xc4f8, +0xbfae, 0xe303, 0xf0e8, 0x0757, 0x3795, 0x525c, 0x364d, 0x163e, 0x3411, 0x078d, +0xc95e, 0xbed3, 0xc146, 0xdd79, 0xe8cb, 0x0fb0, 0x3b8b, 0x4b40, 0x2f52, 0x1708, +0x2c9b, 0xf6f7, 0xc33e, 0xb8f8, 0xc0a0, 0xe27b, 0xe6d8, 0x0c22, 0x3d9b, 0x4878, +0x24a6, 0x186c, 0x2467, 0xe600, 0xc014, 0xb323, 0xbc0b, 0xe0eb, 0xe8da, 0x0f11, +0x3cef, 0x40c5, 0x12df, 0x1430, 0x227a, 0xdb2e, 0xb8c4, 0xb5de, 0xc528, 0xdd7a, +0xe824, 0x13d4, 0x3e15, 0x4384, 0x124e, 0x1469, 0x1e10, 0xd6df, 0xb7fb, 0xb8e3, +0xcdaf, 0xdd42, 0xecbb, 0x1e7d, 0x3c6f, 0x378a, 0x1149, 0x1e8a, 0x1b08, 0xd447, +0xb3c7, 0xb0b3, 0xd341, 0xe16d, 0xebda, 0x22db, 0x4450, 0x345d, 0x0fcd, 0x27aa, +0x137c, 0xcfd2, 0xc241, 0xbb1b, 0xd538, 0xe771, 0xf62c, 0x297f, 0x4c37, 0x3271, +0x103e, 0x360c, 0x143c, 0xc8cb, 0xc2e2, 0xc46f, 0xd919, 0xe83f, 0x0316, 0x2e44, +0x49f7, 0x320d, 0x1102, 0x34eb, 0x0f20, 0xc998, 0xc1e5, 0xc68b, 0xd8b7, 0xe3aa, +0x0e51, 0x3839, 0x473d, 0x306d, 0x1936, 0x313b, 0x023a, 0xca3b, 0xb9cb, 0xc4e8, +0xe9a8, 0xe8e8, 0x0e4f, 0x4390, 0x4a72, 0x23d2, 0x1d52, 0x31ca, 0xf0b0, 0xc813, +0xbd25, 0xc202, 0xe6ea, 0xee18, 0x12c8, 0x4476, 0x4b2e, 0x198b, 0x19a1, 0x2fcc, +0xe518, 0xbf8d, 0xbe9e, 0xcb6d, 0xe622, 0xee0e, 0x167e, 0x3fbf, 0x46fb, 0x1a7d, +0x1f4e, 0x2d08, 0xe17f, 0xbedd, 0xbaa3, 0xcc16, 0xe196, 0xeedc, 0x21cc, 0x44ed, +0x4348, 0x1a18, 0x2363, 0x242e, 0xdc65, 0xbd61, 0xb300, 0xcfa0, 0xe712, 0xe5c7, +0x169f, 0x5f17, 0x7299, 0x2bb1, 0x0b65, 0xe2fd, 0x9b1c, 0xa3b5, 0xaeb5, 0xe147, +0x3787, 0x593a, 0x5290, 0x4a3c, 0x2e69, 0xcbb4, 0xa91f, 0xc5a3, 0xbd85, 0xd07b, +0x1055, 0x3d01, 0x2411, 0x222c, 0x2b1a, 0x0b05, 0xffdc, 0xe3f2, 0xcf8c, 0xf390, +0x15ad, 0xd9f5, 0xc944, 0x2d37, 0x09de, 0xc93f, 0x0d00, 0x229d, 0x0eb5, 0x31fb, +0x193d, 0xdefd, 0x0b6e, 0xe2b8, 0x80c1, 0xd2cb, 0x1719, 0xe9c2, 0x3008, 0x6a8a, +0xfee8, 0x01bc, 0x299a, 0xb39d, 0xa48f, 0x0798, 0xe5e9, 0xddfa, 0x41e1, 0x17dc, +0xf43b, 0x3829, 0x05c3, 0xbd89, 0xf1bc, 0x0dab, 0xcd37, 0xfad8, 0x2e14, 0xf080, +0x107b, 0x24ea, 0xd852, 0xd4a0, 0x17fd, 0xfd24, 0xd818, 0x2b57, 0x168d, 0xdb81, +0x1759, 0x0cdb, 0xc867, 0xf2e6, 0x257d, 0xe349, 0xfff1, 0x39a1, 0xe33d, 0xee45, +0x2b9d, 0xe388, 0xc702, 0x21a8, 0x103e, 0xda0f, 0x2f4b, 0x1b70, 0xd6c1, 0x1b55, +0x104d, 0xb577, 0xe811, 0x28c6, 0xe0aa, 0xfee3, 0x4403, 0xf56f, 0xf711, 0x2c32, +0xe60a, 0xbd96, 0x0d61, 0x048f, 0xce3d, 0x272f, 0x325d, 0xf1c7, 0x2094, 0x1ff0, +0xc860, 0xe30a, 0x2515, 0xdac5, 0xe92d, 0x441f, 0x0548, 0xfb76, 0x3d79, 0xfd5c, +0xbecb, 0x1149, 0x13f9, 0xd214, 0x2a6f, 0x3388, 0xe6f8, 0x2190, 0x2948, 0xc4a5, +0xdd42, 0x2f43, 0xe6af, 0xf03f, 0x54db, 0x13d9, 0xfca6, 0x3215, 0xf506, 0xc57a, +0x12c0, 0x0f9f, 0xd3cc, 0x322e, 0x4301, 0xf273, 0x23ab, 0x356e, 0xd3b2, 0xd051, +0x21b7, 0xf281, 0xecda, 0x4489, 0x12f0, 0x0242, 0x4407, 0x06d1, 0xbafe, 0x0b6c, +0x1d26, 0xc6ee, 0x19bc, 0x44e9, 0xe86d, 0x13b7, 0x39ca, 0xd446, 0xd119, 0x2941, +0xee93, 0xe7c5, 0x4bc2, 0x0643, 0xe908, 0x4535, 0x0444, 0xaaed, 0x0a10, 0x21a1, +0xc807, 0x1964, 0x41d6, 0xe77b, 0x16b3, 0x34e4, 0xc869, 0xc8dc, 0x2196, 0xe4ba, +0xdb97, 0x4973, 0x106a, 0xe7d9, 0x3cc5, 0x0a39, 0xa769, 0xf083, 0x1925, 0xc4c2, +0x075d, 0x3c4a, 0xe3ca, 0x0d28, 0x38d3, 0xc8d1, 0xbd34, 0x29a4, 0xea91, 0xbfc6, +0x3ad0, 0x0fbe, 0xd348, 0x3125, 0x0f03, 0xa6a3, 0xf4e3, 0x222b, 0xbe73, 0x00e2, +0x3cfa, 0xd671, 0xff6d, 0x3893, 0xc753, 0xb6c9, 0x236e, 0xec95, 0xc571, 0x3925, +0x1324, 0xdbd6, 0x2c09, 0x07a8, 0xaa2d, 0xf242, 0x1fa6, 0xc716, 0x042c, 0x441c, +0xe490, 0xffd3, 0x3dc4, 0xdc2a, 0xb9f6, 0x1f30, 0xfbb0, 0xca2e, 0x371c, 0x2003, +0xddf1, 0x31fa, 0x2307, 0xb4d8, 0xf004, 0x2cbc, 0xc878, 0xf7c6, 0x4caf, 0xed6b, +0xfe78, 0x48e2, 0xe5f3, 0xb861, 0x209c, 0xffdd, 0xc990, 0x3a8f, 0x2235, 0xd8df, +0x3307, 0x26fb, 0xb85c, 0xf04e, 0x2cb8, 0xd049, 0xfa7c, 0x49ae, 0xedac, 0xfa25, +0x3f7d, 0xe587, 0xbae6, 0x1de2, 0x03f4, 0xc964, 0x35b0, 0x2bf3, 0xdcc1, 0x287a, +0x2509, 0xb53e, 0xdd34, 0x21f5, 0xd014, 0xf4e6, 0x5327, 0xfbed, 0xf63d, 0x422a, +0xebde, 0xadff, 0x109b, 0x03c0, 0xc66e, 0x34a1, 0x371f, 0xe1e5, 0x266b, 0x298a, +0xb6ec, 0xdb6e, 0x2815, 0xd421, 0xf019, 0x5352, 0xff26, 0xf3f2, 0x43a2, 0xf389, +0xb155, 0x11bc, 0x093e, 0xc3cf, 0x2cd7, 0x37d3, 0xe04d, 0x22e3, 0x2ecd, 0xb8a8, +0xd4f6, 0x2b5c, 0xd879, 0xe9c1, 0x5345, 0x0074, 0xeb1b, 0x3d0d, 0xf0a8, 0xa78e, +0x0f83, 0x1369, 0xc523, 0x2e80, 0x3d4c, 0xdb13, 0x1e41, 0x2ecc, 0xb34d, 0xd013, +0x2f65, 0xd81e, 0xe458, 0x57d2, 0x0406, 0xebe0, 0x457a, 0xf7e1, 0xa66e, 0x0b6f, +0x0e7a, 0xb8d1, 0x251b, 0x3fe1, 0xdd7d, 0x20b9, 0x3687, 0xbb17, 0xd0b9, 0x2e06, +0xd6de, 0xd8c9, 0x50ce, 0x0665, 0xe605, 0x3fce, 0xfc63, 0xac6f, 0x0f4a, 0x249e, +0xcfcc, 0xfc68, 0x0488, 0xeb03, 0x4794, 0x43ec, 0xda83, 0xf3bd, 0x2644, 0xc019, +0xac19, 0xfdb7, 0xdae0, 0xebc8, 0x4a7e, 0x4842, 0x204b, 0x2f4a, 0x0bd7, 0xb466, +0xc7b6, 0xc25a, 0x9ff5, 0xfeaa, 0x3147, 0xf5d6, 0x1606, 0x7098, 0x2536, 0xcb1f, +0xef7c, 0xd8bb, 0xa610, 0xc6a6, 0xf94d, 0x01cf, 0x2326, 0x2e92, 0xfa36, 0x1b23, +0x1fee, 0xc9e0, 0xbf64, 0xf0f7, 0xebf9, 0xcd60, 0xfed7, 0x1727, 0x0a34, 0x1723, +0x0a36, 0x0e7b, 0x18aa, 0xfc64, 0xb854, 0xc985, 0xfdd8, 0xc68b, 0xea58, 0x3e80, +0x2a34, 0x0ba2, 0x2d28, 0x367f, 0xec1b, 0xe1de, 0xce20, 0xb654, 0xf084, 0xed7d, +0xf556, 0x44c2, 0x5de8, 0x118c, 0x103a, 0x43c2, 0xea97, 0xbbb3, 0xd781, 0xd5a7, +0xe105, 0xfd04, 0x1bc6, 0x2dbd, 0x4a4e, 0x2262, 0x090c, 0x37f3, 0x0697, 0xc337, +0xc445, 0xe70d, 0xe217, 0xdb53, 0x1953, 0x38c9, 0x40c1, 0x2ede, 0x22c3, 0x260c, +0xfc8c, 0xcfd4, 0xb0e1, 0xd39e, 0xe34c, 0xdae1, 0x253f, 0x508f, 0x342f, 0x1aa5, +0x3628, 0x1e6e, 0xd753, 0xc9cd, 0xb7c4, 0xd23c, 0xef41, 0xeb30, 0x1cc2, 0x523c, +0x3c38, 0x02b5, 0x29f9, 0x28a2, 0xd759, 0xd1f8, 0xd1bf, 0xd245, 0xe508, 0xfe91, +0x19fc, 0x3b30, 0x3d9b, 0x0a4c, 0x2fd0, 0x37f4, 0xdc8c, 0xbe49, 0xd7b4, 0xe591, +0xd3af, 0xfd0f, 0x3070, 0x36f1, 0x325e, 0x18a4, 0x3386, 0x27ca, 0xdc73, 0xb513, +0xcdc8, 0xf809, 0xd5d9, 0xf013, 0x4334, 0x4964, 0x2395, 0x1b7b, 0x3c5a, 0x0fe4, +0xd7a3, 0xc6c6, 0xc6b6, 0xf0cf, 0xeb7d, 0xf80b, 0x3914, 0x525a, 0x2445, 0x1417, +0x4928, 0x0ff5, 0xc35d, 0xc78a, 0xd244, 0xdff9, 0xe35e, 0x07df, 0x35ae, 0x4ba7, +0x2974, 0x1106, 0x3cf3, 0x0fec, 0xc4b4, 0xb9c7, 0xd562, 0xe489, 0xd970, 0x0e52, +0x3f61, 0x43d6, 0x27aa, 0x2131, 0x364b, 0xfd16, 0xc955, 0xb961, 0xcde0, 0xe8ce, +0xe024, 0x0e4f, 0x4544, 0x4582, 0x18cd, 0x22be, 0x3a77, 0xf22e, 0xc4f3, 0xbabf, +0xcce0, 0xe32e, 0xe352, 0x12f7, 0x43a1, 0x4666, 0x1401, 0x1c0c, 0x30e6, 0xe619, +0xbb56, 0xbb95, 0xd491, 0xe00b, 0xe61a, 0x17a4, 0x3b47, 0x3b00, 0x10e7, 0x1c7e, +0x2707, 0xe361, 0xb750, 0xb2d2, 0xd7be, 0xdb41, 0xe145, 0x2096, 0x40ed, 0x319a, +0x118b, 0x2924, 0x1a2e, 0xd6af, 0xba5f, 0xad6c, 0xd2c9, 0xe064, 0xe67c, 0x25df, +0x4ea4, 0x3357, 0x0fc7, 0x312c, 0x1020, 0xc418, 0xb5ff, 0xb68a, 0xd4f7, 0xe2ef, +0xfb14, 0x2e11, 0x4c3e, 0x3280, 0x08fc, 0x2966, 0x0e36, 0xc69d, 0xb3ba, 0xbf26, +0xde72, 0xe461, 0x0918, 0x3887, 0x4967, 0x313c, 0x1236, 0x2763, 0x0526, 0xcb44, +0xb35a, 0xc8b5, 0xed8f, 0xdf83, 0x05bf, 0x41b2, 0x4548, 0x20ab, 0x1a30, 0x2bd9, +0xf884, 0xce0f, 0xb377, 0xc10c, 0xede8, 0xe5b7, 0x0520, 0x42f2, 0x4b64, 0x19c0, +0x1a50, 0x2fd7, 0xee52, 0xc8d4, 0xbcea, 0xc661, 0xe5d5, 0xe9b8, 0x0e4b, 0x42da, +0x4c23, 0x187a, 0x1ba9, 0x2fdd, 0xe89e, 0xbcad, 0xb84a, 0xd201, 0xe619, 0xeba8, +0x1a61, 0x40ef, 0x41b7, 0x151a, 0x1cbf, 0x2b05, 0xea44, 0xc1f8, 0xbc6c, 0xdb3c, +0xe422, 0xe69f, 0x208e, 0x4881, 0x3cc7, 0x1503, 0x2aa9, 0x27ed, 0xe431, 0xc5cc, +0xbdfa, 0xdd9a, 0xe8e9, 0xf074, 0x2496, 0x4a59, 0x3e74, 0x1374, 0x2e8f, 0x252c, +0xd82c, 0xba66, 0xbeda, 0xe1cc, 0xe3a5, 0xf456, 0x3043, 0x4df4, 0x382a, 0x0d8b, +0x25d9, 0x1516, 0xd249, 0xb805, 0xbbdd, 0xe317, 0xe31f, 0xf717, 0x307f, 0x4438, +0x2ce7, 0x1089, 0x29b8, 0x060d, 0xc757, 0xb6c7, 0xb848, 0xdd4c, 0xde36, 0xf60e, +0x341a, 0x45f6, 0x1fc8, 0x0b03, 0x2ed5, 0xff75, 0xc14a, 0xb3bb, 0xb4dc, 0xd6d2, +0xdc36, 0xfbb0, 0x356c, 0x49c3, 0x2300, 0x0fe9, 0x2f18, 0xf499, 0xb802, 0xb1b2, +0xc06f, 0xdc85, 0xde22, 0x0805, 0x3cc1, 0x488e, 0x1f2e, 0x11d7, 0x2c64, 0xf3b1, +0xbd78, 0xadbb, 0xc5eb, 0xe451, 0xde57, 0x0e82, 0x4140, 0x4137, 0x1916, 0x1b84, +0x28d4, 0xe639, 0xc1a0, 0xb2e7, 0xc697, 0xe4be, 0xdf87, 0x10dc, 0x49b4, 0x457d, +0x1479, 0x2405, 0x2b0f, 0xdcbe, 0xbefc, 0xb3a9, 0xc6dd, 0xe60b, 0xed45, 0x1b13, +0x497b, 0x4531, 0x1324, 0x24b0, 0x243c, 0xd210, 0xb83d, 0xb984, 0xd0bc, 0xe2a6, +0xf3b7, 0x2766, 0x4a82, 0x4204, 0x133f, 0x22b4, 0x1b4e, 0xd4a3, 0xba37, 0xbaaf, +0xdf26, 0xea12, 0xf84b, 0x3177, 0x4e17, 0x39af, 0x193b, 0x308a, 0x13c1, 0xd6b0, +0xc5d3, 0xbffc, 0xe599, 0xeec6, 0xff4d, 0x38ac, 0x5167, 0x346a, 0x1b9d, 0x376a, +0x0ce4, 0xd4a8, 0xc78f, 0xc195, 0xe4f4, 0xf0f5, 0x07bb, 0x3cdc, 0x5981, 0x3510, +0x1b26, 0x3a31, 0x03fb, 0xca72, 0xc53e, 0xcd25, 0xecab, 0xf768, 0x193e, 0x437d, +0x53af, 0x2c6f, 0x15b8, 0x31bf, 0xff10, 0xcc99, 0xc147, 0xd348, 0xee05, 0xee95, +0x1782, 0x2f2b, 0x4b20, 0x5a80, 0x2b14, 0xfd25, 0xdd6a, 0xccb5, 0x9c77, 0xbb91, +0x0abb, 0xfa6d, 0x308d, 0x8b3b, 0x6386, 0x0f1b, 0x0366, 0xd9a6, 0x969a, 0xbb36, +0xbe42, 0xd650, 0x4a43, 0x5e11, 0x39f6, 0x4e5f, 0x3f3f, 0xd1f7, 0xbac7, 0xda01, +0xb75e, 0xdb85, 0x0689, 0x0f50, 0x402d, 0x3a48, 0xf492, 0xf3ba, 0x232e, 0xe3c2, +0xc221, 0x1c7e, 0x103b, 0xda32, 0x0d99, 0x12a9, 0xc374, 0xe4a9, 0x2fee, 0xef59, +0xf571, 0x4551, 0x09ce, 0xee4d, 0x190c, 0xdd87, 0xa5eb, 0xf5c9, 0x0d02, 0xd8dd, +0x32e0, 0x4556, 0xf27b, 0x272d, 0x1a0f, 0xac2d, 0xc929, 0x0d48, 0xd065, 0xe73f, +0x4fb6, 0x0a4b, 0xfcc1, 0x4512, 0xed54, 0xb2b9, 0x0350, 0xfc0b, 0xbed7, 0x1926, +0x2f0c, 0xe1a6, 0x2871, 0x338a, 0xc365, 0xd8fc, 0x2261, 0xe12a, 0xda5e, 0x3836, +0x02a6, 0xeb2d, 0x3c29, 0xfc95, 0xb47f, 0x126c, 0x2240, 0xc4df, 0x1301, 0x42d9, +0xddbd, 0x05c8, 0x2ff4, 0xc609, 0xc9ef, 0x2ebd, 0xf193, 0xda07, 0x46da, 0x0cd3, +0xe052, 0x39eb, 0x0085, 0xa3df, 0xfdbd, 0x1d67, 0xc36d, 0x1321, 0x461a, 0xe3db, +0x121d, 0x3bc5, 0xce7e, 0xc611, 0x1e92, 0xe869, 0xd146, 0x3d6e, 0x12f6, 0xe781, +0x3a2e, 0x100e, 0xb4c0, 0xf87f, 0x2451, 0xce12, 0xfd54, 0x3b61, 0xe9af, 0x0485, +0x363a, 0xd7a5, 0xc531, 0x26b6, 0xfb26, 0xd3af, 0x4024, 0x13d3, 0xcf38, 0x31ca, +0x1fe6, 0xacba, 0xe830, 0x28d0, 0xd67b, 0x03f4, 0x4390, 0xeff5, 0x0d9b, 0x3cdc, +0xd2ef, 0xbce5, 0x1df5, 0xf194, 0xcc0a, 0x3c7b, 0x22be, 0xe9d0, 0x37e4, 0x1f21, +0xbf6a, 0xed14, 0x13f9, 0xccad, 0xfeed, 0x36f2, 0xe931, 0x0bd9, 0x4870, 0xe9a7, +0xc649, 0x2406, 0x009e, 0xc7de, 0x28c6, 0x1d14, 0xe19d, 0x2d2e, 0x24eb, 0xc1ae, +0xf293, 0x2948, 0xd034, 0xfc36, 0x4c80, 0xed33, 0xf76a, 0x4574, 0xe546, 0xb51f, +0x205e, 0x01e4, 0xc8f6, 0x3c9b, 0x2dfd, 0xe000, 0x3231, 0x23e4, 0xac3f, 0xe1e2, +0x2470, 0xc806, 0xf279, 0x51f9, 0xfc93, 0xfd3d, 0x471f, 0xf14b, 0xb564, 0x0d8d, +0xf7a1, 0xbaf7, 0x2ae2, 0x3330, 0xe3cf, 0x2876, 0x2f9d, 0xbe99, 0xd8ed, 0x2066, +0xcc5b, 0xe037, 0x444b, 0xfc55, 0xf1ae, 0x3dee, 0xedb1, 0xa9f3, 0x0f58, 0x052a, +0xb88b, 0x286b, 0x32e9, 0xd191, 0x1a2d, 0x2b19, 0xb1ba, 0xd055, 0x2574, 0xcd9d, +0xe17a, 0x4f5d, 0xf991, 0xe9c8, 0x4424, 0xee22, 0xa03f, 0x0b3e, 0x0833, 0xb2f6, +0x25d7, 0x3fb5, 0xd971, 0x1eca, 0x3552, 0xb55f, 0xc5ed, 0x2341, 0xd2b5, 0xd7c1, +0x523e, 0x069d, 0xe63d, 0x453d, 0xfaec, 0xa137, 0x0414, 0x12c4, 0xb981, 0x1bb8, +0x4054, 0xdb21, 0x1feb, 0x3f6a, 0xbc6b, 0xcb19, 0x2eaa, 0xdddc, 0xd782, 0x53f0, +0x0db9, 0xe5f5, 0x4ae5, 0x09f1, 0xaaaa, 0x08ea, 0x1b96, 0xc280, 0x22c4, 0x4ce0, +0xe24f, 0x1cfe, 0x4491, 0xc23a, 0xc424, 0x2faf, 0xe9a8, 0xd606, 0x50b8, 0x16c3, +0xe5a3, 0x41e4, 0x0b1a, 0xa940, 0xfef6, 0x1bdf, 0xbfb1, 0x1607, 0x4e4e, 0xe252, +0x116e, 0x44af, 0xc71f, 0xbeed, 0x2c56, 0xed57, 0xd13f, 0x46da, 0x1220, 0xdf44, +0x3fcf, 0x0e72, 0xa687, 0xfe99, 0x22c2, 0xc0f4, 0x10f5, 0x4ab0, 0xdcc9, 0x0862, +0x42d3, 0xcce8, 0xbf2b, 0x2c4a, 0xf130, 0xcf23, 0x47a0, 0x1557, 0xd894, 0x3b17, +0x15eb, 0xac91, 0xfc3e, 0x2839, 0xc889, 0x0a6b, 0x4a0a, 0xe524, 0x0571, 0x40a3, +0xd642, 0xc2d3, 0x2b1c, 0xfa19, 0xd4f9, 0x465b, 0x1ef6, 0xe106, 0x371e, 0x15ec, +0xb185, 0xfc2f, 0x2898, 0xcc97, 0x0b55, 0x4c1f, 0xebc4, 0x08bc, 0x3f08, 0xd705, +0xc599, 0x2bb5, 0x081d, 0xcd96, 0x0d3b, 0x0ffa, 0x0823, 0x3f09, 0x1a45, 0xdad9, +0x0662, 0x07b7, 0xbb6a, 0xde9a, 0x0740, 0xda46, 0x0e1e, 0x6549, 0x38b1, 0x04bd, +0x2510, 0xf943, 0xad98, 0xc9a0, 0xca5c, 0xcaba, 0x22c9, 0x2b10, 0x01f0, 0x511a, +0x637c, 0xe409, 0xcfea, 0xff1b, 0xbae4, 0x9b34, 0xfafc, 0x154f, 0xfdb5, 0x2da1, +0x2e82, 0x1b20, 0x2472, 0xf46c, 0xbc6b, 0xd8c3, 0xf895, 0xcd65, 0xe4ee, 0x20c1, +0x1821, 0x08d6, 0x178c, 0x2a03, 0x07e8, 0xfe05, 0xe136, 0xbccf, 0xeb99, 0xdae7, +0xd3aa, 0x1d70, 0x3e94, 0x094b, 0x0900, 0x5434, 0x0901, 0xc4b1, 0xdc6e, 0xc832, +0xca7f, 0xe370, 0xfc55, 0x19fb, 0x5037, 0x3174, 0xfe1c, 0x3bdc, 0x1079, 0xb5a5, +0xbd97, 0xde91, 0xd7dc, 0xd8e9, 0x1ed3, 0x2fd7, 0x3373, 0x2e1c, 0x130d, 0x2861, +0x0ada, 0xcec0, 0xaf81, 0xd3f1, 0xe991, 0xcbf7, 0x0636, 0x408c, 0x3d14, 0x22da, +0x2e7f, 0x334f, 0xf091, 0xd23f, 0xb6f6, 0xbe39, 0xe0ea, 0xdac6, 0x0ab7, 0x52de, +0x5241, 0x1a28, 0x36a7, 0x3ee4, 0xdc10, 0xbfb1, 0xc06c, 0xc69f, 0xdf82, 0xf62e, +0x1f54, 0x4e25, 0x578d, 0x17a6, 0x26c4, 0x37fc, 0xe05d, 0xc099, 0xcd8c, 0xd886, +0xd8c3, 0xfcba, 0x2d83, 0x3fa6, 0x48bb, 0x1e77, 0x2a31, 0x31eb, 0xe98e, 0xbcf5, +0xc196, 0xe4e4, 0xdb34, 0xf4b5, 0x398d, 0x47e8, 0x3526, 0x2168, 0x3d9a, 0x20eb, +0xddcb, 0xbe09, 0xb85c, 0xe775, 0xe3f6, 0xedd1, 0x3731, 0x576a, 0x2d99, 0x1229, +0x4011, 0x0fb4, 0xc58a, 0xc2e0, 0xc163, 0xd8b3, 0xe485, 0xfbc4, 0x28a2, 0x4aba, +0x2b57, 0x06a4, 0x385f, 0x150e, 0xc2cd, 0xb65c, 0xcd33, 0xde60, 0xd4fe, 0x0096, +0x3507, 0x45bc, 0x2781, 0x142c, 0x33ba, 0x049c, 0xc775, 0xb39c, 0xc6ec, 0xe39b, +0xd75b, 0x0203, 0x3c34, 0x4589, 0x1c2f, 0x171d, 0x336b, 0xeff6, 0xbf31, 0xb8c6, +0xc21c, 0xde19, 0xe412, 0x0b3a, 0x399a, 0x4631, 0x1799, 0x116c, 0x3085, 0xeefe, +0xbcec, 0xb922, 0xcdc6, 0xe051, 0xe2d7, 0x10d0, 0x38e1, 0x3dfb, 0x1356, 0x1516, +0x2876, 0xe6f8, 0xbb6a, 0xb636, 0xd128, 0xdda0, 0xdf16, 0x11df, 0x387e, 0x338c, +0x0c5c, 0x211c, 0x2422, 0xdca8, 0xbf10, 0xb435, 0xcd32, 0xde18, 0xe25f, 0x144e, +0x3fe0, 0x3472, 0x0753, 0x2b41, 0x27e8, 0xd555, 0xc117, 0xbddb, 0xcb8c, 0xdaa8, +0xee16, 0x185e, 0x406a, 0x394d, 0x0e4c, 0x3224, 0x2283, 0xcee6, 0xb78f, 0xbe46, +0xd600, 0xd73a, 0xf882, 0x2db5, 0x4253, 0x3500, 0x1558, 0x2eee, 0x13ba, 0xd1b3, +0xb80a, 0xbd32, 0xe28d, 0xdf23, 0xfd44, 0x3980, 0x4ace, 0x2d3f, 0x18f4, 0x34ae, +0x039f, 0xcc97, 0xbb5e, 0xbe2a, 0xe6fa, 0xe555, 0x023b, 0x3de8, 0x4db4, 0x2192, +0x1578, 0x3a68, 0xfe29, 0xc84a, 0xbd0b, 0xc1ef, 0xe3a9, 0xe936, 0x0a3b, 0x3ab4, +0x505a, 0x260d, 0x1903, 0x39c0, 0xf9ac, 0xc53b, 0xbc41, 0xcc45, 0xe5fc, 0xe843, +0x15b8, 0x436d, 0x4dae, 0x24c5, 0x212b, 0x33f2, 0xf1b2, 0xc3a3, 0xb509, 0xcd57, +0xe8db, 0xeb7c, 0x1d1e, 0x4aef, 0x4a01, 0x1af5, 0x24c7, 0x2df1, 0xe4a5, 0xc1ae, +0xb8ad, 0xd2c8, 0xe887, 0xee7b, 0x21d0, 0x4d5f, 0x4806, 0x171f, 0x2854, 0x27e5, +0xdd26, 0xc075, 0xb9c1, 0xd6dc, 0xe94e, 0xf760, 0x2a99, 0x4d0c, 0x4405, 0x1751, +0x2a63, 0x1e7d, 0xd670, 0xba60, 0xb674, 0xde00, 0xe8fc, 0xf57e, 0x3121, 0x51b2, +0x3a66, 0x11d4, 0x29d9, 0x107f, 0xd01f, 0xbbd1, 0xb864, 0xe08f, 0xea2a, 0xfafd, +0x34de, 0x5038, 0x3061, 0x1294, 0x3316, 0x07d3, 0xc6ab, 0xbd82, 0xc0f2, 0xe421, +0xebe4, 0x0398, 0x39c6, 0x54a2, 0x2e8b, 0x0e55, 0x3308, 0x0648, 0xc5ad, 0xbd8e, +0xc53c, 0xdfb2, 0xe8b4, 0x0f4a, 0x3d14, 0x4caa, 0x2bf1, 0x15bf, 0x2e89, 0xf945, +0xc136, 0xb890, 0xcaeb, 0xe950, 0xe7bf, 0x115d, 0x451b, 0x4aa1, 0x20cd, 0x1684, +0x2a91, 0xf0a3, 0xc5b7, 0xb815, 0xc9bf, 0xee16, 0xea12, 0x117d, 0x470b, 0x42c7, +0x113f, 0x1b7c, 0x2b91, 0xe191, 0xc212, 0xbd24, 0xc84b, 0xe419, 0xe8c1, 0x104f, +0x440c, 0x4662, 0x1122, 0x20a6, 0x2d8e, 0xda8b, 0xbcf3, 0xc089, 0xcbf5, 0xde1c, +0xf3c0, 0x2135, 0x414e, 0x3fd9, 0x15e1, 0x26f5, 0x292e, 0xdc7e, 0xb937, 0xb924, +0xd769, 0xe06d, 0xee92, 0x2aa0, 0x48ae, 0x379d, 0x15e3, 0x2afa, 0x167d, 0xd370, +0xbfeb, 0xb8aa, 0xd8da, 0xe695, 0xf331, 0x2abe, 0x4918, 0x2e1c, 0x0f19, 0x32cf, +0x0f46, 0xc822, 0xbf6b, 0xbca2, 0xdadc, 0xe628, 0xf835, 0x2cf1, 0x4b03, 0x2c10, +0x0df9, 0x358e, 0x0a2c, 0xc678, 0xc06b, 0xc05f, 0xd849, 0xe170, 0x02e1, 0x3324, +0x4bd0, 0x2fc8, 0x13c8, 0x3314, 0x0029, 0xbf2e, 0xb455, 0xc1d3, 0xe027, 0xe480, +0x0a7f, 0x2c7a, 0x5506, 0x634d, 0x2129, 0xfadf, 0xe1b5, 0xb620, 0x8bd2, 0xbfae, +0x0a2a, 0x0d5d, 0x5240, 0x8109, 0x4e83, 0x15cf, 0xf367, 0xba2c, 0x9d5f, 0xcd2e, +0xbdc8, 0xf85d, 0x6f35, 0x4484, 0x29e8, 0x54f0, 0x2a04, 0xcc06, 0xd6d5, 0xe253, +0xc387, 0x09da, 0xff4a, 0xebc6, 0x4eb3, 0x2edb, 0xcfcc, 0x0b9a, 0x3d1b, 0xdc1f, +0xf4a1, 0x3fae, 0xeb9b, 0xe915, 0x13be, 0xcb86, 0xb940, 0x1643, 0x18ee, 0xf7d9, +0x4acf, 0x30df, 0xe6dc, 0x16fe, 0xf4d5, 0x9c55, 0xcc79, 0x10aa, 0xe384, 0x0496, +0x4c2c, 0x0504, 0xff4c, 0x2d7e, 0xd93d, 0xacb4, 0x00e4, 0xf5af, 0xc18e, 0x2289, +0x2a64, 0xe0a9, 0x2089, 0x21b8, 0xbaf3, 0xdd89, 0x1ea4, 0xd2e4, 0xe648, 0x37ea, +0xec35, 0xe993, 0x35d6, 0xed2e, 0xbadd, 0x15b4, 0x0a9d, 0xc841, 0x1a7c, 0x191c, +0xcaef, 0x0f4e, 0x1fff, 0xbfae, 0xe155, 0x3460, 0xeb55, 0xe0b6, 0x3048, 0xf2f2, +0xddca, 0x235a, 0xee7f, 0xb7cc, 0x15dd, 0x2097, 0xce52, 0x180f, 0x2dcf, 0xd499, +0x0857, 0x29b8, 0xc4c2, 0xd000, 0x28ff, 0xe652, 0xde94, 0x43c5, 0x05e6, 0xe425, +0x356a, 0xfee7, 0xb2c1, 0x0914, 0x1584, 0xbe7b, 0x0e5a, 0x368a, 0xe276, 0x1274, +0x3391, 0xd008, 0xd357, 0x26c2, 0xec06, 0xdd61, 0x39e2, 0x0868, 0xe6f9, 0x3207, +0x091c, 0xbc0e, 0x0582, 0x1f6d, 0xd133, 0x1cab, 0x4d57, 0xeb81, 0x02e3, 0x3712, +0xde41, 0xc71f, 0x212b, 0xfb67, 0xe7a1, 0x504a, 0x23ac, 0xedd8, 0x3eb6, 0x157e, +0xad36, 0xfc30, 0x2995, 0xcb86, 0x10c5, 0x529b, 0xf7a7, 0x15fe, 0x4546, 0xdc21, +0xcaba, 0x26eb, 0xe984, 0xd493, 0x4c8e, 0x16e6, 0xe56c, 0x463b, 0x1cf9, 0xb4a9, +0xfd71, 0x24ab, 0xc8a4, 0x09c8, 0x41c1, 0xe4ff, 0x0a9c, 0x3d28, 0xd226, 0xc16f, +0x2d0a, 0xf732, 0xcb2f, 0x42b2, 0x1d8f, 0xd5f3, 0x2c26, 0x1649, 0xa7c7, 0xed21, +0x286f, 0xc688, 0x04e2, 0x51dd, 0xe73b, 0x0013, 0x46f0, 0xd1e8, 0xab29, 0x260f, +0xf7aa, 0xbdee, 0x402d, 0x25c0, 0xda8b, 0x3989, 0x21df, 0xa95c, 0xf0ed, 0x290b, +0xbd3d, 0xfb44, 0x4eba, 0xe63a, 0xfecd, 0x4a1d, 0xe177, 0xbc6f, 0x2af3, 0xfdf2, +0xc4cf, 0x3b3d, 0x1ebb, 0xd4a0, 0x319d, 0x221e, 0xaf94, 0xf1b0, 0x3313, 0xcaf9, +0xf7f2, 0x4fd1, 0xeb5b, 0xf54e, 0x3faa, 0xd925, 0xb016, 0x2624, 0x012e, 0xc2f3, +0x3e16, 0x255d, 0xce61, 0x2b67, 0x1e8d, 0xa020, 0xe075, 0x2e2f, 0xc930, 0xf3f3, +0x4f96, 0xe6da, 0xef8a, 0x43fb, 0xdd85, 0xab7b, 0x2022, 0xfe5f, 0xba39, 0x346d, +0x27b4, 0xd20a, 0x2bfd, 0x2882, 0xae6f, 0xe3d3, 0x2b38, 0xc9c6, 0xef8e, 0x49d8, +0xeade, 0xf2c2, 0x46de, 0xe8ca, 0xb2fe, 0x208e, 0x0855, 0xc5c4, 0x338e, 0x29eb, +0xd645, 0x257e, 0x260c, 0xb7e2, 0xebef, 0x3365, 0xd6d8, 0xf811, 0x518d, 0xf457, +0xf134, 0x4558, 0xf41a, 0xb66e, 0x1a28, 0x0bd1, 0xcaa3, 0x31f9, 0x3045, 0xe17a, +0x2ad4, 0x2f2d, 0xbd2b, 0xe13e, 0x2cfe, 0xd3bd, 0xea52, 0x4fb4, 0x020e, 0xf40a, +0x4278, 0xf8f7, 0xb45e, 0x127c, 0x0af1, 0xc2d1, 0x2b03, 0x36f1, 0xdd10, 0x20d2, +0x35ec, 0xc074, 0xd7bd, 0x2eef, 0xd9db, 0xe543, 0x52c9, 0x05cf, 0xec53, 0x41bb, +0xfa65, 0xaf2a, 0x15c6, 0x1274, 0xbe0e, 0x2c97, 0x448e, 0xdd59, 0x1c74, 0x3817, +0xbb2b, 0xcf5b, 0x2f9a, 0xdc0c, 0xe4f0, 0x586d, 0x096c, 0xe913, 0x42c2, 0xf921, +0xa4d2, 0x0f94, 0x157d, 0xbee7, 0x2a97, 0x46c2, 0xe0bf, 0x1d38, 0x3786, 0xb9af, +0xcb2a, 0x2dd9, 0xd952, 0xdcbe, 0x5596, 0x0bab, 0xea4b, 0x4531, 0xffe2, 0xa78b, +0x0c61, 0x136f, 0xb532, 0x2148, 0x44ae, 0xd96e, 0x195c, 0x392c, 0xb898, 0xc8e9, +0x3388, 0xef92, 0xcd85, 0x0ef6, 0xf796, 0x13e1, 0x506a, 0x028d, 0xcd42, 0x14f5, +0xf58e, 0x9d81, 0xe29f, 0xfb3c, 0xcd66, 0x1bbf, 0x6302, 0x30d7, 0x14e4, 0x29bc, +0xdf14, 0xae5e, 0xce80, 0xabdc, 0xca7e, 0x3503, 0x1ee4, 0xf688, 0x5aac, 0x62a7, +0xd87d, 0xd4d5, 0xfc76, 0xb6dd, 0xa5b5, 0xf6e7, 0x0b99, 0x0665, 0x381b, 0x1f19, +0x1206, 0x2ed5, 0xebdd, 0xb56d, 0xde2e, 0xf87e, 0xce4d, 0xed47, 0x2439, 0x121c, +0x1266, 0x1483, 0x16c8, 0x10fd, 0x0650, 0xd754, 0xbaff, 0xf7e2, 0xda39, 0xcd45, +0x2986, 0x40dc, 0x0e53, 0x182a, 0x50a1, 0x01de, 0xcb6e, 0xdc62, 0xb781, 0xcfc4, +0xee54, 0xf542, 0x2240, 0x5981, 0x2c5e, 0xf8e5, 0x3e3b, 0x0d29, 0xaf98, 0xc3b7, +0xd787, 0xd3b1, 0xe2e2, 0x19c0, 0x28df, 0x3943, 0x2fe3, 0x081e, 0x2922, 0x0f78, +0xc962, 0xb6cc, 0xd979, 0xe6a6, 0xd121, 0x07cf, 0x3500, 0x3ad0, 0x2c2a, 0x2624, +0x2c95, 0xfb6f, 0xd7be, 0xb61f, 0xc05e, 0xe300, 0xd931, 0x0c0c, 0x4eae, 0x4878, +0x15a7, 0x2a43, 0x31b1, 0xdd24, 0xc4ea, 0xbda7, 0xc680, 0xe6be, 0xf0c6, 0x13f8, +0x45f0, 0x4cdc, 0x09ee, 0x185b, 0x3039, 0xdd40, 0xc562, 0xd19d, 0xd51e, 0xdcc7, +0xfbf1, 0x1f9a, 0x3311, 0x4108, 0x10a0, 0x1d6d, 0x368a, 0xebc0, 0xbacd, 0xc61c, +0xe6be, 0xd8c6, 0xecc7, 0x2b4f, 0x3ad6, 0x3234, 0x16aa, 0x312b, 0x2c20, 0xe5cf, +0xbf0c, 0xc2d3, 0xef02, 0xde96, 0xe42b, 0x3264, 0x4f6e, 0x2b87, 0x1502, 0x434e, +0x2169, 0xd824, 0xcd4a, 0xcbe5, 0xe67d, 0xe8bc, 0xf5fe, 0x2bd2, 0x4fbf, 0x2b2a, +0x05aa, 0x4482, 0x2857, 0xcb20, 0xc28b, 0xdaa2, 0xe5a8, 0xd616, 0xfaa0, 0x2fc3, +0x4640, 0x2ce5, 0x0f5a, 0x3ab7, 0x1944, 0xcda3, 0xbbcb, 0xcda1, 0xe22a, 0xd491, +0x0143, 0x3873, 0x3fbe, 0x22bb, 0x1736, 0x3ae6, 0x0407, 0xc3a8, 0xb9c4, 0xc437, +0xdc67, 0xd7ba, 0x00f1, 0x3801, 0x41a0, 0x1951, 0x11c6, 0x35de, 0xf7fb, 0xbeac, +0xb811, 0xc658, 0xdc21, 0xd8e4, 0x060e, 0x39e5, 0x4146, 0x14d2, 0x16dd, 0x36f4, +0xed6d, 0xba86, 0xb9b4, 0xcb20, 0xdd7e, 0xdfe1, 0x0f15, 0x3b82, 0x3e9b, 0x1158, +0x1b8a, 0x323f, 0xe8e2, 0xbdfb, 0xb835, 0xd09f, 0xddf2, 0xdd36, 0x148a, 0x40d3, +0x3e5f, 0x13a7, 0x2794, 0x2f4a, 0xde17, 0xbd25, 0xb6e3, 0xcb99, 0xdc56, 0xe6b9, +0x1ce9, 0x4836, 0x40a4, 0x1189, 0x2c70, 0x2966, 0xd436, 0xb74c, 0xb722, 0xd074, +0xdc0f, 0xf37b, 0x2f67, 0x4c6c, 0x3aa1, 0x13df, 0x2e82, 0x1863, 0xcd4e, 0xbc3f, +0xbce0, 0xd9c4, 0xe1be, 0xfb8d, 0x359d, 0x4c01, 0x3625, 0x17b8, 0x32ce, 0x1032, +0xcc89, 0xbc30, 0xbdba, 0xe2ec, 0xe81c, 0x005e, 0x3db9, 0x512c, 0x2c97, 0x17fc, +0x380c, 0x06f5, 0xcdb1, 0xc0d4, 0xbe6b, 0xe241, 0xead9, 0x05a4, 0x3a27, 0x518a, +0x2c10, 0x187d, 0x3809, 0xfd0c, 0xc4ac, 0xbff0, 0xc939, 0xe3de, 0xe907, 0x0ded, +0x3e36, 0x4e75, 0x2456, 0x1759, 0x31b3, 0xf547, 0xc449, 0xba76, 0xcb7c, 0xe629, +0xeb17, 0x17cc, 0x43ae, 0x4970, 0x1dfb, 0x1c5c, 0x2c1b, 0xe97c, 0xc40d, 0xbedd, +0xd492, 0xe90c, 0xea14, 0x18aa, 0x44ec, 0x43bf, 0x15aa, 0x2421, 0x2f68, 0xe453, +0xc2c4, 0xbef4, 0xd4c2, 0xe5c8, 0xf22d, 0x2430, 0x475e, 0x4461, 0x187f, 0x2916, +0x2d8a, 0xe382, 0xc1ee, 0xc2fa, 0xe144, 0xe6ea, 0xf400, 0x30a7, 0x50eb, 0x4265, +0x1b39, 0x2f67, 0x2260, 0xde78, 0xc61b, 0xc3e2, 0xe4c5, 0xea6e, 0xf9b7, 0x32e4, +0x4b24, 0x330a, 0x1529, 0x377b, 0x1ad4, 0xd298, 0xc471, 0xc39e, 0xdfcf, 0xe493, +0xf83e, 0x339f, 0x5169, 0x3178, 0x0fe4, 0x3634, 0x10e7, 0xcad8, 0xc188, 0xc0cb, +0xd97a, 0xe36b, 0x01cf, 0x3255, 0x49ca, 0x2dc9, 0x1019, 0x33a3, 0x059a, 0xbd42, +0xb33f, 0xbe30, 0xd9b3, 0xdc31, 0x0338, 0x37ee, 0x44ae, 0x224f, 0x0cf2, 0x27ab, +0xf5dc, 0xbd67, 0xaf02, 0xbe02, 0xde1c, 0xd738, 0x02b2, 0x3eba, 0x4074, 0x174f, +0x1829, 0x2c82, 0xe72a, 0xbf61, 0xb6b3, 0xbe85, 0xe2b1, 0xe25f, 0x05c1, 0x4181, +0x4a2b, 0x1512, 0x1a96, 0x326a, 0xe3c7, 0xbc8c, 0xb7af, 0xbd6f, 0xd849, 0xe90a, +0x150e, 0x3ed0, 0x469e, 0x176f, 0x1b23, 0x2908, 0xdb26, 0xb2f3, 0xb1f8, 0xca6a, +0xdb06, 0xe6a5, 0x1fb9, 0x4383, 0x3e5d, 0x1596, 0x1e94, 0x1cb0, 0xd8cf, 0xba95, +0xaec4, 0xcef4, 0xe43f, 0xeaf7, 0x2443, 0x4766, 0x336a, 0x0e32, 0x27a3, 0x1356, +0xcd5d, 0xc150, 0xb6ba, 0xd1d8, 0xe528, 0xee84, 0x2426, 0x4adf, 0x3667, 0x10cd, +0x310e, 0x1388, 0xcbbb, 0xc47e, 0xbd1f, 0xd491, 0xe98e, 0x0244, 0x3289, 0x53b3, +0x3eb9, 0x1566, 0x3290, 0x11e3, 0xcc07, 0xc004, 0xc4fd, 0xe223, 0xed0a, 0x10ae, +0x3ff0, 0x5037, 0x36e6, 0x164f, 0x29a1, 0x0284, 0xcdb8, 0xbdcd, 0xc637, 0xed96, +0xeeb1, 0x0cd0, 0x4050, 0x49bb, 0x239a, 0x1780, 0x2eab, 0xf6b6, 0xce3d, 0xbc38, +0xc8a0, 0x00e6, 0xefad, 0x0021, 0x33f9, 0x3ae3, 0x3cd3, 0x3fb1, 0x1838, 0xd924, +0xd541, 0xaecf, 0xa5de, 0xf7be, 0xfc4c, 0x140b, 0x790a, 0x7937, 0x1616, 0xfecc, +0xe9f4, 0x93de, 0xa330, 0xc0f0, 0xcf7e, 0x2cbc, 0x6286, 0x4ccf, 0x462d, 0x450f, +0xe74f, 0xa99c, 0xd6b1, 0xc669, 0xba55, 0xfefe, 0x25a9, 0x3149, 0x43ec, 0x1f26, +0xede2, 0x0adf, 0xff6f, 0xbdad, 0xf121, 0x2c23, 0xf18d, 0xf0cc, 0x2718, 0xe6c1, +0xbbba, 0x1d92, 0x14c7, 0xde85, 0x3e57, 0x31f4, 0xe295, 0x0f8d, 0xf992, 0xa267, +0xd117, 0x1bec, 0xe179, 0x07c9, 0x5af9, 0x03a7, 0x02e9, 0x3014, 0xd04d, 0xa794, +0xfb7e, 0xf282, 0xc715, 0x36b9, 0x3764, 0xea25, 0x307a, 0x1cb0, 0xb2ec, 0xd406, +0x117c, 0xd2a9, 0xea54, 0x43e9, 0xfc21, 0xfaa3, 0x3fc1, 0xeafd, 0xb060, 0x0b4c, +0x0ff9, 0xc461, 0x1954, 0x3040, 0xd984, 0x1601, 0x2825, 0xbc3f, 0xdbce, 0x3875, +0xe248, 0xdd2e, 0x4e02, 0xfd2c, 0xd91c, 0x3749, 0xf658, 0xaa69, 0x13e1, 0x2498, +0xcc14, 0x21ba, 0x3a26, 0xdb15, 0x1623, 0x2c3d, 0xba40, 0xcd2e, 0x2cf5, 0xe4ae, +0xe186, 0x52e0, 0x0d31, 0xe5cf, 0x3778, 0xffc1, 0xac3d, 0xfddf, 0x1bac, 0xc8ec, +0x14d4, 0x4029, 0xe79d, 0x15d6, 0x3792, 0xcc34, 0xca86, 0x3225, 0xf50a, 0xcf32, +0x3e28, 0x12b9, 0xe181, 0x364b, 0x1002, 0xb4c9, 0x031c, 0x26d6, 0xd0a9, 0x1e6a, +0x443a, 0xd350, 0x08d3, 0x41ed, 0xc7a2, 0xb99c, 0x2fe3, 0xff21, 0xdc75, 0x4839, +0x19bb, 0xe84c, 0x32f7, 0x01b7, 0xaddf, 0xfef1, 0x1e1c, 0xcae8, 0x16e4, 0x4bda, +0xecbb, 0x0caf, 0x3f24, 0xe0dc, 0xc4bc, 0x18da, 0xf67e, 0xdd77, 0x3908, 0x10f4, +0xed5b, 0x4369, 0x1b8d, 0xb980, 0x0190, 0x297a, 0xc6e3, 0x009e, 0x4462, 0xea33, +0x0155, 0x3cba, 0xe27f, 0xcbef, 0x2bda, 0xf9a0, 0xd4bc, 0x439f, 0x150b, 0xd559, +0x344d, 0x1a5b, 0xaf57, 0xf935, 0x2de0, 0xcf9a, 0x0979, 0x49a9, 0xea95, 0x051a, +0x3cdb, 0xd6df, 0xbc25, 0x2174, 0xf28b, 0xc89b, 0x4222, 0x2645, 0xdfc1, 0x315e, +0x201e, 0xb2fc, 0xe3d4, 0x181b, 0xc442, 0xfd80, 0x4a43, 0xed31, 0xff1f, 0x4381, +0xdf06, 0xb4dc, 0x1fd7, 0xf6dc, 0xbffe, 0x3a30, 0x24f3, 0xd6d6, 0x297b, 0x1c5d, +0xaf37, 0xedb8, 0x286b, 0xc61d, 0xfe95, 0x515b, 0xe559, 0xf3c9, 0x4090, 0xd830, +0xae85, 0x1db8, 0xf7ec, 0xc607, 0x3f9f, 0x264d, 0xd94a, 0x2a8a, 0x1485, 0xa002, +0xdeaf, 0x235b, 0xc381, 0xfa49, 0x5796, 0xefa6, 0xf6b9, 0x4056, 0xd904, 0xa813, +0x17bf, 0xf931, 0xbf26, 0x3e31, 0x2c1d, 0xd50a, 0x2d55, 0x22b9, 0xa846, 0xdf9f, +0x28c5, 0xc598, 0xef6b, 0x51e5, 0xf17d, 0xfa6e, 0x46ce, 0xddcb, 0xac63, 0x1bcf, +0xff42, 0xc08e, 0x3b8a, 0x30ab, 0xd540, 0x2b2a, 0x2b14, 0xb01e, 0xe003, 0x2eb4, +0xd207, 0xf705, 0x5a04, 0xf5f1, 0xf4f2, 0x49c1, 0xe735, 0xac7d, 0x1ff2, 0x0bc1, +0xc150, 0x3a15, 0x3cd0, 0xdc44, 0x29ee, 0x3079, 0xb504, 0xdcbb, 0x2cd7, 0xcfca, +0xeed8, 0x5c84, 0xfe19, 0xf346, 0x4ec0, 0xf24e, 0xa9a2, 0x1b01, 0x120e, 0xbf61, +0x31bd, 0x3ed0, 0xdca8, 0x27d7, 0x3553, 0xb79f, 0xddc0, 0x376a, 0xd743, 0xea45, +0x592a, 0xf9f4, 0xe94c, 0x4a1d, 0xf552, 0xa9a1, 0x19d2, 0x14c6, 0xbc9b, 0x2b11, +0x3913, 0xd2dc, 0x1f02, 0x340a, 0xb6b6, 0xd426, 0x33f8, 0xd9a8, 0xdc7f, 0x5123, +0xfd3a, 0xde46, 0x40ce, 0xfa10, 0xa997, 0x14a8, 0x1bb4, 0xc08d, 0x2376, 0x3d24, +0xd503, 0x166b, 0x35f1, 0xbc86, 0xd0fa, 0x36e8, 0xf1a1, 0xd628, 0x16ed, 0xf145, +0x0d1a, 0x55e9, 0x09b3, 0xd0ea, 0x189e, 0xfae5, 0xa1d9, 0xe581, 0xfd1f, 0xd241, +0x1ffa, 0x5b9f, 0x2d05, 0x1f94, 0x316b, 0xe330, 0xba22, 0xd9ab, 0xb354, 0xcfaa, +0x3059, 0x1e34, 0xfcfc, 0x565e, 0x623a, 0xe738, 0xe027, 0xfe57, 0xc099, 0xb327, +0xf470, 0x0c3c, 0x0e38, 0x38fd, 0x1a11, 0x0892, 0x3339, 0xf5c3, 0xbab1, 0xe297, +0xf843, 0xce95, 0xe620, 0x1c2a, 0x09ee, 0x1283, 0x1b02, 0x1187, 0x188b, 0x0e86, +0xd87e, 0xb652, 0xeca9, 0xdb2d, 0xc7dd, 0x1fe5, 0x379e, 0x0fd2, 0x1c45, 0x4c2e, +0x1316, 0xd85d, 0xdfc8, 0xb6df, 0xc87f, 0xeb35, 0xe54a, 0x1628, 0x57e4, 0x3419, +0xff6c, 0x4156, 0x1c74, 0xb5b4, 0xca06, 0xd49b, 0xc6db, 0xdff3, 0x0f42, 0x1c9b, +0x38c2, 0x3cc3, 0x059b, 0x2a27, 0x2699, 0xce85, 0xb4f9, 0xd393, 0xdea9, 0xcdb3, +0x03e7, 0x3281, 0x3d54, 0x3c61, 0x2583, 0x2ce2, 0x0c86, 0xdb4d, 0xb3bf, 0xbb9c, +0xe353, 0xd3fa, 0x034f, 0x4cdb, 0x4ab4, 0x21fa, 0x2b59, 0x391f, 0xeb27, 0xc6cb, +0xb8e4, 0xba9a, 0xe811, 0xec0e, 0x0c31, 0x4bdb, 0x5772, 0x163d, 0x1a19, 0x3f4d, +0xe9e8, 0xc3a2, 0xce2a, 0xc788, 0xd9f4, 0xf83e, 0x1bc6, 0x3ce8, 0x5548, 0x1db0, +0x1a55, 0x4521, 0xf1e2, 0xb3ab, 0xc2fd, 0xdbe1, 0xd800, 0xed52, 0x2c30, 0x402d, +0x430b, 0x23ff, 0x260b, 0x2f76, 0xea68, 0xb3d7, 0xb28e, 0xe14a, 0xdd06, 0xe066, +0x33b3, 0x51ec, 0x33b4, 0x1667, 0x3052, 0x1b77, 0xd41e, 0xc1bd, 0xb6c4, 0xd7a4, +0xeae0, 0xe9c9, 0x2119, 0x50ee, 0x3348, 0x0504, 0x35a7, 0x2224, 0xc555, 0xbad4, +0xc362, 0xd0c4, 0xdade, 0xf6c3, 0x247a, 0x463c, 0x3726, 0x098e, 0x2ae9, 0x1a2f, +0xc9d7, 0xb0fe, 0xc012, 0xdaac, 0xd5e1, 0xf9b0, 0x351f, 0x47da, 0x2cc6, 0x10fb, +0x2d9f, 0x068e, 0xc5e3, 0xb7fe, 0xc297, 0xe2b0, 0xe422, 0x01db, 0x36ef, 0x48cb, +0x23b7, 0x10de, 0x3507, 0x0307, 0xc7bf, 0xbff3, 0xc77c, 0xe128, 0xe56e, 0x0857, +0x3924, 0x4aaf, 0x2249, 0x103e, 0x31eb, 0xfa7b, 0xc42a, 0xbff2, 0xca69, 0xdf50, +0xe715, 0x1070, 0x37d6, 0x4303, 0x1eac, 0x16ba, 0x3184, 0xf739, 0xc4f5, 0xba46, +0xcd7e, 0xe4d0, 0xe592, 0x10ee, 0x3d09, 0x4044, 0x17ce, 0x2016, 0x2f3f, 0xe9e5, +0xc633, 0xbad5, 0xc6f9, 0xdeac, 0xe624, 0x121c, 0x413b, 0x4301, 0x1783, 0x29fd, +0x2ba5, 0xdaa4, 0xbe2e, 0xbb8e, 0xcbc8, 0xdde4, 0xf1e9, 0x21db, 0x439b, 0x4190, +0x172e, 0x27a0, 0x21f8, 0xd636, 0xbad8, 0xb8bf, 0xd096, 0xdf64, 0xf8a8, 0x2b93, +0x443b, 0x3b96, 0x185e, 0x26da, 0x10a6, 0xd167, 0xbdb5, 0xb977, 0xdb3a, 0xe708, +0xfa86, 0x2f52, 0x4806, 0x3265, 0x17a3, 0x31bc, 0x0e05, 0xd510, 0xc461, 0xbd66, +0xe192, 0xed77, 0x0119, 0x32ba, 0x50ed, 0x31ea, 0x16d3, 0x36ec, 0x0732, 0xcfc7, +0xc460, 0xc184, 0xdf83, 0xea58, 0x0626, 0x3550, 0x5246, 0x2def, 0x16cd, 0x3427, +0xfd3a, 0xc953, 0xbd3c, 0xc544, 0xe4ec, 0xf153, 0x166b, 0x3e10, 0x4e6d, 0x26d4, +0x1968, 0x2f16, 0xf428, 0xcae0, 0xbedd, 0xccf8, 0xe956, 0xefa2, 0x1950, 0x4297, +0x4a75, 0x1de5, 0x1955, 0x29ba, 0xeb91, 0xc61c, 0xbb12, 0xce33, 0xe7ce, 0xefe6, +0x18c6, 0x3e32, 0x43c5, 0x1922, 0x1cc3, 0x20fd, 0xde2b, 0xbf55, 0xb70b, 0xd16f, +0xe788, 0xef8e, 0x20c4, 0x4654, 0x3d93, 0x11d7, 0x1d2e, 0x15c5, 0xd810, 0xc122, +0xb7df, 0xd5bd, 0xe934, 0xf5a0, 0x24cd, 0x4321, 0x356b, 0x10be, 0x2522, 0x0e25, +0xcdbf, 0xc120, 0xbd1c, 0xd9ef, 0xe950, 0xf8ec, 0x2940, 0x4a04, 0x31e9, 0x09bb, +0x2935, 0x0de2, 0xcd32, 0xc3e0, 0xc0ad, 0xd96f, 0xebee, 0x0617, 0x2f65, 0x4a9d, +0x32b8, 0x104d, 0x2b20, 0x042c, 0xc6fe, 0xc0fc, 0xccb1, 0xe4c6, 0xe7e5, 0x0a2f, +0x3646, 0x44a9, 0x27ed, 0x0f84, 0x2482, 0xf9ba, 0xc9c9, 0xbc46, 0xc6f1, 0xe7c9, +0xe7b4, 0x0935, 0x38ab, 0x3dfb, 0x17f4, 0x1202, 0x2366, 0xe8cf, 0xc894, 0xc02b, +0xc4e7, 0xe682, 0xe9b4, 0x07dc, 0x39bc, 0x4323, 0x1255, 0x11a3, 0x2383, 0xde38, +0xc201, 0xc28c, 0xc797, 0xe30e, 0xf319, 0x11aa, 0x3329, 0x3e07, 0x11d9, 0x1242, +0x2173, 0xdd6c, 0xbc12, 0xbfc4, 0xd3cc, 0xe301, 0xf14f, 0x1ed7, 0x3c0b, 0x3bbe, +0x150a, 0x16d9, 0x1504, 0xded6, 0xc844, 0xc0c3, 0xdedd, 0xf0d7, 0xf666, 0x25d8, +0x4424, 0x33d0, 0x130e, 0x2876, 0x1370, 0xd7a6, 0xcf17, 0xc604, 0xdfb9, 0xf3d2, +0xfde9, 0x29bc, 0x4a3a, 0x328f, 0x0b59, 0x293f, 0x0f84, 0xd398, 0xd04b, 0xc938, +0xdc96, 0xf077, 0x05ff, 0x2a1d, 0x46e9, 0x33e3, 0x0e06, 0x27af, 0x084b, 0xcbee, +0xc5ed, 0xce50, 0xe4ec, 0xee95, 0x0fc4, 0x3481, 0x4291, 0x2ab8, 0x0ee7, 0x217a, +0xfbca, 0xd072, 0xc584, 0xcdc2, 0xeeae, 0xf284, 0x0beb, 0x2a91, 0x499c, 0x4ab9, +0x1751, 0xfb4e, 0xdff4, 0xc548, 0xaa11, 0xcb25, 0x079b, 0x0c5f, 0x3e98, 0x6247, +0x3e07, 0x0f43, 0xf0e4, 0xca5f, 0xb34f, 0xd401, 0xc893, 0xf3d1, 0x4c26, 0x308b, +0x22b3, 0x41c0, 0x2279, 0xdc8b, 0xdff8, 0xe310, 0xcceb, 0x027f, 0xf615, 0xee06, +0x3db0, 0x2392, 0xe01d, 0x1366, 0x3415, 0xe34c, 0xf6fc, 0x29c3, 0xe8c4, 0xee7a, +0x0fa2, 0xddee, 0xd84b, 0x1d1b, 0x1722, 0xff58, 0x3ac2, 0x1f74, 0xf03f, 0x1870, +0xfcd6, 0xbff1, 0xe68f, 0x1180, 0xed1f, 0x0a12, 0x3895, 0x07ec, 0x0a31, 0x24b3, +0xe648, 0xc9fc, 0x0734, 0xf757, 0xd412, 0x1f4f, 0x1e8b, 0xee37, 0x1f0e, 0x1be3, +0xd43a, 0xefa3, 0x194b, 0xddce, 0xf237, 0x287d, 0xeedf, 0xf88e, 0x2f7f, 0xf704, +0xd874, 0x1c88, 0x0972, 0xd8d5, 0x1702, 0x0f28, 0xe05e, 0x15f4, 0x1a7c, 0xd9ff, +0xf6eb, 0x29b0, 0xf002, 0xf068, 0x23d5, 0xf4b8, 0xf046, 0x1d23, 0xf157, 0xd110, +0x1519, 0x14cc, 0xdede, 0x142d, 0x1a12, 0xe515, 0x0b1c, 0x1636, 0xd4d5, 0xe629, +0x1cf8, 0xe7c6, 0xea58, 0x2b1f, 0xfc3e, 0xeeea, 0x236a, 0xfb53, 0xcfca, 0x089d, +0x0488, 0xd160, 0x0a55, 0x141d, 0xe5cd, 0x107d, 0x186d, 0xd8c8, 0xeaf7, 0x1870, +0xe826, 0xe955, 0x18d7, 0xf4b0, 0xf2f4, 0x198f, 0xf637, 0xd898, 0x0a60, 0x099d, +0xe121, 0x112c, 0x19f0, 0xe9f0, 0x0257, 0x16f3, 0xea68, 0xe825, 0x11db, 0xf73d, +0xf784, 0x22c2, 0x01a7, 0xfa94, 0x2329, 0xff98, 0xd3ac, 0x066b, 0x0f20, 0xe092, +0x0cc3, 0x1ddc, 0xf6f5, 0x1320, 0x1de5, 0xe877, 0xf111, 0x167b, 0xeabe, 0xf59b, +0x2682, 0xf99e, 0xf763, 0x2689, 0x0359, 0xdfbd, 0x0e98, 0x0da2, 0xe78d, 0x0e20, +0x0ddb, 0xeff0, 0x11e2, 0x1312, 0xe459, 0xf4b0, 0x1704, 0xee92, 0xf4ab, 0x1ec2, +0xfc20, 0xf450, 0x169f, 0xfcad, 0xdbac, 0x0468, 0x089e, 0xe794, 0x0e53, 0x118e, +0xefe9, 0x0e4a, 0x169a, 0xe1da, 0xebc0, 0x15eb, 0xefcb, 0xf2ee, 0x1beb, 0xfce8, +0xfa9c, 0x1c17, 0xffdb, 0xe6b1, 0x0fc5, 0x065c, 0xe6be, 0x10a6, 0x0c31, 0xefee, +0x1306, 0x13f9, 0xe94c, 0xfe45, 0x19f0, 0xf32a, 0xfe85, 0x1905, 0xf62a, 0xfd6b, +0x1747, 0xf729, 0xeaea, 0x11d1, 0x0593, 0xf301, 0x1786, 0x0b5f, 0xf124, 0x0940, +0x0668, 0xe6ec, 0xfe96, 0x1506, 0xf474, 0x04f3, 0x1923, 0xf708, 0xfe00, 0x1197, +0xf0a5, 0xe784, 0x0dcb, 0xff73, 0xf084, 0x1476, 0x091e, 0xf640, 0x0af0, 0x0286, +0xe773, 0xfd6b, 0x0efa, 0xf175, 0xf89a, 0x07af, 0xf9a6, 0x0516, 0x128d, 0x00ff, +0xfb4e, 0x0ed0, 0xfc70, 0xe60e, 0xf53d, 0xf46c, 0xf494, 0x0bff, 0x1551, 0x06e1, +0x0c9f, 0x0f55, 0xefab, 0xed70, 0xf731, 0xf0fe, 0xfd13, 0x0d56, 0x068f, 0x0174, +0x0fee, 0xffe4, 0xea15, 0xfb9a, 0xffd4, 0xf166, 0xfe33, 0x0e6f, 0xfeb8, 0x0068, +0x0cad, 0xf543, 0xef47, 0x0118, 0xf5be, 0xeb4f, 0x04dc, 0x09b3, 0xf586, 0x0081, +0x05bb, 0xf123, 0xf60d, 0x03d9, 0xf8d9, 0xfe28, 0x0dac, 0xfb79, 0xf27c, 0xfe7f, +0xf2c5, 0xeeb0, 0x04d2, 0x030d, 0xfb07, 0x0e9e, 0x0d11, 0xf686, 0xfc94, 0xffbf, +0xed59, 0xf589, 0x05ab, 0xfa48, 0xffa7, 0x10c1, 0x014b, 0xfa25, 0x09af, 0xfdfc, +0xf0ef, 0x03b9, 0x0400, 0xf635, 0x063f, 0x0b0b, 0xf9ca, 0x03dd, 0x0d8d, 0xfce6, +0x00df, 0x0f4b, 0x024e, 0xff59, 0x0dc5, 0x0159, 0xf654, 0x067a, 0x0580, 0xfe5c, +0x0e74, 0x0f97, 0x0220, 0x099e, 0x09f1, 0xf6cc, 0xfa19, 0x04a0, 0xfb69, 0x0199, +0x10a2, 0x0726, 0x02f2, 0x0c0d, 0x00c5, 0xf7e4, 0x056d, 0x020c, 0xf921, 0x0880, +0x0a05, 0xfc9b, 0x05b1, 0x0ba8, 0xfd73, 0x0126, 0x0afa, 0xfedb, 0xfe8e, 0x0754, +0xff08, 0x010e, 0x0a12, 0xff2a, 0xfc7a, 0x0965, 0x0306, 0xfbf9, 0x0735, 0x05c2, +0xfdbe, 0x020b, 0x01d4, 0xfd23, 0x035d, 0x0690, 0x0006, 0x0536, 0x0b42, 0x02fd, +0x0048, 0x04d9, 0xffac, 0xfb96, 0x0522, 0x06ea, 0x01a3, 0x0640, 0x0721, 0x02e7, +0x04ad, 0x0494, 0xfe70, 0x009e, 0x0380, 0xfafb, 0xfecf, 0x0890, 0x0224, 0xffd6, +0x0613, 0x005f, 0xfada, 0x0129, 0xfdf3, 0xf949, 0x014d, 0x006d, 0xfa91, 0x0029, +0x002c, 0xf7d8, 0xff02, 0x0615, 0xfbc4, 0xfc2b, 0x035b, 0xfb89, 0xf601, 0xfa4f, +0xfabf, 0xfbd9, 0x00a3, 0xfe0a, 0xfbd4, 0x0009, 0xfe8b, 0xf866, 0xf96c, 0xfcbd, +0xf750, 0xf6d5, 0xfee5, 0xfea6, 0xfc47, 0x00a5, 0x013f, 0xfaa4, 0xf910, 0xf98a, +0xf6f0, 0xfa55, 0xfc01, 0xfac1, 0xff53, 0x001d, 0xfac1, 0xfb9d, 0xfef2, 0xf9c9, +0xf9ce, 0xff10, 0xfabf, 0xfab8, 0xfe59, 0xfa05, 0xfa90, 0x00a1, 0xff54, 0xfdbe, +0x0243, 0xff6b, 0xfac6, 0xfde2, 0xfc78, 0xf927, 0xfc12, 0xfe2f, 0xfc8a, 0xfe15, +0x00a9, 0xff55, 0x0011, 0x0049, 0xfbfb, 0xfa18, 0xfd23, 0xfbc7, 0xf7ac, 0xfd25, +0x019e, 0x0030, 0x02a9, 0x0344, 0x0053, 0x0036, 0x003f, 0xfc42, 0xfd77, 0x047f, +0x022f, 0xffd5, 0x0747, 0x065b, 0xffcd, 0x058c, 0x0801, 0x00b8, 0x029f, 0x057c, +0x0228, 0x02a9, 0x03ae, 0x0336, 0x052e, 0x06d3, 0x0355, 0x0367, 0x097b, 0x0767, +0x040b, 0x0708, 0x062b, 0x00f3, 0x010e, 0x0624, 0x0661, 0x0641, 0x0870, 0x08cf, +0x095c, 0x0672, 0x0114, 0x0064, 0x0450, 0x0372, 0x00f0, 0x074e, 0x0927, 0x0375, +0x04d0, 0x06fa, 0x0278, 0x00e0, 0x023e, 0x0105, 0x0392, 0x0478, 0x01dc, 0x0633, +0x06ad, 0x0137, 0x035b, 0x071e, 0x039a, 0x00b9, 0x0238, 0x0257, 0x03b3, 0x032c, +0x00b5, 0x062b, 0x0920, 0x0425, 0x05d7, 0x09b0, 0x0457, 0x011e, 0x02cb, 0x0112, +0x01e7, 0x03e0, 0x04a0, 0x09f0, 0x0993, 0x025d, 0x03ab, 0x06f0, 0x01ce, 0xffa9, +0x0343, 0x03bf, 0x02bc, 0x0192, 0x0175, 0x03f8, 0x025f, 0xfe13, 0xffaf, 0x037b, +0x017f, 0xff0d, 0x010c, 0x01cc, 0xff47, 0xfda7, 0xff79, 0xffc8, 0xfd08, 0xfdcd, +0x01e5, 0x03c0, 0x00fa, 0xfdf8, 0xfdb9, 0xff87, 0xff9b, 0xfbe2, 0xfeae, 0x0380, +0x0014, 0xfe6f, 0x0115, 0x0048, 0xfe1d, 0xff3b, 0xff7b, 0xff0a, 0x0012, 0xfed0, +0xfed6, 0xffe0, 0xfcbf, 0xfbdb, 0x005d, 0xffb1, 0xf9ae, 0xfb2b, 0x0004, 0xff44, +0xfc6c, 0xfb62, 0xfdf8, 0xff0d, 0xfbbb, 0xfae7, 0xfd8a, 0xfd70, 0xfaee, 0xfbe3, +0xfdf3, 0xfc89, 0xfa9a, 0xfb6e, 0xfd82, 0xfcb8, 0xfaa3, 0xfc2a, 0xfeb9, 0xfc5c, +0xf8a1, 0xfb85, 0x000c, 0xfee7, 0xfbc5, 0xfc1f, 0xfee8, 0xfdac, 0xfae0, 0xfc8b, +0xfef5, 0xfebd, 0xfdf5, 0xfec1, 0x0023, 0xff0f, 0xfc4a, 0xfdd7, 0x00f5, 0xfea6, +0xfd0c, 0x002f, 0x0087, 0xfc77, 0xfc93, 0x0024, 0x013b, 0x00dc, 0xfdb0, 0xfcbd, +0x0060, 0xfed8, 0xfc65, 0xfff5, 0x0160, 0xfef8, 0x0045, 0x0243, 0x0065, 0xfff6, +0x0124, 0x00f9, 0x00f5, 0x00ae, 0xff8e, 0x00df, 0x02e1, 0xffa3, 0xfea2, 0x0390, +0x035d, 0xff35, 0xff1f, 0x009b, 0x0048, 0xffed, 0x0005, 0xfff7, 0x0019, 0xff23, +0xfe36, 0xff91, 0x0112, 0x0088, 0xfff6, 0x00fa, 0x00a3, 0xfe18, 0xfe82, 0x01b6, +0x00ae, 0xfead, 0x018f, 0x02ef, 0x0126, 0x002b, 0xffb6, 0x01e3, 0x0382, 0x00b0, +0x00bd, 0x0402, 0x024e, 0x0002, 0x02e3, 0x0327, 0x00b6, 0x01cf, 0x02ca, 0x0250, +0x0280, 0x01bd, 0x021d, 0x04f6, 0x0340, 0xfee9, 0x0095, 0x0305, 0x00bc, 0x012c, +0x04fc, 0x0469, 0x0257, 0x027e, 0x0242, 0x01ad, 0x014b, 0x00c3, 0x0147, 0x037a, +0x036a, 0x00b5, 0x0068, 0x0121, 0xff9a, 0xfec8, 0x0143, 0x0151, 0xfd18, 0xfced, +0xffbd, 0x0066, 0x007d, 0xff3b, 0xfdd4, 0xfe9a, 0xff0d, 0xfdc1, 0xfe33, 0xffd7, +0xfd45, 0xfbe9, 0xffc6, 0xff2d, 0xfb3e, 0xfd69, 0x0057, 0xff59, 0xffc4, 0x00ad, +0x0017, 0xffc4, 0xfde4, 0xfc22, 0xfe08, 0x004b, 0xffd4, 0x0028, 0x0265, 0x00fa, +0xfdc5, 0xfe0b, 0xff0e, 0xfe78, 0xfdca, 0xfe74, 0xff9b, 0x005c, 0x0106, 0x00eb, +0x015c, 0x01a8, 0xff52, 0xfee2, 0x00ee, 0xffbe, 0xfec8, 0x010d, 0x01ab, 0x00d9, +0x0106, 0x010d, 0x00e8, 0x0118, 0x00e8, 0x012b, 0x02b4, 0x0211, 0xff7a, 0xff8e, +0x0115, 0x0100, 0x00de, 0x02dd, 0x0379, 0x00f9, 0xffd1, 0x0018, 0xfff6, 0xfffa, +0x000c, 0xfff1, 0x0004, 0x0012, 0xffc4, 0x009c, 0x010c, 0xfffb, 0xffe4, 0x001a, +0xfff2, 0xfffc, 0x0012, 0xffe2, 0x0015, 0x015a, 0x0257, 0x01c9, 0x004d, 0xfff9, +0xffdd, 0x0059, 0x019b, 0x004f, 0x0095, 0x030f, 0x0191, 0xff96, 0x015d, 0x0296, +0x01ee, 0x0205, 0x01f5, 0x0220, 0x0303, 0x0276, 0x01b6, 0x02a2, 0x02f4, 0x01f9, +0x0209, 0x01e3, 0x0073, 0x00ad, 0x0219, 0x0205, 0x00f2, 0x000a, 0xffc0, 0x00c9, +0x0105, 0xffac, 0x007c, 0x0198, 0x0051, 0xffcf, 0x001b, 0xfff4, 0x0001, 0x0002, +0xfffe, 0xfffb, 0x0005, 0xfffd, 0xfff3, 0x0025, 0xff14, 0xfe3b, 0xffa5, 0xfffc, +0xfee0, 0xff17, 0xffe8, 0x0010, 0xffec, 0x0017, 0xffe5, 0xff21, 0xfef3, 0xfef8, +0xff4b, 0x002c, 0xffc0, 0xfee9, 0xffc3, 0x001f, 0xff65, 0xffbc, 0x001d, 0xfff2, +000000, 0x0003, 0xfffc, 0xfffc, 0x000a, 0xffec, 0x0015, 0x0095, 0x002c, 0xffc9, +0x006a, 0x0078, 0xfff2, 0xfffb, 0x0006, 0xfffa, 0x0002, 0xfffd, 0x0004, 0xfff4, +0x0010, 0xfff2, 0xfff7, 0x003a, 0xfeb1, 0xfe3a, 0xfff4, 0x0020, 0xffde, 0x0015, +0xfff6, 000000, 0x0002, 0xfffc, 0x0001, 0xfffe, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, +000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000, 000000 }; diff --git a/libs/libiax2/src/ringtone.h b/libs/libiax2/src/ringtone.h new file mode 100644 index 0000000000000000000000000000000000000000..637021d3412b5db0682113e57de9ddc8d463576d --- /dev/null +++ b/libs/libiax2/src/ringtone.h @@ -0,0 +1,30 @@ +/* ringtone.h: Generated from frequencies 440 and 480 + by gensound. 200 samples */ +static short ringtone[200] = { + 0, 11581, 21659, 28927, 32445, 31764, 26981, 18727, + 8084, -3559, -14693, -23875, -29927, -32083, -30088, -24228, + -15290, -4453, 6864, 17195, 25212, 29902, 30693, 27526, + 20856, 11585, 944, -9673, -18899, -25560, -28837, -28357, + -24244, -17089, -7868, 2192, 11780, 19667, 24872, 26779, + 25212, 20450, 13179, 4396, -4731, -13019, -19421, -23164, + -23839, -21446, -16384, -9384, -1408, 6484, 13281, 18145, + 20517, 20182, 17286, 12301, 5951, -887, -7314, -12519, + -15886, -17068, -16017, -12983, -8458, -3109, 2327, 7142, + 10750, 12757, 13007, 11585, 8793, 5095, 1044, -2800, + -5951, -8053, -8921, -8560, -7141, -4967, -2421, 104, + 2260, 3791, 4567, 4589, 3977, 2941, 1733, 600, + -257, -722, -772, -481, 0, 481, 772, 722, + 257, -600, -1733, -2941, -3977, -4589, -4567, -3791, + -2260, -104, 2421, 4967, 7141, 8560, 8921, 8053, + 5951, 2800, -1044, -5095, -8793, -11585, -13007, -12757, + -10750, -7142, -2327, 3109, 8458, 12983, 16017, 17068, + 15886, 12519, 7314, 887, -5951, -12301, -17286, -20182, + -20517, -18145, -13281, -6484, 1408, 9384, 16384, 21446, + 23839, 23164, 19421, 13019, 4731, -4396, -13179, -20450, + -25212, -26779, -24872, -19667, -11780, -2192, 7868, 17089, + 24244, 28357, 28837, 25560, 18899, 9673, -944, -11585, + -20856, -27526, -30693, -29902, -25212, -17195, -6864, 4453, + 15290, 24228, 30088, 32083, 29927, 23875, 14693, 3559, + -8084, -18727, -26981, -31764, -32445, -28927, -21659, -11581, + +}; diff --git a/libs/libiax2/src/winiphone.c b/libs/libiax2/src/winiphone.c new file mode 100644 index 0000000000000000000000000000000000000000..0bc3147b7ce2130ff5ff6c7ca3987cf434b4e76d --- /dev/null +++ b/libs/libiax2/src/winiphone.c @@ -0,0 +1,761 @@ +/* + * Miniphone: A simple, command line telephone + * + * IAX Support for talking to Asterisk and other Gnophone clients + * + * Copyright (C) 1999, Linux Support Services, Inc. + * + * Mark Spencer <markster@linux-support.net> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +/* #define PRINTCHUCK /* enable this to indicate chucked incomming packets */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <io.h> +#include <conio.h> +#include <stdio.h> +#include <errno.h> +#include <time.h> +#include <process.h> +#include <windows.h> +#include <winsock.h> +#include <mmsystem.h> +#include <malloc.h> +#include "gsm.h" +#include "iax-client.h" +#include "frame.h" +#include "miniphone.h" + + +struct peer { + int time; + gsm gsmin; + gsm gsmout; + + struct iax_session *session; + struct peer *next; +}; + +static struct peer *peers; +static int answered_call = 0; + +/* stuff for wave audio device */ +HWAVEOUT wout; +HWAVEIN win; + +typedef struct whout { + WAVEHDR w; + short data[160]; + struct whout *next; +} WHOUT; + +WHOUT *outqueue = NULL; + +/* parameters for audio in */ +#define NWHIN 8 /* number of input buffer entries */ +/* NOTE the OUT_INTERVAL parameter *SHOULD* be more around 18 to 20 or so, since the packets should +be spaced by 20 milliseconds. However, in practice, especially in Windoze-95, setting it that high +caused underruns. 10 is just ever so slightly agressive, and the receiver has to chuck a packet +every now and then. Thats about the way it should be to be happy. */ +#define OUT_INTERVAL 10 /* number of ms to wait before sending more data to peer */ +/* parameters for audio out */ +#define OUT_DEPTH 12 /* number of outbut buffer entries */ +#define OUT_PAUSE_THRESHOLD 2 /* number of active entries needed to start output (for smoothing) */ + +/* audio input buffer headers */ +WAVEHDR whin[NWHIN]; +/* audio input buffers */ +char bufin[NWHIN][320]; + +/* initialize the sequence variables for the audio in stuff */ +unsigned int whinserial = 1,nextwhin = 1; + +static struct peer *find_peer(struct iax_session *); +static void parse_args(FILE *, unsigned char *); +void do_iax_event(FILE *); +void call(FILE *, char *); +void answer_call(void); +void reject_call(void); +static void handle_event(FILE *, struct iax_event *e, struct peer *p); +void parse_cmd(FILE *, int, char **); +void issue_prompt(FILE *); +void dump_array(FILE *, char **); + +static char *help[] = { +"Welcome to the miniphone telephony client, the commands are as follows:\n", +"Help\t\t-\tDisplays this screen.", +"Call <Number>\t-\tDials the number supplied.", +"Answer\t\t-\tAnswers an Inbound call.", +"Reject\t\t-\tRejects an Inbound call.", +"Dump\t\t-\tDumps (disconnects) the current call.", +"Dtmf <Digit>\t-\tSends specified DTMF digit.", +"Status\t\t-\tLists the current sessions and their current status.", +"Quit\t\t-\tShuts down the client.", +"", +0 +}; + +static struct peer *most_recent_answer; +static struct iax_session *newcall = 0; + +/* holder of the time, relative to startup in system ticks. See our +gettimeofday() implementation */ +time_t startuptime; + +/* routine called at exit to shutdown audio I/O and close nicely. +NOTE: If all this isnt done, the system doesnt not handle this +cleanly and has to be rebooted. What a pile of doo doo!! */ +void killem(void) +{ + waveInStop(win); + waveInReset(win); + waveInClose(win); + waveOutReset(wout); + waveOutClose(wout); + WSACleanup(); /* dont forget socket stuff too */ + return; +} + +/* Win-doze doenst have gettimeofday(). This sux. So, what we did is +provide some gettimeofday-like functionality that works for our purposes. +In the main(), we take a sample of the system tick counter (into startuptime). +This function returns the relative time since program startup, more or less, +which is certainly good enough for our purposes. */ +void gettimeofday(struct timeval *tv, struct timezone *tz) +{ + long l = startuptime + GetTickCount(); + + tv->tv_sec = l / 1000; + tv->tv_usec = (l % 1000) * 1000; + return; +} + + +static struct peer *find_peer(struct iax_session *session) +{ + struct peer *cur = peers; + while(cur) { + if (cur->session == session) + return cur; + cur = cur->next; + } + return NULL; +} + +void +parse_args(FILE *f, unsigned char *cmd) +{ + static char *argv[MAXARGS]; + unsigned char *parse = cmd; + int argc = 0, t = 0; + + // Don't mess with anything that doesn't exist... + if(!*parse) + return; + + memset(argv, 0, sizeof(argv)); + while(*parse) { + if(*parse < 33 || *parse > 128) { + *parse = 0, t++; + if(t > MAXARG) { + fprintf(f, "Warning: Argument exceeds maximum argument size, command ignored!\n"); + return; + } + } else if(t || !argc) { + if(argc == MAXARGS) { + fprintf(f, "Warning: Command ignored, too many arguments\n"); + return; + } + argv[argc++] = parse; + t = 0; + } + + parse++; + } + + if(argc) + parse_cmd(f, argc, argv); +} + +/* handle all network requests, and a pending scheduled event, if any */ +void service_network(int netfd, FILE *f) +{ + fd_set readfd; + struct timeval dumbtimer; + + /* set up a timer that falls-through */ + dumbtimer.tv_sec = 0; + dumbtimer.tv_usec = 0; + + + for(;;) /* suck everything outa network stuff */ + { + FD_ZERO(&readfd); + FD_SET(netfd, &readfd); + if (select(netfd + 1, &readfd, 0, 0, &dumbtimer) > 0) + { + if (FD_ISSET(netfd,&readfd)) + { + do_iax_event(f); + (void) iax_time_to_next_event(); + } else break; + } else break; + } + do_iax_event(f); /* do pending event if any */ +} + + +int +main(int argc, char *argv[]) +{ + int port; + int netfd; + int c, i; + FILE *f; + char rcmd[RBUFSIZE]; + gsm_frame fo; + WSADATA foop; + time_t t; + WAVEFORMATEX wf; + WHOUT *wh,*wh1,*wh2; + unsigned long lastouttick = 0; + + + + /* get time of day in milliseconds, offset by tick count (see our + gettimeofday() implementation) */ + time(&t); + startuptime = ((t % 86400) * 1000) - GetTickCount(); + + f = stdout; + _dup2(fileno(stdout),fileno(stderr)); + + /* start up the windoze-socket layer stuff */ + if (WSAStartup(0x0101,&foop)) { + fprintf(stderr,"Fatal error: Falied to startup windows sockets\n"); + return -1; + } + + + /* setup the format for opening audio channels */ + wf.wFormatTag = WAVE_FORMAT_PCM; + wf.nChannels = 1; + wf.nSamplesPerSec = 8000; + wf.nAvgBytesPerSec = 16000; + wf.nBlockAlign = 2; + wf.wBitsPerSample = 16; + wf.cbSize = 0; + /* open the audio out channel */ + if (waveOutOpen(&wout,0,&wf,0,0,CALLBACK_NULL) != MMSYSERR_NOERROR) + { + fprintf(stderr,"Fatal Error: Failed to open wave output device\n"); + return -1; + } + /* open the audio in channel */ + if (waveInOpen(&win,0,&wf,0,0,CALLBACK_NULL) != MMSYSERR_NOERROR) + { + fprintf(stderr,"Fatal Error: Failed to open wave input device\n"); + waveOutReset(wout); + waveOutClose(wout); + return -1; + } + /* activate the exit handler */ + atexit(killem); + /* initialize the audio in buffer structures */ + memset(&whin,0,sizeof(whin)); + + if ( (port = iax_init(0) < 0)) { + fprintf(stderr, "Fatal error: failed to initialize iax with port %d\n", port); + return -1; + } + + + iax_set_formats(AST_FORMAT_GSM); + netfd = iax_get_fd(); + + fprintf(f, "Text Based Telephony Client.\n\n"); + issue_prompt(f); + + /* main tight loop */ + while(1) { + /* service the network stuff */ + service_network(netfd,f); + if (outqueue) /* if stuff in audio output queue, free it up if its available */ + { + /* go through audio output queue */ + for(wh = outqueue,wh1 = wh2 = NULL,i = 0; wh != NULL; wh = wh->next) + { + service_network(netfd,f); /* service network here for better performance */ + /* if last one was removed from queue, zot it here */ + if (i && wh1) + { + free(wh1); + wh1 = wh2; + } + i = 0; /* reset "last one removed" flag */ + if (wh->w.dwFlags & WHDR_DONE) /* if this one is done */ + { + /* prepare audio header */ + if ((c = waveOutUnprepareHeader(wout,&wh->w,sizeof(WAVEHDR))) != MMSYSERR_NOERROR) + { + fprintf(stderr,"Cannot unprepare audio out header, error %d\n",c); + exit(255); + } + if (wh1 != NULL) /* if there was a last one */ + { + wh1->next = wh->next; + } + if (outqueue == wh) /* is first one, so set outqueue to next one */ + { + outqueue = wh->next; + } + i = 1; /* set 'to free' flag */ + } + wh2 = wh1; /* save old,old wh pointer */ + wh1 = wh; /* save the old wh pointer */ + } + } + /* go through all audio in buffers, and prepare and queue ones that are currently idle */ + for(i = 0; i < NWHIN; i++) + { + service_network(netfd,f); /* service network stuff here for better performance */ + if (!(whin[i].dwFlags & WHDR_PREPARED)) /* if not prepared, do so */ + { + /* setup this input buffer header */ + memset(&whin[i],0,sizeof(WAVEHDR)); + whin[i].lpData = bufin[i]; + whin[i].dwBufferLength = 320; + whin[i].dwUser = whinserial++; /* set 'user data' to current serial number */ + /* prepare the buffer */ + if (waveInPrepareHeader(win,&whin[i],sizeof(WAVEHDR))) + { + fprintf(stderr,"Unable to prepare header for input\n"); + return -1; + } + /* add it to device (queue) */ + if (waveInAddBuffer(win,&whin[i],sizeof(WAVEHDR))) + { + fprintf(stderr,"Unable to prepare header for input\n"); + return -1; + } + } + waveInStart(win); /* start it (if not already started) */ + } + + /* if key pressed, do command stuff */ + if(_kbhit()) + { + if ( ( fgets(&*rcmd, 256, stdin))) { + rcmd[strlen(rcmd)-1] = 0; + parse_args(f, &*rcmd); + } else fprintf(f, "Fatal error: failed to read data!\n"); + + issue_prompt(f); + } + /* do audio input stuff for buffers that have received data from audio in device already. Must + do them in serial number order (the order in which they were originally queued). */ + if(answered_call) /* send audio only if call answered */ + { + for(;;) /* loop until all are found */ + { + for(i = 0; i < NWHIN; i++) /* find an available one that's the one we are looking for */ + { + service_network(netfd,f); /* service network here for better performance */ + /* if not time to send any more, dont */ + if (GetTickCount() < (lastouttick + OUT_INTERVAL)) + { + i = NWHIN; /* set to value that WILL exit loop */ + break; + } + if ((whin[i].dwUser == nextwhin) && (whin[i].dwFlags & WHDR_DONE)) { /* if audio is ready */ + + /* must have read exactly 320 bytes */ + if (whin[i].dwBytesRecorded != whin[i].dwBufferLength) + { + fprintf(stderr,"Short audio read, got %d bytes, expected %d bytes\n", whin[i].dwBytesRecorded, + whin[i].dwBufferLength); + return -1; + } + if(!most_recent_answer->gsmout) + most_recent_answer->gsmout = gsm_create(); + + service_network(netfd,f); /* service network here for better performance */ + /* encode the audio from the buffer into GSM format */ + gsm_encode(most_recent_answer->gsmout, (short *) ((char *) whin[i].lpData), fo); + if(iax_send_voice(most_recent_answer->session, + AST_FORMAT_GSM, (char *)fo, sizeof(gsm_frame)) == -1) + puts("Failed to send voice!"); + lastouttick = GetTickCount(); /* save time of last output */ + + /* unprepare (free) the header */ + waveInUnprepareHeader(win,&whin[i],sizeof(WAVEHDR)); + /* initialize the buffer */ + memset(&whin[i],0,sizeof(WAVEHDR)); + /* bump the serial number to look for the next time */ + nextwhin++; + /* exit the loop so that we can start at lowest buffer again */ + break; + } + } + if (i >= NWHIN) break; /* if all found, get out of loop */ + } + } + + } + return 0; +} + +void +do_iax_event(FILE *f) { + int sessions = 0; + struct iax_event *e = 0; + struct peer *peer; + + while ( (e = iax_get_event(0))) { + peer = find_peer(e->session); + if(peer) { + handle_event(f, e, peer); + } else { + if(e->etype != IAX_EVENT_CONNECT) { + fprintf(stderr, "Huh? This is an event for a non-existant session?\n"); + } + sessions++; + + if(sessions >= MAX_SESSIONS) { + fprintf(f, "Missed a call... too many sessions open.\n"); + } + + + if(e->event.connect.callerid && e->event.connect.dnid) + fprintf(f, "Call from '%s' for '%s'", e->event.connect.callerid, + e->event.connect.dnid); + else if(e->event.connect.dnid) { + fprintf(f, "Call from '%s'", e->event.connect.dnid); + } else if(e->event.connect.callerid) { + fprintf(f, "Call from '%s'", e->event.connect.callerid); + } else printf("Call from"); + fprintf(f, " (%s)\n", inet_ntoa(iax_get_peer_addr(e->session).sin_addr)); + + if(most_recent_answer) { + fprintf(f, "Incoming call ignored, there's already a call waiting for answer... \ +please accept or reject first\n"); + iax_reject(e->session, "Too many calls, we're busy!"); + } else { + if ( !(peer = malloc(sizeof(struct peer)))) { + fprintf(f, "Warning: Unable to allocate memory!\n"); + return; + } + + peer->time = time(0); + peer->session = e->session; + peer->gsmin = 0; + peer->gsmout = 0; + + peer->next = peers; + peers = peer; + + iax_accept(peer->session); + iax_ring_announce(peer->session); + most_recent_answer = peer; + fprintf(f, "Incoming call!\n"); + } + iax_event_free(e); + issue_prompt(f); + } + } +} + +void +call(FILE *f, char *num) +{ + struct peer *peer; + + if(!newcall) + newcall = iax_session_new(); + else { + fprintf(f, "Already attempting to call somewhere, please cancel first!\n"); + return; + } + + if ( !(peer = malloc(sizeof(struct peer)))) { + fprintf(f, "Warning: Unable to allocate memory!\n"); + return; + } + + peer->time = time(0); + peer->session = newcall; + peer->gsmin = 0; + peer->gsmout = 0; + + peer->next = peers; + peers = peer; + + most_recent_answer = peer; + + iax_call(peer->session, num, 10); +} + +void +answer_call(void) +{ + if(most_recent_answer) + iax_answer(most_recent_answer->session); + printf("Answering call!\n"); + answered_call = 1; +} + +void +dump_call(void) +{ + if(most_recent_answer) + { + iax_hangup(most_recent_answer->session,""); + free(most_recent_answer); + } + printf("Dumping call!\n"); + answered_call = 0; + most_recent_answer = 0; + answered_call = 0; + peers = 0; + newcall = 0; +} + +void +reject_call(void) +{ + iax_reject(most_recent_answer->session, "Call rejected manually."); + most_recent_answer = 0; +} + +void +handle_event(FILE *f, struct iax_event *e, struct peer *p) +{ + int len,n; + WHOUT *wh,*wh1; + short fr[160]; + static paused_xmit = 0; + + + switch(e->etype) { + case IAX_EVENT_HANGUP: + iax_hangup(most_recent_answer->session, "Byeee!"); + fprintf(f, "Call disconnected by peer\n"); + free(most_recent_answer); + most_recent_answer = 0; + answered_call = 0; + peers = 0; + newcall = 0; + + break; + + case IAX_EVENT_REJECT: + fprintf(f, "Authentication was rejected\n"); + break; + case IAX_EVENT_ACCEPT: + fprintf(f, "Waiting for answer... RING RING\n"); + issue_prompt(f); + break; + case IAX_EVENT_ANSWER: + answer_call(); + break; + case IAX_EVENT_VOICE: + switch(e->event.voice.format) { + case AST_FORMAT_GSM: + if(e->event.voice.datalen % 33) { + fprintf(stderr, "Weird gsm frame, not a multiple of 33.\n"); + break; + } + + if (!p->gsmin) + p->gsmin = gsm_create(); + + len = 0; + while(len < e->event.voice.datalen) { + if(gsm_decode(p->gsmin, (char *) e->event.voice.data + len, fr)) { + fprintf(stderr, "Bad GSM data\n"); + break; + } else { /* its an audio packet to be output to user */ + + /* get count of pending items in audio output queue */ + n = 0; + if (outqueue) + { /* determine number of pending out queue items */ + for(wh = outqueue; wh != NULL; wh = wh->next) + { + if (!(wh->w.dwFlags & WHDR_DONE)) n++; + } + } + /* if not too many, send to user, otherwise chuck packet */ + if (n <= OUT_DEPTH) /* if not to chuck packet */ + { + /* malloc the memory for the queue item */ + wh = (WHOUT *) malloc(sizeof(WHOUT)); + if (wh == (WHOUT *) NULL) /* if error, bail */ + { + fprintf(stderr,"Outa memory!!!!\n"); + exit(255); + } + /* initialize the queue entry */ + memset(wh,0,sizeof(WHOUT)); + /* copy the PCM data from the gsm conversion buffer */ + memcpy((char *)wh->data,(char *)fr,sizeof(fr)); + /* set parameters for data */ + wh->w.lpData = (char *) wh->data; + wh->w.dwBufferLength = 320; + + /* prepare buffer for output */ + if (waveOutPrepareHeader(wout,&wh->w,sizeof(WAVEHDR))) + { + fprintf(stderr,"Cannot prepare header for audio out\n"); + exit(255); + } + /* if not currently transmitting, hold off a couple of packets for + smooth sounding output */ + if ((!n) && (!paused_xmit)) + { + /* pause output (before starting) */ + waveOutPause(wout); + /* indicate as such */ + paused_xmit = 1; + } + /* queue packet for output on audio device */ + if (waveOutWrite(wout,&wh->w,sizeof(WAVEHDR))) + { + fprintf(stderr,"Cannot output to wave output device\n"); + exit(255); + } + /* if we are paused, and we have enough packets, start audio */ + if ((n > OUT_PAUSE_THRESHOLD) && paused_xmit) + { + /* start the output */ + waveOutRestart(wout); + /* indicate as such */ + paused_xmit = 0; + } + /* insert it onto tail of outqueue */ + if (outqueue == NULL) /* if empty queue */ + outqueue = wh; /* point queue to new entry */ + else /* otherwise is non-empty queue */ + { + wh1 = outqueue; + while(wh1->next) wh1 = wh1->next; /* find last entry in queue */ + wh1->next = wh; /* point it to new entry */ + } + } +#ifdef PRINTCHUCK + else printf("Chucking packet!!\n"); +#endif + } + len += 33; + } + break; + default : + fprintf(f, "Don't know how to handle that format %d\n", e->event.voice.format); + } + break; + case IAX_EVENT_RINGA: + break; + default: + fprintf(f, "Unknown event: %d\n", e->etype); + break; + } +} + +void +parse_cmd(FILE *f, int argc, char **argv) +{ + _strupr(argv[0]); + if(!strcmp(argv[0], "HELP")) { + if(argc == 1) + dump_array(f, help); + else if(argc == 2) { + if(!strcmp(argv[1], "HELP")) + fprintf(f, "Help <Command>\t-\tDisplays general help or specific help on command if supplied an arguement\n"); + else if(!strcmp(argv[1], "QUIT")) + fprintf(f, "Quit\t\t-\tShuts down the miniphone\n"); + else fprintf(f, "No help available on %s\n", argv[1]); + } else { + fprintf(f, "Too many arguements for command help.\n"); + } + } else if(!strcmp(argv[0], "STATUS")) { + if(argc == 1) { + int c = 0; + struct peer *peerptr = peers; + + if(!peerptr) + fprintf(f, "No session matches found.\n"); + else while(peerptr) { + fprintf(f, "Listing sessions:\n\n"); + fprintf(f, "Session %d\n", ++c); + fprintf(f, "Session existed for %d seconds\n", (int)time(0)-peerptr->time); + if(answered_call) + fprintf(f, "Call answered.\n"); + else fprintf(f, "Call ringing.\n"); + + peerptr = peerptr->next; + } + } else fprintf(f, "Too many arguments for command status.\n"); + } else if(!strcmp(argv[0], "ANSWER")) { + if(argc > 1) + fprintf(f, "Too many arguements for command answer\n"); + else answer_call(); + } else if(!strcmp(argv[0], "REJECT")) { + if(argc > 1) + fprintf(f, "Too many arguements for command reject\n"); + else { + fprintf(f, "Rejecting current phone call.\n"); + reject_call(); + } + } else if(!strcmp(argv[0], "CALL")) { + if(argc > 2) + fprintf(f, "Too many arguements for command call\n"); + else { + call(f, argv[1]); + } + } else if(!strcmp(argv[0], "DUMP")) { + if(argc > 1) + fprintf(f, "Too many arguements for command dump\n"); + else { + dump_call(); + } + } else if(!strcmp(argv[0], "DTMF")) { + if(argc > 2) + { + fprintf(f, "Too many arguements for command dtmf\n"); + return; + } + if (argc < 1) + { + fprintf(f, "Too many arguements for command dtmf\n"); + return; + } + if(most_recent_answer) + iax_send_dtmf(most_recent_answer->session,*argv[1]); + } else if(!strcmp(argv[0], "QUIT")) { + if(argc > 1) + fprintf(f, "Too many arguements for command quit\n"); + else { + fprintf(f, "Good bye!\n"); + exit(1); + } + } else fprintf(f, "Unknown command of %s\n", argv[0]); +} + +void +issue_prompt(FILE *f) +{ + fprintf(f, "TeleClient> "); + fflush(f); +} + +void +dump_array(FILE *f, char **array) { + while(*array) + fprintf(f, "%s\n", *array++); +} diff --git a/libs/libiax2/src/winpoop.h b/libs/libiax2/src/winpoop.h new file mode 100644 index 0000000000000000000000000000000000000000..3089a5ffaf6248a821e851f98843299411e25695 --- /dev/null +++ b/libs/libiax2/src/winpoop.h @@ -0,0 +1,41 @@ +/* + * Functions Windows doesn't have... but should + * Copyright(C) 2001, Linux Support Services, Inc. + * + * Distributed under GNU LGPL. + * + * These are NOT fully compliant with BSD 4.3 and are not + * threadsafe. + * + */ + +#ifndef _winpoop_h +#define _winpoop_h + +#if defined(_MSC_VER) +#define INLINE __inline +#else +#define INLINE inline +#endif + +#include <winsock.h> + +void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz); + +static INLINE int inet_aton(char *cp, struct in_addr *inp) +{ + int a1, a2, a3, a4; + unsigned int saddr; + + if (sscanf(cp, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) != 4) + return 0; + a1 &= 0xff; + a2 &= 0xff; + a3 &= 0xff; + a4 &= 0xff; + saddr = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4; + inp->s_addr = htonl(saddr); + return 1; +} + +#endif diff --git a/platform/fedora.spec b/platform/fedora.spec index ca72da6df5f32a68e3cfc7b649d7582f511bdadc..65e07034a533b7780f4f5641e7e1c04f39b11da7 100644 --- a/platform/fedora.spec +++ b/platform/fedora.spec @@ -1,30 +1,37 @@ %define name sflphone -%define version 0.9.2 +%define version Autoreq: 0 Name: %name Summary: A VoIP daemon with SIP protocol and IAX protocol Version: %version -Release: 6fedora +Release: 2fedora License: GPL Group: System Environment/Daemons URL: http://www.sflphone.org/ -Packager: Yun Liu <yun.liu@savoirfairelinux.com> +Packager: Emmanuel Milou <emmanuel.milouu@savoirfairelinux.com> Source0: %{name}-%{version}.tar.gz Source1: libpj-sfl.pc BuildRoot: %{_tmppath}/%{name}-%{version} -Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex sflphone-iax2 dbus-c++ libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl +Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl %description -SFLPhoned is a VoIP daeamon with SIP protocol and IAX protocol. +SFLphoned is a VoIP daeamon with SIP protocol and IAX protocol. %prep %setup -q -cd libs/pjproject-1.0 +cd libs/pjproject-1.0.1 ./configure --prefix=/usr make dep make clean make +cd ../dbus-c++ +./configure --prefix=/usr +make +cd ../libiax2 +./gen.sh +./configure --prefix=/usr +make cd ../.. %build @@ -41,8 +48,15 @@ cd .. cd sflphone-gtk/ %makeinstall -cd ../libs/pjproject-1.0 +cd ../libs/pjproject-1.0.1 +%makeinstall + +cd ../dbus-c++ +%makeinstall + +cd ../libiax2 %makeinstall + cd ../.. cd %{buildroot}/usr/bin/ ln -sf ./sflphone-gtk sflphone @@ -69,6 +83,9 @@ rm -rf %{buildroot} %changelog +* Mon Feb 16 2009 Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> 2fedora + - Packaging 0.9.3-2 sflphone version on Fedora 10 + * Mon Jan 26 2009 Yun Liu <yun.liu@savoirfairelinux.com> 6 - Packaging sflphone for Fedora 10 diff --git a/platform/fedora/sflphone-fc9.spec b/platform/fedora.spec.in similarity index 65% rename from platform/fedora/sflphone-fc9.spec rename to platform/fedora.spec.in index e7d8a1e21034f793403f290120056ddc7d4b1ea7..6267600c783adeb1f44c53203890a6e55c41f0b2 100644 --- a/platform/fedora/sflphone-fc9.spec +++ b/platform/fedora.spec.in @@ -1,39 +1,44 @@ %define name sflphone -%define version 0.9.2 +%define version @VERSION@ Autoreq: 0 Name: %name Summary: A VoIP daemon with SIP protocol and IAX protocol Version: %version -Release: 2 +Release: 2fedora License: GPL Group: System Environment/Daemons URL: http://www.sflphone.org/ -Packager: Yun Liu <yun.liu@savoirfairelinux.com> +Packager: Emmanuel Milou <emmanuel.milouu@savoirfairelinux.com> Source0: %{name}-%{version}.tar.gz Source1: libpj-sfl.pc BuildRoot: %{_tmppath}/%{name}-%{version} -Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex sflphone-iax2 dbus-c++ libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl +Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl %description -SFLPhoned is a VoIP daeamon with SIP protocol and IAX protocol. +SFLphoned is a VoIP daeamon with SIP protocol and IAX protocol. %prep %setup -q -cd libs/pjproject-1.0 +cd libs/pjproject-1.0.1 ./configure --prefix=/usr make dep make clean make +cd ../dbus-c++ +./configure --prefix=/usr +make +cd ../libiax2 +./gen.sh +./configure --prefix=/usr +make cd ../.. %build -./autogen.sh -./configure --prefix=/usr +./autogen.sh --prefix=/usr make cd sflphone-gtk/ -./autogen.sh -./configure --prefix=/usr +./autogen.sh --prefix=/usr make cd .. @@ -43,21 +48,27 @@ cd .. cd sflphone-gtk/ %makeinstall -cd ../libs/pjproject-1.0 +cd ../libs/pjproject-1.0.1 %makeinstall + +cd ../dbus-c++ +%makeinstall + +cd ../libiax2 +%makeinstall + cd ../.. cd %{buildroot}/usr/bin/ ln -sf ./sflphone-gtk sflphone cd - cp %{SOURCE1} %{buildroot}/usr/lib/pkgconfig/ -f -rm -f %{buildroot}/usr/include/Makefile.* -rm -rf %{buildroot}/usr/lib/debug +rm -rf %{buildroot}/usr/lib/debug +rm -rf %{buildroot}/usr/include/ %files %defattr(-, root, root) /usr/bin/* -/usr/include/* /usr/lib/* /usr/share/applications/* /usr/share/dbus-1/services/* @@ -72,6 +83,12 @@ rm -rf %{buildroot} %changelog +* Mon Feb 16 2009 Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> 2fedora + - Packaging 0.9.3-2 sflphone version on Fedora 10 + +* Mon Jan 26 2009 Yun Liu <yun.liu@savoirfairelinux.com> 6 + - Packaging sflphone for Fedora 10 + * Mon Jan 5 2009 Yun Liu <yun.liu@savoirfairelinux.com> - Fix bug ticket #107, #108, #109, #110, #111, #117, #129 diff --git a/platform/fedora/sflphone-fc6.spec.in b/platform/fedora/sflphone-fc6.spec.in deleted file mode 100644 index 03640ada06f164834af4f33d4af15fe5f2058056..0000000000000000000000000000000000000000 --- a/platform/fedora/sflphone-fc6.spec.in +++ /dev/null @@ -1,52 +0,0 @@ -%define name sflphone -%define version @RPM_VERSION@ -Autoreq: 0 - -Name: %name -Summary: A VoIP daemon with SIP protocol -Version: %version -Release: 1 -License: GPL -Group: System Environment/Daemons -URL: http://www.sflphone.org/ -Packager: Cyrille Béraud <cyrille.beraud@savoirfairelinux.com> -Source0: http://www.sflphone.org/releases/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Requires: commoncpp2 ccrtp libosip2 libeXosip2 libsamplerate qt - -%description -SFLPhoned is a VoIP daeamon with SIP protocol. -%prep -%setup -q - -%build -%configure --prefix=%{_prefix} -make - -%install -rm -fr %{buildroot} - -%makeinstall - -%clean -rm -rf %{buildroot} - -%files -%defattr(-, root, root) -%{_bindir}/sflphone -%{_libexecdir}/sflphoned -%{_libexecdir}/sflphone-qt -%{_libexecdir}/sflphone-cli -%{_datadir}/sflphone/ringtones/* -%{_datadir}/sflphone/skins/* - -%changelog -* Thu Nov 30 2006 Yan Morin <yan.morin@savoirfairelinux.com> - Packaging sflphone for Fedora Core 6 - -* Wed Sep 6 2006 Yan Morin <yan.morin@savoirfairelinux.com> - Packaging sflphone, sflphone-qt and sflphone-cli - -* Mon Nov 21 2005 Yan Morin <yan.morin@savoirfairelinux.com> -- Final 0.6.0 version (Release / Source without alphatag) - diff --git a/platform/fedora/sflphone.spec.in b/platform/fedora/sflphone.spec.in deleted file mode 100644 index 08746b9cde308add4b89f5905f2e9a4c66677a10..0000000000000000000000000000000000000000 --- a/platform/fedora/sflphone.spec.in +++ /dev/null @@ -1,49 +0,0 @@ -%define name sflphone -%define version @RPM_VERSION@ -Autoreq: 0 - -Name: %name -Summary: A VoIP daemon with SIP protocol -Version: %version -Release: 1 -License: GPL -Group: System Environment/Daemons -URL: http://www.sflphone.org/ -Packager: Cyrille Béraud <cyrille.beraud@savoirfairelinux.com> -Source0: http://www.sflphone.org/releases/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Requires: commoncpp2 ccrtp libosip2 libexosip2 samplerate qt - -%description -SFLPhoned is a VoIP daeamon with SIP protocol. -%prep -%setup -q - -%build -%configure --prefix=%{_prefix} -make - -%install -rm -fr %{buildroot} - -%makeinstall - -%clean -rm -rf %{buildroot} - -%files -%defattr(-, root, root) -%{_bindir}/sflphone -%{_libexecdir}/sflphoned -%{_libexecdir}/sflphone-qt -%{_libexecdir}/sflphone-cli -%{_datadir}/sflphone/ringtones/* -%{_datadir}/sflphone/skins/* - -%changelog -* Wed Sep 6 2006 Yan Morin <yan.morin@savoirfairelinux.com> - Packaging sflphone, sflphone-qt and sflphone-cli - -* Mon Nov 21 2005 Yan Morin <yan.morin@savoirfairelinux.com> -- Final 0.6.0 version (Release / Source without alphatag) - diff --git a/platform/fedora/sflphoned.spec.in b/platform/fedora/sflphoned.spec.in deleted file mode 100644 index 4066ea8694887cf837104f19ca5814ba85036dd7..0000000000000000000000000000000000000000 --- a/platform/fedora/sflphoned.spec.in +++ /dev/null @@ -1,48 +0,0 @@ -%define name sflphoned -%define version @RPM_VERSION@ -%define alphatag @RPM_RELEASE@ -Autoreq: 0 - -Name: %name -Summary: A VoIP daemon with SIP protocol -Version: %version -Release: 1 -#Release: 0.1.%{alphatag} -License: GPL -Group: System Environment/Daemons -URL: http://www.sflphone.org/ -Packager: Cyrille Béraud <cyrille.beraud@savoirfairelinux.com> -#Source0: http://www.sflphone.org/releases/%{name}-%{version}-%{alphatag}.tar.gz -Source0: http://www.sflphone.org/releases/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Requires: commoncpp2 ccrtp libosip2 -BuildRequires: autoconf -BuildRequires: automake - -%description -SFLPhoned is a VoIP daeamon with SIP protocol. -%prep -%setup -q - -%build -%configure --disable-zeroconf --prefix=%{_prefix} -make - -%install -rm -fr %{buildroot} - -%makeinstall - -%clean -rm -rf %{buildroot} - -%files -%defattr(-, root, root) -%{_bindir}/sflphone -%{_libexecdir}/sflphoned -%{_datadir}/sflphone/ringtones/* - -%changelog -* Mon Nov 21 2005 Yan Morin <yan.morin@savoirfairelinux.com> -- Final 0.6.0 version (Release / Source without alphatag) - diff --git a/platform/suse.spec b/platform/suse.spec index cb1442c411c9c2fdf77c388264820d2efcae5a29..82a3412cce7835698c1e052b2c9ffd1a8f89c6eb 100644 --- a/platform/suse.spec +++ b/platform/suse.spec @@ -1,30 +1,37 @@ %define name sflphone -%define version 0.9.2 +%define version Autoreq: 0 Name: %name Summary: A VoIP daemon with SIP protocol and IAX protocol Version: %version -Release: 6suse +Release: 2suse License: GPL Group: System Environment/Daemons URL: http://www.sflphone.org/ -Packager: Yun Liu <yun.liu@savoirfairelinux.com> +Packager: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Source0: %{name}-%{version}.tar.gz Source1: libpj-sfl.pc BuildRoot: %{_tmppath}/%{name}-%{version} -Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex sflphone-iax2 dbus-c++ libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl +Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl %description -SFLPhoned is a VoIP daeamon with SIP protocol and IAX protocol. +SFLphoned is a VoIP daeamon with SIP protocol and IAX protocol. %prep %setup -q -cd libs/pjproject-1.0 +cd libs/pjproject-1.0.1 ./configure --prefix=/usr make dep make clean make +cd ../dbus-c++ +./configure --prefix=/usr +make +cd ../libiax2 +./gen.sh +./configure --prefix=/usr +make cd ../.. %build @@ -41,7 +48,13 @@ make prefix=%{buildroot}/usr install cd sflphone-gtk/ make prefix=%{buildroot}/usr install -cd ../libs/pjproject-1.0 +cd ../libs/pjproject-1.0.1 +make prefix=%{buildroot}/usr install + +cd ../dbus-c++ +make prefix=%{buildroot}/usr install + +cd ../libiax2 make prefix=%{buildroot}/usr install cd ../.. @@ -67,9 +80,10 @@ rm -rf %{buildroot}/usr/include %clean rm -rf %{buildroot} - - %changelog +* Mon Feb 16 2009 Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> 2suse + - Packaging 0.9.3-2 sflphone version on openSUSE 11 + * Mon Jan 26 2009 Yun Liu <yun.liu@savoirfairelinux.com> 6suse - Packaging sflphone on openSUSE 11 diff --git a/platform/suse.spec.in b/platform/suse.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..74e1ae85efd920a53996244457c8197ebacbe9d8 --- /dev/null +++ b/platform/suse.spec.in @@ -0,0 +1,104 @@ +%define name sflphone +%define version @VERSION@ +Autoreq: 0 + +Name: %name +Summary: A VoIP daemon with SIP protocol and IAX protocol +Version: %version +Release: 2suse +License: GPL +Group: System Environment/Daemons +URL: http://www.sflphone.org/ +Packager: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> +Source0: %{name}-%{version}.tar.gz +Source1: libpj-sfl.pc +BuildRoot: %{_tmppath}/%{name}-%{version} +Requires: commoncpp2 ccrtp cppunit libsamplerate pulseaudio-libs-zeroconf pulseaudio-libs-devel gsm speex libgcc dbus-glib expat gtk2 glibc glib2 dbus-libs dbus-glib libsexy libnotify perl + +%description +SFLphoned is a VoIP daeamon with SIP protocol and IAX protocol. + +%prep +%setup -q +cd libs/pjproject-1.0.1 +./configure --prefix=/usr +make dep +make clean +make +cd ../dbus-c++ +./configure --prefix=/usr +make +cd ../libiax2 +./gen.sh +./configure --prefix=/usr +make +cd ../.. + +%build +./autogen.sh --prefix=/usr +make +cd sflphone-gtk/ +./autogen.sh --prefix=/usr +make +cd .. + +%install +make prefix=%{buildroot}/usr install + +cd sflphone-gtk/ +make prefix=%{buildroot}/usr install + +cd ../libs/pjproject-1.0.1 +make prefix=%{buildroot}/usr install + +cd ../dbus-c++ +make prefix=%{buildroot}/usr install + +cd ../libiax2 +make prefix=%{buildroot}/usr install + +cd ../.. +cd %{buildroot}/usr/bin/ +ln -sf ./sflphone-gtk sflphone +cd - +cp %{SOURCE1} %{buildroot}/usr/lib/pkgconfig/ -f + +rm -rf %{buildroot}/usr/lib/debug +rm -rf %{buildroot}/usr/include + +%files +%defattr(-, root, root) +/usr/bin/* +/usr/lib/* +/usr/share/applications/* +/usr/share/dbus-1/services/* +/usr/share/locale/* +/usr/share/pixmaps/* +/usr/share/sflphone/* +/usr/share/man/* + +%clean +rm -rf %{buildroot} + +%changelog +* Mon Feb 16 2009 Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> 2suse + - Packaging 0.9.3-2 sflphone version on openSUSE 11 + +* Mon Jan 26 2009 Yun Liu <yun.liu@savoirfairelinux.com> 6suse + - Packaging sflphone on openSUSE 11 + +* Mon Jan 5 2009 Yun Liu <yun.liu@savoirfairelinux.com> + - Fix bug ticket #107, #108, #109, #110, #111, #117, #129 + +* Thu Nov 6 2008 Yun Liu <yun.liu@savoirfairelinux.com> + - Packaging sflphone for Fedora 9 + +* Thu Nov 30 2006 Yan Morin <yan.morin@savoirfairelinux.com> + Packaging sflphone for Fedora Core 6 + +* Wed Sep 6 2006 Yan Morin <yan.morin@savoirfairelinux.com> + Packaging sflphone, sflphone-qt and sflphone-cli + +* Mon Nov 21 2005 Yan Morin <yan.morin@savoirfairelinux.com> +- Final 0.6.0 version (Release / Source without alphatag) + diff --git a/sflphone-gtk/README b/sflphone-gtk/README index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..368bd98433516b06b421fa39da13845fdf35adf7 100644 --- a/sflphone-gtk/README +++ b/sflphone-gtk/README @@ -0,0 +1,5 @@ +Welcome to SFLphone! + +Refer to the development site for further information: http://dev.savoirfairelinux.net/sflphone + +Thank you diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 161935df460a4759343761a1d3ede8832d9d49a3..6d6bbe50b07bdde12073bf4567ab5dd476d2f2f5 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -135,6 +135,8 @@ sflphone_hung_up( call_t * c) #if GTK_CHECK_VERSION(2,10,0) status_tray_icon_blink( FALSE ); #endif + + statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); } /** Internal to actions: Fill account list */ @@ -449,6 +451,10 @@ process_dialing(call_t * c, guint keyval, gchar * key) dbus_start_tone( FALSE , 0 ); //dbus_play_dtmf( key ); } + + g_print("process_dialing : keyval : %i \n",keyval); + g_print("process_dialing : key : %s \n",key); + switch (keyval) { case 65293: /* ENTER */ @@ -462,9 +468,10 @@ process_dialing(call_t * c, guint keyval, gchar * key) { /* Brackets mandatory because of local vars */ gchar * before = c->to; if(strlen(c->to) >= 1){ + c->to = g_strndup(c->to, strlen(c->to) -1); g_free(before); - g_print("TO: %s\n", c->to); + g_print("TO: backspace %s\n", c->to); if(c->state == CALL_STATE_DIALING) { @@ -487,14 +494,16 @@ process_dialing(call_t * c, guint keyval, gchar * key) case 65509: /* CAPS */ break; default: - if (keyval < 255 || (keyval >65453 && keyval < 65466)) + // if (keyval < 255 || (keyval >65453 && keyval < 65466)) + if (keyval < 127) { - if(c->state != CALL_STATE_TRANSFERT) + + if(c->state != CALL_STATE_TRANSFERT) dbus_play_dtmf( key ); gchar * before = c->to; c->to = g_strconcat(c->to, key, NULL); g_free(before); - g_print("TO: %s\n", c->to); + g_print("TO:default %s\n", c->to); if(c->state == CALL_STATE_DIALING) { @@ -512,6 +521,9 @@ process_dialing(call_t * c, guint keyval, gchar * key) call_t * sflphone_new_call() { + + sflphone_on_hold(); + // Play a tone when creating a new call if( call_list_get_size(current_calls) == 0 ) dbus_start_tone( TRUE , ( voice_mails > 0 )? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ; @@ -539,7 +551,7 @@ sflphone_new_call() void sflphone_keypad( guint keyval, gchar * key) { - + call_t * c = call_get_selected(current_calls); if(c) { @@ -548,6 +560,7 @@ sflphone_keypad( guint keyval, gchar * key) case CALL_STATE_DIALING: // Currently dialing => edit number process_dialing(c, keyval, key); break; + case CALL_STATE_RECORD: case CALL_STATE_CURRENT: switch (keyval) { @@ -681,7 +694,17 @@ sflphone_place_call ( call_t * c ) else { - account_t * current = account_list_get_current(); + account_t * current; + + if(c->accountID != 0) + current = account_list_get_by_id(c->accountID); + else + current = account_list_get_current(); + + // printf("sflphone_place_call :: c->accountID : %i \n",c->accountID); + + // account_t * current = c->accountID; + if( current ) { if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0) @@ -724,6 +747,31 @@ sflphone_place_call ( call_t * c ) } +void +sflphone_display_selected_codec (const gchar* codecName) +{ + call_t * selectedCall = call_get_selected(current_calls); + gchar* msg; + account_t* acc; + if(selectedCall->accountID != NULL){ + acc = account_list_get_by_id(selectedCall->accountID); + msg = g_markup_printf_escaped(_("%s account- %s %s") , + (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_TYPE), + (gchar*)g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS), + codecName); + statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT); + g_free(msg); + } + +} + +gchar* +sflphone_get_current_codec_name() +{ + call_t * selectedCall = call_get_selected(current_calls); + return dbus_get_current_codec_name(selectedCall); +} + void sflphone_rec_call() { @@ -745,6 +793,9 @@ sflphone_rec_call() } update_call_tree(current_calls,selectedCall); update_menus(); + + // gchar* codname = sflphone_get_current_codec_name(); + // printf("sflphone_get_current_codec_name: %s \n",codname); } /* Internal to action - set the __CURRENT_ACCOUNT variable */ @@ -807,3 +858,4 @@ sflphone_fill_codec_list() exit(0); } } + diff --git a/sflphone-gtk/src/actions.h b/sflphone-gtk/src/actions.h index ebe0157fe885f0ba6293c45bf42cdf1d44ebfdc4..7c22eeb1b9cc7d9a57fb930ff14580bbc8294cf1 100644 --- a/sflphone-gtk/src/actions.h +++ b/sflphone-gtk/src/actions.h @@ -168,4 +168,8 @@ void sflphone_fill_codec_list(); void sflphone_record (call_t *c); void sflphone_rec_call (void); + +gchar* sflphone_get_current_codec_name(); + +void sflphone_display_selected_codec (const gchar* codecName); #endif diff --git a/sflphone-gtk/src/assistant.c b/sflphone-gtk/src/assistant.c index 69b995f9cdc6ecd0c98208423017129021417a23..5a6f62d4e1c04cc5d2c73ad4663d34be7681f477 100644 --- a/sflphone-gtk/src/assistant.c +++ b/sflphone-gtk/src/assistant.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2008 Savoir-Faire Linux inc. * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * + * * This program 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + *Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> @@ -29,6 +29,7 @@ #define SFLPHONE_ORG_SERVER "sip.sflphone.org" #define SFLPHONE_ORG_ALIAS "sflphone.org" + struct _wizard *wiz; static int account_type; static int use_sflphone_org = 1; @@ -43,20 +44,18 @@ static gint forward_page_func( gint current_page , gpointer data ); * Page template */ static GtkWidget* create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section); - - void -set_account_type( GtkWidget* widget , gpointer data UNUSED ) -{ - - if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget )) ){ - account_type = _SIP; - }else{ - account_type = _IAX ; - } +void prefill_sip(void) ; + +void set_account_type( GtkWidget* widget , gpointer data UNUSED ) { + if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget )) ){ + account_type = _SIP; + }else{ + account_type = _IAX ; + } } void set_sflphone_org( GtkWidget* widget , gpointer data UNUSED ) { - use_sflphone_org = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) && 1; + use_sflphone_org = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))?1:0) ; } @@ -65,444 +64,447 @@ void set_sflphone_org( GtkWidget* widget , gpointer data UNUSED ) { * Callback when the close button of the dialog is clicked * Action : close the assistant widget and get back to sflphone main window */ -static void close_callback( void ) -{ - gtk_widget_destroy(wiz->assistant); - g_free(wiz); wiz = NULL; +static void close_callback( void ) { + gtk_widget_destroy(wiz->assistant); + g_free(wiz); wiz = NULL; } /** * Callback when the cancel button of the dialog is clicked * Action : close the assistant widget and get back to sflphone main window */ -static void cancel_callback( void ) -{ - gtk_widget_destroy(wiz->assistant); - g_free(wiz); wiz = NULL; +static void cancel_callback( void ) { + gtk_widget_destroy(wiz->assistant); + g_free(wiz); wiz = NULL; } /** * Callback when the button apply is clicked * Action : Set the account parameters with the entries values and called dbus_add_account */ - static void -sip_apply_callback( void ) -{ - if( account_type == _SIP ) - { - g_print("SIP APPLY CALLBACK\n"); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_server)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_password)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_username)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable))? "TRUE":"FALSE")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->addr)))); - - dbus_add_account( current ); - account_list_set_current_id( current->accountID ); - g_print( "ACCOUNT ID = %s\n" , current->accountID ); - } +static void sip_apply_callback( void ) { + if(use_sflphone_org){ + prefill_sip(); + account_type = _SIP; + } + if( account_type == _SIP ) { + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_server)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_password)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_username)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable))? "TRUE":"FALSE"))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->addr)))); + + dbus_add_account( current ); + account_list_set_current_id( current->accountID ); + } } /** * Callback when the button apply is clicked * Action : Set the account parameters with the entries values and called dbus_add_account */ - static void -iax_apply_callback( void ) -{ - if( account_type == _IAX) - { - g_print("IAX APPLY CALLBACK\n"); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX")); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server)))); - g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password)))); - - dbus_add_account( current ); - account_list_set_current_id( current->accountID ); - g_print( "ACCOUNT ID = %s\n" , current->accountID ); - } +static void iax_apply_callback( void ) { + if( account_type == _IAX) { + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX")); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server)))); + g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password)))); + dbus_add_account( current ); + account_list_set_current_id( current->accountID ); + } } - void -enable_stun( GtkWidget* widget ) -{ - gtk_widget_set_sensitive( GTK_WIDGET( wiz->addr ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); +void enable_stun( GtkWidget* widget ) { + gtk_widget_set_sensitive( GTK_WIDGET( wiz->addr ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); } - void -build_wizard( void ) -{ -if(!wiz){ - wiz = ( struct _wizard* )g_malloc( sizeof( struct _wizard)); - current = g_new0(account_t, 1); - current->properties = g_hash_table_new(NULL, g_str_equal); - //current ->accountID = "test"; - - wiz->assistant = gtk_assistant_new( ); - gtk_window_set_title( GTK_WINDOW(wiz->assistant), _("SFLphone account configuration wizard") ); - gtk_window_set_position(GTK_WINDOW(wiz->assistant), GTK_WIN_POS_CENTER); - gtk_window_set_default_size(GTK_WINDOW(wiz->assistant), 200 , 200); - gtk_assistant_set_forward_page_func( GTK_ASSISTANT( wiz->assistant ), (GtkAssistantPageFunc) forward_page_func , NULL , NULL ); - - build_intro(); - build_sfl_or_account(); - build_select_account(); - build_sip_account_configuration(); - build_nat_settings(); - build_iax_account_configuration(); - build_registration_error(); - build_summary(); - - g_signal_connect(G_OBJECT(wiz->assistant), "close" , G_CALLBACK(close_callback), NULL); - g_signal_connect(G_OBJECT(wiz->assistant), "cancel" , G_CALLBACK(cancel_callback), NULL); - - gtk_widget_show_all(wiz->assistant); - - gtk_assistant_update_buttons_state(GTK_ASSISTANT(wiz->assistant)); - } -} +void build_wizard( void ) { + if (wiz) + return ; - GtkWidget* -build_intro() -{ - GtkWidget *label; + wiz = ( struct _wizard* )g_malloc( sizeof( struct _wizard)); + current = g_new0(account_t, 1); + current->properties = g_hash_table_new(NULL, g_str_equal); - wiz->intro = create_vbox( GTK_ASSISTANT_PAGE_INTRO , _("SFLphone 0.9.2") , _("Welcome to SFLphone!")); + wiz->assistant = gtk_assistant_new( ); - label = gtk_label_new(_("This installation wizard will help you configure an account.")) ; - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); - gtk_box_pack_start(GTK_BOX(wiz->intro), label, FALSE, TRUE, 0); + gtk_window_set_title( GTK_WINDOW(wiz->assistant), _("SFLphone account configuration wizard") ); + gtk_window_set_position(GTK_WINDOW(wiz->assistant), GTK_WIN_POS_CENTER); + gtk_window_set_default_size(GTK_WINDOW(wiz->assistant), 200 , 200); - return wiz->intro; -} + build_intro(); + build_sfl_or_account(); + build_select_account(); + build_sip_account_configuration(); + build_nat_settings(); + build_iax_account_configuration(); + build_email_configuration(); + build_summary(); - GtkWidget* -build_select_account() -{ - GtkWidget* sip; - GtkWidget* iax; + g_signal_connect(G_OBJECT(wiz->assistant), "close" , G_CALLBACK(close_callback), NULL); + + g_signal_connect(G_OBJECT(wiz->assistant), "cancel" , G_CALLBACK(cancel_callback), NULL); - wiz->protocols = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("VoIP Protocols") , _("Select an account type:")); + gtk_widget_show_all(wiz->assistant); - sip = gtk_radio_button_new_with_label(NULL,"SIP (Session Initiation Protocol)"); - gtk_box_pack_start( GTK_BOX(wiz->protocols) , sip , TRUE, TRUE, 0); - iax = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sip), "IAX2 (InterAsterix Exchange)"); - gtk_box_pack_start( GTK_BOX(wiz->protocols) , iax , TRUE, TRUE, 0); + gtk_assistant_set_forward_page_func( GTK_ASSISTANT( wiz->assistant ), (GtkAssistantPageFunc) forward_page_func , NULL , NULL ); + gtk_assistant_update_buttons_state(GTK_ASSISTANT(wiz->assistant)); +} - g_signal_connect(G_OBJECT( sip ) , "clicked" , G_CALLBACK( set_account_type ) , NULL ); +GtkWidget* build_intro() { + GtkWidget *label; - return wiz->protocols; + wiz->intro = create_vbox( GTK_ASSISTANT_PAGE_INTRO , _("SFLphone 0.9.3") , _("Welcome to SFLphone!")); + label = gtk_label_new(_("This installation wizard will help you configure an account.")) ; + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); + gtk_box_pack_start(GTK_BOX(wiz->intro), label, FALSE, TRUE, 0); + + gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), wiz->intro, TRUE); + return wiz->intro; } +GtkWidget* build_select_account() { + GtkWidget* sip; + GtkWidget* iax; + + wiz->protocols = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("VoIP Protocols") , _("Select an account type:")); + + sip = gtk_radio_button_new_with_label(NULL,"SIP (Session Initiation Protocol)"); + gtk_box_pack_start( GTK_BOX(wiz->protocols) , sip , TRUE, TRUE, 0); + iax = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sip), "IAX2 (InterAsterix Exchange)"); + gtk_box_pack_start( GTK_BOX(wiz->protocols) , iax , TRUE, TRUE, 0); + + g_signal_connect(G_OBJECT( sip ) , "clicked" , G_CALLBACK( set_account_type ) , NULL ); + + gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), wiz->protocols, TRUE); + return wiz->protocols; +} -GtkWidget* build_sfl_or_account() -{ - GtkWidget* sfl; - GtkWidget* cus; - wiz->sflphone_org = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("Account") , _("Please select one of the following option:")); +GtkWidget* build_sfl_or_account() { + GtkWidget* sfl; + GtkWidget* cus; - sfl = gtk_radio_button_new_with_label(NULL, _("Create a free SIP/IAX2 account on sflphone.org")); - gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , sfl , TRUE, TRUE, 0); - cus = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sfl), _("Register an existing SIP or IAX2 account")); - gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , cus , TRUE, TRUE, 0); - g_signal_connect(G_OBJECT( sfl ) , "clicked" , G_CALLBACK( set_sflphone_org ) , NULL ); + wiz->sflphone_org = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("Account") , _("Please select one of the following option:")); - return wiz->sflphone_org; + sfl = gtk_radio_button_new_with_label( NULL, _("Create a free SIP/IAX2 account on sflphone.org")); + gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , sfl , TRUE, TRUE, 0); + cus = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sfl), _("Register an existing SIP or IAX2 account")); + gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , cus , TRUE, TRUE, 0); + g_signal_connect(G_OBJECT( sfl ) , "clicked" , G_CALLBACK( set_sflphone_org ) , NULL ); + + return wiz->sflphone_org; } - GtkWidget* -build_sip_account_configuration( void ) -{ - GtkWidget* table; - GtkWidget* label; - GtkWidget* image; - - wiz->sip_account = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("SIP account configuration") , _("Please fill the following information:")); - // table - table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */); - gtk_table_set_row_spacings( GTK_TABLE(table), 10); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_box_pack_start( GTK_BOX(wiz->sip_account) , table , TRUE, TRUE, 0); - - // alias field - label = gtk_label_new_with_mnemonic (_("_Alias")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->sip_alias = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_alias); - gtk_table_attach ( GTK_TABLE( table ), wiz->sip_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // server field - label = gtk_label_new_with_mnemonic (_("_Host name")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->sip_server = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_server); - gtk_table_attach ( GTK_TABLE( table ), wiz->sip_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // username field - label = gtk_label_new_with_mnemonic (_("_User name")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->sip_username = sexy_icon_entry_new(); - image = gtk_image_new_from_file( ICONS_DIR "/stock_person.svg" ); - sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_username); - gtk_table_attach ( GTK_TABLE( table ), wiz->sip_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // password field - label = gtk_label_new_with_mnemonic (_("_Password")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->sip_password = sexy_icon_entry_new(); - image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR ); - sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_password); - gtk_entry_set_visibility(GTK_ENTRY(wiz->sip_password), FALSE); - gtk_table_attach ( GTK_TABLE( table ), wiz->sip_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - return wiz->sip_account; +GtkWidget* build_sip_account_configuration( void ) { + GtkWidget* table; + GtkWidget* label; + GtkWidget* image; + + wiz->sip_account = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("SIP account configuration") , _("Please fill the following information:")); + // table + table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */); + gtk_table_set_row_spacings( GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start( GTK_BOX(wiz->sip_account) , table , TRUE, TRUE, 0); + + // alias field + label = gtk_label_new_with_mnemonic (_("_Alias")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->sip_alias = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_alias); + gtk_table_attach ( GTK_TABLE( table ), wiz->sip_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // server field + label = gtk_label_new_with_mnemonic (_("_Host name")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->sip_server = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_server); + gtk_table_attach ( GTK_TABLE( table ), wiz->sip_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // username field + label = gtk_label_new_with_mnemonic (_("_User name")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->sip_username = sexy_icon_entry_new(); + image = gtk_image_new_from_file( ICONS_DIR "/stock_person.svg" ); + sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_username); + gtk_table_attach ( GTK_TABLE( table ), wiz->sip_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // password field + label = gtk_label_new_with_mnemonic (_("_Password")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->sip_password = sexy_icon_entry_new(); + image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR ); + sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->sip_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->sip_password); + gtk_entry_set_visibility(GTK_ENTRY(wiz->sip_password), FALSE); + gtk_table_attach ( GTK_TABLE( table ), wiz->sip_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + //gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), wiz->sip_account, TRUE); + return wiz->sip_account; } - GtkWidget* -build_iax_account_configuration( void ) -{ - GtkWidget* label; - GtkWidget* table; - GtkWidget* image; - - wiz->iax_account = create_vbox( GTK_ASSISTANT_PAGE_CONFIRM , _("IAX2 account configuration") , _("Please fill the following information:")); - - table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */); - gtk_table_set_row_spacings( GTK_TABLE(table), 10); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_box_pack_start( GTK_BOX(wiz->iax_account) , table , TRUE, TRUE, 0); - - // alias field - label = gtk_label_new_with_mnemonic (_("_Alias")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->iax_alias = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_alias); - gtk_table_attach ( GTK_TABLE( table ), wiz->iax_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // server field - label = gtk_label_new_with_mnemonic (_("_Host name")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->iax_server = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_server); - gtk_table_attach ( GTK_TABLE( table ), wiz->iax_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // username field - label = gtk_label_new_with_mnemonic (_("_User name")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->iax_username = sexy_icon_entry_new(); - image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR ); - sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_username); - gtk_table_attach ( GTK_TABLE( table ), wiz->iax_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - // password field - label = gtk_label_new_with_mnemonic (_("_Password")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->iax_password = sexy_icon_entry_new(); - sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_password); - gtk_entry_set_visibility(GTK_ENTRY(wiz->iax_password), FALSE); - gtk_table_attach ( GTK_TABLE( table ), wiz->iax_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - - - current -> state = ACCOUNT_STATE_UNREGISTERED; - - g_signal_connect( G_OBJECT( wiz->assistant ) , "apply" , G_CALLBACK( iax_apply_callback ), NULL); - - return wiz->iax_account; +GtkWidget* build_email_configuration( void ) { + GtkWidget* label; + GtkWidget* table; + + wiz->email = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("Optional Email Address ") , _("This email address will be use to send your voicemail messages")); + + table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */); + gtk_table_set_row_spacings( GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start( GTK_BOX(wiz->email) , table , TRUE, TRUE, 0); + + // email field + label = gtk_label_new_with_mnemonic (_("_Email")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->mailbox = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->mailbox); + gtk_table_attach ( GTK_TABLE( table ), wiz->mailbox, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + return wiz->email; } - - GtkWidget* -build_nat_settings( void ) -{ - GtkWidget* label; - GtkWidget* table; - - wiz->nat = create_vbox( GTK_ASSISTANT_PAGE_CONFIRM , _("Network Address Translation") , _("You should probably enable this if you are behind a firewall.")); - - // table - table = gtk_table_new ( 2, 2 , FALSE/* homogeneous */); - gtk_table_set_row_spacings( GTK_TABLE(table), 10); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_box_pack_start( GTK_BOX(wiz->nat), table , TRUE, TRUE, 0); - - // enable - wiz->enable = gtk_check_button_new_with_mnemonic(_("E_nable STUN")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wiz->enable), FALSE); - gtk_table_attach ( GTK_TABLE( table ), wiz->enable, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_set_sensitive( GTK_WIDGET( wiz->enable ) , TRUE ); - g_signal_connect( G_OBJECT( GTK_TOGGLE_BUTTON(wiz->enable)) , "toggled" , G_CALLBACK( enable_stun ), NULL); - - // server address - label = gtk_label_new_with_mnemonic (_("_STUN server")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - wiz->addr = gtk_entry_new(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->addr); - gtk_table_attach ( GTK_TABLE( table ), wiz->addr, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_set_sensitive( GTK_WIDGET( wiz->addr ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable))); - - g_signal_connect( G_OBJECT( wiz->assistant ) , "apply" , G_CALLBACK( sip_apply_callback ), NULL); - - return wiz->nat; + +GtkWidget* build_iax_account_configuration( void ) { + GtkWidget* label; + GtkWidget* table; + GtkWidget* image; + + wiz->iax_account = create_vbox( GTK_ASSISTANT_PAGE_CONFIRM , _("IAX2 account configuration") , _("Please fill the following information:")); + + table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */); + gtk_table_set_row_spacings( GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start( GTK_BOX(wiz->iax_account) , table , TRUE, TRUE, 0); + + // alias field + label = gtk_label_new_with_mnemonic (_("_Alias")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->iax_alias = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_alias); + gtk_table_attach ( GTK_TABLE( table ), wiz->iax_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // server field + label = gtk_label_new_with_mnemonic (_("_Host name")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->iax_server = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_server); + gtk_table_attach ( GTK_TABLE( table ), wiz->iax_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // username field + label = gtk_label_new_with_mnemonic (_("_User name")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->iax_username = sexy_icon_entry_new(); + image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_AUTHENTICATION , GTK_ICON_SIZE_SMALL_TOOLBAR ); + sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_username), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_username); + gtk_table_attach ( GTK_TABLE( table ), wiz->iax_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + // password field + label = gtk_label_new_with_mnemonic (_("_Password")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->iax_password = sexy_icon_entry_new(); + sexy_icon_entry_set_icon( SEXY_ICON_ENTRY(wiz->iax_password), SEXY_ICON_ENTRY_PRIMARY , GTK_IMAGE(image) ); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->iax_password); + gtk_entry_set_visibility(GTK_ENTRY(wiz->iax_password), FALSE); + gtk_table_attach ( GTK_TABLE( table ), wiz->iax_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + + + current -> state = ACCOUNT_STATE_UNREGISTERED; + + g_signal_connect( G_OBJECT( wiz->assistant ) , "apply" , G_CALLBACK( iax_apply_callback ), NULL); + + return wiz->iax_account; } - GtkWidget* -build_summary() -{ - GtkWidget *label; - wiz->summary = create_vbox( GTK_ASSISTANT_PAGE_SUMMARY , _("Account Registration") , _("Congratulations!")); - - label = gtk_label_new(_("This assistant is now finished.\n\n You can at any time check your registration state or modify your accounts parameters in the Options/Accounts window.")) ; - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); - gtk_box_pack_start(GTK_BOX(wiz->summary), label, FALSE, TRUE, 0); - - return wiz->summary; +GtkWidget* build_nat_settings( void ) { + GtkWidget* label; + GtkWidget* table; + + wiz->nat = create_vbox( GTK_ASSISTANT_PAGE_CONFIRM , _("Network Address Translation") , _("You should probably enable this if you are behind a firewall.")); + + // table + table = gtk_table_new ( 2, 2 , FALSE/* homogeneous */); + gtk_table_set_row_spacings( GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start( GTK_BOX(wiz->nat), table , TRUE, TRUE, 0); + + // enable + wiz->enable = gtk_check_button_new_with_mnemonic(_("E_nable STUN")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wiz->enable), FALSE); + gtk_table_attach ( GTK_TABLE( table ), wiz->enable, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( wiz->enable ) , TRUE ); + g_signal_connect( G_OBJECT( GTK_TOGGLE_BUTTON(wiz->enable)) , "toggled" , G_CALLBACK( enable_stun ), NULL); + + // server address + label = gtk_label_new_with_mnemonic (_("_STUN server")); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); + wiz->addr = gtk_entry_new(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), wiz->addr); + gtk_table_attach ( GTK_TABLE( table ), wiz->addr, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( wiz->addr ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable))); + + g_signal_connect( G_OBJECT( wiz->assistant ) , "apply" , G_CALLBACK( sip_apply_callback ), NULL); + + return wiz->nat; } - GtkWidget* -build_registration_error() -{ - GtkWidget *label; - wiz->reg_failed = create_vbox( GTK_ASSISTANT_PAGE_SUMMARY , "Account Registration" , "Registration error"); - - label = gtk_label_new(" Please correct the information.") ; - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); - gtk_box_pack_start(GTK_BOX(wiz->reg_failed), label, FALSE, TRUE, 0); - - return wiz->reg_failed; +GtkWidget* build_summary() { + GtkWidget *label; + wiz->summary = create_vbox( GTK_ASSISTANT_PAGE_SUMMARY , _("Account Registration") , _("Congratulations!")); + + label = gtk_label_new(_("This assistant is now finished.\n\n You can at any time check your registration state or modify your accounts parameters in the Options/Accounts window.")) ; + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); + gtk_box_pack_start(GTK_BOX(wiz->summary), label, FALSE, TRUE, 0); + + return wiz->summary; +} +GtkWidget* build_registration_error() { + GtkWidget *label; + wiz->reg_failed = create_vbox( GTK_ASSISTANT_PAGE_SUMMARY , "Account Registration" , "Registration error"); + + label = gtk_label_new(" Please correct the information.") ; + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1); + gtk_box_pack_start(GTK_BOX(wiz->reg_failed), label, FALSE, TRUE, 0); + + return wiz->reg_failed; } void set_sip_infos_sentivite(gboolean b) { - gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_alias), b); - gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_server), b); - gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_username), b); - gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_password), b); + gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_alias), b); + gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_server), b); + gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_username), b); + gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_password), b); } void prefill_sip(void) { - if (use_sflphone_org == 1) { - char alias[400]; - rest_account ra = get_rest_account(SFLPHONE_ORG_SERVER); - if (ra.success) { - set_sip_infos_sentivite(FALSE); - strcpy(alias,ra.user); - strcat(alias,"@"); - strcat(alias,"sip.sflphone.org"); - gtk_entry_set_text (GTK_ENTRY(wiz->sip_alias),alias ); - gtk_entry_set_text (GTK_ENTRY(wiz->sip_server), SFLPHONE_ORG_SERVER); - gtk_entry_set_text (GTK_ENTRY(wiz->sip_username), ra.user); - gtk_entry_set_text (GTK_ENTRY(wiz->sip_password), ra.passwd); - } - } + if (use_sflphone_org == 1) { + char alias[300]; + char *email; + email = (char *)gtk_entry_get_text (GTK_ENTRY(wiz->mailbox) ); + rest_account ra = get_rest_account(SFLPHONE_ORG_SERVER,email); + if (ra.success) { + set_sip_infos_sentivite(FALSE); + strcpy(alias,ra.user); + strcat(alias,"@"); + strcat(alias,"sip.sflphone.org"); + gtk_entry_set_text (GTK_ENTRY(wiz->sip_alias),alias ); + gtk_entry_set_text (GTK_ENTRY(wiz->sip_server), SFLPHONE_ORG_SERVER); + gtk_entry_set_text (GTK_ENTRY(wiz->sip_username), ra.user); + gtk_entry_set_text (GTK_ENTRY(wiz->sip_password), ra.passwd); + } + } } - -#define PAGE_INTRO 0 -#define PAGE_SFL 1 -#define PAGE_TYPE 2 -#define PAGE_SIP 3 -#define PAGE_STUN 4 -#define PAGE_IAX 5 -#define PAGE_REG_ERR 6 -#define PAGE_SUMMARY 8 - -static gint -forward_page_func( gint current_page , gpointer data UNUSED) { - - switch( current_page ){ - case PAGE_INTRO: - return PAGE_SFL; - - case PAGE_SFL: - if (use_sflphone_org) { - prefill_sip(); - account_type = _SIP; - return PAGE_SIP; - } - return PAGE_TYPE; - - case PAGE_TYPE: - if( account_type == _SIP ) { - set_sip_infos_sentivite(TRUE); - return PAGE_SIP; - } - return PAGE_IAX; - - case PAGE_SIP: - return PAGE_STUN; - - case PAGE_STUN: - return PAGE_SUMMARY; - - case PAGE_IAX: - return PAGE_SUMMARY; - - default: - return -1; - } +typedef enum { + PAGE_INTRO, + PAGE_SFL, + PAGE_TYPE, + PAGE_SIP, + PAGE_STUN, + PAGE_IAX, + PAGE_EMAIL, + PAGE_SUMMARY +} assistant_state; + +static gint forward_page_func( gint current_page , gpointer data) { + gint next_page = 0; + + switch( current_page ){ + case PAGE_INTRO: + next_page = PAGE_SFL; + break; + case PAGE_SFL: + if (use_sflphone_org) { + next_page = PAGE_EMAIL; + } else + next_page = PAGE_TYPE; + break; + case PAGE_TYPE: + if( account_type == _SIP ) { + set_sip_infos_sentivite(TRUE); + next_page = PAGE_SIP; + } else + next_page = PAGE_IAX; + break; + case PAGE_SIP: + next_page = PAGE_STUN; + break; + case PAGE_EMAIL: + next_page = PAGE_STUN; + break; + case PAGE_STUN: + next_page = PAGE_SUMMARY; + break; + case PAGE_IAX: + next_page = PAGE_SUMMARY; + break; + case PAGE_SUMMARY: + next_page = PAGE_SUMMARY; + break; + default: + next_page = -1; + } + return next_page; } - static GtkWidget* -create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section) -{ - GtkWidget *vbox; - GtkWidget *label; - gchar *str; - - vbox = gtk_vbox_new(FALSE, 6); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); - - gtk_assistant_append_page(GTK_ASSISTANT(wiz->assistant), vbox); - gtk_assistant_set_page_type(GTK_ASSISTANT(wiz->assistant), vbox, type); - str = g_strdup_printf(" %s", title); - gtk_assistant_set_page_title(GTK_ASSISTANT(wiz->assistant), vbox, str); - - g_free(str); - - gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), vbox, TRUE); - - wiz->logo = gdk_pixbuf_new_from_file(ICONS_DIR "/sflphone.png", NULL); - gtk_assistant_set_page_header_image(GTK_ASSISTANT(wiz->assistant),vbox, wiz->logo); - g_object_unref(wiz->logo); - - if (section) { - label = gtk_label_new(NULL); - str = g_strdup_printf("<b>%s</b>\n", section); - gtk_label_set_markup(GTK_LABEL(label), str); - g_free(str); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - } - return vbox; +static GtkWidget* create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section) { + GtkWidget *vbox; + GtkWidget *label; + gchar *str; + + vbox = gtk_vbox_new(FALSE, 6); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); + + gtk_assistant_append_page(GTK_ASSISTANT(wiz->assistant), vbox); + gtk_assistant_set_page_type(GTK_ASSISTANT(wiz->assistant), vbox, type); + str = g_strdup_printf(" %s", title); + gtk_assistant_set_page_title(GTK_ASSISTANT(wiz->assistant), vbox, str); + + g_free(str); + + gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), vbox, TRUE); + + wiz->logo = gdk_pixbuf_new_from_file(ICONS_DIR "/sflphone.png", NULL); + gtk_assistant_set_page_header_image(GTK_ASSISTANT(wiz->assistant),vbox, wiz->logo); + g_object_unref(wiz->logo); + + if (section) { + label = gtk_label_new(NULL); + str = g_strdup_printf("<b>%s</b>\n", section); + gtk_label_set_markup(GTK_LABEL(label), str); + g_free(str); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + } + return vbox; } #endif // GTK_CHECK_VERSION diff --git a/sflphone-gtk/src/assistant.h b/sflphone-gtk/src/assistant.h index d31fe7b5e6c5b9b4dd58516bcc30b6a00e3cb39e..787af025f3248d88e3aa4fd3a93a245149016eed 100644 --- a/sflphone-gtk/src/assistant.h +++ b/sflphone-gtk/src/assistant.h @@ -41,6 +41,7 @@ struct _wizard GtkWidget *account_type; GtkWidget *protocols; GtkWidget *sip; + GtkWidget *email; GtkWidget *iax; /** Page 2 - SIP account creation */ GtkWidget *sip_account; @@ -100,6 +101,7 @@ GtkWidget* build_nat_settings( void ); GtkWidget* build_iax_account_configuration( void ); GtkWidget* build_summary( void ); GtkWidget* build_registration_error( void ); +GtkWidget* build_email_configuration( void ); GtkWidget* build_sfl_or_account (void); /** diff --git a/sflphone-gtk/src/callmanager-glue.h b/sflphone-gtk/src/callmanager-glue.h index c4123cd1e39732f6931696431c5de88d78df6c31..1921fbb0e0b630413699dc5b7c71d2e308b4ba5c 100644 --- a/sflphone-gtk/src/callmanager-glue.h +++ b/sflphone-gtk/src/callmanager-glue.h @@ -529,6 +529,44 @@ org_sflphone_SFLphone_CallManager_get_current_call_id_async (DBusGProxy *proxy, stuff->userdata = userdata; return dbus_g_proxy_begin_call (proxy, "getCurrentCallID", org_sflphone_SFLphone_CallManager_get_current_call_id_async_callback, stuff, g_free, G_TYPE_INVALID); } +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean +org_sflphone_SFLphone_CallManager_get_current_codec_name (DBusGProxy *proxy, const char * IN_callID, char ** OUT_codecName, GError **error) + +{ + return dbus_g_proxy_call (proxy, "getCurrentCodecName", error, G_TYPE_STRING, IN_callID, G_TYPE_INVALID, G_TYPE_STRING, OUT_codecName, G_TYPE_INVALID); +} + +typedef void (*org_sflphone_SFLphone_CallManager_get_current_codec_name_reply) (DBusGProxy *proxy, char * OUT_codecName, GError *error, gpointer userdata); + +static void +org_sflphone_SFLphone_CallManager_get_current_codec_name_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + char * OUT_codecName; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_codecName, G_TYPE_INVALID); + (*(org_sflphone_SFLphone_CallManager_get_current_codec_name_reply)data->cb) (proxy, OUT_codecName, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_sflphone_SFLphone_CallManager_get_current_codec_name_async (DBusGProxy *proxy, const char * IN_callID, org_sflphone_SFLphone_CallManager_get_current_codec_name_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "getCurrentCodecName", org_sflphone_SFLphone_CallManager_get_current_codec_name_async_callback, stuff, g_free, G_TYPE_STRING, IN_callID, G_TYPE_INVALID); +} #endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_CallManager */ G_END_DECLS diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index 9b56a004f7abb92acc019f3d55b6b783adbe1809..591f276ca0a91642aaf6cc3b18536017da73983f 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -37,7 +37,7 @@ GtkToolItem * hangupButton; GtkToolItem * holdButton; GtkToolItem * transfertButton; GtkToolItem * unholdButton; -GtkToolItem * historyButton; +// GtkToolItem * historyButton; GtkToolItem * mailboxButton; GtkToolItem * recButton; guint transfertButtonConnId; //The button toggled signal connection ID @@ -395,6 +395,7 @@ void row_activated(GtkTreeView *tree_view UNUSED, break; } } + // if history else { newCall = g_new0( call_t, 1 ); @@ -405,7 +406,8 @@ void row_activated(GtkTreeView *tree_view UNUSED, g_sprintf(newCall->callID, "%d", rand()); newCall->_start = 0; newCall->_stop = 0; - + printf("call : account : %s \n", selectedCall->accountID); + newCall->accountID = selectedCall->accountID; printf("call : from : %s to %s\n", newCall->from, newCall->to); call_list_add(current_calls, newCall); update_call_tree_add(current_calls, newCall); diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index e56170f64f09f6f8824060f4ddacb015b7bcec1b..428333e55943631d14c7a46afb0a816554c1da3c 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -60,6 +60,15 @@ incoming_call_cb (DBusGProxy *proxy UNUSED, sflphone_incoming_call (c); } +static void +curent_selected_codec (DBusGProxy *proxy UNUSED, + const gchar* callID, + const gchar* codecName, + void * foo UNUSED ) +{ + g_print ("%s codec decided for call %s\n",codecName,callID); + sflphone_display_selected_codec (codecName); +} static void volume_changed_cb (DBusGProxy *proxy UNUSED, @@ -232,6 +241,14 @@ dbus_connect () dbus_g_proxy_connect_signal (callManagerProxy, "incomingCall", G_CALLBACK(incoming_call_cb), NULL, NULL); + /* Current codec */ + dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_STRING, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_add_signal (callManagerProxy, + "currentSelectedCodec", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (callManagerProxy, + "currentSelectedCodec", G_CALLBACK(curent_selected_codec), NULL, NULL); + /* Register a marshaller for STRING,STRING */ dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); @@ -649,6 +666,30 @@ dbus_codec_details( int payload ) return array; } +gchar* +dbus_get_current_codec_name(const call_t * c) +{ + + printf("dbus_get_current_codec_name : CallID : %s \n", c->callID); + + gchar* codecName; + GError* error = NULL; + + org_sflphone_SFLphone_CallManager_get_current_codec_name ( + callManagerProxy, + c->callID, + &codecName, + &error); + if(error) + { + g_error_free(error); + } + + printf("dbus_get_current_codec_name : codecName : %s \n", codecName); + + return codecName; +} + gchar** diff --git a/sflphone-gtk/src/dbus.h b/sflphone-gtk/src/dbus.h index b6c1ebddfd468a6baba24276a02d9aa19ce2d198..f347a4a47e4395900d8b4fb4edb9417e9b82a421 100644 --- a/sflphone-gtk/src/dbus.h +++ b/sflphone-gtk/src/dbus.h @@ -177,6 +177,12 @@ gchar** dbus_get_active_codec_list( void ); */ void dbus_set_active_codec_list( const gchar** list ); +/** + * CallManager - return the codec name + * @param call_t* current call + */ +gchar* dbus_get_current_codec_name(const call_t * c); + /** * ConfigurationManager - Get the list of available input audio plugins * @return gchar** The list of plugins diff --git a/sflphone-gtk/src/mainwindow.c b/sflphone-gtk/src/mainwindow.c index 9eb1a34fcc1d2b93831e84f630c6579fa0ffe5f3..6eaa0c0c723bed27ae928c77d4360422a6da2017 100644 --- a/sflphone-gtk/src/mainwindow.c +++ b/sflphone-gtk/src/mainwindow.c @@ -104,7 +104,7 @@ create_main_window () window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_window_set_title (GTK_WINDOW (window), PACKAGE); - gtk_window_set_default_size (GTK_WINDOW (window), 260, 320); + gtk_window_set_default_size (GTK_WINDOW (window), 258, 320); gtk_window_set_default_icon_from_file (ICONS_DIR "/sflphone.png", NULL); gtk_window_set_position( GTK_WINDOW( window ) , GTK_WIN_POS_MOUSE); diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index fcd371ac0a430e6dada126b7339c3586be4eede3..c0a21e40f1238f66570060ba8f3a51c9d43c714a 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -38,6 +38,7 @@ GtkWidget * newCallMenu; GtkWidget * holdMenu; GtkWidget * copyMenu; GtkWidget * pasteMenu; +GtkWidget * recordMenu; guint holdConnId; //The hold_menu signal connection ID @@ -55,6 +56,7 @@ void update_menus() gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), FALSE); gtk_widget_set_sensitive( GTK_WIDGET(newCallMenu),FALSE); gtk_widget_set_sensitive( GTK_WIDGET(holdMenu), FALSE); + gtk_widget_set_sensitive( GTK_WIDGET(recordMenu), FALSE); gtk_widget_set_sensitive( GTK_WIDGET(copyMenu), FALSE); call_t * selectedCall = call_get_selected(active_calltree); @@ -83,20 +85,17 @@ void update_menus() gtk_widget_set_sensitive( GTK_WIDGET(newCallMenu),TRUE); break; case CALL_STATE_CURRENT: + case CALL_STATE_RECORD: gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(holdMenu), TRUE); gtk_widget_set_sensitive( GTK_WIDGET(newCallMenu),TRUE); + gtk_widget_set_sensitive( GTK_WIDGET(recordMenu), TRUE); gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( holdMenu ), gtk_image_new_from_file( ICONS_DIR "/icon_hold.svg")); break; case CALL_STATE_BUSY: case CALL_STATE_FAILURE: gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE); break; - case CALL_STATE_RECORD: - gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(holdMenu), TRUE); - gtk_widget_set_sensitive( GTK_WIDGET(newCallMenu),TRUE); - break; default: g_warning("Should not happen in update_menus()!"); break; @@ -225,6 +224,12 @@ call_hang_up ( void * foo UNUSED) sflphone_hang_up(); } +static void +call_record ( void * foo UNUSED) +{ + sflphone_rec_call(); +} + static void call_wizard ( void * foo UNUSED) { @@ -318,6 +323,16 @@ create_call_menu() NULL); gtk_widget_show (menu_items); + image = gtk_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD); + recordMenu = gtk_image_menu_item_new_with_mnemonic(_("_Record")); + gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( recordMenu ), image ); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), recordMenu); + gtk_widget_set_sensitive( GTK_WIDGET(recordMenu), FALSE); + g_signal_connect_swapped (G_OBJECT (recordMenu), "activate", + G_CALLBACK (call_record), + NULL); + gtk_widget_show (recordMenu); + // Separator menu_items = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); @@ -682,7 +697,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) { // TODO update the selection to make sure the call under the mouse is the call selected - gboolean pickup = FALSE, hangup = FALSE, hold = FALSE, copy = FALSE; + gboolean pickup = FALSE, hangup = FALSE, hold = FALSE, copy = FALSE, record = FALSE; gboolean accounts = FALSE; call_t * selectedCall = call_get_selected(current_calls); @@ -707,9 +722,11 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) hangup = TRUE; accounts = TRUE; break; + case CALL_STATE_RECORD: case CALL_STATE_CURRENT: hangup = TRUE; hold = TRUE; + record = TRUE; break; case CALL_STATE_BUSY: case CALL_STATE_FAILURE: @@ -791,6 +808,18 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) gtk_widget_show (menu_items); } + if(record) + { + menu_items = gtk_image_menu_item_new_with_mnemonic(_("_Record")); + image = gtk_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); + g_signal_connect (G_OBJECT (menu_items), "activate", + G_CALLBACK (call_record), + NULL); + gtk_widget_show (menu_items); + } + if(accounts) { menu_items = gtk_separator_menu_item_new (); diff --git a/sflphone-gtk/src/reqaccount.c b/sflphone-gtk/src/reqaccount.c index 48fccb983184dd502449299773ee48c65745700e..f9079b8cb2786488971bfd31c3870da774a1a66a 100644 --- a/sflphone-gtk/src/reqaccount.c +++ b/sflphone-gtk/src/reqaccount.c @@ -99,12 +99,14 @@ int req(char *host, int port, char *req, char *ret) { return 0; } -rest_account get_rest_account(char *host) { +rest_account get_rest_account(char *host,char *email) { char ret[4096]; rest_account ra; bzero(ret, sizeof(ret)); printf("HOST: %s\n", host); - if (req(host, 80, "GET /rest/accountcreator", ret) != -1) { + strcpy(ret,"GET /rest/accountcreator?email="); + strcat(ret, email); + if (req(host, 80, ret, ret) != -1) { strcpy(ra.user, strtok(ret, "\n")); strcpy(ra.passwd, strtok(NULL, "\n"));\ ra.success = 1; @@ -120,7 +122,7 @@ rest_account get_rest_account(char *host) { #ifdef BUILD_EXAMPLE int main (void) { - rest_account acc = get_rest_account("sip.sflphone.org"); + rest_account acc = get_rest_account("sip.sflphone.org","email@email.com"); if (acc.success) { puts(acc.user); puts(acc.passwd); diff --git a/sflphone-gtk/src/reqaccount.h b/sflphone-gtk/src/reqaccount.h index 5c2b7bc1cb853f128e090b83dc59aa991ed90597..9ff07f26e0132a9c107054454dd3662b20df47cf 100644 --- a/sflphone-gtk/src/reqaccount.h +++ b/sflphone-gtk/src/reqaccount.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2009 Jean Schurger <jean@schurger.org> - * and Savoir-Faire Linux inc. + * Copyright (C) 2009 Savoir-faire Linux inc. + * Author Jean Schurger <jean.schurger@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,4 +24,4 @@ typedef struct { char passwd[200]; } rest_account; -rest_account get_rest_account(char *host); +rest_account get_rest_account(char *host, char *email); diff --git a/sflphone-gtk/src/sflnotify.c b/sflphone-gtk/src/sflnotify.c index a71ba9ea0e17b49a45934995aad9972ff4fa095a..b00123dfda655cc4da441d78b46ce37bdb59695e 100644 --- a/sflphone-gtk/src/sflnotify.c +++ b/sflphone-gtk/src/sflnotify.c @@ -205,8 +205,10 @@ notify_no_registered_accounts( ) gchar* body=""; notify_init("sflphone"); + body = g_markup_printf_escaped(_("You have no registered accounts")); + title = g_markup_printf_escaped(_("Error")); pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/sflphone.png", NULL); @@ -223,9 +225,10 @@ notify_no_registered_accounts( ) notify_notification_set_timeout( notification , NOTIFY_EXPIRES_DEFAULT ); notify_notification_add_action( notification , "setup" , _("Setup Accounts") , (NotifyActionCallback) setup_accounts_cb , NULL , NULL ); - if (!notify_notification_show (notification, NULL)) { - g_print("notify(), failed to send notification\n"); - } + if (!notify_notification_show (notification, NULL)) { + g_print("notify(), failed to send notification\n"); + } + } void diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp index 03869783fc9ad70b05eaa4e590be8e242bd6f87b..b1b0dd69a6eef9e913d7b7d9fd7cdee912230a9d 100644 --- a/src/audio/alsalayer.cpp +++ b/src/audio/alsalayer.cpp @@ -122,7 +122,7 @@ AlsaLayer::startStream(void) void AlsaLayer::stopStream(void) { - _debug ("Stop ALSA streams\n"); + _debug ("AlsaLayer::stopStream :: Stop ALSA streams\n"); stopCaptureStream (); //stopPlaybackStream (); @@ -134,21 +134,46 @@ AlsaLayer::stopStream(void) int AlsaLayer::canGetMic() -{ +{ + int avail; + + if (!_CaptureHandle) + return 0; + + avail = snd_pcm_avail_update (_CaptureHandle); + + if (avail == -EPIPE) + { + stop_capture (); + return 0; + } + else + return ((avail<0)?0:avail); + + /* if(_CaptureHandle) + return _micRingBuffer.AvailForGet(); else - return 0; + return 0;*/ } int AlsaLayer::getMic(void *buffer, int toCopy) { + /* if( _CaptureHandle ){ return _micRingBuffer.Get(buffer, toCopy,100); } else - return 0; + return 0;*/ + int res = 0; + if( _CaptureHandle ) + { + res = read( buffer, toCopy); + adjustVolume (buffer, toCopy, SFL_PCM_CAPTURE); + } + return res; } bool AlsaLayer::isCaptureActive(void) { @@ -165,9 +190,13 @@ bool AlsaLayer::isCaptureActive(void) { void AlsaLayer::stopCaptureStream (void) { + int err; + if(_CaptureHandle){ - snd_pcm_drop (_CaptureHandle); + err = snd_pcm_drop (_CaptureHandle); + _debug("AlsaLayer::stopCaptureStream snd_pcm_drop returned vaue : %i\n",err); stop_capture (); + _debug("Wroking here !!!!!!!!!!!!!!!\n"); } } @@ -348,7 +377,8 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag) if(flag == SFL_PCM_BOTH || flag == SFL_PCM_PLAYBACK) { - if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0 )) < 0){ + // if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0 )) < 0){ + if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0 )) < 0){ _debugAlsa("Error while opening playback device %s\n", pcm_p.c_str()); setErrorMessage( ALSA_PLAYBACK_DEVICE ); close_playback (); @@ -669,7 +699,7 @@ void AlsaLayer::audioCallback (void) // Additionally handle the mic's audio stream //if(is_capture_running()){ - micAvailAlsa = snd_pcm_avail_update(_CaptureHandle); + /*micAvailAlsa = snd_pcm_avail_update(_CaptureHandle); if(micAvailAlsa > 0) { micAvailPut = _micRingBuffer.AvailForPut(); toPut = (micAvailAlsa <= micAvailPut) ? micAvailAlsa : micAvailPut; @@ -680,7 +710,7 @@ void AlsaLayer::audioCallback (void) _micRingBuffer.Put(in, toPut, 100); } free(in); in=0; - } + }*/ } void* AlsaLayer::adjustVolume( void* buffer , int len, int stream ) diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index 319ba0d92626666004fe4da8aa5509e599129746..24042f7d2f4ce289962eba87805dd1a25a56cc4e 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -116,6 +116,7 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) : time(new ost::Time()), _ _sym(sym), micData(NULL), micDataConverted(NULL), micDataEncoded(NULL), spkrDataDecoded(NULL), spkrDataConverted(NULL), converter(NULL), _layerSampleRate(),_codecSampleRate(), _layerFrameSize(), _audiocodec(NULL) { + setCancel(cancelDefault); // AudioRtpRTX should be close if we change sample rate // TODO: Change bind address according to user settings. @@ -150,6 +151,7 @@ AudioRtpRTX::~AudioRtpRTX () { delete _session; _session = NULL; } + delete [] micData; micData = NULL; delete [] micDataConverted; micDataConverted = NULL; delete [] micDataEncoded; micDataEncoded = NULL; @@ -163,6 +165,8 @@ AudioRtpRTX::~AudioRtpRTX () { } + + void AudioRtpRTX::initBuffers() { @@ -248,6 +252,7 @@ AudioRtpRTX::initAudioRtpSession (void) _debugException("! ARTP Failure: initialisation failed"); throw; } + } void @@ -312,14 +317,18 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime) { + if (_ca == 0) { return; } //try { + AudioLayer* audiolayer = Manager::instance().getAudioDriver(); if (!audiolayer) { return; } const ost::AppDataUnit* adu = NULL; // Get audio data stream + // printf("AudioRtpRTX::receiveSessionForSpkr() %i \n",_session->getFirstTimestamp()); + if (!_sym) { adu = _sessionRecv->getData(_sessionRecv->getFirstTimestamp()); } else { @@ -330,10 +339,14 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime) return; } + + //int payload = adu->getType(); // codec type unsigned char* spkrData = (unsigned char*)adu->getData(); // data in char unsigned int size = adu->getSize(); // size in char + // printf("AudioRtpRTX::receiveSessionForSpkr() Size of data from %i \n",size); + // Decode data with relevant codec unsigned int max = (unsigned int)(_codecSampleRate * _layerFrameSize / 1000); @@ -359,6 +372,7 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime) // Do sample rate conversion int nb_sample_down = nbSample; nbSample = reSampleData(_codecSampleRate , nb_sample_down, UP_SAMPLING); + #ifdef DATAFORMAT_IS_FLOAT #else #endif @@ -403,17 +417,23 @@ AudioRtpRTX::reSampleData(int sampleRate_codec, int nbSamples, int status) return 0; } + + void AudioRtpRTX::run () { - //mic, we receive from soundcard in stereo, and we send encoded - //encoding before sending - AudioLayer *audiolayer = Manager::instance().getAudioDriver(); - _layerFrameSize = audiolayer->getFrameSize(); // en ms - _layerSampleRate = audiolayer->getSampleRate(); - initBuffers(); - int step; - //try { + //mic, we receive from soundcard in stereo, and we send encoded + //encoding before sending + AudioLayer *audiolayer = Manager::instance().getAudioDriver(); + _layerFrameSize = audiolayer->getFrameSize(); // en ms + _layerSampleRate = audiolayer->getSampleRate(); + initBuffers(); + int step; + + int sessionWaiting; + + //try { + // Init the session initAudioRtpSession(); step = (int) (_layerFrameSize * _codecSampleRate / 1000); @@ -433,27 +453,59 @@ AudioRtpRTX::run () { audiolayer->startStream(); _start.post(); - _debug("- ARTP Action: Start\n"); + _debug("- ARTP Action: Start call %s\n",_ca->getCallId().c_str()); while (!testCancel()) { - //////////////////////////// - // Send session - //////////////////////////// - sendSessionFromMic(timestamp); - timestamp += step; - //////////////////////////// - // Recv session - //////////////////////////// - receiveSessionForSpkr(countTime); - // Let's wait for the next transmit cycle + + // printf("AudioRtpRTX::run() _session->getFirstTimestamp() %i \n",_session->getFirstTimestamp()); + + // printf("AudioRtpRTX::run() _session->isWaiting() %i \n",_session->isWaiting()); + ///////////////////// + //////////////////////////// + // Send session + //////////////////////////// + + sessionWaiting = _session->isWaiting(); + + sendSessionFromMic(timestamp); + timestamp += step; + + //////////////////////////// + // Recv session + //////////////////////////// + receiveSessionForSpkr(countTime); + + // Let's wait for the next transmit cycle + + + if(sessionWaiting == 1){ + // _debug("Record TWO buffer \n"); _ca->recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic); - - Thread::sleep(TimerPort::getTimer()); - TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms + } + else { + // _debug("Record ONE buffer \n"); + _ca->recAudio.recData(micData,_nSamplesMic); + } + + Thread::sleep(TimerPort::getTimer()); + TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms + } - + + // _debug("stop stream for audiortp loop\n"); + _debug("AudioRtpRTX::run () :: This is bad when holding a call!!!!!!!\n"); audiolayer->stopStream(); - _debug("- ARTP Action: Stop\n"); + _debug("- ARTP Action: Stop call %s\n",_ca->getCallId().c_str()); + //} catch(std::exception &e) { + //_start.post(); + //_debug("! ARTP: Stop %s\n", e.what()); + //throw; + //} catch(...) { + //_start.post(); + //_debugException("* ARTP Action: Stop"); + //throw; + //} + } diff --git a/src/audio/audiortp.h b/src/audio/audiortp.h index fe75441c0ee6ad36a84f77a103707e5daf2c8064..a0a3cf6846ec858ed6ec342b80b5a624d503e842 100644 --- a/src/audio/audiortp.h +++ b/src/audio/audiortp.h @@ -69,7 +69,7 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { /** * Audio recording object */ - AudioRecord recAudio; + // AudioRecord recAudio; /** A SIP call */ SIPCall* _ca; @@ -128,7 +128,10 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { */ int _nSamplesMic; - + /** + * Maximum number of sample for audio buffers (mic and spkr) + */ + int nbSamplesMax; /** * Init the RTP session. Create either symmetric or double sessions to manage data transport @@ -167,10 +170,6 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { /** The audio codec used during the session */ AudioCodec* _audiocodec; - /** - * Audio recording object - */ - // AudioRecord recAudio; }; /////////////////////////////////////////////////////////////////////////////// @@ -203,7 +202,7 @@ class AudioRtp { * Start recording */ void setRecording (); - + private: // copy constructor diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp index 5e4d295871dc2f614f2bf0b1266aac706f3e044b..778192643d5ee2ad3b2e2ba8540e2266a8cb370f 100644 --- a/src/audio/audiostream.cpp +++ b/src/audio/audiostream.cpp @@ -53,7 +53,7 @@ AudioStream::disconnect( void ) void AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) { - _debug("The state of the stream changed\n"); + _debug("AudioStream::stream_state_callback :: The state of the stream changed\n"); assert(s); switch(pa_stream_get_state(s)){ case PA_STREAM_CREATING: @@ -64,7 +64,8 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) PulseLayer::streamState++; break; case PA_STREAM_READY: - _debug("Stream successfully created, connected to %s\n", pa_stream_get_device_name( s )); + + _debug("Stream successfully created, connected to %s\n", pa_stream_get_device_name( s )); break; case PA_STREAM_UNCONNECTED: _debug("Stream unconnected\n"); @@ -78,6 +79,8 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) } + + pa_stream* AudioStream::createStream( pa_context* c ) { @@ -99,7 +102,7 @@ AudioStream::createStream( pa_context* c ) attributes->prebuf = 10000; attributes->minreq = 940; pa_stream_connect_playback( s , NULL , attributes, - PA_STREAM_INTERPOLATE_TIMING, + PA_STREAM_START_CORKED, &_volume, NULL); } else if( _streamType == CAPTURE_STREAM ){ diff --git a/src/audio/codecs/Makefile.am b/src/audio/codecs/Makefile.am index 6f8b16559c518a1c2da8832b4befa607b1282a67..8c7d4803848e93c0e4f47ee9f40ebfbe4d0dafc5 100644 --- a/src/audio/codecs/Makefile.am +++ b/src/audio/codecs/Makefile.am @@ -9,12 +9,16 @@ libcodec_gsm_so_LDFLAGS = --shared -lc -lgsm INSTALL_GSM_RULE = install-libcodec_gsm_so endif +if ENABLE_SPEEXDSP +SPEEXDSP= -DHAVE_SPEEXDSP_LIB +endif + if BUILD_SPEEX SPEEX_LIB = libcodec_speex.so libcodec_speex_so_SOURCES = speexcodec.cpp libcodec_speex_so_CFLAGS = -fPIC -g -Wall -libcodec_speex_so_CXXFLAGS = -fPIC -g -Wall -libcodec_speex_so_LDFLAGS = --shared -lc -lspeex -lspeexdsp -lm +libcodec_speex_so_CXXFLAGS = -fPIC -g -Wall $(SPEEXDSP) +libcodec_speex_so_LDFLAGS = --shared -lc -lspeex $(SPEEX_NIMP) INSTALL_SPEEX_RULE = install-libcodec_speex_so endif diff --git a/src/audio/codecs/speexcodec.cpp b/src/audio/codecs/speexcodec.cpp index 1400e0c2069108bd2776015a21e13f4a26a468c7..a2442cbfe869a26af242f4f6b67cbf7ec0326c3b 100644 --- a/src/audio/codecs/speexcodec.cpp +++ b/src/audio/codecs/speexcodec.cpp @@ -1,7 +1,7 @@ /* - * Copyright (C) 2005 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> + * Copyright (C) 2007-2009 Savoir-Faire Linux inc. + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,126 +23,114 @@ #include <speex/speex.h> #include <speex/speex_preprocess.h> - class Speex : public AudioCodec{ -public: - Speex(int payload=0) - : AudioCodec(payload, "speex"), - _speexModePtr(NULL), - _speex_dec_bits(), - _speex_enc_bits(), - _speex_dec_state(), - _speex_enc_state(), - _speex_frame_size(), - _preprocess_state() - { - _clockRate = 8000; - _channel = 1; - _bitrate = 0; - _bandwidth = 0; - initSpeex(); - } + public: + Speex(int payload=0) + : AudioCodec(payload, "speex"), + _speexModePtr(NULL), + _speex_dec_bits(), + _speex_enc_bits(), + _speex_dec_state(), + _speex_enc_state(), + _speex_frame_size(), + _preprocess_state() + { + _clockRate = 8000; + _channel = 1; + _bitrate = 0; + _bandwidth = 0; + initSpeex(); + } Speex( const Speex& ); Speex& operator=(const Speex&); - void initSpeex() { - int temp = 1; - int temp10 = 10; - int db = -10; - - int *enable; - enable = &temp; - - int *quality; - quality = &temp10; - - int *complex; - complex = &temp10; - - int *attenuation; - attenuation = &db; - - /* - if (_clockRate < 16000 ) { - _speexModePtr = &speex_nb_mode; - } else if (_clockRate < 32000) { - _speexModePtr = &speex_wb_mode; - } else { - _speexModePtr = &speex_uwb_mode; - } - */ - // 8000 HZ --> Narrow-band mode - // TODO Manage the other modes - _speexModePtr = &speex_nb_mode; - - // Init the decoder struct - speex_bits_init(&_speex_dec_bits); - _speex_dec_state = speex_decoder_init(_speexModePtr); - - // Init the encoder struct - speex_bits_init(&_speex_enc_bits); - _speex_enc_state = speex_encoder_init(_speexModePtr); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VAD, enable); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_DTX, enable); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VBR_QUALITY, quality); - speex_encoder_ctl(_speex_enc_state, SPEEX_SET_COMPLEXITY, complex); - - // Init the decoder struct - speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size); - - // Init the preprocess struct - _preprocess_state = speex_preprocess_state_init(_speex_frame_size,_clockRate); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, enable); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, attenuation); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_VAD, enable); - speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_AGC, enable); - + void initSpeex() { + + // 8000 HZ --> Narrow-band mode + // TODO Manage the other modes + _speexModePtr = &speex_nb_mode; + + // Init the decoder struct + speex_bits_init(&_speex_dec_bits); + _speex_dec_state = speex_decoder_init(_speexModePtr); + + // Init the encoder struct + speex_bits_init(&_speex_enc_bits); + _speex_enc_state = speex_encoder_init(_speexModePtr); + +#ifdef HAVE_SPEEXDSP_LIB + + int enable = 1; + int quality = 10; + int complex = 10; + int attenuation = -10; + + speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VAD, &enable); + speex_encoder_ctl(_speex_enc_state, SPEEX_SET_DTX, &enable); + speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VBR_QUALITY, &quality); + speex_encoder_ctl(_speex_enc_state, SPEEX_SET_COMPLEXITY, &complex); + + // Init the decoder struct + speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size); + + // Init the preprocess struct + _preprocess_state = speex_preprocess_state_init(_speex_frame_size,_clockRate); + speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &enable); + speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &attenuation); + speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_VAD, &enable); + speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_AGC, &enable); +#endif + + } + + ~Speex() + { + terminateSpeex(); + } + + void terminateSpeex() { + // Destroy the decoder struct + speex_bits_destroy(&_speex_dec_bits); + speex_decoder_destroy(_speex_dec_state); + _speex_dec_state = 0; + + // Destroy the encoder struct + speex_bits_destroy(&_speex_enc_bits); + speex_encoder_destroy(_speex_enc_state); + _speex_enc_state = 0; + } + + virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) + { + int ratio = 320 / _speex_frame_size; + speex_bits_read_from(&_speex_dec_bits, (char*)src, size); + speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst); + + return _speex_frame_size * ratio; + } + + virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) + { + speex_bits_reset(&_speex_enc_bits); + +#ifdef HAVE_SPEEXDSP_LIB + speex_encoder_ctl(_speex_enc_state,SPEEX_SET_SAMPLING_RATE,&_clockRate); + speex_preprocess_run(_preprocess_state, src); +#endif + + speex_encode_int(_speex_enc_state, src, &_speex_enc_bits); + int nbBytes = speex_bits_write(&_speex_enc_bits, (char*)dst, size); + return nbBytes; } - ~Speex() - { - terminateSpeex(); - } - - void terminateSpeex() { - // Destroy the decoder struct - speex_bits_destroy(&_speex_dec_bits); - speex_decoder_destroy(_speex_dec_state); - _speex_dec_state = 0; - - // Destroy the encoder struct - speex_bits_destroy(&_speex_enc_bits); - speex_encoder_destroy(_speex_enc_state); - _speex_enc_state = 0; - } - - virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) - { - int ratio = 320 / _speex_frame_size; - speex_bits_read_from(&_speex_dec_bits, (char*)src, size); - speex_decode_int(_speex_dec_state, &_speex_dec_bits, dst); - - return _speex_frame_size * ratio; - } - - virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) - { - speex_bits_reset(&_speex_enc_bits); - speex_encoder_ctl(_speex_enc_state,SPEEX_SET_SAMPLING_RATE,&_clockRate); - speex_preprocess_run(_preprocess_state, src); - speex_encode_int(_speex_enc_state, src, &_speex_enc_bits); - int nbBytes = speex_bits_write(&_speex_enc_bits, (char*)dst, size); - return nbBytes; - } - -private: - const SpeexMode* _speexModePtr; - SpeexBits _speex_dec_bits; - SpeexBits _speex_enc_bits; - void *_speex_dec_state; - void *_speex_enc_state; - int _speex_frame_size; + private: + const SpeexMode* _speexModePtr; + SpeexBits _speex_dec_bits; + SpeexBits _speex_enc_bits; + void *_speex_dec_state; + void *_speex_enc_state; + int _speex_frame_size; SpeexPreprocessState *_preprocess_state; }; diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index a8ae5937fa270ec0e251cc8babcf0838545cc8e9..40de7e886fa86a6282b40e5870c402d3af0b4a18 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -30,6 +30,8 @@ static void audioCallback ( pa_stream* s, size_t bytes, void* userdata ) static_cast<PulseLayer*>(userdata)->processData(); } + + PulseLayer::PulseLayer(ManagerImpl* manager) : AudioLayer( manager , PULSEAUDIO ) , context(NULL) @@ -38,7 +40,7 @@ static void audioCallback ( pa_stream* s, size_t bytes, void* userdata ) , record() { PulseLayer::streamState = 0; - _debug("Pulse audio constructor: Create context\n"); + _debug("PulseLayer::Pulse audio constructor: Create context\n"); } // Destructor @@ -53,7 +55,7 @@ PulseLayer::~PulseLayer (void) void PulseLayer::closeLayer( void ) { - _debug(" Destroy pulselayer\n"); + _debug("PulseLayer::closeLayer :: Destroy pulselayer\n"); playback->disconnect(); record->disconnect(); @@ -69,6 +71,7 @@ PulseLayer::closeLayer( void ) void PulseLayer::connectPulseAudioServer( void ) { + _debug("PulseLayer::connectPulseAudioServer \n"); pa_context_flags_t flag = PA_CONTEXT_NOAUTOSPAWN ; pa_threaded_mainloop_lock( m ); @@ -94,7 +97,7 @@ PulseLayer::connectPulseAudioServer( void ) void PulseLayer::context_state_callback( pa_context* c, void* user_data ) { - _debug("The state of the context changed\n"); + _debug("PulseLayer::context_state_callback ::The state of the context changed\n"); PulseLayer* pulse = (PulseLayer*)user_data; assert(c && pulse->m); switch(pa_context_get_state(c)){ @@ -105,7 +108,8 @@ void PulseLayer::context_state_callback( pa_context* c, void* user_data ) break; case PA_CONTEXT_READY: pulse->createStreams( c ); - _debug("Connection to PulseAudio server established\n"); + _debug("Connection to PulseAudio server established\n"); + break; case PA_CONTEXT_TERMINATED: _debug("Context terminated\n"); @@ -121,6 +125,7 @@ void PulseLayer::context_state_callback( pa_context* c, void* user_data ) void PulseLayer::disconnectPulseAudioServer( void ) { + _debug(" PulseLayer::disconnectPulseAudioServer( void ) \n"); if( playback ) delete playback; playback=NULL; @@ -128,22 +133,29 @@ void PulseLayer::disconnectPulseAudioServer( void ) delete record; record=NULL; } - void -PulseLayer::createStreams( pa_context* c ) + +void PulseLayer::createStreams( pa_context* c ) { + _debug("PulseLayer::createStreams \n"); + playback = new AudioStream(c, PLAYBACK_STREAM, PLAYBACK_STREAM_NAME, _manager->getSpkrVolume()); - pa_stream_set_write_callback( playback->pulseStream() , audioCallback, this); + pa_stream_set_write_callback( playback->pulseStream(), audioCallback, this); //pa_stream_set_overflow_callback( playback->pulseStream() , overflow , this); + // pa_stream_set_suspended_callback( playback->pulseStream(), stream_suspended_callback, this); + record = new AudioStream(c, CAPTURE_STREAM, CAPTURE_STREAM_NAME , _manager->getMicVolume()); pa_stream_set_read_callback( record->pulseStream() , audioCallback, this); //pa_stream_set_underflow_callback( record->pulseStream() , underflow , this); + // pa_stream_set_suspended_callback(record->pulseStream(), stream_suspended_callback, this); + pa_threaded_mainloop_signal(m , 0); } - bool -PulseLayer::openDevice(int indexIn UNUSED, int indexOut UNUSED, int sampleRate, int frameSize , int stream UNUSED, std::string plugin UNUSED) + +bool PulseLayer::openDevice(int indexIn UNUSED, int indexOut UNUSED, int sampleRate, int frameSize , int stream UNUSED, std::string plugin UNUSED) { + _debug("PulseLayer::openDevice \n"); _sampleRate = sampleRate; _frameSize = frameSize; @@ -166,18 +178,15 @@ PulseLayer::openDevice(int indexIn UNUSED, int indexOut UNUSED, int sampleRate, return true; } - void -PulseLayer::closeCaptureStream( void ) +void PulseLayer::closeCaptureStream( void ) { } - void -PulseLayer::closePlaybackStream( void ) -{ +void PulseLayer::closePlaybackStream( void ) +{ } - int -PulseLayer::canGetMic() +int PulseLayer::canGetMic() { if( record ) return _micRingBuffer.AvailForGet(); @@ -185,8 +194,7 @@ PulseLayer::canGetMic() return 0; } - int -PulseLayer::getMic(void *buffer, int toCopy) +int PulseLayer::getMic(void *buffer, int toCopy) { if( record ){ return _micRingBuffer.Get(buffer, toCopy, 100); @@ -195,13 +203,15 @@ PulseLayer::getMic(void *buffer, int toCopy) return 0; } - void -PulseLayer::startStream (void) +void PulseLayer::startStream (void) { flushMic(); - _debug("Start stream\n"); + _debug("PulseLayer::Start stream\n"); pa_threaded_mainloop_lock(m); - pa_stream_cork( record->pulseStream(), NULL, NULL, NULL); + + pa_stream_cork( playback->pulseStream(), 0, NULL, NULL); + pa_stream_cork( record->pulseStream(), 0, NULL, NULL); + pa_threaded_mainloop_unlock(m); } @@ -209,9 +219,13 @@ PulseLayer::startStream (void) void PulseLayer::stopStream (void) { - _debug("Stop stream\n"); + _debug("PulseLayer::Stop stream\n"); pa_stream_flush( playback->pulseStream(), NULL, NULL ); pa_stream_flush( record->pulseStream(), NULL, NULL ); + + pa_stream_cork( playback->pulseStream(), 1, NULL, NULL); + pa_stream_cork( record->pulseStream(), 1, NULL, NULL); + flushMic(); flushMain(); flushUrgent(); @@ -219,42 +233,48 @@ PulseLayer::stopStream (void) - void -PulseLayer::underflow ( pa_stream* s UNUSED, void* userdata UNUSED ) +void PulseLayer::underflow ( pa_stream* s UNUSED, void* userdata UNUSED ) { - _debug("Buffer Underflow\n"); + _debug("PulseLayer::Buffer Underflow\n"); } - void -PulseLayer::overflow ( pa_stream* s, void* userdata UNUSED ) +void PulseLayer::overflow ( pa_stream* s, void* userdata UNUSED ) { //PulseLayer* pulse = (PulseLayer*) userdata; pa_stream_drop( s ); pa_stream_trigger( s, NULL, NULL); } - void -PulseLayer::processData( void ) +void PulseLayer::stream_suspended_callback(pa_stream *s, void *userdata UNUSED ) +{ + +} + +void PulseLayer::processData( void ) { - // Handle the mic - // We check if the stream is ready - if( (record->pulseStream()) && pa_stream_get_state( record->pulseStream()) == PA_STREAM_READY) - readFromMic(); - // Handle the data for the speakers - if( (playback->pulseStream()) && pa_stream_get_state( playback->pulseStream()) == PA_STREAM_READY){ + _debug("PulseLayer::processData() \n"); + + // Handle the mic + // We check if the stream is ready + if( (record->pulseStream()) && (pa_stream_get_state( record->pulseStream()) == PA_STREAM_READY)) + readFromMic(); + + // _debug("PulseLayer::processData() playback->pulseStream() \n"); + + // Handle the data for the speakers + if( (playback->pulseStream()) && (pa_stream_get_state( playback->pulseStream()) == PA_STREAM_READY)){ // If the playback buffer is full, we don't overflow it; wait for it to have free space if( pa_stream_writable_size(playback->pulseStream()) == 0 ) return; - + writeToSpeaker(); } } - void -PulseLayer::writeToSpeaker( void ) +void PulseLayer::writeToSpeaker( void ) { /** Bytes available in the urgent ringbuffer ( reserved for DTMF ) */ int urgentAvail; @@ -303,6 +323,7 @@ PulseLayer::writeToSpeaker( void ) else { bzero(out, framesPerBuffer * sizeof(SFLDataFormat)); } + pa_stream_write( playback->pulseStream() , out , toGet , NULL, 0 , PA_SEEK_RELATIVE); pa_xfree(out); } diff --git a/src/audio/pulselayer.h b/src/audio/pulselayer.h index 7476d6052ec41fe04013e9068c2f863ef82e6109..ce2bc2e6af79d49dd5d049f952896c2b03956c44 100644 --- a/src/audio/pulselayer.h +++ b/src/audio/pulselayer.h @@ -24,6 +24,7 @@ #include "audiostream.h" #include <pulse/pulseaudio.h> +#include <pulse/stream.h> #define PLAYBACK_STREAM_NAME "SFLphone out" #define CAPTURE_STREAM_NAME "SFLphone in" @@ -74,7 +75,8 @@ class PulseLayer : public AudioLayer { static void overflow ( pa_stream* s, void* userdata ); static void underflow ( pa_stream* s, void* userdata ); static void stream_state_callback( pa_stream* s, void* user_data ); - static void context_state_callback( pa_context* c, void* user_data ); + static void context_state_callback( pa_context* c, void* user_data ); + static void stream_suspended_callback ( pa_stream* s, void* userdata ); bool isCaptureActive (void){return true;} @@ -127,6 +129,7 @@ class PulseLayer : public AudioLayer { void setMicVolume( int value ) { micVolume = value; } void processData( void ); + private: // Copy Constructor PulseLayer(const PulseLayer& rh); diff --git a/src/audio/tone.cpp b/src/audio/tone.cpp index 91471942ae5e1fa3a87d546156cb95f14526e54d..ac6cfda8b785e60b50369dc5e592e30c78185f76 100644 --- a/src/audio/tone.cpp +++ b/src/audio/tone.cpp @@ -114,6 +114,7 @@ Tone::genBuffer(const std::string& definition) void Tone::genSin(SFLDataFormat* buffer, int frequency1, int frequency2, int nb) { + double pi2 = 6.28318520; double var1 = pi2 * (double)frequency1 / (double)_sampleRate; double var2 = pi2 * (double)frequency2 / (double)_sampleRate; diff --git a/src/audio/tonegenerator.cpp b/src/audio/tonegenerator.cpp index e5a29cd078f231af539627d704f2f9e2a707de00..f053bfa9b8fca73f573677bebf107ff190948cf5 100644 --- a/src/audio/tonegenerator.cpp +++ b/src/audio/tonegenerator.cpp @@ -45,7 +45,7 @@ ToneGenerator::~ToneGenerator (void) { void ToneGenerator::generateSin (int lowerfreq, int higherfreq, int16* ptr, int len) const { double var1, var2; - + var1 = (double)2 * (double)M_PI * (double)higherfreq / (double)_sampleRate; var2 = (double)2 * (double)M_PI * (double)lowerfreq / (double)_sampleRate; diff --git a/src/call.cpp b/src/call.cpp index 558ee81b8840d5ca7672ae9e45cee1c8d8f8ed0b..32cc4d7bcda73c5da7f5fb5f38d4eac563d92f33 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -41,17 +41,17 @@ Call::Call(const CallID& id, Call::CallType type) FILE_TYPE fileType = FILE_WAV; SOUND_FORMAT soundFormat = INT16; - recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH)); - _debug("CALL::Constructor for this clss is called \n"); + recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH),id); + // _debug("CALL::Constructor for this clss is called \n"); } Call::~Call() { - _debug("CALL::~Call(): Destructor for this clss is called \n"); + // _debug("CALL::~Call(): Destructor for this clss is called \n"); if(recAudio.isOpenFile()) { - _debug("CALL::~Call(): A recording file is open, close it \n"); + // _debug("CALL::~Call(): A recording file is open, close it \n"); recAudio.closeFile(); } } @@ -122,7 +122,6 @@ Call::getRemoteIp() AudioCodecType Call::getAudioCodec() { - ost::MutexLock m(_callMutex); return _audioCodec; } @@ -146,6 +145,11 @@ Call::setRecording() recAudio.setRecording(); } +void +Call::initRecFileName() { + recAudio.initFileName(_peerNumber); +} + void Call::stopRecording() { diff --git a/src/call.h b/src/call.h index f0ad6b02eff1439155d710f9a99b709a5c997348..6b247e036017d684056f9db64a59d8a1460d35ae 100644 --- a/src/call.h +++ b/src/call.h @@ -237,6 +237,11 @@ class Call{ */ bool isRecording(); + /** + * + */ + void initRecFileName(); + protected: /** Protect every attribute that can be changed by two threads */ ost::Mutex _callMutex; diff --git a/src/dbus/callmanager-glue.h b/src/dbus/callmanager-glue.h index 4abf94d05cbb97ae8bb735547f9d401f251307aa..71dd6b5170eca847ee33cbc5d457c7593c2c9f44 100644 --- a/src/dbus/callmanager-glue.h +++ b/src/dbus/callmanager-glue.h @@ -34,6 +34,7 @@ public: register_method(CallManager_adaptor, setRecording, _setRecording_stub); register_method(CallManager_adaptor, getCallDetails, _getCallDetails_stub); register_method(CallManager_adaptor, getCurrentCallID, _getCurrentCallID_stub); + register_method(CallManager_adaptor, getCurrentCodecName, _getCurrentCodecName_stub); } ::DBus::IntrospectedInterface *const introspect() const @@ -115,6 +116,18 @@ public: { "callID", "s", false }, { 0, 0, 0 } }; + static ::DBus::IntrospectedArgument getCurrentCodecName_args[] = + { + { "callID", "s", true }, + { "codecName", "s", false }, + { 0, 0, 0 } + }; + static ::DBus::IntrospectedArgument currentSelectedCodec_args[] = + { + { "callID", "s", false }, + { "codecName", "s", false }, + { 0, 0, 0 } + }; static ::DBus::IntrospectedArgument incomingCall_args[] = { { "accountID", "s", false }, @@ -167,10 +180,12 @@ public: { "setRecording", setRecording_args }, { "getCallDetails", getCallDetails_args }, { "getCurrentCallID", getCurrentCallID_args }, + { "getCurrentCodecName", getCurrentCodecName_args }, { 0, 0 } }; static ::DBus::IntrospectedMethod CallManager_adaptor_signals[] = { + { "currentSelectedCodec", currentSelectedCodec_args }, { "incomingCall", incomingCall_args }, { "incomingMessage", incomingMessage_args }, { "callStateChanged", callStateChanged_args }, @@ -218,11 +233,20 @@ public: virtual void setRecording(const std::string& callID) = 0; virtual std::map< std::string, std::string > getCallDetails(const std::string& callID) = 0; virtual std::string getCurrentCallID() = 0; + virtual std::string getCurrentCodecName(const std::string& callID) = 0; public: /* signal emitters for this interface */ + void currentSelectedCodec(const std::string& arg1, const std::string& arg2) + { + ::DBus::SignalMessage sig("currentSelectedCodec"); + ::DBus::MessageIter wi = sig.writer(); + wi << arg1; + wi << arg2; + emit_signal(sig); + } void incomingCall(const std::string& arg1, const std::string& arg2, const std::string& arg3) { ::DBus::SignalMessage sig("incomingCall"); @@ -412,6 +436,17 @@ private: wi << argout1; return reply; } + ::DBus::Message _getCurrentCodecName_stub(const ::DBus::CallMessage &call) + { + ::DBus::MessageIter ri = call.reader(); + + std::string argin1; ri >> argin1; + std::string argout1 = getCurrentCodecName(argin1); + ::DBus::ReturnMessage reply(call); + ::DBus::MessageIter wi = reply.writer(); + wi << argout1; + return reply; + } }; } } } diff --git a/src/dbus/callmanager-introspec.xml b/src/dbus/callmanager-introspec.xml index 6e415f9bfb71c26a48d3495733a9ced0545b1f32..9c503cac8dcd7c6a84d784b82d6854c2fcad029b 100644 --- a/src/dbus/callmanager-introspec.xml +++ b/src/dbus/callmanager-introspec.xml @@ -64,6 +64,16 @@ <method name="getCurrentCallID"> <arg type="s" name="callID" direction="out"/> </method> + + <method name="getCurrentCodecName"> + <arg type="s" name="callID" direction="in"/> + <arg type="s" name="codecName" direction="out"/> + </method> + + <signal name="currentSelectedCodec"> + <arg type="s" name="callID" direction="out" /> + <arg type="s" name="codecName" direction="out"/> + </signal> <signal name="incomingCall"> <arg type="s" name="accountID" /> @@ -91,7 +101,6 @@ <arg type="s" name="device" direction="out"/> <arg type="d" name="value" direction="out"/> </signal> - <signal name="error"> diff --git a/src/dbus/callmanager.cpp b/src/dbus/callmanager.cpp index d516dba31b305fe9c8e30e30cbb7ed5b8d628e46..126b7ef3b69ff5ed5a4afa8df9af05c545d5914f 100644 --- a/src/dbus/callmanager.cpp +++ b/src/dbus/callmanager.cpp @@ -101,7 +101,7 @@ CallManager::setVolume( const std::string& device, const double& value ) double CallManager::getVolume( const std::string& device ) { - _debug("CallManager::getVolume received\n"); + _debug("CallManager::getVolume received \n"); if(device == "speaker") { _debug("Current speaker = %d\n", Manager::instance().getSpkrVolume()); @@ -123,6 +123,14 @@ CallManager::setRecording(const std::string& callID) } +std::string +CallManager::getCurrentCodecName(const std::string& callID) +{ + _debug("CallManager::getCurrentCodecName received %s \n",Manager::instance().getCurrentCodecName(callID).c_str()); + return Manager::instance().getCurrentCodecName(callID).c_str(); +} + + std::map< std::string, std::string > CallManager::getCallDetails( const std::string& callID UNUSED ) { diff --git a/src/dbus/callmanager.h b/src/dbus/callmanager.h index a8c4c0c2ed8dba4bc841d258ab7fa6a9c70bc2bc..7f2e7e689f5c6e2dc0f65cbe21d29c1492885e24 100644 --- a/src/dbus/callmanager.h +++ b/src/dbus/callmanager.h @@ -49,6 +49,7 @@ public: void setVolume( const std::string& device, const double& value ); double getVolume( const std::string& device ); void setRecording( const std::string& callID ); + std::string getCurrentCodecName(const std::string& callID); std::map< std::string, std::string > getCallDetails( const std::string& callID ); std::string getCurrentCallID( ); void playDTMF( const std::string& key ); diff --git a/src/global.h b/src/global.h index 553fe6c161aef231e75f1fa08dcfcc5da70e55c4..334c18edfe4abf704b1b3d34a776da6bbd966e0f 100644 --- a/src/global.h +++ b/src/global.h @@ -32,7 +32,7 @@ #include <map> #include <vector> -#define SFLPHONED_VERSION "0.9.3-1" /** Version number */ +#define SFLPHONED_VERSION "0.9.3" /** Version number */ #define HOMEDIR (getenv ("HOME")) /** Home directory */ diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index f5c65eea29615baf338a9346a120ab5c87d06fd1..231e024d4619433cbc8ad291411a1155a1183150 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -43,6 +43,7 @@ IAXVoIPLink::IAXVoIPLink(const AccountID& accountID) : VoIPLink(accountID) { + // _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread \n "); _evThread = new EventThread(this); _regSession = NULL; _nextRefreshStamp = 0; @@ -89,7 +90,7 @@ IAXVoIPLink::init() return false; bool returnValue = false; - //_localAddress = "127.0.0.1"; + // _localAddress = "127.0.0.1"; // port 0 is default // iax_enable_debug(); have to enable debug when compiling iax... int port = IAX_DEFAULT_PORTNO; @@ -207,10 +208,18 @@ IAXVoIPLink::getEvent() iaxHandlePrecallEvent(event); } + // _debug("IAXVoIPLink::getEvent() : timestamp %i \n",event->ts); + iax_event_free(event); } _mutexIAX.leaveMutex(); + + if(call){ + // _debug("Are we recording"); + call->recAudio.recData(spkrDataConverted,micData,nbSampleForRec_,nbSampleForRec_); + } + // Do the doodle-moodle to send audio from the microphone to the IAX channel. sendAudioFromMic(); @@ -218,9 +227,13 @@ IAXVoIPLink::getEvent() if (_nextRefreshStamp && _nextRefreshStamp - 2 < time(NULL)) { sendRegister(""); } - if(call){ - call->recAudio.recData(spkrDataConverted,micData,nbSampleForRec_,nbSampleForRec_); - } + + // _debug("IAXVoIPLink::getEvent() \n"); + // reinitialize speaker buffer for recording (when recording a voice mail) + for (int i = 0; i < nbSampleForRec_; i++) + spkrDataConverted[i] = 0; + + // thread wait 3 millisecond _evThread->sleep(3); free(event); @@ -229,6 +242,8 @@ IAXVoIPLink::getEvent() void IAXVoIPLink::sendAudioFromMic(void) { + // _debug("IAXVoIPLink::sendAudioFromMic"); + int maxBytesToGet, availBytesFromMic, bytesAvail, compSize; AudioCodec *ac; @@ -289,7 +304,9 @@ IAXVoIPLink::sendAudioFromMic(void) nbSample_ = audiolayer->getMic( micData, bytesAvail ) / sizeof(SFLDataFormat); // Store the number of samples for recording - nbSampleForRec_ = nbSample_; + nbSampleForRec_ = nbSample_; + + // _debug("IAXVoIPLink::sendAudioFromMic : %i \n",nbSampleForRec_); // resample nbSample_ = converter->downsampleData( micData , micDataConverted , (int)ac ->getClockRate() , (int)audiolayer->getSampleRate() , nbSample_ ); @@ -400,7 +417,8 @@ IAXVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) if (call) { call->setPeerNumber(toUrl); - + call->initRecFileName(); + if ( iaxOutgoingInvite(call) ) { call->setConnectionState(Call::Progressing); call->setState(Call::Active); @@ -588,6 +606,16 @@ IAXVoIPLink::carryingDTMFdigits(const CallID& id, char code) } +std::string +IAXVoIPLink::getCurrentCodecName() +{ + IAXCall *call = getIAXCall(Manager::instance().getCurrentCallId()); + + AudioCodec *ac = call->getCodecMap().getCodec(call->getAudioCodec()); + + return ac->getCodecName(); +} + bool IAXVoIPLink::iaxOutgoingInvite(IAXCall* call) @@ -717,6 +745,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call) case IAX_EVENT_VOICE: //if (!audiolayer->isCaptureActive ()) // audiolayer->startStream (); + // _debug("IAX_EVENT_VOICE: \n"); iaxHandleVoiceEvent(event, call); break; @@ -924,8 +953,11 @@ IAXVoIPLink::iaxHandlePrecallEvent(iax_event* event) if (event->ies.calling_number) call->setPeerNumber(std::string(event->ies.calling_number)); - if (event->ies.calling_name) + if (event->ies.calling_name) call->setPeerName(std::string(event->ies.calling_name)); + + // if peerNumber exist append it to the name string + call->initRecFileName(); if (Manager::instance().incomingCall(call, getAccountID())) { /** @todo Faudra considérer éventuellement le champ CODEC PREFS pour diff --git a/src/iaxvoiplink.h b/src/iaxvoiplink.h index 7cdaeaa5439782e9b2855b357eccdb549c8f45fd..2cd4d16357dab62162080f9d7003bd8a759aac6c 100644 --- a/src/iaxvoiplink.h +++ b/src/iaxvoiplink.h @@ -190,6 +190,13 @@ class IAXVoIPLink : public VoIPLink bool isContactPresenceSupported() { return false; } + /** + * Return the codec protocol used for this call + * @param id The call identifier + */ + std::string getCurrentCodecName(); + + public: // iaxvoiplink only void updateAudiolayer( void ); diff --git a/src/main.cpp b/src/main.cpp index 7ae724194b4ae53525d0587e490195b6e7772dc9..85f9170e5782cd44b28a9b4297447f4a2408c3ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,6 +110,7 @@ main (int argc, char **argv) { } bool initOK = false; try { + _debug("Initialize manager in main \n"); Manager::instance().initConfigFile(); Manager::instance().init(); initOK = true; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 7a98835bace3e7b923e73aae58c80ebd22052105..c24affc647efee0a88119fc1d99cf61bd7dd42db 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -188,6 +188,8 @@ ManagerImpl::switchCall(const CallID& id ) { bool ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const std::string& to) { + _debug("ManagerImpl::outgoingCall() method \n"); + if (!accountExists(accountid)) { _debug("! Manager Error: Outgoing Call: account doesn't exist\n"); return false; @@ -219,6 +221,7 @@ ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const bool ManagerImpl::answerCall(const CallID& id) { + stopTone(false); _debug("Try to answer call: %s\n", id.data()); AccountID accountid = getAccountFromCall( id ); @@ -237,11 +240,16 @@ ManagerImpl::answerCall(const CallID& id) removeCallAccount(id); return false; } - + // if it was waiting, it's waiting no more if (_dbus) _dbus->getCallManager()->callStateChanged(id, "CURRENT"); removeWaitingCall(id); switchCall(id); + + std::string codecName = getCurrentCodecName(id); + _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); + if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); + return true; } @@ -249,7 +257,7 @@ ManagerImpl::answerCall(const CallID& id) bool ManagerImpl::hangupCall(const CallID& id) { - _debug("ManagerImpl::hangupCall(): This function is called when user hangup \n"); + _debug("ManagerImpl::hangupCall(): This function is called when user hangup \n"); PulseLayer *pulselayer; AccountID accountid; bool returnValue; @@ -305,6 +313,7 @@ ManagerImpl::cancelCall (const CallID& id) bool ManagerImpl::onHoldCall(const CallID& id) { + _debug("*************** ON HOLD ***********************************\n"); stopTone(true); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { @@ -327,6 +336,7 @@ ManagerImpl::onHoldCall(const CallID& id) bool ManagerImpl::offHoldCall(const CallID& id) { + _debug("*************** OFF HOLD ***********************************\n"); stopTone(false); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { @@ -361,6 +371,10 @@ ManagerImpl::offHoldCall(const CallID& id) } switchCall(id); + std::string codecName = getCurrentCodecName(id); + _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); + if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); + return returnValue; } @@ -574,7 +588,7 @@ ManagerImpl::isWaitingCall(const CallID& id) { // Management of event peer IP-phone //////////////////////////////////////////////////////////////////////////////// // SipEvent Thread - bool +bool ManagerImpl::incomingCall(Call* call, const AccountID& accountId) { PulseLayer *pulselayer; @@ -633,6 +647,10 @@ ManagerImpl::peerAnsweredCall(const CallID& id) stopTone(false); } if (_dbus) _dbus->getCallManager()->callStateChanged(id, "CURRENT"); + + std::string codecName = getCurrentCodecName(id); + _debug("ManagerImpl::hangupCall(): broadcast codec name %s \n",codecName.c_str()); + if (_dbus) _dbus->getCallManager()->currentSelectedCodec(id,codecName.c_str()); } //THREAD=VoIP Call=Outgoing @@ -738,7 +756,7 @@ bool ManagerImpl::playATone(Tone::TONEID toneId) return false; audiolayer = getAudioDriver(); - + if (_telephoneTone != 0) { _toneMutex.enterMutex(); _telephoneTone->setCurrentTone(toneId); @@ -1184,6 +1202,15 @@ ManagerImpl::getCodecDetails( const int32_t& payload ) return v; } +std::string +ManagerImpl::getCurrentCodecName(const CallID& id) +{ + // _debug("ManagerImpl::getCurrentCodecName method called \n"); + AccountID accountid = getAccountFromCall(id); + // _debug("ManagerImpl::getCurrentCodecName : %s \n",getAccountLink(accountid)->getCurrentCodecName().c_str()); + return getAccountLink(accountid)->getCurrentCodecName(); +} + /** * Get list of supported input audio plugin */ diff --git a/src/managerimpl.h b/src/managerimpl.h index 51fefa04968eb802444b42e477edc4fcc1ffe884..0765bac47619e05229a9f0fbca829f97a17611f1 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -326,6 +326,13 @@ class ManagerImpl { */ std::vector< ::std::string > getCodecDetails( const int32_t& payload); + /** + * Get current codec name + * @param call id + * @return std::string The codec name + */ + std::string getCurrentCodecName(const CallID& id); + /** * Get a list of supported input audio plugin * @return std::vector<std::string> List of names diff --git a/src/plug-in/audiorecorder/Makefile.am b/src/plug-in/audiorecorder/Makefile.am index 5690f7591853253b0d12900aeee1d50973c5769a..2a37f147295de545974f83dbf48e097a5a0d53dc 100644 --- a/src/plug-in/audiorecorder/Makefile.am +++ b/src/plug-in/audiorecorder/Makefile.am @@ -3,6 +3,4 @@ include $(top_srcdir)/globals.mak noinst_LTLIBRARIES = libaudiorecorder.la libaudiorecorder_la_SOURCES = \ - audiorecord.cpp \ - audiodsp.h \ - audiodsp.cpp \ No newline at end of file + audiorecord.cpp \ No newline at end of file diff --git a/src/plug-in/audiorecorder/audiorecord.cpp b/src/plug-in/audiorecorder/audiorecord.cpp index cc0d25e4a8e2efbad89509dc2c3e3c6865126ca1..aa8e064aa04bdd5358da2db969a417b6f1694448 100644 --- a/src/plug-in/audiorecorder/audiorecord.cpp +++ b/src/plug-in/audiorecorder/audiorecord.cpp @@ -44,9 +44,19 @@ AudioRecord::AudioRecord(){ byteCounter_ = 0; recordingEnabled_ = false; fp = 0; + nbSamplesMax_ = 3000; createFilename(); - + + mixBuffer_ = new SFLDataFormat[nbSamplesMax_]; + micBuffer_ = new SFLDataFormat[nbSamplesMax_]; + spkBuffer_ = new SFLDataFormat[nbSamplesMax_]; +} + +AudioRecord::~AudioRecord() { + delete [] mixBuffer_; + delete [] micBuffer_; + delete [] spkBuffer_; } @@ -54,32 +64,42 @@ void AudioRecord::setSndSamplingRate(int smplRate){ sndSmplRate_ = smplRate; } -void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path){ +void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id){ - std::string fName; - - fileType_ = type; + + fileType_ = type; sndFormat_ = format; channels_ = 1; sndSmplRate_ = sndSmplRate; - - if (fileType_ == FILE_RAW){ + call_id_ = id; + + savePath_ = path + "/"; + +} + + + +void AudioRecord::initFileName( std::string peerNumber){ + + std::string fName; + + fName = fileName_; + fName.append("-"+peerNumber); + + if (fileType_ == FILE_RAW){ if ( strstr(fileName_, ".raw") == NULL){ printf("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_); - strcat(fileName_, ".raw"); + fName.append(".raw"); } } else if (fileType_ == FILE_WAV){ if ( strstr(fileName_, ".wav") == NULL){ printf("AudioRecord::openFile::concatenate .wav file extension: name : %s \n", fileName_); - strcat(fileName_, ".wav"); + fName.append(".wav"); } } - - fName = fileName_; - savePath_ = path + "/"; + savePath_.append(fName); - } void AudioRecord::openFile(){ @@ -122,6 +142,8 @@ void AudioRecord::closeFile() { else if (fileType_ == FILE_WAV) this->closeWavFile(); + + } @@ -332,21 +354,9 @@ void AudioRecord::closeWavFile() return; } - _debug("AudioRecord::closeWavFile() \n"); - - if ( fclose( fp ) != 0) - _debug("AudioRecord::closeWavFile()::ERROR: can't close file ab \n"); - - - - fp = fopen(fileName_, "rb+"); - if ( !fp ) { - _debug("AudioRecord::closeWavFile() : could not open WAV file rb+!\n"); - return; - } - SINT32 bytes = byteCounter_ * channels_; + fseek(fp, 40, SEEK_SET); // jump to data length if (ferror(fp))perror("AudioRecord::closeWavFile()::ERROR: can't reach offset 40\n"); @@ -366,11 +376,37 @@ void AudioRecord::closeWavFile() if ( fclose( fp ) != 0) _debug("AudioRecord::closeWavFile()::ERROR: can't close file\n"); - // i = fclose(fp); - // printf("AudioRecord::closeWavFile : indicator i : %i \n",i); } +void AudioRecord::recSpkrData(SFLDataFormat* buffer, int nSamples) { + + if (recordingEnabled_) { + + nbSamplesMic_ = nSamples; + + for(int i = 0; i < nbSamplesMic_; i++) + micBuffer_[i] = buffer[i]; + } + + return; +} + + +void AudioRecord::recMicData(SFLDataFormat* buffer, int nSamples) { + + if (recordingEnabled_) { + + nbSamplesSpk_ = nSamples; + + for(int i = 0; i < nbSamplesSpk_; i++) + spkBuffer_[i] = buffer[i]; + + } + + return; +} + void AudioRecord::recData(SFLDataFormat* buffer, int nSamples) { @@ -381,22 +417,13 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples) { return; } - // int size = nSamples * (sizeof(SFLDataFormat)); - // int size = sizeof(buffer); - // int count = sizeof(buffer) / sizeof(SFLDataFormat); - - // printf("AudioRecord : sizeof(buffer) : %d \n",size); - // printf("AudioRecord : sizeof(buffer) / sizeof(SFLDataFormat) : %d \n",count); - // printf("AudioRecord : nSamples : %d \n",nSamples); - // printf("AudioRecord : buffer: %x : ", buffer); + if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16 if ( fwrite(buffer, sizeof(SFLDataFormat), nSamples, fp) != nSamples) _debug("AudioRecord: Could not record data! \n"); else { - // printf("Buffer : %x \n",*buffer); fflush(fp); - // _debug("Flushing!\n"); byteCounter_ += (unsigned long)(nSamples*sizeof(SFLDataFormat)); } } @@ -415,40 +442,25 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int return; } - mixBuffer_ = new SFLDataFormat[nSamples_1]; - - // int size = nSamples * (sizeof(SFLDataFormat)); - // int size = sizeof(buffer); - // int count = sizeof(buffer) / sizeof(SFLDataFormat); - - // printf("AudioRecord : sizeof(buffer) : %d \n",size); - // printf("AudioRecord : sizeof(buffer) / sizeof(SFLDataFormat) : %d \n",count); - // printf("AudioRecord : nSamples : %d \n",nSamples); - // printf("AudioRecord : buffer: %x : ", buffer); if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16 for (int k=0; k<nSamples_1; k++){ - mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2; - - // dsp.getRMS(mixBuffer_[k]); + mixBuffer_[k] = (buffer_1[k]+buffer_2[k]); + - if ( fwrite(&buffer_1[k], 2, 1, fp) != 1) + if ( fwrite(&mixBuffer_[k], 2, 1, fp) != 1) _debug("AudioRecord: Could not record data!\n"); else { - // printf("Buffer : %x \n",*buffer); fflush(fp); - // _debug("Flushing!\n"); } } } byteCounter_ += (unsigned long)(nSamples_1*sizeof(SFLDataFormat)); - //printf("AudioRecord::recData():: byteCounter_ : %i \n",(int)byteCounter_ ); - - delete [] mixBuffer_; } return; } + diff --git a/src/plug-in/audiorecorder/audiorecord.h b/src/plug-in/audiorecorder/audiorecord.h index e5104e8fb0fa214657632e2f0094b978f2aaf207..679625090403ac097ff40d1da5a64feb1aa86658 100644 --- a/src/plug-in/audiorecorder/audiorecord.h +++ b/src/plug-in/audiorecorder/audiorecord.h @@ -26,7 +26,7 @@ #include <sstream> #include "plug-in/plugin.h" -#include "audiodsp.h" +// #include "audiodsp.h" // class AudioDSP; @@ -41,9 +41,13 @@ public: AudioRecord(); + ~AudioRecord(); + void setSndSamplingRate(int smplRate); - void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path); + void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id); + + void initFileName( std::string peerNumber ); /** * Check if no otehr file is opened, then create a new one @@ -83,6 +87,21 @@ public: */ void stopRecording(); + + /** + * Record a chunk of data in an internal buffer + * @param buffer The data chunk to be recorded + * @param nSamples Number of samples (number of bytes) to be recorded + */ + void recSpkrData(SFLDataFormat* buffer, int nSamples); + + /** + * Record a chunk of data in an internal buffer + * @param buffer The data chunk to be recorded + * @param nSamples Number of samples (number of bytes) to be recorded + */ + void recMicData(SFLDataFormat* buffer, int nSamples); + /** * Record a chunk of data in an openend file * @param buffer The data chunk to be recorded @@ -99,6 +118,7 @@ public: */ void recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2); + protected: /** @@ -131,10 +151,6 @@ protected: */ void closeWavFile(); - /** - * Given two buffers, return one mixed audio buffer - */ - void mixBuffers(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2); /** * Pointer to the recorded file @@ -165,6 +181,21 @@ protected: * Sampling rate */ int sndSmplRate_; + + /** + * number of samples recorded for mic buffer + */ + int nbSamplesMic_; + + /** + * number of samples recorded for speaker buffer + */ + int nbSamplesSpk_; + + /** + * Maximum number of samples + */ + int nbSamplesMax_; /** * Recording flage @@ -175,6 +206,16 @@ protected: * Buffer used for mixing two channels */ SFLDataFormat* mixBuffer_; + + /** + * Buffer used to copy mic info + */ + SFLDataFormat* micBuffer_; + + /** + * Buffer used to copy spkr info + */ + SFLDataFormat* spkBuffer_; /** * Filename for this recording @@ -185,12 +226,11 @@ protected: * Path for this recording */ std::string savePath_; - /** - * AudioDSP test (compute RMS value) + * Path for this recordingId for this call */ - AudioDSP dsp; + std::string call_id_; }; diff --git a/src/samplerateconverter.cpp b/src/samplerateconverter.cpp index 52d047ca4cb5c5da507b1d91b4a7851b49cea9b9..a4e8474d37127fac823216486bd550cff6a711c5 100644 --- a/src/samplerateconverter.cpp +++ b/src/samplerateconverter.cpp @@ -64,8 +64,8 @@ void SamplerateConverter::init( void ) { // libSamplerateConverter-related // Set the converter type for the upsampling and the downsampling // interpolator SRC_SINC_BEST_QUALITY - _src_state_mic = src_new(SRC_SINC_BEST_QUALITY, 1, &_src_err); - _src_state_spkr = src_new(SRC_SINC_BEST_QUALITY, 1, &_src_err); + _src_state_mic = src_new(SRC_LINEAR, 1, &_src_err); + _src_state_spkr = src_new(SRC_LINEAR, 1, &_src_err); int nbSamplesMax = (int) ( getFrequence() * getFramesize() / 1000 ); _floatBufferDownMic = new float32[nbSamplesMax]; diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 5d533c04f8e50ad912e95cb6f7bd4967bb804524..59633b0e324ae68d1c7c571f0add0c7f7847e447 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -424,6 +424,9 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) } //call->setPeerNumber(toUrl); call->setPeerNumber(getSipTo(toUrl, account->getHostname())); + + call->initRecFileName(); + _debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data()); // we have to add the codec before using it in SIPOutgoingInvite... call->setCodecMap(Manager::instance().getCodecDescriptorMap()); @@ -447,7 +450,7 @@ SIPVoIPLink::answer(const CallID& id) pj_status_t status; pjsip_tx_data *tdata; - _debug("- SIP Action: start answering\n"); + _debug("SIPVoIPLink::answer: start answering \n"); call = getSIPCall(id); @@ -459,22 +462,23 @@ SIPVoIPLink::answer(const CallID& id) // User answered the incoming call, tell peer this news if (call->getLocalSDP()->startNegociation()) { // Create and send a 200(OK) response - _debug("UserAgent: Negociation success!\n"); + _debug("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str()); status = pjsip_inv_answer(call->getInvSession(), PJSIP_SC_OK, NULL, NULL, &tdata); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); status = pjsip_inv_send_msg(call->getInvSession(), tdata); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); - _debug("* SIP Info: Starting AudioRTP when answering\n"); + _debug("SIPVoIPLink::answer: Starting AudioRTP when answering : call %s \n", call->getCallId().c_str()); if (_audiortp->createNewSession(call) >= 0) { call->setAudioStart(true); call->setConnectionState(Call::Connected); call->setState(Call::Active); return true; } else { - _debug("! SIP Failure: Unable to start sound when answering %s/%d\n", __FILE__, __LINE__); + _debug("SIPVoIPLink::answer: Unable to start sound when answering %s/%d\n", __FILE__, __LINE__); } } + _debug("SIPVoIPLink::answer: fail terminate call %s \n",call->getCallId().c_str()); terminateOneCall(call->getCallId()); removeCall(call->getCallId()); return false; @@ -800,6 +804,18 @@ SIPVoIPLink::isRecording(const CallID& id) return call->isRecording(); } + +std::string +SIPVoIPLink::getCurrentCodecName() +{ + + SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId()); + + AudioCodec *ac = call->getCodecMap().getCodec(call->getAudioCodec()); + + return ac->getCodecName(); +} + bool SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code) { @@ -1082,8 +1098,8 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam } - SIPCall* - SIPVoIPLink::getSIPCall(const CallID& id) +SIPCall* +SIPVoIPLink::getSIPCall(const CallID& id) { Call* call = getCall(id); if (call) { @@ -1092,9 +1108,11 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam return NULL; } - void SIPVoIPLink::setStunServer( const std::string &server ) - { - if(server != "") { + +void SIPVoIPLink::setStunServer( const std::string &server ) +{ + if(server != "") { + useStun(true); _stunServer = server; } else { @@ -1848,6 +1866,8 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam call->getLocalSDP()->setIp(link->getLocalIPAddress()); call->setPeerNumber(peerNumber); + call->initRecFileName(); + /* Call the SIPCallInvite function to generate the local sdp, * remote sdp and negociator. * This function is also used to set the parameters of audio RTP, including: diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index f21f5916d85db57f650cde6dc868dfd2ed029278..8790b84d1415a94cb7c1cd855f0108e764c2f3e5 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -297,6 +297,13 @@ class SIPVoIPLink : public VoIPLink */ bool isRecording(const CallID& id); + /** + * Return the codec protocol used for this call + * @param id The call identifier + */ + std::string getCurrentCodecName(); + + private: /** * Constructor diff --git a/src/voiplink.h b/src/voiplink.h index 92b7795eb479a987674e71cc9d75a88fcd181565..6de21106b354a5cab3e1694e3728742b0fb87b6e 100644 --- a/src/voiplink.h +++ b/src/voiplink.h @@ -173,6 +173,12 @@ class VoIPLink { */ virtual bool isRecording(const CallID& id) = 0; + /** + * Return the codec protocol used for this call + * @param id The call identifier + */ + virtual std::string getCurrentCodecName() = 0; + bool initDone (void) { return _initDone; } void initDone (bool state) { _initDone = state; } diff --git a/tools/build-package.sh b/tools/build-package.sh index 78e8a4f97ee214ce72409d004be522cfb2de0dc2..c2d4d5f85bab8e25b70fddf6a43dcd2cb23bf365 100755 --- a/tools/build-package.sh +++ b/tools/build-package.sh @@ -54,12 +54,11 @@ git checkout origin/release -b release # Get system parameters arch_flag=`getconf -a|grep LONG_BIT | sed -e 's/LONG_BIT\s*//'` os_version=`lsb_release -d -s -c | sed -e '1d'` -ver=0.9.2 +ver=0.9.3 if [ $platform == "ubuntu" ];then # Generate the changelog, according to the distribution and the git commit messages - cp debian/changelog.$os_version debian/changelog - git-dch --debian-branch=release --release + sed 's/%system%/'$os_version'/g' debian/changelog > debian/changelog.tmp && mv debian/changelog.tmp debian/changelog fi cd .. diff --git a/www/contact.php b/www/contact.php index f5c9548673ec92f059fa146ebdb0bf6cc416eabc..1649ffc79a831948346a8739f301480a392ae0a1 100644 --- a/www/contact.php +++ b/www/contact.php @@ -11,7 +11,7 @@ include('include/header.php'); <tbody> <tr> <td > - <h5>SAVOIR-FAIRE LINUX - À MONTRÉAL</h5> + <h5>SAVOIR-FAIRE LINUX - IN MONTREAL</h5> <p>7275 Saint Urbain Bureau 306</p> <p>Montréal (Québec) H2R 2Y5</p> <p>Tél. (514) 276-5468</p> @@ -22,7 +22,7 @@ include('include/header.php'); </td > <td > - <h5>À QUÉBEC :</h5> + <h5>IN QUEBEC :</h5> <p>275, rue du Parvis </p> <p>Bureau 310 </p> <p>Québec (Québec) G1K 6G7 </p> @@ -34,7 +34,7 @@ include('include/header.php'); </tr> <tr> <td > - <h5>À OTTAWA / Gatineau :</h5> + <h5>IN OTTAWA / Gatineau :</h5> <p>151, rue Slater</p> <p>Bureau 504</p> <p>Ottawa, ON, K1P 5H3</p> diff --git a/www/css/reset.css b/www/css/reset.css index 8525df42a9796cb1ffd600b86c5724cddca7575b..d7c9809743ba3e2354e1dc4c17401adb87044d44 100644 --- a/www/css/reset.css +++ b/www/css/reset.css @@ -5,7 +5,7 @@ ---------------------------------------- */ #slider { - width: 260px; /*important to be same as image width */ + width: 328px; /*important to be same as image width */ /* height: 300px; important to be same as image height */ position: relative; /* important */ overflow: hidden; /* important */ @@ -38,12 +38,12 @@ position: absolute; font: 10px/15px Arial, Helvetica, sans-serif; padding: 10px 13px; - width: 190px; + width: 100%; background-color: #ddfabb; - filter: alpha(opacity=70); - -moz-opacity: 0.7; - -khtml-opacity: 0.7; - opacity: 0.7; + filter: alpha(opacity=80); + -moz-opacity: 0.8; + -khtml-opacity: 0.8; + opacity: 0.8; color: #000; display: none; border:1px solid #ddd; @@ -74,7 +74,7 @@ } .bottom { bottom: 0; - left: 0; + left: 5px; } .left { top: 0; diff --git a/www/css/style1.css b/www/css/style1.css index c24e74333349f7088cd1b8abee41feb87fbf3cc9..30c89548ea5b09cd442fd5c994463c61a598cfc0 100644 --- a/www/css/style1.css +++ b/www/css/style1.css @@ -532,4 +532,10 @@ code { padding: 3px; } +.discover-image { + bottom: -50px; + left: -50px; + position: relative; +} + diff --git a/www/download.php b/www/download.php index 68cd82e83643323c38ad40b5016fdb9ccf7a902f..3edf117f50d9f1d55f7c89ed0313d8df2479f82b 100644 --- a/www/download.php +++ b/www/download.php @@ -24,19 +24,36 @@ include('include/header.php'); <tr> <td><img class="logo" src="img/logos/small/ubuntu.png" alt="Ubuntu downloads" /></td> <td> - <ul style="margin:10px; padding:5px;"> - <li>Ubuntu 8.10 "Intrepid Ibex" <a href="http://sflphone.org/debian/dists/intrepid/universe/binary-i386/sflphone_0.9.3-0ubuntu1_i386.deb">i386</a> | <a href="http://sflphone.org/debian/dists/intrepid/universe/binary-amd64/sflphone_0.9.3-0ubuntu1_amd64.deb" >amd64</a> - </li> - <li> - Ubuntu 8.04 LTS "Hardy Heron" <a href="http://sflphone.org/debian/dists/hardy/universe/binary-i386/sflphone_0.9.2-2ubuntu7_i386.deb" >i386</a> | <a href="http://sflphone.org/debian/dists/hardy/universe/binary-amd64/sflphone_0.9.2-2ubuntu7_amd64.deb" >amd64</a></li> - </ul> - <br/> + <!-- UBUNTU SECTION --> + <ul style="margin:10px; padding:5px;"> + <li>Ubuntu 9.04 "Jaunty Jackalope" + <a href="http://sflphone.org/debian/dists/jaunty/universe/binary-i386/sflphone_0.9.3-0ubuntu2_i386.deb">i386</a> + </li> + + + <li>Ubuntu 8.10 "Intrepid Ibex" + <a href="http://sflphone.org/debian/dists/intrepid/universe/binary-i386/sflphone_0.9.3-0ubuntu3_i386.deb">i386</a> + | <a href="http://sflphone.org/debian/dists/intrepid/universe/binary-amd64/sflphone_0.9.3-0ubuntu3_amd64.deb" >amd64</a> + </li> + + <li>Ubuntu 8.04 LTS "Hardy Heron" + <a href="http://sflphone.org/debian/dists/hardy/universe/binary-i386/sflphone_0.9.3-0ubuntu3_i386.deb" >i386</a> + | <a href="http://sflphone.org/debian/dists/hardy/universe/binary-amd64/sflphone_0.9.3-0ubuntu3_amd64.deb" >amd64</a> + </li> + </ul> + <i>Before installing the latest version 0.9.3-3, please remove the following packages: <b>dbus-c++-1</b> and <b>sflphone-iax2</b>. + The both libraries are now provided with sflphone package.</i> + <br/><br/> <a href="http://dev.savoirfairelinux.net/sflphone/wiki/DebianPackaging">add our repository</a> | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#ReleaseNote">release note</a> | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#Changelog">changelog</a> </td> <td><a href="mailto:emmanuel.milou@savoirfairelinux.com">Emmanuel Milou</a></td> </tr> + + <!-- END UBUNTU SECTION --> + + <!-- FEDORA SECTION --> <tr> <td><img class="logo" src="img/logos/small/fedora.png" alt="Fedora downloads" /></td> <td> @@ -48,6 +65,7 @@ include('include/header.php'); Fedora 10 : <i>Soon</i><br /> </li> </ul> + <br/> <a href="http://dev.savoirfairelinux.net/sflphone/wiki/YumRepository">add our repository</a> | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#ReleaseNote">release note</a> | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#Changelog">changelog</a> @@ -56,7 +74,16 @@ include('include/header.php'); </tr> <tr> <td><img class="logo"src="img/logos/small/suse.png" alt="Suse downloads" /></td> - <td>Follow the steps to add our Suse yum repository <a href="http://dev.savoirfairelinux.net/sflphone/wiki/DownloadSFLphone#Binaries">here</a>.</td> + <td> + <ul style="margin:10px; padding:5px;"> + <li>OpenSUSE 11: <a href="http://sflphone.org/yum/suse/11/i586/sflphone-0.9.3-2suse.i586.rpm">i586</a> + </li> + </ul> + <br/> + <a href="http://dev.savoirfairelinux.net/sflphone/wiki/YumRepository">add our repository</a> + | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#ReleaseNote">release note</a> + | <a href="http://dev.savoirfairelinux.net/sflphone/milestone/0.9.3#Changelog">changelog</a> + </td> <td><a href="mailto:emmanuel.milou@savoirfairelinux.com">Emmanuel Milou</a></td> </tr> <tr> @@ -76,7 +103,7 @@ include('include/header.php'); </thead> <tbody> <tr> - <td><a href="http://dev.savoirfairelinux.net/sflphone/downloads/5">sflphone_0.9.2.orig.tar.gz</a></td> + <td><a href="http://dev.savoirfairelinux.net/sflphone/downloads/7">sflphone_0.9.3.orig.tar.gz</a></td> <td>Compressed code source</td> </tr> <tr> diff --git a/www/features.php b/www/features.php index 0b00373b6823c6bcb724272f56ab9ff551ff611d..30d65c5b31f79bd680be20445dcaad2b49838da0 100644 --- a/www/features.php +++ b/www/features.php @@ -21,7 +21,7 @@ include('include/header.php'); <a href="http://www.pulseaudio.org">PulseAudio</a> sound server so you could experience the great possibilities it offers (sound mixing, per application volume control, ...). <br/> - The GTK+ graphical user interface provides you an intuitiv and easy way to phone, and, thanks to the integration of the GNOME desktop notification, you will never miss a call. + The GTK+ graphical user interface provides you an intuitive and easy way to phone, and, thanks to the integration of the GNOME desktop notification, you will never miss a call. <br/> </p> </td> @@ -41,7 +41,7 @@ include('include/header.php'); <br/> Connect it to <a href="http://www.asterisk.org">Asterisk</a> - PABX to get the best of it. + PBX to get the best of it. <br/> </p> </td> diff --git a/www/img/gallery/account-add.png b/www/img/gallery/account-add.png new file mode 100644 index 0000000000000000000000000000000000000000..6740507261ae070a456a38925e1a0fbe0d74847a Binary files /dev/null and b/www/img/gallery/account-add.png differ diff --git a/www/img/gallery/account-edit.png b/www/img/gallery/account-edit.png new file mode 100644 index 0000000000000000000000000000000000000000..006880381306effaf01954f9115a705bba9f2fb8 Binary files /dev/null and b/www/img/gallery/account-edit.png differ diff --git a/www/img/gallery/thumbs/account-add.png b/www/img/gallery/thumbs/account-add.png new file mode 100644 index 0000000000000000000000000000000000000000..3f912d6a8894ce4cb6dba0b8d9005da068b2e2aa Binary files /dev/null and b/www/img/gallery/thumbs/account-add.png differ diff --git a/www/img/gallery/thumbs/account-edit.png b/www/img/gallery/thumbs/account-edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b59a120b5aa70ac7278bf0b25eebb29ebcc0bdf7 Binary files /dev/null and b/www/img/gallery/thumbs/account-edit.png differ diff --git a/www/img/logos/GPLv3-logo-red.png b/www/img/logos/GPLv3-logo-red.png deleted file mode 100644 index bf4e320967cecfbd0972c3bfdac390794f3c91a6..0000000000000000000000000000000000000000 Binary files a/www/img/logos/GPLv3-logo-red.png and /dev/null differ diff --git a/www/img/logos/custom/gpl3.png b/www/img/logos/custom/gpl3.png new file mode 100644 index 0000000000000000000000000000000000000000..1643642eba04468cdd8beb43ea0cdf23c380d664 Binary files /dev/null and b/www/img/logos/custom/gpl3.png differ diff --git a/www/img/slider/homepage.png b/www/img/slider/homepage.png new file mode 100644 index 0000000000000000000000000000000000000000..8974efa5b8ff00b3677ec2c389e4fa3983b205ec Binary files /dev/null and b/www/img/slider/homepage.png differ diff --git a/www/img/slider/lady-discover.jpg b/www/img/slider/lady-discover.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0058e469cd7049c45581da7ef6017357e1e47307 Binary files /dev/null and b/www/img/slider/lady-discover.jpg differ diff --git a/www/img/slider/lady-wise.jpg b/www/img/slider/lady-wise.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e71acfdd83af8051ad3dd20c668bd2fd2f27f5f1 Binary files /dev/null and b/www/img/slider/lady-wise.jpg differ diff --git a/www/img/slider/mrbad.jpg b/www/img/slider/mrbad.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6cd63f5608a030284447aa7cb58cb38cf40f2b44 Binary files /dev/null and b/www/img/slider/mrbad.jpg differ diff --git a/www/include/footer.php b/www/include/footer.php index 7d59666bd5604c1f7488ef4b072d5d9c32a6ef4b..675d04a66187509bc93e93756c61f88282cb3347 100644 --- a/www/include/footer.php +++ b/www/include/footer.php @@ -26,7 +26,7 @@ <div class="footBlock"> <ul> <li>Development team</li> - <li><a href="mailto:sflphoneteam@savoirfairelinux.com">sflphoneteam@savoirfairelinux.com</a></li> + <li><a href="mailto:sflphone@lists.savoirfairelinux.net">sflphone@lists.savoirfairelinux.net</a></li> <li>Support</li> <li><a href="mailto:support@savoirfairelinux.com">support@savoirfairelinux.com</a></li> <li>General Information</li> @@ -38,7 +38,7 @@ <div class="rightfootBlock"> <ul> <li> - © Savoir-Faire Linux Inc 2009</li> + © Savoir-Faire Linux Inc 2009<img src="img/logos/custom/gpl3.png" /></li> </ul> </div> <div class="clear"> diff --git a/www/index.php b/www/index.php index 765f2c356c8525e5b1f68bcfeef6a105b054cb43..6b102c0091b0ea5ae8da4cd70b5d67f63980f083 100644 --- a/www/index.php +++ b/www/index.php @@ -18,13 +18,19 @@ include('include/header.php'); <div id="slider" > <ul id="sliderContent"> <li class="sliderImage"> - <img src="img/comm.jpg" width="210" height="384" alt=""/> + <img src="img/slider/lady-wise.jpg" width="310" height="384" alt=""/> <span class="bottom"> <strong>Savoir-Faire Linux</strong> <br />presents SFLphone</span> </li> <li class="sliderImage"> - <img src="img/sflPhone_a.png" width="210" height="384" alt=""/> + <img src="img/slider/mrbad.jpg" width="310" height="384" alt=""/> + <span class="bottom"> + <strong>SFLphone</strong> + <br />It's free and you can use it everywhere.</span> + </li> + <li class="sliderImage"> + <img src="img/slider/homepage.png" width="310" height="384" alt=""/> <span class="bottom"> <strong>SFLphone</strong> <br />SIP and IAX2 softphone</span> @@ -41,7 +47,7 @@ include('include/header.php'); <li>SIP and IAX2 compatible softphone</li> <li>Robust enterprise-class desktop phone for Linux</li> <li>Provide support of unlimited number of calls, multi-accounts, call transfer and hold.</li> - <li>Enjoy a perfect audio quality</li> + <li>Enjoy perfect audio quality</li> </ul> <br> <div class="float_it_middle"> @@ -75,6 +81,7 @@ include('include/header.php'); a Canadian Linux consulting company, in partnership with the global community. Savoir-Faire Linux provides to users easy-to-install packages for most of the main Linux distributions. </p> + <img class="discover-image" src="img/slider/lady-discover.jpg" /> </td> </tr> </tbody> diff --git a/www/screenshot.php b/www/screenshot.php index 6e1cc71cecf4a10eed0602daddfbee19455adf22..8f28dc1fd3fa9c6d68e719a251b4014522e0f074 100644 --- a/www/screenshot.php +++ b/www/screenshot.php @@ -9,6 +9,7 @@ include('include/header.php'); ?> <div id="content"> + <div id="main-image"> </div> <ul class="gallery"> <?php // $imageDirectory = "./img/gallery"; @@ -22,7 +23,7 @@ include('include/header.php'); //<li><a href="img/gallery/<?php echo $file " title="Main Window"><img src="img/gallery/thumbs/<?php echo $file " alt="Main Window"></a></li> //php endforeach; $images = array( - array('assistant-1.png','File menu'), + array('assistant-1.png','File menu', 'state' => 'active'), array('main-edit.png','Edit menu'), array('main-view.png','View menu'), array('main-help.png','Help menu'), @@ -37,14 +38,19 @@ include('include/header.php'); array('incoming-call.png','Incoming call'), array('main-history.png','Call history'), array('main-history-opt.png','Call history options'), - array('main-transfer.png','Call transfer') + array('main-transfer.png','Call transfer'), + array('account-edit.png','Account add dialog'), + array('account-add.png','Account edit dialog') ); foreach($images as $image){ $fileName = $image[0]; $description = $image[1]; - echo "<li><a href='img/gallery/$fileName' title='$description'><img src='img/gallery/thumbs/$fileName' alt='$description'></a></li>"; + echo "<li "; + if($image['state'] != null) + echo 'class="active" > '; + echo "<a href='img/gallery/$fileName' title='$description'><img src='img/gallery/thumbs/$fileName' alt='$description'></a></li>"; } ?> @@ -57,57 +63,56 @@ include('include/header.php'); I should thank all the jQuery team and users for making one of the most awesome javascript library out there. http://jquery.org --> - <script type="text/javascript"> - //jQuery(function($) { $('ul.gallery').galleria(); }); - - jQuery(function($) { + <script type="text/javascript"> + jQuery(function($) { - $('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability + $('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability - $('ul.gallery').galleria({ - history : true, // activates the history object for bookmarking, back-button etc. - clickNext : true, // helper for making the image clickable - insert : '#main_image', // the containing selector for our main image - onImage : function(image,caption,thumb) { // let's add some image effects for demonstration purposes + $('ul.gallery').galleria({ + history : true, // activates the history object for bookmarking, back-button etc. + clickNext : true, // helper for making the image clickable + insert : '#main-image', + onImage : function(image,caption,thumb) { // let's add some image effects for demonstration purposes - // fade in the image & caption - if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow - image.css('display','none').fadeIn(1000); - } - caption.css('display','none').fadeIn(1000); + // fade in the image & caption + if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow + image.css('display','none').fadeIn(1000); + } + caption.css('display','none').fadeIn(1000); - // fetch the thumbnail container - var _li = thumb.parents('li'); + // fetch the thumbnail container + var _li = thumb.parents('li'); - // fade out inactive thumbnail - _li.siblings().children('img.selected').fadeTo(500,0.3); + // fade out inactive thumbnail + _li.siblings().children('img.selected').fadeTo(500,0.3); - // fade in active thumbnail - thumb.fadeTo('fast',1).addClass('selected'); + // fade in active thumbnail + thumb.fadeTo('fast',1).addClass('selected'); - // add a title for the clickable image - image.attr('title','Next image >>'); - }, - onThumb : function(thumb) { // thumbnail effects goes here + // add a title for the clickable image + image.attr('title','Next image >>'); + }, + onThumb : function(thumb) { // thumbnail effects goes here - // fetch the thumbnail container - var _li = thumb.parents('li'); + // fetch the thumbnail container + var _li = thumb.parents('li'); - // if thumbnail is active, fade all the way. - var _fadeTo = _li.is('.active') ? '1' : '0.3'; + // if thumbnail is active, fade all the way. + var _fadeTo = _li.is('.active') ? '1' : '0.3'; - // fade in the thumbnail when finnished loading - thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500); + // fade in the thumbnail when finnished loading + thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500); - // hover effects - thumb.hover( - function() { thumb.fadeTo('fast',1); }, - function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active - ) - } - }); - }); + // hover effects + thumb.hover( + function() { thumb.fadeTo('fast',1); }, + function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active + ) + } + }); + }); + //$('ul.gallery > li:first > img').click(); </script> <?php diff --git a/www/utils.php b/www/utils.php index d778c9151ded2ac0a2e6512a8ee8724819b831dc..633d33aef11a93e65e8f13ef72f11c7963286c5d 100644 --- a/www/utils.php +++ b/www/utils.php @@ -1,6 +1,6 @@ <?php -$GLOBALS['SFLPHONE_LATEST_VERSION'] = '0.9.3-1'; -$GLOBALS['SFLPHONE_RELEASE_DATE'] = '2008 Feb 6'; +$GLOBALS['SFLPHONE_LATEST_VERSION'] = '0.9.3-3'; +$GLOBALS['SFLPHONE_RELEASE_DATE'] = '2009 Feb 28'; ?>