00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef OPAL_RTP_SRTP_H
00035 #define OPAL_RTP_SRTP_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #ifndef _PTLIB_H
00042 #include <ptlib.h>
00043 #endif
00044
00045 #include <opal/buildopts.h>
00046
00047 #include <rtp/rtp.h>
00048 #include <opal/rtpconn.h>
00049
00050 #if OPAL_SRTP
00051
00052
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class OpalSRTPSecurityMode : public OpalSecurityMode
00068 {
00069 PCLASSINFO(OpalSRTPSecurityMode, OpalSecurityMode);
00070 public:
00071 struct KeySalt {
00072 KeySalt() { }
00073 KeySalt(const PBYTEArray & data) : key(data) { }
00074 KeySalt(const BYTE * data, PINDEX dataLen) : key(data, dataLen) { }
00075 PBYTEArray key;
00076 PBYTEArray salt;
00077 };
00078 virtual PBoolean SetOutgoingKey(const KeySalt & key) = 0;
00079 virtual PBoolean GetOutgoingKey(KeySalt & key) const = 0;
00080 virtual PBoolean SetOutgoingSSRC(DWORD ssrc) = 0;
00081 virtual PBoolean GetOutgoingSSRC(DWORD & ssrc) const = 0;
00082
00083 virtual PBoolean SetIncomingKey(const KeySalt & key) = 0;
00084 virtual PBoolean GetIncomingKey(KeySalt & key) const = 0;
00085 virtual PBoolean SetIncomingSSRC(DWORD ssrc) = 0;
00086 virtual PBoolean GetIncomingSSRC(DWORD & ssrc) const = 0;
00087 };
00088
00090
00091
00092
00093
00094 class OpalSRTP_UDP : public SecureRTP_UDP
00095 {
00096 PCLASSINFO(OpalSRTP_UDP, SecureRTP_UDP);
00097 public:
00098 OpalSRTP_UDP(
00099 const Params & options
00100 );
00101
00102 virtual SendReceiveStatus OnSendData (RTP_DataFrame & frame) = 0;
00103 virtual SendReceiveStatus OnReceiveData(RTP_DataFrame & frame) = 0;
00104 virtual SendReceiveStatus OnSendControl(RTP_ControlFrame & frame, PINDEX & len) = 0;
00105 virtual SendReceiveStatus OnReceiveControl(RTP_ControlFrame & frame) = 0;
00106 };
00107
00108
00110
00111
00112
00113
00114 class LibSRTP_UDP : public OpalSRTP_UDP
00115 {
00116 PCLASSINFO(LibSRTP_UDP, OpalSRTP_UDP);
00117 public:
00118 LibSRTP_UDP(
00119 const Params & options
00120 );
00121
00122 ~LibSRTP_UDP();
00123
00124 PBoolean Open(
00125 PIPSocket::Address localAddress,
00126 WORD portBase,
00127 WORD portMax,
00128 BYTE ipTypeOfService,
00129 PNatMethod * natMethod = NULL,
00130 RTP_QOS * rtpqos = NULL
00131 );
00132
00133 virtual SendReceiveStatus OnSendData (RTP_DataFrame & frame);
00134 virtual SendReceiveStatus OnReceiveData(RTP_DataFrame & frame);
00135 virtual SendReceiveStatus OnSendControl(RTP_ControlFrame & frame, PINDEX & len);
00136 virtual SendReceiveStatus OnReceiveControl(RTP_ControlFrame & frame);
00137 };
00138
00139 PFACTORY_LOAD(LibSRTPSecurityMode_STRONGHOLD);
00140
00141
00142 #endif // OPAL_SRTP
00143
00144 #endif // OPAL_RTP_SRTP_H