27 #ifndef OPAL_RTP_DTLS_SRTP_SESSION_H
28 #define OPAL_RTP_DTLS_SRTP_SESSION_H
43 #include <ptclib/pssl.h>
44 #include <ptclib/pstun.h>
45 #include <ptclib/qchannel.h>
51 #define OPAL_OPT_DTLS_TIMEOUT "DTLS-Timeout"
55 typedef OpalICEMediaTransport OpalDTLSMediaTransportParent;
60 class OpalDTLSMediaTransport :
public OpalDTLSMediaTransportParent
62 PCLASSINFO(OpalDTLSMediaTransport, OpalDTLSMediaTransportParent);
64 OpalDTLSMediaTransport(
const PString & name,
bool passiveMode,
const PSSLCertificateFingerprint& fp);
67 virtual bool IsEstablished()
const;
70 void SetPassiveMode(
bool passive);
71 PSSLCertificateFingerprint GetLocalFingerprint(PSSLCertificateFingerprint::HashType hashType)
const;
72 bool SetRemoteFingerprint(
const PSSLCertificateFingerprint& fp);
73 PSSLCertificateFingerprint GetRemoteFingerprint()
const;
76 virtual PChannel * AddWrapperChannels(SubChannels subchannel, PChannel * channel);
78 class DTLSChannel :
public PSSLChannelDTLS
80 PCLASSINFO(DTLSChannel, PSSLChannelDTLS);
82 DTLSChannel(OpalDTLSMediaTransport & transport, PChannel * channel);
83 ~DTLSChannel() { Close(); }
84 virtual bool Read(
void * buf, PINDEX len);
85 virtual int BioRead(
char * buf,
int len);
86 virtual int BioWrite(
const char * buf,
int len);
88 OpalDTLSMediaTransport & m_transport;
92 std::list<PBYTEArray> m_lastReceivedPackets;
94 PBYTEArray m_lastResponseData;
95 PINDEX m_lastResponseLength;
97 friend class DTLSChannel;
99 bool InternalPerformHandshake(DTLSChannel * channel);
100 virtual bool PerformHandshake(DTLSChannel & channel);
101 PDECLARE_SSLVerifyNotifier(OpalDTLSMediaTransport, OnVerify);
103 atomic<bool> m_passiveMode;
104 PTimeInterval m_handshakeTimeout;
106 PSSLCertificate m_certificate;
107 PSSLPrivateKey m_privateKey;
108 PSSLCertificateFingerprint m_remoteFingerprint;
109 PAutoPtr<OpalMediaCryptoKeyInfo> m_keyInfo[2];
111 friend class OpalDTLSContext;
113 P_REMOVE_VIRTUAL(DTLSChannel*,CreateDTLSChannel(),NULL);
114 P_REMOVE_VIRTUAL_VOID(PerformHandshake(PChannel*));
118 class OpalDTLSSRTPSession :
public OpalSRTPSession
120 PCLASSINFO(OpalDTLSSRTPSession, OpalSRTPSession);
122 static const PCaselessString & RTP_DTLS_SAVP();
123 static const PCaselessString & RTP_DTLS_SAVPF();
125 OpalDTLSSRTPSession(
const Init & init);
126 ~OpalDTLSSRTPSession();
128 virtual const PCaselessString & GetSessionType()
const {
return RTP_DTLS_SAVP(); }
131 void SetPassiveMode(
bool passive);
132 bool IsPassiveMode()
const;
134 PSSLCertificateFingerprint GetLocalFingerprint(PSSLCertificateFingerprint::HashType hashType)
const;
135 void SetRemoteFingerprint(
const PSSLCertificateFingerprint& fp);
141 PSSLCertificateFingerprint m_earlyRemoteFingerprint;
147 #endif // OPAL_RTP_DTLS_SRTP_SESSION_H
Definition: transports.h:151