[ice4j] r142 committed - Improves handling of MessageIntegrity, Fingerprint, and Software attri...

ice4j at googlecode.com ice4j at googlecode.com
Sun Apr 25 17:49:47 CEST 2010


Revision: 142
Author: emcho at sip-communicator.org
Date: Sun Apr 25 07:44:53 2010
Log: Improves handling of MessageIntegrity, Fingerprint, and Software  
attributes
http://code.google.com/p/ice4j/source/detail?r=142

Modified:
  /trunk/src/org/ice4j/message/Message.java

=======================================
--- /trunk/src/org/ice4j/message/Message.java	Sun Apr 25 07:44:29 2010
+++ /trunk/src/org/ice4j/message/Message.java	Sun Apr 25 07:44:53 2010
@@ -12,6 +12,8 @@
  import org.ice4j.attribute.*;
  import org.ice4j.stack.*;

+import sun.tools.tree.*;
+
  /**
   * This class represents a STUN message. STUN messages are TLV  
(type-length-value)
   * encoded using big endian (network ordered) binary.  All STUN messages  
start
@@ -568,7 +570,7 @@
      {
          //remove MESSAGE-INTEGRITY and FINGERPRINT attributes so that we  
can
          //make sure they are added at the end.
-        Attribute msgIntegrity =  
removeAttribute(Attribute.MESSAGE_INTEGRITY);
+        Attribute msgIntAttr =  
removeAttribute(Attribute.MESSAGE_INTEGRITY);
          Attribute fingerprint  = removeAttribute(Attribute.FINGERPRINT);

          //add a SOFTWARE attribute if the user said so, and unless they  
did it
@@ -582,7 +584,24 @@
                              .createSoftwareAttribute(software.getBytes()));
          }

-
+        //re-add MESSAGE-INTEGRITY if there was one.
+        if (msgIntAttr != null)
+        {
+            addAttribute(msgIntAttr);
+        }
+
+        //add FINGERPRINT if there was one or if user told us to add it
+        //everywhere.
+        if (fingerprint == null
+            && Boolean.getBoolean(StackProperties.ALWAYS_SIGN));
+        {
+            fingerprint = AttributeFactory.createFingerprintAttribute();
+        }
+
+        if (fingerprint != null)
+        {
+            addAttribute(fingerprint);
+        }

      }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: commits-help at sip-communicator.dev.java.net





More information about the commits mailing list