Commit 9bb1e53a authored by Tristan Matthews's avatar Tristan Matthews

* #12974: move application-wide constants/keys into separate headers

parent 32a6b189
......@@ -54,7 +54,9 @@ noinst_HEADERS = \
cc_thread.h \
cc_config.h \
sfl_types.h \
array_size.h
array_size.h \
account_schema.h \
registration_states.h
if SFL_VIDEO
SFL_VIDEO_LIB=./video/libvideo.la
......
......@@ -37,6 +37,21 @@
#include "video/video_endpoint.h"
#endif
const char * const Account::AUDIO_CODECS_KEY = "audioCodecs"; // 0/9/110/111/112/
const char * const Account::VIDEO_CODECS_KEY = "videoCodecs";
const char * const Account::RINGTONE_PATH_KEY = "ringtonePath";
const char * const Account::RINGTONE_ENABLED_KEY = "ringtoneEnabled";
const char * const Account::DISPLAY_NAME_KEY = "displayName";
const char * const Account::ALIAS_KEY = "alias";
const char * const Account::TYPE_KEY = "type";
const char * const Account::ID_KEY = "id";
const char * const Account::USERNAME_KEY = "username";
const char * const Account::AUTHENTICATION_USERNAME_KEY = "authenticationUsername";
const char * const Account::PASSWORD_KEY = "password";
const char * const Account::HOSTNAME_KEY = "hostname";
const char * const Account::ACCOUNT_ENABLE_KEY = "enable";
const char * const Account::MAILBOX_KEY = "mailbox";
Account::Account(const std::string &accountID, const std::string &type) :
accountID_(accountID)
, username_()
......@@ -44,7 +59,7 @@ Account::Account(const std::string &accountID, const std::string &type) :
, alias_()
, enabled_(true)
, type_(type)
, registrationState_(Unregistered)
, registrationState_(UNREGISTERED)
, audioCodecList_()
, videoCodecList_()
, audioCodecStr_()
......@@ -138,7 +153,7 @@ std::string Account::mapStateNumberToString(RegistrationState state)
"ERRORCONFSTUN"
};
if (state > NumberOfStates)
if (state > NUMBER_OF_STATES)
return "ERROR";
return mapStateToChar[state];
......
......@@ -35,10 +35,10 @@
#include <string>
#include <vector>
#include "global.h"
#include "noncopyable.h"
#include "config/sfl_config.h"
#include "config/serializable.h"
#include "registration_states.h"
class VoIPLink;
......@@ -49,102 +49,6 @@ class VoIPLink;
* It contains account, configuration, VoIP Link and Calls (inside the VoIPLink)
*/
/** Contains all the state an Voip can be in */
enum RegistrationState {
Unregistered,
Trying,
Registered,
Error,
ErrorAuth ,
ErrorNetwork ,
ErrorHost,
ErrorExistStun,
ErrorNotAcceptable,
NumberOfStates
};
// Account identifier
static const char *const CONFIG_ACCOUNT_ID = "Account.id";
// Common account parameters
static const char *const CONFIG_ACCOUNT_TYPE = "Account.type";
static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription";
static const char *const CONFIG_CREDENTIAL_NUMBER = "Credential.count";
static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType";
static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath";
static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
static const char *const CONFIG_KEEP_ALIVE_ENABLED = "Account.keepAliveEnabled";
static const char *const CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
static const char *const CONFIG_ACCOUNT_USERNAME = "Account.username";
static const char *const CONFIG_ACCOUNT_ROUTESET = "Account.routeset";
static const char *const CONFIG_ACCOUNT_PASSWORD = "Account.password";
static const char *const CONFIG_ACCOUNT_REALM = "Account.realm";
static const char *const CONFIG_ACCOUNT_DEFAULT_REALM = "*";
static const char *const CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
static const char *const CONFIG_LOCAL_INTERFACE = "Account.localInterface";
static const char *const CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publishedSameAsLocal";
static const char *const CONFIG_LOCAL_PORT = "Account.localPort";
static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort";
static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress";
static const char *const CONFIG_DISPLAY_NAME = "Account.displayName";
static const char *const CONFIG_DEFAULT_ADDRESS = "0.0.0.0";
// SIP specific parameters
static const char *const CONFIG_SIP_PROXY = "SIP.proxy";
static const char *const CONFIG_STUN_SERVER = "STUN.server";
static const char *const CONFIG_STUN_ENABLE = "STUN.enable";
// SRTP specific parameters
static const char *const CONFIG_SRTP_ENABLE = "SRTP.enable";
static const char *const CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
static const char *const CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
static const char *const CONFIG_SRTP_RTP_FALLBACK = "SRTP.rtpFallback";
static const char *const CONFIG_ZRTP_HELLO_HASH = "ZRTP.helloHashEnable";
static const char *const CONFIG_ZRTP_DISPLAY_SAS = "ZRTP.displaySAS";
static const char *const CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
static const char *const CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
static const char *const CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
static const char *const CONFIG_TLS_ENABLE = "TLS.enable";
static const char *const CONFIG_TLS_CA_LIST_FILE = "TLS.certificateListFile";
static const char *const CONFIG_TLS_CERTIFICATE_FILE = "TLS.certificateFile";
static const char *const CONFIG_TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
static const char *const CONFIG_TLS_PASSWORD = "TLS.password";
static const char *const CONFIG_TLS_METHOD = "TLS.method";
static const char *const CONFIG_TLS_CIPHERS = "TLS.ciphers";
static const char *const CONFIG_TLS_SERVER_NAME = "TLS.serverName";
static const char *const CONFIG_TLS_VERIFY_SERVER = "TLS.verifyServer";
static const char *const CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyClient";
static const char *const CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
// General configuration keys for accounts
static const char * const ALIAS_KEY = "alias";
static const char * const TYPE_KEY = "type";
static const char * const ID_KEY = "id";
static const char * const USERNAME_KEY = "username";
static const char * const AUTHENTICATION_USERNAME_KEY = "authenticationUsername";
static const char * const PASSWORD_KEY = "password";
static const char * const HOSTNAME_KEY = "hostname";
static const char * const ACCOUNT_ENABLE_KEY = "enable";
static const char * const MAILBOX_KEY = "mailbox";
static const char * const AUDIO_CODECS_KEY = "audioCodecs"; // 0/9/110/111/112/
static const char * const VIDEO_CODECS_KEY = "videoCodecs";
static const char * const RINGTONE_PATH_KEY = "ringtonePath";
static const char * const RINGTONE_ENABLED_KEY = "ringtoneEnabled";
static const char * const DISPLAY_NAME_KEY = "displayName";
class Account : public Serializable {
public:
......@@ -289,6 +193,23 @@ class Account : public Serializable {
void loadDefaultCodecs();
protected:
friend class ConfigurationTest;
// General configuration keys for accounts
static const char * const AUDIO_CODECS_KEY;
static const char * const VIDEO_CODECS_KEY;
static const char * const RINGTONE_PATH_KEY;
static const char * const RINGTONE_ENABLED_KEY;
static const char * const DISPLAY_NAME_KEY;
static const char * const ALIAS_KEY;
static const char * const TYPE_KEY;
static const char * const ID_KEY;
static const char * const USERNAME_KEY;
static const char * const AUTHENTICATION_USERNAME_KEY;
static const char * const PASSWORD_KEY;
static const char * const HOSTNAME_KEY;
static const char * const ACCOUNT_ENABLE_KEY;
static const char * const MAILBOX_KEY;
static std::string mapStateNumberToString(RegistrationState state);
/**
......
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Yan Morin <yan.morin@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.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef ACCOUNT_SCHEMA_H
#define ACCOUNT_SCHEMA_H_
/**
* @file account_schema.h
* @brief Account specfic keys/constants that must be shared in daemon and clients.
*/
// Account identifier
static const char *const CONFIG_ACCOUNT_ID = "Account.id";
// Common account parameters
static const char *const CONFIG_ACCOUNT_TYPE = "Account.type";
static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription";
static const char *const CONFIG_CREDENTIAL_NUMBER = "Credential.count";
static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType";
static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath";
static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
static const char *const CONFIG_KEEP_ALIVE_ENABLED = "Account.keepAliveEnabled";
static const char *const CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
static const char *const CONFIG_ACCOUNT_USERNAME = "Account.username";
static const char *const CONFIG_ACCOUNT_ROUTESET = "Account.routeset";
static const char *const CONFIG_ACCOUNT_PASSWORD = "Account.password";
static const char *const CONFIG_ACCOUNT_REALM = "Account.realm";
static const char *const CONFIG_ACCOUNT_DEFAULT_REALM = "*";
static const char *const CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
static const char *const CONFIG_LOCAL_INTERFACE = "Account.localInterface";
static const char *const CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publishedSameAsLocal";
static const char *const CONFIG_LOCAL_PORT = "Account.localPort";
static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort";
static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress";
static const char *const CONFIG_DISPLAY_NAME = "Account.displayName";
static const char *const CONFIG_DEFAULT_ADDRESS = "0.0.0.0";
// SIP specific parameters
static const char *const CONFIG_SIP_PROXY = "SIP.proxy";
static const char *const CONFIG_STUN_SERVER = "STUN.server";
static const char *const CONFIG_STUN_ENABLE = "STUN.enable";
// SRTP specific parameters
static const char *const CONFIG_SRTP_ENABLE = "SRTP.enable";
static const char *const CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
static const char *const CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
static const char *const CONFIG_SRTP_RTP_FALLBACK = "SRTP.rtpFallback";
static const char *const CONFIG_ZRTP_HELLO_HASH = "ZRTP.helloHashEnable";
static const char *const CONFIG_ZRTP_DISPLAY_SAS = "ZRTP.displaySAS";
static const char *const CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
static const char *const CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
static const char *const CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
static const char *const CONFIG_TLS_ENABLE = "TLS.enable";
static const char *const CONFIG_TLS_CA_LIST_FILE = "TLS.certificateListFile";
static const char *const CONFIG_TLS_CERTIFICATE_FILE = "TLS.certificateFile";
static const char *const CONFIG_TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
static const char *const CONFIG_TLS_PASSWORD = "TLS.password";
static const char *const CONFIG_TLS_METHOD = "TLS.method";
static const char *const CONFIG_TLS_CIPHERS = "TLS.ciphers";
static const char *const CONFIG_TLS_SERVER_NAME = "TLS.serverName";
static const char *const CONFIG_TLS_VERIFY_SERVER = "TLS.verifyServer";
static const char *const CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyClient";
static const char *const CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
#endif
......@@ -35,6 +35,7 @@
#endif
#include "configurationmanager.h"
#include "account_schema.h"
#include <cerrno>
#include <sstream>
#include "../manager.h"
......
......@@ -36,6 +36,7 @@
#endif
#include "iaxaccount.h"
#include "account_schema.h"
#include "iaxvoiplink.h"
#include "logger.h"
#include "manager.h"
......
......@@ -229,7 +229,7 @@ IAXVoIPLink::sendRegister(Account *a)
if (regSession_) {
iax_register(regSession_, account->getHostname().data(), account->getUsername().data(), account->getPassword().data(), 120);
nextRefreshStamp_ = time(NULL) + 10;
account->setRegistrationState(Trying);
account->setRegistrationState(TRYING);
}
}
......@@ -244,7 +244,7 @@ IAXVoIPLink::sendUnregister(Account *a)
nextRefreshStamp_ = 0;
dynamic_cast<IAXAccount*>(a)->setRegistrationState(Unregistered);
dynamic_cast<IAXAccount*>(a)->setRegistrationState(UNREGISTERED);
}
Call*
......@@ -601,7 +601,7 @@ void IAXVoIPLink::iaxHandleRegReply(iax_event* event)
iax_destroy(regSession_);
regSession_ = NULL;
account->setRegistrationState((event->etype == IAX_EVENT_REGREJ) ? ErrorAuth : Registered);
account->setRegistrationState((event->etype == IAX_EVENT_REGREJ) ? ERROR_AUTH : REGISTERED);
if (event->etype == IAX_EVENT_REGACK)
nextRefreshStamp_ = time(NULL) + (event->ies.refresh ? event->ies.refresh : 60);
......
......@@ -38,6 +38,7 @@
#include "logger.h"
#include "managerimpl.h"
#include "account_schema.h"
#include "account.h"
#include "dbus/callmanager.h"
......
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Yan Morin <yan.morin@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.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef REGISTRATION_STATES_H_
#define REGISTRATION_STATES_H_
/** Contains all the Registration states for an account can be in */
typedef enum {
UNREGISTERED,
TRYING,
REGISTERED,
ERROR,
ERROR_AUTH ,
ERROR_NETWORK ,
ERROR_HOST,
ERROR_EXIST_STUN,
ERROR_NOT_ACCEPTABLE,
NUMBER_OF_STATES
} RegistrationState;
#endif // REGISTRATION_STATES_H_
......@@ -34,6 +34,7 @@
#include "config.h"
#endif
#include "account_schema.h"
#include "sipaccount.h"
#include "sipvoiplink.h"
#include "config/yamlnode.h"
......@@ -495,7 +496,7 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
a[CONFIG_RINGTONE_ENABLED] = ringtoneEnabled_ ? "true" : "false";
a[CONFIG_ACCOUNT_MAILBOX] = mailBox_;
RegistrationState state = Unregistered;
RegistrationState state = UNREGISTERED;
std::string registrationStateCode;
std::string registrationStateDescription;
......
......@@ -550,7 +550,7 @@ void SIPVoIPLink::sendRegister(Account *a)
sipTransport.createSipTransport(*account);
account->setRegister(true);
account->setRegistrationState(Trying);
account->setRegistrationState(TRYING);
pjsip_regc *regc = account->getRegistrationInfo();
......@@ -637,7 +637,7 @@ void SIPVoIPLink::sendUnregister(Account *a)
// This may occurs if account failed to register and is in state INVALID
if (!account->isRegistered()) {
account->setRegistrationState(Unregistered);
account->setRegistrationState(UNREGISTERED);
return;
}
......@@ -1788,7 +1788,7 @@ void registration_cb(pjsip_regc_cbparam *param)
if (param->status != PJ_SUCCESS) {
FAILURE_MESSAGE();
processRegistrationError(*account, ErrorAuth);
processRegistrationError(*account, ERROR_AUTH);
return;
}
......@@ -1800,11 +1800,11 @@ void registration_cb(pjsip_regc_cbparam *param)
case PJSIP_SC_USE_PROXY: // 305
case PJSIP_SC_ALTERNATIVE_SERVICE: // 380
FAILURE_MESSAGE();
processRegistrationError(*account, Error);
processRegistrationError(*account, ERROR);
break;
case PJSIP_SC_SERVICE_UNAVAILABLE: // 503
FAILURE_MESSAGE();
processRegistrationError(*account, ErrorHost);
processRegistrationError(*account, ERROR_HOST);
break;
case PJSIP_SC_UNAUTHORIZED: // 401
// Automatically answered by PJSIP
......@@ -1813,11 +1813,11 @@ void registration_cb(pjsip_regc_cbparam *param)
case PJSIP_SC_FORBIDDEN: // 403
case PJSIP_SC_NOT_FOUND: // 404
FAILURE_MESSAGE();
processRegistrationError(*account, ErrorAuth);
processRegistrationError(*account, ERROR_AUTH);
break;
case PJSIP_SC_REQUEST_TIMEOUT: // 408
FAILURE_MESSAGE();
processRegistrationError(*account, ErrorHost);
processRegistrationError(*account, ERROR_HOST);
break;
case PJSIP_SC_INTERVAL_TOO_BRIEF: // 423
// Expiration Interval Too Brief
......@@ -1827,21 +1827,21 @@ void registration_cb(pjsip_regc_cbparam *param)
break;
case PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE: // 606
lookForReceivedParameter(*param, *account);
account->setRegistrationState(ErrorNotAcceptable);
account->setRegistrationState(ERROR_NOT_ACCEPTABLE);
account->registerVoIPLink();
break;
default:
FAILURE_MESSAGE();
processRegistrationError(*account, Error);
processRegistrationError(*account, ERROR);
break;
}
} else {
lookForReceivedParameter(*param, *account);
if (account->isRegistered())
account->setRegistrationState(Registered);
account->setRegistrationState(REGISTERED);
else {
account->setRegistrationState(Unregistered);
account->setRegistrationState(UNREGISTERED);
SIPVoIPLink::instance()->sipTransport.shutdownSipTransport(*account);
}
}
......
......@@ -31,6 +31,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <map>
#include "account.h"
#include "account_schema.h"
#include "accounttest.h"
#include "manager.h"
#include "logger.h"
......
......@@ -33,6 +33,7 @@
#include "config/yamlemitter.h"
#include "config/yamlparser.h"
#include "account.h"
#include "account_schema.h"
#include "logger.h"
#include "audio/alsa/alsalayer.h"
#include "audio/pulseaudio/pulselayer.h"
......@@ -153,14 +154,14 @@ void ConfigurationTest::testYamlEmitter()
ScalarNode verifyclient(true);
ScalarNode verifyserver(true);
accountmap.setKeyValue(ALIAS_KEY, &alias);
accountmap.setKeyValue(TYPE_KEY, &type);
accountmap.setKeyValue(ID_KEY, &id);
accountmap.setKeyValue(USERNAME_KEY, &username);
accountmap.setKeyValue(PASSWORD_KEY, &password);
accountmap.setKeyValue(HOSTNAME_KEY, &hostname);
accountmap.setKeyValue(ACCOUNT_ENABLE_KEY, &enable);
accountmap.setKeyValue(MAILBOX_KEY, &mailbox);
accountmap.setKeyValue(Account::ALIAS_KEY, &alias);
accountmap.setKeyValue(Account::TYPE_KEY, &type);
accountmap.setKeyValue(Account::ID_KEY, &id);
accountmap.setKeyValue(Account::USERNAME_KEY, &username);
accountmap.setKeyValue(Account::PASSWORD_KEY, &password);
accountmap.setKeyValue(Account::HOSTNAME_KEY, &hostname);
accountmap.setKeyValue(Account::ACCOUNT_ENABLE_KEY, &enable);
accountmap.setKeyValue(Account::MAILBOX_KEY, &mailbox);
accountmap.setKeyValue(Preferences::REGISTRATION_EXPIRE_KEY, &expire);
accountmap.setKeyValue(INTERFACE_KEY, &interface);
accountmap.setKeyValue(PORT_KEY, &port);
......@@ -168,7 +169,7 @@ void ConfigurationTest::testYamlEmitter()
accountmap.setKeyValue(PUBLISH_PORT_KEY, &publishPort);
accountmap.setKeyValue(SAME_AS_LOCAL_KEY, &sameasLocal);
accountmap.setKeyValue(DTMF_TYPE_KEY, &dtmfType);
accountmap.setKeyValue(DISPLAY_NAME_KEY, &displayName);
accountmap.setKeyValue(Account::DISPLAY_NAME_KEY, &displayName);
accountmap.setKeyValue(SRTP_KEY, &srtpmap);
srtpmap.setKeyValue(SRTP_ENABLE_KEY, &srtpenabled);
......
......@@ -53,7 +53,8 @@ libsflphone_client_la_SOURCES = \
unused.h \
str_utils.h \
gtk2_wrappers.h \
seekslider.h
seekslider.h \
account_schema.h
libsflphone_client_la_LIBADD = $(SFLPHONE_LIBS)
libsflphone_client_la_LDFLAGS = @DBUSGLIB_LIBS@ @LIBNOTIFY_LIBS@ \
......
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Yan Morin <yan.morin@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.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef ACCOUNT_SCHEMA_H
#define ACCOUNT_SCHEMA_H_
/**
* @file account_schema.h
* @brief Account specfic keys/constants that must be shared in daemon and clients.
*/
// Account identifier
static const char *const CONFIG_ACCOUNT_ID = "Account.id";
// Common account parameters
static const char *const CONFIG_ACCOUNT_TYPE = "Account.type";
static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription";
static const char *const CONFIG_CREDENTIAL_NUMBER = "Credential.count";
static const char *const CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType";
static const char *const CONFIG_RINGTONE_PATH = "Account.ringtonePath";
static const char *const CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
static const char *const CONFIG_KEEP_ALIVE_ENABLED = "Account.keepAliveEnabled";
static const char *const CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
static const char *const CONFIG_ACCOUNT_USERNAME = "Account.username";
static const char *const CONFIG_ACCOUNT_ROUTESET = "Account.routeset";
static const char *const CONFIG_ACCOUNT_PASSWORD = "Account.password";
static const char *const CONFIG_ACCOUNT_REALM = "Account.realm";
static const char *const CONFIG_ACCOUNT_DEFAULT_REALM = "*";
static const char *const CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
static const char *const CONFIG_LOCAL_INTERFACE = "Account.localInterface";
static const char *const CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publishedSameAsLocal";
static const char *const CONFIG_LOCAL_PORT = "Account.localPort";
static const char *const CONFIG_PUBLISHED_PORT = "Account.publishedPort";
static const char *const CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress";
static const char *const CONFIG_DISPLAY_NAME = "Account.displayName";
static const char *const CONFIG_DEFAULT_ADDRESS = "0.0.0.0";
// SIP specific parameters
static const char *const CONFIG_SIP_PROXY = "SIP.proxy";
static const char *const CONFIG_STUN_SERVER = "STUN.server";
static const char *const CONFIG_STUN_ENABLE = "STUN.enable";
// SRTP specific parameters
static const char *const CONFIG_SRTP_ENABLE = "SRTP.enable";
static const char *const CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
static const char *const CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
static const char *const CONFIG_SRTP_RTP_FALLBACK = "SRTP.rtpFallback";
static const char *const CONFIG_ZRTP_HELLO_HASH = "ZRTP.helloHashEnable";
static const char *const CONFIG_ZRTP_DISPLAY_SAS = "ZRTP.displaySAS";
static const char *const CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
static const char *const CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
static const char *const CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
static const char *const CONFIG_TLS_ENABLE = "TLS.enable";
static const char *const CONFIG_TLS_CA_LIST_FILE = "TLS.certificateListFile";
static const char *const CONFIG_TLS_CERTIFICATE_FILE = "TLS.certificateFile";
static const char *const CONFIG_TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
static const char *const CONFIG_TLS_PASSWORD = "TLS.password";
static const char *const CONFIG_TLS_METHOD = "TLS.method";
static const char *const CONFIG_TLS_CIPHERS = "TLS.ciphers";
static const char *const CONFIG_TLS_SERVER_NAME = "TLS.serverName";
static const char *const CONFIG_TLS_VERIFY_SERVER = "TLS.verifyServer";
static const char *const CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyClient";
static const char *const CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
static const char *const CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
#endif
......@@ -33,6 +33,7 @@
#include "str_utils.h"
#include "dbus.h"
#include "accountlist.h"
#include "account_schema.h"
#include "logger.h"
#include "actions.h"
#include "unused.h"
......@@ -267,7 +268,7 @@ gboolean current_account_has_mailbox(void)
account_t *current = account_list_get_current();
if (current) {
gchar * account_mailbox = account_lookup(current, ACCOUNT_MAILBOX);
gchar * account_mailbox = account_lookup(current, CONFIG_ACCOUNT_MAILBOX);
if (account_mailbox && !utf8_case_equal(account_mailbox, ""))
return TRUE;
......@@ -306,7 +307,7 @@ gboolean account_is_IP2IP(const account_t *account)
static gboolean is_type(const account_t *account, const gchar *type)
{
const gchar *account_type = account_lookup(account, ACCOUNT_TYPE);
const gchar *account_type = account_lookup(account, CONFIG_ACCOUNT_TYPE);
return g_strcmp0(account_type, type) == 0;
}
......@@ -345,9 +346,9 @@ void initialize_credential_information(account_t *account)
if (!account->credential_information) {
account->credential_information = g_ptr_array_sized_new(1);
GHashTable * new_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
g_hash_table_insert(new_table, g_strdup(ACCOUNT_REALM), g_strdup("*"));
g_hash_table_insert(new_table, g_strdup(ACCOUNT_USERNAME), g_strdup(""));
g_hash_table_insert(new_table, g_strdup(ACCOUNT_PASSWORD), g_strdup(""));
g_hash_table_insert(new_table, g_strdup(CONFIG_ACCOUNT_REALM), g_strdup("*"));
g_hash_table_insert(new_table, g_strdup(CONFIG_ACCOUNT_USERNAME), g_strdup(""));
g_hash_table_insert(new_table, g_strdup(CONFIG_ACCOUNT_PASSWORD), g_strdup(""));
g_ptr_array_add(account->credential_information, new_table);
}
}
......
......@@ -61,6 +61,7 @@
#include "actions.h"
#include "dbus/dbus.h"
#include "logger.h"
#include "account_schema.h"
#include "contacts/calltab.h"
#include "contacts/searchbar.h"
#include "contacts/addrbookfactory.h"
......@@ -135,13 +136,13 @@ status_bar_display_account()
if (acc) {
msg = g_markup_printf_escaped("%s %s (%s)" ,
_("Using account"),
(gchar*) account_lookup(acc, ACCOUNT_ALIAS),
(gchar*) account_lookup(acc, ACCOUNT_TYPE));
(gchar*) account_lookup(acc, CONFIG_ACCOUNT_ALIAS),
(gchar*) account_lookup(acc, CONFIG_ACCOUNT_TYPE));
} else {