Permalink
Browse files

Merge branch 'master' into bugfix/tcp-harvester-interface-reuse

  • Loading branch information...
Roberto Andrade
Roberto Andrade committed Aug 5, 2015
2 parents b8ff856 + 26200ea commit 9f03488376e1fd51173871656bde92cf4fe40c52
Showing with 138 additions and 55 deletions.
  1. +5 −0 .gitignore
  2. +2 −2 build.xml
  3. +38 −2 pom.xml
  4. 0 src/{ → main/java}/org/ice4j/AbstractResponseCollector.java
  5. 0 src/{ → main/java}/org/ice4j/BaseStunMessageEvent.java
  6. 0 src/{ → main/java}/org/ice4j/ChannelDataMessageEvent.java
  7. 0 src/{ → main/java}/org/ice4j/PeerUdpMessageEvent.java
  8. 0 src/{ → main/java}/org/ice4j/ResponseCollector.java
  9. 0 src/{ → main/java}/org/ice4j/StackProperties.java
  10. 0 src/{ → main/java}/org/ice4j/StunException.java
  11. 0 src/{ → main/java}/org/ice4j/StunFailureEvent.java
  12. 0 src/{ → main/java}/org/ice4j/StunMessageEvent.java
  13. 0 src/{ → main/java}/org/ice4j/StunResponseEvent.java
  14. 0 src/{ → main/java}/org/ice4j/StunTimeoutEvent.java
  15. 0 src/{ → main/java}/org/ice4j/Transport.java
  16. 0 src/{ → main/java}/org/ice4j/TransportAddress.java
  17. 0 src/{ → main/java}/org/ice4j/attribute/AddressAttribute.java
  18. 0 src/{ → main/java}/org/ice4j/attribute/AlternateServerAttribute.java
  19. 0 src/{ → main/java}/org/ice4j/attribute/Attribute.java
  20. 0 src/{ → main/java}/org/ice4j/attribute/AttributeDecoder.java
  21. 0 src/{ → main/java}/org/ice4j/attribute/AttributeFactory.java
  22. 0 src/{ → main/java}/org/ice4j/attribute/ChangeRequestAttribute.java
  23. 0 src/{ → main/java}/org/ice4j/attribute/ChangedAddressAttribute.java
  24. 0 src/{ → main/java}/org/ice4j/attribute/ChannelNumberAttribute.java
  25. 0 src/{ → main/java}/org/ice4j/attribute/ConnectionIdAttribute.java
  26. 0 src/{ → main/java}/org/ice4j/attribute/ContentDependentAttribute.java
  27. +17 −12 src/{ → main/java}/org/ice4j/attribute/DataAttribute.java
  28. 0 src/{ → main/java}/org/ice4j/attribute/DestinationAddressAttribute.java
  29. 0 src/{ → main/java}/org/ice4j/attribute/DontFragmentAttribute.java
  30. 0 src/{ → main/java}/org/ice4j/attribute/ErrorCodeAttribute.java
  31. 0 src/{ → main/java}/org/ice4j/attribute/EvenPortAttribute.java
  32. 0 src/{ → main/java}/org/ice4j/attribute/FingerprintAttribute.java
  33. 0 src/{ → main/java}/org/ice4j/attribute/IceControlAttribute.java
  34. 0 src/{ → main/java}/org/ice4j/attribute/IceControlledAttribute.java
  35. 0 src/{ → main/java}/org/ice4j/attribute/IceControllingAttribute.java
  36. 0 src/{ → main/java}/org/ice4j/attribute/LifetimeAttribute.java
  37. 0 src/{ → main/java}/org/ice4j/attribute/MagicCookieAttribute.java
  38. 0 src/{ → main/java}/org/ice4j/attribute/MappedAddressAttribute.java
  39. 0 src/{ → main/java}/org/ice4j/attribute/MessageIntegrityAttribute.java
  40. 0 src/{ → main/java}/org/ice4j/attribute/NonceAttribute.java
  41. 0 src/{ → main/java}/org/ice4j/attribute/OptionalAttribute.java
  42. 0 src/{ → main/java}/org/ice4j/attribute/PriorityAttribute.java
  43. 0 src/{ → main/java}/org/ice4j/attribute/RealmAttribute.java
  44. 0 src/{ → main/java}/org/ice4j/attribute/ReflectedFromAttribute.java
  45. 0 src/{ → main/java}/org/ice4j/attribute/RemoteAddressAttribute.java
  46. 0 src/{ → main/java}/org/ice4j/attribute/RequestedAddressFamilyAttribute.java
  47. 0 src/{ → main/java}/org/ice4j/attribute/RequestedTransportAttribute.java
  48. 0 src/{ → main/java}/org/ice4j/attribute/ReservationTokenAttribute.java
  49. 0 src/{ → main/java}/org/ice4j/attribute/ResponseAddressAttribute.java
  50. 0 src/{ → main/java}/org/ice4j/attribute/SoftwareAttribute.java
  51. 0 src/{ → main/java}/org/ice4j/attribute/SourceAddressAttribute.java
  52. 0 src/{ → main/java}/org/ice4j/attribute/UnknownAttributesAttribute.java
  53. 0 src/{ → main/java}/org/ice4j/attribute/UseCandidateAttribute.java
  54. 0 src/{ → main/java}/org/ice4j/attribute/UsernameAttribute.java
  55. 0 src/{ → main/java}/org/ice4j/attribute/XorMappedAddressAttribute.java
  56. 0 src/{ → main/java}/org/ice4j/attribute/XorOnlyAttribute.java
  57. 0 src/{ → main/java}/org/ice4j/attribute/XorPeerAddressAttribute.java
  58. 0 src/{ → main/java}/org/ice4j/attribute/XorRelayedAddressAttribute.java
  59. +11 −1 src/{ → main/java}/org/ice4j/ice/Agent.java
  60. +22 −14 src/{ → main/java}/org/ice4j/ice/Candidate.java
  61. 0 src/{ → main/java}/org/ice4j/ice/CandidateExtendedType.java
  62. 0 src/{ → main/java}/org/ice4j/ice/CandidatePair.java
  63. 0 src/{ → main/java}/org/ice4j/ice/CandidatePairState.java
  64. 0 src/{ → main/java}/org/ice4j/ice/CandidatePrioritizer.java
  65. 0 src/{ → main/java}/org/ice4j/ice/CandidateTcpType.java
  66. 0 src/{ → main/java}/org/ice4j/ice/CandidateType.java
  67. 0 src/{ → main/java}/org/ice4j/ice/CheckList.java
  68. 0 src/{ → main/java}/org/ice4j/ice/CheckListState.java
  69. +4 −10 src/{ → main/java}/org/ice4j/ice/Component.java
  70. 0 src/{ → main/java}/org/ice4j/ice/ConnectivityCheckClient.java
  71. 0 src/{ → main/java}/org/ice4j/ice/ConnectivityCheckServer.java
  72. 0 src/{ → main/java}/org/ice4j/ice/DefaultNominator.java
  73. 0 src/{ → main/java}/org/ice4j/ice/FoundationsRegistry.java
  74. 0 src/{ → main/java}/org/ice4j/ice/GoogleRelayedCandidate.java
  75. 0 src/{ → main/java}/org/ice4j/ice/HostCandidate.java
  76. 0 src/{ → main/java}/org/ice4j/ice/IceMediaStream.java
  77. 0 src/{ → main/java}/org/ice4j/ice/IceProcessingState.java
  78. 0 src/{ → main/java}/org/ice4j/ice/LocalCandidate.java
  79. 0 src/{ → main/java}/org/ice4j/ice/NetworkUtils.java
  80. 0 src/{ → main/java}/org/ice4j/ice/NominationStrategy.java
  81. 0 src/{ → main/java}/org/ice4j/ice/PeerReflexiveCandidate.java
  82. 0 src/{ → main/java}/org/ice4j/ice/RelayedCandidate.java
  83. 0 src/{ → main/java}/org/ice4j/ice/RemoteCandidate.java
  84. 0 src/{ → main/java}/org/ice4j/ice/ServerReflexiveCandidate.java
  85. 0 src/{ → main/java}/org/ice4j/ice/TcpHostCandidate.java
  86. 0 src/{ → main/java}/org/ice4j/ice/UPNPCandidate.java
  87. 0 src/{ → main/java}/org/ice4j/ice/harvest/AwsCandidateHarvester.java
  88. 0 src/{ → main/java}/org/ice4j/ice/harvest/CandidateHarvester.java
  89. 0 src/{ → main/java}/org/ice4j/ice/harvest/CandidateHarvesterSet.java
  90. 0 src/{ → main/java}/org/ice4j/ice/harvest/CandidateHarvesterSetElement.java
  91. 0 src/{ → main/java}/org/ice4j/ice/harvest/CandidateHarvesterSetTask.java
  92. 0 src/{ → main/java}/org/ice4j/ice/harvest/GoogleTurnCandidateHarvest.java
  93. 0 src/{ → main/java}/org/ice4j/ice/harvest/GoogleTurnCandidateHarvester.java
  94. 0 src/{ → main/java}/org/ice4j/ice/harvest/GoogleTurnSSLCandidateHarvester.java
  95. 0 src/{ → main/java}/org/ice4j/ice/harvest/HarvestStatistics.java
  96. 0 src/{ → main/java}/org/ice4j/ice/harvest/HostCandidateHarvester.java
  97. 0 src/{ → main/java}/org/ice4j/ice/harvest/MappingCandidateHarvester.java
  98. 0 src/{ → main/java}/org/ice4j/ice/harvest/MultiplexingTcpHostHarvester.java
  99. 0 src/{ → main/java}/org/ice4j/ice/harvest/SinglePortUdpHarvester.java
  100. 0 src/{ → main/java}/org/ice4j/ice/harvest/StunCandidateHarvest.java
  101. 0 src/{ → main/java}/org/ice4j/ice/harvest/StunCandidateHarvester.java
  102. 0 src/{ → main/java}/org/ice4j/ice/harvest/TrickleCallback.java
  103. 0 src/{ → main/java}/org/ice4j/ice/harvest/TurnCandidateHarvest.java
  104. 0 src/{ → main/java}/org/ice4j/ice/harvest/TurnCandidateHarvester.java
  105. 0 src/{ → main/java}/org/ice4j/ice/harvest/UPNPHarvester.java
  106. +36 −9 src/{ → main/java}/org/ice4j/ice/sdp/CandidateAttribute.java
  107. 0 src/{ → main/java}/org/ice4j/ice/sdp/IceSdpUtils.java
  108. 0 src/{ → main/java}/org/ice4j/message/ChannelData.java
  109. 0 src/{ → main/java}/org/ice4j/message/Indication.java
  110. 0 src/{ → main/java}/org/ice4j/message/Message.java
  111. 0 src/{ → main/java}/org/ice4j/message/MessageFactory.java
  112. 0 src/{ → main/java}/org/ice4j/message/Request.java
  113. 0 src/{ → main/java}/org/ice4j/message/Response.java
  114. 0 src/{ → main/java}/org/ice4j/pseudotcp/EnShutdown.java
  115. 0 src/{ → main/java}/org/ice4j/pseudotcp/IPseudoTcpNotify.java
  116. 0 src/{ → main/java}/org/ice4j/pseudotcp/Option.java
  117. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTCPBase.java
  118. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpJavaSocket.java
  119. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpNotify.java
  120. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpSocket.java
  121. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpSocketFactory.java
  122. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpSocketImpl.java
  123. 0 src/{ → main/java}/org/ice4j/pseudotcp/PseudoTcpState.java
  124. 0 src/{ → main/java}/org/ice4j/pseudotcp/RSegment.java
  125. 0 src/{ → main/java}/org/ice4j/pseudotcp/SSegment.java
  126. 0 src/{ → main/java}/org/ice4j/pseudotcp/Segment.java
  127. 0 src/{ → main/java}/org/ice4j/pseudotcp/SendFlags.java
  128. 0 src/{ → main/java}/org/ice4j/pseudotcp/WriteResult.java
  129. 0 src/{ → main/java}/org/ice4j/pseudotcp/util/ByteFifoBuffer.java
  130. 0 src/{ → main/java}/org/ice4j/security/CredentialsAuthority.java
  131. 0 src/{ → main/java}/org/ice4j/security/CredentialsManager.java
  132. 0 src/{ → main/java}/org/ice4j/security/LongTermCredential.java
  133. 0 src/{ → main/java}/org/ice4j/security/LongTermCredentialSession.java
  134. 0 src/{ → main/java}/org/ice4j/socket/BaseDelegatingServerSocketChannel.java
  135. 0 src/{ → main/java}/org/ice4j/socket/BaseDelegatingSocketChannel.java
  136. 0 src/{ → main/java}/org/ice4j/socket/DTLSDatagramFilter.java
  137. 0 src/{ → main/java}/org/ice4j/socket/DatagramPacketFilter.java
  138. 0 src/{ → main/java}/org/ice4j/socket/DatagramSocketFactory.java
  139. 0 src/{ → main/java}/org/ice4j/socket/DelegatingDatagramSocket.java
  140. 0 src/{ → main/java}/org/ice4j/socket/DelegatingServerSocket.java
  141. 0 src/{ → main/java}/org/ice4j/socket/DelegatingSocket.java
  142. 0 src/{ → main/java}/org/ice4j/socket/GoogleRelayedCandidateDatagramSocket.java
  143. 0 src/{ → main/java}/org/ice4j/socket/GoogleRelayedCandidateDelegate.java
  144. 0 src/{ → main/java}/org/ice4j/socket/GoogleRelayedCandidateSocket.java
  145. 0 src/{ → main/java}/org/ice4j/socket/HttpDemuxFilter.java
  146. 0 src/{ → main/java}/org/ice4j/socket/IceSocketWrapper.java
  147. 0 src/{ → main/java}/org/ice4j/socket/IceTcpServerSocketWrapper.java
  148. 0 src/{ → main/java}/org/ice4j/socket/IceTcpSocketWrapper.java
  149. 0 src/{ → main/java}/org/ice4j/socket/IceUdpSocketWrapper.java
  150. 0 src/{ → main/java}/org/ice4j/socket/MultiplexedDatagramSocket.java
  151. 0 src/{ → main/java}/org/ice4j/socket/MultiplexedSocket.java
  152. 0 src/{ → main/java}/org/ice4j/socket/MultiplexingDatagramSocket.java
  153. 0 src/{ → main/java}/org/ice4j/socket/MultiplexingSocket.java
  154. 0 src/{ → main/java}/org/ice4j/socket/MuxServerSocketChannelFactory.java
  155. 0 src/{ → main/java}/org/ice4j/socket/RelayedCandidateDatagramSocket.java
  156. 0 src/{ → main/java}/org/ice4j/socket/RtcpDemuxPacketFilter.java
  157. 0 src/{ → main/java}/org/ice4j/socket/SafeCloseDatagramSocket.java
  158. 0 src/{ → main/java}/org/ice4j/socket/SocketReceiveBuffer.java
  159. 0 src/{ → main/java}/org/ice4j/socket/StunDatagramPacketFilter.java
  160. 0 src/{ → main/java}/org/ice4j/socket/TCPInputStream.java
  161. 0 src/{ → main/java}/org/ice4j/socket/TCPOutputStream.java
  162. 0 src/{ → main/java}/org/ice4j/socket/TurnDatagramPacketFilter.java
  163. 0 src/{ → main/java}/org/ice4j/socket/jdk8/DelegatingServerSocketChannel.java
  164. 0 src/{ → main/java}/org/ice4j/socket/jdk8/DelegatingSocketChannel.java
  165. 0 src/{ → main/java}/org/ice4j/socket/jdk8/MuxServerSocketChannel.java
  166. 0 src/{ → main/java}/org/ice4j/socket/jdk8/PreReadSocketChannel.java
  167. 0 src/{ → main/java}/org/ice4j/stack/ChannelDataEventHandler.java
  168. 0 src/{ → main/java}/org/ice4j/stack/Connector.java
  169. 0 src/{ → main/java}/org/ice4j/stack/ErrorHandler.java
  170. 0 src/{ → main/java}/org/ice4j/stack/EventDispatcher.java
  171. 0 src/{ → main/java}/org/ice4j/stack/MessageEventHandler.java
  172. 0 src/{ → main/java}/org/ice4j/stack/MessageProcessor.java
  173. 0 src/{ → main/java}/org/ice4j/stack/MessageQueue.java
  174. 0 src/{ → main/java}/org/ice4j/stack/NetAccessManager.java
  175. 0 src/{ → main/java}/org/ice4j/stack/PacketLogger.java
  176. 0 src/{ → main/java}/org/ice4j/stack/PeerUdpMessageEventHandler.java
  177. 0 src/{ → main/java}/org/ice4j/stack/RawMessage.java
  178. 0 src/{ → main/java}/org/ice4j/stack/RequestListener.java
  179. 0 src/{ → main/java}/org/ice4j/stack/StunClientTransaction.java
  180. 0 src/{ → main/java}/org/ice4j/stack/StunServerTransaction.java
  181. 0 src/{ → main/java}/org/ice4j/stack/StunStack.java
  182. 0 src/{ → main/java}/org/ice4j/stack/TransactionID.java
  183. 0 src/{ → main/java}/org/ice4j/stunclient/BlockingRequestSender.java
  184. 0 src/{ → main/java}/org/ice4j/stunclient/NetworkConfigurationDiscoveryProcess.java
  185. 0 src/{ → main/java}/org/ice4j/stunclient/SimpleAddressDetector.java
  186. 0 src/{ → main/java}/org/ice4j/stunclient/StunDiscoveryReport.java
  187. 0 src/{ → main/java}/org/ice4j/util/Ice4jLogFormatter.java
  188. 0 {test → src/test/java}/org/ice4j/MessageEventDispatchingTest.java
  189. 0 {test → src/test/java}/org/ice4j/MsgFixture.java
  190. 0 {test → src/test/java}/org/ice4j/PseudoTcpTestSuite.java
  191. 0 {test → src/test/java}/org/ice4j/StunTestSuite.java
  192. 0 {test → src/test/java}/org/ice4j/TransactionSupportTests.java
  193. 0 {test → src/test/java}/org/ice4j/attribute/AddressAttributeTest.java
  194. 0 {test → src/test/java}/org/ice4j/attribute/AttributeDecoderTest.java
  195. 0 {test → src/test/java}/org/ice4j/attribute/ChangeRequestAttributeTest.java
  196. 0 {test → src/test/java}/org/ice4j/attribute/ConnectionIdAttributeTest.java
  197. 0 {test → src/test/java}/org/ice4j/attribute/ErrorCodeAttributeTest.java
  198. 0 {test → src/test/java}/org/ice4j/attribute/NonceAttributeTest.java
  199. 0 {test → src/test/java}/org/ice4j/attribute/OptionalAttributeAttributeTest.java
  200. 0 {test → src/test/java}/org/ice4j/attribute/RealmAttributeTest.java
  201. 0 {test → src/test/java}/org/ice4j/attribute/RequestedAddressFamilyAttributeTest.java
  202. 0 {test → src/test/java}/org/ice4j/attribute/SoftwareAttributeTest.java
  203. 0 {test → src/test/java}/org/ice4j/attribute/UnknownAttributesAttributeTest.java
  204. 0 {test → src/test/java}/org/ice4j/attribute/UsernameAttributeTest.java
  205. 0 {test → src/test/java}/org/ice4j/attribute/XorOnlyTest.java
  206. 0 {test → src/test/java}/org/ice4j/message/MessageFactoryTest.java
  207. 0 {test → src/test/java}/org/ice4j/message/MessageTest.java
  208. 0 {test → src/test/java}/org/ice4j/pseudotcp/MultiThreadSupportTest.java
  209. 0 {test → src/test/java}/org/ice4j/pseudotcp/PseudoTcpStreamTest.java
  210. 0 {test → src/test/java}/org/ice4j/pseudotcp/PseudoTcpTestBase.java
  211. 0 {test → src/test/java}/org/ice4j/pseudotcp/PseudoTcpTestPingPong.java
  212. 0 {test → src/test/java}/org/ice4j/pseudotcp/PseudoTcpTestRecvWindow.java
  213. 0 {test → src/test/java}/org/ice4j/pseudotcp/PseudoTcpTestTransfer.java
  214. 0 {test → src/test/java}/org/ice4j/pseudotcp/util/ByteFifoBufferTest.java
  215. 0 {test → src/test/java}/org/ice4j/stack/DatagramCollector.java
  216. 0 {test → src/test/java}/org/ice4j/stack/ShallowStackTest.java
  217. 0 {test → src/test/java}/org/ice4j/stunclient/ResponseSequenceServer.java
  218. 0 {test → src/test/java}/org/ice4j/stunclient/StunAddressDiscovererTest.java
  219. 0 {test → src/test/java}/org/ice4j/stunclient/StunAddressDiscovererTest_v4v6.java
  220. 0 {test → src/test/java}/org/ice4j/stunclient/StunAddressDiscovererTest_v6.java
  221. 0 {test → src/test/java}/test/AwsTest.java
  222. 0 {test → src/test/java}/test/Ice.java
  223. 0 {test → src/test/java}/test/IceDistributed.java
  224. 0 {test → src/test/java}/test/IceLite.java
  225. 0 {test → src/test/java}/test/IcePseudoTcp.java
  226. 0 {test → src/test/java}/test/MappingTest.java
  227. +3 −5 {test → src/test/java}/test/SdpUtils.java
  228. 0 {test → src/test/java}/test/TrickleIce.java
  229. 0 {test → src/test/java}/test/signalling/Signalling.java
  230. 0 {test → src/test/java}/test/signalling/SignallingCallback.java
View
@@ -0,0 +1,5 @@
/classes/
/classes-test/
/junit-reports/
/target/
/ice4j.jar
View
@@ -5,8 +5,8 @@
<property name="dest-test" value="classes-test"/>
<property name="lib" value="lib"/>
<property name="JUnit.home" value="${lib}"/>
<property name="src" value="src"/>
<property name="src2" value="test"/>
<property name="src" value="src/main/java"/>
<property name="src2" value="src/test/java"/>
<property name="junit.reports" value="junit-reports"/>
<property name="junit.html.reports" value="${junit.reports}/html"/>
<property name="ice4j.jar" value="ice4j.jar"/>
View
40 pom.xml
@@ -36,8 +36,17 @@
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*TestSuite.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
@@ -60,4 +69,31 @@
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>jitsi-maven-repository-releases</id>
<layout>default</layout>
<name>Jitsi Maven Repository (Releases)</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/</url>
</repository>
<repository>
<id>jitsi-maven-repository-snapshots</id>
<layout>default</layout>
<name>Jitsi Maven Repository (Snapshots)</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/snapshots/</url>
</repository>
</repositories>
</project>
@@ -38,22 +38,23 @@
*
* Some dialect does not add (and support) padding (GTalk).
*/
private boolean padding = true;
private final boolean padding;
/**
* Constructor.
*/
protected DataAttribute ()
protected DataAttribute()
{
this(true);
}
/**
* Constructor.
*/
protected DataAttribute (boolean padding)
protected DataAttribute(boolean padding)
{
super(DATA);
this.padding = padding;
}
@@ -80,22 +81,26 @@ void decodeAttributeBody(byte[] attributeValue, char offset, char length)
*/
public byte[] encode()
{
char dataLength = getDataLength();
char type = getAttributeType();
byte binValue[] = new byte[HEADER_LENGTH + getDataLength() +
(padding ? (getDataLength() % 4) : 0)];
byte binary[]
= new byte[
HEADER_LENGTH
+ dataLength
+ (padding ? ((4 - dataLength % 4) % 4) : 0)];
//Type
binValue[0] = (byte)(type >> 8);
binValue[1] = (byte)(type & 0x00FF);
binary[0] = (byte)(type >> 8);
binary[1] = (byte)(type & 0x00FF);
//Length
binValue[2] = (byte)(getDataLength() >> 8);
binValue[3] = (byte)(getDataLength() & 0x00FF);
binary[2] = (byte)(dataLength >> 8);
binary[3] = (byte)(dataLength & 0x00FF);
//data
System.arraycopy(data, 0, binValue, 4, getDataLength());
System.arraycopy(data, 0, binary, 4, dataLength);
return binValue;
return binary;
}
/**
@@ -169,4 +174,4 @@ public boolean equals(Object obj)
return true;
}
}
}
@@ -178,7 +178,7 @@
* repair the case where both agents believe to have the controlling or the
* controlled role.
*/
private final long tieBreaker;
private long tieBreaker;
/**
* Determines whether this is the controlling agent in a an ICE interaction.
@@ -311,6 +311,16 @@ public Agent()
nominator = new DefaultNominator(this);
}
/**
* Sets the tie breaker value. Note that to this should be set early (before
* connectivity checks start).
* @param tieBreakerInput the value to set.
*/
public void setTieBreaker(long tieBreakerInput)
{
tieBreaker = tieBreakerInput;
}
/**
* Creates a new media stream and stores it.
*
@@ -773,24 +773,32 @@ public String toShortString()
*/
protected int getDefaultPreference()
{
if( getType() == CandidateType.RELAYED_CANDIDATE)
// https://tools.ietf.org/html/rfc5245#section-4.1.4
//
// It is RECOMMENDED that default candidates be chosen based on the
// likelihood of those candidates to work with the peer that is being
// contacted. It is RECOMMENDED that the default candidates are the
// relayed candidates (if relayed candidates are available), server
// reflexive candidates (if server reflexive candidates are available),
// and finally host candidates.
switch (getType())
{
case RELAYED_CANDIDATE:
return 30;
if( getType() == CandidateType.SERVER_REFLEXIVE_CANDIDATE)
return 10;
case SERVER_REFLEXIVE_CANDIDATE:
return 20;
if( getType() == CandidateType.HOST_CANDIDATE)
{
//prefer IPv4 as default since many servers would still freak out
//when seeing IPv6 address.
if(getTransportAddress().isIPv6())
return 20;
else
return 25;
}
case HOST_CANDIDATE:
// Prefer IPv4 as default since many servers would still freak out
// when seeing IPv6 address.
return getTransportAddress().isIPv6() ? 10 : 15;
//WTF?
return 5;
default:
// WTF?
return 5;
}
}
/**
@@ -691,21 +691,15 @@ protected void selectDefaultCandidate()
{
synchronized(localCandidates)
{
Iterator<LocalCandidate> localCandsIter
= localCandidates.iterator();
Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
while (localCandsIter.hasNext())
{
LocalCandidate cand = localCandsIter.next();
if(this.defaultCandidate == null)
{
this.defaultCandidate = cand;
continue;
}
if( defaultCandidate.getDefaultPreference()
< cand.getDefaultPreference())
if ((defaultCandidate == null)
|| (defaultCandidate.getDefaultPreference()
< cand.getDefaultPreference()))
{
defaultCandidate = cand;
}
@@ -28,7 +28,12 @@
/**
* The Candidate that we will be encapsulating.
*/
private final Candidate<?> candidate;
private Candidate<?> candidate;
protected CandidateAttribute()
{
this(null);
}
/**
* Creates an attribute instance
@@ -40,6 +45,29 @@ public CandidateAttribute(Candidate<?> candidate)
this.candidate = candidate;
}
/**
* {@inheritDoc}
*/
public NameValue getAttribute()
{
// We've overridden the method getValue() of AttributeField. The
// NameValue pair of the method getAttribute() should return the value of
// the method getValue() of AttributeField then. Unfortunately, NameValue
// accesses its field value in multiple places so it is not a question of
// simply overriding a method or two. As a compromise, initialize a new
// NameValue with the current name and value upon each invocation.
NameValue attribute = super.getAttribute();
String name = getName();
if ((attribute == null)
|| (name.equals(attribute.getName())
&& (attribute.getValue() == null)))
{
attribute = new NameValue(name, getValue());
}
return attribute;
}
/**
* Returns the name of this attribute
*
@@ -69,8 +97,6 @@ public boolean hasValue()
return true;
}
;
/**
* Returns the value of this attribute.
*
@@ -111,10 +137,9 @@ public String getValue()
* @throws javax.sdp.SdpException if there's a problem with the <tt>value
* String</tt>.
*/
public void setValue(String value) throws
SdpException
public void setValue(String value)
throws SdpException
{
}
/**
@@ -134,7 +159,10 @@ public char getTypeChar()
*/
public CandidateAttribute clone()
{
return null;
CandidateAttribute clone = (CandidateAttribute) super.clone();
clone.candidate = candidate;
return clone;
}
/**
@@ -149,5 +177,4 @@ public String encode()
sbuff.append(getValue());
return sbuff.append(Separators.NEWLINE).toString();
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -92,12 +92,10 @@ public static void parseSDP(Agent localAgent, String sdp)
continue;
Vector<Attribute> attributes = desc.getAttributes(true);
for( Attribute attribute : attributes)
for (Attribute attribute : attributes)
{
if(!attribute.getName().equals(CandidateAttribute.NAME))
continue;
parseCandidate(attribute, stream);
if (attribute.getName().equals(CandidateAttribute.NAME))
parseCandidate(attribute, stream);
}
//set default candidates
File renamed without changes.

0 comments on commit 9f03488

Please sign in to comment.