Commit cebe1f10 authored by jehan's avatar jehan

start privacy impelmentation

parent c444c810
......@@ -1141,13 +1141,20 @@ void _linphone_call_params_copy(LinphoneCallParams *ncp, const LinphoneCallParam
if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers);
}
void linphone_call_params_enable_privacy(LinphoneCallParams *params, bool_t enable) {
params->privacy_enabled=enable;
void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacy privacy) {
params->privacy=privacy;
}
bool_t linphone_call_params_privacy_enabled(const LinphoneCallParams *params) {
return params->privacy_enabled;
LinphonePrivacy linphone_call_params_get_privacy(const LinphoneCallParams *params) {
return params->privacy;
}
const char* linphone_privacy_to_string(LinphonePrivacy privacy) {
switch(privacy) {
case LinphonePrivacyDefault: return "LinphonePrivacyDefault";
case LinphonePrivacyId: return "LinphonePrivacyId";
case LinphonePrivacyNone: return "LinphonePrivacyNone";
default: return "Unknown privacy mode";
}
}
/**
* Copy existing LinphoneCallParams to a new LinphoneCallParams object.
**/
......
......@@ -5888,6 +5888,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para
params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate;
params->media_encryption=linphone_core_get_media_encryption(lc);
params->in_conference=FALSE;
params->privacy=LinphonePrivacyNone;
}
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
......
......@@ -280,20 +280,43 @@ LINPHONE_PUBLIC void linphone_call_params_set_record_file(LinphoneCallParams *cp
LINPHONE_PUBLIC const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value);
LINPHONE_PUBLIC const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name);
/***
* @ingroup call_control
* Defines privacy policy to apply as described by rfc3325
* */
typedef enum _LinphonePrivacy {
/**
* Default privacy as defined either globally or by proxy using #linphone_proxy_config_set_privacy
*/
LinphonePrivacyDefault,
/**
* With this mode, "from" header is hidden, usually replaced by From: "Anonymous" <sip:anonymous@anonymous.invalid>
*/
LinphonePrivacyId,
/**
* No privacy action are taken
*/
LinphonePrivacyNone
} LinphonePrivacy;
/**
* @ingroup call_control
* @return string value of LinphonePrivacy enum
* */
const char* linphone_privacy_to_string(LinphonePrivacy privacy);
/**
* @ingroup call_control
* indicates if from must be replaced by anonymous value as described by rfc3325.
* Indicates if "from" must be replaced by anonymous value as described by rfc3325.
* @param params to be modified
* @param enable TRUE to enable privacy
* @param LinphonePrivacy to configure privacy
* */
LINPHONE_PUBLIC void linphone_call_params_enable_privacy(LinphoneCallParams *params, bool_t enable);
LINPHONE_PUBLIC void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacy privacy);
/**
* @ingroup call_control
* indicates if from must be replaced by anonymous value as described by rfc3325.
* indicates if "from" must be replaced by anonymous value as described by rfc3325.
* @param params object
* @return TRUE if privacy enabled
* @return Privacy mode
* */
LINPHONE_PUBLIC bool_t linphone_call_params_privacy_enabled(const LinphoneCallParams *params);
LINPHONE_PUBLIC LinphonePrivacy linphone_call_params_get_privacy(const LinphoneCallParams *params);
struct _LinphoneInfoMessage;
......
......@@ -74,6 +74,9 @@ extern "C" {
#endif
#endif
struct LinphoneParams {
};
struct _LinphoneCallParams{
LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */
int audio_bw; /* bandwidth limit for audio stream */
......@@ -91,7 +94,7 @@ struct _LinphoneCallParams{
bool_t in_conference; /*in conference mode */
bool_t pad;
bool_t low_bandwidth;
bool_t privacy_enabled;
LinphonePrivacy privacy;
};
struct _LinphoneCallLog{
......
......@@ -615,7 +615,7 @@ static void call_with_privacy(void) {
LinphoneCallParams *params;
params=linphone_core_create_default_call_parameters(pauline->lc);
linphone_call_params_enable_privacy(params,TRUE);
linphone_call_params_set_privacy(params,LinphonePrivacyId);
CU_ASSERT_TRUE(call_with_params(pauline,marie,params));
linphone_call_params_destroy(params);
......@@ -632,7 +632,7 @@ static void call_with_privacy(void) {
/*make sure remote identity is hidden*/
CU_ASSERT_FALSE(linphone_address_weak_equal(linphone_call_get_remote_address(c2),pauline->identity));
CU_ASSERT_TRUE(linphone_call_params_privacy_enabled(linphone_call_get_current_params(c2)));
CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment