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
1caa2d8d
Commit
1caa2d8d
authored
Aug 29, 2014
by
Ghislain MARY
Browse files
Add reference count handling to LinphoneCallLog objects.
parent
34c945f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
16 deletions
+58
-16
coreapi/call_log.c
coreapi/call_log.c
+28
-8
coreapi/call_log.h
coreapi/call_log.h
+20
-0
coreapi/private.h
coreapi/private.h
+10
-8
No files found.
coreapi/call_log.c
View file @
1caa2d8d
...
...
@@ -235,32 +235,38 @@ bool_t linphone_call_log_video_enabled(LinphoneCallLog *cl) {
* Reference and user data handling functions *
******************************************************************************/
void
*
linphone_call_log_get_user_data
(
const
LinphoneCallLog
*
cl
){
return
cl
->
user_
pointer
;
void
*
linphone_call_log_get_user_data
(
const
LinphoneCallLog
*
cl
)
{
return
cl
->
user_
data
;
}
void
linphone_call_log_set_user_data
(
LinphoneCallLog
*
cl
,
void
*
ud
){
cl
->
user_
pointer
=
ud
;
void
linphone_call_log_set_user_data
(
LinphoneCallLog
*
cl
,
void
*
ud
)
{
cl
->
user_
data
=
ud
;
}
LinphoneCallLog
*
linphone_call_log_ref
(
LinphoneCallLog
*
cl
)
{
belle_sip_object_ref
(
cl
);
return
cl
;
}
void
linphone_call_log_unref
(
LinphoneCallLog
*
cl
)
{
belle_sip_object_unref
(
cl
);
}
/*******************************************************************************
* Constructor and destructor functions *
******************************************************************************/
void
linphone_call_log_destroy
(
LinphoneCallLog
*
cl
){
static
void
_
linphone_call_log_destroy
(
LinphoneCallLog
*
cl
){
if
(
cl
->
from
!=
NULL
)
linphone_address_destroy
(
cl
->
from
);
if
(
cl
->
to
!=
NULL
)
linphone_address_destroy
(
cl
->
to
);
if
(
cl
->
refkey
!=
NULL
)
ms_free
(
cl
->
refkey
);
if
(
cl
->
call_id
)
ms_free
(
cl
->
call_id
);
if
(
cl
->
reporting
.
reports
[
LINPHONE_CALL_STATS_AUDIO
]
!=
NULL
)
linphone_reporting_destroy
(
cl
->
reporting
.
reports
[
LINPHONE_CALL_STATS_AUDIO
]);
if
(
cl
->
reporting
.
reports
[
LINPHONE_CALL_STATS_VIDEO
]
!=
NULL
)
linphone_reporting_destroy
(
cl
->
reporting
.
reports
[
LINPHONE_CALL_STATS_VIDEO
]);
ms_free
(
cl
);
}
LinphoneCallLog
*
linphone_call_log_new
(
LinphoneCall
*
call
,
LinphoneAddress
*
from
,
LinphoneAddress
*
to
){
LinphoneCallLog
*
cl
=
ms
_new
0
(
LinphoneCallLog
,
1
);
LinphoneCallLog
*
cl
=
belle_sip_object
_new
(
LinphoneCallLog
);
cl
->
dir
=
call
->
dir
;
cl
->
start_date_time
=
time
(
NULL
);
set_call_log_date
(
cl
,
cl
->
start_date_time
);
...
...
@@ -273,3 +279,17 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *fro
cl
->
reporting
.
reports
[
LINPHONE_CALL_STATS_VIDEO
]
=
linphone_reporting_new
();
return
cl
;
}
/* DEPRECATED */
void
linphone_call_log_destroy
(
LinphoneCallLog
*
cl
)
{
belle_sip_object_unref
(
cl
);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES
(
LinphoneCallLog
);
BELLE_SIP_INSTANCIATE_VPTR
(
LinphoneCallLog
,
belle_sip_object_t
,
(
belle_sip_object_destroy_t
)
linphone_call_log_destroy
,
NULL
,
// clone
NULL
,
// marshal
FALSE
);
coreapi/call_log.h
View file @
1caa2d8d
...
...
@@ -198,6 +198,19 @@ LINPHONE_PUBLIC void *linphone_call_log_get_user_data(const LinphoneCallLog *cl)
**/
LINPHONE_PUBLIC
void
linphone_call_log_set_user_data
(
LinphoneCallLog
*
cl
,
void
*
ud
);
/**
* Acquire a reference to the call log.
* @param[in] cl LinphoneCallLog object
* @return The same LinphoneCallLog object
**/
LINPHONE_PUBLIC
LinphoneCallLog
*
linphone_call_log_ref
(
LinphoneCallLog
*
cl
);
/**
* Release a reference to the call log.
* @param[in] cl LinphoneCallLog object
**/
LINPHONE_PUBLIC
void
linphone_call_log_unref
(
LinphoneCallLog
*
cl
);
/*******************************************************************************
* DEPRECATED *
...
...
@@ -215,6 +228,13 @@ LINPHONE_PUBLIC void linphone_call_log_set_user_data(LinphoneCallLog *cl, void *
/** @deprecated Use linphone_call_log_get_user_data() instead. */
#define linphone_call_log_get_user_pointer(cl) linphone_call_log_get_user_data(cl)
/**
* Destroy a LinphoneCallLog.
* @param cl LinphoneCallLog object
* @deprecated Use linphone_call_log_unref() instead.
*/
LINPHONE_PUBLIC
void
linphone_call_log_destroy
(
LinphoneCallLog
*
cl
);
/**
* @}
...
...
coreapi/private.h
View file @
1caa2d8d
...
...
@@ -111,6 +111,8 @@ struct _LinphoneQualityReporting{
};
struct
_LinphoneCallLog
{
belle_sip_object_t
base
;
void
*
user_data
;
struct
_LinphoneCore
*
lc
;
LinphoneCallDir
dir
;
/**< The direction of the call*/
LinphoneCallStatus
status
;
/**< The status of the call*/
...
...
@@ -119,18 +121,17 @@ struct _LinphoneCallLog{
char
start_date
[
128
];
/**<Human readable string containing the start date*/
int
duration
;
/**<Duration of the call in seconds*/
char
*
refkey
;
void
*
user_pointer
;
rtp_stats_t
local_stats
;
rtp_stats_t
remote_stats
;
float
quality
;
time_t
start_date_time
;
/**Start date of the call in seconds as expressed in a time_t */
char
*
call_id
;
/**unique id of a call*/
struct
_LinphoneQualityReporting
reporting
;
bool_t
video_enabled
;
};
BELLE_SIP_DECLARE_VPTR
(
LinphoneCallLog
);
typedef
struct
_CallCallbackObj
{
...
...
@@ -922,14 +923,15 @@ const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc);
*/
BELLE_SIP_DECLARE_TYPES_BEGIN
(
linphone
,
10000
)
BELLE_SIP_TYPE_ID
(
LinphoneContactSearch
),
BELLE_SIP_TYPE_ID
(
LinphoneContactProvider
),
BELLE_SIP_TYPE_ID
(
LinphoneLDAPContactProvider
),
BELLE_SIP_TYPE_ID
(
LinphoneLDAPContactSearch
),
BELLE_SIP_TYPE_ID
(
LinphoneContactSearch
),
BELLE_SIP_TYPE_ID
(
LinphoneCall
),
BELLE_SIP_TYPE_ID
(
LinphoneCallLog
),
BELLE_SIP_TYPE_ID
(
LinphoneChatMessage
),
BELLE_SIP_TYPE_ID
(
LinphoneChatRoom
),
BELLE_SIP_TYPE_ID
(
LinphoneProxyConfig
),
BELLE_SIP_TYPE_ID
(
LinphoneCall
)
BELLE_SIP_TYPE_ID
(
LinphoneLDAPContactProvider
),
BELLE_SIP_TYPE_ID
(
LinphoneLDAPContactSearch
),
BELLE_SIP_TYPE_ID
(
LinphoneProxyConfig
)
BELLE_SIP_DECLARE_TYPES_END
...
...
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