Commit 147d74d3 authored by Guillaume Beraudo's avatar Guillaume Beraudo

API for ZRTP.

parent a94f569c
......@@ -5,7 +5,7 @@ ortp_includedir=$(includedir)/ortp
ortp_include_HEADERS=str_utils.h rtpsession.h rtp.h port.h \
ortp.h telephonyevents.h sessionset.h payloadtype.h rtpsignaltable.h \
rtcp.h \
event.h stun.h stun_udp.h srtp.h \
event.h stun.h stun_udp.h srtp.h zrtp.h \
b64.h
EXTRA_DIST=$(ortp_include_HEADERS)
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2011 Belledonne Communications
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ortp_zrtp_h
#define ortp_zrtp_h
#include <ortp/rtpsession.h>
#ifdef HAVE_zrtp
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <srtp/srtp.h>
#include <libzrtpcpp/ZrtpCWrapper.h>
#endif
#ifdef __cplusplus
extern "C"{
#endif
typedef void (*OrtpZrtpSasReady)(const char *sas, bool_t verified);
typedef void (*OrtpZrtpSecretsOff)();
typedef void (*OrtpZrtpGoClear)();
typedef void (*OrtpZrtpNegociationFailed)();
typedef void (*OrtpZrtpNotSupportedByOther)();
/**
* This structure holds all callbacks that the UI should implement.
* Mandatory ones are: sas_ready
**/
typedef struct _OrtpZrtpUiCb {
OrtpZrtpSasReady sas_ready; /**<Notifies when the Short Authentication String is ready*/
OrtpZrtpSecretsOff secrets_off;
OrtpZrtpNegociationFailed failed;
OrtpZrtpNotSupportedByOther not_supported_by_other;
OrtpZrtpGoClear go_clear;
} OrtpZrtpUiCb;
typedef struct OrtpZrtpParams {
char *zid; // ZRTP identifier (96 bits)
char *zid_file; // File where to store secrets and other information
OrtpZrtpUiCb *ui_cbs; // User call back functions
} OrtpZrtpParams;
typedef struct _OrtpZrtpContext OrtpZrtpContext ;
OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params);
void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx);
void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx);
#ifdef __cplusplus
}
#endif
#endif
......@@ -30,7 +30,8 @@ libortp_la_SOURCES= str_utils.c \
event.c \
stun.c stun_udp.c \
srtp.c \
b64.c
b64.c \
zrtp.c zrtp.h
libortp_la_LIBADD= $(PTHREAD_LIBS) -lm $(SRTP_LIBS) $(SSL_LIBS)
......
......@@ -33,6 +33,10 @@ int ortp_allocations=0;
#endif
#ifdef HAVE_SRTP
#include <srtp/srtp.h>
#endif
RtpScheduler *__ortp_scheduler;
......@@ -79,6 +83,13 @@ void ortp_init()
av_profile_init(&av_profile);
ortp_global_stats_reset();
init_random_number_generator();
#ifdef HAVE_SRTP
if (srtp_init() != err_status_ok) {
ortp_fatal("Couldn't initialize SRTP library.");
}
#endif
ortp_message("oRTP-" ORTP_VERSION " initialized.");
}
......
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
Copyright (C) 2011 Belledonne Communications
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if defined(_MSC_VER) && (defined(WIN32) || defined(_WIN32_WCE))
#include "ortp-config-win32.h"
#elif HAVE_CONFIG_H
#include "ortp-config.h"
#endif
#include "ortp/ortp.h"
#include "ortp/zrtp.h"
#ifdef HAVE_zrtp
// The ZRTP implementation/wrapper will come here
#else
OrtpZrtpContext* ortp_zrtp_context_new(RtpSession *s, OrtpZrtpParams *params){
ortp_message("ZRTP is disabled - not compiled");
return NULL;
}
void ortp_zrtp_sas_verified(OrtpZrtpContext* ctx){}
void ortp_zrtp_sas_reset_verified(OrtpZrtpContext* ctx){}
void ortp_zrtp_context_destroy(OrtpZrtpContext *ctx){}
#endif
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