Committing cosmetic modifications on the media package before refactoring ZRTP

cusax-fix
Emil Ivov 18 years ago
parent f564087d1e
commit 1b502575c7

@ -104,18 +104,18 @@ TOOLBAR_DRAG_ICON=resources/images/impl/gui/common/toolbarDragIcon.png
ADD_GROUP_ICON=resources/images/impl/gui/common/addGroup.png
MOVE_CONTACT=resources/images/impl/gui/common/moveContact.png
SMILEY1=resources/images/impl/gui/common/smilies/default/smiley1.png
SMILEY2=resources/images/impl/gui/common/smilies/default/smiley2.png
SMILEY3=resources/images/impl/gui/common/smilies/default/smiley3.png
SMILEY4=resources/images/impl/gui/common/smilies/default/smiley4.png
SMILEY5=resources/images/impl/gui/common/smilies/default/smiley5.png
SMILEY1=resources/images/impl/gui/common/smilies/default/smiley1.gif
SMILEY2=resources/images/impl/gui/common/smilies/default/smiley2.gif
SMILEY3=resources/images/impl/gui/common/smilies/default/smiley3.gif
SMILEY4=resources/images/impl/gui/common/smilies/default/smiley4.gif
SMILEY5=resources/images/impl/gui/common/smilies/default/smiley5.gif
SMILEY6=resources/images/impl/gui/common/smilies/default/smiley6.png
SMILEY7=resources/images/impl/gui/common/smilies/default/smiley7.png
SMILEY8=resources/images/impl/gui/common/smilies/default/smiley8.png
SMILEY9=resources/images/impl/gui/common/smilies/default/smiley9.png
SMILEY10=resources/images/impl/gui/common/smilies/default/smiley10.png
SMILEY11=resources/images/impl/gui/common/smilies/default/smiley11.png
SMILEY12=resources/images/impl/gui/common/smilies/default/smiley12.png
SMILEY7=resources/images/impl/gui/common/smilies/default/smiley7.gif
SMILEY8=resources/images/impl/gui/common/smilies/default/smiley8.gif
SMILEY9=resources/images/impl/gui/common/smilies/default/smiley9.gif
SMILEY10=resources/images/impl/gui/common/smilies/default/smiley10.gif
SMILEY11=resources/images/impl/gui/common/smilies/default/smiley11.gif
SMILEY12=resources/images/impl/gui/common/smilies/default/smiley12.gif
AUTH_WINDOW_BACKGROUND=resources/images/impl/gui/common/passWindowBackground.png
@ -202,7 +202,7 @@ trayIconWindowsAway=resources/images/impl/systray/systrayIconWindowsAway.png
trayIconWindowsFFC=resources/images/impl/systray/systrayIconWindowsFFC.png
trayIconMacOSX=resources/images/impl/systray/systrayIconMacOSX.png
trayIconMacOSXWhite=resources/images/impl/systray/systrayIconMacOSXWhite.png
dockIconOffline=resources/images/impl/systray/dock-offline.png
dockIconOffline=resources/images/impl/systray/dock-offline.png
dockIconAway=resources/images/impl/systray/dock-away.png
dockIconFFC=resources/images/impl/systray/dock-chatty.png
addContactIcon=resources/images/impl/gui/buttons/addContactIcon.png
@ -381,7 +381,7 @@ ircAwayIcon=resources/images/protocol/gibberish/gibberish-away.png
ircConnectingIcon=resources/images/protocol/irc/cr16-action-irc_connecting-1.gif
irc64x64Icon=resources/images/protocol/irc/cr32-app-irc_protocol.png
# jabber accregwizz
# jabber accregwizz
protocolIconJabber=resources/images/protocol/jabber/status16x16-online.png
pageImageJabber=resources/images/protocol/jabber/logo48x48.png
jabberConnectingIcon=resources/images/protocol/jabber/status16x16-connecting.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

