Commit 197ef9bd authored by Matthieu Tanon's avatar Matthieu Tanon

Add MSZrtpPeerStatus enum

parent e63f5617
......@@ -90,6 +90,12 @@ typedef enum _MSZrtpSasType{
MS_ZRTP_SAS_B256
} MSZrtpSasType;
typedef enum _MSZrtpPeerStatus{
MS_ZRTP_PEER_STATUS_UNKNOWN,
MS_ZRTP_PEER_STATUS_INVALID,
MS_ZRTP_PEER_STATUS_VALID
} MSZrtpPeerStatus;
typedef struct MSZrtpParams {
void *zidCacheDB; /**< a pointer to an sqlite database holding all zrtp related information */
const char *selfUri; /* our sip URI, needed for zrtp Cache */
......@@ -170,11 +176,11 @@ MS2_PUBLIC void ms_zrtp_sas_reset_verified(MSZrtpContext* ctx);
* Once the SAS has been validated or rejected, the status will never return to UNKNOWN (unless you delete your cache)
* @param[in/out] db Pointer to the sqlite3 db open connection
* Use a void * to keep this API when building cacheless
* @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
* @return - MS_ZRTP_PEER_STATUS_UNKNOWN: this uri is not present in cache OR during calls with the active device, SAS never was validated or rejected
* - MS_ZRTP_PEER_STATUS_INVALID: the active device status is set to valid
* - MS_ZRTP_PEER_STATUS_VALID: the active peer device status is set to invalid
*/
MS2_PUBLIC int ms_zrtp_get_peer_status(void *db, const char *peerUri);
MS2_PUBLIC MSZrtpPeerStatus ms_zrtp_get_peer_status(void *db, const char *peerUri);
/**
* Get the ZRTP Hello Hash from the given context
......
......@@ -690,8 +690,18 @@ void ms_zrtp_sas_reset_verified(MSZrtpContext* ctx){
bzrtp_resetSASVerified(ctx->zrtpContext);
}
int ms_zrtp_get_peer_status(void *db, const char *peerUri){
return bzrtp_cache_getPeerStatus(db, peerUri);
MSZrtpPeerStatus ms_zrtp_get_peer_status(void *db, const char *peerUri){
int status = bzrtp_cache_getPeerStatus(db, peerUri);
switch (status) {
case BZRTP_CACHE_PEER_STATUS_UNKNOWN:
return MS_ZRTP_PEER_STATUS_UNKNOWN;
case BZRTP_CACHE_PEER_STATUS_INVALID:
return MS_ZRTP_PEER_STATUS_INVALID;
case BZRTP_CACHE_PEER_STATUS_VALID:
return MS_ZRTP_PEER_STATUS_VALID;
default:
return MS_ZRTP_PEER_STATUS_UNKNOWN;
}
}
int ms_zrtp_getHelloHash(MSZrtpContext* ctx, uint8_t *output, size_t outputLength) {
......
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