Skip to content
Snippets Groups Projects
Commit e031e4fe authored by Boris Grozev's avatar Boris Grozev
Browse files

Adds a method that allows sending application data through DTLS. Enables...

Adds a method that allows sending application data through DTLS. Enables handling of received application data when DTLS-SRTP is enabled.
parent ede3d25f
No related branches found
Tags 485
No related merge requests found
......@@ -91,8 +91,8 @@ protected void doLogPacket(RawPacket packet, InetSocketAddress target)
* Returns whether or not this <tt>RTPConnectorOutputStream</tt> has a valid
* socket.
*
* @returns true if this <tt>RTPConnectorOutputStream</tt> has a valid
* socket, false otherwise
* @return <tt>true</tt>if this <tt>RTPConnectorOutputStream</tt> has a valid
* socket, and <tt>false</tt> otherwise.
*/
@Override
protected boolean isSocketValid()
......
......@@ -659,13 +659,6 @@ else if (delta < 0)
delta = len - received;
if (delta > 0)
pkt.shrink(delta);
/*
* In DTLS-SRTP no application data is transmitted
* over the DTLS channel.
*/
if (!transformEngine.isSrtpDisabled())
pkt = null;
}
}
catch (IOException ioe)
......@@ -1136,6 +1129,53 @@ public RawPacket transform(RawPacket pkt)
return pkt;
}
/**
* Sends the data contained in a specific byte array as application data
* through the DTLS connection of this <tt>DtlsPacketTransformer</tt>.
*
* @param buf the byte array containing data to send.
* @param off the offset in <tt>buf</tt> where the data begins.
* @param len the length of data to send.
*/
public void sendApplicationData(byte[] buf, int off, int len)
{
DTLSTransport dtlsTransport = this.dtlsTransport;
Exception exception = null;
if (dtlsTransport != null)
{
try
{
dtlsTransport.send(buf, off, len);
}
catch (IOException ioe)
{
exception = ioe;
}
}
else
{
exception = new NullPointerException("dtlsTransport");
}
if (exception != null)
{
/*
* SrtpControl.start(MediaType) starts its associated
* TransformEngine. We will use that mediaType to signal the
* normal stop then as well i.e. we will ignore exception
* after the procedure to stop this PacketTransformer has
* begun.
*/
if ((mediaType != null) && !tlsPeerHasRaisedCloseNotifyWarning)
{
logger.error(
"Failed to send application data over DTLS transport: ",
exception);
}
}
}
/**
* Enables/disables rtcp-mux.
* @param rtcpmux whether to enable or disable.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment