Commit 9d331de9 authored by Matthieu Tanon's avatar Matthieu Tanon

Add LinphoneZrtpPeerStatus enum

parent dcaa1bcc
......@@ -6718,14 +6718,24 @@ void *linphone_core_get_zrtp_cache_db(LinphoneCore *lc){
#endif /* SQLITE_STORAGE_ENABLED */
}
int linphone_core_get_zrtp_status(LinphoneCore *lc, const char *peerUri) {
LinphoneZrtpPeerStatus linphone_core_get_zrtp_status(LinphoneCore *lc, const char *peerUri) {
#ifdef SQLITE_STORAGE_ENABLED
int status = MS_ZRTP_PEER_STATUS_UNKNOWN;
if (lc->zrtp_cache_db) {
return ms_zrtp_get_peer_status(lc->zrtp_cache_db, peerUri);
status = ms_zrtp_get_peer_status(lc->zrtp_cache_db, peerUri);
}
switch (status) {
case MS_ZRTP_PEER_STATUS_UNKNOWN:
return LinphoneZrtpPeerStatusUnknown;
case MS_ZRTP_PEER_STATUS_INVALID:
return LinphoneZrtpPeerStatusInvalid;
case MS_ZRTP_PEER_STATUS_VALID:
return LinphoneZrtpPeerStatusValid;
default:
return LinphoneZrtpPeerStatusUnknown;
}
return 0;
#else /* SQLITE_STORAGE_ENABLED */
return 0;
return LinphoneZrtpPeerStatusUnkown;
#endif /* SQLITE_STORAGE_ENABLED */
}
......
......@@ -4239,13 +4239,15 @@ LINPHONE_PUBLIC void *linphone_core_get_zrtp_cache_db(LinphoneCore *lc);
/**
* Get the zrtp sas validation status for a peer uri.
* Once the SAS has been validated or rejected, the status will never return to UNKNOWN (unless you delete your cache)
* Once the SAS has been validated or rejected, the status will never return to Unknown (unless you delete your cache)
* @param[in] lc #LinphoneCore object.
* @return - BZRTP_CACHE_PEER_STATUS_UNKNOWN: this uri is not present in cache OR during calls with the active device, SAS never was validated or rejected
* - BZRTP_CACHE_PEER_STATUS_VALID: the active device status is set to valid
* - BZRTP_CACHE_PEER_STATUS_INVALID: the active peer device status is set to invalid
* @param[in] addr the peer uri
* @ingroup media_parameters
* @return - LinphoneZrtpPeerStatusUnknown: this uri is not present in cache OR during calls with the active device, SAS never was validated or rejected
* - LinphoneZrtpPeerStatusValid: the active device status is set to valid
* - LinphoneZrtpPeerStatusInvalid: the active peer device status is set to invalid
*/
LINPHONE_PUBLIC int linphone_core_get_zrtp_status(LinphoneCore *lc, const char *addr);
LINPHONE_PUBLIC LinphoneZrtpPeerStatus linphone_core_get_zrtp_status(LinphoneCore *lc, const char *addr);
/**
* Set the path to the directory storing the user's x509 certificates (used by dtls)
......
......@@ -587,6 +587,16 @@ typedef enum _LinphoneMediaEncryption {
LinphoneMediaEncryptionDTLS /**< Use DTLS media encryption */
} LinphoneMediaEncryption;
/**
* Enum describing the ZRTP SAS validation status of a peer URI
* @ingroup media_parameters
**/
typedef enum _LinphoneZrtpPeerStatus {
LinphoneZrtpPeerStatusUnknown, /**< Peer URI unkown or never validated/invalidated the SAS */
LinphoneZrtpPeerStatusInvalid, /**< Peer URI SAS rejected in database */
LinphoneZrtpPeerStatusValid /**< Peer URI SAS validated in database */
} LinphoneZrtpPeerStatus;
/**
* Policy to use to pass through NATs/firewalls.
* @ingroup network_parameters
......
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