Skip to content
Snippets Groups Projects
Commit 81c11a60 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#1722] Add SDES key exchange option in configuration panels (account, IP2IP)

parent 78b33798
No related branches found
No related tags found
No related merge requests found
...@@ -730,7 +730,7 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -730,7 +730,7 @@ GtkWidget * create_security_tab(account_t **a)
keyExchangeCombo = gtk_combo_box_new_text(); keyExchangeCombo = gtk_combo_box_new_text();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo);
gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP");
//gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES");
gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled"));
advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES); advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
...@@ -738,13 +738,17 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -738,13 +738,17 @@ GtkWidget * create_security_tab(account_t **a)
if (g_strcmp0(curSRTPEnabled, "false") == 0) if (g_strcmp0(curSRTPEnabled, "false") == 0)
{ {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2);
gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE);
} else { } else {
if (strcmp(curKeyExchange, ZRTP) == 0) { if (strcmp(curKeyExchange, ZRTP) == 0) {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0);
} else { }
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); else if (strcmp(curKeyExchange, SDES) == 0) {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),1);
}
else {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2);
gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE);
} }
} }
...@@ -1152,7 +1156,12 @@ show_account_window (account_t * a) ...@@ -1152,7 +1156,12 @@ show_account_window (account_t * a)
if (g_strcasecmp(keyExchange, "ZRTP") == 0) { if (g_strcasecmp(keyExchange, "ZRTP") == 0) {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true"));
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP)); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP));
} else { }
else if(g_strcasecmp(keyExchange, "SDES") == 0) {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true"));
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(SDES));
}
else {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false")); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false"));
} }
......
...@@ -120,10 +120,16 @@ static void key_exchange_changed_cb(GtkWidget *widget, gpointer data) ...@@ -120,10 +120,16 @@ static void key_exchange_changed_cb(GtkWidget *widget, gpointer data)
{ {
DEBUG("Key exchange changed"); DEBUG("Key exchange changed");
if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "ZRTP") == 0) { if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "ZRTP") == 0) {
gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE);
g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true"));
g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP)); g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP));
} else { }
else if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "SDES") == 0) {
gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true"));
g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(SDES));
}
else {
gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
DEBUG("Setting key exchange %s to %s\n", ACCOUNT_KEY_EXCHANGE, KEY_EXCHANGE_NONE); DEBUG("Setting key exchange %s to %s\n", ACCOUNT_KEY_EXCHANGE, KEY_EXCHANGE_NONE);
g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false")); g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false"));
...@@ -326,16 +332,20 @@ GtkWidget* create_direct_ip_calls_tab() ...@@ -326,16 +332,20 @@ GtkWidget* create_direct_ip_calls_tab()
keyExchangeCombo = gtk_combo_box_new_text(); keyExchangeCombo = gtk_combo_box_new_text();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo);
gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP");
//gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES");
gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled"));
advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES); advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
g_signal_connect(G_OBJECT(advancedZrtpButton), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), directIpCallsProperties); g_signal_connect(G_OBJECT(advancedZrtpButton), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), directIpCallsProperties);
if (g_strcasecmp(curKeyExchange, ZRTP) == 0) { if (g_strcasecmp(curKeyExchange, ZRTP) == 0) {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0);
} else { }
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); else if(g_strcasecmp(curKeyExchange, SDES) == 0) {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),1);
}
else {
gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 2);
gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE);
} }
......
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
#define UNUSED __attribute__((__unused__)) #define UNUSED __attribute__((__unused__))
#define ACCOUNT_TYPE "Account.type" #define ACCOUNT_TYPE "Account.type"
#define ACCOUNT_ALIAS "Account.alias" #define ACCOUNT_ALIAS "Account.alias"
#define ACCOUNT_ENABLED "Account.enable" #define ACCOUNT_ENABLED "Account.enable"
#define ACCOUNT_MAILBOX "Account.mailbox" #define ACCOUNT_MAILBOX "Account.mailbox"
#define ACCOUNT_RESOLVE_ONCE "Account.resolveOnce" #define ACCOUNT_RESOLVE_ONCE "Account.resolveOnce"
#define ACCOUNT_REGISTRATION_EXPIRE "Account.expire" #define ACCOUNT_REGISTRATION_EXPIRE "Account.expire"
#define ACCOUNT_SIP_STUN_SERVER "STUN.server" #define ACCOUNT_SIP_STUN_SERVER "STUN.server"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
#define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" #define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce"
#define KEY_EXCHANGE_NONE "0" #define KEY_EXCHANGE_NONE "0"
#define ZRTP "1" #define ZRTP "1"
#define SDES_TLS "2" #define SDES "2"
#define TLS_ENABLE "TLS.enable" #define TLS_ENABLE "TLS.enable"
#define TLS_PORT "TLS.port" #define TLS_PORT "TLS.port"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "AudioRtpFactory.h" #include "AudioRtpFactory.h"
#include "AudioZrtpSession.h" #include "AudioZrtpSession.h"
#include "AudioSrtpSession.h"
#include "AudioSymmetricRtpSession.h" #include "AudioSymmetricRtpSession.h"
#include "manager.h" #include "manager.h"
...@@ -106,6 +107,11 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca) ...@@ -106,6 +107,11 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
case Sdes: case Sdes:
_rtpSession = new AudioSrtpSession (&Manager::instance(), ca);
_rtpSessionType = Sdes;
break;
default: default:
throw UnsupportedRtpSessionType(); throw UnsupportedRtpSessionType();
} }
...@@ -125,6 +131,9 @@ void AudioRtpFactory::start (void) ...@@ -125,6 +131,9 @@ void AudioRtpFactory::start (void)
switch (_rtpSessionType) { switch (_rtpSessionType) {
case Sdes: case Sdes:
if (static_cast<AudioSrtpSession *> (_rtpSession)->startRtpThread() != 0) {
throw AudioRtpFactoryException ("Failed to start AudioSRtpSession thread");
}
break; break;
case Symmetric: case Symmetric:
......
...@@ -25,11 +25,13 @@ ...@@ -25,11 +25,13 @@
class SIPCall; class SIPCall;
namespace sfl { namespace sfl {
class AudioZrtpSession; class AudioZrtpSession;
class AudioSrtpSession;
} }
namespace sfl { namespace sfl {
class AudioZrtpSession; class AudioZrtpSession;
class AudioSrtpSession;
// Possible kind of rtp session // Possible kind of rtp session
typedef enum RtpMethod { typedef enum RtpMethod {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment