Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblinphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
liblinphone
Commits
88fe8d00
Commit
88fe8d00
authored
Jun 26, 2017
by
jehan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure IP encryption Engine API can be used without needing to include any private headers
parent
76472182
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
19 deletions
+42
-19
chat.c
coreapi/chat.c
+11
-0
im_encryption_engine.c
coreapi/im_encryption_engine.c
+2
-2
linphonecore.c
coreapi/linphonecore.c
+2
-1
private.h
coreapi/private.h
+0
-2
im_encryption_engine.h
include/linphone/im_encryption_engine.h
+13
-0
message_tester.c
tester/message_tester.c
+14
-14
No files found.
coreapi/chat.c
View file @
88fe8d00
...
...
@@ -1609,6 +1609,17 @@ const char *linphone_chat_message_get_text(const LinphoneChatMessage *msg) {
return
msg
->
message
;
}
int
linphone_chat_message_set_text
(
LinphoneChatMessage
*
msg
,
const
char
*
text
)
{
if
(
msg
->
message
)
ms_free
(
msg
->
message
);
if
(
text
)
msg
->
message
=
ms_strdup
(
text
);
else
msg
->
message
=
NULL
;
return
0
;
}
void
linphone_chat_message_add_custom_header
(
LinphoneChatMessage
*
msg
,
const
char
*
header_name
,
const
char
*
header_value
)
{
msg
->
custom_headers
=
sal_custom_header_append
(
msg
->
custom_headers
,
header_name
,
header_value
);
...
...
coreapi/im_encryption_engine.c
View file @
88fe8d00
...
...
@@ -66,10 +66,10 @@ void linphone_im_encryption_engine_cbs_set_user_data(LinphoneImEncryptionEngineC
cbs
->
user_data
=
data
;
}
LinphoneImEncryptionEngine
*
linphone_im_encryption_engine_new
(
LinphoneCore
*
lc
)
{
LinphoneImEncryptionEngine
*
linphone_im_encryption_engine_new
(
void
)
{
LinphoneImEncryptionEngine
*
imee
=
belle_sip_object_new
(
LinphoneImEncryptionEngine
);
belle_sip_object_ref
(
imee
);
imee
->
lc
=
lc
;
imee
->
lc
=
NULL
;
imee
->
callbacks
=
linphone_im_encryption_engine_cbs_new
();
return
imee
;
}
...
...
coreapi/linphonecore.c
View file @
88fe8d00
...
...
@@ -2410,7 +2410,7 @@ bool_t linphone_core_get_guess_hostname(LinphoneCore *lc){
}
void
linphone_core_enable_lime
(
LinphoneCore
*
lc
,
LinphoneLimeState
val
){
LinphoneImEncryptionEngine
*
imee
=
linphone_im_encryption_engine_new
(
lc
);
LinphoneImEncryptionEngine
*
imee
=
linphone_im_encryption_engine_new
();
LinphoneImEncryptionEngineCbs
*
cbs
=
linphone_im_encryption_engine_get_callbacks
(
imee
);
if
(
lime_is_available
()){
...
...
@@ -7259,6 +7259,7 @@ void linphone_core_set_im_encryption_engine(LinphoneCore *lc, LinphoneImEncrypti
lc
->
im_encryption_engine
=
NULL
;
}
if
(
imee
)
{
imee
->
lc
=
lc
;
lc
->
im_encryption_engine
=
linphone_im_encryption_engine_ref
(
imee
);
}
}
...
...
coreapi/private.h
View file @
88fe8d00
...
...
@@ -1753,8 +1753,6 @@ struct _LinphoneImEncryptionEngine {
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneImEncryptionEngine
);
LINPHONE_PUBLIC
LinphoneImEncryptionEngine
*
linphone_im_encryption_engine_new
(
LinphoneCore
*
lc
);
struct
_LinphoneRange
{
belle_sip_object_t
base
;
void
*
user_data
;
...
...
include/linphone/im_encryption_engine.h
View file @
88fe8d00
...
...
@@ -183,6 +183,19 @@ LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb linphone_
*/
LINPHONE_PUBLIC
void
linphone_im_encryption_engine_cbs_set_generate_file_transfer_key
(
LinphoneImEncryptionEngineCbs
*
cbs
,
LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb
cb
);
/** Set a chat message text to be sent by #linphone_chat_room_send_message
* @param[in] msg LinphoneChatMessage
* @param[in] text Const char *
* @returns 0 if succeed.
*/
LINPHONE_PUBLIC
int
linphone_chat_message_set_text
(
LinphoneChatMessage
*
msg
,
const
char
*
text
);
/**
* Create the IM encryption engine
* @return The created the IM encryption engine
*/
LINPHONE_PUBLIC
LinphoneImEncryptionEngine
*
linphone_im_encryption_engine_new
(
void
);
/**
* @}
*/
...
...
tester/message_tester.c
View file @
88fe8d00
...
...
@@ -2298,19 +2298,19 @@ void text_message_with_custom_content_type_and_lime(void) {
static
int
im_encryption_engine_process_incoming_message_cb
(
LinphoneImEncryptionEngine
*
engine
,
LinphoneChatRoom
*
room
,
LinphoneChatMessage
*
msg
)
{
if
(
msg
->
content_type
)
{
if
(
strcmp
(
msg
->
content_type
,
"cipher/b64"
)
==
0
)
{
if
(
linphone_chat_message_get_content_type
(
msg
)
)
{
if
(
strcmp
(
linphone_chat_message_get_content_type
(
msg
)
,
"cipher/b64"
)
==
0
)
{
size_t
b64Size
=
0
;
unsigned
char
*
output
;
bctbx_base64_decode
(
NULL
,
&
b64Size
,
(
unsigned
char
*
)
msg
->
message
,
strlen
(
msg
->
message
));
bctbx_base64_decode
(
NULL
,
&
b64Size
,
(
unsigned
char
*
)
linphone_chat_message_get_text
(
msg
),
strlen
(
linphone_chat_message_get_text
(
msg
)
));
output
=
(
unsigned
char
*
)
ms_malloc
(
b64Size
+
1
),
bctbx_base64_decode
(
output
,
&
b64Size
,
(
unsigned
char
*
)
msg
->
message
,
strlen
(
msg
->
message
));
ms_free
(
msg
->
message
);
bctbx_base64_decode
(
output
,
&
b64Size
,
(
unsigned
char
*
)
linphone_chat_message_get_text
(
msg
),
strlen
(
linphone_chat_message_get_text
(
msg
)));
output
[
b64Size
]
=
'\0'
;
msg
->
message
=
(
char
*
)
output
;
linphone_chat_message_set_text
(
msg
,
(
char
*
)
output
);
ms_free
(
output
);
linphone_chat_message_set_content_type
(
msg
,
"text/plain"
);
return
0
;
}
else
if
(
strcmp
(
msg
->
content_type
,
"text/plain"
)
==
0
)
{
}
else
if
(
strcmp
(
linphone_chat_message_get_content_type
(
msg
)
,
"text/plain"
)
==
0
)
{
return
-
1
;
// Not encrypted, nothing to do
}
else
{
return
488
;
// Not acceptable
...
...
@@ -2320,15 +2320,15 @@ static int im_encryption_engine_process_incoming_message_cb(LinphoneImEncryption
}
static
int
im_encryption_engine_process_outgoing_message_cb
(
LinphoneImEncryptionEngine
*
engine
,
LinphoneChatRoom
*
room
,
LinphoneChatMessage
*
msg
)
{
if
(
strcmp
(
msg
->
content_type
,
"text/plain"
)
==
0
)
{
if
(
strcmp
(
linphone_chat_message_get_content_type
(
msg
)
,
"text/plain"
)
==
0
)
{
size_t
b64Size
=
0
;
unsigned
char
*
output
;
bctbx_base64_encode
(
NULL
,
&
b64Size
,
(
unsigned
char
*
)
msg
->
message
,
strlen
(
msg
->
message
));
bctbx_base64_encode
(
NULL
,
&
b64Size
,
(
unsigned
char
*
)
linphone_chat_message_get_text
(
msg
),
strlen
(
linphone_chat_message_get_text
(
msg
)
));
output
=
(
unsigned
char
*
)
ms_malloc0
(
b64Size
+
1
),
bctbx_base64_encode
(
output
,
&
b64Size
,
(
unsigned
char
*
)
msg
->
message
,
strlen
(
msg
->
message
));
ms_free
(
msg
->
message
);
bctbx_base64_encode
(
output
,
&
b64Size
,
(
unsigned
char
*
)
linphone_chat_message_get_text
(
msg
),
strlen
(
linphone_chat_message_get_text
(
msg
)));
output
[
b64Size
]
=
'\0'
;
msg
->
message
=
(
char
*
)
output
;
linphone_chat_message_set_text
(
msg
,(
const
char
*
)
output
);
ms_free
(
output
);
linphone_chat_message_set_content_type
(
msg
,
"cipher/b64"
);
return
0
;
}
...
...
@@ -2339,10 +2339,10 @@ void im_encryption_engine_b64(void) {
LinphoneChatMessage
*
chat_msg
=
NULL
;
LinphoneChatRoom
*
chat_room
=
NULL
;
LinphoneCoreManager
*
marie
=
linphone_core_manager_new
(
"marie_rc"
);
LinphoneImEncryptionEngine
*
marie_imee
=
linphone_im_encryption_engine_new
(
marie
->
lc
);
LinphoneImEncryptionEngine
*
marie_imee
=
linphone_im_encryption_engine_new
();
LinphoneImEncryptionEngineCbs
*
marie_cbs
=
linphone_im_encryption_engine_get_callbacks
(
marie_imee
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_new
(
"pauline_tcp_rc"
);
LinphoneImEncryptionEngine
*
pauline_imee
=
linphone_im_encryption_engine_new
(
pauline
->
lc
);
LinphoneImEncryptionEngine
*
pauline_imee
=
linphone_im_encryption_engine_new
();
LinphoneImEncryptionEngineCbs
*
pauline_cbs
=
linphone_im_encryption_engine_get_callbacks
(
pauline_imee
);
linphone_im_encryption_engine_cbs_set_process_incoming_message
(
marie_cbs
,
im_encryption_engine_process_incoming_message_cb
);
...
...
Write
Preview
Markdown
is supported
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