Commit be66a259 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Deprecated LinphoneIntRange, replaced by LinphoneRange

parent 47485efe
......@@ -216,3 +216,7 @@ LinphoneErrorInfo *linphone_factory_create_error_info(LinphoneFactory *factory){
return linphone_error_info_new();
}
LinphoneRange *linphone_factory_create_range(LinphoneFactory *factory) {
return linphone_range_new();
}
\ No newline at end of file
......@@ -2531,6 +2531,13 @@ LinphoneIntRange linphone_core_get_audio_port_range_2(const LinphoneCore *lc) {
return range;
}
LinphoneRange *linphone_core_get_audio_ports_range(const LinphoneCore *lc) {
LinphoneRange *range = linphone_range_new();
range->min = lc->rtp_conf.audio_rtp_min_port;
range->max = lc->rtp_conf.audio_rtp_max_port;
return range;
}
int linphone_core_get_video_port(const LinphoneCore *lc){
return lc->rtp_conf.video_rtp_min_port;
}
......@@ -2548,6 +2555,13 @@ LinphoneIntRange linphone_core_get_video_port_range_2(const LinphoneCore *lc) {
return range;
}
LinphoneRange *linphone_core_get_video_ports_range(const LinphoneCore *lc) {
LinphoneRange *range = linphone_range_new();
range->min = lc->rtp_conf.video_rtp_min_port;
range->max = lc->rtp_conf.video_rtp_max_port;
return range;
}
int linphone_core_get_text_port(const LinphoneCore *lc) {
return lc->rtp_conf.text_rtp_min_port;
}
......@@ -2565,6 +2579,13 @@ LinphoneIntRange linphone_core_get_text_port_range_2(const LinphoneCore *lc) {
return range;
}
LinphoneRange *linphone_core_get_text_ports_range(const LinphoneCore *lc) {
LinphoneRange *range = linphone_range_new();
range->min = lc->rtp_conf.text_rtp_min_port;
range->max = lc->rtp_conf.text_rtp_max_port;
return range;
}
int linphone_core_get_nortp_timeout(const LinphoneCore *lc){
return lc->rtp_conf.nortp_timeout;
}
......
......@@ -1780,26 +1780,6 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
}
/* Functions to mainpulate the LinphoneIntRange structure */
int linphone_int_range_get_min(const LinphoneIntRange *range) {
return range->min;
}
int linphone_int_range_get_max(const LinphoneIntRange *range) {
return range->max;
}
void linphone_int_range_set_min(LinphoneIntRange *range, int min) {
range->min = min;
}
void linphone_int_range_set_max(LinphoneIntRange *range, int max) {
range->max = max;
}
void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log){
bool_t call_logs_sqlite_db_found = FALSE;
......@@ -1835,4 +1815,42 @@ void linphone_core_report_early_failed_call(LinphoneCore *lc, LinphoneCallDir di
linphone_call_log_unref(l);
}
/* Functions to mainpulate the LinphoneRange structure */
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneRange);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneRange, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
LinphoneRange *linphone_range_new() {
LinphoneRange *range = belle_sip_object_new(LinphoneRange);
return range;
}
LinphoneRange* linphone_range_ref (LinphoneRange* range) {
return (LinphoneRange*) belle_sip_object_ref(range);
}
void linphone_range_unref (LinphoneRange* range) {
belle_sip_object_unref(range);
}
int linphone_range_get_min(const LinphoneRange *range) {
return range->min;
}
int linphone_range_get_max(const LinphoneRange *range) {
return range->max;
}
void linphone_range_set_min(LinphoneRange *range, int min) {
range->min = min;
}
void linphone_range_set_max(LinphoneRange *range, int max) {
range->max = max;
}
\ No newline at end of file
......@@ -1722,6 +1722,17 @@ 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;
int min;
int max;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneRange);
LinphoneRange *linphone_range_new(void);
/** Belle Sip-based objects need unique ids
*/
......@@ -1771,7 +1782,8 @@ BELLE_SIP_TYPE_ID(LinphoneErrorInfo),
BELLE_SIP_TYPE_ID(LinphoneConferenceParams),
BELLE_SIP_TYPE_ID(LinphoneConference),
BELLE_SIP_TYPE_ID(LinphoneInfoMessage),
BELLE_SIP_TYPE_ID(LinphonePayloadType)
BELLE_SIP_TYPE_ID(LinphonePayloadType),
BELLE_SIP_TYPE_ID(LinphoneRange)
BELLE_SIP_DECLARE_TYPES_END
......
......@@ -2105,10 +2105,19 @@ LINPHONE_PUBLIC void linphone_core_get_audio_port_range(const LinphoneCore *lc,
/**
* Overload of linphone_core_get_audio_port_range().
* @deprecated Use linphone_core_get_audio_ports_range instead
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_audio_port_range_2(const LinphoneCore *lc);
/**
* Get the audio port range from which is randomly chosen the UDP port used for audio streaming.
* @param[in] lc LinphoneCore object
* @return a LinphoneRange object
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneRange *linphone_core_get_audio_ports_range(const LinphoneCore *lc);
/**
* Gets the UDP port used for video streaming.
* @param[in] lc LinphoneCore object
......@@ -2129,10 +2138,19 @@ LINPHONE_PUBLIC void linphone_core_get_video_port_range(const LinphoneCore *lc,
/**
* Overload of linphone_core_get_video_port_range().
* @deprecated Use linphone_core_get_video_ports_range instead
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_video_port_range_2(const LinphoneCore *lc);
/**
* Get the video port range from which is randomly chosen the UDP port used for video streaming.
* @param[in] lc LinphoneCore object
* @return a LinphoneRange object
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneRange *linphone_core_get_video_ports_range(const LinphoneCore *lc);
/**
* Gets the UDP port used for text streaming.
* @param[in] lc LinphoneCore object
......@@ -2153,10 +2171,19 @@ LINPHONE_PUBLIC void linphone_core_get_text_port_range(const LinphoneCore *lc, i
/**
* Overload of linphone_core_get_text_port_range().
* @deprecated Use linphone_core_get_text_ports_range instead
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_text_port_range_2(const LinphoneCore *lc);
/**
* Get the text port range from which is randomly chosen the UDP port used for text streaming.
* @param[in] lc LinphoneCore object
* @return a LinphoneRange object
* @ingroup network_parameters
*/
LINPHONE_PUBLIC LinphoneRange *linphone_core_get_text_ports_range(const LinphoneCore *lc);
/**
* Gets the value of the no-rtp timeout.
*
......
......@@ -216,6 +216,13 @@ LINPHONE_PUBLIC void linphone_factory_set_msplugins_dir(LinphoneFactory *factory
* @return LinphoneErrorInfo object.
*/
LINPHONE_PUBLIC LinphoneErrorInfo *linphone_factory_create_error_info(LinphoneFactory *factory);
/**
* Creates an object LinphoneRange.
* @param[in] factory LinphoneFactory object
* @return LinphoneRange object.
*/
LINPHONE_PUBLIC LinphoneRange *linphone_factory_create_range(LinphoneFactory *factory);
/**
* @}
*/
......
......@@ -159,6 +159,18 @@ LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* trans
**/
LINPHONE_PUBLIC LinphoneReason linphone_error_code_to_reason(int err);
/**
* Increment refcount.
* @param[in] range LinphoneRange object
**/
LINPHONE_PUBLIC LinphoneRange *linphone_range_ref(LinphoneRange *range);
/**
* Decrement refcount and possibly free the object.
* @param[in] range LinphoneRange object
**/
LINPHONE_PUBLIC void linphone_range_unref(LinphoneRange *range);
/**
* Converts a LinphoneReason to an error code.
* @param[in] reason A LinphoneReason
......@@ -167,6 +179,38 @@ LINPHONE_PUBLIC LinphoneReason linphone_error_code_to_reason(int err);
*/
LINPHONE_PUBLIC int linphone_reason_to_error_code(LinphoneReason reason);
/**
* Gets the lower value of the range
* @param[in] range a LinphoneRange
* @return The lower value
* @ingroup misc
*/
LINPHONE_PUBLIC int linphone_range_get_min(const LinphoneRange *range);
/**
* Gets the higher value of the range
* @param[in] range a LinphoneRange
* @return The higher value
* @ingroup misc
*/
LINPHONE_PUBLIC int linphone_range_get_max(const LinphoneRange *range);
/**
* Sets the lower value of the range
* @param[in] range a LinphoneRange
* @param[in] min the value to set
* @ingroup misc
*/
LINPHONE_PUBLIC void linphone_range_set_min(LinphoneRange *range, int min);
/**
* Sets the higher value of the range
* @param[in] range a LinphoneRange
* @param[in] max the value to set
* @ingroup misc
*/
LINPHONE_PUBLIC void linphone_range_set_max(LinphoneRange *range, int max);
#ifdef __cplusplus
}
......
......@@ -1181,13 +1181,19 @@ typedef struct _LinphonePayloadType LinphonePayloadType;
/**
* Structure describing a range of integers
* @ingroup misc
* @deprecated
*/
typedef struct _LinphoneIntRange {
int min; /**< Minimum value */
int max; /**< Maximum value */
} LinphoneIntRange;
/**
* Structure describing a range of integers
* @ingroup misc
*/
typedef struct _LinphoneRange LinphoneRange;
/**
* Status code returned by some functions to
* notify whether the execution has been succesfully
......
......@@ -65,30 +65,6 @@ LINPHONE_PUBLIC void linphone_chat_message_resend(LinphoneChatMessage *msg);
*/
LINPHONE_PUBLIC void *linphone_vcard_get_belcard(LinphoneVcard *vcard);
/* Functions to mainpulate the LinphoneIntRange structure */
/**
* Get the minimum value of a #LinphoneIntRange.
*/
LINPHONE_PUBLIC int linphone_int_range_get_min(const LinphoneIntRange *range);
/**
* Get the maximum value of a #LinphoneIntRange.
*/
LINPHONE_PUBLIC int linphone_int_range_get_max(const LinphoneIntRange *range);
/**
* Set the minimum value of a #LinphoneIntRange.
*/
LINPHONE_PUBLIC void linphone_int_range_set_min(LinphoneIntRange *range, int min);
/**
* Set the maximum value of a #LinphoneIntRange.
*/
LINPHONE_PUBLIC void linphone_int_range_set_max(LinphoneIntRange *range, int max);
/**
* @}
*/
......
......@@ -422,6 +422,7 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
int dummy = 0;
pol.automatically_accept = 1;
pol.automatically_initiate = 1;
LinphoneRange *port_range = NULL;
linphone_core_enable_video_capture(pauline->lc, TRUE);
linphone_core_enable_video_display(pauline->lc, TRUE);
......@@ -432,7 +433,15 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
linphone_core_enable_video_display(marie2->lc, TRUE);
linphone_core_set_video_policy(marie2->lc, &pol);
linphone_core_set_audio_port_range(marie2->lc, 40200, 40300);
port_range = linphone_core_get_audio_ports_range(marie2->lc);
BC_ASSERT_EQUAL(port_range->min, 40200, int, "%i");
BC_ASSERT_EQUAL(port_range->max, 40300, int, "%i");
linphone_range_unref(port_range);
linphone_core_set_video_port_range(marie2->lc, 40400, 40500);
port_range = linphone_core_get_video_ports_range(marie2->lc);
BC_ASSERT_EQUAL(port_range->min, 40400, int, "%i");
BC_ASSERT_EQUAL(port_range->max, 40500, int, "%i");
linphone_range_unref(port_range);
lcs = bctbx_list_append(lcs,marie1->lc);
lcs = bctbx_list_append(lcs,marie2->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