Merge branch 'master' of https://github.com/jitsi/ice4j into pmaster

This commit is contained in:
ubivent-seuffert 2016-06-01 16:15:55 +02:00
commit ded13aa230
251 changed files with 14092 additions and 9973 deletions

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jain-sdp.jar"/>
<classpathentry kind="lib" path="lib/junit.jar"/>
<classpathentry kind="lib" path="lib/weupnp-0.1.2-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/xalan-2.6.0.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>

4
.gitignore vendored
View File

@ -3,3 +3,7 @@
/junit-reports/
/target/
/ice4j.jar
.classpath
.project
.settings/
bin/

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ice4j</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,35 +1,12 @@
<table width='70%' align='justify' border='0'>
<tr>
<td width='15px' align='center' valign='top'>
ice4j
=====
The Interactive Connectivity Establishment (ICE) protocol combines various NAT traversal utilities such as the STUN and TURN protocols in order to offer a powerful mechanism that allows Offer/Answer based protocols such as SIP and XMPP to traverse NATs.
<p align='center'>
<a href='http://jitsi.org'>
<img src='http://jitsi.org/wiki/pub/sip-communicator/sc_logo139x208.white.png' alt='jitsi.org' title='jitsi.org' />
</a>
This project provides a Java implementation of the ICE protocol that would be usable by both SIP and XMPP applications. The project also provides features such as socket sharing and support for Pseudo TCP.
<a href='http://jitsi.org'>jitsi.org</a> <br />Secure Open Source Video Calls & Chat</p></td>
ice4j is maintained by the [Jitsi](https://jitsi.org/) community. Use Jitsi's [dev mailing list](https://jitsi.org/Development/MailingLists) for questions and discussions.
<td align='justify'>
<h1>ice4j.org</h1>
The Interactive Connectivity Establishment (ICE) protocol combines various NAT traversal utilities such as the STUN and TURN protocols in order to offer a powerful mechanism that allows Offer/Answer based protocols such as SIP and XMPP to traverse NATs.<br>
<br>
This project provides a Java implementation of the ICE protocol that would be usable by both SIP and XMPP applications. The project also provides features such as socket sharing and support for Pseudo TCP.<br>
<br>
This project is maintained by the <a href='http://jitsi.org'>Jitsi</a> community. Use Jitsi's <a href='http://www.jitsi.org/index.php/Development/MailingLists#dev|dev'>dev mailing list</a> for questions and discussions.<br>
<br>
Javadocs for the ice4j API are <a href='http://dev.jitsi.org/ice4j/javadoc/'>available here</a>.<br>
</td>
Thanks
------
Work on this project was graciously funded by the [NLnet Foundation](https://nlnet.nl/). Thank you!
</tr>
<tr align='justify'>
<td width='15%' align='center' valign='top'>
<a href='http://nlnet.nl'>
<img src='http://nlnet.nl/image/logo.gif' alt='NLnet Foundation' title='NLnet foundation' />
</a>
</td>
<td align='justify'>
Work on this project is graciously funded by the <a href='http://nlnet.nl'>NLnet Foundation</a>. Thank you!<br>
</td>
</tr>
</table>

306
build.xml
View File

@ -1,306 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="ice4j" basedir="." default="rebuild">
<property name="dest" value="classes"/>
<property name="dest-test" value="classes-test"/>
<property name="lib" value="lib"/>
<property name="JUnit.home" value="${lib}"/>
<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"/>
<property name="doc" value="doc"/>
<property name="java.doc" value="${doc}/api"/>
<path id="project.class.path">
<pathelement location="${dest}"/>
<pathelement location="${lib}/jain-sdp.jar"/>
<pathelement location="${lib}/weupnp-0.1.2-SNAPSHOT.jar"/>
</path>
<path id="test.class.path">
<path refid="project.class.path" />
<pathelement location="${dest-test}"/>
<pathelement location="${JUnit.home}/junit.jar"/>
</path>
<!--Patternset to exclude files from the output directory:-->
<patternset id="dest.exclude">
<exclude name="package cache/"/>
<exclude name="dependency cache/"/>
<exclude name="test/"/>
</patternset>
<!-- ANT TARGETS -->
<!-- compiles all classes -->
<target name="compile" depends="init">
<condition property="compile.javac.exclude.name" value="**/jdk8/**">
<not>
<matches string="${java.runtime.version}" pattern="^1\.8(\..*)?$"/>
</not>
</condition>
<javac classpathref="project.class.path"
debug="true"
deprecation="true"
destdir="${dest}"
includeantruntime="false"
nowarn="false"
optimize="true"
source="1.5"
target="1.5">
<compilerarg value="-Xlint"/>
<src path="${src}"/>
<exclude name="${compile.javac.exclude.name}"/>
</javac>
</target>
<!-- compiles all tests -->
<target name="compile-tests" depends="init">
<javac classpathref="test.class.path"
debug="true"
deprecation="true"
destdir="${dest-test}"
nowarn="false"
optimize="true"
target="1.5"
source="1.5">
<src path="${src2}"/>
<compilerarg value="-Xlint"/>
</javac>
</target>
<!-- copies ressource files if any to the classes directory -->
<target name="resource">
<copy todir="${dest}">
<fileset dir="${src}">
<include name="**/*.jpe"/>
<include name="**/*.jpeg"/>
<include name="**/*.rmf"/>
<include name="**/*.wav"/>
<include name="**/*.mid"/>
<include name="**/*.midi"/>
<include name="**/*.au"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.aiff"/>
<include name="**/*.properties"/>
</fileset>
<fileset dir="${src2}">
<include name="**/*.jpe"/>
<include name="**/*.jpeg"/>
<include name="**/*.rmf"/>
<include name="**/*.wav"/>
<include name="**/*.mid"/>
<include name="**/*.midi"/>
<include name="**/*.au"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.aiff"/>
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<!-- creates the javadocs -->
<target name="javadoc">
<javadoc author="true" destdir="${java.doc}" package="true">
<fileset dir="${src}"/>
</javadoc>
</target>
<!-- delete the contents of the classes directory-->
<target name="clean">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${dest}"/>
<fileset dir="${dest-test}"/>
<fileset dir="${junit.reports}"/>
<fileset dir="doc" />
</delete>
<delete file="${ice4j.jar}" failonerror="true" quiet="false"/>
</target>
<!-- make everything -->
<target name="make" depends="compile,compile-tests,resource,jar"/>
<!-- clean and make everything -->
<target name="rebuild" depends="clean,make" />
<!-- make javadoc -->
<target name="doc" depends="make,javadoc" />
<!-- create needed subdirs-->
<target name="init">
<mkdir dir="${dest}"/>
<mkdir dir="${dest-test}"/>
<mkdir dir="${junit.reports}"/>
<mkdir dir="${junit.html.reports}"/>
</target>
<!-- create jar file-->
<target name="jar" depends="compile">
<jar compress="true" destfile="${ice4j.jar}">
<fileset dir="${dest}">
<patternset refid="dest.exclude"/>
<include name="**/*.*"/>
</fileset>
</jar>
</target>
<!-- We use this target from within the test target in order to generate
a human readable test report. We do not directly use the htmlreport
target because we need to include xalan in the classpath before we
do.-->
<target name="htmlreport">
<junitreport todir="${junit.reports}">
<fileset dir="${junit.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.html.reports}"/>
</junitreport>
</target>
<!-- Run the tests-->
<target name="test" depends="compile-tests">
<junit haltonfailure="true" fork="true" forkmode="once">
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<test name="org.ice4j.StunTestSuite" todir="${junit.reports}"/>
<test name="org.ice4j.PseudoTcpTestSuite" todir="${junit.reports}"/>
<classpath refid="test.class.path"/>
</junit>
<!-- Generate the html report.
Run it quietly (i.e. redirect the output) because we don't won't to
see its "Build Successful" output line as users might confuse it
for a general build success while this might not be the case.-->
<echo message="Generating HTML test reports ..."/>
<java fork="true"
classname="org.apache.tools.ant.launch.Launcher"
classpath="${java.class.path}:${lib}/xalan-2.6.0.jar"
failonerror="true"
output="${junit.html.reports}/output.txt">
<arg value="htmlreport"/>
</java>
</target>
<!-- runs our sample application -->
<target name="run-sample">
<java fork="true"
classname="test.Ice"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- Run pseudotcp sample application -->
<target name="run-pseudotcp" depends="compile">
<java fork="true"
classname="test.IcePseudoTcp"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- Debug pseudotcp example on port 5005 -->
<target name="debug-pseudotcp" depends="compile">
<java fork="true"
classname="test.IcePseudoTcp"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" />
</java>
</target>
<!-- Debug pseudotcp example with netbeans -->
<target name="nb-debug-pseudotcp" depends="compile">
<nbjpdastart addressproperty="jpda.address" name="ice4j" transport="dt_socket">
<classpath refid="test.class.path"/>
</nbjpdastart>
<java classname="test.IcePseudoTcp" fork="true">
<classpath refid="test.class.path"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample distributed application -->
<target name="run-dist">
<java fork="true"
classname="test.IceDistributed"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample Trickle ICE application -->
<target name="run-trickle">
<java fork="true"
classname="test.TrickleIce"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample lite application -->
<target name="run-lite">
<java fork="true"
classname="test.IceLite"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample NAT mapping application -->
<target name="run-map">
<java fork="true"
classname="test.MappingTest"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample aws application -->
<target name="run-aws">
<java fork="true"
classname="test.AwsTest"
classpathref="test.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- Cruise Control Target-->
<target name="cc-buildloop" depends="rebuild,test"/>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

189
pom.xml
View File

@ -1,27 +1,33 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jitsi</groupId>
<artifactId>jitsi-universe</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../jitsi-universe/pom.xml</relativePath>
<artifactId>jitsi-universe-public</artifactId>
<version>1.0</version>
</parent>
<artifactId>ice4j</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<version>1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>ice4j</name>
<url>https://github.com/jitsi/ice4j</url>
<scm>
<url>https://github.com/jitsi/ice4j</url>
<connection>scm:git:https://github.com/jitsi/ice4j.git</connection>
<developerConnection>scm:git:https://github.com/jitsi/ice4j.git</developerConnection>
<tag>HEAD</tag>
</scm>
<dependencies>
<dependency>
<groupId>javax.sdp</groupId>
<artifactId>jain-sdp</artifactId>
<groupId>org.opentelecoms.sdp</groupId>
<artifactId>java-sdp-nist-bridge</artifactId>
</dependency>
<dependency>
<groupId>org.jitsi</groupId>
<artifactId>jain-sip-ri-ossonly</artifactId>
</dependency>
<dependency>
<groupId>org.bitlet</groupId>
@ -46,7 +52,36 @@
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<classpathScope>test</classpathScope>
<systemProperties>
<systemProperty>
<key>java.util.logging.config.file</key>
<value>logging.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
@ -68,32 +103,110 @@
</plugins>
</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>
<profile>
<id>run-sample</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.Ice</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-pseudotcp</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.IcePseudoTcp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-dist</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.IceDistributed</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-trickle</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.TrickleIce</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-lite</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.IceLite</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-map</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.MappingTest</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>run-aws</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>test.AwsTest</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;
@ -99,6 +110,9 @@ public class ChannelDataMessageEvent
/**
* Gets the <tt>TransportAddress</tt> which is local address on which this
* event was received.
*
* @return the <tt>TransportAddress</tt> which is local address on which
* this event was received.
*/
public TransportAddress getLocalAddress()
{

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;
@ -156,7 +166,7 @@ public class StackProperties
* addresses that are allowed to be used for host candidate allocations.
*
* NOTE: this is currently only supported by
* {@link org.ice4j.ice.harvest.MultiplexingTcpHostHarvester}.
* {@link org.ice4j.ice.harvest.TcpHarvester}.
*/
public static final String ALLOWED_ADDRESSES
= "org.ice4j.ice.harvest.ALLOWED_ADDRESSES";
@ -173,7 +183,7 @@ public class StackProperties
* addresses that are not allowed to be used for host candidate allocations.
*
* NOTE: this is currently only supported by
* {@link org.ice4j.ice.harvest.MultiplexingTcpHostHarvester}.
* {@link org.ice4j.ice.harvest.TcpHarvester}.
*/
public static final String BLOCKED_ADDRESSES
= "org.ice4j.ice.harvest.BLOCKED_ADDRESSES";
@ -235,7 +245,7 @@ public class StackProperties
String[] parts = str.split(regex);
// Remove mal-formatted entries.
List<String> res = new ArrayList<String>();
List<String> res = new ArrayList<>();
for (String s : parts)
if (s != null && s.trim().length() != 0)
res.add(s);

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j;
@ -205,7 +216,7 @@ public class TransportAddress
* address if both the InetAddresses (or hostnames if it is unresolved),
* port numbers, and <tt>Transport</tt>s are equal.
*
* If both addresses are unresolved, then the hostname, the port & and
* If both addresses are unresolved, then the hostname, the port and
* the <tt>Transport</tt> are compared.
*
* @param obj the object to compare against.

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -13,34 +24,32 @@ import org.ice4j.*;
/**
* This class is used to represent Stun attributes that contain an address. Such
* attributes are:
*<p>
* MAPPED-ADDRESS <br/>
* RESPONSE-ADDRESS <br/>
* SOURCE-ADDRESS <br/>
* CHANGED-ADDRESS <br/>
* REFLECTED-FROM <br/>
* ALTERNATE-SERVER <br/>
* XOR-PEER-ADDRESS <br/>
* XOR-RELAYED-ADDRESS <br/>
*</p>
*<ul>
* <li>MAPPED-ADDRESS
* <li>RESPONSE-ADDRESS
* <li>SOURCE-ADDRESS
* <li>CHANGED-ADDRESS
* <li>REFLECTED-FROM
* <li>ALTERNATE-SERVER
* <li>XOR-PEER-ADDRESS
* <li>XOR-RELAYED-ADDRESS
*</ul>
*<p>
* The different attributes are distinguished by the attributeType of
* org.ice4j.attribute.Attribute.
*</p>
* {@link Attribute}.
*<p>
* Address attributes indicate the mapped IP address and
* port. They consist of an eight bit address family, and a sixteen bit
* port, followed by a fixed length value representing the IP address.
*<code>
* 0 1 2 3 <br/>
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* |x x x x x x x x| Family | Port | <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* | Address | <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* <br/>
* </p>
*<pre>
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |x x x x x x x x| Family | Port |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Address |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
* <p>
* The port is a network byte ordered representation of the mapped port.
* The address family is always 0x01, corresponding to IPv4. The first
@ -150,8 +159,7 @@ abstract class AddressAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof AddressAttribute)
|| obj == null)
if (! (obj instanceof AddressAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -11,52 +22,53 @@ import org.ice4j.*;
/**
* After the header are 0 or more attributes. Each attribute is TLV
* encoded, with a 16 bit type, 16 bit length, and variable value:
*<pre>
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Type | Length |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Value ....
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* 0 1 2 3 <br/>
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* | Type | Length | <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* | Value .... <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
*<br/>
* The following types are defined:<br/>
*<br/>
* STUN attributes:<br/>
* 0x0001: MAPPED-ADDRESS <br/>
* 0x0002: RESPONSE-ADDRESS <br/>
* 0x0003: CHANGE-REQUEST <br/>
* 0x0004: SOURCE-ADDRESS <br/>
* 0x0005: CHANGED-ADDRESS <br/>
* 0x0006: USERNAME <br/>
* 0x0007: PASSWORD <br/>
* 0x0008: MESSAGE-INTEGRITY <br/>
* 0x0009: ERROR-CODE <br/>
* 0x000a: UNKNOWN-ATTRIBUTES <br/>
* 0x000b: REFLECTED-FROM <br/>
* 0x0014: REALM <br/>
* 0x0015: NONCE <br/>
* 0x0020: XOR-MAPPED-ADDRESS <br/>
* 0x8022: SOFTWARE <br/>
* 0x8023: ALTERNATE-SERVER <br/>
* 0x8028: FINGERPRINT <br/>
* <br/>
* TURN attributes:<br/>
* 0x000C: CHANNEL-NUMBER <br/>
* 0x000D: LIFETIME <br/>
* 0x0012: XOR-PEER-ADDRESS <br/>
* 0x0013: DATA <br/>
* 0x0016: XOR-RELAYED-ADDRESS <br/>
* 0x0018: EVEN-PORT <br/>
* 0x0019: REQUESTED-TRANSPORT <br/>
* 0x001A: DONT-FRAGMENT <br/>
* 0x0022: RESERVATION-TOKEN <br/>
* The following types are defined:
*
* ICE attributes:<br/>
* 0x0024: PRIORITY <br/>
* 0x0025: USE-CANDIDATE <br/>
* 0x8029: ICE-CONTROLLED <br/>
* 0x802A: ICE-CONTROLLING <br/>
* STUN attributes:
* 0x0001: MAPPED-ADDRESS
* 0x0002: RESPONSE-ADDRESS
* 0x0003: CHANGE-REQUEST
* 0x0004: SOURCE-ADDRESS
* 0x0005: CHANGED-ADDRESS
* 0x0006: USERNAME
* 0x0007: PASSWORD
* 0x0008: MESSAGE-INTEGRITY
* 0x0009: ERROR-CODE
* 0x000a: UNKNOWN-ATTRIBUTES
* 0x000b: REFLECTED-FROM
* 0x0014: REALM
* 0x0015: NONCE
* 0x0020: XOR-MAPPED-ADDRESS
* 0x8022: SOFTWARE
* 0x8023: ALTERNATE-SERVER
* 0x8028: FINGERPRINT
*
* TURN attributes:
* 0x000C: CHANNEL-NUMBER
* 0x000D: LIFETIME
* 0x0012: XOR-PEER-ADDRESS
* 0x0013: DATA
* 0x0016: XOR-RELAYED-ADDRESS
* 0x0018: EVEN-PORT
* 0x0019: REQUESTED-TRANSPORT
* 0x001A: DONT-FRAGMENT
* 0x0022: RESERVATION-TOKEN
*
* ICE attributes:
* 0x0024: PRIORITY
* 0x0025: USE-CANDIDATE
* 0x8029: ICE-CONTROLLED
* 0x802A: ICE-CONTROLLING
* </pre>
*
* @author Emil Ivov
* @author Sebastien Vincent

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -43,10 +54,10 @@ public class AttributeDecoder
}
//Discover attribute type
char attributeType = (char)((bytes[offset] << 8) | bytes[offset + 1]);
int len1 = bytes[offset + 2] & 0xff;
int len2 = bytes[offset + 3] & 0xff;
char attributeLength = (char)((len1 << 8) | len2);
char attributeType = (char)
(((bytes[offset] & 0xFF) << 8) | (bytes[offset + 1] & 0xFF));
char attributeLength = (char)
(((bytes[offset + 2] & 0xFF) << 8) | (bytes[offset + 3] & 0xFF));
if(attributeLength > bytes.length - offset )
throw new StunException( StunException.ILLEGAL_ARGUMENT,

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -533,7 +544,8 @@ public class AttributeFactory
*
* @param priority the priority value
* @return the created PriorityAttribute
* @throws IllegalArgumentException if priority < 0 or priority > (2^31 - 1)
* @throws IllegalArgumentException if priority &lt; 0 or priority &gt;
* (2^31 - 1)
*/
public static PriorityAttribute createPriorityAttribute(long priority)
throws IllegalArgumentException

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -13,13 +24,13 @@ import org.ice4j.*;
* attribute is used by the client to request that the server use a different
* address and/or port when sending the response. The attribute is 32 bits
* long, although only two bits (A and B) are used:
*
* 0 1 2 3 <br/>
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
* |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A B 0| <br/>
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
*
* <pre>
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A B 0|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* </pre>
* The meaning of the flags is:
*
* A: This is the "change IP" flag. If true, it requests the server
@ -89,8 +100,7 @@ public class ChangeRequestAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof ChangeRequestAttribute)
|| obj == null)
if (! (obj instanceof ChangeRequestAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -49,8 +60,7 @@ public class ChannelNumberAttribute extends Attribute
@Override
public boolean equals(Object obj)
{
if (! (obj instanceof ChannelNumberAttribute)
|| obj == null)
if (! (obj instanceof ChannelNumberAttribute))
return false;
if (obj == this)
@ -158,7 +168,7 @@ public class ChannelNumberAttribute extends Attribute
/**
* Determines if the channelNo is in valid range.
* @param channelNo the channelNo to validate.
* @return true if channnelNo is >= 0x4000.
* @return true if channnelNo is &gt;= 0x4000.
*/
public static boolean isValidRange(char channelNo)
{

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -41,7 +52,7 @@ public class DataAttribute
private final boolean padding;
/**
* Constructor.
* Creates a new instance of this class with padding enabled.
*/
protected DataAttribute()
{
@ -49,7 +60,9 @@ public class DataAttribute
}
/**
* Constructor.
* Creates a new instance of this class.
* @param padding true to pad the data if the length is not on a word
* boundary.
*/
protected DataAttribute(boolean padding)
{
@ -159,8 +172,7 @@ public class DataAttribute
public boolean equals(Object obj)
{
if (! (obj instanceof DataAttribute)
|| obj == null)
if (! (obj instanceof DataAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -43,11 +54,8 @@ public class DontFragmentAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof DontFragmentAttribute)
|| obj == null)
{
if (! (obj instanceof DontFragmentAttribute))
return false;
}
return true;
}

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -477,8 +488,7 @@ public class ErrorCodeAttribute extends Attribute
@Override
public boolean equals(Object obj)
{
if (! (obj instanceof ErrorCodeAttribute)
|| obj == null)
if (! (obj instanceof ErrorCodeAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -13,8 +24,8 @@ import org.ice4j.*;
* server to allocate an even port and optionally allocate
* the next higher port number.
*
* There are one flag supported : <br/>
* R : ask to reserve a second port.<br/>
* There is one flag supported: <br>
* R : ask to reserve a second port.
*
* @author Sebastien Vincent
*/
@ -51,8 +62,7 @@ public class EvenPortAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof EvenPortAttribute)
|| obj == null)
if (! (obj instanceof EvenPortAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -111,7 +122,7 @@ public class FingerprintAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof FingerprintAttribute) || obj == null)
if (! (obj instanceof FingerprintAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -63,14 +74,14 @@ public abstract class IceControlAttribute
// the attributeValue array
// Reading in the network byte order (Big-Endian)
tieBreaker = ((attributeValue[offset++] & 0xffl) << 56)
| ((attributeValue[offset++] & 0xffl) << 48)
| ((attributeValue[offset++] & 0xffl) << 40)
| ((attributeValue[offset++] & 0xffl) << 32)
| ((attributeValue[offset++] & 0xffl) << 24)
| ((attributeValue[offset++] & 0xffl) << 16)
| ((attributeValue[offset++] & 0xffl) << 8)
| (attributeValue[offset++] & 0xffl);
tieBreaker = ((attributeValue[offset++] & 0xffL) << 56)
| ((attributeValue[offset++] & 0xffL) << 48)
| ((attributeValue[offset++] & 0xffL) << 40)
| ((attributeValue[offset++] & 0xffL) << 32)
| ((attributeValue[offset++] & 0xffL) << 24)
| ((attributeValue[offset++] & 0xffL) << 16)
| ((attributeValue[offset++] & 0xffL) << 8)
| (attributeValue[offset] & 0xffL);
}
/**
@ -114,8 +125,7 @@ public abstract class IceControlAttribute
*/
public boolean equals(Object obj)
{
if(!(obj instanceof IceControlAttribute)
|| obj == null)
if(!(obj instanceof IceControlAttribute))
return false;
if(obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -50,8 +61,7 @@ public class LifetimeAttribute
@Override
public boolean equals(Object obj)
{
if (! (obj instanceof LifetimeAttribute)
|| obj == null)
if (! (obj instanceof LifetimeAttribute))
return false;
if (obj == this)
@ -133,7 +143,7 @@ public class LifetimeAttribute
throw new StunException("length invalid");
}
lifetime = ((attributeValue[offset + 0] << 24) & 0xff000000) +
lifetime = ((attributeValue[offset] << 24) & 0xff000000) +
((attributeValue[offset + 1] << 16) & 0x00ff0000) +
((attributeValue[offset + 2] << 8) & 0x0000ff00) +
(attributeValue[offset + 3] & 0x000000ff);

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -72,8 +83,7 @@ public class MagicCookieAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof LifetimeAttribute)
|| obj == null)
if (! (obj instanceof MagicCookieAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -26,7 +37,6 @@ import org.ice4j.stack.*;
* The key for the HMAC depends on whether long-term or short-term
* credentials are in use. For long-term credentials, the key is 16
* bytes:
* <p>
* <pre>
* key = MD5(username ":" realm ":" SASLprep(password))
* </pre>
@ -43,7 +53,6 @@ import org.ice4j.stack.*;
* 0x8493fbc53ba582fb4c044c456bdc40eb.
* <p>
* For short-term credentials:
* <p>
* <pre>
* key = SASLprep(password)
* </pre>
@ -271,7 +280,8 @@ public class MessageIntegrityAttribute
binValue[3] = (byte)(getDataLength() & 0x00FF);
byte[] key = null;
char msgType = (char)((content[0] << 8) + content[1]);
char msgType =
(char) (((content[0] & 0xFF) << 8) | (content[1] & 0xFF));
if(Message.isRequestType(msgType))
{
@ -324,7 +334,7 @@ public class MessageIntegrityAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof MessageIntegrityAttribute) || obj == null)
if (! (obj instanceof MessageIntegrityAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -123,8 +134,7 @@ public class OptionalAttribute
*/
public boolean equals(Object obj)
{
if(obj == null
|| !(obj instanceof OptionalAttribute) )
if(! (obj instanceof OptionalAttribute) )
return false;
return

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -107,8 +118,7 @@ public class PriorityAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof PriorityAttribute)
|| obj == null)
if (! (obj instanceof PriorityAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -130,7 +141,7 @@ public class RealmAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof RealmAttribute) || obj == null)
if (! (obj instanceof RealmAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -59,8 +70,7 @@ public class RequestedTransportAttribute extends Attribute
@Override
public boolean equals(Object obj)
{
if (! (obj instanceof RequestedTransportAttribute)
|| obj == null)
if (! (obj instanceof RequestedTransportAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -120,7 +131,7 @@ public class ReservationTokenAttribute
byte[] copy = new byte[reservationToken.length];
System.arraycopy(reservationToken, 0, copy, 0, reservationToken.length);
return reservationToken;
return copy;
}
/**
@ -185,8 +196,8 @@ public class ReservationTokenAttribute
for(int i = 0; i < b; i++)
{
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFl);
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFl);
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFL);
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFL);
}
//calculate hashcode for Hashtable storage.
@ -205,8 +216,7 @@ public class ReservationTokenAttribute
@Override
public boolean equals(Object obj)
{
if (! (obj instanceof ReservationTokenAttribute)
|| obj == null)
if (! (obj instanceof ReservationTokenAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -110,7 +121,7 @@ public class SoftwareAttribute
byte[] copy = new byte[software.length];
System.arraycopy(software, 0, copy, 0, software.length);
return software;
return copy;
}
/**
@ -140,8 +151,7 @@ public class SoftwareAttribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof SoftwareAttribute)
|| obj == null)
if (! (obj instanceof SoftwareAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -41,7 +52,7 @@ public class UnknownAttributesAttribute extends Attribute
/**
* A list of attribute types that were not understood by the server.
*/
private ArrayList<Character> unknownAttributes = new ArrayList<Character>();
private ArrayList<Character> unknownAttributes = new ArrayList<>();
/**
* Constructor.
@ -89,7 +100,7 @@ public class UnknownAttributesAttribute extends Attribute
//some attributes may be repeated for padding
//(packet length should be divisable by 4)
if(!contains(attributeID))
unknownAttributes.add(new Character(attributeID));
unknownAttributes.add(attributeID);
}
/**
@ -99,7 +110,7 @@ public class UnknownAttributesAttribute extends Attribute
*/
public boolean contains(char attributeID)
{
return unknownAttributes.contains(new Character(attributeID));
return unknownAttributes.contains(attributeID);
}
/**
@ -129,7 +140,7 @@ public class UnknownAttributesAttribute extends Attribute
*/
public char getAttribute(int index )
{
return (unknownAttributes.get(index)).charValue();
return unknownAttributes.get(index);
}
/**
@ -153,7 +164,7 @@ public class UnknownAttributesAttribute extends Attribute
Iterator<Character> attributes = getAttributes();
while (attributes.hasNext())
{
char att = attributes.next().charValue();
char att = attributes.next();
binValue[offset++] = (byte)(att >> 8);
binValue[offset++] = (byte)(att & 0x00FF);
}
@ -180,8 +191,7 @@ public class UnknownAttributesAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof UnknownAttributesAttribute)
|| obj == null)
if (! (obj instanceof UnknownAttributesAttribute))
return false;
if (obj == this)
@ -218,8 +228,8 @@ public class UnknownAttributesAttribute extends Attribute
char originalOffset = offset;
for(int i = offset; i < originalOffset + length; i += 2)
{
char attributeID = (char)( (attributeValue[offset++] << 8) |
(attributeValue[offset++]) );
char attributeID = (char) (((attributeValue[offset++] & 0xFF) << 8)
| (attributeValue[offset++] & 0xFF));
addAttributeID(attributeID);
}
}

View File

@ -1,3 +1,20 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
import org.ice4j.*;
@ -72,8 +89,7 @@ public class UseCandidateAttribute
*/
public boolean equals(Object obj)
{
if(!(obj instanceof UseCandidateAttribute)
|| obj == null)
if(!(obj instanceof UseCandidateAttribute))
return false;
if(obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -136,7 +147,7 @@ public class UsernameAttribute extends Attribute
*/
public boolean equals(Object obj)
{
if (! (obj instanceof UsernameAttribute) || obj == null)
if (! (obj instanceof UsernameAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;
@ -100,8 +111,7 @@ public class XorOnlyAttribute
public boolean equals(Object obj)
{
if (! (obj instanceof XorOnlyAttribute)
|| obj == null)
if (! (obj instanceof XorOnlyAttribute))
return false;
if (obj == this)

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.attribute;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the Jitsi community (https://jitsi.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -17,7 +27,6 @@ import java.util.logging.*;
import org.ice4j.*;
import org.ice4j.ice.harvest.*;
import org.ice4j.ice.harvest.TrickleCallback;
import org.ice4j.stack.*;
/**
@ -98,7 +107,7 @@ public class Agent
* This map preserves the insertion order of the media streams.
*/
private final Map<String, IceMediaStream> mediaStreams
= new LinkedHashMap<String, IceMediaStream>();
= new LinkedHashMap<>();
/**
* The candidate harvester that we use to gather candidate on the local
@ -112,8 +121,7 @@ public class Agent
* harvest candidates synchronously, and previously to harvesting by
* {@link #harvesters}.
*/
private final List<CandidateHarvester> hostHarvesters
= new LinkedList<CandidateHarvester>();
private final List<CandidateHarvester> hostHarvesters = new LinkedList<>();
/**
* The set of harvesters (i.e. STUN, TURN, and others) that the agent should
@ -156,7 +164,7 @@ public class Agent
* the necessary triggered checks.
*/
private final List<CandidatePair> preDiscoveredPairsQueue
= new LinkedList<CandidatePair>();
= new LinkedList<>();
/**
* The lock that we use while starting connectivity establishment.
@ -218,7 +226,7 @@ public class Agent
* Agent} and following its changes of state.
*/
private final List<PropertyChangeListener> stateListeners
= new LinkedList<PropertyChangeListener>();
= new LinkedList<>();
/**
* The <tt>StunStack</tt> used by this <tt>Agent</tt>.
@ -307,7 +315,7 @@ public class Agent
new BigInteger(128, random).toString(32),
/* min */ 22, /* max */ 256);
tieBreaker = Math.abs(random.nextLong());
tieBreaker = random.nextLong() & 0x7FFFFFFFFFFFFFFFL;
nominator = new DefaultNominator(this);
}
@ -365,7 +373,7 @@ public class Agent
* all and only local candidates.
*
* @throws IllegalArgumentException if either <tt>minPort</tt> or
* <tt>maxPort</tt> is not a valid port number or if <tt>minPort >
* <tt>maxPort</tt> is not a valid port number or if <tt>minPort &gt;
* maxPort</tt>, or if <tt>transport</tt> is not currently supported.
* @throws IOException if an error occurs while the underlying resolver lib
* is using sockets.
@ -414,6 +422,28 @@ public class Agent
return component;
}
/**
* Initializes a new {@link CandidatePair} instance from a
* {@link LocalCandidate} and a {@link RemoteCandidate}. The method
* represents a {@code CandidatePair} factory and is preferable to
* explicitly calling the {@code CandidatePair} constructor because it
* allows this {@code Agent} to easily track the initialization of its
* {@code CandidatePair}s.
*
* @param local the {@code LocalCandidate} to initialize the new instance
* with
* @param remote the {@code RemoteCandidate} to initialize the new instance
* with
* @return a new {@code CandidatePair} instance initializes with
* {@code local} and {@code remote}
*/
protected CandidatePair createCandidatePair(
LocalCandidate local,
RemoteCandidate remote)
{
return new CandidatePair(local, remote);
}
/**
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
* <tt>Agent</tt> to obtain whatever addresses they can discover.
@ -515,7 +545,7 @@ public class Agent
}
//create a list of components and start harvesting
List<Component> components = new LinkedList<Component>();
List<Component> components = new LinkedList<>();
for (IceMediaStream stream : getStreams())
{
@ -561,14 +591,12 @@ public class Agent
"Trigger checks for pairs that were received before "
+ "running state");
Iterator<CandidatePair> it = preDiscoveredPairsQueue.iterator();
while(it.hasNext())
for (CandidatePair cp : preDiscoveredPairsQueue)
{
triggerCheck(it.next());
triggerCheck(cp);
}
this.preDiscoveredPairsQueue.clear();
preDiscoveredPairsQueue.clear();
}
connCheckClient.startChecks();
@ -653,9 +681,9 @@ public class Agent
*/
public boolean isOver()
{
return state == IceProcessingState.COMPLETED
|| state == IceProcessingState.TERMINATED
|| state == IceProcessingState.FAILED;
IceProcessingState state = getState();
return (state != null) && state.isOver();
}
/**
@ -679,7 +707,7 @@ public class Agent
synchronized(stateListeners)
{
if(!stateListeners.contains(l))
this.stateListeners.add(l);
stateListeners.add(l);
}
}
@ -693,7 +721,7 @@ public class Agent
{
synchronized(stateListeners)
{
this.stateListeners.remove(l);
stateListeners.remove(l);
}
}
@ -995,6 +1023,7 @@ public class Agent
* candidate foundations. We use the <tt>FoundationsRegistry</tt> to keep
* track of the foundations we assign within a session (i.e. the entire life
* time of an <tt>Agent</tt>)
* @return the {@link FoundationsRegistry} of this agent
*/
public final FoundationsRegistry getFoundationsRegistry()
{
@ -1032,7 +1061,7 @@ public class Agent
{
synchronized(mediaStreams)
{
return new LinkedList<String>(mediaStreams.keySet());
return new LinkedList<>(mediaStreams.keySet());
}
}
@ -1047,7 +1076,7 @@ public class Agent
{
synchronized(mediaStreams)
{
return new LinkedList<IceMediaStream>(mediaStreams.values());
return new LinkedList<>(mediaStreams.values());
}
}
@ -1439,7 +1468,7 @@ public class Agent
ufrag);
CandidatePair triggeredPair
= new CandidatePair(localCandidate, remoteCandidate);
= createCandidatePair(localCandidate, remoteCandidate);
logger.fine("set use-candidate " + useCandidate + " for pair " +
triggeredPair.toShortString());
@ -1505,29 +1534,6 @@ public class Agent
//we already know about the remote address so we only need to
//trigger a check for the existing pair
if(!isControlling())
{
logger.fine("set useCandidateReceived for " +
triggerPair.toShortString());
// we synchronize here because the same pair object can be
// processed (in another thread) in ConnectivityCheckClient's
// processSuccessResponse. A controlled agent select its
// pair here if the pair state is succeeded (set in
// processSuccessResponse) or in processSuccessResponse if
// the pair has useCandidateReceived as true (set here). So be
// sure that if a binding response and a binding request (for
// the same check) from other peer come at the very same time,
// that we will trigger the nominationConfirmed (that will
// pass the pair as selected if it is the first time).
synchronized(triggerPair)
{
//next time we will see a request it will be considered as
//having USE-CANDIDATE
triggerPair.setUseCandidateReceived();
}
}
if (knownPair.getState() == CandidatePairState.SUCCEEDED )
{
//7.2.1.5. Updating the Nominated Flag
@ -1576,7 +1582,6 @@ public class Agent
if(triggerPair.getParentComponent().getSelectedPair() == null)
logger.info("Add peer CandidatePair with new reflexive " +
"address to checkList: " + triggerPair);
triggerPair.setUseCandidateReceived();
parentStream.addToCheckList(triggerPair);
}
@ -1633,23 +1638,24 @@ public class Agent
public synchronized void nominate(CandidatePair pair)
throws IllegalStateException
{
if(! isControlling() )
throw new IllegalStateException("Only controlling agents can "
+"nominate pairs");
if(!isControlling())
{
throw new IllegalStateException(
"Only controlling agents can nominate pairs");
}
Component parentComponent = pair.getParentComponent();
IceMediaStream parentStream = parentComponent.getParentStream();
//If the pair is not already nominated and if its parent component
//does not already contain a nominated pair - nominate it.
if(!pair.isNominated()
if (!pair.isNominated()
&& !parentStream.validListContainsNomineeForComponent(
parentComponent))
{
logger.info("verify if nominated pair answer again");
pair.nominate();
pair.getParentComponent().getParentStream()
.getCheckList().scheduleTriggeredCheck(pair);
parentStream.getCheckList().scheduleTriggeredCheck(pair);
}
}
@ -1886,7 +1892,6 @@ public class Agent
* @return the value of the <tt>Ta</tt> pace timer according to the
* number and type of {@link IceMediaStream}s this agent will be using or
* a pre-configured value if the application has set one.
* <p>
*/
protected long calculateTa()
{

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -52,7 +62,7 @@ public abstract class Candidate<T extends Candidate<?>>
/**
* The transport address represented by this candidate.
*/
private TransportAddress transportAddress = null;
private final TransportAddress transportAddress;
/**
* The type of this candidate. At this point the ICE specification (and
@ -60,7 +70,7 @@ public abstract class Candidate<T extends Candidate<?>>
* server reflexive, peer reflexive and relayed candidates. Others may be
* added in the future.
*/
private CandidateType candidateType = null;
private CandidateType candidateType;
/**
* An arbitrary string that is the same for two candidates
@ -331,6 +341,20 @@ public abstract class Candidate<T extends Candidate<?>>
&& getFoundation().equals(candidate.getFoundation());
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
// Even if the following hashCode algorithm has drawbacks because of it
// simplicity, it is better than nothing because at least it allows
// Candidate and, respectively, CandidatePair to be used as HashMap
// keys.
return
getParentComponent().hashCode() + getTransportAddress().hashCode();
}
/**
* Returns a reference to the <tt>Component</tt> that this candidate belongs
* to.
@ -946,24 +970,24 @@ public abstract class Candidate<T extends Candidate<?>>
TransportAddress relatedAddress = null;
switch (getType())
{
case SERVER_REFLEXIVE_CANDIDATE:
if(getBase() != null)
{
relatedAddress = getBase().getTransportAddress();
}
break;
case PEER_REFLEXIVE_CANDIDATE:
if(getBase() != null)
{
relatedAddress = getBase().getTransportAddress();
}
break;
case RELAYED_CANDIDATE:
relatedAddress = getMappedAddress();
break;
default:
//host candidate
return null;
case SERVER_REFLEXIVE_CANDIDATE:
if(getBase() != null)
{
relatedAddress = getBase().getTransportAddress();
}
break;
case PEER_REFLEXIVE_CANDIDATE:
if(getBase() != null)
{
relatedAddress = getBase().getTransportAddress();
}
break;
case RELAYED_CANDIDATE:
relatedAddress = getMappedAddress();
break;
default:
//host candidate
return null;
}
// Update the related candidate conforming to the related address.
this.relatedCandidate = findRelatedCandidate(relatedAddress);

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -120,7 +131,6 @@ public class CandidatePair
public CandidatePair(LocalCandidate localCandidate,
RemoteCandidate remoteCandidate)
{
this.localCandidate = localCandidate;
this.remoteCandidate = remoteCandidate;
@ -357,7 +367,7 @@ public class CandidatePair
* agent. Let D be the priority for the candidate provided by the
* controlled agent. The priority for a pair is computed as:
* <p>
* <i>pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)</i>
* <i>pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G&gt;D?1:0)</i>
* <p>
* This formula ensures a unique priority for each pair. Once the priority
* is assigned, the agent sorts the candidate pairs in decreasing order of
@ -433,19 +443,33 @@ public class CandidatePair
@Override
public boolean equals(Object obj)
{
if ((obj == null) || !(obj instanceof CandidatePair))
if (! (obj instanceof CandidatePair))
return false;
CandidatePair candidatePair = (CandidatePair) obj;
//DO NOT change this method to also depend on other pair properties
//because the Conn Check Client counts on it only using the candidates
//for comparisons.
// XXX DO NOT change this method to also depend on other pair properties
// because ConnectivityCheckClient counts on it only using the
// candidates for comparisons.
return
localCandidate.equals(candidatePair.localCandidate)
&& remoteCandidate.equals(candidatePair.remoteCandidate);
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
// Even if the following hashCode algorithm has drawbacks because of it
// simplicity, it is better than nothing because at least it allows
// CandidatePair to be used as a HashMap key.
// XXX While localCandidate is not final, the parentComponent is
// supposedly effectively final.
return getLocalCandidate().getParentComponent().hashCode();
}
/**
* Returns a String representation of this <tt>CandidatePair</tt>.
*
@ -605,8 +629,8 @@ public class CandidatePair
getParentComponent().getParentStream().firePairPropertyChange(
this,
IceMediaStream.PROPERTY_PAIR_NOMINATED,
false,
true);
/* oldValue */ false,
/* newValue */ true);
}
/**

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -63,6 +74,8 @@ public enum CandidateTcpType
* Parses the string <tt>candidateTcpTypeName</tt> and return the
* corresponding <tt>CandidateTcpType</tt> instance.
*
* @param candidateTcpTypeName the string to parse
* @return candidateTcpTypeName as an Enum
* @throws IllegalArgumentException in case <tt>candidateTcpTypeName</tt> is
* not a valid or currently supported candidate TCP type.
*/

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -45,8 +56,7 @@ public class CheckList
* A pair would get into a triggered check queue as soon as we receive
* a check on its local candidate.
*/
private final List<CandidatePair> triggeredCheckQueue
= new LinkedList<CandidatePair>();
private final List<CandidatePair> triggeredCheckQueue = new LinkedList<>();
/**
* A reference to the {@link IceMediaStream} that we belong to.
@ -58,14 +68,14 @@ public class CheckList
* Agent} and following its changes of state.
*/
private final List<PropertyChangeListener> stateListeners
= new LinkedList<PropertyChangeListener>();
= new LinkedList<>();
/**
* Contains {@link PropertyChangeListener}s registered with this {@link
* Agent} and following its changes of state.
*/
private final List<PropertyChangeListener> checkListeners
= new LinkedList<PropertyChangeListener>();
= new LinkedList<>();
/**
* The name of the {@link PropertyChangeEvent} that we use to deliver
@ -286,8 +296,7 @@ public class CheckList
*/
protected synchronized void computeInitialCheckListPairStates()
{
Map<String, CandidatePair> pairsToWait
= new Hashtable<String, CandidatePair>();
Map<String, CandidatePair> pairsToWait = new Hashtable<>();
//first, determine the pairs that we'd need to put in the waiting state.
for(CandidatePair pair : this)
@ -374,9 +383,9 @@ public class CheckList
return;
}
logger.info("Selected pair for stream " +
cmp.toShortString() + ": " +
nominatedPair.toShortString());
logger.info(
"Selected pair for stream " + cmp.toShortString() + ": "
+ nominatedPair.toShortString());
cmp.setSelectedPair(nominatedPair);
@ -497,8 +506,7 @@ public class CheckList
synchronized(stateListeners)
{
listenersCopy
= new LinkedList<PropertyChangeListener>(stateListeners);
listenersCopy = new LinkedList<>(stateListeners);
}
PropertyChangeEvent evt = new PropertyChangeEvent(
@ -553,8 +561,7 @@ public class CheckList
synchronized(checkListeners)
{
listenersCopy
= new LinkedList<PropertyChangeListener>(checkListeners);
listenersCopy = new LinkedList<>(checkListeners);
}
PropertyChangeEvent evt = new PropertyChangeEvent(

View File

@ -1,25 +1,36 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
/**
* Everty <tt>CheckList</tt> is associated with a state, which captures the
* state of ICE checks for that media stream. There are three states:
* <p/>
* <br>
* Running: In this state, ICE checks are still in progress for this
* media stream.
* <p/>
* <br>
* Completed: In this state, ICE checks have produced nominated pairs
* for each component of the media stream. Consequently, ICE has succeeded and
* media can be sent.
* <p/>
* <br>
* Failed: In this state, the ICE checks have not completed successfully for
* this media stream.
* <p/>
* <br>
* When a check list is first constructed as the consequence of an offer/answer
* exchange, it is placed in the Running state.
*

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -63,21 +73,19 @@ public class Component
/**
* The list locally gathered candidates for this media stream.
*/
private final List<LocalCandidate> localCandidates
= new LinkedList<LocalCandidate>();
private final List<LocalCandidate> localCandidates = new LinkedList<>();
/**
* The list of candidates that the peer agent sent for this stream.
*/
private final List<RemoteCandidate> remoteCandidates
= new LinkedList<RemoteCandidate>();
private final List<RemoteCandidate> remoteCandidates = new LinkedList<>();
/**
* The list of candidates that the peer agent sent for this stream after
* connectivity establishment.
*/
private final List<RemoteCandidate> remoteUpdateCandidates =
new LinkedList<RemoteCandidate>();
private final List<RemoteCandidate> remoteUpdateCandidates
= new LinkedList<>();
/**
* A <tt>Comparator</tt> that we use for sorting <tt>Candidate</tt>s by
@ -175,7 +183,7 @@ public class Component
{
synchronized(localCandidates)
{
return new ArrayList<LocalCandidate>(localCandidates);
return new ArrayList<>(localCandidates);
}
}
@ -247,8 +255,7 @@ public class Component
logger.info("Update remote candidate for " + toShortString() + ": " +
candidate.getTransportAddress());
List<RemoteCandidate> existingCandidates
= new LinkedList<RemoteCandidate>();
List<RemoteCandidate> existingCandidates = new LinkedList<>();
synchronized (remoteCandidates)
{
existingCandidates.addAll(remoteCandidates);
@ -282,7 +289,7 @@ public class Component
*/
public void updateRemoteCandidates()
{
List<CandidatePair> checkList = null;
List<CandidatePair> checkList;
List<RemoteCandidate> newRemoteCandidates;
synchronized(remoteUpdateCandidates)
@ -290,8 +297,7 @@ public class Component
if(remoteUpdateCandidates.size() == 0)
return;
newRemoteCandidates
= new LinkedList<RemoteCandidate>(remoteUpdateCandidates);
newRemoteCandidates = new LinkedList<>(remoteUpdateCandidates);
List<LocalCandidate> localCnds = getLocalCandidates();
@ -305,7 +311,7 @@ public class Component
}
}
checkList = new Vector<CandidatePair>();
checkList = new Vector<>();
for(LocalCandidate localCnd : localCnds)
{
@ -336,7 +342,9 @@ public class Component
*/
CandidatePair pair
= new CandidatePair(localCnd, remoteCnd);
= getParentStream()
.getParentAgent()
.createCandidatePair(localCnd, remoteCnd);
logger.info("new Pair added: " + pair.toShortString());
checkList.add(pair);
}
@ -381,7 +389,7 @@ public class Component
{
synchronized(remoteCandidates)
{
return new ArrayList<RemoteCandidate>(remoteCandidates);
return new ArrayList<>(remoteCandidates);
}
}
@ -449,15 +457,17 @@ public class Component
StringBuffer buff
= new StringBuffer("Component id=").append(getComponentID());
buff.append(" parent stream=" + getParentStream().getName());
buff.append(" parent stream=").append(getParentStream().getName());
//local candidates
int localCandidatesCount = getLocalCandidateCount();
if(localCandidatesCount > 0)
{
buff.append("\n" + localCandidatesCount + " Local candidates:");
buff.append("\ndefault candidate: " + getDefaultCandidate());
buff.append("\n")
.append(localCandidatesCount)
.append(" Local candidates:");
buff.append("\ndefault candidate: ").append(getDefaultCandidate());
synchronized(localCandidates)
{
@ -477,14 +487,16 @@ public class Component
if(remoteCandidatesCount > 0)
{
buff.append("\n" + remoteCandidatesCount + " Remote candidates:");
buff.append("\ndefault remote candidate: "
+ getDefaultRemoteCandidate());
buff.append("\n")
.append(remoteCandidatesCount)
.append(" Remote candidates:");
buff.append("\ndefault remote candidate: ")
.append(getDefaultRemoteCandidate());
synchronized(remoteCandidates)
{
for (RemoteCandidate cand : remoteCandidates)
{
buff.append("\n" + cand.toString());
buff.append("\n").append(cand);
}
}
}
@ -691,12 +703,8 @@ public class Component
{
synchronized(localCandidates)
{
Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
while (localCandsIter.hasNext())
for (LocalCandidate cand : localCandidates)
{
LocalCandidate cand = localCandsIter.next();
if ((defaultCandidate == null)
|| (defaultCandidate.getDefaultPreference()
< cand.getDefaultPreference()))
@ -874,4 +882,19 @@ public class Component
else
return Integer.toString(componentID);
}
/**
* Use builder pattern to allow creation of immutable Component instances,
* from outside the current package.
*
* @param componentID the id of this component.
* @param mediaStream the {@link IceMediaStream} instance that would be the
* parent of this component.
* @return Component
*/
public static Component build(int componentID, IceMediaStream mediaStream)
{
return new Component(componentID, mediaStream);
}
}

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -46,13 +57,13 @@ class ConnectivityCheckClient
/**
* The {@link PaceMaker}s that are currently running checks in this client.
*/
private final List<PaceMaker> paceMakers = new LinkedList<PaceMaker>();
private final List<PaceMaker> paceMakers = new LinkedList<>();
/**
* Timer that is used to let some seconds before a CheckList is considered
* as FAILED.
*/
private Map<String, Timer> timers = new HashMap<String, Timer>();
private Map<String, Timer> timers = new HashMap<>();
/**
* A flag that determines whether we have received a STUN response or not.
@ -237,7 +248,7 @@ class ConnectivityCheckClient
//if we are the controlling agent then we need to indicate our
//nominated pairs.
if(candidatePair.isNominated())
if (candidatePair.isNominated())
{
logger.fine(
"Add USE-CANDIDATE in check for: "
@ -283,8 +294,6 @@ class ConnectivityCheckClient
tran.setApplicationData(candidatePair);
if (isReliableTransport(candidatePair))
maxRetransmissions = 0;
logger.fine(
"start check for " + candidatePair.toShortString() + " tid "
+ tran);
@ -476,7 +485,7 @@ class ConnectivityCheckClient
TransportAddress mappedAddress = null;
if(! response.containsAttribute(Attribute.XOR_MAPPED_ADDRESS))
if (!response.containsAttribute(Attribute.XOR_MAPPED_ADDRESS))
{
logger.fine("Received a success response with no "
+ "XOR_MAPPED_ADDRESS attribute.");
@ -487,14 +496,14 @@ class ConnectivityCheckClient
}
XorMappedAddressAttribute mappedAddressAttr
= (XorMappedAddressAttribute)response
.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
= (XorMappedAddressAttribute)
response.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
mappedAddress = mappedAddressAttr
.getAddress(response.getTransactionID());
mappedAddress
= mappedAddressAttr.getAddress(response.getTransactionID());
// XXX AddressAttribute always returns UDP based TransportAddress
if(checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
if (checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
{
mappedAddress
= new TransportAddress(
@ -505,8 +514,7 @@ class ConnectivityCheckClient
LocalCandidate validLocalCandidate = null;
validLocalCandidate = parentAgent
.findLocalCandidate(mappedAddress);
validLocalCandidate = parentAgent.findLocalCandidate(mappedAddress);
RemoteCandidate validRemoteCandidate = checkedPair.getRemoteCandidate();
@ -514,7 +522,7 @@ class ConnectivityCheckClient
// response. If the transport address does not match any of the
// local candidates that the agent knows about, the mapped address
// represents a new candidate -- a peer reflexive candidate.
if ( validLocalCandidate == null)
if (validLocalCandidate == null)
{
//Like other candidates, PEER-REFLEXIVE candidates have a type,
//base, priority, and foundation. They are computed as follows:
@ -548,9 +556,12 @@ class ConnectivityCheckClient
//generated from it momentarily
validLocalCandidate = peerReflexiveCandidate;
if(checkedPair.getParentComponent().getSelectedPair() == null)
logger.info("Receive a peer-reflexive candidate: " +
peerReflexiveCandidate.getTransportAddress());
if (checkedPair.getParentComponent().getSelectedPair() == null)
{
logger.info(
"Receive a peer-reflexive candidate: "
+ peerReflexiveCandidate.getTransportAddress());
}
}
//check if the resulting valid pair was already in our check lists.
@ -566,7 +577,9 @@ class ConnectivityCheckClient
// by a STUN connectivity check.
CandidatePair validPair
= (existingPair == null)
? new CandidatePair(validLocalCandidate, validRemoteCandidate)
? parentAgent.createCandidatePair(
validLocalCandidate,
validRemoteCandidate)
: existingPair;
// we synchronize here because the same pair object can be processed (in
@ -577,38 +590,42 @@ class ConnectivityCheckClient
// (for the same check) from other peer come at the very same time, that
// we will trigger the nominationConfirmed (that will pass the pair as
// as selected if it is the first time).
synchronized(checkedPair)
synchronized (checkedPair)
{
//The agent sets the state of the pair that *generated* the check to
//Succeeded. Note that, the pair which *generated* the check may be
//different than the valid pair constructed above
if(checkedPair.getParentComponent().getSelectedPair() == null)
if (checkedPair.getParentComponent().getSelectedPair() == null)
logger.info("Pair succeeded: " + checkedPair.toShortString());
checkedPair.setStateSucceeded();
}
if(! validPair.isValid())
if (!validPair.isValid())
{
if(validPair.getParentComponent().getSelectedPair() == null)
if (validPair.getParentComponent().getSelectedPair() == null)
logger.info("Pair validated: " + validPair.toShortString());
parentAgent.validatePair(validPair);
}
//The agent changes the states for all other Frozen pairs for the
//same media stream and same foundation to Waiting.
IceMediaStream parentStream = checkedPair.getParentComponent()
.getParentStream();
IceMediaStream parentStream
= checkedPair.getParentComponent().getParentStream();
synchronized(this)
{
Vector<CandidatePair> parentCheckList
= new Vector<CandidatePair>(parentStream.getCheckList());
= new Vector<>(parentStream.getCheckList());
for(CandidatePair pair : parentCheckList)
if ((pair.getState() == CandidatePairState.FROZEN)
{
if (pair.getState() == CandidatePairState.FROZEN
&& checkedPair.getFoundation().equals(
pair.getFoundation()))
{
pair.setStateWaiting();
}
}
}
// The agent examines the check list for all other streams in turn. If
@ -625,7 +642,7 @@ class ConnectivityCheckClient
synchronized (checkList)
{
for(CandidatePair pair : checkList)
for (CandidatePair pair : checkList)
{
if (parentStream.validListContainsFoundation(
pair.getFoundation())
@ -641,7 +658,7 @@ class ConnectivityCheckClient
//foundation, and for each group, sets the state of the pair with
//the lowest component ID to Waiting. If there is more than one
//such pair, the one with the highest priority is used.
if(checkList.isFrozen())
if (checkList.isFrozen())
checkList.computeInitialCheckListPairStates();
if (wasFrozen)
@ -652,7 +669,7 @@ class ConnectivityCheckClient
}
}
if(validPair.getParentComponent().getSelectedPair() == null)
if (validPair.getParentComponent().getSelectedPair() == null)
{
logger.info("IsControlling: " + parentAgent.isControlling() +
" USE-CANDIDATE:" +
@ -663,8 +680,8 @@ class ConnectivityCheckClient
//If the agent was a controlling agent, and it had included a USE-
//CANDIDATE attribute in the Binding request, the valid pair generated
//from that check has its nominated flag set to true.
if((parentAgent.isControlling()
&& request.containsAttribute(Attribute.USE_CANDIDATE)))
if (parentAgent.isControlling()
&& request.containsAttribute(Attribute.USE_CANDIDATE))
{
if(validPair.getParentComponent().getSelectedPair() == null)
{
@ -684,7 +701,7 @@ class ConnectivityCheckClient
//itself had the USE-CANDIDATE attribute. This case is described in
//Section 7.2.1.5, and may now result in setting the nominated flag for
//the pair learned from the original request.
else if(!parentAgent.isControlling()
else if (!parentAgent.isControlling()
&& checkedPair.useCandidateReceived()
&& !checkedPair.isNominated())
{
@ -693,7 +710,7 @@ class ConnectivityCheckClient
logger.info(
"Nomination confirmed for pair: "
+ validPair.toShortString());
parentAgent.nominationConfirmed( checkedPair );
parentAgent.nominationConfirmed(checkedPair);
}
else
{
@ -740,20 +757,6 @@ class ConnectivityCheckClient
evt.getRemoteAddress());
}
/**
* Checks whether the transport protocol used by <tt>pair</tt> is to be
* considered reliable for the purposes of <tt>ConnectivityCheckClient</tt>,
* that is, if client transactions need to be retransmitted or not.
* @param pair the pair to check.
* @return <tt>true</tt> iff the transport protocol of <tt>pair</tt> is
* to be considered reliable and retransmissions should be disabled for
* a client transaction for <tt>pair</tt>.
*/
private boolean isReliableTransport(CandidatePair pair)
{
return pair.getLocalCandidate().getTransport() == Transport.TCP;
}
/**
* In case of a role conflict, changes the state of the agent and
* reschedules the check, in all other cases sets the corresponding peer

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -39,8 +50,7 @@ public class DefaultNominator
* Map that will remember association between validated relayed candidate
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy.
*/
private final Map<String, TimerTask> validatedCandidates
= new HashMap<String, TimerTask>();
private final Map<String, TimerTask> validatedCandidates = new HashMap<>();
/**
* Creates a new instance of this nominator using <tt>parentAgent</tt> as
@ -312,7 +322,7 @@ public class DefaultNominator
}
}
if(allFailed && !pair.isNominated())
if (allFailed && !pair.isNominated())
{
// all other pairs are failed to do not waste time, cancel
// timer and nominate ourself (the relayed candidate).

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -34,7 +44,7 @@ public class FoundationsRegistry
* Contains mappings between a type+baseIP+server+transport
* <tt>String</tt>s and the foundation that has been assigned to them.
*/
private Map<String, String> foundations = new Hashtable<String, String>();
private Map<String, String> foundations = new Hashtable<>();
/**
* Assigns to <tt>candidate</tt> the foundation that corresponds to its

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -65,8 +75,7 @@ public class IceMediaStream
* address; a media stream may require multiple components, each of which
* has to work for the media stream as a whole to work.
*/
private final Map<Integer, Component> components
= new LinkedHashMap<Integer, Component>();
private final Map<Integer, Component> components = new LinkedHashMap<>();
/**
* An ordered set of candidate pairs for a media stream that have been
@ -74,8 +83,7 @@ public class IceMediaStream
* start of ICE processing, and fills as checks are performed, resulting in
* valid candidate pairs.
*/
private final TreeSet<CandidatePair> validList
= new TreeSet<CandidatePair>();
private final TreeSet<CandidatePair> validList = new TreeSet<>();
/**
* The id that was last assigned to a component. The next id that we give
@ -100,7 +108,7 @@ public class IceMediaStream
* Agent} and following the various events it may be generating.
*/
private final List<PropertyChangeListener> streamListeners
= new LinkedList<PropertyChangeListener>();
= new LinkedList<>();
/**
* The maximum number of candidate pairs that we should have in our check
@ -153,9 +161,7 @@ public class IceMediaStream
synchronized (components)
{
component = new Component(++lastComponentID, this);
components.put(
Integer.valueOf(component.getComponentID()),
component);
components.put(component.getComponentID(), component);
}
return component;
@ -221,7 +227,7 @@ public class IceMediaStream
{
synchronized(components)
{
return new ArrayList<Component>(components.values());
return new ArrayList<>(components.values());
}
}
@ -251,7 +257,7 @@ public class IceMediaStream
{
synchronized(components)
{
return new ArrayList<Integer>(components.keySet());
return new ArrayList<>(components.keySet());
}
}
@ -388,8 +394,9 @@ public class IceMediaStream
if(localCnd.canReach(remoteCnd)
&& remoteCnd.getTransportAddress().getPort() != 0)
{
CandidatePair pair = new CandidatePair(localCnd,
remoteCnd);
CandidatePair pair
= getParentAgent()
.createCandidatePair(localCnd, remoteCnd);
checkList.add(pair);
}
}
@ -415,7 +422,7 @@ public class IceMediaStream
* candidate with its base. Once this has been done, we remove each pair
* where the local and remote candidates are identical to the local and
* remote candidates of a pair higher up on the priority list.
* <p/>
* <br>
* In addition, in order to limit the attacks described in Section 18.5.2
* of the ICE spec, we limit the total number of pairs and hence
* (connectivity checks) to a specific value, (a total of 100 by default).
@ -426,8 +433,7 @@ public class IceMediaStream
{
//a list that we only use for storing pairs that we've already gone
//through. The list is destroyed at the end of this method.
List<CandidatePair> tmpCheckList
= new ArrayList<CandidatePair>(checkList.size());
List<CandidatePair> tmpCheckList = new ArrayList<>(checkList.size());
Iterator<CandidatePair> ckListIter = checkList.iterator();
@ -684,9 +690,9 @@ public class IceMediaStream
*/
protected boolean validListContainsNomineeForComponent(Component component)
{
synchronized(validList)
synchronized (validList)
{
for(CandidatePair pair : validList)
for (CandidatePair pair : validList)
{
if (pair.isNominated()
&& pair.getParentComponent() == component)
@ -736,9 +742,9 @@ public class IceMediaStream
synchronized (validList)
{
for(CandidatePair pair : validList)
for (CandidatePair pair : validList)
{
if(pair.isNominated())
if (pair.isNominated())
components.remove(pair.getParentComponent());
}
}
@ -893,4 +899,18 @@ public class IceMediaStream
{
return remotePassword;
}
/**
* Use builder pattern to provide an immutable IceMediaStream instance.
*
* @param name the name of the media stream
* @param parentAgent the agent that is handling the session that this
* media stream is a part of
* @return IceMediaStream
*/
public static IceMediaStream build(Agent parentAgent, String name)
{
return new IceMediaStream(parentAgent, name);
}
}

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -24,6 +35,7 @@ package org.ice4j.ice;
* refer to with "Terminated".
*
* @author Emil Ivov
* @author Lyubomir Marinov
*/
public enum IceProcessingState
{
@ -88,6 +100,21 @@ public enum IceProcessingState
return stateName;
}
/**
* Determines whether an {@link Agent} in this state has finished its ICE
* processing.
*
* @return {@code true} if an {@code Agent} in this state has finished its
* ICE processing; otherwise, {@code false}
*/
public boolean isOver()
{
return
COMPLETED.equals(this)
|| FAILED.equals(this)
|| TERMINATED.equals(this);
}
/**
* Returns <tt>true</tt> iff the state is one in which a connection
* has been established, that is either <tt>COMPLETED</tt> or

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -520,7 +530,7 @@ public class NetworkUtils
if (isMappedIPv4Addr(addr))
{
byte[] newAddr = new byte[IN4_ADDR_SIZE];
System.arraycopy(addr, 12, newAddr, 0, IN6_ADDR_SIZE);
System.arraycopy(addr, 12, newAddr, 0, IN4_ADDR_SIZE);
return newAddr;
}
@ -697,8 +707,7 @@ public class NetworkUtils
{
Method method = iface.getClass().getMethod("isLoopback");
return ((Boolean)method.invoke(iface, new Object[]{}))
.booleanValue();
return (Boolean) method.invoke(iface);
}
catch(Throwable t)
{
@ -729,7 +738,7 @@ public class NetworkUtils
{
Method method = iface.getClass().getMethod("isUp");
return ((Boolean)method.invoke(iface)).booleanValue();
return (Boolean) method.invoke(iface);
}
catch(Throwable t)
{
@ -759,7 +768,7 @@ public class NetworkUtils
{
Method method = iface.getClass().getMethod("isVirtual");
return ((Boolean)method.invoke(iface)).booleanValue();
return (Boolean) method.invoke(iface);
}
catch(Throwable t)
{

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,8 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license. See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;
@ -27,8 +38,7 @@ public class TcpHostCandidate
/**
* List of <tt>accept</tt>ed sockets for this <tt>TcpHostCandidate</tt>.
*/
private final List<IceSocketWrapper> sockets
= new LinkedList<IceSocketWrapper>();
private final List<IceSocketWrapper> sockets = new LinkedList<>();
/**
* Initializes a new <tt>TcpHostCandidate</tt>.

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice;

View File

@ -1,17 +1,26 @@
/*
* Jitsi Videobridge, OpenSource video conferencing.
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;
import org.ice4j.*;
import org.ice4j.ice.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.logging.*;
/**
@ -63,6 +72,11 @@ public class AwsCandidateHarvester
*/
private static TransportAddress face;
/**
* Whether we have already checked and found the mapping addresses.
*/
private static boolean addressChecked = false;
/**
* Creates an AWS harvester. The actual addresses wil be retrieved later,
* during the first harvest.
@ -72,77 +86,17 @@ public class AwsCandidateHarvester
super(null, null);
}
/**
* Maps all candidates to this harvester's mask and adds them to
* <tt>component</tt>.
*
* @param component the {@link Component} that we'd like to map candidates
* to.
* @return the <tt>LocalCandidate</tt>s gathered by this
* <tt>CandidateHarvester</tt> or <tt>null</tt> if no mask is specified.
*/
public Collection<LocalCandidate> harvest(Component component)
{
if (mask == null || face == null)
{
if(!obtainEC2Addresses())
return null;
}
/*
* Report the LocalCandidates gathered by this CandidateHarvester so
* that the harvest is sure to be considered successful.
*/
Collection<LocalCandidate> candidates = new HashSet<LocalCandidate>();
for (Candidate<?> cand : component.getLocalCandidates())
{
if (!(cand instanceof HostCandidate)
|| !cand.getTransportAddress().getHostAddress()
.equals(face.getHostAddress()))
{
continue;
}
TransportAddress mappedAddress = new TransportAddress(
mask.getHostAddress(),
cand.getHostAddress().getPort(),
cand.getHostAddress().getTransport());
ServerReflexiveCandidate mappedCandidate
= new ServerReflexiveCandidate(
mappedAddress,
(HostCandidate)cand,
cand.getStunServerAddress(),
CandidateExtendedType.STATICALLY_MAPPED_CANDIDATE);
//try to add the candidate to the component and then
//only add it to the harvest not redundant
if( !candidates.contains(mappedCandidate)
&& component.addLocalCandidate(mappedCandidate))
{
candidates.add(mappedCandidate);
}
}
return candidates;
}
/**
* Sends HTTP GET queries to
* <tt>http://169.254.169.254/latest/meta-data/local-ipv4</tt> and
* <tt>http://169.254.169.254/latest/meta-data/public-ipv4</tt> to learn the
* private (face) and public (mask) addresses of this EC2 instance.
*
* @return <tt>true</tt> if we managed to obtain addresses or someone else
* had already achieved that before us, <tt>false</tt> otherwise.
*/
private static synchronized boolean obtainEC2Addresses()
private static synchronized void obtainEC2Addresses()
{
if(mask != null && face != null)
return true;
if (addressChecked)
return;
addressChecked = true;
String localIPStr = null;
String publicIPStr = null;
@ -164,22 +118,19 @@ public class AwsCandidateHarvester
}
catch (Exception exc)
{
//whatever happens, we just log and bail
//whatever happens, we just log and fail
logger.log(Level.INFO, "We failed to obtain EC2 instance addresses "
+ "for the following reason: ", exc);
logger.info("String for local IP: " + localIPStr);
logger.info("String for public IP: " + publicIPStr);
}
return true;
}
/**
* Returns the discovered public (mask) address, or null.
* @return the discovered public (mask) address, or null.
* Returns the public (mask) address, or null.
* @return the public (mask) address, or null.
*/
public static TransportAddress getMask()
public TransportAddress getMask()
{
if (smellsLikeAnEC2())
{
@ -190,10 +141,10 @@ public class AwsCandidateHarvester
}
/**
* Returns the discovered local (face) address, or null.
* @return the discovered local (face) address, or null.
* Returns the local (face) address, or null.
* @return the local (face) address, or null.
*/
public static TransportAddress getFace()
public TransportAddress getFace()
{
if (smellsLikeAnEC2())
{

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;
@ -34,7 +44,7 @@ public class CandidateHarvesterSet
* <tt>Set</tt>.
*/
private final Collection<CandidateHarvesterSetElement> elements
= new LinkedList<CandidateHarvesterSetElement>();
= new LinkedList<>();
/**
* A pool of thread used for gathering process.
@ -85,7 +95,7 @@ public class CandidateHarvesterSet
*/
public void harvest(Component component)
{
harvest(Arrays.asList(new Component[]{component}), null);
harvest(Arrays.asList(component), null);
}
@ -135,8 +145,7 @@ public class CandidateHarvesterSet
* Start asynchronously executing the
* CandidateHarvester#harvest(Component) method of the harvesters.
*/
Map<CandidateHarvesterSetTask, Future<?>> tasks
= new HashMap<CandidateHarvesterSetTask, Future<?>>();
Map<CandidateHarvesterSetTask, Future<?>> tasks = new HashMap<>();
while (true)
{
@ -161,7 +170,7 @@ public class CandidateHarvesterSet
synchronized (components)
{
componentsCopy = new ArrayList<Component>(components);
componentsCopy = new ArrayList<>(components);
}
// Asynchronously start gathering candidates using the harvester.
@ -184,7 +193,7 @@ public class CandidateHarvesterSet
= taskIter.next();
Future<?> future = task.getValue();
while (true)
do
{
try
{
@ -222,9 +231,9 @@ public class CandidateHarvesterSet
}
catch (InterruptedException ie)
{
continue;
}
}
while (true);
taskIter.remove();
}
}

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;

View File

@ -1,9 +1,19 @@
/*
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
* Maintained by the SIP Communicator community (http://sip-communicator.org).
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ice4j.ice.harvest;

Some files were not shown because too many files have changed in this diff Show More