Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
b7bf6fea
Commit
b7bf6fea
authored
Aug 20, 2009
by
pierre-luc
Browse files
[#812] Adds the ability to configure local/published address from
gtk-ui. Values are not saved back yet.
parent
ed4694c0
Changes
10
Hide whitespace changes
Inline
Side-by-side
sflphone-client-gnome/src/config/accountwindow.c
View file @
b7bf6fea
...
...
@@ -38,7 +38,13 @@
#include
<gtk/gtk.h>
/** Local variables */
/**
* TODO: tidy this up
* by storing these variables
* in a private structure.
* Local variables
*/
GtkDialog
*
dialog
;
GtkWidget
*
hbox
;
GtkWidget
*
label
;
...
...
@@ -59,6 +65,14 @@ GtkWidget * scrolledWindowCredential;
GtkWidget
*
advancedZrtpButton
;
GtkWidget
*
keyExchangeCombo
;
GtkWidget
*
useSipTlsCheckBox
;
GtkWidget
*
publishedAddressEntry
;
GtkWidget
*
localAddressCombo
;
GtkWidget
*
sameAsLocalCheckBox
;
GtkWidget
*
publishedPortSpinBox
;
GtkWidget
*
localPortSpinBox
;
GtkWidget
*
displayNameEntry
;
// Credentials
enum
{
...
...
@@ -107,7 +121,6 @@ static GtkWidget * create_account_tab(account_t **a)
// Default settings
gchar
*
curAccountID
=
""
;
gchar
*
curAccountEnabled
=
"true"
;
gchar
*
curAccountResolveOnce
=
"false"
;
gchar
*
curAccountType
=
"SIP"
;
gchar
*
curAlias
=
""
;
gchar
*
curUsername
=
""
;
...
...
@@ -129,7 +142,6 @@ static GtkWidget * create_account_tab(account_t **a)
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_PASSWORD
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_USERNAME
);
curMailbox
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_MAILBOX
);
curAccountResolveOnce
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_RESOLVE_ONCE
);
}
else
{
...
...
@@ -425,11 +437,10 @@ static void use_sip_tls_cb(GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive
(
GTK_WIDGET
(
data
),
TRUE
);
}
else
{
gtk_widget_set_sensitive
(
GTK_WIDGET
(
data
),
FALSE
);
}
}
}
GtkWidget
*
create_
advanced
_tab
(
account_t
**
a
)
GtkWidget
*
create_
security
_tab
(
account_t
**
a
)
{
GtkWidget
*
frame
;
GtkWidget
*
table
;
...
...
@@ -452,21 +463,10 @@ GtkWidget * create_advanced_tab(account_t **a)
gchar
*
curSRTPEnabled
=
NULL
;
gchar
*
curKeyExchange
=
NULL
;
gchar
*
curAccountResolveOnce
=
NULL
;
gchar
*
curAccountExpire
=
NULL
;
gchar
*
curTLSEnabled
=
NULL
;
// Load from SIP/IAX/Unknown ?
if
(
currentAccount
)
{
curAccountResolveOnce
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_RESOLVE_ONCE
);
if
(
curAccountResolveOnce
==
NULL
)
{
curAccountResolveOnce
=
"false"
;
}
curAccountExpire
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_REGISTRATION_EXPIRE
);
if
(
curAccountExpire
==
NULL
)
{
curAccountExpire
=
"600"
;
}
if
(
currentAccount
)
{
curKeyExchange
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_KEY_EXCHANGE
);
if
(
curKeyExchange
==
NULL
)
{
curKeyExchange
=
"none"
;
...
...
@@ -482,31 +482,9 @@ GtkWidget * create_advanced_tab(account_t **a)
curTLSEnabled
=
"false"
;
}
}
gnome_main_section_new_with_table
(
_
(
"Registration Options"
),
&
frame
,
&
table
,
2
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
frame
,
FALSE
,
FALSE
,
0
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Registration _expire"
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
0
,
1
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
entryExpire
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
entryExpire
);
gtk_entry_set_text
(
GTK_ENTRY
(
entryExpire
),
curAccountExpire
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
entryExpire
,
1
,
2
,
0
,
1
);
entryResolveNameOnlyOnce
=
gtk_check_button_new_with_mnemonic
(
_
(
"_Comply with RFC 3263"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
entryResolveNameOnlyOnce
),
g_strcasecmp
(
curAccountResolveOnce
,
"false"
)
==
0
?
TRUE
:
FALSE
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
entryResolveNameOnlyOnce
,
0
,
2
,
1
,
2
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
entryResolveNameOnlyOnce
)
,
TRUE
);
gtk_widget_show_all
(
table
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
table
),
10
);
gtk_widget_size_request
(
GTK_WIDGET
(
table
),
&
requisitionTable
);
/* Credentials tree view */
gnome_main_section_new_with_table
(
_
(
"Credential
informations
"
),
&
frame
,
&
table
,
1
,
1
);
gnome_main_section_new_with_table
(
_
(
"Credential"
),
&
frame
,
&
table
,
1
,
1
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
table
),
10
);
gtk_table_set_row_spacings
(
GTK_TABLE
(
table
),
10
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
frame
,
FALSE
,
FALSE
,
0
);
...
...
@@ -520,7 +498,7 @@ GtkWidget * create_advanced_tab(account_t **a)
G_TYPE_STRING
,
// Realm
G_TYPE_STRING
,
// Username
G_TYPE_STRING
,
// Password
G_TYPE_POINTER
// Pointer to the Object
G_TYPE_POINTER
// Pointer to the Object
c
);
treeViewCredential
=
gtk_tree_view_new_with_model
(
GTK_TREE_MODEL
(
credentialStore
));
...
...
@@ -564,7 +542,7 @@ GtkWidget * create_advanced_tab(account_t **a)
/* Dynamically resize the window to fit the scrolled window */
gtk_widget_size_request
(
GTK_WIDGET
(
treeViewCredential
),
&
requisitionTreeView
);
gtk_widget_set_size_request
(
GTK_WIDGET
(
scrolledWindowCredential
),
requisitionT
able
.
width
,
requisitionTreeView
.
height
+
20
);
gtk_widget_set_size_request
(
GTK_WIDGET
(
scrolledWindowCredential
),
requisitionT
reeView
.
width
,
requisitionTreeView
.
height
+
20
);
/* Credential Buttons */
hbox
=
gtk_hbox_new
(
FALSE
,
10
);
...
...
@@ -631,6 +609,177 @@ GtkWidget * create_advanced_tab(account_t **a)
return
ret
;
}
static
same_as_local_cb
(
GtkWidget
*
widget
,
gpointer
data
UNUSED
)
{
if
(
gtk_toggle_button_get_active
(
GTK_TOGGLE_BUTTON
(
widget
)))
{
DEBUG
(
"Same as local"
);
gchar
*
ip_address
=
(
gchar
*
)
gtk_combo_box_get_active_text
(
GTK_COMBO_BOX
(
localAddressCombo
));
gtk_entry_set_text
(
GTK_ENTRY
(
publishedAddressEntry
),
ip_address
);
gchar
*
local_port
=
gtk_entry_get_text
(
GTK_ENTRY
(
localPortSpinBox
));
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
publishedPortSpinBox
),
g_ascii_strtod
(
local_port
,
NULL
));
gtk_widget_set_sensitive
(
publishedPortSpinBox
,
FALSE
);
gtk_widget_set_sensitive
(
publishedAddressEntry
,
FALSE
);
}
else
{
gtk_widget_set_sensitive
(
publishedPortSpinBox
,
TRUE
);
gtk_widget_set_sensitive
(
publishedAddressEntry
,
TRUE
);
}
}
GtkWidget
*
create_advanced_tab
(
account_t
**
a
)
{
GtkWidget
*
frame
;
GtkWidget
*
table
;
GtkWidget
*
label
;
GtkWidget
*
ret
;
GtkWidget
*
hbox
;
ret
=
gtk_vbox_new
(
FALSE
,
10
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
ret
),
10
);
account_t
*
currentAccount
;
currentAccount
=
*
a
;
gchar
*
resolve_once
=
NULL
;
gchar
*
account_expire
=
NULL
;
gchar
*
published_address
;
gchar
*
published_port
;
gchar
*
local_address
;
gchar
*
local_port
;
// Load from SIP/IAX/Unknown ?
if
(
currentAccount
)
{
resolve_once
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_RESOLVE_ONCE
);
account_expire
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_REGISTRATION_EXPIRE
);
local_port
=
g_hash_table_lookup
(
currentAccount
->
properties
,
LOCAL_PORT
);
local_address
=
g_hash_table_lookup
(
currentAccount
->
properties
,
LOCAL_ADDRESS
);
published_address
=
g_hash_table_lookup
(
currentAccount
->
properties
,
PUBLISHED_ADDRESS
);
published_port
=
g_hash_table_lookup
(
currentAccount
->
properties
,
PUBLISHED_PORT
);
}
gnome_main_section_new_with_table
(
_
(
"Registration"
),
&
frame
,
&
table
,
2
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
frame
,
FALSE
,
FALSE
,
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
table
),
10
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Registration _expire"
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
0
,
1
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
entryExpire
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
entryExpire
);
gtk_entry_set_text
(
GTK_ENTRY
(
entryExpire
),
account_expire
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
entryExpire
,
1
,
2
,
0
,
1
);
entryResolveNameOnlyOnce
=
gtk_check_button_new_with_mnemonic
(
_
(
"_Comply with RFC 3263"
));
gtk_toggle_button_set_active
(
GTK_TOGGLE_BUTTON
(
entryResolveNameOnlyOnce
),
g_strcasecmp
(
resolve_once
,
"false"
)
==
0
?
TRUE
:
FALSE
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
entryResolveNameOnlyOnce
,
0
,
2
,
1
,
2
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
entryResolveNameOnlyOnce
)
,
TRUE
);
gnome_main_section_new_with_table
(
_
(
"Network"
),
&
frame
,
&
table
,
2
,
3
);
gtk_box_pack_start
(
GTK_BOX
(
ret
),
frame
,
FALSE
,
FALSE
,
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
table
),
10
);
/**
* Retreive the list of IP interface from the
* the daemon and build the combo box.
*/
GtkListStore
*
ipInterfaceListStore
;
GtkTreeIter
iter
;
ipInterfaceListStore
=
gtk_list_store_new
(
1
,
G_TYPE_STRING
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Local address"
));
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
);
GtkTreeIter
current_local_address_iter
=
iter
;
gchar
**
iface_list
=
NULL
;
iface_list
=
dbus_get_all_ip_interface
();
gchar
**
iface
=
NULL
;
if
(
iface_list
!=
NULL
)
{
for
(
iface
=
iface_list
;
*
iface
;
iface
++
)
{
DEBUG
(
"Interface %s"
,
*
iface
);
gtk_list_store_append
(
ipInterfaceListStore
,
&
iter
);
gtk_list_store_set
(
ipInterfaceListStore
,
&
iter
,
0
,
*
iface
,
-
1
);
current_local_address_iter
=
iter
;
if
(
g_strcmp0
(
*
iface
,
local_address
)
==
0
)
{
DEBUG
(
"Setting active local address combo box"
);
current_local_address_iter
=
iter
;
}
}
}
localAddressCombo
=
gtk_combo_box_new_with_model
(
GTK_TREE_MODEL
(
ipInterfaceListStore
));
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
localAddressCombo
);
gtk_table_attach
(
GTK_TABLE
(
table
),
localAddressCombo
,
1
,
2
,
0
,
1
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
g_object_unref
(
G_OBJECT
(
ipInterfaceListStore
));
GtkCellRenderer
*
ipInterfaceCellRenderer
;
ipInterfaceCellRenderer
=
gtk_cell_renderer_text_new
();
gtk_cell_layout_pack_start
(
GTK_CELL_LAYOUT
(
localAddressCombo
),
ipInterfaceCellRenderer
,
TRUE
);
gtk_cell_layout_set_attributes
(
GTK_CELL_LAYOUT
(
localAddressCombo
),
ipInterfaceCellRenderer
,
"text"
,
0
,
NULL
);
gtk_combo_box_set_active_iter
(
GTK_COMBO_BOX
(
localAddressCombo
),
&
current_local_address_iter
);
/*label = gtk_label_new_with_mnemonic (_("Local address"));
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);
localAddressCombo = gtk_combo_box_new_text();
gtk_label_set_mnemonic_widget (GTK_LABEL(label), localAddressCombo);
gchar ** iface_list = NULL;
iface_list = dbus_get_all_ip_interface();
gchar ** iface = NULL;
if (iface_list != NULL) {
for (iface = iface_list; *iface; iface++)
{
DEBUG("Interface %s", *iface);
gtk_combo_box_append_text(GTK_COMBO_BOX(localAddressCombo), *iface);
}
g_strfreev (iface_list);
}
gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);*/
/**
* Local port
*/
label
=
gtk_label_new_with_mnemonic
(
_
(
"Local port"
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
1
,
2
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
localPortSpinBox
=
gtk_spin_button_new_with_range
(
1
,
65535
,
1
);
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
localPortSpinBox
);
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
localPortSpinBox
),
g_ascii_strtod
(
local_port
,
NULL
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
localPortSpinBox
,
1
,
2
,
1
,
2
);
sameAsLocalCheckBox
=
gtk_check_button_new_with_mnemonic
(
_
(
"Published address and port same as local"
));
g_signal_connect
(
sameAsLocalCheckBox
,
"toggled"
,
G_CALLBACK
(
same_as_local_cb
),
sameAsLocalCheckBox
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
sameAsLocalCheckBox
,
0
,
2
,
2
,
3
);
gtk_widget_set_sensitive
(
GTK_WIDGET
(
sameAsLocalCheckBox
),
TRUE
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Published address"
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
3
,
4
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
publishedAddressEntry
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
publishedAddressEntry
);
gtk_entry_set_text
(
GTK_ENTRY
(
publishedAddressEntry
),
published_address
);
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
publishedAddressEntry
,
1
,
2
,
3
,
4
);
label
=
gtk_label_new_with_mnemonic
(
_
(
"Published port"
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
label
,
0
,
1
,
4
,
5
);
gtk_misc_set_alignment
(
GTK_MISC
(
label
),
0
,
0
.
5
);
publishedPortSpinBox
=
gtk_spin_button_new_with_range
(
1
,
65535
,
1
);
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
publishedPortSpinBox
);
gtk_spin_button_set_value
(
GTK_SPIN_BUTTON
(
publishedPortSpinBox
),
g_ascii_strtod
(
published_port
,
NULL
));
gtk_table_attach_defaults
(
GTK_TABLE
(
table
),
publishedPortSpinBox
,
1
,
2
,
4
,
5
);
gtk_widget_show_all
(
ret
);
return
ret
;
}
static
GPtrArray
*
getNewCredential
(
GHashTable
*
properties
)
{
GtkTreeIter
iter
;
...
...
@@ -714,12 +863,17 @@ show_account_window (account_t * a)
tab
=
create_account_tab
(
&
currentAccount
);
gtk_notebook_append_page
(
GTK_NOTEBOOK
(
notebook
),
tab
,
gtk_label_new
(
_
(
"Basic"
)));
gtk_notebook_page_num
(
GTK_NOTEBOOK
(
notebook
),
tab
);
/* Advanced */
tab
=
create_advanced_tab
(
&
currentAccount
);
gtk_notebook_append_page
(
GTK_NOTEBOOK
(
notebook
),
tab
,
gtk_label_new
(
_
(
"Advanced"
)));
gtk_notebook_page_num
(
GTK_NOTEBOOK
(
notebook
),
tab
);
/* Security */
tab
=
create_security_tab
(
&
currentAccount
);
gtk_notebook_append_page
(
GTK_NOTEBOOK
(
notebook
),
tab
,
gtk_label_new
(
_
(
"Security"
)));
gtk_notebook_page_num
(
GTK_NOTEBOOK
(
notebook
),
tab
);
gtk_notebook_set_current_page
(
GTK_NOTEBOOK
(
notebook
)
,
0
);
response
=
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
...
...
sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml
View file @
b7bf6fea
...
...
@@ -388,5 +388,9 @@
<arg
type=
"a{ss}"
name=
"details"
direction=
"in"
/>
</method>
<method
name=
"getAllIpInterface"
>
<annotation
name=
"com.trolltech.QtDBus.QtTypeName.Out0"
value=
"VectorString"
/>
<arg
type=
"as"
name=
"list"
direction=
"out"
/>
</method>
</interface>
</node>
sflphone-client-gnome/src/dbus/dbus.c
View file @
b7bf6fea
...
...
@@ -2157,3 +2157,28 @@ void dbus_set_tls_settings (account_t *a)
g_error_free
(
error
);
}
}
gchar
**
dbus_get_all_ip_interface
(
void
)
{
GError
*
error
=
NULL
;
char
**
array
;
if
(
!
org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface
(
configurationManagerProxy
,
&
array
,
&
error
))
{
if
(
error
->
domain
==
DBUS_GERROR
&&
error
->
code
==
DBUS_GERROR_REMOTE_EXCEPTION
)
{
ERROR
(
"Caught remote method (get_all_ip_interface) exception %s: %s"
,
dbus_g_error_get_name
(
error
),
error
->
message
);
}
else
{
ERROR
(
"Error while calling get_all_ip_interface: %s"
,
error
->
message
);
}
g_error_free
(
error
);
return
NULL
;
}
else
{
DEBUG
(
"DBus called get_all_ip_interface() on ConfigurationManager"
);
return
array
;
}
}
sflphone-client-gnome/src/sflphone_const.h
View file @
b7bf6fea
...
...
@@ -82,6 +82,11 @@
#define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec"
#define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec"
#define LOCAL_PORT "Account.localPort"
#define LOCAL_ADDRESS "Account.localAddress"
#define PUBLISHED_PORT "Account.publishedPort"
#define PUBLISHED_ADDRESS "Account.publishedAddress"
/**
* Global logger
*/
...
...
sflphone-common/src/dbus/configurationmanager-introspec.xml
View file @
b7bf6fea
...
...
@@ -389,5 +389,11 @@
<arg
type=
"s"
name=
"accountID"
direction=
"in"
/>
<arg
type=
"a{ss}"
name=
"details"
direction=
"in"
/>
</method>
<method
name=
"getAllIpInterface"
>
<annotation
name=
"com.trolltech.QtDBus.QtTypeName.Out0"
value=
"VectorString"
/>
<arg
type=
"as"
name=
"list"
direction=
"out"
/>
</method>
</interface>
</node>
sflphone-common/src/dbus/configurationmanager.cpp
View file @
b7bf6fea
...
...
@@ -23,6 +23,7 @@
#include
<configurationmanager.h>
#include
<sstream>
#include
"../manager.h"
#include
"sip/sipvoiplink.h"
const
char
*
ConfigurationManager
::
SERVER_PATH
=
"/org/sflphone/SFLphone/ConfigurationManager"
;
...
...
@@ -752,3 +753,17 @@ void ConfigurationManager::setHistory (const std::map <std::string, std::string>
{
Manager
::
instance
().
receive_history_from_client
(
entries
);
}
std
::
vector
<
std
::
string
>
ConfigurationManager
::
getAllIpInterface
(
void
)
{
_debug
(
"ConfigurationManager::getAllIpInterface received
\n
"
);
std
::
vector
<
std
::
string
>
vector
;
SIPVoIPLink
*
sipLink
=
NULL
;
sipLink
=
SIPVoIPLink
::
instance
(
""
);
if
(
sipLink
!=
NULL
)
{
vector
=
sipLink
->
getAllIpInterface
();
}
return
vector
;
}
sflphone-common/src/dbus/configurationmanager.h
View file @
b7bf6fea
...
...
@@ -137,7 +137,8 @@ public:
std
::
map
<
std
::
string
,
std
::
string
>
getTlsSettings
(
const
std
::
string
&
accountID
);
void
setTlsSettings
(
const
std
::
string
&
accountID
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
details
);
std
::
vector
<
std
::
string
>
getAllIpInterface
(
void
);
};
...
...
sflphone-common/src/managerimpl.cpp
View file @
b7bf6fea
...
...
@@ -46,8 +46,8 @@
#include
<fstream>
#include
<sstream>
#include
<sys/types.h>
// mkdir(2)
#include
<sys/stat.h>
// mkdir(2)
#include
<pwd.h>
// getpwuid
#include
<sys/stat.h>
// mkdir(2)
#include
<pwd.h>
// getpwuid
#define fill_config_str(name, value) \
(_config.addConfigTreeItem(section, Conf::ConfigTreeItem(std::string(name), std::string(value), type_str)))
...
...
sflphone-common/src/sip/sipvoiplink.cpp
View file @
b7bf6fea
...
...
@@ -3273,4 +3273,26 @@ std::string fetch_header_value (pjsip_msg *msg, std::string field)
return
url
;
}
std
::
vector
<
std
::
string
>
SIPVoIPLink
::
getAllIpInterface
(
void
)
{
pj_sockaddr
addrList
[
16
];
unsigned
int
addrCnt
=
PJ_ARRAY_SIZE
(
addrList
);
pj_status_t
success
;
success
=
pj_enum_ip_interface
(
pj_AF_INET
(),
&
addrCnt
,
addrList
);
std
::
vector
<
std
::
string
>
ifaceList
;
if
(
success
!=
PJ_SUCCESS
)
{
return
ifaceList
;
}
_debug
(
"Detecting available interfaces...
\n
"
);
int
i
;
for
(
i
=
0
;
i
<
addrCnt
;
i
++
)
{
char
tmpAddr
[
PJ_INET_ADDRSTRLEN
];
pj_sockaddr_print
(
&
addrList
[
i
],
tmpAddr
,
sizeof
(
tmpAddr
),
0
);
ifaceList
.
push_back
(
std
::
string
(
tmpAddr
));
_debug
(
"Local interface %s
\n
"
,
tmpAddr
);
}
}
sflphone-common/src/sip/sipvoiplink.h
View file @
b7bf6fea
...
...
@@ -300,6 +300,16 @@ class SIPVoIPLink : public VoIPLink
std
::
string
get_useragent_name
(
void
);
/**
* List all the interfaces on the system and return
* a vector list containing their IPV4 address.
* @param void
* @return std::vector<std::string> A std::string vector
* of IPV4 address available on all of the interfaces on
* the system.
*/
std
::
vector
<
std
::
string
>
getAllIpInterface
(
void
);
private:
/**
* Constructor
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment