libs/jstun-android.patch
author Da Risk <darisk972@gmail.com>
Sat, 26 Dec 2009 17:45:02 +0100
changeset 605 bccd99644eac
parent 445 e1b29b86422c
permissions -rw-r--r--
Change the image for status in the chat activity. various correction in strings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
445
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     1
diff -Nru src-stun/de/javawi/jstun/attribute/ChangedAddress.java src/de/javawi/jstun/attribute/ChangedAddress.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     2
--- src-stun/de/javawi/jstun/attribute/ChangedAddress.java	2009-03-08 13:37:27.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     3
+++ src/de/javawi/jstun/attribute/ChangedAddress.java	2009-10-03 14:47:30.504972058 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     4
@@ -11,11 +11,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     5
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     6
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     7
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     8
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
     9
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    10
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    11
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    12
 public class ChangedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    13
-	private static final Logger LOGGER = LoggerFactory.getLogger(ChangedAddress.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    14
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    15
 	public ChangedAddress() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    16
 		super(MessageAttribute.MessageAttributeType.ChangedAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    17
@@ -24,7 +22,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    18
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    19
 		ChangedAddress ca = new ChangedAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    20
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ca, data);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    21
-		LOGGER.debug("Message Attribute: Changed Address parsed: " + ca.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    22
+		Log.d("Jstun-ChangedAddress", "Message Attribute: Changed Address parsed: " + ca.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    23
 		return ca;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    24
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    25
 }
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    26
diff -Nru src-stun/de/javawi/jstun/attribute/MappedAddress.java src/de/javawi/jstun/attribute/MappedAddress.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    27
--- src-stun/de/javawi/jstun/attribute/MappedAddress.java	2009-03-08 13:36:42.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    28
+++ src/de/javawi/jstun/attribute/MappedAddress.java	2009-10-03 14:47:23.989081351 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    29
@@ -11,11 +11,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    30
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    31
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    32
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    33
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    34
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    35
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    36
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    37
 public class MappedAddress extends MappedResponseChangedSourceAddressReflectedFrom {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    38
-	private static final Logger LOGGER = LoggerFactory.getLogger(MappedAddress.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    39
 	public MappedAddress() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    40
 		super(MessageAttribute.MessageAttributeType.MappedAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    41
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    42
@@ -23,7 +21,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    43
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    44
 		MappedAddress ma = new MappedAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    45
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ma, data);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    46
-		LOGGER.debug("Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    47
+		Log.d("Jstun-MappedAddress", "Message Attribute: Mapped Address parsed: " + ma.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    48
 		return ma;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    49
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    50
 }
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    51
diff -Nru src-stun/de/javawi/jstun/attribute/MessageAttribute.java src/de/javawi/jstun/attribute/MessageAttribute.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    52
--- src-stun/de/javawi/jstun/attribute/MessageAttribute.java	2009-03-08 13:35:52.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    53
+++ src/de/javawi/jstun/attribute/MessageAttribute.java	2009-10-03 14:48:48.776972620 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    54
@@ -11,15 +11,12 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    55
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    56
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    57
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    58
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    59
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    60
-
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    61
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    62
 import de.javawi.jstun.util.Utility;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    63
 import de.javawi.jstun.util.UtilityException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    64
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    65
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    66
 public abstract class MessageAttribute implements MessageAttributeInterface {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    67
-	private static final Logger LOGGER = LoggerFactory.getLogger(MessageAttribute.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    68
 	MessageAttributeType type;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    69
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    70
 	public MessageAttribute() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    71
@@ -104,7 +101,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    72
 				if (type <= 0x7fff) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    73
 					throw new UnknownMessageAttributeException("Unkown mandatory message attribute", intToType(type));
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    74
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    75
-					LOGGER.debug("MessageAttribute with type " + type + " unkown.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    76
+					Log.d("Jstun-MessageAttribute", "MessageAttribute with type " + type + " unkown.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    77
 					ma = Dummy.parse(valueArray);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    78
 					break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    79
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    80
diff -Nru src-stun/de/javawi/jstun/attribute/ReflectedFrom.java src/de/javawi/jstun/attribute/ReflectedFrom.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    81
--- src-stun/de/javawi/jstun/attribute/ReflectedFrom.java	2009-03-08 13:34:16.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    82
+++ src/de/javawi/jstun/attribute/ReflectedFrom.java	2009-10-03 14:48:06.624977962 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    83
@@ -11,11 +11,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    84
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    85
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    86
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    87
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    88
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    89
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    90
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    91
 public class ReflectedFrom extends MappedResponseChangedSourceAddressReflectedFrom {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    92
-	private static final Logger LOGGER = LoggerFactory.getLogger(ReflectedFrom.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    93
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    94
 	public ReflectedFrom() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    95
 		super(MessageAttribute.MessageAttributeType.ReflectedFrom);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    96
@@ -24,7 +22,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    97
 	public static ReflectedFrom parse(byte[] data) throws MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    98
 		ReflectedFrom result = new ReflectedFrom();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
    99
 		MappedResponseChangedSourceAddressReflectedFrom.parse(result, data);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   100
-		LOGGER.debug("Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   101
+		Log.d("Jstun-ReflectedFrom", "Message Attribute: ReflectedFrom parsed: " + result.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   102
 		return result;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   103
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   104
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   105
diff -Nru src-stun/de/javawi/jstun/attribute/ResponseAddress.java src/de/javawi/jstun/attribute/ResponseAddress.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   106
--- src-stun/de/javawi/jstun/attribute/ResponseAddress.java	2009-03-08 13:35:02.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   107
+++ src/de/javawi/jstun/attribute/ResponseAddress.java	2009-10-03 14:49:42.388979100 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   108
@@ -11,12 +11,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   109
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   110
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   111
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   112
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   113
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   114
-
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   115
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   116
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   117
 public class ResponseAddress extends MappedResponseChangedSourceAddressReflectedFrom {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   118
-	private static final Logger LOGGER = LoggerFactory.getLogger(ResponseAddress.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   119
 	public ResponseAddress() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   120
 		super(MessageAttribute.MessageAttributeType.ResponseAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   121
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   122
@@ -24,7 +21,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   123
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   124
 		ResponseAddress ra = new ResponseAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   125
 		MappedResponseChangedSourceAddressReflectedFrom.parse(ra, data);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   126
-		LOGGER.debug("Message Attribute: Response Address parsed: " + ra.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   127
+		Log.d("Jstun-ResponseAddress", "Message Attribute: Response Address parsed: " + ra.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   128
 		return ra;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   129
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   130
 }
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   131
diff -Nru src-stun/de/javawi/jstun/attribute/SourceAddress.java src/de/javawi/jstun/attribute/SourceAddress.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   132
--- src-stun/de/javawi/jstun/attribute/SourceAddress.java	2009-03-08 13:33:15.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   133
+++ src/de/javawi/jstun/attribute/SourceAddress.java	2009-10-03 14:50:35.312972305 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   134
@@ -11,12 +11,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   135
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   136
 package de.javawi.jstun.attribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   137
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   138
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   139
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   140
-
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   141
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   142
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   143
 public class SourceAddress extends MappedResponseChangedSourceAddressReflectedFrom {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   144
-	private static final Logger LOGGER = LoggerFactory.getLogger(SourceAddress.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   145
 	public SourceAddress() {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   146
 		super(MessageAttribute.MessageAttributeType.SourceAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   147
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   148
@@ -24,7 +21,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   149
 	public static MessageAttribute parse(byte[] data) throws MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   150
 		SourceAddress sa = new SourceAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   151
 		MappedResponseChangedSourceAddressReflectedFrom.parse(sa, data);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   152
-		LOGGER.debug("Message Attribute: Source Address parsed: " + sa.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   153
+		Log.d("Jstun-SourceAddress", "Message Attribute: Source Address parsed: " + sa.toString() + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   154
 		return sa;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   155
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   156
 }
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   157
\ No newline at end of file
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   158
diff -Nru src-stun/de/javawi/jstun/header/MessageHeader.java src/de/javawi/jstun/header/MessageHeader.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   159
--- src-stun/de/javawi/jstun/header/MessageHeader.java	2009-03-08 13:54:30.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   160
+++ src/de/javawi/jstun/header/MessageHeader.java	2009-10-03 14:52:58.156973579 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   161
@@ -14,8 +14,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   162
 import java.util.Iterator;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   163
 import java.util.TreeMap;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   164
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   165
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   166
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   167
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   168
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   169
 import de.javawi.jstun.attribute.MessageAttribute;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   170
 import de.javawi.jstun.attribute.MessageAttributeParsingException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   171
@@ -38,7 +37,6 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   172
      *                                                                 |
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   173
      * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   174
 	 */
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   175
-	private static final Logger LOGGER = LoggerFactory.getLogger(MessageHeader.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   176
 	MessageHeaderType type;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   177
 	byte[] id = new byte[16];
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   178
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   179
@@ -169,12 +167,12 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   180
 			System.arraycopy(data, 0, typeArray, 0, 2);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   181
 			int type = Utility.twoBytesToInteger(typeArray);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   182
 			switch (type) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   183
-				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); LOGGER.debug("Binding Request received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   184
-				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); LOGGER.debug("Binding Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   185
-				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); LOGGER.debug("Binding Error Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   186
-				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); LOGGER.debug("Shared Secret Request received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   187
-				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); LOGGER.debug("Shared Secret Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   188
-				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); LOGGER.debug("Shared Secret Error Response received.");break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   189
+				case BINDINGREQUEST: mh.setType(MessageHeaderType.BindingRequest); Log.d("Jstun-MessageHeader", "Binding Request received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   190
+				case BINDINGRESPONSE: mh.setType(MessageHeaderType.BindingResponse); Log.d("Jstun-MessageHeader", "Binding Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   191
+				case BINDINGERRORRESPONSE: mh.setType(MessageHeaderType.BindingErrorResponse); Log.d("Jstun-MessageHeader", "Binding Error Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   192
+				case SHAREDSECRETREQUEST: mh.setType(MessageHeaderType.SharedSecretRequest); Log.d("Jstun-MessageHeader", "Shared Secret Request received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   193
+				case SHAREDSECRETRESPONSE: mh.setType(MessageHeaderType.SharedSecretResponse); Log.d("Jstun-MessageHeader", "Shared Secret Response received."); break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   194
+				case SHAREDSECRETERRORRESPONSE: mh.setType(MessageHeaderType.SharedSecretErrorResponse); Log.d("Jstun-MessageHeader", "Shared Secret Error Response received.");break;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   195
 				default: throw new MessageHeaderParsingException("Message type " + type + "is not supported"); 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   196
 			}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   197
 			return mh;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   198
diff -Nru src-stun/de/javawi/jstun/test/BindingLifetimeTest.java src/de/javawi/jstun/test/BindingLifetimeTest.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   199
--- src-stun/de/javawi/jstun/test/BindingLifetimeTest.java	2009-03-08 13:43:27.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   200
+++ src/de/javawi/jstun/test/BindingLifetimeTest.java	2009-10-03 14:55:31.104990854 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   201
@@ -21,8 +21,8 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   202
 import java.util.Timer;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   203
 import java.util.TimerTask;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   204
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   205
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   206
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   207
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   208
+
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   209
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   210
 import de.javawi.jstun.attribute.ChangeRequest;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   211
 import de.javawi.jstun.attribute.ErrorCode;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   212
@@ -36,7 +36,6 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   213
 import de.javawi.jstun.util.UtilityException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   214
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   215
 public class BindingLifetimeTest {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   216
-	private static final Logger LOGGER = LoggerFactory.getLogger(BindingLifetimeTest.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   217
 	String stunServer;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   218
 	int port;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   219
 	int timeout = 300; //ms
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   220
@@ -70,7 +69,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   221
 		}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   222
 		BindingLifetimeTask task = new BindingLifetimeTask();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   223
 		timer.schedule(task, binarySearchLifetime);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   224
-		LOGGER.debug("Timer scheduled initially: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   225
+		Log.d("Jstun-BindingLifetimeTest", "Timer scheduled initially: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   226
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   227
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   228
 	private boolean bindingCommunicationInitialSocket() throws UtilityException, IOException, MessageHeaderParsingException, MessageAttributeParsingException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   229
@@ -82,7 +81,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   230
 		
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   231
 		DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   232
 		initialSocket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   233
-		LOGGER.debug("Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   234
+		Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   235
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   236
 		MessageHeader receiveMH = new MessageHeader();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   237
 		while (!(receiveMH.equalTransactionID(sendMH))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   238
@@ -94,11 +93,11 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   239
 		ma = (MappedAddress) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.MappedAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   240
 		ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   241
 		if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   242
-			LOGGER.debug("Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   243
+			Log.d("Jstun-BindingLifetimeTest", "Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   244
 			return true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   245
 		}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   246
 		if (ma == null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   247
-			LOGGER.debug("Response does not contain a Mapped Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   248
+			Log.d("Jstun-BindingLifetimeTest", "Response does not contain a Mapped Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   249
 			return true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   250
 		}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   251
 		return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   252
@@ -127,7 +126,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   253
 			try {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   254
 				lifetimeQuery();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   255
 			} catch (Exception e) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   256
-				LOGGER.debug("Unhandled Exception. BindLifetimeTasks stopped.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   257
+				Log.d("Jstun-BindingLifetimeTest", "Unhandled Exception. BindLifetimeTasks stopped.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   258
 				e.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   259
 			}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   260
 		}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   261
@@ -150,7 +149,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   262
 			
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   263
 				DatagramPacket send = new DatagramPacket(data, data.length, InetAddress.getByName(stunServer), port);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   264
 				socket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   265
-				LOGGER.debug("Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   266
+				Log.d("Jstun-BindingLifetimeTest", "Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   267
 		
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   268
 				MessageHeader receiveMH = new MessageHeader();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   269
 				while (!(receiveMH.equalTransactionID(sendMH))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   270
@@ -161,30 +160,30 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   271
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   272
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   273
 				if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   274
-					LOGGER.debug("Message header contains errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   275
+					Log.d("Jstun-BindingLifetimeTest", "Message header contains errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   276
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   277
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   278
-				LOGGER.debug("Binding Response received.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   279
+				Log.d("Jstun-BindingLifetimeTest", "Binding Response received.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   280
 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   281
-					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   282
+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   283
 					completed = true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   284
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   285
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   286
 				lifetime = binarySearchLifetime;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   287
-				LOGGER.debug("Lifetime update: " + lifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   288
+				Log.d("Jstun-BindingLifetimeTest", "Lifetime update: " + lifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   289
 				lowerBinarySearchLifetime = binarySearchLifetime;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   290
 				binarySearchLifetime = (upperBinarySearchLifetime + lowerBinarySearchLifetime) / 2;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   291
 				if (binarySearchLifetime > 0) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   292
 					BindingLifetimeTask task = new BindingLifetimeTask();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   293
 					timer.schedule(task, binarySearchLifetime);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   294
-					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   295
+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   296
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   297
 					completed = true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   298
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   299
 			} catch (SocketTimeoutException ste) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   300
-				LOGGER.debug("Read operation at query socket timeout.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   301
+				Log.d("Jstun-BindingLifetimeTest", "Read operation at query socket timeout.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   302
 				if (upperBinarySearchLifetime == (lowerBinarySearchLifetime + 1)) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   303
-					LOGGER.debug("BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   304
+					Log.d("Jstun-BindingLifetimeTest", "BindingLifetimeTest completed. UDP binding lifetime: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   305
 					completed = true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   306
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   307
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   308
@@ -196,7 +195,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   309
 					}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   310
 					BindingLifetimeTask task = new BindingLifetimeTask();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   311
 					timer.schedule(task, binarySearchLifetime);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   312
-					LOGGER.debug("Timer scheduled: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   313
+					Log.d("Jstun-BindingLifetimeTest", "Timer scheduled: " + binarySearchLifetime + ".");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   314
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   315
 					completed = true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   316
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   317
diff -Nru src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java src/de/javawi/jstun/test/demo/ice/ICENegociator.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   318
--- src-stun/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-03-08 13:40:52.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   319
+++ src/de/javawi/jstun/test/demo/ice/ICENegociator.java	2009-10-03 14:57:51.400971966 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   320
@@ -23,9 +23,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   321
 import java.util.List;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   322
 import java.util.Vector;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   323
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   324
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   325
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   326
-
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   327
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   328
 import de.javawi.jstun.attribute.MessageAttributeException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   329
 import de.javawi.jstun.header.MessageHeaderParsingException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   330
 import de.javawi.jstun.test.DiscoveryInfo;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   331
@@ -35,7 +33,6 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   332
 import de.javawi.jstun.util.UtilityException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   333
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   334
 public class ICENegociator {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   335
-	private static final Logger LOGGER = LoggerFactory.getLogger(ICENegociator.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   336
 	// type preference must be an integer from 0 (=lowest) to 126 (=highest) (inclusive)
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   337
 	private final static int LOCAL_PREFERENCE = 0;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   338
 	private final static int SERVER_REFLEXIVE_PREFERENCE = 42;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   339
@@ -91,29 +88,29 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   340
 								candidates.add(cand);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   341
 							}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   342
 						} catch (MessageHeaderParsingException mhpe) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   343
-							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   344
+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   345
 							mhpe.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   346
 						} catch (MessageAttributeException mae) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   347
-							LOGGER.debug("MessageAttributeException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   348
+							Log.d("Jstun-ICENegociator", "MessageAttributeException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   349
 							mae.printStackTrace();	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   350
 						} catch (UtilityException ue) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   351
-							LOGGER.debug("UtilityException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   352
+							Log.d("Jstun-ICENegociator", "UtilityException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   353
 							ue.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   354
 						} catch (UnknownHostException uhe) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   355
-							LOGGER.debug("MessageHeaderParsingException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   356
+							Log.d("Jstun-ICENegociator", "MessageHeaderParsingException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   357
 							uhe.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   358
 						} catch (SocketException se) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   359
-							LOGGER.debug("SocketException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   360
+							Log.d("Jstun-ICENegociator", "SocketException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   361
 							se.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   362
 						} catch (IOException ioe) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   363
-							LOGGER.debug("IOException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   364
+							Log.d("Jstun-ICENegociator", "IOException while gathering candidate addresses.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   365
 							ioe.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   366
 						}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   367
 					}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   368
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   369
 			}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   370
 		} catch (SocketException se) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   371
-			LOGGER.debug("SocketException while enumatering over the network cards.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   372
+			Log.d("Jstun-ICENegociator", "SocketException while enumatering over the network cards.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   373
 			se.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   374
 		}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   375
 	}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   376
diff -Nru src-stun/de/javawi/jstun/test/demo/StunServer.java src/de/javawi/jstun/test/demo/StunServer.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   377
--- src-stun/de/javawi/jstun/test/demo/StunServer.java	2009-03-08 13:52:00.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   378
+++ src/de/javawi/jstun/test/demo/StunServer.java	2009-10-03 14:57:05.248972557 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   379
@@ -23,8 +23,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   380
 import java.util.logging.Level;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   381
 import java.util.logging.SimpleFormatter;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   382
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   383
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   384
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   385
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   386
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   387
 import de.javawi.jstun.attribute.ChangeRequest;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   388
 import de.javawi.jstun.attribute.ChangedAddress;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   389
@@ -47,7 +46,6 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   390
  * The server requires a machine that is dual-homed to be functional. 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   391
  */
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   392
 public class StunServer {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   393
-	private static final Logger LOGGER = LoggerFactory.getLogger(StunServer.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   394
 	Vector<DatagramSocket> sockets;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   395
 	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   396
 	public StunServer(int primaryPort, InetAddress primary, int secondaryPort, InetAddress secondary) throws SocketException {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   397
@@ -99,12 +97,12 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   398
 				try {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   399
 					DatagramPacket receive = new DatagramPacket(new byte[200], 200);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   400
 					receiverSocket.receive(receive);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   401
-					LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   402
+					Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " datagram received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   403
 					MessageHeader receiveMH = MessageHeader.parseHeader(receive.getData()); 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   404
 					try {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   405
 						receiveMH.parseAttributes(receive.getData());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   406
 						if (receiveMH.getType() == MessageHeaderType.BindingRequest) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   407
-							LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   408
+							Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " Binding Request received from " + receive.getAddress().getHostAddress() + ":" + receive.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   409
 							ChangeRequest cr = (ChangeRequest) receiveMH.getMessageAttribute(MessageAttributeType.ChangeRequest);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   410
 							if (cr == null) throw new MessageAttributeException("Message attribute change request is not set.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   411
 							ResponseAddress ra = (ResponseAddress) receiveMH.getMessageAttribute(MessageAttributeType.ResponseAddress);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   412
@@ -123,7 +121,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   413
 							ca.setPort(changedPortIP.getLocalPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   414
 							sendMH.addMessageAttribute(ca);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   415
 							if (cr.isChangePort() && (!cr.isChangeIP())) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   416
-								LOGGER.debug("Change port received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   417
+								Log.d("Jstun-StunServer", "Change port received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   418
 								// Source address attribute
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   419
 								SourceAddress sa = new SourceAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   420
 								sa.setAddress(new Address(changedPort.getLocalAddress().getAddress()));
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   421
@@ -139,9 +137,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   422
 									send.setAddress(receive.getAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   423
 								}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   424
 								changedPort.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   425
-								LOGGER.debug(changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   426
+								Log.d("Jstun-StunServer", changedPort.getLocalAddress().getHostAddress() + ":" + changedPort.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   427
 							} else if ((!cr.isChangePort()) && cr.isChangeIP()) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   428
-								LOGGER.debug("Change ip received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   429
+								Log.d("Jstun-StunServer", "Change ip received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   430
 								// Source address attribute
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   431
 								SourceAddress sa = new SourceAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   432
 								sa.setAddress(new Address(changedIP.getLocalAddress().getAddress()));
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   433
@@ -157,9 +155,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   434
 									send.setAddress(receive.getAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   435
 								}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   436
 								changedIP.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   437
-								LOGGER.debug(changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   438
+								Log.d("Jstun-StunServer", changedIP.getLocalAddress().getHostAddress() + ":" + changedIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   439
 							} else if ((!cr.isChangePort()) && (!cr.isChangeIP())) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   440
-								LOGGER.debug("Nothing received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   441
+								Log.d("Jstun-StunServer", "Nothing received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   442
 								// Source address attribute
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   443
 								SourceAddress sa = new SourceAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   444
 								sa.setAddress(new Address(receiverSocket.getLocalAddress().getAddress()));
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   445
@@ -175,9 +173,9 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   446
 									send.setAddress(receive.getAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   447
 								}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   448
 								receiverSocket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   449
-								LOGGER.debug(receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   450
+								Log.d("Jstun-StunServer", receiverSocket.getLocalAddress().getHostAddress() + ":" + receiverSocket.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   451
 							} else if (cr.isChangePort() && cr.isChangeIP()) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   452
-								LOGGER.debug("Change port and ip received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   453
+								Log.d("Jstun-StunServer", "Change port and ip received in Change Request attribute");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   454
 								// Source address attribute
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   455
 								SourceAddress sa = new SourceAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   456
 								sa.setAddress(new Address(changedPortIP.getLocalAddress().getAddress()));
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   457
@@ -193,7 +191,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   458
 									send.setAddress(receive.getAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   459
 								}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   460
 								changedPortIP.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   461
-								LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   462
+								Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   463
 							}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   464
 						}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   465
 					} catch (UnknownMessageAttributeException umae) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   466
@@ -212,7 +210,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   467
 						send.setPort(receive.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   468
 						send.setAddress(receive.getAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   469
 						receiverSocket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   470
-						LOGGER.debug(changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   471
+						Log.d("Jstun-StunServer", changedPortIP.getLocalAddress().getHostAddress() + ":" + changedPortIP.getLocalPort() + " send Binding Error Response to " + send.getAddress().getHostAddress() + ":" + send.getPort());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   472
 					}	
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   473
 				} catch (IOException ioe) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   474
 					ioe.printStackTrace();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   475
diff -Nru src-stun/de/javawi/jstun/test/DiscoveryTest.java src/de/javawi/jstun/test/DiscoveryTest.java
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   476
--- src-stun/de/javawi/jstun/test/DiscoveryTest.java	2009-03-08 13:45:49.000000000 +0100
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   477
+++ src/de/javawi/jstun/test/DiscoveryTest.java	2009-10-03 14:56:26.816979238 +0200
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   478
@@ -20,8 +20,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   479
 import java.net.SocketTimeoutException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   480
 import java.net.UnknownHostException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   481
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   482
-import org.slf4j.Logger;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   483
-import org.slf4j.LoggerFactory;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   484
+import android.util.Log;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   485
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   486
 import de.javawi.jstun.attribute.ChangeRequest;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   487
 import de.javawi.jstun.attribute.ChangedAddress;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   488
@@ -35,7 +34,6 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   489
 import de.javawi.jstun.util.UtilityException;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   490
 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   491
 public class DiscoveryTest {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   492
-	private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryTest.class);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   493
 	InetAddress iaddress;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   494
 	String stunServer;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   495
 	int port;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   496
@@ -93,7 +91,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   497
 				byte[] data = sendMH.getBytes();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   498
 				DatagramPacket send = new DatagramPacket(data, data.length);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   499
 				socketTest1.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   500
-				LOGGER.debug("Test 1: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   501
+				Log.d("Jstun-DiscoveryTest", "Test 1: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   502
 			
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   503
 				MessageHeader receiveMH = new MessageHeader();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   504
 				while (!(receiveMH.equalTransactionID(sendMH))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   505
@@ -108,35 +106,35 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   506
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   507
 				if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   508
 					di.setError(ec.getResponseCode(), ec.getReason());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   509
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   510
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   511
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   512
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   513
 				if ((ma == null) || (ca == null)) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   514
 					di.setError(700, "The server is sending an incomplete response (Mapped Address and Changed Address message attributes are missing). The client should not retry.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   515
-					LOGGER.debug("Response does not contain a Mapped Address or Changed Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   516
+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address or Changed Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   517
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   518
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   519
 					di.setPublicIP(ma.getAddress().getInetAddress());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   520
 					if ((ma.getPort() == socketTest1.getLocalPort()) && (ma.getAddress().getInetAddress().equals(socketTest1.getLocalAddress()))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   521
-						LOGGER.debug("Node is not natted.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   522
+						Log.d("Jstun-DiscoveryTest", "Node is not natted.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   523
 						nodeNatted = false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   524
 					} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   525
-						LOGGER.debug("Node is natted.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   526
+						Log.d("Jstun-DiscoveryTest", "Node is natted.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   527
 					}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   528
 					return true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   529
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   530
 			} catch (SocketTimeoutException ste) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   531
 				if (timeSinceFirstTransmission < 7900) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   532
-					LOGGER.debug("Test 1: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   533
+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   534
 					timeSinceFirstTransmission += timeout;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   535
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   536
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   537
 					timeout = timeoutAddValue;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   538
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   539
 					// node is not capable of udp communication
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   540
-					LOGGER.debug("Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   541
+					Log.d("Jstun-DiscoveryTest", "Test 1: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   542
 					di.setBlockedUDP();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   543
-					LOGGER.debug("Node is not capable of UDP communication.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   544
+					Log.d("Jstun-DiscoveryTest", "Node is not capable of UDP communication.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   545
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   546
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   547
 			} 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   548
@@ -164,7 +162,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   549
 				byte[] data = sendMH.getBytes(); 
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   550
 				DatagramPacket send = new DatagramPacket(data, data.length);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   551
 				sendSocket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   552
-				LOGGER.debug("Test 2: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   553
+				Log.d("Jstun-DiscoveryTest", "Test 2: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   554
 				
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   555
 				int localPort = sendSocket.getLocalPort();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   556
 				InetAddress localAddress = sendSocket.getLocalAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   557
@@ -185,29 +183,29 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   558
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   559
 				if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   560
 					di.setError(ec.getResponseCode(), ec.getReason());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   561
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   562
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   563
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   564
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   565
 				if (!nodeNatted) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   566
 					di.setOpenAccess();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   567
-					LOGGER.debug("Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   568
+					Log.d("Jstun-DiscoveryTest", "Node has open access to the Internet (or, at least the node is behind a full-cone NAT without translation).");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   569
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   570
 					di.setFullCone();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   571
-					LOGGER.debug("Node is behind a full-cone NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   572
+					Log.d("Jstun-DiscoveryTest", "Node is behind a full-cone NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   573
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   574
 				return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   575
 			} catch (SocketTimeoutException ste) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   576
 				if (timeSinceFirstTransmission < 7900) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   577
-					LOGGER.debug("Test 2: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   578
+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   579
 					timeSinceFirstTransmission += timeout;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   580
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   581
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   582
 					timeout = timeoutAddValue;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   583
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   584
-					LOGGER.debug("Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   585
+					Log.d("Jstun-DiscoveryTest", "Test 2: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   586
 					if (!nodeNatted) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   587
 						di.setSymmetricUDPFirewall();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   588
-						LOGGER.debug("Node is behind a symmetric UDP firewall.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   589
+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric UDP firewall.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   590
 						return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   591
 					} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   592
 						// not is natted
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   593
@@ -238,7 +236,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   594
 				byte[] data = sendMH.getBytes();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   595
 				DatagramPacket send = new DatagramPacket(data, data.length);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   596
 				socketTest1.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   597
-				LOGGER.debug("Test 1 redo with changed address: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   598
+				Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   599
 				
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   600
 				MessageHeader receiveMH = new MessageHeader();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   601
 				while (!(receiveMH.equalTransactionID(sendMH))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   602
@@ -251,30 +249,30 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   603
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   604
 				if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   605
 					di.setError(ec.getResponseCode(), ec.getReason());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   606
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   607
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   608
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   609
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   610
 				if (ma2 == null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   611
 					di.setError(700, "The server is sending an incomplete response (Mapped Address message attribute is missing). The client should not retry.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   612
-					LOGGER.debug("Response does not contain a Mapped Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   613
+					Log.d("Jstun-DiscoveryTest", "Response does not contain a Mapped Address message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   614
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   615
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   616
 					if ((ma.getPort() != ma2.getPort()) || (!(ma.getAddress().getInetAddress().equals(ma2.getAddress().getInetAddress())))) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   617
 						di.setSymmetric();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   618
-						LOGGER.debug("Node is behind a symmetric NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   619
+						Log.d("Jstun-DiscoveryTest", "Node is behind a symmetric NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   620
 						return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   621
 					}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   622
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   623
 				return true;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   624
 			} catch (SocketTimeoutException ste2) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   625
 				if (timeSinceFirstTransmission < 7900) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   626
-					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   627
+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   628
 					timeSinceFirstTransmission += timeout;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   629
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   630
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   631
 					timeout = timeoutAddValue;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   632
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   633
-					LOGGER.debug("Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   634
+					Log.d("Jstun-DiscoveryTest", "Test 1 redo with changed address: Socket timeout while receiving the response.  Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   635
 					return false;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   636
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   637
 			}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   638
@@ -301,7 +299,7 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   639
 				byte[] data = sendMH.getBytes();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   640
 				DatagramPacket send = new DatagramPacket(data, data.length);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   641
 				sendSocket.send(send);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   642
-				LOGGER.debug("Test 3: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   643
+				Log.d("Jstun-DiscoveryTest", "Test 3: Binding Request sent.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   644
 				
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   645
 				int localPort = sendSocket.getLocalPort();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   646
 				InetAddress localAddress = sendSocket.getLocalAddress();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   647
@@ -322,25 +320,25 @@
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   648
 				ErrorCode ec = (ErrorCode) receiveMH.getMessageAttribute(MessageAttribute.MessageAttributeType.ErrorCode);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   649
 				if (ec != null) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   650
 					di.setError(ec.getResponseCode(), ec.getReason());
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   651
-					LOGGER.debug("Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   652
+					Log.d("Jstun-DiscoveryTest", "Message header contains an Errorcode message attribute.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   653
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   654
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   655
 				if (nodeNatted) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   656
 					di.setRestrictedCone();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   657
-					LOGGER.debug("Node is behind a restricted NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   658
+					Log.d("Jstun-DiscoveryTest", "Node is behind a restricted NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   659
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   660
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   661
 			} catch (SocketTimeoutException ste) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   662
 				if (timeSinceFirstTransmission < 7900) {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   663
-					LOGGER.debug("Test 3: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   664
+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   665
 					timeSinceFirstTransmission += timeout;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   666
 					int timeoutAddValue = (timeSinceFirstTransmission * 2);
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   667
 					if (timeoutAddValue > 1600) timeoutAddValue = 1600;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   668
 					timeout = timeoutAddValue;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   669
 				} else {
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   670
-					LOGGER.debug("Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   671
+					Log.d("Jstun-DiscoveryTest", "Test 3: Socket timeout while receiving the response. Maximum retry limit exceed. Give up.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   672
 					di.setPortRestrictedCone();
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   673
-					LOGGER.debug("Node is behind a port restricted NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   674
+					Log.d("Jstun-DiscoveryTest", "Node is behind a port restricted NAT.");
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   675
 					return;
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   676
 				}
e1b29b86422c ajout de la lib jstun et de son patch
Nikita Kozlov <nikita@beem-project.com>
parents:
diff changeset
   677
 			}