Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
1c3bcf0b
Commit
1c3bcf0b
authored
Sep 04, 2017
by
Ronan
Browse files
feat(core): big refactoring & full c address impl
parent
ca824433
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
471 additions
and
367 deletions
+471
-367
coreapi/CMakeLists.txt
coreapi/CMakeLists.txt
+0
-1
coreapi/address.c
coreapi/address.c
+0
-221
coreapi/bellesip_sal/sal_op_registration.c
coreapi/bellesip_sal/sal_op_registration.c
+1
-3
coreapi/chat.c
coreapi/chat.c
+3
-3
coreapi/factory.c
coreapi/factory.c
+6
-6
coreapi/help/doc/doxygen/CMakeLists.txt
coreapi/help/doc/doxygen/CMakeLists.txt
+33
-29
coreapi/help/doc/doxygen/Doxyfile.in
coreapi/help/doc/doxygen/Doxyfile.in
+1
-3
coreapi/linphonecall.c
coreapi/linphonecall.c
+11
-3
coreapi/linphonecore.c
coreapi/linphonecore.c
+8
-2
coreapi/private.h
coreapi/private.h
+5
-0
coreapi/proxy.c
coreapi/proxy.c
+32
-13
include/CMakeLists.txt
include/CMakeLists.txt
+71
-21
include/linphone/api/c-address.h
include/linphone/api/c-address.h
+242
-0
include/linphone/api/c-api.h
include/linphone/api/c-api.h
+6
-29
include/linphone/api/c-event-log.h
include/linphone/api/c-event-log.h
+2
-2
include/linphone/api/c-types.h
include/linphone/api/c-types.h
+44
-12
include/linphone/core.h
include/linphone/core.h
+2
-1
include/linphone/enums/event-log-enums.h
include/linphone/enums/event-log-enums.h
+1
-1
include/linphone/types.h
include/linphone/types.h
+2
-16
include/linphone/utils/enum-generator.h
include/linphone/utils/enum-generator.h
+1
-1
No files found.
coreapi/CMakeLists.txt
View file @
1c3bcf0b
...
...
@@ -53,7 +53,6 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES
set
(
LINPHONE_SOURCE_FILES_C
account_creator.c
account_creator_service.c
address.c
authentication.c
bellesip_sal/sal_address_impl.c
bellesip_sal/sal_impl.c
...
...
coreapi/address.c
deleted
100644 → 0
View file @
ca824433
/*
linphone
Copyright (C) 2009 Simon MORLAT (simon.morlat@linphone.org)
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#include "private.h"
LinphoneAddress
*
_linphone_address_new
(
const
char
*
addr
){
SalAddress
*
saddr
=
sal_address_new
(
addr
);
if
(
saddr
==
NULL
)
ms_error
(
"Cannot create LinphoneAddress, bad uri [%s]"
,
addr
);
return
saddr
;
}
LinphoneAddress
*
linphone_address_new
(
const
char
*
addr
)
{
return
_linphone_address_new
(
addr
);
}
LinphoneAddress
*
linphone_address_clone
(
const
LinphoneAddress
*
addr
){
return
sal_address_clone
(
addr
);
}
LinphoneAddress
*
linphone_address_ref
(
LinphoneAddress
*
addr
){
return
sal_address_ref
(
addr
);
}
void
linphone_address_unref
(
LinphoneAddress
*
addr
){
sal_address_unref
(
addr
);
}
const
char
*
linphone_address_get_scheme
(
const
LinphoneAddress
*
u
){
return
sal_address_get_scheme
(
u
);
}
const
char
*
linphone_address_get_display_name
(
const
LinphoneAddress
*
u
){
return
sal_address_get_display_name
(
u
);
}
const
char
*
linphone_address_get_username
(
const
LinphoneAddress
*
u
){
return
sal_address_get_username
(
u
);
}
const
char
*
linphone_address_get_domain
(
const
LinphoneAddress
*
u
){
return
sal_address_get_domain
(
u
);
}
int
linphone_address_get_port
(
const
LinphoneAddress
*
u
)
{
return
sal_address_get_port
(
u
);
}
LinphoneStatus
linphone_address_set_display_name
(
LinphoneAddress
*
u
,
const
char
*
display_name
){
sal_address_set_display_name
(
u
,
display_name
);
return
0
;
}
LinphoneStatus
linphone_address_set_username
(
LinphoneAddress
*
uri
,
const
char
*
username
)
{
sal_address_set_username
(
uri
,
username
);
return
0
;
}
LinphoneStatus
linphone_address_set_domain
(
LinphoneAddress
*
uri
,
const
char
*
host
){
sal_address_set_domain
(
uri
,
host
);
return
0
;
}
LinphoneStatus
linphone_address_set_port
(
LinphoneAddress
*
uri
,
int
port
){
sal_address_set_port
(
uri
,
port
);
return
0
;
}
LinphoneStatus
linphone_address_set_transport
(
LinphoneAddress
*
uri
,
LinphoneTransportType
tp
){
sal_address_set_transport
(
uri
,(
SalTransport
)
tp
);
return
0
;
}
LinphoneTransportType
linphone_address_get_transport
(
const
LinphoneAddress
*
uri
){
return
(
LinphoneTransportType
)
sal_address_get_transport
(
uri
);
}
void
linphone_address_set_method_param
(
LinphoneAddress
*
addr
,
const
char
*
method
)
{
sal_address_set_method_param
(
addr
,
method
);
}
const
char
*
linphone_address_get_method_param
(
const
LinphoneAddress
*
addr
)
{
return
sal_address_get_method_param
(
addr
);
}
void
linphone_address_clean
(
LinphoneAddress
*
uri
){
sal_address_clean
(
uri
);
}
char
*
linphone_address_as_string
(
const
LinphoneAddress
*
u
){
return
sal_address_as_string
(
u
);
}
char
*
linphone_address_as_string_uri_only
(
const
LinphoneAddress
*
u
){
return
sal_address_as_string_uri_only
(
u
);
}
bool_t
linphone_address_is_secure
(
const
LinphoneAddress
*
uri
){
return
sal_address_is_secure
(
uri
);
}
bool_t
linphone_address_get_secure
(
const
LinphoneAddress
*
uri
){
return
sal_address_is_secure
(
uri
);
}
void
linphone_address_set_secure
(
LinphoneAddress
*
addr
,
bool_t
enabled
){
sal_address_set_secure
(
addr
,
enabled
);
}
bool_t
linphone_address_is_sip
(
const
LinphoneAddress
*
uri
){
return
sal_address_is_sip
(
uri
);
}
static
bool_t
strings_equals
(
const
char
*
s1
,
const
char
*
s2
){
if
(
s1
==
NULL
&&
s2
==
NULL
)
return
TRUE
;
if
(
s1
!=
NULL
&&
s2
!=
NULL
&&
strcmp
(
s1
,
s2
)
==
0
)
return
TRUE
;
return
FALSE
;
}
bool_t
linphone_address_weak_equal
(
const
LinphoneAddress
*
a1
,
const
LinphoneAddress
*
a2
){
const
char
*
u1
,
*
u2
;
const
char
*
h1
,
*
h2
;
int
p1
,
p2
;
u1
=
linphone_address_get_username
(
a1
);
u2
=
linphone_address_get_username
(
a2
);
p1
=
linphone_address_get_port
(
a1
);
p2
=
linphone_address_get_port
(
a2
);
h1
=
linphone_address_get_domain
(
a1
);
h2
=
linphone_address_get_domain
(
a2
);
return
strings_equals
(
u1
,
u2
)
&&
strings_equals
(
h1
,
h2
)
&&
p1
==
p2
;
}
bool_t
linphone_address_equal
(
const
LinphoneAddress
*
a1
,
const
LinphoneAddress
*
a2
)
{
char
*
s1
;
char
*
s2
;
bool_t
res
;
if
((
a1
==
NULL
)
&&
(
a2
==
NULL
))
return
TRUE
;
if
((
a1
==
NULL
)
||
(
a2
==
NULL
))
return
FALSE
;
s1
=
linphone_address_as_string
(
a1
);
s2
=
linphone_address_as_string
(
a2
);
res
=
(
strcmp
(
s1
,
s2
)
==
0
)
?
TRUE
:
FALSE
;
ms_free
(
s1
);
ms_free
(
s2
);
return
res
;
}
void
linphone_address_destroy
(
LinphoneAddress
*
u
){
linphone_address_unref
(
u
);
}
void
linphone_address_set_password
(
LinphoneAddress
*
addr
,
const
char
*
passwd
){
sal_address_set_password
(
addr
,
passwd
);
}
const
char
*
linphone_address_get_password
(
const
LinphoneAddress
*
addr
){
return
sal_address_get_password
(
addr
);
}
void
linphone_address_set_header
(
LinphoneAddress
*
addr
,
const
char
*
header_name
,
const
char
*
header_value
){
sal_address_set_header
(
addr
,
header_name
,
header_value
);
}
const
char
*
linphone_address_get_header
(
const
LinphoneAddress
*
addr
,
const
char
*
name
){
return
sal_address_get_header
(
addr
,
name
);
}
bool_t
linphone_address_has_param
(
const
LinphoneAddress
*
addr
,
const
char
*
name
)
{
return
sal_address_has_param
(
addr
,
name
);
}
const
char
*
linphone_address_get_param
(
const
LinphoneAddress
*
addr
,
const
char
*
name
)
{
return
sal_address_get_param
(
addr
,
name
);
}
void
linphone_address_set_param
(
LinphoneAddress
*
addr
,
const
char
*
name
,
const
char
*
value
)
{
sal_address_set_param
(
addr
,
name
,
value
);
}
void
linphone_address_set_params
(
LinphoneAddress
*
addr
,
const
char
*
params
)
{
sal_address_set_params
(
addr
,
params
);
}
void
linphone_address_set_uri_param
(
LinphoneAddress
*
addr
,
const
char
*
name
,
const
char
*
value
)
{
sal_address_set_uri_param
(
addr
,
name
,
value
);
}
void
linphone_address_set_uri_params
(
LinphoneAddress
*
addr
,
const
char
*
params
)
{
sal_address_set_uri_params
(
addr
,
params
);
}
bool_t
linphone_address_has_uri_param
(
const
LinphoneAddress
*
addr
,
const
char
*
name
)
{
return
sal_address_has_uri_param
(
addr
,
name
);
}
const
char
*
linphone_address_get_uri_param
(
const
LinphoneAddress
*
addr
,
const
char
*
name
)
{
return
sal_address_get_uri_param
(
addr
,
name
);
}
LinphoneAddress
*
linphone_core_create_address
(
LinphoneCore
*
lc
,
const
char
*
address
)
{
return
linphone_address_new
(
address
);
}
/** @} */
coreapi/bellesip_sal/sal_op_registration.c
View file @
1c3bcf0b
...
...
@@ -84,7 +84,7 @@ static void register_refresher_listener (belle_sip_refresher_t* refresher
}
}
int
sal_register
(
SalOp
*
op
,
const
char
*
proxy
,
const
char
*
from
,
int
expires
,
SalAddress
*
old_contact
){
int
sal_register
(
SalOp
*
op
,
const
char
*
proxy
,
const
char
*
from
,
int
expires
,
const
SalAddress
*
old_contact
){
belle_sip_request_t
*
req
;
belle_sip_uri_t
*
req_uri
;
belle_sip_header_t
*
accept_header
;
...
...
@@ -135,5 +135,3 @@ int sal_register_refresh(SalOp *op, int expires){
int
sal_unregister
(
SalOp
*
op
){
return
sal_register_refresh
(
op
,
0
);
}
coreapi/chat.c
View file @
1c3bcf0b
...
...
@@ -26,6 +26,8 @@
#include <libxml/tree.h>
#include <libxml/xmlwriter.h>
#include <linphone/utils/utils.h>
#include "linphone/core.h"
#include "private.h"
#include "linphone/lpconfig.h"
...
...
@@ -33,12 +35,10 @@
#include "ortp/b64.h"
#include "linphone/wrapper_utils.h"
#include "c-wrapper/
wrapper
.h"
#include "c-wrapper/
c-tools
.h"
#include "chat/chat-room-p.h"
#include "chat/chat-room.h"
#include "utils/content-type.h"
#include "utils/utils.h"
struct
_LinphoneChatRoom
{
belle_sip_object_t
base
;
...
...
coreapi/factory.c
View file @
1c3bcf0b
...
...
@@ -48,7 +48,7 @@ struct _LinphoneFactory {
char
*
ring_resources_dir
;
char
*
image_resources_dir
;
char
*
msplugins_dir
;
/*these are the cached result computed from directories set by the application*/
char
*
cached_data_resources_dir
;
char
*
cached_sound_resources_dir
;
...
...
@@ -67,7 +67,7 @@ static void linphone_factory_uninit(LinphoneFactory *obj){
STRING_RESET
(
obj
->
ring_resources_dir
);
STRING_RESET
(
obj
->
image_resources_dir
);
STRING_RESET
(
obj
->
msplugins_dir
);
STRING_RESET
(
obj
->
cached_data_resources_dir
);
STRING_RESET
(
obj
->
cached_sound_resources_dir
);
STRING_RESET
(
obj
->
cached_ring_resources_dir
);
...
...
@@ -163,7 +163,7 @@ LinphoneCoreCbs *linphone_factory_create_core_cbs(const LinphoneFactory *factory
}
LinphoneAddress
*
linphone_factory_create_address
(
const
LinphoneFactory
*
factory
,
const
char
*
addr
)
{
return
_
linphone_address_new
(
addr
);
return
linphone_address_new
(
addr
);
}
LinphoneAuthInfo
*
linphone_factory_create_auth_info
(
const
LinphoneFactory
*
factory
,
const
char
*
username
,
const
char
*
userid
,
const
char
*
passwd
,
const
char
*
ha1
,
const
char
*
realm
,
const
char
*
domain
)
{
...
...
@@ -303,9 +303,9 @@ void linphone_factory_set_msplugins_dir(LinphoneFactory *factory, const char *pa
}
LinphoneErrorInfo
*
linphone_factory_create_error_info
(
LinphoneFactory
*
factory
){
return
linphone_error_info_new
();
}
LinphoneRange
*
linphone_factory_create_range
(
LinphoneFactory
*
factory
)
{
...
...
@@ -318,4 +318,4 @@ LinphoneTransports *linphone_factory_create_transports(LinphoneFactory *factory)
LinphoneVideoActivationPolicy
*
linphone_factory_create_video_activation_policy
(
LinphoneFactory
*
factory
)
{
return
linphone_video_activation_policy_new
();
}
\ No newline at end of file
}
coreapi/help/doc/doxygen/CMakeLists.txt
View file @
1c3bcf0b
############################################################################
############################################################################
####
# CMakeLists.txt
# Copyright (C) 2017 Belledonne Communications, Grenoble France
#
############################################################################
############################################################################
####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
...
...
@@ -18,32 +18,36 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
############################################################################
####
if
(
ENABLE_DOC OR ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER
)
find_package
(
Doxygen
)
if
(
DOXYGEN_FOUND
)
if
(
DOXYGEN_DOT_FOUND
)
set
(
top_srcdir
"
${
PROJECT_SOURCE_DIR
}
"
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/Doxyfile.in
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
)
set
(
DOC_INPUT_FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
${
CMAKE_CURRENT_SOURCE_DIR
}
/doxygen.dox
${
LINPHONE_HEADER_FILES
}
)
add_custom_command
(
OUTPUT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html/index.html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml/index.xml"
COMMAND
${
DOXYGEN_EXECUTABLE
}
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
DEPENDS
${
DOC_INPUT_FILES
}
)
add_custom_target
(
linphone-doc ALL DEPENDS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html/index.html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml/index.xml"
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml"
DESTINATION
"
${
CMAKE_INSTALL_DATADIR
}
/doc/linphone-
${
LINPHONE_VERSION
}
"
)
else
()
if
(
ENABLE_CXX_WRAPPER
)
message
(
FATAL_ERROR
"The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/."
)
else
()
message
(
WARNING
"The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/."
)
endif
()
endif
()
endif
()
endif
()
find_package
(
Doxygen
)
if
(
DOXYGEN_FOUND
)
if
(
DOXYGEN_DOT_FOUND
)
set
(
DOC_INPUT_FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
${
CMAKE_CURRENT_SOURCE_DIR
}
/doxygen.dox
${
LINPHONE_HEADER_FILES
}
)
set
(
DOXYGEN_INPUT
""
)
foreach
(
HEADER_FILE
${
LINPHONE_HEADER_FILES
}
)
string
(
CONCAT DOXYGEN_INPUT
${
DOXYGEN_INPUT
}
"
\"
${
HEADER_FILE
}
\"
"
)
endforeach
()
string
(
CONCAT DOXYGEN_INPUT
${
DOXYGEN_INPUT
}
"
\"
${
CMAKE_CURRENT_SOURCE_DIR
}
\"
"
)
string
(
CONCAT DOXYGEN_INPUT
${
DOXYGEN_INPUT
}
"
\"
${
PROJECT_SOURCE_DIR
}
/coreapi/help/examples/C
\"
"
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/Doxyfile.in
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
)
add_custom_command
(
OUTPUT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html/index.html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml/index.xml"
COMMAND
${
DOXYGEN_EXECUTABLE
}
${
CMAKE_CURRENT_BINARY_DIR
}
/Doxyfile
DEPENDS
${
DOC_INPUT_FILES
}
)
add_custom_target
(
linphone-doc ALL DEPENDS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html/index.html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml/index.xml"
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/html"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/xml"
DESTINATION
"
${
CMAKE_INSTALL_DATADIR
}
/doc/linphone-
${
LINPHONE_VERSION
}
"
)
else
()
if
(
ENABLE_CXX_WRAPPER
)
message
(
FATAL_ERROR
"The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/."
)
else
()
message
(
WARNING
"The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/."
)
endif
()
endif
()
endif
()
endif
()
coreapi/help/doc/doxygen/Doxyfile.in
View file @
1c3bcf0b
...
...
@@ -772,9 +772,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = @top_srcdir@/include/linphone \
@top_srcdir@/coreapi/help/doc/doxygen \
@top_srcdir@/coreapi/help/examples/C
INPUT = @DOXYGEN_INPUT@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
...
...
coreapi/linphonecall.c
View file @
1c3bcf0b
...
...
@@ -43,6 +43,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <bctoolbox/defs.h>
// For migration purpose.
#include "address/address-p.h"
#include "c-wrapper/c-tools.h"
inline
OrtpRtcpXrStatSummaryFlag
operator
|
(
OrtpRtcpXrStatSummaryFlag
a
,
OrtpRtcpXrStatSummaryFlag
b
)
{
return
static_cast
<
OrtpRtcpXrStatSummaryFlag
>
(
static_cast
<
int
>
(
a
)
|
static_cast
<
int
>
(
b
));
...
...
@@ -1199,7 +1202,7 @@ void linphone_call_create_op(LinphoneCall *call){
**/
static
void
linphone_call_outgoing_select_ip_version
(
LinphoneCall
*
call
,
LinphoneAddress
*
to
,
LinphoneProxyConfig
*
cfg
){
if
(
linphone_core_ipv6_enabled
(
call
->
core
)){
if
(
sal_address_is_ipv6
(
(
S
alAddress
*
)
to
)){
if
(
sal_address_is_ipv6
(
L_GET_PRIVATE_FROM_C_STRUCT
(
to
,
Address
)
->
getIntern
alAddress
()
))
{
call
->
af
=
AF_INET6
;
}
else
if
(
cfg
&&
cfg
->
op
){
call
->
af
=
sal_op_get_address_family
(
cfg
->
op
);
...
...
@@ -4986,14 +4989,19 @@ static LinphoneAddress *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call ,
/* if already choosed, don't change it */
return
NULL
;
}
else
if
(
call
->
ping_op
&&
sal_op_get_contact_address
(
call
->
ping_op
))
{
char
*
addr
=
sal_address_as_string
(
sal_op_get_contact_address
(
call
->
ping_op
));
/* if the ping OPTIONS request succeeded use the contact guessed from the
received, rport*/
ms_message
(
"Contact has been fixed using OPTIONS"
/* to %s",guessed*/
);
ret
=
linphone_address_clone
(
sal_op_get_contact_address
(
call
->
ping_op
));;
ret
=
linphone_address_new
(
addr
);
ms_free
(
addr
);
}
else
if
(
dest_proxy
&&
dest_proxy
->
op
&&
sal_op_get_contact_address
(
dest_proxy
->
op
)){
char
*
addr
=
sal_address_as_string
(
sal_op_get_contact_address
(
dest_proxy
->
op
));
/*if using a proxy, use the contact address as guessed with the REGISTERs*/
ms_message
(
"Contact has been fixed using proxy"
/*to %s",fixed_contact*/
);
ret
=
linphone_address_clone
(
sal_op_get_contact_address
(
dest_proxy
->
op
));
ret
=
linphone_address_new
(
addr
);
ms_free
(
addr
);
}
else
{
ctt
=
linphone_core_get_primary_contact_parsed
(
lc
);
if
(
ctt
!=
NULL
){
...
...
coreapi/linphonecore.c
View file @
1c3bcf0b
...
...
@@ -3410,7 +3410,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
/*return default proxy if it is matching the destination uri*/
if
(
default_cfg
){
const
char
*
domain
=
linphone_proxy_config_get_domain
(
default_cfg
);
if
(
strcmp
(
domain
,
linphone_address_get_domain
(
uri
))
==
0
){
if
(
domain
&&
!
strcmp
(
domain
,
linphone_address_get_domain
(
uri
))){
found_cfg
=
default_cfg
;
goto
end
;
}
...
...
@@ -3502,7 +3502,9 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
routes
=
make_routes_for_proxy
(
proxy
,
dest
);
linphone_transfer_routes_to_op
(
routes
,
op
);
}
sal_op_set_to_address
(
op
,
dest
);
char
*
addr
=
linphone_address_as_string
(
dest
);
sal_op_set_to
(
op
,
addr
);
ms_free
(
addr
);
sal_op_set_from
(
op
,
identity
);
sal_op_set_sent_custom_header
(
op
,
headers
);
sal_op_set_realm
(
op
,
linphone_proxy_config_get_realm
(
proxy
));
...
...
@@ -6037,6 +6039,10 @@ LinphoneConfig * linphone_core_create_config(LinphoneCore *lc, const char *filen
return
lp_config_new
(
filename
);
}
LinphoneAddress
*
linphone_core_create_address
(
LinphoneCore
*
lc
,
const
char
*
address
)
{
return
linphone_address_new
(
address
);
}
static
void
linphone_core_uninit
(
LinphoneCore
*
lc
)
{
bctbx_list_t
*
elem
=
NULL
;
...
...
coreapi/private.h
View file @
1c3bcf0b
...
...
@@ -721,6 +721,10 @@ struct _LinphoneProxyConfig
char
*
refkey
;
char
*
sip_etag
;
/*publish context*/
// For migration purpose. (Do not use directly!)
// Cache.
LinphoneAddress
*
contact_address
;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneProxyConfig
);
...
...
@@ -1824,6 +1828,7 @@ BELLE_SIP_DECLARE_TYPES_BEGIN(linphone,10000)
BELLE_SIP_TYPE_ID
(
LinphoneAccountCreator
),
BELLE_SIP_TYPE_ID
(
LinphoneAccountCreatorCbs
),
BELLE_SIP_TYPE_ID
(
LinphoneAccountCreatorService
),
BELLE_SIP_TYPE_ID
(
LinphoneAddress
),
BELLE_SIP_TYPE_ID
(
LinphoneBuffer
),
BELLE_SIP_TYPE_ID
(
LinphoneContactProvider
),
BELLE_SIP_TYPE_ID
(
LinphoneContactSearch
),
...
...
coreapi/proxy.c
View file @
1c3bcf0b
...
...
@@ -18,14 +18,20 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone/core.h"
#include <ctype.h>
#include "linphone/core_utils.h"
#include "linphone/
sipsetup
.h"
#include "linphone/
core
.h"
#include "linphone/lpconfig.h"
#include "
private
.h"
#include "
linphone/sipsetup
.h"
#include "mediastreamer2/mediastream.h"
#include "enum.h"
#include <ctype.h>
#include "private.h"
// For migration purpose.
#include "address/address-p.h"
#include "c-wrapper/c-tools.h"
/*store current config related to server location*/
static
void
linphone_proxy_config_store_server_config
(
LinphoneProxyConfig
*
cfg
)
{
...
...
@@ -422,7 +428,7 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig * cfg){
linphone_event_unref
(
cfg
->
presence_publish_event
);
/*probably useless as cfg->long_term_event is already unref in linphone_proxy_config_notify_publish_state_changed. To be check with Ghislain*/
cfg
->
presence_publish_event
=
NULL
;
}
}
if
(
cfg
->
op
){
sal_op_release
(
cfg
->
op
);
...
...
@@ -446,10 +452,10 @@ LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *cfg){
if
(
cfg
->
contact_params
)
{
// We want to add a list of contacts params to the linphone address
sal
_address_set_params
(
contact
,
cfg
->
contact_params
);
linphone
_address_set_params
(
contact
,
cfg
->
contact_params
);
}
if
(
cfg
->
contact_uri_params
){
sal
_address_set_uri_params
(
contact
,
cfg
->
contact_uri_params
);
linphone
_address_set_uri_params
(
contact
,
cfg
->
contact_uri_params
);
}
#ifdef BUILD_UPNP
if
(
cfg
->
lc
->
upnp
!=
NULL
&&
linphone_core_get_firewall_policy
(
cfg
->
lc
)
==
LinphonePolicyUseUpnp
&&
...
...
@@ -491,14 +497,19 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
linphone_configure_op
(
cfg
->
lc
,
cfg
->
op
,
cfg
->
identity_address
,
cfg
->
sent_headers
,
FALSE
);
if
((
contact
=
guess_contact_for_register
(
cfg
)))
{
sal_op_set_contact_address
(
cfg
->
op
,
contact
);
sal_op_set_contact_address
(
cfg
->
op
,
L_GET_PRIVATE_FROM_C_STRUCT
(
contact
,
Address
)
->
getInternalAddress
()
);
linphone_address_unref
(
contact
);
}
sal_op_set_user_pointer
(
cfg
->
op
,
cfg
);
if
(
sal_register
(
cfg
->
op
,
proxy_string
,
cfg
->
reg_identity
,
cfg
->
expires
,
cfg
->
pending_contact
)
==
0
)
{
if
(
sal_register
(
cfg
->
op
,
proxy_string
,
cfg
->
reg_identity
,
cfg
->
expires
,
cfg
->
pending_contact
?
L_GET_PRIVATE_FROM_C_STRUCT
(
cfg
->
pending_contact
,
Address
)
->
getInternalAddress
()
:
NULL
)
==
0
)
{
if
(
cfg
->
pending_contact
)
{
linphone_address_unref
(
cfg
->
pending_contact
);
cfg
->
pending_contact
=
NULL
;
...
...
@@ -879,7 +890,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePrese
}
linphone_presence_model_set_presentity
(
presence
,
linphone_proxy_config_get_identity_address
(
proxy
));
linphone_presence_model_set_contact
(
presence
,
NULL
);
/*it will be automatically computed*/
}
if
(
!
(
presence_body
=
linphone_presence_model_to_xml
(
presence
)))
{
ms_error
(
"Cannot publish presence model [%p] for proxy config [%p] because of xml serialization error"
,
presence
,
proxy
);
...
...
@@ -906,7 +917,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePrese
linphone_presence_model_set_contact
(
presence
,
contact
);
bctbx_free
(
contact
);
}
}
else
proxy
->
send_publish
=
TRUE
;
/*otherwise do not send publish if registration is in progress, this will be done later*/
return
err
;
}
...
...
@@ -1450,7 +1461,15 @@ uint8_t linphone_proxy_config_get_avpf_rr_interval(const LinphoneProxyConfig *cf
}
const
LinphoneAddress
*
linphone_proxy_config_get_contact
(
const
LinphoneProxyConfig
*
cfg
)
{
return
sal_op_get_contact_address
(
cfg
->
op
);
// Workaround for wrapping.
if
(
cfg
->
contact_address
)
linphone_address_unref
(
cfg
->
contact_address
);
char
*
buf
=
sal_address_as_string
(
sal_op_get_contact_address
(
cfg
->
op
));
const_cast
<
LinphoneProxyConfig
*>
(
cfg
)
->
contact_address
=
linphone_address_new
(
buf
);
ms_free
(
buf
);
return
cfg
->
contact_address
;
}
const
struct
_LinphoneAuthInfo
*
linphone_proxy_config_find_auth_info
(
const
LinphoneProxyConfig
*
cfg
)
{
...
...
include/CMakeLists.txt
View file @
1c3bcf0b
############################################################################
############################################################################
####
# CMakeLists.txt
# Copyright (C) 201
0-2016
Belledonne Communications, Grenoble France
# Copyright (C) 201
7
Belledonne Communications, Grenoble France
#
############################################################################
############################################################################
####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
...
...
@@ -18,25 +18,24 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#