1 /* 2 misc.h 3 Copyright (C) 2010-2017 Belledonne Communications SARL 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either version 2 8 of the License, or (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef LINPHONE_MISC_H_ 21 #define LINPHONE_MISC_H_ 22 23 24 #include "linphone/types.h" 25 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 32 /** 33 * Lowest volume measurement that can be returned by linphone_call_get_play_volume() or linphone_call_get_record_volume(), corresponding to pure silence. 34 * @ingroup call_misc 35 **/ 36 #define LINPHONE_VOLUME_DB_LOWEST (-120) /* WARNING: keep this in sync with mediastreamer2/msvolume.h */ 37 38 39 /** 40 * Disable a sip transport 41 * Use with #LinphoneSipTransports 42 * @ingroup initializing 43 */ 44 #define LC_SIP_TRANSPORT_DISABLED 0 45 /** 46 * Randomly chose a sip port for this transport 47 * Use with #LinphoneSipTransports 48 * @ingroup initializing 49 */ 50 #define LC_SIP_TRANSPORT_RANDOM (-1) 51 52 /** 53 * Don't create any server socket for this transport, ie don't bind on any port. 54 * Use with #LinphoneSipTransports 55 * @ingroup initializing 56 **/ 57 #define LC_SIP_TRANSPORT_DONTBIND (-2) 58 59 60 /** 61 * Function returning a human readable value for LinphoneStreamType. 62 * @ingroup initializing 63 **/ 64 LINPHONE_PUBLIC const char *linphone_stream_type_to_string(const LinphoneStreamType); 65 66 /** 67 * Human readable version of the #LinphoneRegistrationState 68 * @param cs sate 69 * @ingroup proxies 70 */ 71 LINPHONE_PUBLIC const char *linphone_registration_state_to_string(LinphoneRegistrationState cs); 72 73 /** 74 * Convert enum member to string. 75 * @ingroup media_parameters 76 **/ 77 LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc); 78 79 LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy); 80 81 LINPHONE_PUBLIC const char *linphone_subscription_state_to_string(LinphoneSubscriptionState state); 82 83 LINPHONE_PUBLIC const char *linphone_publish_state_to_string(LinphonePublishState state); 84 85 LINPHONE_PUBLIC const char *linphone_ice_state_to_string(LinphoneIceState state); 86 87 LINPHONE_PUBLIC const char *linphone_global_state_to_string(LinphoneGlobalState gs); 88 89 LINPHONE_PUBLIC const char *linphone_core_log_collection_upload_state_to_string(const LinphoneCoreLogCollectionUploadState lcus); 90 91 LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs); 92 93 /** 94 * Converts a _LinphoneConfiguringState enum to a string. 95 * @ingroup misc 96 **/ 97 LINPHONE_PUBLIC const char *linphone_configuring_state_to_string(LinphoneConfiguringState cs); 98 99 /** 100 * Returns a #LinphoneChatMessageState as a string. 101 */ 102 LINPHONE_PUBLIC const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state); 103 104 /** 105 * Converts a LinphoneReason enum to a string. 106 * @param[in] err A #LinphoneReason 107 * @return The string representation of the specified LinphoneReason 108 * @ingroup misc 109 **/ 110 LINPHONE_PUBLIC const char *linphone_reason_to_string(LinphoneReason err); 111 112 /** 113 * Return humain readable presence status 114 * @param ss 115 * @deprecated Use #LinphonePresenceModel, #LinphonePresenceActivity and linphone_presence_activity_to_string() instead. 116 * @donotwrap 117 */ 118 LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_online_status_to_string(LinphoneOnlineStatus ss); 119 120 /** 121 * Convert a string into LinphoneTunnelMode enum 122 * @param string String to convert 123 * @return An LinphoneTunnelMode enum. If the passed string is NULL or 124 * does not match with any mode, the LinphoneTunnelModeDisable is returned. 125 */ 126 LINPHONE_PUBLIC LinphoneTunnelMode linphone_tunnel_mode_from_string(const char *string); 127 128 /** 129 * Convert a tunnel mode enum into string 130 * @param mode Enum to convert 131 * @return "disable", "enable" or "auto" 132 */ 133 LINPHONE_PUBLIC const char *linphone_tunnel_mode_to_string(LinphoneTunnelMode mode); 134 135 /** 136 * Check whether Matroksa format is supported by the player 137 * @return TRUE if it is supported 138 */ 139 LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void); 140 141 /** 142 * Converts a LinphoneTransportType enum to a lowercase string. 143 * @ingroup misc 144 **/ 145 LINPHONE_PUBLIC const char* linphone_transport_to_string(LinphoneTransportType transport); 146 147 /** 148 * Converts a lowercase string to a LinphoneTransportType enum. 149 * @ingroup misc 150 * @return Transport matching input, or LinphoneTransportUdp if nothing is found 151 **/ 152 LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* transport); 153 154 /** 155 * Converts an error code to a LinphoneReason. 156 * @param[in] err An error code 157 * @return The LinphoneReason corresponding to the specified error code 158 * @ingroup misc 159 **/ 160 LINPHONE_PUBLIC LinphoneReason linphone_error_code_to_reason(int err); 161 162 /** 163 * Converts a LinphoneReason to an error code. 164 * @param[in] reason A LinphoneReason 165 * @return The error code corresponding to the specified LinphoneReason 166 * @ingroup misc 167 */ 168 LINPHONE_PUBLIC int linphone_reason_to_error_code(LinphoneReason reason); 169 170 /** 171 * Increment refcount. 172 * @param[in] range LinphoneRange object 173 * @ingroup misc 174 **/ 175 LINPHONE_PUBLIC LinphoneRange *linphone_range_ref(LinphoneRange *range); 176 177 /** 178 * Decrement refcount and possibly free the object. 179 * @param[in] range LinphoneRange object 180 * @ingroup misc 181 **/ 182 LINPHONE_PUBLIC void linphone_range_unref(LinphoneRange *range); 183 184 /** 185 * Gets the user data in the LinphoneRange object 186 * @param[in] range the LinphoneRange 187 * @return the user data 188 * @ingroup misc 189 */ 190 LINPHONE_PUBLIC void *linphone_range_get_user_data(const LinphoneRange *range); 191 192 /** 193 * Sets the user data in the LinphoneRange object 194 * @param[in] range the LinphoneRange object 195 * @param[in] data the user data 196 * @ingroup misc 197 */ 198 LINPHONE_PUBLIC void linphone_range_set_user_data(LinphoneRange *range, void *data); 199 200 /** 201 * Gets the lower value of the range 202 * @param[in] range a LinphoneRange 203 * @return The lower value 204 * @ingroup misc 205 */ 206 LINPHONE_PUBLIC int linphone_range_get_min(const LinphoneRange *range); 207 208 /** 209 * Gets the higher value of the range 210 * @param[in] range a LinphoneRange 211 * @return The higher value 212 * @ingroup misc 213 */ 214 LINPHONE_PUBLIC int linphone_range_get_max(const LinphoneRange *range); 215 216 /** 217 * Sets the lower value of the range 218 * @param[in] range a LinphoneRange 219 * @param[in] min the value to set 220 * @ingroup misc 221 */ 222 LINPHONE_PUBLIC void linphone_range_set_min(LinphoneRange *range, int min); 223 224 /** 225 * Sets the higher value of the range 226 * @param[in] range a LinphoneRange 227 * @param[in] max the value to set 228 * @ingroup misc 229 */ 230 LINPHONE_PUBLIC void linphone_range_set_max(LinphoneRange *range, int max); 231 232 233 #ifdef __cplusplus 234 } 235 #endif 236 237 #endif /* LINPHONE_MISC_H_ */ 238