Commit 5509e52e authored by pierre-luc's avatar pierre-luc

[#1994] Better organize the source directory structure. New subdirectories

created under src/audio. Also, sip/ and iax/ were added under src/.
parent 3d54b92f
......@@ -45,8 +45,13 @@ AC_CONFIG_FILES([Makefile])
libs/iax2/Makefile])
AC_CONFIG_FILES([src/Makefile \
src/sip/Makefile \
src/iax/Makefile \
src/audio/Makefile \
src/audio/audiortp/Makefile \
src/audio/pulseaudio/Makefile \
src/audio/alsa/Makefile \
src/audio/sound/Makefile \
src/audio/codecs/Makefile \
src/config/Makefile \
src/dbus/Makefile \
......
......@@ -3,19 +3,7 @@ include ../globals.mak
libexecdir=$(libdir)/sflphone
libexec_PROGRAMS = sflphoned
if USE_IAX
# Use the global instead of locally built
IAX_FLAGS = -DUSE_IAX
IAXSOURCES = iaxaccount.cpp iaxvoiplink.cpp iaxcall.cpp
IAXHEADERS = iaxaccount.h iaxvoiplink.h iaxcall.h
else
IAX_FLAGS =
IAXSOURCES =
IAXHEADERS =
endif
SUBDIRS = dbus audio config plug-in hooks history
SUBDIRS = dbus audio config plug-in hooks history sip iax
# Add here the cpp files to be build with sflphone
sflphoned_SOURCES = \
......@@ -23,23 +11,14 @@ sflphoned_SOURCES = \
main.cpp \
managerimpl.cpp \
observer.cpp \
samplerateconverter.cpp \
eventthread.cpp \
sipaccount.cpp \
accountcreator.cpp \
sipvoiplink.cpp \
call.cpp \
account.cpp \
sipcall.cpp \
sdp.cpp \
sdpmedia.cpp \
numbercleaner.cpp \
$(IAXSOURCES)
numbercleaner.cpp
sflphoned_CXXFLAGS = \
-DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" \
$(IAX_FLAGS) \
@ZRTPCPP_CFLAGS@
......@@ -68,28 +47,28 @@ noinst_HEADERS = \
observer.h \
eventthread.h \
user_cfg.h \
samplerateconverter.h \
account.h \
sipaccount.h \
accountcreator.h \
sipvoiplink.h \
call.h \
sipcall.h \
sdp.h \
sdpmedia.h \
numbercleaner.h
libsflphone_la_LIBADD = \
$(src)/libs/stund/libstun.la \
$(src)/libs/utilspp/libutilspp.la \
$(src)/libs/iax2/libiax2.la \
./iax/libiaxlink.la \
./sip/libsiplink.la \
./audio/libaudio.la \
./audio/audiortp/libaudiortp.la \
./audio/sound/libsound.la \
./audio/codecs/libcodecdescriptor.la \
./audio/alsa/libalsalayer.la \
./audio/pulseaudio/libpulselayer.la \
./dbus/libdbus.la \
./config/libconfig.la \
./plug-in/libplugin.la \
./plug-in/audiorecorder/libaudiorecorder.la \
./hooks/libhooks.la \
./history/libhistory.la
./history/libhistory.la
libsflphone_la_SOURCES =
......@@ -18,9 +18,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "accountcreator.h"
#include "sipaccount.h"
#include "sip/sipaccount.h"
#ifdef USE_IAX
#include "iaxaccount.h"
#include "iax/iaxaccount.h"
#endif
AccountCreator::AccountCreator()
......
......@@ -9,39 +9,21 @@ else
ILBC_FLAG =
endif
SUBDIRS = codecs audiortp
SUBDIRS = codecs audiortp sound alsa pulseaudio
libaudio_la_SOURCES = \
audiofile.cpp \
tonelist.cpp \
audiostream.cpp \
dtmf.cpp \
tone.cpp \
alsalayer.cpp \
audiolayer.cpp \
pulselayer.cpp \
audiodevice.cpp \
dtmfgenerator.cpp \
tonegenerator.cpp \
codecDescriptor.cpp \
audioloop.cpp \
ringbuffer.cpp \
audiolayer.cpp \
audiodevice.cpp \
samplerateconverter.cpp \
$(SPEEX_SOURCES_CPP)
noinst_HEADERS = \
audioloop.h \
audiostream.h \
common.h \
ringbuffer.h \
audiofile.h \
tonelist.h \
audiolayer.h \
alsalayer.h \
pulselayer.h \
audiodevice.h \
dtmfgenerator.h \
tonegenerator.h \
codecDescriptor.h \
dtmf.h \
tone.h
samplerateconverter.h
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libalsalayer.la
libalsalayer_la_SOURCES = alsalayer.cpp
noinst_HEADERS = alsalayer.h
......@@ -20,7 +20,7 @@
#ifndef _ALSA_LAYER_H
#define _ALSA_LAYER_H
#include "audiolayer.h"
#include "audio/audiolayer.h"
#include "eventthread.h"
#include <alsa/asoundlib.h>
......
......@@ -22,8 +22,8 @@
#include "AudioSymmetricRtpSession.h"
#include "AudioZrtpSession.h"
#include "../../manager.h"
#include "../../account.h"
#include "manager.h"
#include "account.h"
namespace sfl {
......
......@@ -22,7 +22,7 @@
#include <exception>
#include <cc++/thread.h>
#include "../../sipcall.h"
#include "sip/sipcall.h"
class SIPCall;
......
......@@ -31,10 +31,10 @@
#include <cc++/socket.h>
#include "global.h"
#include "../../sipcall.h"
#include "../../samplerateconverter.h"
#include "../codecs/audiocodec.h"
#include "../audiolayer.h"
#include "sip/sipcall.h"
#include "audio/samplerateconverter.h"
#include "audio/codecs/audiocodec.h"
#include "audio/audiolayer.h"
class SIPCall;
......
......@@ -17,7 +17,7 @@
*/
#include "AudioZrtpSession.h"
#include "ZrtpSessionCallback.h"
#include "../user_cfg.h"
#include "user_cfg.h"
#include <libzrtpcpp/ZrtpQueue.h>
#include <libzrtpcpp/ZrtpUserCallback.h>
......
......@@ -18,8 +18,8 @@
*/
#include "ZrtpSessionCallback.h"
#include "../../managerimpl.h"
#include "../../global.h"
#include "managerimpl.h"
#include "global.h"
#include <cstdlib>
#include <string>
......
......@@ -24,7 +24,7 @@
#include <libzrtpcpp/ZrtpQueue.h>
#include <libzrtpcpp/ZrtpUserCallback.h>
#include "../../sipcall.h"
#include "sip/sipcall.h"
namespace sfl {
class ZrtpSessionCallback: public ZrtpUserCallback {
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libcodecdescriptor.la
libcodecdescriptor_la_SOURCES = codecDescriptor.cpp
if BUILD_GSM
GSM_LIB = libcodec_gsm.so
libcodec_gsm_so_SOURCES = gsmcodec.cpp
......@@ -52,8 +56,7 @@ endif
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so $(GSM_LIB) $(SPEEX_NB_LIB) $(SPEEX_WB_LIB) $(SPEEX_UB_LIB) $(CELT_LIB)
noinst_HEADERS = audiocodec.h
noinst_HEADERS = audiocodec.h codecDescriptor.h
libcodec_ulaw_so_SOURCES = ulaw.cpp
libcodec_ulaw_so_CFLAGS = -fPIC -g -Wall
......
......@@ -28,7 +28,7 @@
#include "global.h"
#include "user_cfg.h"
#include "codecs/audiocodec.h"
#include "audio/codecs/audiocodec.h"
/** Enumeration that contains known audio payloads */
typedef enum {
......@@ -55,8 +55,6 @@ typedef enum {
PAYLOAD_CODEC_SPEEX_32000 = 112
} AudioCodecType;
#include "codecs/audiocodec.h"
/** A codec is identified by its payload. A payload is associated with a name. */
typedef std::map<AudioCodecType, std::string> CodecMap;
/** The struct to reflect the order the user wants to use the codecs */
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libpulselayer.la
libpulselayer_la_SOURCES = \
audiostream.cpp \
pulselayer.cpp
noinst_HEADERS = \
audiostream.h \
pulselayer.h
......@@ -23,9 +23,9 @@
#include <pulse/pulseaudio.h>
#include <string>
#include "../global.h"
#include "ringbuffer.h"
#include "audioloop.h"
#include "global.h"
#include "audio/ringbuffer.h"
#include "audio/audioloop.h"
#include <cc++/thread.h>
......
......@@ -20,7 +20,7 @@
#ifndef _PULSE_LAYER_H
#define _PULSE_LAYER_H
#include "audiolayer.h"
#include "audio/audiolayer.h"
#include "audiostream.h"
#include <pulse/pulseaudio.h>
......
......@@ -25,7 +25,7 @@
#include <string.h>
#include "ringbuffer.h"
#include "../global.h"
#include "global.h"
#define MIN_BUFFER_SIZE 1280
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libsound.la
libsound_la_SOURCES = \
audiofile.cpp \
tone.cpp \
tonegenerator.cpp \
tonelist.cpp \
dtmf.cpp \
dtmfgenerator.cpp
noinst_HEADERS = \
audiofile.h \
tonegenerator.h \
tone.h \
tonelist.h \
dtmfgenerator.h \
dtmf.h
......@@ -21,7 +21,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "audiofile.h"
#include "codecDescriptor.h"
#include "audio/codecs/codecDescriptor.h"
#include <fstream>
#include <math.h>
#include <samplerate.h>
......
......@@ -23,9 +23,9 @@
#ifndef __AUDIOFILE_H__
#define __AUDIOFILE_H__
#include "audioloop.h"
#include "codecs/audiocodec.h"
#include "codecDescriptor.h"
#include "audio/audioloop.h"
#include "audio/codecs/audiocodec.h"
#include "audio/codecs/codecDescriptor.h"
/**
* @file audiofile.h
......
......@@ -24,7 +24,7 @@
#ifndef __DTMF_H_
#define __DTMF_H_
#include "../global.h"
#include "global.h"
#include "dtmfgenerator.h"
/**
......
......@@ -25,7 +25,7 @@
#include <math.h>
#include "dtmfgenerator.h"
#include "../global.h"
#include "global.h"
/*
......
......@@ -23,7 +23,7 @@
#define __TONE_H__
#include <string>
#include "audioloop.h"
#include "audio/audioloop.h"
#define TONE_NBTONE 4
#define TONE_NBCOUNTRY 7
......
......@@ -23,7 +23,7 @@
#include <stdlib.h>
#include "tonegenerator.h"
#include "../global.h"
#include "global.h"
int AMPLITUDE = 32767;
......
......@@ -24,7 +24,7 @@
#include <string>
#include <cc++/thread.h>
#include "../global.h"
#include "global.h"
/**
* @file tonegenerator.h
......
......@@ -29,7 +29,15 @@
<method name="deleteAllCredential">
<arg type="s" name="accountID" direction="in"/>
</method>
<method name="getIp2IpDetails">
<arg type="a{ss}" name="details" direction="out"/>
</method>
<method name="setIp2IpDetails">
<arg type="a{ss}" name="details" direction="in"/>
</method>
<method name="getCredential">
<arg type="s" name="accountID" direction="in"/>
<arg type="i" name="index" direction="in"/>
......
......@@ -23,6 +23,7 @@
#include <configurationmanager.h>
#include <sstream>
#include "../manager.h"
#include "../audio/audiortp/AudioRtpFactory.h"
const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLphone/ConfigurationManager";
......@@ -41,6 +42,59 @@ ConfigurationManager::getAccountDetails (const std::string& accountID)
return Manager::instance().getAccountDetails (accountID);
}
std::map< std::string, std::string >
ConfigurationManager::getIp2IpDetails(void)
{
std::map<std::string, std::string> ip2ipAccountDetails;
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(SRTP_KEY_EXCHANGE, Manager::instance().getConfigString(IP2IP_PROFILE, SRTP_KEY_EXCHANGE)));
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(SRTP_ENABLE, Manager::instance().getConfigString(IP2IP_PROFILE, SRTP_ENABLE) == "1" ? "TRUE": "FALSE"));
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(ZRTP_DISPLAY_SAS, Manager::instance().getConfigString(IP2IP_PROFILE, ZRTP_DISPLAY_SAS) == "1" ? "TRUE": "FALSE"));
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(ZRTP_HELLO_HASH, Manager::instance().getConfigString(IP2IP_PROFILE, ZRTP_HELLO_HASH) == "1" ? "TRUE": "FALSE"));
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString(IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING) == "1" ? "TRUE": "FALSE"));
ip2ipAccountDetails.insert(std::pair<std::string, std::string>
(ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString(IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE) == "1" ? "TRUE": "FALSE"));
return ip2ipAccountDetails;
}
void
ConfigurationManager::setIp2IpDetails(const std::map< std::string, std::string >& details )
{
Manager::instance().setConfigOrDefaultEmptyField(details, IP2IP_PROFILE, SRTP_ENABLE);
Manager::instance().setConfigOrDefaultEmptyField(details, IP2IP_PROFILE, ZRTP_DISPLAY_SAS);
Manager::instance().setConfigOrDefaultEmptyField(details, IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING);
Manager::instance().setConfigOrDefaultEmptyField(details, IP2IP_PROFILE, ZRTP_HELLO_HASH);
Manager::instance().setConfigOrDefaultEmptyField(details, IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE);
std::string keyExchange(details.find(SRTP_KEY_EXCHANGE)->second);
if(keyExchange.find("ZRTP") == 0) {
Manager::instance().setConfig(IP2IP_PROFILE, SRTP_KEY_EXCHANGE, sfl::Zrtp);
} else {
Manager::instance().setConfig(IP2IP_PROFILE, SRTP_KEY_EXCHANGE, sfl::Sdes);
}
Manager::instance().saveConfig();
// Update account details to the client side
accountsChanged();
}
std::map< std::string, std::string >
ConfigurationManager::getCredential (const std::string& accountID, const int32_t& index)
{
......@@ -122,7 +176,6 @@ ConfigurationManager::setCredential (const std::string& accountID, const int32_t
}
_debug("Realm: %s\n", it->second.c_str());
}
void
......
......@@ -47,6 +47,8 @@ public:
std::vector< std::string > getAccountList( );
void sendRegister( const std::string& accoundID , const int32_t& expire );
void setIp2IpDetails(const std::map< std::string, std::string >& details);
std::map< std::string, std::string > getIp2IpDetails(void);
std::map< std::string, std::string > getCredential (const std::string& accountID, const int32_t& index);
int32_t getNumberOfCredential (const std::string& accountID);
void setCredential (const std::string& accountID, const int32_t& index, const std::map< std::string, std::string >& details);
......
......@@ -19,7 +19,7 @@
#include "eventthread.h"
#include "voiplink.h"
#include "audio/alsalayer.h"
#include "audio/alsa/alsalayer.h"
/********************************** Voiplink thread *************************************/
EventThread::EventThread (VoIPLink *link)
......
include $(top_srcdir)/globals.mak
if USE_IAX
noinst_LTLIBRARIES = libiaxlink.la
libiaxlink_la_SOURCES = \
iaxaccount.cpp \
iaxcall.cpp \
iaxvoiplink.cpp
libiaxlink_la_CXXFLAGS = \
-DUSE_IAX
noinst_HEADERS = \
iaxaccount.h \
iaxcall.h \
iaxvoiplink.h
endif
......@@ -21,7 +21,7 @@
#define IAXCALL_H
#include "call.h"
#include "audio/codecDescriptor.h"
#include "audio/codecs/codecDescriptor.h"
#include <iax-client.h>
#include <frame.h>
......
......@@ -25,8 +25,8 @@
#include <iax-client.h>
#include "global.h"
#include "audio/codecDescriptor.h"
#include "samplerateconverter.h"
#include "audio/codecs/codecDescriptor.h"
#include "audio/samplerateconverter.h"
#include "hooks/urlhook.h"
class EventThread;
......
......@@ -37,14 +37,14 @@
#include "manager.h"
#include "account.h"
#include "sipaccount.h"
#include "sip/sipaccount.h"
#include "audio/audiolayer.h"
#include "audio/alsalayer.h"
#include "audio/pulselayer.h"
#include "audio/tonelist.h"
#include "audio/alsa/alsalayer.h"
#include "audio/pulseaudio/pulselayer.h"
#include "audio/sound/tonelist.h"
#include "accountcreator.h" // create new account
#include "sipvoiplink.h"
#include "sip/sipvoiplink.h"
#include "user_cfg.h"
......@@ -2400,6 +2400,18 @@ ManagerImpl::setConfig (const std::string& section, const std::string& name, int
return _config.setConfigTreeItem (section, name, valueStream.str());
}
bool ManagerImpl::setConfigOrDefaultEmptyField(const std::map<std::string, std::string>& details, const char * section, const char * field)
{
std::map<std::string, std::string>::iterator it;
std::map<std::string, std::string> detailsCpy = details;
it = detailsCpy.find(field);
if (it == detailsCpy.end()) {
return setConfig(section, field, EMPTY_FIELD);
} else {
return setConfig(section, field, it->second);
}
}
void ManagerImpl::setAccountsOrder (const std::string& order)
{
......
......@@ -39,10 +39,10 @@
#include "numbercleaner.h"
#include <history/historymanager.h>
#include "audio/tonelist.h" // for Tone::TONEID declaration
#include "audio/audiofile.h"
#include "audio/dtmf.h"
#include "audio/codecDescriptor.h"
#include "audio/sound/tonelist.h" // for Tone::TONEID declaration
#include "audio/sound/audiofile.h"
#include "audio/sound/dtmf.h"
#include "audio/codecs/codecDescriptor.h"
class AudioLayer;
class CodecDescriptor;
......@@ -711,6 +711,16 @@ class ManagerImpl {
*/
bool setConfig(const std::string& section, const std::string& name, int value);
/**
* Set a field in the configuration file to the value
* found in the map, otherwise, it is set to
* EMPTY_FIELD.
* @param details The map containing the field:value association
* @param section The ini style section in the configuration file
* @param field The field under that section to set the value to.
*/
bool setConfigOrDefaultEmptyField(const std::map<std::string, std::string>& details, const char * section, const char * field);
/**
* Get a int from the configuration tree
* Throw an Conf::ConfigTreeItemException if not found
......@@ -718,6 +728,7 @@ class ManagerImpl {
* @param name The parameter name
* @return int The int value
*/
int getConfigInt(const std::string& section, const std::string& name);
/**
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libsiplink.la
libsiplink_la_SOURCES = \
sdp.cpp \
sdpmedia.cpp \
sipaccount.cpp \
sipcall.cpp \
sipvoiplink.cpp
noinst_HEADERS = \
sdp.h \
sdpmedia.h \
sipaccount.h \
sipcall.h \
sipvoiplink.h
......@@ -30,7 +30,7 @@
#include <pj/pool.h>
#include <pj/assert.h>
#include "audio/codecDescriptor.h"
#include "audio/codecs/codecDescriptor.h"
#include "sdpmedia.h"
class Sdp {
......
......@@ -22,7 +22,7 @@
#include <vector>
#include "audio/codecDescriptor.h"
#include "audio/codecs/codecDescriptor.h"