diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3e496caa3..4a0eccb36 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2442,6 +2442,14 @@ void linphone_core_get_audio_port_range(const LinphoneCore *lc, int *min_port, i *max_port = lc->rtp_conf.audio_rtp_max_port; } +LinphoneIntRange linphone_core_get_audio_port_range_2(const LinphoneCore *lc) { + LinphoneIntRange range = { + .min = lc->rtp_conf.audio_rtp_min_port, + .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; } @@ -2451,6 +2459,14 @@ void linphone_core_get_video_port_range(const LinphoneCore *lc, int *min_port, i *max_port = lc->rtp_conf.video_rtp_max_port; } +LinphoneIntRange linphone_core_get_video_port_range_2(const LinphoneCore *lc) { + LinphoneIntRange range = { + .min = lc->rtp_conf.video_rtp_min_port, + .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; } @@ -2460,6 +2476,14 @@ void linphone_core_get_text_port_range(const LinphoneCore *lc, int *min_port, in *max_port = lc->rtp_conf.text_rtp_max_port; } +LinphoneIntRange linphone_core_get_text_port_range_2(const LinphoneCore *lc) { + LinphoneIntRange range = { + .min = lc->rtp_conf.text_rtp_min_port, + .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; } diff --git a/coreapi/misc.c b/coreapi/misc.c index 6b4d655d2..862d8f570 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1884,3 +1884,22 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, linphone_call_set_symmetric_rtp(call, linphone_core_symmetric_rtp_enabled(linphone_call_get_core(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; +} diff --git a/include/linphone/core.h b/include/linphone/core.h index 4f3bc85a3..0b1638380 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -2313,9 +2313,16 @@ LINPHONE_PUBLIC int linphone_core_get_audio_port(const LinphoneCore *lc); * @param[out] min_port The lower bound of the audio port range being used * @param[out] max_port The upper bound of the audio port range being used * @ingroup network_parameters + * @donotwrap */ LINPHONE_PUBLIC void linphone_core_get_audio_port_range(const LinphoneCore *lc, int *min_port, int *max_port); +/** + * Overload of linphone_core_get_audio_port_range(). + * @ingroup network_parameters + */ +LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_audio_port_range_2(const LinphoneCore *lc); + /** * Gets the UDP port used for video streaming. * @param[in] lc LinphoneCore object @@ -2330,9 +2337,16 @@ LINPHONE_PUBLIC int linphone_core_get_video_port(const LinphoneCore *lc); * @param[out] min_port The lower bound of the video port range being used * @param[out] max_port The upper bound of the video port range being used * @ingroup network_parameters + * @donotwrap */ LINPHONE_PUBLIC void linphone_core_get_video_port_range(const LinphoneCore *lc, int *min_port, int *max_port); +/** + * Overload of linphone_core_get_video_port_range(). + * @ingroup network_parameters + */ +LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_video_port_range_2(const LinphoneCore *lc); + /** * Gets the UDP port used for text streaming. * @param[in] lc LinphoneCore object @@ -2347,9 +2361,16 @@ LINPHONE_PUBLIC int linphone_core_get_text_port(const LinphoneCore *lc); * @param[out] min_port The lower bound of the text port range being used * @param[out] max_port The upper bound of the text port range being used * @ingroup network_parameters + * @donotwrap */ LINPHONE_PUBLIC void linphone_core_get_text_port_range(const LinphoneCore *lc, int *min_port, int *max_port); +/** + * Overload of linphone_core_get_text_port_range(). + * @ingroup network_parameters + */ +LINPHONE_PUBLIC LinphoneIntRange linphone_core_get_text_port_range_2(const LinphoneCore *lc); + /** * Gets the value of the no-rtp timeout. * diff --git a/include/linphone/types.h b/include/linphone/types.h index 3782621e9..4f1f3f4a3 100644 --- a/include/linphone/types.h +++ b/include/linphone/types.h @@ -1104,4 +1104,14 @@ typedef enum _LinphoneXmlRpcStatus { typedef struct _LsdPlayer LsdPlayer; +/** + * Structure describing a range of integers + * @ingroup misc + */ +typedef struct _LinphoneIntRange { + int min; /**< Minimum value */ + int max; /**< Maximum value */ +} LinphoneIntRange; + + #endif /* LINPHONE_TYPES_H_ */ diff --git a/include/linphone/wrapper_utils.h b/include/linphone/wrapper_utils.h index 5c05a1cc0..d06d5eab3 100644 --- a/include/linphone/wrapper_utils.h +++ b/include/linphone/wrapper_utils.h @@ -65,6 +65,30 @@ 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); + /** * @} */