@ -92,7 +92,7 @@ public class ImageLoader {
= new ImageID("BUTTON_ROLLOVER_BG_MIDDLE");
/**
* The pressed toggle button background image.
* The pressed toggle button background image.
*/
public static final ImageID TOGGLE_BUTTON_PRESSED
= new ImageID("TOGGLE_BUTTON_PRESSED");
@ -102,7 +102,7 @@ public class ImageLoader {
*/
public static final ImageID TOGGLE_BUTTON
= new ImageID("TOGGLE_BUTTON");
/**
* The image used for a horizontal split.
*/
@ -439,7 +439,7 @@ public class ImageLoader {
= new ImageID("DIEZ_DIAL_BUTTON");
/**
* A dial button icon. The icon shown in the CallParticipant panel.
* A dial button icon. The icon shown in the CallParticipant panel.
*/
public static final ImageID DIAL_BUTTON
= new ImageID("DIAL_BUTTON");
@ -461,13 +461,13 @@ public class ImageLoader {
*/
public static final ImageID TRANSFER_CALL_BUTTON =
new ImageID("TRANSFER_CALL_BUTTON");
/**
* The secure button on icon. The icon shown in the CallParticipant panel.
*/
public static final ImageID SECURE_BUTTON_ON =
new ImageID("SECURE_BUTTON_ON");
/**
* The secure button off icon. The icon shown in the CallParticipant panel.
*/
@ -542,7 +542,7 @@ public class ImageLoader {
*/
public static final ImageID RENAME_DIALOG_ICON
= new ImageID("RENAME_DIALOG_ICON");
/**
* The image used for decoration of the "reason" dialog. The "reason" dialog
* is used wherever user should specify a reason for the operation he's
@ -606,26 +606,26 @@ public class ImageLoader {
*/
public static final ImageID CLOSED_GROUP
= new ImageID("CLOSED_GROUP");
/**
* The image used for chat rooms.
*/
public static final ImageID CHAT_ROOM_16x16_ICON
= new ImageID("CHAT_ROOM_16x16_ICON");
/**
* The image used for multi user chat servers.
*/
public static final ImageID CHAT_SERVER_16x16_ICON
= new ImageID("CHAT_SERVER_16x16_ICON");
/**
* The image used to indicate in the contact list that a message is received
* from a certain contact.
*/
public static final ImageID MESSAGE_RECEIVED_ICON
= new ImageID("MESSAGE_RECEIVED_ICON");
/**
* The image used to set to the chat room "join" right button menu.
*/
@ -792,7 +792,7 @@ public class ImageLoader {
/**
* The icon shown between the global status button and other protocol status
* buttons.
* buttons.
*/
public static final ImageID STATUS_SEPARATOR_ICON
= new ImageID("STATUS_SEPARATOR_ICON");
@ -988,13 +988,13 @@ public class ImageLoader {
* The icon used to indicate a search.
*/
public static final ImageID SEARCH_ICON = new ImageID("SEARCH_ICON");
/**
* The icon used to indicate a search.
*/
public static final ImageID SEARCH_ICON_16x16
= new ImageID("SEARCH_ICON_16x16");
/*
* =======================================================================
* ------------------------ USERS' ICONS ---------------------------------
@ -1080,7 +1080,7 @@ public static ArrayList getDefaultSmiliesPack() {
ArrayList defaultPackList = new ArrayList();
defaultPackList.add(new Smiley(ImageLoader.SMILEY1, new String[] {
"$-)", "$)" }));
";-(", ";(" }));
defaultPackList.add(new Smiley(ImageLoader.SMILEY2, new String[] {
"B-)", "B)" }));
@ -1095,7 +1095,7 @@ public static ArrayList getDefaultSmiliesPack() {
":-((", ":((" }));
defaultPackList.add(new Smiley(ImageLoader.SMILEY6, new String[] {
":-~", ":~" }));
"(L)" , "(l)"}));
defaultPackList.add(new Smiley(ImageLoader.SMILEY7, new String[] {
":-|", ":|" }));
@ -1180,7 +1180,7 @@ public static BufferedImage getImage(ImageID imageID)
return image;
}
/**
* Loads an image from a given path.
*
@ -1190,11 +1190,11 @@ public static BufferedImage getImage(ImageID imageID)
public static BufferedImage getImageFromUrl(String path)
{
BufferedImage image = null;
try
{
URL imgUrl = new URL(path);
image = ImageIO.read(imgUrl.openStream());
}
catch (Exception exc)
@ -1210,7 +1210,7 @@ public static BufferedImage getImageFromUrl(String path)
* @param imageID The identifier of the image.
* @return The image for the given identifier.
*/
public static byte[] getImageInBytes(ImageID imageID)
public static byte[] getImageInBytes(ImageID imageID)
{
InputStream in = GuiActivator.getResources().
getImageInputStream(imageID.getId());
@ -1218,12 +1218,12 @@ public static byte[] getImageInBytes(ImageID imageID)
if (in == null)
return null;
byte[] image = null;
try
try
{
image = new byte[in.available()];
in.read(image);
} catch (IOException e)
} catch (IOException e)
{
log.error("Failed to load image:" + imageID.getId(), e);
}
@ -1243,8 +1243,8 @@ public static Image getBytesInImage(byte[] imageBytes)
{
image = ImageIO.read(
new ByteArrayInputStream(imageBytes));
}
}
catch (Exception e)
{
log.error("Failed to convert bytes to image.", e);
@ -1277,7 +1277,7 @@ public static BufferedImage[] getAnimatedImage(byte[] animatedImage)
if(numImages == 0)
return null;
images = new BufferedImage[numImages];
for (int i = 0; i < numImages; ++i) {
@ -1314,14 +1314,14 @@ public String getId() {
* The image wich path to return.
* @return The path string of an already loaded image, otherwise null.
*/
public static String getImagePath(Image image)
public static String getImagePath(Image image)
{
Iterator i = ImageLoader.loadedImages.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
if (entry.getValue().equals(image))
if (entry.getValue().equals(image))
{
String imageID = ((ImageID) entry.getKey()).getId();

@ -62,6 +62,7 @@
* <tt>RTPManager</tt>s.
*
* @author Emil Ivov
* @author Damian Minkov
* @author Ryan Ricard
* @author Ken Larson
* @author Dudek Przemyslaw
@ -167,8 +168,9 @@ public class CallSessionImpl
private boolean usingSRTP = false;
/**
* Vector used to hold references of various key management solutions implemented.
* For now only ZRTP and Dummy (hardcoded keys) are present.
* Vector used to hold references of the various key management solutions
* that are implemented. For now only ZRTP and dummy (hardcoded keys) are
* present.
*/
private Vector<KeyProviderAlgorithm> keySharingAlgorithms = null;
@ -355,16 +357,16 @@ private void startStreaming()
boolean startedAtLeastOneStream = false;
RTPManager rtpManager = getAudioRtpManager();
Vector sendStreams = rtpManager.getSendStreams();
Vector<SendStream> sendStreams = rtpManager.getSendStreams();
if(sendStreams != null && sendStreams.size() > 0)
{
logger.trace("Will be starting " + sendStreams.size()
+ " audio send streams.");
Iterator ssIter = sendStreams.iterator();
Iterator<SendStream> ssIter = sendStreams.iterator();
while (ssIter.hasNext())
{
SendStream stream = (SendStream) ssIter.next();
SendStream stream = ssIter.next();
try
{
/** @todo are we sure we want to connect here? */
@ -390,7 +392,7 @@ private void startStreaming()
{
logger.trace("Will be starting " + sendStreams.size()
+ " video send streams.");
Iterator ssIter = sendStreams.iterator();
Iterator<SendStream> ssIter = sendStreams.iterator();
while (ssIter.hasNext())
{
@ -448,7 +450,7 @@ public boolean stopStreaming()
/**
* Stops and closes all streams currently handled by <tt>rtpManager</tt>.
*
*
* @param rtpManager the rtpManager whose streams we'll be stopping.
* @return <tt>true</tt> if there was an actual change in the streaming i.e.
* the streaming wasn't already stopped before this request;
@ -457,8 +459,8 @@ public boolean stopStreaming()
private boolean stopStreaming(RTPManager rtpManager)
{
boolean stoppedAtLeastOneStream = false;
Vector sendStreams = rtpManager.getSendStreams();
Iterator ssIter = sendStreams.iterator();
Vector<SendStream> sendStreams = rtpManager.getSendStreams();
Iterator<SendStream> ssIter = sendStreams.iterator();
while(ssIter.hasNext())
{
@ -476,11 +478,11 @@ private boolean stopStreaming(RTPManager rtpManager)
stoppedAtLeastOneStream = true;
}
Vector receiveStreams = rtpManager.getReceiveStreams();
Iterator rsIter = receiveStreams.iterator();
Vector<ReceiveStream> receiveStreams = rtpManager.getReceiveStreams();
Iterator<ReceiveStream> rsIter = receiveStreams.iterator();
while(rsIter.hasNext())
{
ReceiveStream stream = (ReceiveStream) rsIter.next();
ReceiveStream stream = rsIter.next();
try
{
stream.getDataSource().stop();
@ -505,10 +507,12 @@ private boolean stopStreaming(RTPManager rtpManager)
if (transConnector != null)
{
ZRTPTransformEngine engine = (ZRTPTransformEngine)transConnector.getEngine();
ZRTPTransformEngine engine
= (ZRTPTransformEngine)transConnector.getEngine();
engine.sendInfo(ZrtpCodes.MessageSeverity.Info,
EnumSet.of(ZRTPCustomInfoCodes.ZRTPDisabledByCallEnd));
engine.sendInfo(
ZrtpCodes.MessageSeverity.Info,
EnumSet.of(ZRTPCustomInfoCodes.ZRTPDisabledByCallEnd));
transConnector.removeTargets();
}
@ -537,6 +541,9 @@ private boolean stopStreaming(RTPManager rtpManager)
*/
private void printFlowStatistics(RTPManager rtpManager)
{
if(! logger.isDebugEnabled())
return;
String rtpManagerDescription = (rtpManager == getAudioRtpManager())
? "(for audio flows)"
: "(for video flows)";
@ -649,7 +656,7 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
}
catch (SdpParseException ex)
{
throwMediaException(
throw new MediaException(
"Failed to parse the SDP description of the participant.",
MediaException.INTERNAL_ERROR, ex);
}
@ -657,24 +664,25 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
SessionDescription sdpOffer =
createSessionDescription(participantDescription, null);
Vector mediaDescriptions = null;
Vector<MediaDescription> mediaDescriptions = null;
try
{
mediaDescriptions = sdpOffer.getMediaDescriptions(true);
}
catch (SdpException ex)
{
throwMediaException(
throw new MediaException(
"Failed to get media descriptions from SDP offer.",
MediaException.INTERNAL_ERROR, ex);
}
for (Iterator mediaDescriptionIter = mediaDescriptions.iterator(); mediaDescriptionIter
.hasNext();)
for (Iterator<MediaDescription> mediaDescriptionIter
= mediaDescriptions.iterator();
mediaDescriptionIter.hasNext();)
{
MediaDescription mediaDescription =
(MediaDescription) mediaDescriptionIter.next();
Vector attributes = mediaDescription.getAttributes(false);
MediaDescription mediaDescription = mediaDescriptionIter.next();
Vector<Attribute> attributes
= mediaDescription.getAttributes(false);
try
{
@ -683,7 +691,7 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
catch (SdpException ex)
{
throwMediaException(
throw new MediaException(
"Failed to modify media description for hold.",
MediaException.INTERNAL_ERROR, ex);
}
@ -695,7 +703,7 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
}
catch (SdpException ex)
{
throwMediaException(
throw new MediaException(
"Failed to set media descriptions to SDP offer.",
MediaException.INTERNAL_ERROR, ex);
}
@ -707,7 +715,7 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
* Modifies the attributes of a specific <tt>MediaDescription</tt> in
* order to make them reflect the state of being on/off hold.
*
* @param on <tt>true</tt> if the state described by the modified
* @param onHold <tt>true</tt> if the state described by the modified
* <tt>MediaDescription</tt> should reflect being put on hold;
* <tt>false</tt> for being put off hold
* @param mediaDescription the <tt>MediaDescription</tt> to modify the
@ -715,8 +723,10 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
* @param attributes the attributes of <tt>mediaDescription</tt>
* @throws SdpException
*/
private void modifyMediaDescriptionForHold(boolean on,
MediaDescription mediaDescription, Vector attributes)
private void modifyMediaDescriptionForHold(
boolean onHold,
MediaDescription mediaDescription,
Vector<Attribute> attributes)
throws SdpException
{
@ -725,19 +735,19 @@ private void modifyMediaDescriptionForHold(boolean on,
* sendrecv and sendonly or between recvonly and inactive depending on
* the current state.
*/
String oldAttribute = on ? "recvonly" : "inactive";
String oldAttribute = onHold ? "recvonly" : "inactive";
String newAttribute = null;
if (attributes != null)
for (Iterator attributeIter = attributes.iterator(); attributeIter
.hasNext();)
for (Iterator<Attribute> attributeIter = attributes.iterator();
attributeIter.hasNext();)
{
String attribute = ((Attribute) attributeIter.next()).getName();
String attribute = attributeIter.next().getName();
if (oldAttribute.equalsIgnoreCase(attribute))
newAttribute = on ? "inactive" : "recvonly";
newAttribute = onHold ? "inactive" : "recvonly";
}
if (newAttribute == null)
newAttribute = on ? "sendonly" : "sendrecv";
newAttribute = onHold ? "sendonly" : "sendrecv";
mediaDescription.removeAttribute("inactive");
mediaDescription.removeAttribute("recvonly");
@ -746,27 +756,6 @@ private void modifyMediaDescriptionForHold(boolean on,
mediaDescription.setAttribute(newAttribute, null);
}
/**
* Logs a specific message and associated <tt>Throwable</tt> cause as an
* error using the current <tt>Logger</tt> and then throws a new
* <tt>MediaException</tt> with the message, a specific error code and the
* cause.
*
* @param message the message to be logged and then wrapped in a new
* <tt>MediaException</tt>
* @param errorCode the error code to be assigned to the new
* <tt>MediaException</tt>
* @param cause the <tt>Throwable</tt> that has caused the necessity to
* log an error and have a new <tt>MediaException</tt> thrown
* @throws MediaException
*/
private void throwMediaException(String message, int errorCode,
Throwable cause) throws MediaException
{
logger.error(message, cause);
throw new MediaException(message, errorCode, cause);
}
/**
* Determines whether a specific SDP description <tt>String</tt> offers
* this party to be put on hold.
@ -788,42 +777,43 @@ public boolean isSdpOfferToHold(String sdpOffer) throws MediaException
}
catch (SdpParseException ex)
{
throwMediaException("Failed to parse SDP offer.",
throw new MediaException("Failed to parse SDP offer.",
MediaException.INTERNAL_ERROR, ex);
}
Vector mediaDescriptions = null;
Vector<MediaDescription> mediaDescriptions = null;
try
{
mediaDescriptions = description.getMediaDescriptions(true);
}
catch (SdpException ex)
{
throwMediaException(
throw new MediaException(
"Failed to get media descriptions from SDP offer.",
MediaException.INTERNAL_ERROR, ex);
}
boolean isOfferToHold = true;
for (Iterator mediaDescriptionIter = mediaDescriptions.iterator(); mediaDescriptionIter
.hasNext()
&& isOfferToHold;)
for (Iterator<MediaDescription> mediaDescriptionIter
= mediaDescriptions.iterator();
mediaDescriptionIter.hasNext()
&& isOfferToHold;)
{
MediaDescription mediaDescription =
(MediaDescription) mediaDescriptionIter.next();
Vector attributes = mediaDescription.getAttributes(false);
Vector<Attribute> attributes
= mediaDescription.getAttributes(false);
isOfferToHold = false;
if (attributes != null)
{
for (Iterator attributeIter = attributes.iterator(); attributeIter
.hasNext()
&& !isOfferToHold;)
for (Iterator<Attribute> attributeIter = attributes.iterator();
attributeIter.hasNext()
&& !isOfferToHold;)
{
try
{
String attribute =
((Attribute) attributeIter.next()).getName();
String attribute = attributeIter.next().getName();
if ("sendonly".equalsIgnoreCase(attribute)
|| "inactive".equalsIgnoreCase(attribute))
@ -833,9 +823,10 @@ public boolean isSdpOfferToHold(String sdpOffer) throws MediaException
}
catch (SdpParseException ex)
{
throwMediaException(
"Failed to get SDP media description attribute name",
MediaException.INTERNAL_ERROR, ex);
throw new MediaException(
"Failed to get SDP media description attribute name",
MediaException.INTERNAL_ERROR,
ex);
}
}
}
@ -868,7 +859,7 @@ public void putOnHold(boolean on, boolean here)
{
onHold &= ~ (here ? ON_HOLD_LOCALLY : ON_HOLD_REMOTELY);
}
applyOnHold();
}
@ -1143,9 +1134,9 @@ else if (streams[i].getFormat() instanceof AudioFormat)
else
{
logger.warn("We are apparently capable of sending a format "
+" that is neither videro nor audio. Is "
+"this really possible?:"
+streams[i].getFormat());
+ " that is neither videro nor audio. Is "
+ "this really possible?:"
+ streams[i].getFormat());
continue;
}
@ -1182,7 +1173,7 @@ else if (streams[i].getFormat() instanceof AudioFormat)
* addresses or set them as targets on our RTPManagers.
*/
private void initStreamTargets(Connection globalConnParam,
Vector mediaDescriptions)
Vector<MediaDescription> mediaDescriptions)
throws MediaException, ParseException
{
try
@ -1192,12 +1183,12 @@ private void initStreamTargets(Connection globalConnParam,
if (globalConnParam != null)
globalConnectionAddress = globalConnParam.getAddress();
Iterator mediaDescsIter = mediaDescriptions.iterator();
Iterator<MediaDescription> mediaDescsIter
= mediaDescriptions.iterator();
while (mediaDescsIter.hasNext())
{
SessionAddress target = null;
MediaDescription mediaDescription
= (MediaDescription) mediaDescsIter.next();
MediaDescription mediaDescription = mediaDescsIter.next();
int port = mediaDescription.getMedia().getMediaPort();
String type = mediaDescription.getMedia().getMediaType();
@ -1228,7 +1219,7 @@ private void initStreamTargets(Connection globalConnParam,
InetAddress inetAddress = null;
try
{
inetAddress = InetAddress.getByName(address);
inetAddress = NetworkUtils.getInetAddress(address);
}
catch (UnknownHostException exc)
{
@ -1244,7 +1235,7 @@ private void initStreamTargets(Connection globalConnParam,
/** @todo the following line assumes that we have a single rtp
* manager per media type which is not necessarily true (e.g. we
* may two distinct video streams: 1 for a webcam video and
* may have two distinct video streams: 1 for a webcam video and
* another one desktop capture stream) */
RTPManager rtpManager = type.equals("video")
? getVideoRtpManager()
@ -1263,11 +1254,6 @@ private void initStreamTargets(Connection globalConnParam,
TransformConnector transConnector =
this.transConnectors.get(rtpManager);
if (transConnector == null)
{
throw new Exception();
}
transConnector.addTarget(target);
}
else
@ -1278,7 +1264,7 @@ private void initStreamTargets(Connection globalConnParam,
logger.trace("added target " + target
+ " for type " + type);
}
catch (Exception exc)
catch (Throwable exc)
{
throw new MediaException("Failed to add RTPManager target."
, MediaException.INTERNAL_ERROR
@ -1342,8 +1328,8 @@ private SessionDescription createSessionDescription(
{
try
{
intendedDestination = InetAddress.getByName(c.
getAddress());
intendedDestination = NetworkUtils.getInetAddress(
c.getAddress());
}
catch (SdpParseException ex)
{
@ -1519,9 +1505,9 @@ private SessionDescription createSessionDescription(
* support any of the offered media formats.
*/
private Vector createMediaDescriptions(
Vector offerMediaDescs,
InetSocketAddress publicAudioAddress,
InetSocketAddress publicVideoAddress)
Vector<MediaDescription> offerMediaDescs,
InetSocketAddress publicAudioAddress,
InetSocketAddress publicVideoAddress)
throws SdpException
,MediaException
{
@ -1543,12 +1529,12 @@ private Vector createMediaDescriptions(
{
Vector<String> offeredVideoEncodings = new Vector<String>();
Vector<String> offeredAudioEncodings = new Vector<String>();
Iterator offerDescsIter = offerMediaDescs.iterator();
Iterator<MediaDescription> offerDescsIter
= offerMediaDescs.iterator();
while (offerDescsIter.hasNext())
{
MediaDescription desc
= (MediaDescription) offerDescsIter.next();
MediaDescription desc = offerDescsIter.next();
Media media = desc.getMedia();
String mediaType = media.getMediaType();
@ -1598,7 +1584,7 @@ private Vector createMediaDescriptions(
// if we support g723 it is in 6.3 bitrate
String g723Str = String.valueOf(SdpConstants.G723);
for (int i = 0; i < supportedAudioEncodings.length; i++)
for (int i = 0; i < supportedAudioEncodings.length; i++)
{
if(supportedAudioEncodings[i].equals(g723Str))
{
@ -1780,7 +1766,7 @@ private Hashtable<String, List<String>> intersectMediaEncodings(
* Returns a <tt>Hashtable</tt> mapping media types (e.g. audio or video) to
* lists of JMF encoding strings corresponding to the SDP formats specified
* in the <tt>mediaDescriptions</tt> vector.
*
*
* @param mediaDescriptions a <tt>Vector</tt> containing
* <tt>MediaDescription</tt> instances extracted from an SDP
* offer or answer.
@ -2064,7 +2050,7 @@ private void initializeRtpManager(RTPManager rtpManager,
ZRTPTransformEngine engine
= (ZRTPTransformEngine)transConnector.getEngine();
// Case 1: user toggled secure communication prior to the call
// Note that this is not possible now as the "secure" button is
// Note that this is not possible now as the "secure" button is
// in the call panel that appears once the call has started
if (usingSRTP)
{
@ -2719,9 +2705,9 @@ public void setSecureCommunicationStatus(boolean activator,
* @param activator type of change - enable/disable communication security
* @param source the source of changing the secure status (local or remote)
*/
private synchronized void fireSecureStatusChanged(boolean activator,
OperationSetSecureTelephony.
SecureStatusChangeSource source)
private synchronized void fireSecureStatusChanged(
boolean activator,
OperationSetSecureTelephony.SecureStatusChangeSource source)
{
if (activator)
{
@ -2748,10 +2734,11 @@ private synchronized void fireSecureStatusChanged(boolean activator,
* will be secure or unsecure
* @param event The secure status changed event
*/
public void ZRTPChangeStatus(RTPManager manager, SecureEvent event)
private void zrtpChangeStatus(RTPManager manager, SecureEvent event)
{
int newStatus = event.getEventID();
OperationSetSecureTelephony.SecureStatusChangeSource source = event.getSource();
OperationSetSecureTelephony.SecureStatusChangeSource source
= event.getSource();
TransformConnector transConnector = this.transConnectors.get(manager);
@ -2811,7 +2798,7 @@ public void secureStatusChanged(SecureEvent secureEvent)
if (selectedKeyProviderAlgorithm.getProviderType() ==
KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER)
{
ZRTPChangeStatus(this.audioRtpManager, secureEvent);
zrtpChangeStatus(this.audioRtpManager, secureEvent);
/* TODO: Video securing related code
*

@ -6,46 +6,44 @@
*/
package net.java.sip.communicator.impl.media.keyshare;
import net.java.sip.communicator.impl.media.transform.srtp.*;
/**
* KeyProvider interface defines the current available provider types,
* and a method to obtain the set type for a provider.
* (Originally the interface contained setter and getter methods for keys
* KeyProvider interface defines the currently available provider types,
* and a method to obtain the set type for a provider.
* (Originally the interface contained setter and getter methods for keys
* and other cryptographic parameters but this were removed due to
* redundancy regarding the fact these are partial provided already inside
* directly in the SRTPTransformEngine class.
* It might still be a viable option.)
*
* It might still be a viable option.)
*
* @author Emanuel Onica (eonica@info.uaic.ro)
*/
public interface KeyProviderAlgorithm
public interface KeyProviderAlgorithm
{
public enum ProviderType
{
DUMMY_PROVIDER,
ZRTP_PROVIDER
};
/**
* Obtains the current provider type for the class implementing the interface
*
* @return the provider type
*/
public ProviderType getProviderType();
/**
* Gets this algorithm's priority of usage in handling the key management
*
* @return the priority of usage in handling the key management
*/
public int getPriority();
/**
* Sets this algorithm's priority of usage in handling the key management
*
* @param priority the priority of usage in handling the key management
*/
public void setPriority(int priority);
public enum ProviderType
{
DUMMY_PROVIDER,
ZRTP_PROVIDER
};
/**
* Obtains the current provider type for the class implementing the interface
*
* @return the provider type
*/
public ProviderType getProviderType();
/**
* Gets this algorithm's priority of usage in handling the key management
*
* @return the priority of usage in handling the key management
*/
public int getPriority();
/**
* Sets this algorithm's priority of usage in handling the key management
*
* @param priority the priority of usage in handling the key management
*/
public void setPriority(int priority);
}

@ -13,25 +13,25 @@
import javax.media.rtp.*;
/**
* TransformConnector implements the RTPConnector interface. RTPConnector
* TransformConnector implements the RTPConnector interface. RTPConnector
* is originally designed for programmers to abstract the underlying transport
* mechanism for RTP control and data from the RTPManager. However, it provides
* the possibility to modify / transform the RTP and RTCP packets before
* the possibility to modify / transform the RTP and RTCP packets before
* they are sent to network, or after the have been received from the network.
*
* The RTPConnector interface is very powerful. But just to perform packets
* transformation, we do not need all the flexibility. So, we designed this
*
* The RTPConnector interface is very powerful. But just to perform packets
* transformation, we do not need all the flexibility. So, we designed this
* TransformConnector, which uses UDP to transfer RTP/RTCP packets just like
* normal RTP stack, and then provides the TransformInputStream interface for
* people to define their own transformation.
*
*
* With TransformConnector, people can implement RTP/RTCP packets transformation
* and/or manipulation by implementing the TransformEngine interface.
*
* and/or manipulation by implementing the TransformEngine interface.
*
* @see TransformEngine
* @see RTPConnector
* @see RTPManager
*
*
* @author Bing SU (nova.su@gmail.com)
*/
public class TransformConnector
@ -39,7 +39,7 @@ public class TransformConnector
{
/**
* The customized TransformEngine object, which contains the concrete
* transform logic.
* transform logic.
*/
protected TransformEngine engine;
@ -52,7 +52,7 @@ public class TransformConnector
* RTP packet input stream object used by RTPManager.
*/
private TransformInputStream dataInputStream;
/**
* RTCP packet input stream object used by RTPManager.
*/
@ -62,7 +62,7 @@ public class TransformConnector
* RTP packet output stream used by RTPManager.
*/
private TransformOutputStream dataOutputStream;
/**
* RTCP packet output stream used by RTPManager.
*/
@ -72,7 +72,7 @@ public class TransformConnector
* UDP Socket we used to send and receive RTP packets.
*/
private DatagramSocket dataSocket;
/**
* UDP Socket we used to send and receive RTCP packets.
*/
@ -81,11 +81,11 @@ public class TransformConnector
/**
* Construct a TransformConnector based on the given local RTP session
* address and a customized TransformEngine.
*
*
* @param localAddr The local listen address of this RTP session
* @param engine TransformEngine object which contains your transformation
* logic
*
*
* @throws InvalidSessionAddressException if session address is invalid,
*/
public TransformConnector(SessionAddress localAddr, TransformEngine engine)
@ -109,7 +109,7 @@ public TransformConnector(SessionAddress localAddr, TransformEngine engine)
}
/**
* Closes this RTPConnector object
* Closes this RTPConnector object
*
* @see javax.media.rtp.RTPConnector#close()
*/
@ -138,12 +138,12 @@ public void close()
}
/**
* Add a stream target. A stream target is the destination address which
* Add a stream target. A stream target is the destination address which
* this RTP session will send its data to. For a single session, we can add
* multiple SessionAddresses, and for each address, one copy of data will be
* sent to.
*
* @param target Destination target address
* @param target Destination target address
*/
public void addTarget(SessionAddress target)
{
@ -174,7 +174,7 @@ public void addTarget(SessionAddress target)
*
* @param target Destination target to be removed
* @return true if the target address is removed successfully
* false if there is something wrong
* false if there is something wrong
*/
public boolean removeTarget(SessionAddress target)
{
@ -329,102 +329,102 @@ public void setSendBufferSize(int size)
{
// Nothing should be done here :-)
}
/**
* Getter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @return the control input stream
*/
public TransformInputStream getCtrlInputStream()
public TransformInputStream getCtrlInputStream()
{
return ctrlInputStream;
}
/**
* Getter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @return the control output stream
*/
public TransformOutputStream getCtrlOutputStream()
public TransformOutputStream getCtrlOutputStream()
{
return ctrlOutputStream;
}
/**
* Setter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @param ctrlOutputStream the control output stream to be set
*/
public void setCtrlOutputStream(TransformOutputStream ctrlOutputStream)
public void setCtrlOutputStream(TransformOutputStream ctrlOutputStream)
{
this.ctrlOutputStream = ctrlOutputStream;
}
/**
* Setter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @param dataInputStream the data input stream to be set
*/
public void setDataInputStream(TransformInputStream dataInputStream)
public void setDataInputStream(TransformInputStream dataInputStream)
{
this.dataInputStream = dataInputStream;
}
/**
* Setter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @param ctrlInputStream the control input stream to be set
*/
public void setCtrlInputStream(TransformInputStream ctrlInputStream)
public void setCtrlInputStream(TransformInputStream ctrlInputStream)
{
this.ctrlInputStream = ctrlInputStream;
}
/**
* Setter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @param dataOutputStream the data output stream to be set
*/
public void setDataOutputStream(TransformOutputStream dataOutputStream)
public void setDataOutputStream(TransformOutputStream dataOutputStream)
{
this.dataOutputStream = dataOutputStream;
}
/**
* Getter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @return the data socket
*/
public DatagramSocket getDataSocket()
public DatagramSocket getDataSocket()
{
return dataSocket;
}
/**
* Getter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @return the control socket
*/
public DatagramSocket getCtrlSocket()
public DatagramSocket getCtrlSocket()
{
return ctrlSocket;
}
/**
* Getter to use in derived classes.
* (Could modify the member variable to protected instead for direct access)
*
* (Could modify the member variable to protected instead for direct access)
*
* @return the engine
*/
public TransformEngine getEngine()
public TransformEngine getEngine()
{
return engine;
}

@ -14,12 +14,12 @@
/**
* TransformOutputStream implements OutputDataStream. It is use by RTPManager
* to send RTP/RTCP packet data out.
*
* In this implementation, UDP socket is used to send the data out. When a
* normal RTP/RTCP packet is passed down from RTPManager, we first transform
*
* In this implementation, UDP socket is used to send the data out. When a
* normal RTP/RTCP packet is passed down from RTPManager, we first transform
* the packet using user define PacketTransformer and then send it out through
* network to all the stream targets.
*
* network to all the stream targets.
*
* @author Bing SU (nova.su@gmail.com)
*/
public class TransformOutputStream
@ -29,7 +29,7 @@ public class TransformOutputStream
* UDP socket used to send packet data
*/
private DatagramSocket socket;
/**
* PacketTransformer used to transform RTP/RTCP packets
*/
@ -39,16 +39,16 @@ public class TransformOutputStream
* Stream targets' ip addresses
*/
private Vector<InetAddress> remoteAddrs;
/**
* Stream targets' ports, corresponding to their ip addresses.
*/
private Vector<Integer> remotePorts;
/**
* Construct a TransformOutputStream based on the given UDP socket and
* PacketTransformer
*
*
* @param socket UDP socket used to send packet data out
* @param transformer PacketTransformer used to transform RTP/RTCP packets
*/
@ -63,7 +63,7 @@ public TransformOutputStream(DatagramSocket socket,
/**
* Add a target to stream targets list
*
*
* @param remoteAddr target ip address
* @param remotePort target port
*/
@ -75,7 +75,7 @@ public void addTarget(InetAddress remoteAddr, int remotePort)
/**
* Remove a target from stream targets list
*
*
* @param remoteAddr target ip address
* @param remotePort target port
* @return true if the target is in stream target list and can be removed
@ -103,14 +103,13 @@ public void removeTargets()
* @see javax.media.rtp.OutputDataStream#write(byte[], int, int)
*/
public int write(byte[] buffer, int offset, int length)
{
// Transformation could be non-inplace, we shall not modify the the old
{
// Transformation could be non-inplace, we shall not modify the old
// buffer
RawPacket pkt = this.transformer.transform(new RawPacket(buffer,
offset,
length));
// This is for the case when the ZRTP engine stops the media stream
// allowing only ZRTP packets
/* TODO GoClear
@ -118,18 +117,18 @@ public int write(byte[] buffer, int offset, int length)
*/
/*
if (pkt == null)
return length;
*/
return length;
*/
for (int i = 0; i < this.remoteAddrs.size(); ++i)
{
InetAddress remoteAddr =
InetAddress remoteAddr =
(InetAddress) this.remoteAddrs.elementAt(i);
int remotePort =
int remotePort =
((Integer) this.remotePorts.elementAt(i)).intValue();
try
{
{
this.socket.send(new DatagramPacket(pkt.getBuffer(),
pkt.getOffset(),
pkt.getLength(),

@ -62,7 +62,7 @@ public String createSdpOffer(InetAddress intendedDestination)
* The method is meant for use by protocol service implementations when
* willing to send an in-dialog invitation to a remote callee to put her
* on/off hold or to send an answer to an offer to be put on/off hold.
*
*
* @param participantSdpDescription the last SDP description of the remote
* callee
* @param on <tt>true</tt> if the SDP description should offer the remote
@ -75,12 +75,12 @@ public String createSdpOffer(InetAddress intendedDestination)
* @throws MediaException
*/
public String createSdpDescriptionForHold(String participantSdpDescription,
boolean on) throws MediaException;
boolean onHold) throws MediaException;
/**
* Determines whether a specific SDP description <tt>String</tt> offers
* this party to be put on hold.
*
*
* @param sdpOffer the SDP description <tt>String</tt> to be examined for
* an offer to this party to be put on hold
* @return <tt>true</tt> if the specified SDP description <tt>String</tt>
@ -96,7 +96,7 @@ public String createSdpDescriptionForHold(String participantSdpDescription,
* For example, a remote request to have this party put off hold cannot
* override an earlier local request to put the remote party on hold.
* </p>
*
*
* @param on <tt>true</tt> to request the media of this
* <tt>CallSession</tt> be put on hold; <tt>false</tt>,
* otherwise
@ -159,20 +159,20 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
* <tt>CallSession</tt>.
*/
public int getAudioPort();
/**
* Returns a URL pointing to a location with call control information for
* Returns a URL pointing to a location with call control information for
* this call or <tt>null</tt> if no such URL is available.
*
*
* @return a URL link to a location with call information or a call control
* web interface for the specified participant or <tt>null</tt> if no such
* web interface for the specified participant or <tt>null</tt> if no such
* URL is available.
*/
public URL getCallInfoURL();
/**
* Determines whether the audio of this session is (set to) mute.
*
*
* @return <tt>true</tt> if the audio of this session is (set to) mute;
* otherwise, <tt>false</tt>
*/
@ -180,7 +180,7 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
/**
* Sets the mute state of the audio of this session.
*
*
* @param mute <tt>true</tt> to mute the audio of this session; otherwise,
* <tt>false</tt>
*/
@ -189,35 +189,35 @@ public void processSdpAnswer(CallParticipant responder, String sdpAnswer)
/**
* Stops and closes the audio and video streams flowing through this
* session.
*
*
* @return <tt>true</tt> if there was an actual change in the streaming i.e.
* the streaming wasn't already stopped before this request;
* <tt>false</tt>, otherwise
*/
public boolean stopStreaming();
/**
/**
* Sets the default secure/unsecure communication status for the supported
* call sessions.
*
* @param activator value of default secure communication status
*
* @param activator value of default secure communication status
* @param source the initiator of the secure status change (can be local or remote)
*/
public void setSecureCommunicationStatus(boolean activator,
public void setSecureCommunicationStatus(boolean activator,
OperationSetSecureTelephony.
SecureStatusChangeSource source);
/**
* Gets the default secure/unsecure communication status for the supported
* call sessions.
*
*
* @return default secure communication status for the supported call sessions
*/
public boolean getSecureCommunicationStatus();
/**
* Gets the call associated with this session
*
* Gets the call associated with this session
*
* @return the call associated with this session
*/
public Call getCall();

@ -13,34 +13,36 @@
*
* @author Emanuel Onica
* @author Romain Kuntz
* @author Emil Ivov
*/
public interface OperationSetSecureTelephony
extends OperationSet
{
{
/**
* Sets the secure state of the call session in which a specific participant
* is involved
*
* @param participant the participant who toggled (or for whom is remotely
*
* @param participant the participant who toggled (or for whom is remotely
* toggled) the secure status change for the call
* @param secure the new secure status
* @param source the source who generated the call change
* @param source the source who generated the call change
*/
public void setSecure(CallParticipant participant, boolean secure,
SecureStatusChangeSource source);
/**
* Gets the secure state of the call session in which a specific participant
* Gets the secure state of the call session in which a specific participant
* is involved
*
*
* @param participant the participant for who the call state is required
* @return the call state
*/
public boolean isSecure(CallParticipant participant);
/**
* Use this to indicate the source of setting the secure status
* of the communication as being the local or remote peer or reverted by local
* of the communication as being the local or remote peer or reverted by
* local
*/
public static enum SecureStatusChangeSource {
SECURE_STATUS_CHANGE_BY_LOCAL,

Loading…
Cancel
Save