Merge branch 'master' of https://github.com/jitsi/ice4j into pmaster
This commit is contained in:
commit
ded13aa230
11
.classpath
11
.classpath
@ -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
4
.gitignore
vendored
@ -3,3 +3,7 @@
|
|||||||
/junit-reports/
|
/junit-reports/
|
||||||
/target/
|
/target/
|
||||||
/ice4j.jar
|
/ice4j.jar
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
bin/
|
||||||
|
|||||||
17
.project
17
.project
@ -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
202
LICENSE
Normal 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.
|
||||||
39
README.md
39
README.md
@ -1,35 +1,12 @@
|
|||||||
<table width='70%' align='justify' border='0'>
|
ice4j
|
||||||
<tr>
|
=====
|
||||||
<td width='15px' align='center' valign='top'>
|
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'>
|
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'>
|
|
||||||
<img src='http://jitsi.org/wiki/pub/sip-communicator/sc_logo139x208.white.png' alt='jitsi.org' title='jitsi.org' />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<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'>
|
Thanks
|
||||||
<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>
|
Work on this project was graciously funded by the [NLnet Foundation](https://nlnet.nl/). Thank you!
|
||||||
<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>
|
|
||||||
|
|
||||||
</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
306
build.xml
@ -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>
|
|
||||||
BIN
lib/jain-sdp.jar
BIN
lib/jain-sdp.jar
Binary file not shown.
BIN
lib/junit.jar
BIN
lib/junit.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
189
pom.xml
189
pom.xml
@ -1,27 +1,33 @@
|
|||||||
<project
|
<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">
|
||||||
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.jitsi</groupId>
|
<groupId>org.jitsi</groupId>
|
||||||
<artifactId>jitsi-universe</artifactId>
|
<artifactId>jitsi-universe-public</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0</version>
|
||||||
<relativePath>../jitsi-universe/pom.xml</relativePath>
|
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>ice4j</artifactId>
|
<artifactId>ice4j</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<name>ice4j</name>
|
<name>ice4j</name>
|
||||||
<url>https://github.com/jitsi/ice4j</url>
|
<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>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.sdp</groupId>
|
<groupId>org.opentelecoms.sdp</groupId>
|
||||||
<artifactId>jain-sdp</artifactId>
|
<artifactId>java-sdp-nist-bridge</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jitsi</groupId>
|
||||||
|
<artifactId>jain-sip-ri-ossonly</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bitlet</groupId>
|
<groupId>org.bitlet</groupId>
|
||||||
@ -46,7 +52,36 @@
|
|||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</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>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
@ -68,32 +103,110 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<repositories>
|
<profile>
|
||||||
<repository>
|
<id>run-sample</id>
|
||||||
<id>jitsi-maven-repository-releases</id>
|
<build>
|
||||||
<layout>default</layout>
|
<plugins>
|
||||||
<name>Jitsi Maven Repository (Releases)</name>
|
<plugin>
|
||||||
<releases>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<enabled>true</enabled>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
</releases>
|
<configuration>
|
||||||
<snapshots>
|
<mainClass>test.Ice</mainClass>
|
||||||
<enabled>false</enabled>
|
</configuration>
|
||||||
</snapshots>
|
</plugin>
|
||||||
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/</url>
|
</plugins>
|
||||||
</repository>
|
</build>
|
||||||
<repository>
|
</profile>
|
||||||
<id>jitsi-maven-repository-snapshots</id>
|
|
||||||
<layout>default</layout>
|
<profile>
|
||||||
<name>Jitsi Maven Repository (Snapshots)</name>
|
<id>run-pseudotcp</id>
|
||||||
<releases>
|
<build>
|
||||||
<enabled>false</enabled>
|
<plugins>
|
||||||
</releases>
|
<plugin>
|
||||||
<snapshots>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<enabled>true</enabled>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
</snapshots>
|
<configuration>
|
||||||
<url>https://github.com/jitsi/jitsi-maven-repository/raw/master/snapshots/</url>
|
<mainClass>test.IcePseudoTcp</mainClass>
|
||||||
</repository>
|
</configuration>
|
||||||
</repositories>
|
</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>
|
</project>
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
*
|
||||||
*
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
@ -95,10 +106,13 @@ public class ChannelDataMessageEvent
|
|||||||
{
|
{
|
||||||
return this.remoteAddress;
|
return this.remoteAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the <tt>TransportAddress</tt> which is local address on which this
|
* Gets the <tt>TransportAddress</tt> which is local address on which this
|
||||||
* event was received.
|
* event was received.
|
||||||
|
*
|
||||||
|
* @return the <tt>TransportAddress</tt> which is local address on which
|
||||||
|
* this event was received.
|
||||||
*/
|
*/
|
||||||
public TransportAddress getLocalAddress()
|
public TransportAddress getLocalAddress()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
*
|
||||||
*
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
@ -156,7 +166,7 @@ public class StackProperties
|
|||||||
* addresses that are allowed to be used for host candidate allocations.
|
* addresses that are allowed to be used for host candidate allocations.
|
||||||
*
|
*
|
||||||
* NOTE: this is currently only supported by
|
* 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
|
public static final String ALLOWED_ADDRESSES
|
||||||
= "org.ice4j.ice.harvest.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.
|
* addresses that are not allowed to be used for host candidate allocations.
|
||||||
*
|
*
|
||||||
* NOTE: this is currently only supported by
|
* 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
|
public static final String BLOCKED_ADDRESSES
|
||||||
= "org.ice4j.ice.harvest.BLOCKED_ADDRESSES";
|
= "org.ice4j.ice.harvest.BLOCKED_ADDRESSES";
|
||||||
@ -235,7 +245,7 @@ public class StackProperties
|
|||||||
String[] parts = str.split(regex);
|
String[] parts = str.split(regex);
|
||||||
|
|
||||||
// Remove mal-formatted entries.
|
// Remove mal-formatted entries.
|
||||||
List<String> res = new ArrayList<String>();
|
List<String> res = new ArrayList<>();
|
||||||
for (String s : parts)
|
for (String s : parts)
|
||||||
if (s != null && s.trim().length() != 0)
|
if (s != null && s.trim().length() != 0)
|
||||||
res.add(s);
|
res.add(s);
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j;
|
||||||
|
|
||||||
@ -205,7 +216,7 @@ public class TransportAddress
|
|||||||
* address if both the InetAddresses (or hostnames if it is unresolved),
|
* address if both the InetAddresses (or hostnames if it is unresolved),
|
||||||
* port numbers, and <tt>Transport</tt>s are equal.
|
* 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.
|
* the <tt>Transport</tt> are compared.
|
||||||
*
|
*
|
||||||
* @param obj the object to compare against.
|
* @param obj the object to compare against.
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -13,34 +24,32 @@ import org.ice4j.*;
|
|||||||
/**
|
/**
|
||||||
* This class is used to represent Stun attributes that contain an address. Such
|
* This class is used to represent Stun attributes that contain an address. Such
|
||||||
* attributes are:
|
* attributes are:
|
||||||
*<p>
|
*<ul>
|
||||||
* MAPPED-ADDRESS <br/>
|
* <li>MAPPED-ADDRESS
|
||||||
* RESPONSE-ADDRESS <br/>
|
* <li>RESPONSE-ADDRESS
|
||||||
* SOURCE-ADDRESS <br/>
|
* <li>SOURCE-ADDRESS
|
||||||
* CHANGED-ADDRESS <br/>
|
* <li>CHANGED-ADDRESS
|
||||||
* REFLECTED-FROM <br/>
|
* <li>REFLECTED-FROM
|
||||||
* ALTERNATE-SERVER <br/>
|
* <li>ALTERNATE-SERVER
|
||||||
* XOR-PEER-ADDRESS <br/>
|
* <li>XOR-PEER-ADDRESS
|
||||||
* XOR-RELAYED-ADDRESS <br/>
|
* <li>XOR-RELAYED-ADDRESS
|
||||||
*</p>
|
*</ul>
|
||||||
*<p>
|
*<p>
|
||||||
* The different attributes are distinguished by the attributeType of
|
* The different attributes are distinguished by the attributeType of
|
||||||
* org.ice4j.attribute.Attribute.
|
* {@link Attribute}.
|
||||||
*</p>
|
|
||||||
*<p>
|
*<p>
|
||||||
* Address attributes indicate the mapped IP address and
|
* Address attributes indicate the mapped IP address and
|
||||||
* port. They consist of an eight bit address family, and a sixteen bit
|
* port. They consist of an eight bit address family, and a sixteen bit
|
||||||
* port, followed by a fixed length value representing the IP address.
|
* port, followed by a fixed length value representing the IP address.
|
||||||
*<code>
|
*<pre>
|
||||||
* 0 1 2 3 <br/>
|
* 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 <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/>
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
* |x x x x x x x x| Family | Port | <br/>
|
* |x x x x x x x x| Family | Port |
|
||||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
* | Address | <br/>
|
* | Address |
|
||||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ <br/>
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
* <br/>
|
* </pre>
|
||||||
* </p>
|
|
||||||
* <p>
|
* <p>
|
||||||
* The port is a network byte ordered representation of the mapped port.
|
* The port is a network byte ordered representation of the mapped port.
|
||||||
* The address family is always 0x01, corresponding to IPv4. The first
|
* 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)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof AddressAttribute)
|
if (! (obj instanceof AddressAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -11,53 +22,54 @@ import org.ice4j.*;
|
|||||||
/**
|
/**
|
||||||
* After the header are 0 or more attributes. Each attribute is TLV
|
* After the header are 0 or more attributes. Each attribute is TLV
|
||||||
* encoded, with a 16 bit type, 16 bit length, and variable value:
|
* 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/>
|
* The following types are defined:
|
||||||
* 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/>
|
|
||||||
*
|
*
|
||||||
* ICE attributes:<br/>
|
* STUN attributes:
|
||||||
* 0x0024: PRIORITY <br/>
|
* 0x0001: MAPPED-ADDRESS
|
||||||
* 0x0025: USE-CANDIDATE <br/>
|
* 0x0002: RESPONSE-ADDRESS
|
||||||
* 0x8029: ICE-CONTROLLED <br/>
|
* 0x0003: CHANGE-REQUEST
|
||||||
* 0x802A: ICE-CONTROLLING <br/>
|
* 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 Emil Ivov
|
||||||
* @author Sebastien Vincent
|
* @author Sebastien Vincent
|
||||||
* @author Namal Senarathne
|
* @author Namal Senarathne
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -43,10 +54,10 @@ public class AttributeDecoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Discover attribute type
|
//Discover attribute type
|
||||||
char attributeType = (char)((bytes[offset] << 8) | bytes[offset + 1]);
|
char attributeType = (char)
|
||||||
int len1 = bytes[offset + 2] & 0xff;
|
(((bytes[offset] & 0xFF) << 8) | (bytes[offset + 1] & 0xFF));
|
||||||
int len2 = bytes[offset + 3] & 0xff;
|
char attributeLength = (char)
|
||||||
char attributeLength = (char)((len1 << 8) | len2);
|
(((bytes[offset + 2] & 0xFF) << 8) | (bytes[offset + 3] & 0xFF));
|
||||||
|
|
||||||
if(attributeLength > bytes.length - offset )
|
if(attributeLength > bytes.length - offset )
|
||||||
throw new StunException( StunException.ILLEGAL_ARGUMENT,
|
throw new StunException( StunException.ILLEGAL_ARGUMENT,
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -533,7 +544,8 @@ public class AttributeFactory
|
|||||||
*
|
*
|
||||||
* @param priority the priority value
|
* @param priority the priority value
|
||||||
* @return the created PriorityAttribute
|
* @return the created PriorityAttribute
|
||||||
* @throws IllegalArgumentException if priority < 0 or priority > (2^31 - 1)
|
* @throws IllegalArgumentException if priority < 0 or priority >
|
||||||
|
* (2^31 - 1)
|
||||||
*/
|
*/
|
||||||
public static PriorityAttribute createPriorityAttribute(long priority)
|
public static PriorityAttribute createPriorityAttribute(long priority)
|
||||||
throws IllegalArgumentException
|
throws IllegalArgumentException
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
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
|
* 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
|
* address and/or port when sending the response. The attribute is 32 bits
|
||||||
* long, although only two bits (A and B) are used:
|
* long, although only two bits (A and B) are used:
|
||||||
*
|
* <pre>
|
||||||
* 0 1 2 3 <br/>
|
* 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 <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/>
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
* |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/>
|
* |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/>
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
*
|
* </pre>
|
||||||
* The meaning of the flags is:
|
* The meaning of the flags is:
|
||||||
*
|
*
|
||||||
* A: This is the "change IP" flag. If true, it requests the server
|
* 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)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof ChangeRequestAttribute)
|
if (! (obj instanceof ChangeRequestAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -49,8 +60,7 @@ public class ChannelNumberAttribute extends Attribute
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof ChannelNumberAttribute)
|
if (! (obj instanceof ChannelNumberAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
@ -158,7 +168,7 @@ public class ChannelNumberAttribute extends Attribute
|
|||||||
/**
|
/**
|
||||||
* Determines if the channelNo is in valid range.
|
* Determines if the channelNo is in valid range.
|
||||||
* @param channelNo the channelNo to validate.
|
* @param channelNo the channelNo to validate.
|
||||||
* @return true if channnelNo is >= 0x4000.
|
* @return true if channnelNo is >= 0x4000.
|
||||||
*/
|
*/
|
||||||
public static boolean isValidRange(char channelNo)
|
public static boolean isValidRange(char channelNo)
|
||||||
{
|
{
|
||||||
@ -168,4 +178,4 @@ public class ChannelNumberAttribute extends Attribute
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -41,7 +52,7 @@ public class DataAttribute
|
|||||||
private final boolean padding;
|
private final boolean padding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Creates a new instance of this class with padding enabled.
|
||||||
*/
|
*/
|
||||||
protected DataAttribute()
|
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)
|
protected DataAttribute(boolean padding)
|
||||||
{
|
{
|
||||||
@ -159,8 +172,7 @@ public class DataAttribute
|
|||||||
|
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof DataAttribute)
|
if (! (obj instanceof DataAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -27,4 +38,4 @@ public class DestinationAddressAttribute extends AddressAttribute
|
|||||||
{
|
{
|
||||||
super(DESTINATION_ADDRESS);
|
super(DESTINATION_ADDRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -43,11 +54,8 @@ public class DontFragmentAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof DontFragmentAttribute)
|
if (! (obj instanceof DontFragmentAttribute))
|
||||||
|| obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -477,8 +488,7 @@ public class ErrorCodeAttribute extends Attribute
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof ErrorCodeAttribute)
|
if (! (obj instanceof ErrorCodeAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -13,8 +24,8 @@ import org.ice4j.*;
|
|||||||
* server to allocate an even port and optionally allocate
|
* server to allocate an even port and optionally allocate
|
||||||
* the next higher port number.
|
* the next higher port number.
|
||||||
*
|
*
|
||||||
* There are one flag supported : <br/>
|
* There is one flag supported: <br>
|
||||||
* R : ask to reserve a second port.<br/>
|
* R : ask to reserve a second port.
|
||||||
*
|
*
|
||||||
* @author Sebastien Vincent
|
* @author Sebastien Vincent
|
||||||
*/
|
*/
|
||||||
@ -51,8 +62,7 @@ public class EvenPortAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof EvenPortAttribute)
|
if (! (obj instanceof EvenPortAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
@ -147,4 +157,4 @@ public class EvenPortAttribute extends Attribute
|
|||||||
{
|
{
|
||||||
return rFlag;
|
return rFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -111,7 +122,7 @@ public class FingerprintAttribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof FingerprintAttribute) || obj == null)
|
if (! (obj instanceof FingerprintAttribute))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,175 +1,185 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
*
|
||||||
*
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
*
|
||||||
*/
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
package org.ice4j.attribute;
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
import org.ice4j.*;
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
/**
|
*
|
||||||
*
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* @author Emil Ivov
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*/
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
public abstract class IceControlAttribute
|
* See the License for the specific language governing permissions and
|
||||||
extends Attribute
|
* limitations under the License.
|
||||||
{
|
*/
|
||||||
/**
|
package org.ice4j.attribute;
|
||||||
* The length of the data contained in this attribute
|
|
||||||
*/
|
import org.ice4j.*;
|
||||||
static final char DATA_LENGTH_ICE_CONTROL = 8;
|
|
||||||
|
/**
|
||||||
/**
|
*
|
||||||
* The tie-breaker value stored in this attribute
|
* @author Emil Ivov
|
||||||
*/
|
*/
|
||||||
long tieBreaker;
|
public abstract class IceControlAttribute
|
||||||
|
extends Attribute
|
||||||
/**
|
{
|
||||||
* Indicates whether this is an <tt>ICE-CONTROLLING</tt> or an
|
/**
|
||||||
* <tt>ICE-CONTROLLED</tt> attribute.
|
* The length of the data contained in this attribute
|
||||||
*/
|
*/
|
||||||
boolean isControlling;
|
static final char DATA_LENGTH_ICE_CONTROL = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an ICE-CONTROLLING or an ICE-CONTROLLED attribute depending
|
* The tie-breaker value stored in this attribute
|
||||||
* on the value of <tt>isControlling</tt>.
|
*/
|
||||||
*
|
long tieBreaker;
|
||||||
* @param isControlling indicates the kind of attribute we are trying to
|
|
||||||
* create
|
/**
|
||||||
*/
|
* Indicates whether this is an <tt>ICE-CONTROLLING</tt> or an
|
||||||
IceControlAttribute(boolean isControlling)
|
* <tt>ICE-CONTROLLED</tt> attribute.
|
||||||
{
|
*/
|
||||||
super(isControlling ? ICE_CONTROLLING : ICE_CONTROLLED);
|
boolean isControlling;
|
||||||
this.isControlling = isControlling;
|
|
||||||
}
|
/**
|
||||||
|
* Constructs an ICE-CONTROLLING or an ICE-CONTROLLED attribute depending
|
||||||
/**
|
* on the value of <tt>isControlling</tt>.
|
||||||
* Sets this attribute's fields according to attributeValue array.
|
*
|
||||||
*
|
* @param isControlling indicates the kind of attribute we are trying to
|
||||||
* @param attributeValue a binary array containing this attribute's field
|
* create
|
||||||
* values and NOT containing the attribute header.
|
*/
|
||||||
* @param offset the position where attribute values begin (most often
|
IceControlAttribute(boolean isControlling)
|
||||||
* offset is equal to the index of the first byte after
|
{
|
||||||
* length)
|
super(isControlling ? ICE_CONTROLLING : ICE_CONTROLLED);
|
||||||
* @param length the length of the attribute data.
|
this.isControlling = isControlling;
|
||||||
*
|
}
|
||||||
* @throws StunException if attrubteValue contains invalid data.
|
|
||||||
*/
|
/**
|
||||||
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
* Sets this attribute's fields according to attributeValue array.
|
||||||
throws StunException
|
*
|
||||||
{
|
* @param attributeValue a binary array containing this attribute's field
|
||||||
// array used to hold the intermediate long values reconstructed from
|
* values and NOT containing the attribute header.
|
||||||
// the attributeValue array
|
* @param offset the position where attribute values begin (most often
|
||||||
|
* offset is equal to the index of the first byte after
|
||||||
// Reading in the network byte order (Big-Endian)
|
* length)
|
||||||
tieBreaker = ((attributeValue[offset++] & 0xffl) << 56)
|
* @param length the length of the attribute data.
|
||||||
| ((attributeValue[offset++] & 0xffl) << 48)
|
*
|
||||||
| ((attributeValue[offset++] & 0xffl) << 40)
|
* @throws StunException if attrubteValue contains invalid data.
|
||||||
| ((attributeValue[offset++] & 0xffl) << 32)
|
*/
|
||||||
| ((attributeValue[offset++] & 0xffl) << 24)
|
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
||||||
| ((attributeValue[offset++] & 0xffl) << 16)
|
throws StunException
|
||||||
| ((attributeValue[offset++] & 0xffl) << 8)
|
{
|
||||||
| (attributeValue[offset++] & 0xffl);
|
// array used to hold the intermediate long values reconstructed from
|
||||||
}
|
// the attributeValue array
|
||||||
|
|
||||||
/**
|
// Reading in the network byte order (Big-Endian)
|
||||||
* Returns a binary representation of this attribute.
|
tieBreaker = ((attributeValue[offset++] & 0xffL) << 56)
|
||||||
*
|
| ((attributeValue[offset++] & 0xffL) << 48)
|
||||||
* @return a binary representation of this attribute.
|
| ((attributeValue[offset++] & 0xffL) << 40)
|
||||||
*/
|
| ((attributeValue[offset++] & 0xffL) << 32)
|
||||||
public byte[] encode()
|
| ((attributeValue[offset++] & 0xffL) << 24)
|
||||||
{
|
| ((attributeValue[offset++] & 0xffL) << 16)
|
||||||
char type = getAttributeType();
|
| ((attributeValue[offset++] & 0xffL) << 8)
|
||||||
byte[] binValue = new byte[HEADER_LENGTH + getDataLength()];
|
| (attributeValue[offset] & 0xffL);
|
||||||
|
}
|
||||||
//Type
|
|
||||||
binValue[0] = (byte)(type >> 8);
|
/**
|
||||||
binValue[1] = (byte)(type & 0x00FF);
|
* Returns a binary representation of this attribute.
|
||||||
|
*
|
||||||
//Length
|
* @return a binary representation of this attribute.
|
||||||
binValue[2] = (byte)(getDataLength() >> 8);
|
*/
|
||||||
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
public byte[] encode()
|
||||||
|
{
|
||||||
//Tie-Breaker
|
char type = getAttributeType();
|
||||||
binValue[4] = (byte)((tieBreaker & 0xFF00000000000000L) >> 56);
|
byte[] binValue = new byte[HEADER_LENGTH + getDataLength()];
|
||||||
binValue[5] = (byte)((tieBreaker & 0x00FF000000000000L) >> 48);
|
|
||||||
binValue[6] = (byte)((tieBreaker & 0x0000FF0000000000L) >> 40);
|
//Type
|
||||||
binValue[7] = (byte)((tieBreaker & 0x000000FF00000000L) >> 32);
|
binValue[0] = (byte)(type >> 8);
|
||||||
binValue[8] = (byte)((tieBreaker & 0x00000000FF000000L) >> 24);
|
binValue[1] = (byte)(type & 0x00FF);
|
||||||
binValue[9] = (byte)((tieBreaker & 0x0000000000FF0000L) >> 16);
|
|
||||||
binValue[10] = (byte)((tieBreaker & 0x000000000000FF00L) >> 8);
|
//Length
|
||||||
binValue[11] = (byte)( tieBreaker & 0x00000000000000FFL);
|
binValue[2] = (byte)(getDataLength() >> 8);
|
||||||
|
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
||||||
return binValue;
|
|
||||||
}
|
//Tie-Breaker
|
||||||
|
binValue[4] = (byte)((tieBreaker & 0xFF00000000000000L) >> 56);
|
||||||
/**
|
binValue[5] = (byte)((tieBreaker & 0x00FF000000000000L) >> 48);
|
||||||
* Compares two STUN Attributes. Attributes are considered equal when their
|
binValue[6] = (byte)((tieBreaker & 0x0000FF0000000000L) >> 40);
|
||||||
* type, length, and all data are the same.
|
binValue[7] = (byte)((tieBreaker & 0x000000FF00000000L) >> 32);
|
||||||
*
|
binValue[8] = (byte)((tieBreaker & 0x00000000FF000000L) >> 24);
|
||||||
* @param obj the object to compare this attribute with.
|
binValue[9] = (byte)((tieBreaker & 0x0000000000FF0000L) >> 16);
|
||||||
*
|
binValue[10] = (byte)((tieBreaker & 0x000000000000FF00L) >> 8);
|
||||||
* @return true if the attributes are equal and false otherwise.
|
binValue[11] = (byte)( tieBreaker & 0x00000000000000FFL);
|
||||||
*/
|
|
||||||
public boolean equals(Object obj)
|
return binValue;
|
||||||
{
|
}
|
||||||
if(!(obj instanceof IceControlAttribute)
|
|
||||||
|| obj == null)
|
/**
|
||||||
return false;
|
* Compares two STUN Attributes. Attributes are considered equal when their
|
||||||
|
* type, length, and all data are the same.
|
||||||
if(obj == this)
|
*
|
||||||
return true;
|
* @param obj the object to compare this attribute with.
|
||||||
|
*
|
||||||
IceControlAttribute iceControlAtt = (IceControlAttribute)obj;
|
* @return true if the attributes are equal and false otherwise.
|
||||||
if(iceControlAtt.getAttributeType() != getAttributeType()
|
*/
|
||||||
|| iceControlAtt.isControlling != isControlling
|
public boolean equals(Object obj)
|
||||||
|| iceControlAtt.getDataLength() != DATA_LENGTH_ICE_CONTROL
|
{
|
||||||
|| getTieBreaker() != iceControlAtt.getTieBreaker())
|
if(!(obj instanceof IceControlAttribute))
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
if(obj == this)
|
||||||
|
return true;
|
||||||
return true;
|
|
||||||
}
|
IceControlAttribute iceControlAtt = (IceControlAttribute)obj;
|
||||||
|
if(iceControlAtt.getAttributeType() != getAttributeType()
|
||||||
/**
|
|| iceControlAtt.isControlling != isControlling
|
||||||
* Returns the data length of this attribute
|
|| iceControlAtt.getDataLength() != DATA_LENGTH_ICE_CONTROL
|
||||||
*
|
|| getTieBreaker() != iceControlAtt.getTieBreaker())
|
||||||
* @return the data length of this attribute
|
{
|
||||||
*/
|
return false;
|
||||||
public char getDataLength()
|
}
|
||||||
{
|
|
||||||
return DATA_LENGTH_ICE_CONTROL;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the human readable name of this attribute.
|
* Returns the data length of this attribute
|
||||||
*
|
*
|
||||||
* @return this attribute's name.
|
* @return the data length of this attribute
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public char getDataLength()
|
||||||
{
|
{
|
||||||
return isControlling ? "ICE-CONTROLLING" : "ICE-CONTROLLED";
|
return DATA_LENGTH_ICE_CONTROL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tie-breaker value.
|
* Returns the human readable name of this attribute.
|
||||||
*
|
*
|
||||||
* @param tieBreaker the the tie-breaker value
|
* @return this attribute's name.
|
||||||
*/
|
*/
|
||||||
public void setTieBreaker(long tieBreaker)
|
public String getName()
|
||||||
{
|
{
|
||||||
this.tieBreaker = tieBreaker;
|
return isControlling ? "ICE-CONTROLLING" : "ICE-CONTROLLED";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the tie-breaker.
|
* Sets the tie-breaker value.
|
||||||
*
|
*
|
||||||
* @return the value of the tie-breaker.
|
* @param tieBreaker the the tie-breaker value
|
||||||
*/
|
*/
|
||||||
public long getTieBreaker()
|
public void setTieBreaker(long tieBreaker)
|
||||||
{
|
{
|
||||||
return tieBreaker;
|
this.tieBreaker = tieBreaker;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Returns the value of the tie-breaker.
|
||||||
|
*
|
||||||
|
* @return the value of the tie-breaker.
|
||||||
|
*/
|
||||||
|
public long getTieBreaker()
|
||||||
|
{
|
||||||
|
return tieBreaker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -50,8 +61,7 @@ public class LifetimeAttribute
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof LifetimeAttribute)
|
if (! (obj instanceof LifetimeAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
@ -133,7 +143,7 @@ public class LifetimeAttribute
|
|||||||
throw new StunException("length invalid");
|
throw new StunException("length invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
lifetime = ((attributeValue[offset + 0] << 24) & 0xff000000) +
|
lifetime = ((attributeValue[offset] << 24) & 0xff000000) +
|
||||||
((attributeValue[offset + 1] << 16) & 0x00ff0000) +
|
((attributeValue[offset + 1] << 16) & 0x00ff0000) +
|
||||||
((attributeValue[offset + 2] << 8) & 0x0000ff00) +
|
((attributeValue[offset + 2] << 8) & 0x0000ff00) +
|
||||||
(attributeValue[offset + 3] & 0x000000ff);
|
(attributeValue[offset + 3] & 0x000000ff);
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -72,8 +83,7 @@ public class MagicCookieAttribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof LifetimeAttribute)
|
if (! (obj instanceof MagicCookieAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
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
|
* 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
|
* credentials are in use. For long-term credentials, the key is 16
|
||||||
* bytes:
|
* bytes:
|
||||||
* <p>
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* key = MD5(username ":" realm ":" SASLprep(password))
|
* key = MD5(username ":" realm ":" SASLprep(password))
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -43,7 +53,6 @@ import org.ice4j.stack.*;
|
|||||||
* 0x8493fbc53ba582fb4c044c456bdc40eb.
|
* 0x8493fbc53ba582fb4c044c456bdc40eb.
|
||||||
* <p>
|
* <p>
|
||||||
* For short-term credentials:
|
* For short-term credentials:
|
||||||
* <p>
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* key = SASLprep(password)
|
* key = SASLprep(password)
|
||||||
* </pre>
|
* </pre>
|
||||||
@ -271,7 +280,8 @@ public class MessageIntegrityAttribute
|
|||||||
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
||||||
|
|
||||||
byte[] key = null;
|
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))
|
if(Message.isRequestType(msgType))
|
||||||
{
|
{
|
||||||
@ -324,7 +334,7 @@ public class MessageIntegrityAttribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof MessageIntegrityAttribute) || obj == null)
|
if (! (obj instanceof MessageIntegrityAttribute))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -123,8 +134,7 @@ public class OptionalAttribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if(obj == null
|
if(! (obj instanceof OptionalAttribute) )
|
||||||
|| !(obj instanceof OptionalAttribute) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,175 +1,185 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
*
|
||||||
*
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
*
|
||||||
*/
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
package org.ice4j.attribute;
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
import org.ice4j.*;
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
/**
|
*
|
||||||
* This class is used to represent the PRIORITY attribute used for ICE processing
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* This attribute is not in the original specification of STUN
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* It is added as an extension to STUN to be used for ICE implementations
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*
|
* See the License for the specific language governing permissions and
|
||||||
* PRIORITY attribute contains a 32 bit priority value
|
* limitations under the License.
|
||||||
* It is used in stun binding requests sent from ICE-Agents to their
|
*/
|
||||||
* peers
|
package org.ice4j.attribute;
|
||||||
*
|
|
||||||
* @author Namal Senarathne
|
import org.ice4j.*;
|
||||||
*/
|
|
||||||
public class PriorityAttribute
|
/**
|
||||||
extends Attribute
|
* This class is used to represent the PRIORITY attribute used for ICE processing
|
||||||
{
|
* This attribute is not in the original specification of STUN
|
||||||
/**
|
* It is added as an extension to STUN to be used for ICE implementations
|
||||||
* The length of the Data contained in the Priority Attribute
|
*
|
||||||
*/
|
* PRIORITY attribute contains a 32 bit priority value
|
||||||
private static final char DATA_LENGTH_PRIORITY = 4;
|
* It is used in stun binding requests sent from ICE-Agents to their
|
||||||
|
* peers
|
||||||
/**
|
*
|
||||||
* The priority value specified in the attribute. An int should be enough
|
* @author Namal Senarathne
|
||||||
* to store this value, but long is used, since candidate and candidate-pair
|
*/
|
||||||
* classes use long to store priority values
|
public class PriorityAttribute
|
||||||
*/
|
extends Attribute
|
||||||
private long priority = 0;
|
{
|
||||||
|
/**
|
||||||
/**
|
* The length of the Data contained in the Priority Attribute
|
||||||
* Creates a priority attribute.
|
*/
|
||||||
*/
|
private static final char DATA_LENGTH_PRIORITY = 4;
|
||||||
public PriorityAttribute()
|
|
||||||
{
|
/**
|
||||||
super(PRIORITY);
|
* The priority value specified in the attribute. An int should be enough
|
||||||
}
|
* to store this value, but long is used, since candidate and candidate-pair
|
||||||
|
* classes use long to store priority values
|
||||||
/**
|
*/
|
||||||
* Reconstructs the priority value from the given byte array
|
private long priority = 0;
|
||||||
* and stores it in the 'long' variable
|
|
||||||
*
|
/**
|
||||||
* @param attributeValue a binary array containing this attribute's
|
* Creates a priority attribute.
|
||||||
* field values and NOT containing the attribute header.
|
*/
|
||||||
* @param offset the position where attribute values begin (most often
|
public PriorityAttribute()
|
||||||
* offset is equal to the index of the first byte after length)
|
{
|
||||||
* @param length the length of the binary array.
|
super(PRIORITY);
|
||||||
* @throws StunException if attrubteValue contains invalid data.
|
}
|
||||||
*/
|
|
||||||
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
/**
|
||||||
throws StunException
|
* Reconstructs the priority value from the given byte array
|
||||||
{
|
* and stores it in the 'long' variable
|
||||||
|
*
|
||||||
// array used to hold the intermediate long values reconstructed from
|
* @param attributeValue a binary array containing this attribute's
|
||||||
// the attributeValue array
|
* field values and NOT containing the attribute header.
|
||||||
long[] values = new long[4];
|
* @param offset the position where attribute values begin (most often
|
||||||
|
* offset is equal to the index of the first byte after length)
|
||||||
// Reading in the network byte order (Big-Endian)
|
* @param length the length of the binary array.
|
||||||
values[0] = (long)((attributeValue[offset++] & 0xff) << 24);
|
* @throws StunException if attrubteValue contains invalid data.
|
||||||
values[1] = (long)((attributeValue[offset++] & 0xff) << 16);
|
*/
|
||||||
values[2] = (long)((attributeValue[offset++] & 0xff) << 8);
|
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
||||||
values[3] = (long)(attributeValue[offset++] & 0xff);
|
throws StunException
|
||||||
|
{
|
||||||
// reconstructing the priority value
|
|
||||||
this.priority = values[0] | values[1] | values[2] | values[3];
|
// array used to hold the intermediate long values reconstructed from
|
||||||
}
|
// the attributeValue array
|
||||||
|
long[] values = new long[4];
|
||||||
/**
|
|
||||||
* Returns a binary representation of this attribute.
|
// Reading in the network byte order (Big-Endian)
|
||||||
*
|
values[0] = (long)((attributeValue[offset++] & 0xff) << 24);
|
||||||
* @return a binary representation of this attribute.
|
values[1] = (long)((attributeValue[offset++] & 0xff) << 16);
|
||||||
*/
|
values[2] = (long)((attributeValue[offset++] & 0xff) << 8);
|
||||||
public byte[] encode()
|
values[3] = (long)(attributeValue[offset++] & 0xff);
|
||||||
{
|
|
||||||
char type = getAttributeType();
|
// reconstructing the priority value
|
||||||
byte[] binValue = new byte[HEADER_LENGTH + getDataLength()];
|
this.priority = values[0] | values[1] | values[2] | values[3];
|
||||||
|
}
|
||||||
//Type
|
|
||||||
binValue[0] = (byte)(type >> 8);
|
/**
|
||||||
binValue[1] = (byte)(type & 0x00FF);
|
* Returns a binary representation of this attribute.
|
||||||
|
*
|
||||||
//Length
|
* @return a binary representation of this attribute.
|
||||||
binValue[2] = (byte)(getDataLength() >> 8);
|
*/
|
||||||
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
public byte[] encode()
|
||||||
|
{
|
||||||
//Priority
|
char type = getAttributeType();
|
||||||
binValue[4] = (byte)((priority & 0xFF000000L) >> 24);
|
byte[] binValue = new byte[HEADER_LENGTH + getDataLength()];
|
||||||
binValue[5] = (byte)((priority & 0x00FF0000L) >> 16);
|
|
||||||
binValue[6] = (byte)((priority & 0x0000FF00L) >> 8);
|
//Type
|
||||||
binValue[7] = (byte)(priority & 0x000000FFL);
|
binValue[0] = (byte)(type >> 8);
|
||||||
|
binValue[1] = (byte)(type & 0x00FF);
|
||||||
return binValue;
|
|
||||||
}
|
//Length
|
||||||
|
binValue[2] = (byte)(getDataLength() >> 8);
|
||||||
/**
|
binValue[3] = (byte)(getDataLength() & 0x00FF);
|
||||||
* Compares two STUN Attributes. Two attributes are considered equal when
|
|
||||||
* they have the same type length and value.
|
//Priority
|
||||||
*
|
binValue[4] = (byte)((priority & 0xFF000000L) >> 24);
|
||||||
* @param obj the object to compare this attribute with.
|
binValue[5] = (byte)((priority & 0x00FF0000L) >> 16);
|
||||||
* @return true if the attributes are equal and false otherwise.
|
binValue[6] = (byte)((priority & 0x0000FF00L) >> 8);
|
||||||
*/
|
binValue[7] = (byte)(priority & 0x000000FFL);
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
return binValue;
|
||||||
if (! (obj instanceof PriorityAttribute)
|
}
|
||||||
|| obj == null)
|
|
||||||
return false;
|
/**
|
||||||
|
* Compares two STUN Attributes. Two attributes are considered equal when
|
||||||
if (obj == this)
|
* they have the same type length and value.
|
||||||
return true;
|
*
|
||||||
|
* @param obj the object to compare this attribute with.
|
||||||
PriorityAttribute att = (PriorityAttribute) obj;
|
* @return true if the attributes are equal and false otherwise.
|
||||||
if (att.getAttributeType() != getAttributeType()
|
*/
|
||||||
|| att.getDataLength() != getDataLength()
|
public boolean equals(Object obj)
|
||||||
|| (priority != att.priority))
|
{
|
||||||
return false;
|
if (! (obj instanceof PriorityAttribute))
|
||||||
|
return false;
|
||||||
return true;
|
|
||||||
}
|
if (obj == this)
|
||||||
|
return true;
|
||||||
/**
|
|
||||||
* Returns the length of this attribute's body.
|
PriorityAttribute att = (PriorityAttribute) obj;
|
||||||
*
|
if (att.getAttributeType() != getAttributeType()
|
||||||
* @return the length of this attribute's value.
|
|| att.getDataLength() != getDataLength()
|
||||||
*/
|
|| (priority != att.priority))
|
||||||
public char getDataLength()
|
return false;
|
||||||
{
|
|
||||||
return DATA_LENGTH_PRIORITY;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the human readable name of this attribute.
|
* Returns the length of this attribute's body.
|
||||||
*
|
*
|
||||||
* @return this attribute's name.
|
* @return the length of this attribute's value.
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public char getDataLength()
|
||||||
{
|
{
|
||||||
return "PRIORITY";
|
return DATA_LENGTH_PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the priority specified in the PRIORITY Attribute
|
* Returns the human readable name of this attribute.
|
||||||
*
|
*
|
||||||
* @return long specifying the priority
|
* @return this attribute's name.
|
||||||
*/
|
*/
|
||||||
public long getPriority()
|
public String getName()
|
||||||
{
|
{
|
||||||
return priority;
|
return "PRIORITY";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the priority of the PRIORITY Attribute with the specified value
|
* Returns the priority specified in the PRIORITY Attribute
|
||||||
*
|
*
|
||||||
* @param priority the long variable specifying the priority value
|
* @return long specifying the priority
|
||||||
*
|
*/
|
||||||
* @throws IllegalArgumentException if indicated priority value is illegal.
|
public long getPriority()
|
||||||
*/
|
{
|
||||||
public void setPriority(long priority)
|
return priority;
|
||||||
throws IllegalArgumentException
|
}
|
||||||
{
|
|
||||||
/* Priority must be between 1 and (2^31 - 1) */
|
/**
|
||||||
if(priority <= 0 || priority > 0x7FFFFFFFL)
|
* Sets the priority of the PRIORITY Attribute with the specified value
|
||||||
{
|
*
|
||||||
throw new IllegalArgumentException("Priority must be " +
|
* @param priority the long variable specifying the priority value
|
||||||
"between 0 and (2**31 - 1)");
|
*
|
||||||
}
|
* @throws IllegalArgumentException if indicated priority value is illegal.
|
||||||
else
|
*/
|
||||||
this.priority = priority;
|
public void setPriority(long priority)
|
||||||
}
|
throws IllegalArgumentException
|
||||||
}
|
{
|
||||||
|
/* Priority must be between 1 and (2^31 - 1) */
|
||||||
|
if(priority <= 0 || priority > 0x7FFFFFFFL)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Priority must be " +
|
||||||
|
"between 0 and (2**31 - 1)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -130,7 +141,7 @@ public class RealmAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof RealmAttribute) || obj == null)
|
if (! (obj instanceof RealmAttribute))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -27,4 +38,4 @@ public class RemoteAddressAttribute extends AddressAttribute
|
|||||||
{
|
{
|
||||||
super(REMOTE_ADDRESS);
|
super(REMOTE_ADDRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -59,8 +70,7 @@ public class RequestedTransportAttribute extends Attribute
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof RequestedTransportAttribute)
|
if (! (obj instanceof RequestedTransportAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -120,7 +131,7 @@ public class ReservationTokenAttribute
|
|||||||
|
|
||||||
byte[] copy = new byte[reservationToken.length];
|
byte[] copy = new byte[reservationToken.length];
|
||||||
System.arraycopy(reservationToken, 0, copy, 0, 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++)
|
for(int i = 0; i < b; i++)
|
||||||
{
|
{
|
||||||
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFl);
|
token.reservationToken[i] = (byte)((left >> (i * 8)) & 0xFFL);
|
||||||
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFl);
|
token.reservationToken[i + b] = (byte)((right >> (i * 8)) & 0xFFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate hashcode for Hashtable storage.
|
//calculate hashcode for Hashtable storage.
|
||||||
@ -205,8 +216,7 @@ public class ReservationTokenAttribute
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof ReservationTokenAttribute)
|
if (! (obj instanceof ReservationTokenAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -110,7 +121,7 @@ public class SoftwareAttribute
|
|||||||
|
|
||||||
byte[] copy = new byte[software.length];
|
byte[] copy = new byte[software.length];
|
||||||
System.arraycopy(software, 0, copy, 0, 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)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof SoftwareAttribute)
|
if (! (obj instanceof SoftwareAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
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.
|
* 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.
|
* Constructor.
|
||||||
@ -89,7 +100,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
//some attributes may be repeated for padding
|
//some attributes may be repeated for padding
|
||||||
//(packet length should be divisable by 4)
|
//(packet length should be divisable by 4)
|
||||||
if(!contains(attributeID))
|
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)
|
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 )
|
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();
|
Iterator<Character> attributes = getAttributes();
|
||||||
while (attributes.hasNext())
|
while (attributes.hasNext())
|
||||||
{
|
{
|
||||||
char att = attributes.next().charValue();
|
char att = attributes.next();
|
||||||
binValue[offset++] = (byte)(att >> 8);
|
binValue[offset++] = (byte)(att >> 8);
|
||||||
binValue[offset++] = (byte)(att & 0x00FF);
|
binValue[offset++] = (byte)(att & 0x00FF);
|
||||||
}
|
}
|
||||||
@ -180,8 +191,7 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof UnknownAttributesAttribute)
|
if (! (obj instanceof UnknownAttributesAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
@ -218,8 +228,8 @@ public class UnknownAttributesAttribute extends Attribute
|
|||||||
char originalOffset = offset;
|
char originalOffset = offset;
|
||||||
for(int i = offset; i < originalOffset + length; i += 2)
|
for(int i = offset; i < originalOffset + length; i += 2)
|
||||||
{
|
{
|
||||||
char attributeID = (char)( (attributeValue[offset++] << 8) |
|
char attributeID = (char) (((attributeValue[offset++] & 0xFF) << 8)
|
||||||
(attributeValue[offset++]) );
|
| (attributeValue[offset++] & 0xFF));
|
||||||
addAttributeID(attributeID);
|
addAttributeID(attributeID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,109 +1,125 @@
|
|||||||
package org.ice4j.attribute;
|
/*
|
||||||
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
import org.ice4j.*;
|
*
|
||||||
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
/**
|
*
|
||||||
* This class implements the USE-CANDIDATE attribute
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* This attribute is an extension to the original STUN protocol
|
* you may not use this file except in compliance with the License.
|
||||||
* This is used only during an ICE implementation
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* This attribute serves as only a flag, it does not have any data
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* so the data length is zero
|
*
|
||||||
*/
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
public class UseCandidateAttribute
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
extends Attribute
|
* 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.
|
||||||
* Data length.
|
*/
|
||||||
*/
|
package org.ice4j.attribute;
|
||||||
private static final char DATA_LENGTH_USE_CANDIDATE = 0;
|
|
||||||
|
import org.ice4j.*;
|
||||||
/**
|
|
||||||
* Constructor.
|
/**
|
||||||
*/
|
* This class implements the USE-CANDIDATE attribute
|
||||||
protected UseCandidateAttribute()
|
* This attribute is an extension to the original STUN protocol
|
||||||
{
|
* This is used only during an ICE implementation
|
||||||
super(USE_CANDIDATE);
|
*
|
||||||
}
|
* This attribute serves as only a flag, it does not have any data
|
||||||
|
* so the data length is zero
|
||||||
/**
|
*/
|
||||||
* Decodes the USE-CANDIDATE attribute's body, which is empty
|
public class UseCandidateAttribute
|
||||||
*
|
extends Attribute
|
||||||
* @param attributeValue a binary array containing this attribute's
|
{
|
||||||
* field values and NOT containing the attribute header.
|
/**
|
||||||
* @param offset the position where attribute values begin (most often
|
* Data length.
|
||||||
* offset is equal to the index of the first byte after length)
|
*/
|
||||||
* @param length the length of the binary array.
|
private static final char DATA_LENGTH_USE_CANDIDATE = 0;
|
||||||
* @throws StunException if attrubteValue contains invalid data.
|
|
||||||
*/
|
/**
|
||||||
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
* Constructor.
|
||||||
throws StunException
|
*/
|
||||||
{
|
protected UseCandidateAttribute()
|
||||||
// Do nothing, empty attribute body
|
{
|
||||||
}
|
super(USE_CANDIDATE);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Returns a binary representation of this attribute.
|
/**
|
||||||
*
|
* Decodes the USE-CANDIDATE attribute's body, which is empty
|
||||||
* @return a binary representation of this attribute.
|
*
|
||||||
*/
|
* @param attributeValue a binary array containing this attribute's
|
||||||
public byte[] encode()
|
* field values and NOT containing the attribute header.
|
||||||
{
|
* @param offset the position where attribute values begin (most often
|
||||||
char type = getAttributeType();
|
* offset is equal to the index of the first byte after length)
|
||||||
byte[] binValue = new byte[HEADER_LENGTH + DATA_LENGTH_USE_CANDIDATE];
|
* @param length the length of the binary array.
|
||||||
|
* @throws StunException if attrubteValue contains invalid data.
|
||||||
// Type
|
*/
|
||||||
binValue[0] = (byte)(type >> 8);
|
void decodeAttributeBody(byte[] attributeValue, char offset, char length)
|
||||||
binValue[1] = (byte)(type & 0x00FF);
|
throws StunException
|
||||||
|
{
|
||||||
// Length
|
// Do nothing, empty attribute body
|
||||||
binValue[2] = (byte)(DATA_LENGTH_USE_CANDIDATE >> 8);
|
}
|
||||||
binValue[3] = (byte)(DATA_LENGTH_USE_CANDIDATE & 0x00FF);
|
|
||||||
|
/**
|
||||||
return binValue;
|
* Returns a binary representation of this attribute.
|
||||||
}
|
*
|
||||||
|
* @return a binary representation of this attribute.
|
||||||
/**
|
*/
|
||||||
* Compares two STUN Attributes. Two attributes are considered equal when
|
public byte[] encode()
|
||||||
* they have the same type, length and value.
|
{
|
||||||
*
|
char type = getAttributeType();
|
||||||
* @param obj the object to compare this attribute with.
|
byte[] binValue = new byte[HEADER_LENGTH + DATA_LENGTH_USE_CANDIDATE];
|
||||||
* @return true if the attributes are equal and false otherwise.
|
|
||||||
*/
|
// Type
|
||||||
public boolean equals(Object obj)
|
binValue[0] = (byte)(type >> 8);
|
||||||
{
|
binValue[1] = (byte)(type & 0x00FF);
|
||||||
if(!(obj instanceof UseCandidateAttribute)
|
|
||||||
|| obj == null)
|
// Length
|
||||||
return false;
|
binValue[2] = (byte)(DATA_LENGTH_USE_CANDIDATE >> 8);
|
||||||
|
binValue[3] = (byte)(DATA_LENGTH_USE_CANDIDATE & 0x00FF);
|
||||||
if(obj == this)
|
|
||||||
return true;
|
return binValue;
|
||||||
|
}
|
||||||
UseCandidateAttribute useCandidateAtt = (UseCandidateAttribute)obj;
|
|
||||||
if(useCandidateAtt.getAttributeType() != getAttributeType()
|
/**
|
||||||
|| useCandidateAtt.getDataLength() != getDataLength())
|
* Compares two STUN Attributes. Two attributes are considered equal when
|
||||||
return false;
|
* they have the same type, length and value.
|
||||||
|
*
|
||||||
return true;
|
* @param obj the object to compare this attribute with.
|
||||||
}
|
* @return true if the attributes are equal and false otherwise.
|
||||||
|
*/
|
||||||
/**
|
public boolean equals(Object obj)
|
||||||
* Returns the length of this attribute's body.
|
{
|
||||||
*
|
if(!(obj instanceof UseCandidateAttribute))
|
||||||
* @return the length of this attribute's value.
|
return false;
|
||||||
*/
|
|
||||||
public char getDataLength()
|
if(obj == this)
|
||||||
{
|
return true;
|
||||||
return DATA_LENGTH_USE_CANDIDATE;
|
|
||||||
}
|
UseCandidateAttribute useCandidateAtt = (UseCandidateAttribute)obj;
|
||||||
|
if(useCandidateAtt.getAttributeType() != getAttributeType()
|
||||||
/**
|
|| useCandidateAtt.getDataLength() != getDataLength())
|
||||||
* Returns the human readable name of this attribute.
|
return false;
|
||||||
*
|
|
||||||
* @return this attribute's name.
|
return true;
|
||||||
*/
|
}
|
||||||
public String getName()
|
|
||||||
{
|
/**
|
||||||
return "USE-CANDIDATE";
|
* Returns the length of this attribute's body.
|
||||||
}
|
*
|
||||||
}
|
* @return the length of this attribute's value.
|
||||||
|
*/
|
||||||
|
public char getDataLength()
|
||||||
|
{
|
||||||
|
return DATA_LENGTH_USE_CANDIDATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the human readable name of this attribute.
|
||||||
|
*
|
||||||
|
* @return this attribute's name.
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "USE-CANDIDATE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -136,7 +147,7 @@ public class UsernameAttribute extends Attribute
|
|||||||
*/
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof UsernameAttribute) || obj == null)
|
if (! (obj instanceof UsernameAttribute))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
@ -100,8 +111,7 @@ public class XorOnlyAttribute
|
|||||||
|
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (! (obj instanceof XorOnlyAttribute)
|
if (! (obj instanceof XorOnlyAttribute))
|
||||||
|| obj == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the Jitsi community (https://jitsi.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -17,7 +27,6 @@ import java.util.logging.*;
|
|||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.harvest.*;
|
import org.ice4j.ice.harvest.*;
|
||||||
import org.ice4j.ice.harvest.TrickleCallback;
|
|
||||||
import org.ice4j.stack.*;
|
import org.ice4j.stack.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +107,7 @@ public class Agent
|
|||||||
* This map preserves the insertion order of the media streams.
|
* This map preserves the insertion order of the media streams.
|
||||||
*/
|
*/
|
||||||
private final Map<String, IceMediaStream> mediaStreams
|
private final Map<String, IceMediaStream> mediaStreams
|
||||||
= new LinkedHashMap<String, IceMediaStream>();
|
= new LinkedHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The candidate harvester that we use to gather candidate on the local
|
* 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
|
* harvest candidates synchronously, and previously to harvesting by
|
||||||
* {@link #harvesters}.
|
* {@link #harvesters}.
|
||||||
*/
|
*/
|
||||||
private final List<CandidateHarvester> hostHarvesters
|
private final List<CandidateHarvester> hostHarvesters = new LinkedList<>();
|
||||||
= new LinkedList<CandidateHarvester>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of harvesters (i.e. STUN, TURN, and others) that the agent should
|
* 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.
|
* the necessary triggered checks.
|
||||||
*/
|
*/
|
||||||
private final List<CandidatePair> preDiscoveredPairsQueue
|
private final List<CandidatePair> preDiscoveredPairsQueue
|
||||||
= new LinkedList<CandidatePair>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The lock that we use while starting connectivity establishment.
|
* The lock that we use while starting connectivity establishment.
|
||||||
@ -218,7 +226,7 @@ public class Agent
|
|||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> stateListeners
|
private final List<PropertyChangeListener> stateListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>StunStack</tt> used by this <tt>Agent</tt>.
|
* The <tt>StunStack</tt> used by this <tt>Agent</tt>.
|
||||||
@ -307,7 +315,7 @@ public class Agent
|
|||||||
new BigInteger(128, random).toString(32),
|
new BigInteger(128, random).toString(32),
|
||||||
/* min */ 22, /* max */ 256);
|
/* min */ 22, /* max */ 256);
|
||||||
|
|
||||||
tieBreaker = Math.abs(random.nextLong());
|
tieBreaker = random.nextLong() & 0x7FFFFFFFFFFFFFFFL;
|
||||||
nominator = new DefaultNominator(this);
|
nominator = new DefaultNominator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +373,7 @@ public class Agent
|
|||||||
* all and only local candidates.
|
* all and only local candidates.
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if either <tt>minPort</tt> or
|
* @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 >
|
||||||
* maxPort</tt>, or if <tt>transport</tt> is not currently supported.
|
* maxPort</tt>, or if <tt>transport</tt> is not currently supported.
|
||||||
* @throws IOException if an error occurs while the underlying resolver lib
|
* @throws IOException if an error occurs while the underlying resolver lib
|
||||||
* is using sockets.
|
* is using sockets.
|
||||||
@ -414,6 +422,28 @@ public class Agent
|
|||||||
return component;
|
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
|
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
||||||
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
* <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
|
//create a list of components and start harvesting
|
||||||
List<Component> components = new LinkedList<Component>();
|
List<Component> components = new LinkedList<>();
|
||||||
|
|
||||||
for (IceMediaStream stream : getStreams())
|
for (IceMediaStream stream : getStreams())
|
||||||
{
|
{
|
||||||
@ -561,14 +591,12 @@ public class Agent
|
|||||||
"Trigger checks for pairs that were received before "
|
"Trigger checks for pairs that were received before "
|
||||||
+ "running state");
|
+ "running state");
|
||||||
|
|
||||||
Iterator<CandidatePair> it = preDiscoveredPairsQueue.iterator();
|
for (CandidatePair cp : preDiscoveredPairsQueue)
|
||||||
|
|
||||||
while(it.hasNext())
|
|
||||||
{
|
{
|
||||||
triggerCheck(it.next());
|
triggerCheck(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preDiscoveredPairsQueue.clear();
|
preDiscoveredPairsQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
connCheckClient.startChecks();
|
connCheckClient.startChecks();
|
||||||
@ -653,9 +681,9 @@ public class Agent
|
|||||||
*/
|
*/
|
||||||
public boolean isOver()
|
public boolean isOver()
|
||||||
{
|
{
|
||||||
return state == IceProcessingState.COMPLETED
|
IceProcessingState state = getState();
|
||||||
|| state == IceProcessingState.TERMINATED
|
|
||||||
|| state == IceProcessingState.FAILED;
|
return (state != null) && state.isOver();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -679,7 +707,7 @@ public class Agent
|
|||||||
synchronized(stateListeners)
|
synchronized(stateListeners)
|
||||||
{
|
{
|
||||||
if(!stateListeners.contains(l))
|
if(!stateListeners.contains(l))
|
||||||
this.stateListeners.add(l);
|
stateListeners.add(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +721,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(stateListeners)
|
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
|
* candidate foundations. We use the <tt>FoundationsRegistry</tt> to keep
|
||||||
* track of the foundations we assign within a session (i.e. the entire life
|
* track of the foundations we assign within a session (i.e. the entire life
|
||||||
* time of an <tt>Agent</tt>)
|
* time of an <tt>Agent</tt>)
|
||||||
|
* @return the {@link FoundationsRegistry} of this agent
|
||||||
*/
|
*/
|
||||||
public final FoundationsRegistry getFoundationsRegistry()
|
public final FoundationsRegistry getFoundationsRegistry()
|
||||||
{
|
{
|
||||||
@ -1032,7 +1061,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(mediaStreams)
|
synchronized(mediaStreams)
|
||||||
{
|
{
|
||||||
return new LinkedList<String>(mediaStreams.keySet());
|
return new LinkedList<>(mediaStreams.keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1047,7 +1076,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
synchronized(mediaStreams)
|
synchronized(mediaStreams)
|
||||||
{
|
{
|
||||||
return new LinkedList<IceMediaStream>(mediaStreams.values());
|
return new LinkedList<>(mediaStreams.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,7 +1468,7 @@ public class Agent
|
|||||||
ufrag);
|
ufrag);
|
||||||
|
|
||||||
CandidatePair triggeredPair
|
CandidatePair triggeredPair
|
||||||
= new CandidatePair(localCandidate, remoteCandidate);
|
= createCandidatePair(localCandidate, remoteCandidate);
|
||||||
|
|
||||||
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
||||||
triggeredPair.toShortString());
|
triggeredPair.toShortString());
|
||||||
@ -1505,29 +1534,6 @@ public class Agent
|
|||||||
//we already know about the remote address so we only need to
|
//we already know about the remote address so we only need to
|
||||||
//trigger a check for the existing pair
|
//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 )
|
if (knownPair.getState() == CandidatePairState.SUCCEEDED )
|
||||||
{
|
{
|
||||||
//7.2.1.5. Updating the Nominated Flag
|
//7.2.1.5. Updating the Nominated Flag
|
||||||
@ -1576,7 +1582,6 @@ public class Agent
|
|||||||
if(triggerPair.getParentComponent().getSelectedPair() == null)
|
if(triggerPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Add peer CandidatePair with new reflexive " +
|
logger.info("Add peer CandidatePair with new reflexive " +
|
||||||
"address to checkList: " + triggerPair);
|
"address to checkList: " + triggerPair);
|
||||||
triggerPair.setUseCandidateReceived();
|
|
||||||
parentStream.addToCheckList(triggerPair);
|
parentStream.addToCheckList(triggerPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1633,23 +1638,24 @@ public class Agent
|
|||||||
public synchronized void nominate(CandidatePair pair)
|
public synchronized void nominate(CandidatePair pair)
|
||||||
throws IllegalStateException
|
throws IllegalStateException
|
||||||
{
|
{
|
||||||
if(! isControlling() )
|
if(!isControlling())
|
||||||
throw new IllegalStateException("Only controlling agents can "
|
{
|
||||||
+"nominate pairs");
|
throw new IllegalStateException(
|
||||||
|
"Only controlling agents can nominate pairs");
|
||||||
|
}
|
||||||
|
|
||||||
Component parentComponent = pair.getParentComponent();
|
Component parentComponent = pair.getParentComponent();
|
||||||
IceMediaStream parentStream = parentComponent.getParentStream();
|
IceMediaStream parentStream = parentComponent.getParentStream();
|
||||||
|
|
||||||
//If the pair is not already nominated and if its parent component
|
//If the pair is not already nominated and if its parent component
|
||||||
//does not already contain a nominated pair - nominate it.
|
//does not already contain a nominated pair - nominate it.
|
||||||
if(!pair.isNominated()
|
if (!pair.isNominated()
|
||||||
&& !parentStream.validListContainsNomineeForComponent(
|
&& !parentStream.validListContainsNomineeForComponent(
|
||||||
parentComponent))
|
parentComponent))
|
||||||
{
|
{
|
||||||
logger.info("verify if nominated pair answer again");
|
logger.info("verify if nominated pair answer again");
|
||||||
pair.nominate();
|
pair.nominate();
|
||||||
pair.getParentComponent().getParentStream()
|
parentStream.getCheckList().scheduleTriggeredCheck(pair);
|
||||||
.getCheckList().scheduleTriggeredCheck(pair);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1886,7 +1892,6 @@ public class Agent
|
|||||||
* @return the value of the <tt>Ta</tt> pace timer according to the
|
* @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
|
* number and type of {@link IceMediaStream}s this agent will be using or
|
||||||
* a pre-configured value if the application has set one.
|
* a pre-configured value if the application has set one.
|
||||||
* <p>
|
|
||||||
*/
|
*/
|
||||||
protected long calculateTa()
|
protected long calculateTa()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -52,7 +62,7 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
/**
|
/**
|
||||||
* The transport address represented by this 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
|
* 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
|
* server reflexive, peer reflexive and relayed candidates. Others may be
|
||||||
* added in the future.
|
* added in the future.
|
||||||
*/
|
*/
|
||||||
private CandidateType candidateType = null;
|
private CandidateType candidateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary string that is the same for two candidates
|
* 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());
|
&& 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
|
* Returns a reference to the <tt>Component</tt> that this candidate belongs
|
||||||
* to.
|
* to.
|
||||||
@ -946,24 +970,24 @@ public abstract class Candidate<T extends Candidate<?>>
|
|||||||
TransportAddress relatedAddress = null;
|
TransportAddress relatedAddress = null;
|
||||||
switch (getType())
|
switch (getType())
|
||||||
{
|
{
|
||||||
case SERVER_REFLEXIVE_CANDIDATE:
|
case SERVER_REFLEXIVE_CANDIDATE:
|
||||||
if(getBase() != null)
|
if(getBase() != null)
|
||||||
{
|
{
|
||||||
relatedAddress = getBase().getTransportAddress();
|
relatedAddress = getBase().getTransportAddress();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PEER_REFLEXIVE_CANDIDATE:
|
case PEER_REFLEXIVE_CANDIDATE:
|
||||||
if(getBase() != null)
|
if(getBase() != null)
|
||||||
{
|
{
|
||||||
relatedAddress = getBase().getTransportAddress();
|
relatedAddress = getBase().getTransportAddress();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RELAYED_CANDIDATE:
|
case RELAYED_CANDIDATE:
|
||||||
relatedAddress = getMappedAddress();
|
relatedAddress = getMappedAddress();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//host candidate
|
//host candidate
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Update the related candidate conforming to the related address.
|
// Update the related candidate conforming to the related address.
|
||||||
this.relatedCandidate = findRelatedCandidate(relatedAddress);
|
this.relatedCandidate = findRelatedCandidate(relatedAddress);
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -120,7 +131,6 @@ public class CandidatePair
|
|||||||
public CandidatePair(LocalCandidate localCandidate,
|
public CandidatePair(LocalCandidate localCandidate,
|
||||||
RemoteCandidate remoteCandidate)
|
RemoteCandidate remoteCandidate)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.localCandidate = localCandidate;
|
this.localCandidate = localCandidate;
|
||||||
this.remoteCandidate = remoteCandidate;
|
this.remoteCandidate = remoteCandidate;
|
||||||
|
|
||||||
@ -357,7 +367,7 @@ public class CandidatePair
|
|||||||
* agent. Let D be the priority for the candidate provided by the
|
* agent. Let D be the priority for the candidate provided by the
|
||||||
* controlled agent. The priority for a pair is computed as:
|
* controlled agent. The priority for a pair is computed as:
|
||||||
* <p>
|
* <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>D?1:0)</i>
|
||||||
* <p>
|
* <p>
|
||||||
* This formula ensures a unique priority for each pair. Once the priority
|
* This formula ensures a unique priority for each pair. Once the priority
|
||||||
* is assigned, the agent sorts the candidate pairs in decreasing order of
|
* is assigned, the agent sorts the candidate pairs in decreasing order of
|
||||||
@ -433,19 +443,33 @@ public class CandidatePair
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if ((obj == null) || !(obj instanceof CandidatePair))
|
if (! (obj instanceof CandidatePair))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CandidatePair candidatePair = (CandidatePair) obj;
|
CandidatePair candidatePair = (CandidatePair) obj;
|
||||||
|
|
||||||
//DO NOT change this method to also depend on other pair properties
|
// XXX DO NOT change this method to also depend on other pair properties
|
||||||
//because the Conn Check Client counts on it only using the candidates
|
// because ConnectivityCheckClient counts on it only using the
|
||||||
//for comparisons.
|
// candidates for comparisons.
|
||||||
return
|
return
|
||||||
localCandidate.equals(candidatePair.localCandidate)
|
localCandidate.equals(candidatePair.localCandidate)
|
||||||
&& remoteCandidate.equals(candidatePair.remoteCandidate);
|
&& 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>.
|
* Returns a String representation of this <tt>CandidatePair</tt>.
|
||||||
*
|
*
|
||||||
@ -605,8 +629,8 @@ public class CandidatePair
|
|||||||
getParentComponent().getParentStream().firePairPropertyChange(
|
getParentComponent().getParentStream().firePairPropertyChange(
|
||||||
this,
|
this,
|
||||||
IceMediaStream.PROPERTY_PAIR_NOMINATED,
|
IceMediaStream.PROPERTY_PAIR_NOMINATED,
|
||||||
false,
|
/* oldValue */ false,
|
||||||
true);
|
/* newValue */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -88,4 +98,4 @@ class CandidatePrioritizer
|
|||||||
{
|
{
|
||||||
return (obj instanceof CandidatePrioritizer);
|
return (obj instanceof CandidatePrioritizer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -63,6 +74,8 @@ public enum CandidateTcpType
|
|||||||
* Parses the string <tt>candidateTcpTypeName</tt> and return the
|
* Parses the string <tt>candidateTcpTypeName</tt> and return the
|
||||||
* corresponding <tt>CandidateTcpType</tt> instance.
|
* corresponding <tt>CandidateTcpType</tt> instance.
|
||||||
*
|
*
|
||||||
|
* @param candidateTcpTypeName the string to parse
|
||||||
|
* @return candidateTcpTypeName as an Enum
|
||||||
* @throws IllegalArgumentException in case <tt>candidateTcpTypeName</tt> is
|
* @throws IllegalArgumentException in case <tt>candidateTcpTypeName</tt> is
|
||||||
* not a valid or currently supported candidate TCP type.
|
* not a valid or currently supported candidate TCP type.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
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 pair would get into a triggered check queue as soon as we receive
|
||||||
* a check on its local candidate.
|
* a check on its local candidate.
|
||||||
*/
|
*/
|
||||||
private final List<CandidatePair> triggeredCheckQueue
|
private final List<CandidatePair> triggeredCheckQueue = new LinkedList<>();
|
||||||
= new LinkedList<CandidatePair>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to the {@link IceMediaStream} that we belong to.
|
* A reference to the {@link IceMediaStream} that we belong to.
|
||||||
@ -58,14 +68,14 @@ public class CheckList
|
|||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> stateListeners
|
private final List<PropertyChangeListener> stateListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains {@link PropertyChangeListener}s registered with this {@link
|
* Contains {@link PropertyChangeListener}s registered with this {@link
|
||||||
* Agent} and following its changes of state.
|
* Agent} and following its changes of state.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> checkListeners
|
private final List<PropertyChangeListener> checkListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
||||||
@ -286,8 +296,7 @@ public class CheckList
|
|||||||
*/
|
*/
|
||||||
protected synchronized void computeInitialCheckListPairStates()
|
protected synchronized void computeInitialCheckListPairStates()
|
||||||
{
|
{
|
||||||
Map<String, CandidatePair> pairsToWait
|
Map<String, CandidatePair> pairsToWait = new Hashtable<>();
|
||||||
= new Hashtable<String, CandidatePair>();
|
|
||||||
|
|
||||||
//first, determine the pairs that we'd need to put in the waiting state.
|
//first, determine the pairs that we'd need to put in the waiting state.
|
||||||
for(CandidatePair pair : this)
|
for(CandidatePair pair : this)
|
||||||
@ -374,9 +383,9 @@ public class CheckList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Selected pair for stream " +
|
logger.info(
|
||||||
cmp.toShortString() + ": " +
|
"Selected pair for stream " + cmp.toShortString() + ": "
|
||||||
nominatedPair.toShortString());
|
+ nominatedPair.toShortString());
|
||||||
|
|
||||||
cmp.setSelectedPair(nominatedPair);
|
cmp.setSelectedPair(nominatedPair);
|
||||||
|
|
||||||
@ -497,8 +506,7 @@ public class CheckList
|
|||||||
|
|
||||||
synchronized(stateListeners)
|
synchronized(stateListeners)
|
||||||
{
|
{
|
||||||
listenersCopy
|
listenersCopy = new LinkedList<>(stateListeners);
|
||||||
= new LinkedList<PropertyChangeListener>(stateListeners);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChangeEvent evt = new PropertyChangeEvent(
|
PropertyChangeEvent evt = new PropertyChangeEvent(
|
||||||
@ -553,8 +561,7 @@ public class CheckList
|
|||||||
|
|
||||||
synchronized(checkListeners)
|
synchronized(checkListeners)
|
||||||
{
|
{
|
||||||
listenersCopy
|
listenersCopy = new LinkedList<>(checkListeners);
|
||||||
= new LinkedList<PropertyChangeListener>(checkListeners);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyChangeEvent evt = new PropertyChangeEvent(
|
PropertyChangeEvent evt = new PropertyChangeEvent(
|
||||||
|
|||||||
@ -1,25 +1,36 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Everty <tt>CheckList</tt> is associated with a state, which captures the
|
* Everty <tt>CheckList</tt> is associated with a state, which captures the
|
||||||
* state of ICE checks for that media stream. There are three states:
|
* 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
|
* Running: In this state, ICE checks are still in progress for this
|
||||||
* media stream.
|
* media stream.
|
||||||
* <p/>
|
* <br>
|
||||||
* Completed: In this state, ICE checks have produced nominated pairs
|
* Completed: In this state, ICE checks have produced nominated pairs
|
||||||
* for each component of the media stream. Consequently, ICE has succeeded and
|
* for each component of the media stream. Consequently, ICE has succeeded and
|
||||||
* media can be sent.
|
* media can be sent.
|
||||||
* <p/>
|
* <br>
|
||||||
* Failed: In this state, the ICE checks have not completed successfully for
|
* Failed: In this state, the ICE checks have not completed successfully for
|
||||||
* this media stream.
|
* this media stream.
|
||||||
* <p/>
|
* <br>
|
||||||
* When a check list is first constructed as the consequence of an offer/answer
|
* When a check list is first constructed as the consequence of an offer/answer
|
||||||
* exchange, it is placed in the Running state.
|
* exchange, it is placed in the Running state.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -63,21 +73,19 @@ public class Component
|
|||||||
/**
|
/**
|
||||||
* The list locally gathered candidates for this media stream.
|
* The list locally gathered candidates for this media stream.
|
||||||
*/
|
*/
|
||||||
private final List<LocalCandidate> localCandidates
|
private final List<LocalCandidate> localCandidates = new LinkedList<>();
|
||||||
= new LinkedList<LocalCandidate>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of candidates that the peer agent sent for this stream.
|
* The list of candidates that the peer agent sent for this stream.
|
||||||
*/
|
*/
|
||||||
private final List<RemoteCandidate> remoteCandidates
|
private final List<RemoteCandidate> remoteCandidates = new LinkedList<>();
|
||||||
= new LinkedList<RemoteCandidate>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of candidates that the peer agent sent for this stream after
|
* The list of candidates that the peer agent sent for this stream after
|
||||||
* connectivity establishment.
|
* connectivity establishment.
|
||||||
*/
|
*/
|
||||||
private final List<RemoteCandidate> remoteUpdateCandidates =
|
private final List<RemoteCandidate> remoteUpdateCandidates
|
||||||
new LinkedList<RemoteCandidate>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <tt>Comparator</tt> that we use for sorting <tt>Candidate</tt>s by
|
* A <tt>Comparator</tt> that we use for sorting <tt>Candidate</tt>s by
|
||||||
@ -175,7 +183,7 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
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() + ": " +
|
logger.info("Update remote candidate for " + toShortString() + ": " +
|
||||||
candidate.getTransportAddress());
|
candidate.getTransportAddress());
|
||||||
|
|
||||||
List<RemoteCandidate> existingCandidates
|
List<RemoteCandidate> existingCandidates = new LinkedList<>();
|
||||||
= new LinkedList<RemoteCandidate>();
|
|
||||||
synchronized (remoteCandidates)
|
synchronized (remoteCandidates)
|
||||||
{
|
{
|
||||||
existingCandidates.addAll(remoteCandidates);
|
existingCandidates.addAll(remoteCandidates);
|
||||||
@ -282,7 +289,7 @@ public class Component
|
|||||||
*/
|
*/
|
||||||
public void updateRemoteCandidates()
|
public void updateRemoteCandidates()
|
||||||
{
|
{
|
||||||
List<CandidatePair> checkList = null;
|
List<CandidatePair> checkList;
|
||||||
List<RemoteCandidate> newRemoteCandidates;
|
List<RemoteCandidate> newRemoteCandidates;
|
||||||
|
|
||||||
synchronized(remoteUpdateCandidates)
|
synchronized(remoteUpdateCandidates)
|
||||||
@ -290,8 +297,7 @@ public class Component
|
|||||||
if(remoteUpdateCandidates.size() == 0)
|
if(remoteUpdateCandidates.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newRemoteCandidates
|
newRemoteCandidates = new LinkedList<>(remoteUpdateCandidates);
|
||||||
= new LinkedList<RemoteCandidate>(remoteUpdateCandidates);
|
|
||||||
|
|
||||||
List<LocalCandidate> localCnds = getLocalCandidates();
|
List<LocalCandidate> localCnds = getLocalCandidates();
|
||||||
|
|
||||||
@ -305,7 +311,7 @@ public class Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkList = new Vector<CandidatePair>();
|
checkList = new Vector<>();
|
||||||
|
|
||||||
for(LocalCandidate localCnd : localCnds)
|
for(LocalCandidate localCnd : localCnds)
|
||||||
{
|
{
|
||||||
@ -336,7 +342,9 @@ public class Component
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CandidatePair pair
|
CandidatePair pair
|
||||||
= new CandidatePair(localCnd, remoteCnd);
|
= getParentStream()
|
||||||
|
.getParentAgent()
|
||||||
|
.createCandidatePair(localCnd, remoteCnd);
|
||||||
logger.info("new Pair added: " + pair.toShortString());
|
logger.info("new Pair added: " + pair.toShortString());
|
||||||
checkList.add(pair);
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
@ -381,7 +389,7 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(remoteCandidates)
|
synchronized(remoteCandidates)
|
||||||
{
|
{
|
||||||
return new ArrayList<RemoteCandidate>(remoteCandidates);
|
return new ArrayList<>(remoteCandidates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,15 +457,17 @@ public class Component
|
|||||||
StringBuffer buff
|
StringBuffer buff
|
||||||
= new StringBuffer("Component id=").append(getComponentID());
|
= new StringBuffer("Component id=").append(getComponentID());
|
||||||
|
|
||||||
buff.append(" parent stream=" + getParentStream().getName());
|
buff.append(" parent stream=").append(getParentStream().getName());
|
||||||
|
|
||||||
//local candidates
|
//local candidates
|
||||||
int localCandidatesCount = getLocalCandidateCount();
|
int localCandidatesCount = getLocalCandidateCount();
|
||||||
|
|
||||||
if(localCandidatesCount > 0)
|
if(localCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
buff.append("\n" + localCandidatesCount + " Local candidates:");
|
buff.append("\n")
|
||||||
buff.append("\ndefault candidate: " + getDefaultCandidate());
|
.append(localCandidatesCount)
|
||||||
|
.append(" Local candidates:");
|
||||||
|
buff.append("\ndefault candidate: ").append(getDefaultCandidate());
|
||||||
|
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
@ -477,14 +487,16 @@ public class Component
|
|||||||
|
|
||||||
if(remoteCandidatesCount > 0)
|
if(remoteCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
buff.append("\n" + remoteCandidatesCount + " Remote candidates:");
|
buff.append("\n")
|
||||||
buff.append("\ndefault remote candidate: "
|
.append(remoteCandidatesCount)
|
||||||
+ getDefaultRemoteCandidate());
|
.append(" Remote candidates:");
|
||||||
|
buff.append("\ndefault remote candidate: ")
|
||||||
|
.append(getDefaultRemoteCandidate());
|
||||||
synchronized(remoteCandidates)
|
synchronized(remoteCandidates)
|
||||||
{
|
{
|
||||||
for (RemoteCandidate cand : remoteCandidates)
|
for (RemoteCandidate cand : remoteCandidates)
|
||||||
{
|
{
|
||||||
buff.append("\n" + cand.toString());
|
buff.append("\n").append(cand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -691,12 +703,8 @@ public class Component
|
|||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
Iterator<LocalCandidate> localCandsIter = localCandidates.iterator();
|
for (LocalCandidate cand : localCandidates)
|
||||||
|
|
||||||
while (localCandsIter.hasNext())
|
|
||||||
{
|
{
|
||||||
LocalCandidate cand = localCandsIter.next();
|
|
||||||
|
|
||||||
if ((defaultCandidate == null)
|
if ((defaultCandidate == null)
|
||||||
|| (defaultCandidate.getDefaultPreference()
|
|| (defaultCandidate.getDefaultPreference()
|
||||||
< cand.getDefaultPreference()))
|
< cand.getDefaultPreference()))
|
||||||
@ -874,4 +882,19 @@ public class Component
|
|||||||
else
|
else
|
||||||
return Integer.toString(componentID);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -46,13 +57,13 @@ class ConnectivityCheckClient
|
|||||||
/**
|
/**
|
||||||
* The {@link PaceMaker}s that are currently running checks in this client.
|
* 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
|
* Timer that is used to let some seconds before a CheckList is considered
|
||||||
* as FAILED.
|
* 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.
|
* 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
|
//if we are the controlling agent then we need to indicate our
|
||||||
//nominated pairs.
|
//nominated pairs.
|
||||||
if(candidatePair.isNominated())
|
if (candidatePair.isNominated())
|
||||||
{
|
{
|
||||||
logger.fine(
|
logger.fine(
|
||||||
"Add USE-CANDIDATE in check for: "
|
"Add USE-CANDIDATE in check for: "
|
||||||
@ -283,8 +294,6 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
tran.setApplicationData(candidatePair);
|
tran.setApplicationData(candidatePair);
|
||||||
|
|
||||||
if (isReliableTransport(candidatePair))
|
|
||||||
maxRetransmissions = 0;
|
|
||||||
logger.fine(
|
logger.fine(
|
||||||
"start check for " + candidatePair.toShortString() + " tid "
|
"start check for " + candidatePair.toShortString() + " tid "
|
||||||
+ tran);
|
+ tran);
|
||||||
@ -476,7 +485,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
TransportAddress mappedAddress = null;
|
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 "
|
logger.fine("Received a success response with no "
|
||||||
+ "XOR_MAPPED_ADDRESS attribute.");
|
+ "XOR_MAPPED_ADDRESS attribute.");
|
||||||
@ -487,14 +496,14 @@ class ConnectivityCheckClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
XorMappedAddressAttribute mappedAddressAttr
|
XorMappedAddressAttribute mappedAddressAttr
|
||||||
= (XorMappedAddressAttribute)response
|
= (XorMappedAddressAttribute)
|
||||||
.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
|
response.getAttribute(Attribute.XOR_MAPPED_ADDRESS);
|
||||||
|
|
||||||
mappedAddress = mappedAddressAttr
|
mappedAddress
|
||||||
.getAddress(response.getTransactionID());
|
= mappedAddressAttr.getAddress(response.getTransactionID());
|
||||||
|
|
||||||
// XXX AddressAttribute always returns UDP based TransportAddress
|
// XXX AddressAttribute always returns UDP based TransportAddress
|
||||||
if(checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
|
if (checkedPair.getLocalCandidate().getTransport() == Transport.TCP)
|
||||||
{
|
{
|
||||||
mappedAddress
|
mappedAddress
|
||||||
= new TransportAddress(
|
= new TransportAddress(
|
||||||
@ -505,8 +514,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
LocalCandidate validLocalCandidate = null;
|
LocalCandidate validLocalCandidate = null;
|
||||||
|
|
||||||
validLocalCandidate = parentAgent
|
validLocalCandidate = parentAgent.findLocalCandidate(mappedAddress);
|
||||||
.findLocalCandidate(mappedAddress);
|
|
||||||
|
|
||||||
RemoteCandidate validRemoteCandidate = checkedPair.getRemoteCandidate();
|
RemoteCandidate validRemoteCandidate = checkedPair.getRemoteCandidate();
|
||||||
|
|
||||||
@ -514,7 +522,7 @@ class ConnectivityCheckClient
|
|||||||
// response. If the transport address does not match any of the
|
// response. If the transport address does not match any of the
|
||||||
// local candidates that the agent knows about, the mapped address
|
// local candidates that the agent knows about, the mapped address
|
||||||
// represents a new candidate -- a peer reflexive candidate.
|
// represents a new candidate -- a peer reflexive candidate.
|
||||||
if ( validLocalCandidate == null)
|
if (validLocalCandidate == null)
|
||||||
{
|
{
|
||||||
//Like other candidates, PEER-REFLEXIVE candidates have a type,
|
//Like other candidates, PEER-REFLEXIVE candidates have a type,
|
||||||
//base, priority, and foundation. They are computed as follows:
|
//base, priority, and foundation. They are computed as follows:
|
||||||
@ -548,9 +556,12 @@ class ConnectivityCheckClient
|
|||||||
//generated from it momentarily
|
//generated from it momentarily
|
||||||
validLocalCandidate = peerReflexiveCandidate;
|
validLocalCandidate = peerReflexiveCandidate;
|
||||||
|
|
||||||
if(checkedPair.getParentComponent().getSelectedPair() == null)
|
if (checkedPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Receive a peer-reflexive candidate: " +
|
{
|
||||||
peerReflexiveCandidate.getTransportAddress());
|
logger.info(
|
||||||
|
"Receive a peer-reflexive candidate: "
|
||||||
|
+ peerReflexiveCandidate.getTransportAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the resulting valid pair was already in our check lists.
|
//check if the resulting valid pair was already in our check lists.
|
||||||
@ -566,7 +577,9 @@ class ConnectivityCheckClient
|
|||||||
// by a STUN connectivity check.
|
// by a STUN connectivity check.
|
||||||
CandidatePair validPair
|
CandidatePair validPair
|
||||||
= (existingPair == null)
|
= (existingPair == null)
|
||||||
? new CandidatePair(validLocalCandidate, validRemoteCandidate)
|
? parentAgent.createCandidatePair(
|
||||||
|
validLocalCandidate,
|
||||||
|
validRemoteCandidate)
|
||||||
: existingPair;
|
: existingPair;
|
||||||
|
|
||||||
// we synchronize here because the same pair object can be processed (in
|
// 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
|
// (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
|
// we will trigger the nominationConfirmed (that will pass the pair as
|
||||||
// as selected if it is the first time).
|
// 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
|
//The agent sets the state of the pair that *generated* the check to
|
||||||
//Succeeded. Note that, the pair which *generated* the check may be
|
//Succeeded. Note that, the pair which *generated* the check may be
|
||||||
//different than the valid pair constructed above
|
//different than the valid pair constructed above
|
||||||
if(checkedPair.getParentComponent().getSelectedPair() == null)
|
if (checkedPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Pair succeeded: " + checkedPair.toShortString());
|
logger.info("Pair succeeded: " + checkedPair.toShortString());
|
||||||
checkedPair.setStateSucceeded();
|
checkedPair.setStateSucceeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! validPair.isValid())
|
if (!validPair.isValid())
|
||||||
{
|
{
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if (validPair.getParentComponent().getSelectedPair() == null)
|
||||||
logger.info("Pair validated: " + validPair.toShortString());
|
logger.info("Pair validated: " + validPair.toShortString());
|
||||||
parentAgent.validatePair(validPair);
|
parentAgent.validatePair(validPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
//The agent changes the states for all other Frozen pairs for the
|
//The agent changes the states for all other Frozen pairs for the
|
||||||
//same media stream and same foundation to Waiting.
|
//same media stream and same foundation to Waiting.
|
||||||
IceMediaStream parentStream = checkedPair.getParentComponent()
|
IceMediaStream parentStream
|
||||||
.getParentStream();
|
= checkedPair.getParentComponent().getParentStream();
|
||||||
|
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
{
|
{
|
||||||
Vector<CandidatePair> parentCheckList
|
Vector<CandidatePair> parentCheckList
|
||||||
= new Vector<CandidatePair>(parentStream.getCheckList());
|
= new Vector<>(parentStream.getCheckList());
|
||||||
|
|
||||||
for(CandidatePair pair : parentCheckList)
|
for(CandidatePair pair : parentCheckList)
|
||||||
if ((pair.getState() == CandidatePairState.FROZEN)
|
{
|
||||||
|
if (pair.getState() == CandidatePairState.FROZEN
|
||||||
&& checkedPair.getFoundation().equals(
|
&& checkedPair.getFoundation().equals(
|
||||||
pair.getFoundation()))
|
pair.getFoundation()))
|
||||||
|
{
|
||||||
pair.setStateWaiting();
|
pair.setStateWaiting();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The agent examines the check list for all other streams in turn. If
|
// The agent examines the check list for all other streams in turn. If
|
||||||
@ -625,7 +642,7 @@ class ConnectivityCheckClient
|
|||||||
|
|
||||||
synchronized (checkList)
|
synchronized (checkList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : checkList)
|
for (CandidatePair pair : checkList)
|
||||||
{
|
{
|
||||||
if (parentStream.validListContainsFoundation(
|
if (parentStream.validListContainsFoundation(
|
||||||
pair.getFoundation())
|
pair.getFoundation())
|
||||||
@ -641,7 +658,7 @@ class ConnectivityCheckClient
|
|||||||
//foundation, and for each group, sets the state of the pair with
|
//foundation, and for each group, sets the state of the pair with
|
||||||
//the lowest component ID to Waiting. If there is more than one
|
//the lowest component ID to Waiting. If there is more than one
|
||||||
//such pair, the one with the highest priority is used.
|
//such pair, the one with the highest priority is used.
|
||||||
if(checkList.isFrozen())
|
if (checkList.isFrozen())
|
||||||
checkList.computeInitialCheckListPairStates();
|
checkList.computeInitialCheckListPairStates();
|
||||||
|
|
||||||
if (wasFrozen)
|
if (wasFrozen)
|
||||||
@ -652,7 +669,7 @@ class ConnectivityCheckClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if (validPair.getParentComponent().getSelectedPair() == null)
|
||||||
{
|
{
|
||||||
logger.info("IsControlling: " + parentAgent.isControlling() +
|
logger.info("IsControlling: " + parentAgent.isControlling() +
|
||||||
" USE-CANDIDATE:" +
|
" USE-CANDIDATE:" +
|
||||||
@ -663,8 +680,8 @@ class ConnectivityCheckClient
|
|||||||
//If the agent was a controlling agent, and it had included a USE-
|
//If the agent was a controlling agent, and it had included a USE-
|
||||||
//CANDIDATE attribute in the Binding request, the valid pair generated
|
//CANDIDATE attribute in the Binding request, the valid pair generated
|
||||||
//from that check has its nominated flag set to true.
|
//from that check has its nominated flag set to true.
|
||||||
if((parentAgent.isControlling()
|
if (parentAgent.isControlling()
|
||||||
&& request.containsAttribute(Attribute.USE_CANDIDATE)))
|
&& request.containsAttribute(Attribute.USE_CANDIDATE))
|
||||||
{
|
{
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if(validPair.getParentComponent().getSelectedPair() == null)
|
||||||
{
|
{
|
||||||
@ -684,7 +701,7 @@ class ConnectivityCheckClient
|
|||||||
//itself had the USE-CANDIDATE attribute. This case is described in
|
//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
|
//Section 7.2.1.5, and may now result in setting the nominated flag for
|
||||||
//the pair learned from the original request.
|
//the pair learned from the original request.
|
||||||
else if(!parentAgent.isControlling()
|
else if (!parentAgent.isControlling()
|
||||||
&& checkedPair.useCandidateReceived()
|
&& checkedPair.useCandidateReceived()
|
||||||
&& !checkedPair.isNominated())
|
&& !checkedPair.isNominated())
|
||||||
{
|
{
|
||||||
@ -693,7 +710,7 @@ class ConnectivityCheckClient
|
|||||||
logger.info(
|
logger.info(
|
||||||
"Nomination confirmed for pair: "
|
"Nomination confirmed for pair: "
|
||||||
+ validPair.toShortString());
|
+ validPair.toShortString());
|
||||||
parentAgent.nominationConfirmed( checkedPair );
|
parentAgent.nominationConfirmed(checkedPair);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -740,20 +757,6 @@ class ConnectivityCheckClient
|
|||||||
evt.getRemoteAddress());
|
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
|
* In case of a role conflict, changes the state of the agent and
|
||||||
* reschedules the check, in all other cases sets the corresponding peer
|
* reschedules the check, in all other cases sets the corresponding peer
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -39,8 +50,7 @@ public class DefaultNominator
|
|||||||
* Map that will remember association between validated relayed candidate
|
* Map that will remember association between validated relayed candidate
|
||||||
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy.
|
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy.
|
||||||
*/
|
*/
|
||||||
private final Map<String, TimerTask> validatedCandidates
|
private final Map<String, TimerTask> validatedCandidates = new HashMap<>();
|
||||||
= new HashMap<String, TimerTask>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of this nominator using <tt>parentAgent</tt> as
|
* 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
|
// all other pairs are failed to do not waste time, cancel
|
||||||
// timer and nominate ourself (the relayed candidate).
|
// timer and nominate ourself (the relayed candidate).
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -34,7 +44,7 @@ public class FoundationsRegistry
|
|||||||
* Contains mappings between a type+baseIP+server+transport
|
* Contains mappings between a type+baseIP+server+transport
|
||||||
* <tt>String</tt>s and the foundation that has been assigned to them.
|
* <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
|
* Assigns to <tt>candidate</tt> the foundation that corresponds to its
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -65,8 +75,7 @@ public class IceMediaStream
|
|||||||
* address; a media stream may require multiple components, each of which
|
* address; a media stream may require multiple components, each of which
|
||||||
* has to work for the media stream as a whole to work.
|
* has to work for the media stream as a whole to work.
|
||||||
*/
|
*/
|
||||||
private final Map<Integer, Component> components
|
private final Map<Integer, Component> components = new LinkedHashMap<>();
|
||||||
= new LinkedHashMap<Integer, Component>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ordered set of candidate pairs for a media stream that have been
|
* 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
|
* start of ICE processing, and fills as checks are performed, resulting in
|
||||||
* valid candidate pairs.
|
* valid candidate pairs.
|
||||||
*/
|
*/
|
||||||
private final TreeSet<CandidatePair> validList
|
private final TreeSet<CandidatePair> validList = new TreeSet<>();
|
||||||
= new TreeSet<CandidatePair>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id that was last assigned to a component. The next id that we give
|
* 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.
|
* Agent} and following the various events it may be generating.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyChangeListener> streamListeners
|
private final List<PropertyChangeListener> streamListeners
|
||||||
= new LinkedList<PropertyChangeListener>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum number of candidate pairs that we should have in our check
|
* The maximum number of candidate pairs that we should have in our check
|
||||||
@ -153,9 +161,7 @@ public class IceMediaStream
|
|||||||
synchronized (components)
|
synchronized (components)
|
||||||
{
|
{
|
||||||
component = new Component(++lastComponentID, this);
|
component = new Component(++lastComponentID, this);
|
||||||
components.put(
|
components.put(component.getComponentID(), component);
|
||||||
Integer.valueOf(component.getComponentID()),
|
|
||||||
component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
@ -221,7 +227,7 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
synchronized(components)
|
synchronized(components)
|
||||||
{
|
{
|
||||||
return new ArrayList<Component>(components.values());
|
return new ArrayList<>(components.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +257,7 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
synchronized(components)
|
synchronized(components)
|
||||||
{
|
{
|
||||||
return new ArrayList<Integer>(components.keySet());
|
return new ArrayList<>(components.keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,8 +394,9 @@ public class IceMediaStream
|
|||||||
if(localCnd.canReach(remoteCnd)
|
if(localCnd.canReach(remoteCnd)
|
||||||
&& remoteCnd.getTransportAddress().getPort() != 0)
|
&& remoteCnd.getTransportAddress().getPort() != 0)
|
||||||
{
|
{
|
||||||
CandidatePair pair = new CandidatePair(localCnd,
|
CandidatePair pair
|
||||||
remoteCnd);
|
= getParentAgent()
|
||||||
|
.createCandidatePair(localCnd, remoteCnd);
|
||||||
checkList.add(pair);
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,7 +422,7 @@ public class IceMediaStream
|
|||||||
* candidate with its base. Once this has been done, we remove each pair
|
* 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
|
* where the local and remote candidates are identical to the local and
|
||||||
* remote candidates of a pair higher up on the priority list.
|
* 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
|
* 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
|
* 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).
|
* (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
|
//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.
|
//through. The list is destroyed at the end of this method.
|
||||||
List<CandidatePair> tmpCheckList
|
List<CandidatePair> tmpCheckList = new ArrayList<>(checkList.size());
|
||||||
= new ArrayList<CandidatePair>(checkList.size());
|
|
||||||
|
|
||||||
Iterator<CandidatePair> ckListIter = checkList.iterator();
|
Iterator<CandidatePair> ckListIter = checkList.iterator();
|
||||||
|
|
||||||
@ -684,9 +690,9 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
protected boolean validListContainsNomineeForComponent(Component component)
|
protected boolean validListContainsNomineeForComponent(Component component)
|
||||||
{
|
{
|
||||||
synchronized(validList)
|
synchronized (validList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : validList)
|
for (CandidatePair pair : validList)
|
||||||
{
|
{
|
||||||
if (pair.isNominated()
|
if (pair.isNominated()
|
||||||
&& pair.getParentComponent() == component)
|
&& pair.getParentComponent() == component)
|
||||||
@ -736,9 +742,9 @@ public class IceMediaStream
|
|||||||
|
|
||||||
synchronized (validList)
|
synchronized (validList)
|
||||||
{
|
{
|
||||||
for(CandidatePair pair : validList)
|
for (CandidatePair pair : validList)
|
||||||
{
|
{
|
||||||
if(pair.isNominated())
|
if (pair.isNominated())
|
||||||
components.remove(pair.getParentComponent());
|
components.remove(pair.getParentComponent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,4 +899,18 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
return remotePassword;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -24,6 +35,7 @@ package org.ice4j.ice;
|
|||||||
* refer to with "Terminated".
|
* refer to with "Terminated".
|
||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
|
* @author Lyubomir Marinov
|
||||||
*/
|
*/
|
||||||
public enum IceProcessingState
|
public enum IceProcessingState
|
||||||
{
|
{
|
||||||
@ -88,6 +100,21 @@ public enum IceProcessingState
|
|||||||
return stateName;
|
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
|
* Returns <tt>true</tt> iff the state is one in which a connection
|
||||||
* has been established, that is either <tt>COMPLETED</tt> or
|
* has been established, that is either <tt>COMPLETED</tt> or
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -520,7 +530,7 @@ public class NetworkUtils
|
|||||||
if (isMappedIPv4Addr(addr))
|
if (isMappedIPv4Addr(addr))
|
||||||
{
|
{
|
||||||
byte[] newAddr = new byte[IN4_ADDR_SIZE];
|
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;
|
return newAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,8 +707,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isLoopback");
|
Method method = iface.getClass().getMethod("isLoopback");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface, new Object[]{}))
|
return (Boolean) method.invoke(iface);
|
||||||
.booleanValue();
|
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
@ -729,7 +738,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isUp");
|
Method method = iface.getClass().getMethod("isUp");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface)).booleanValue();
|
return (Boolean) method.invoke(iface);
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
@ -759,7 +768,7 @@ public class NetworkUtils
|
|||||||
{
|
{
|
||||||
Method method = iface.getClass().getMethod("isVirtual");
|
Method method = iface.getClass().getMethod("isVirtual");
|
||||||
|
|
||||||
return ((Boolean)method.invoke(iface)).booleanValue();
|
return (Boolean) method.invoke(iface);
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
@ -27,8 +38,7 @@ public class TcpHostCandidate
|
|||||||
/**
|
/**
|
||||||
* List of <tt>accept</tt>ed sockets for this <tt>TcpHostCandidate</tt>.
|
* List of <tt>accept</tt>ed sockets for this <tt>TcpHostCandidate</tt>.
|
||||||
*/
|
*/
|
||||||
private final List<IceSocketWrapper> sockets
|
private final List<IceSocketWrapper> sockets = new LinkedList<>();
|
||||||
= new LinkedList<IceSocketWrapper>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new <tt>TcpHostCandidate</tt>.
|
* Initializes a new <tt>TcpHostCandidate</tt>.
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice;
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* Jitsi Videobridge, OpenSource video conferencing.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.*;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.*;
|
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +72,11 @@ public class AwsCandidateHarvester
|
|||||||
*/
|
*/
|
||||||
private static TransportAddress face;
|
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,
|
* Creates an AWS harvester. The actual addresses wil be retrieved later,
|
||||||
* during the first harvest.
|
* during the first harvest.
|
||||||
@ -72,77 +86,17 @@ public class AwsCandidateHarvester
|
|||||||
super(null, null);
|
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
|
* 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/local-ipv4</tt> and
|
||||||
* <tt>http://169.254.169.254/latest/meta-data/public-ipv4</tt> to learn the
|
* <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.
|
* 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)
|
if (addressChecked)
|
||||||
return true;
|
return;
|
||||||
|
addressChecked = true;
|
||||||
|
|
||||||
String localIPStr = null;
|
String localIPStr = null;
|
||||||
String publicIPStr = null;
|
String publicIPStr = null;
|
||||||
@ -164,22 +118,19 @@ public class AwsCandidateHarvester
|
|||||||
}
|
}
|
||||||
catch (Exception exc)
|
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 "
|
logger.log(Level.INFO, "We failed to obtain EC2 instance addresses "
|
||||||
+ "for the following reason: ", exc);
|
+ "for the following reason: ", exc);
|
||||||
logger.info("String for local IP: " + localIPStr);
|
logger.info("String for local IP: " + localIPStr);
|
||||||
logger.info("String for public IP: " + publicIPStr);
|
logger.info("String for public IP: " + publicIPStr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the discovered public (mask) address, or null.
|
* Returns the public (mask) address, or null.
|
||||||
* @return the discovered public (mask) address, or null.
|
* @return the public (mask) address, or null.
|
||||||
*/
|
*/
|
||||||
public static TransportAddress getMask()
|
public TransportAddress getMask()
|
||||||
{
|
{
|
||||||
if (smellsLikeAnEC2())
|
if (smellsLikeAnEC2())
|
||||||
{
|
{
|
||||||
@ -190,10 +141,10 @@ public class AwsCandidateHarvester
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the discovered local (face) address, or null.
|
* Returns the local (face) address, or null.
|
||||||
* @return the discovered local (face) address, or null.
|
* @return the local (face) address, or null.
|
||||||
*/
|
*/
|
||||||
public static TransportAddress getFace()
|
public TransportAddress getFace()
|
||||||
{
|
{
|
||||||
if (smellsLikeAnEC2())
|
if (smellsLikeAnEC2())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
@ -34,7 +44,7 @@ public class CandidateHarvesterSet
|
|||||||
* <tt>Set</tt>.
|
* <tt>Set</tt>.
|
||||||
*/
|
*/
|
||||||
private final Collection<CandidateHarvesterSetElement> elements
|
private final Collection<CandidateHarvesterSetElement> elements
|
||||||
= new LinkedList<CandidateHarvesterSetElement>();
|
= new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pool of thread used for gathering process.
|
* A pool of thread used for gathering process.
|
||||||
@ -85,7 +95,7 @@ public class CandidateHarvesterSet
|
|||||||
*/
|
*/
|
||||||
public void harvest(Component component)
|
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
|
* Start asynchronously executing the
|
||||||
* CandidateHarvester#harvest(Component) method of the harvesters.
|
* CandidateHarvester#harvest(Component) method of the harvesters.
|
||||||
*/
|
*/
|
||||||
Map<CandidateHarvesterSetTask, Future<?>> tasks
|
Map<CandidateHarvesterSetTask, Future<?>> tasks = new HashMap<>();
|
||||||
= new HashMap<CandidateHarvesterSetTask, Future<?>>();
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -161,7 +170,7 @@ public class CandidateHarvesterSet
|
|||||||
|
|
||||||
synchronized (components)
|
synchronized (components)
|
||||||
{
|
{
|
||||||
componentsCopy = new ArrayList<Component>(components);
|
componentsCopy = new ArrayList<>(components);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asynchronously start gathering candidates using the harvester.
|
// Asynchronously start gathering candidates using the harvester.
|
||||||
@ -184,7 +193,7 @@ public class CandidateHarvesterSet
|
|||||||
= taskIter.next();
|
= taskIter.next();
|
||||||
Future<?> future = task.getValue();
|
Future<?> future = task.getValue();
|
||||||
|
|
||||||
while (true)
|
do
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -222,9 +231,9 @@ public class CandidateHarvesterSet
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ie)
|
catch (InterruptedException ie)
|
||||||
{
|
{
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
taskIter.remove();
|
taskIter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
|
||||||
*
|
*
|
||||||
* Distributable under LGPL license.
|
* Copyright @ 2015 Atlassian Pty Ltd
|
||||||
* See terms of license at gnu.org.
|
*
|
||||||
|
* 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;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user