mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 05:51:08 +01:00
Enable trailing whitespace checkstyle check
for all source code regions, including javadoc.
This commit is contained in:
parent
9d61a6de7d
commit
e8923b9d16
545 changed files with 3713 additions and 3715 deletions
|
|
@ -35,14 +35,14 @@ import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
|
|||
* <p>
|
||||
* {@link Socks5BytestreamListener} or {@link InBandBytestreamListener} provide a more specific
|
||||
* interface of the BytestreamListener.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public interface BytestreamListener {
|
||||
|
||||
/**
|
||||
* This listener is notified if a bytestream request from another user has been received.
|
||||
*
|
||||
*
|
||||
* @param request the incoming bytestream request
|
||||
*/
|
||||
void incomingBytestreamRequest(BytestreamRequest request);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.jxmpp.jid.Jid;
|
|||
* <p>
|
||||
* There are two implementations of the interface. See {@link Socks5BytestreamManager} and
|
||||
* {@link InBandBytestreamManager}.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public interface BytestreamManager {
|
||||
|
|
@ -43,14 +43,14 @@ public interface BytestreamManager {
|
|||
* See {@link Socks5BytestreamManager#addIncomingBytestreamListener(BytestreamListener)} and
|
||||
* {@link InBandBytestreamManager#addIncomingBytestreamListener(BytestreamListener)} for further
|
||||
* details.
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
*/
|
||||
void addIncomingBytestreamListener(BytestreamListener listener);
|
||||
|
||||
/**
|
||||
* Removes the given listener from the list of listeners for all incoming bytestream requests.
|
||||
*
|
||||
*
|
||||
* @param listener the listener to remove
|
||||
*/
|
||||
void removeIncomingBytestreamListener(BytestreamListener listener);
|
||||
|
|
@ -64,7 +64,7 @@ public interface BytestreamManager {
|
|||
* See {@link Socks5BytestreamManager#addIncomingBytestreamListener(BytestreamListener, Jid)}
|
||||
* and {@link InBandBytestreamManager#addIncomingBytestreamListener(BytestreamListener, Jid)}
|
||||
* for further details.
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
* @param initiatorJID the JID of the user that wants to establish a bytestream
|
||||
*/
|
||||
|
|
@ -72,7 +72,7 @@ public interface BytestreamManager {
|
|||
|
||||
/**
|
||||
* Removes the listener for the given user.
|
||||
*
|
||||
*
|
||||
* @param initiatorJID the JID of the user the listener should be removed
|
||||
*/
|
||||
void removeIncomingBytestreamListener(Jid initiatorJID);
|
||||
|
|
@ -89,7 +89,7 @@ public interface BytestreamManager {
|
|||
* <p>
|
||||
* See {@link Socks5BytestreamManager#establishSession(Jid)} and
|
||||
* {@link InBandBytestreamManager#establishSession(Jid)} for further details.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user a bytestream should be established
|
||||
* @return the session to send/receive data to/from the user
|
||||
* @throws XMPPException if an error occurred while establishing the session
|
||||
|
|
@ -107,7 +107,7 @@ public interface BytestreamManager {
|
|||
* <p>
|
||||
* See {@link Socks5BytestreamManager#establishSession(Jid)} and
|
||||
* {@link InBandBytestreamManager#establishSession(Jid)} for further details.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user a bytestream should be established
|
||||
* @param sessionID the session ID for the bytestream request
|
||||
* @return the session to send/receive data to/from the user
|
||||
|
|
|
|||
|
|
@ -31,41 +31,41 @@ import org.jxmpp.jid.Jid;
|
|||
* <p>
|
||||
* There are two implementations of the interface. See {@link Socks5BytestreamRequest} and
|
||||
* {@link InBandBytestreamRequest}.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public interface BytestreamRequest {
|
||||
|
||||
/**
|
||||
* Returns the sender of the bytestream open request.
|
||||
*
|
||||
*
|
||||
* @return the sender of the bytestream open request
|
||||
*/
|
||||
Jid getFrom();
|
||||
|
||||
/**
|
||||
* Returns the session ID of the bytestream open request.
|
||||
*
|
||||
*
|
||||
* @return the session ID of the bytestream open request
|
||||
*/
|
||||
String getSessionID();
|
||||
|
||||
/**
|
||||
* Accepts the bytestream open request and returns the session to send/receive data.
|
||||
*
|
||||
*
|
||||
* @return the session to send/receive data
|
||||
* @throws XMPPErrorException if an error occurred while accepting the bytestream request
|
||||
* @throws InterruptedException if the thread was interrupted while waiting in a blocking
|
||||
* operation
|
||||
* @throws NoResponseException
|
||||
* @throws SmackException
|
||||
* @throws NoResponseException
|
||||
* @throws SmackException
|
||||
*/
|
||||
BytestreamSession accept() throws InterruptedException, XMPPErrorException, SmackException;
|
||||
|
||||
/**
|
||||
* Rejects the bytestream request by sending a reject error to the initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
void reject() throws NotConnectedException, InterruptedException;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
|||
* <p>
|
||||
* There are two implementations of the interface. See {@link Socks5BytestreamSession} and
|
||||
* {@link InBandBytestreamSession}.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public interface BytestreamSession {
|
||||
|
||||
/**
|
||||
* Returns the InputStream associated with this session to send data.
|
||||
*
|
||||
*
|
||||
* @return the InputStream associated with this session to send data
|
||||
* @throws IOException if an error occurs while retrieving the input stream
|
||||
*/
|
||||
|
|
@ -43,7 +43,7 @@ public interface BytestreamSession {
|
|||
|
||||
/**
|
||||
* Returns the OutputStream associated with this session to receive data.
|
||||
*
|
||||
*
|
||||
* @return the OutputStream associated with this session to receive data
|
||||
* @throws IOException if an error occurs while retrieving the output stream
|
||||
*/
|
||||
|
|
@ -54,7 +54,7 @@ public interface BytestreamSession {
|
|||
* <p>
|
||||
* Closing the session will also close the input stream and the output stream associated to this
|
||||
* session.
|
||||
*
|
||||
*
|
||||
* @throws IOException if an error occurs while closing the session
|
||||
*/
|
||||
void close() throws IOException;
|
||||
|
|
@ -62,7 +62,7 @@ public interface BytestreamSession {
|
|||
/**
|
||||
* Returns the timeout for read operations of the input stream associated with this session. 0
|
||||
* returns implies that the option is disabled (i.e., timeout of infinity). Default is 0.
|
||||
*
|
||||
*
|
||||
* @return the timeout for read operations
|
||||
* @throws IOException if there is an error in the underlying protocol
|
||||
*/
|
||||
|
|
@ -75,7 +75,7 @@ public interface BytestreamSession {
|
|||
* session is still valid. The option must be enabled prior to entering the blocking operation
|
||||
* to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite
|
||||
* timeout. Default is 0.
|
||||
*
|
||||
*
|
||||
* @param timeout the specified timeout, in milliseconds
|
||||
* @throws IOException if there is an error in the underlying protocol
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
|
|||
* If a close request is received it looks if a stored In-Band Bytestream
|
||||
* session exists and closes it. If no session with the given session ID exists
|
||||
* an <item-not-found/> error is returned to the sender.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
class CloseListener extends AbstractIqRequestHandler {
|
||||
|
|
@ -38,7 +38,7 @@ class CloseListener extends AbstractIqRequestHandler {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param manager the In-Band Bytestream manager
|
||||
*/
|
||||
protected CloseListener(InBandBytestreamManager manager) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
|||
* Data packets belonging to a running In-Band Bytestream session are processed
|
||||
* by more specific listeners registered when an {@link InBandBytestreamSession}
|
||||
* is created.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
class DataListener extends AbstractIqRequestHandler {
|
||||
|
|
@ -45,7 +45,7 @@ class DataListener extends AbstractIqRequestHandler {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param manager the In-Band Bytestream manager
|
||||
*/
|
||||
DataListener(InBandBytestreamManager manager) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
|||
* {@link InBandBytestreamManager#addIncomingBytestreamListener(BytestreamListener)} and
|
||||
* {@link InBandBytestreamManager#addIncomingBytestreamListener(BytestreamListener, org.jxmpp.jid.Jid)} for
|
||||
* further details.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public abstract class InBandBytestreamListener implements BytestreamListener {
|
||||
|
|
@ -42,7 +42,7 @@ public abstract class InBandBytestreamListener implements BytestreamListener {
|
|||
/**
|
||||
* This listener is notified if an In-Band Bytestream request from another user has been
|
||||
* received.
|
||||
*
|
||||
*
|
||||
* @param request the incoming In-Band Bytestream request
|
||||
*/
|
||||
public abstract void incomingBytestreamRequest(InBandBytestreamRequest request);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ import org.jxmpp.jid.Jid;
|
|||
* <p>
|
||||
* If no {@link InBandBytestreamListener}s are registered, all incoming In-Band bytestream requests
|
||||
* will be rejected by returning a <not-acceptable/> error to the initiator.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public final class InBandBytestreamManager extends Manager implements BytestreamManager {
|
||||
|
|
@ -186,7 +186,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the InBandBytestreamManager to handle In-Band Bytestreams for a given
|
||||
* {@link XMPPConnection}.
|
||||
*
|
||||
*
|
||||
* @param connection the XMPP connection
|
||||
* @return the InBandBytestreamManager for the given XMPP connection
|
||||
*/
|
||||
|
|
@ -203,7 +203,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param connection the XMPP connection
|
||||
*/
|
||||
private InBandBytestreamManager(XMPPConnection connection) {
|
||||
|
|
@ -233,7 +233,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* Socks5 bytestream requests sent in the context of <a
|
||||
* href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See
|
||||
* {@link FileTransferManager})
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -244,7 +244,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Removes the given listener from the list of listeners for all incoming In-Band Bytestream
|
||||
* requests.
|
||||
*
|
||||
*
|
||||
* @param listener the listener to remove
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -266,7 +266,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* Socks5 bytestream requests sent in the context of <a
|
||||
* href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See
|
||||
* {@link FileTransferManager})
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
* @param initiatorJID the JID of the user that wants to establish an In-Band Bytestream
|
||||
*/
|
||||
|
|
@ -277,7 +277,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Removes the listener for the given user.
|
||||
*
|
||||
*
|
||||
* @param initiatorJID the JID of the user the listener should be removed
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -292,7 +292,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* This method should be used if you are awaiting an In-Band Bytestream request as a reply to
|
||||
* another stanza (e.g. file transfer).
|
||||
*
|
||||
*
|
||||
* @param sessionID to be ignored
|
||||
*/
|
||||
public void ignoreBytestreamRequestOnce(String sessionID) {
|
||||
|
|
@ -305,7 +305,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* The recommended default block size is 4096 bytes. See <a
|
||||
* href="http://xmpp.org/extensions/xep-0047.html#usage">XEP-0047</a> Section 5.
|
||||
*
|
||||
*
|
||||
* @return the default block size
|
||||
*/
|
||||
public int getDefaultBlockSize() {
|
||||
|
|
@ -319,7 +319,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* The default block size must be between 1 and 65535 bytes. The recommended default block size
|
||||
* is 4096 bytes. See <a href="http://xmpp.org/extensions/xep-0047.html#usage">XEP-0047</a>
|
||||
* Section 5.
|
||||
*
|
||||
*
|
||||
* @param defaultBlockSize the default block size to set
|
||||
*/
|
||||
public void setDefaultBlockSize(int defaultBlockSize) {
|
||||
|
|
@ -338,7 +338,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* block size.
|
||||
* <p>
|
||||
* The default maximum block size is 65535 bytes.
|
||||
*
|
||||
*
|
||||
* @return the maximum block size
|
||||
*/
|
||||
public int getMaximumBlockSize() {
|
||||
|
|
@ -353,7 +353,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* Incoming In-Band Bytestream open request will be rejected with an
|
||||
* <resource-constraint/> error if the block size is greater then the maximum allowed
|
||||
* block size.
|
||||
*
|
||||
*
|
||||
* @param maximumBlockSize the maximum block size to set
|
||||
*/
|
||||
public void setMaximumBlockSize(int maximumBlockSize) {
|
||||
|
|
@ -369,7 +369,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* Default is {@link StanzaType#IQ}. See <a
|
||||
* href="http://xmpp.org/extensions/xep-0047.html#message">XEP-0047</a> Section 4.
|
||||
*
|
||||
*
|
||||
* @return the stanza used to send data packets
|
||||
*/
|
||||
public StanzaType getStanza() {
|
||||
|
|
@ -381,7 +381,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* The use of {@link StanzaType#IQ} is recommended. See <a
|
||||
* href="http://xmpp.org/extensions/xep-0047.html#message">XEP-0047</a> Section 4.
|
||||
*
|
||||
*
|
||||
* @param stanza the stanza to set
|
||||
*/
|
||||
public void setStanza(StanzaType stanza) {
|
||||
|
|
@ -398,13 +398,13 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* To establish an In-Band Bytestream after negotiation the kind of data to be sent (e.g. file
|
||||
* transfer) use {@link #establishSession(Jid, String)}.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user an In-Band Bytestream should be established
|
||||
* @return the session to send/receive data to/from the user
|
||||
* @throws XMPPException if the user doesn't support or accept in-band bytestreams, or if the
|
||||
* user prefers smaller block sizes
|
||||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Override
|
||||
public InBandBytestreamSession establishSession(Jid targetJID) throws XMPPException, SmackException, InterruptedException {
|
||||
|
|
@ -415,15 +415,15 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Establishes an In-Band Bytestream with the given user using the given session ID and returns
|
||||
* the session to send/receive data to/from the user.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user an In-Band Bytestream should be established
|
||||
* @param sessionID the session ID for the In-Band Bytestream request
|
||||
* @return the session to send/receive data to/from the user
|
||||
* @throws XMPPErrorException if the user doesn't support or accept in-band bytestreams, or if the
|
||||
* user prefers smaller block sizes
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Override
|
||||
public InBandBytestreamSession establishSession(Jid targetJID, String sessionID)
|
||||
|
|
@ -446,10 +446,10 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream is
|
||||
* not accepted.
|
||||
*
|
||||
*
|
||||
* @param request IQ stanza that should be answered with a not-acceptable error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.not_acceptable);
|
||||
|
|
@ -459,10 +459,10 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream open
|
||||
* request is rejected because its block size is greater than the maximum allowed block size.
|
||||
*
|
||||
*
|
||||
* @param request IQ stanza that should be answered with a resource-constraint error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.resource_constraint);
|
||||
|
|
@ -472,10 +472,10 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream
|
||||
* session could not be found.
|
||||
*
|
||||
*
|
||||
* @param request IQ stanza that should be answered with a item-not-found error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException {
|
||||
IQ error = IQ.createErrorResponse(request, StanzaError.Condition.item_not_found);
|
||||
|
|
@ -484,7 +484,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns a new unique session ID.
|
||||
*
|
||||
*
|
||||
* @return a new unique session ID
|
||||
*/
|
||||
private static String getNextSessionID() {
|
||||
|
|
@ -496,7 +496,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns the XMPP connection.
|
||||
*
|
||||
*
|
||||
* @return the XMPP connection
|
||||
*/
|
||||
protected XMPPConnection getConnection() {
|
||||
|
|
@ -506,7 +506,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the {@link InBandBytestreamListener} that should be informed if a In-Band Bytestream
|
||||
* request from the given initiator JID is received.
|
||||
*
|
||||
*
|
||||
* @param initiator the initiator's JID
|
||||
* @return the listener
|
||||
*/
|
||||
|
|
@ -517,7 +517,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns a list of {@link InBandBytestreamListener} that are informed if there are no
|
||||
* listeners for a specific initiator.
|
||||
*
|
||||
*
|
||||
* @return list of listeners
|
||||
*/
|
||||
protected List<BytestreamListener> getAllRequestListeners() {
|
||||
|
|
@ -526,7 +526,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns the sessions map.
|
||||
*
|
||||
*
|
||||
* @return the sessions map
|
||||
*/
|
||||
protected Map<String, InBandBytestreamSession> getSessions() {
|
||||
|
|
@ -535,7 +535,7 @@ public final class InBandBytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns the list of session IDs that should be ignored by the InitialtionListener
|
||||
*
|
||||
*
|
||||
* @return list of session IDs
|
||||
*/
|
||||
protected List<String> getIgnoredBytestreamRequests() {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.jxmpp.jid.Jid;
|
|||
|
||||
/**
|
||||
* InBandBytestreamRequest class handles incoming In-Band Bytestream requests.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamRequest implements BytestreamRequest {
|
||||
|
|
@ -49,7 +49,7 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns the sender of the In-Band Bytestream open request.
|
||||
*
|
||||
*
|
||||
* @return the sender of the In-Band Bytestream open request
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -59,7 +59,7 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns the session ID of the In-Band Bytestream open request.
|
||||
*
|
||||
*
|
||||
* @return the session ID of the In-Band Bytestream open request
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -70,10 +70,10 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Accepts the In-Band Bytestream open request and returns the session to
|
||||
* send/receive data.
|
||||
*
|
||||
*
|
||||
* @return the session to send/receive data
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Override
|
||||
public InBandBytestreamSession accept() throws NotConnectedException, InterruptedException {
|
||||
|
|
@ -94,8 +94,8 @@ public class InBandBytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Rejects the In-Band Bytestream request by sending a reject error to the
|
||||
* initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Override
|
||||
public void reject() throws NotConnectedException, InterruptedException {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import org.jxmpp.jid.Jid;
|
|||
* closed individually the session will be closed automatically once the second stream is closed.
|
||||
* Use the {@link #setCloseBothStreamsEnabled(boolean)} method if both streams should be closed
|
||||
* automatically if one of them is closed.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamSession implements BytestreamSession {
|
||||
|
|
@ -87,7 +87,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param connection the XMPP connection
|
||||
* @param byteStreamRequest the In-Band Bytestream open request for this session
|
||||
* @param remoteJID JID of the remote peer
|
||||
|
|
@ -138,7 +138,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
/**
|
||||
* Returns whether both streams should be closed automatically if one of the streams is closed.
|
||||
* Default is <code>false</code>.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if both streams will be closed if one of the streams is closed,
|
||||
* <code>false</code> if both streams can be closed independently.
|
||||
*/
|
||||
|
|
@ -149,7 +149,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
/**
|
||||
* Sets whether both streams should be closed automatically if one of the streams is closed.
|
||||
* Default is <code>false</code>.
|
||||
*
|
||||
*
|
||||
* @param closeBothStreamsEnabled <code>true</code> if both streams should be closed if one of
|
||||
* the streams is closed, <code>false</code> if both streams should be closed
|
||||
* independently
|
||||
|
|
@ -166,10 +166,10 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* This method is invoked if a request to close the In-Band Bytestream has been received.
|
||||
*
|
||||
*
|
||||
* @param closeRequest the close request from the remote peer
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void closeByPeer(Close closeRequest) throws NotConnectedException, InterruptedException {
|
||||
|
||||
|
|
@ -282,14 +282,14 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* Returns the stanza listener that processes In-Band Bytestream data packets.
|
||||
*
|
||||
*
|
||||
* @return the data stanza listener
|
||||
*/
|
||||
protected abstract StanzaListener getDataPacketListener();
|
||||
|
||||
/**
|
||||
* Returns the stanza filter that accepts In-Band Bytestream data packets.
|
||||
*
|
||||
*
|
||||
* @return the data stanza filter
|
||||
*/
|
||||
protected abstract StanzaFilter getDataPacketFilter();
|
||||
|
|
@ -352,7 +352,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
/**
|
||||
* This method blocks until a data stanza is received, the stream is closed or the current
|
||||
* thread is interrupted.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if data was received, otherwise <code>false</code>
|
||||
* @throws IOException if data packets are out of sequence
|
||||
*/
|
||||
|
|
@ -406,7 +406,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* Checks if this stream is closed and throws an IOException if necessary
|
||||
*
|
||||
*
|
||||
* @throws IOException if stream is closed and no data should be read anymore
|
||||
*/
|
||||
private void checkClosed() throws IOException {
|
||||
|
|
@ -633,11 +633,11 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* Writes the given data stanza to the XMPP stream.
|
||||
*
|
||||
*
|
||||
* @param data the data packet
|
||||
* @throws IOException if an I/O error occurred while sending or if the stream is closed
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected abstract void writeToXML(DataPacketExtension data) throws IOException, NotConnectedException, InterruptedException;
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
* Fills the buffer with the given data and sends it over the XMPP stream if the buffers
|
||||
* capacity has been reached. This method is only called from this class so it is assured
|
||||
* that the amount of data to send is <= buffer capacity
|
||||
*
|
||||
*
|
||||
* @param b the data
|
||||
* @param off the data
|
||||
* @param len the number of bytes to write
|
||||
|
|
@ -771,7 +771,7 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
|
||||
/**
|
||||
* Sets the close flag and optionally flushes the stream.
|
||||
*
|
||||
*
|
||||
* @param flush if <code>true</code> flushes the stream
|
||||
*/
|
||||
protected void closeInternal(boolean flush) {
|
||||
|
|
@ -848,8 +848,8 @@ public class InBandBytestreamSession implements BytestreamSession {
|
|||
* Process IQ stanza.
|
||||
* @param data
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotLoggedInException
|
||||
* @throws InterruptedException
|
||||
* @throws NotLoggedInException
|
||||
*/
|
||||
public void processIQPacket(Data data) throws NotConnectedException, InterruptedException, NotLoggedInException {
|
||||
inputStream.dataPacketListener.processStanza(data);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import org.jivesoftware.smackx.filetransfer.StreamNegotiator;
|
|||
* All In-Band Bytestream request having a block size greater than the maximum allowed block size
|
||||
* for this connection are rejected with an <resource-constraint/> error. The maximum block
|
||||
* size can be set by invoking {@link InBandBytestreamManager#setMaximumBlockSize(int)}.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
class InitiationListener extends AbstractIqRequestHandler {
|
||||
|
|
@ -54,7 +54,7 @@ class InitiationListener extends AbstractIqRequestHandler {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param manager the In-Band Bytestream manager
|
||||
*/
|
||||
protected InitiationListener(InBandBytestreamManager manager) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
|
||||
/**
|
||||
* Represents a request to close an In-Band Bytestream.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Close extends IQ {
|
||||
|
|
@ -33,7 +33,7 @@ public class Close extends IQ {
|
|||
|
||||
/**
|
||||
* Creates a new In-Band Bytestream close request packet.
|
||||
*
|
||||
*
|
||||
* @param sessionID unique session ID identifying this In-Band Bytestream
|
||||
*/
|
||||
public Close(String sessionID) {
|
||||
|
|
@ -47,7 +47,7 @@ public class Close extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the unique session ID identifying this In-Band Bytestream.
|
||||
*
|
||||
*
|
||||
* @return the unique session ID identifying this In-Band Bytestream
|
||||
*/
|
||||
public String getSessionID() {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
/**
|
||||
* Represents a chunk of data sent over an In-Band Bytestream encapsulated in an
|
||||
* IQ stanza.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Data extends IQ {
|
||||
|
|
@ -31,7 +31,7 @@ public class Data extends IQ {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param data data stanza extension containing the encoded data
|
||||
*/
|
||||
public Data(DataPacketExtension data) {
|
||||
|
|
@ -46,7 +46,7 @@ public class Data extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the data stanza extension.
|
||||
*
|
||||
*
|
||||
* @return the data stanza extension
|
||||
*/
|
||||
public DataPacketExtension getDataPacketExtension() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.stringencoder.Base64;
|
|||
/**
|
||||
* Represents a chunk of data of an In-Band Bytestream within an IQ stanza or a
|
||||
* message stanza.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class DataPacketExtension implements ExtensionElement {
|
||||
|
|
@ -52,7 +52,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Creates a new In-Band Bytestream data packet.
|
||||
*
|
||||
*
|
||||
* @param sessionID unique session ID identifying this In-Band Bytestream
|
||||
* @param seq sequence of this stanza in regard to the other data packets
|
||||
* @param data the base64 encoded data contained in this packet
|
||||
|
|
@ -74,7 +74,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Returns the unique session ID identifying this In-Band Bytestream.
|
||||
*
|
||||
*
|
||||
* @return the unique session ID identifying this In-Band Bytestream
|
||||
*/
|
||||
public String getSessionID() {
|
||||
|
|
@ -83,7 +83,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Returns the sequence of this stanza in regard to the other data packets.
|
||||
*
|
||||
*
|
||||
* @return the sequence of this stanza in regard to the other data packets.
|
||||
*/
|
||||
public long getSeq() {
|
||||
|
|
@ -92,7 +92,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Returns the data contained in this packet.
|
||||
*
|
||||
*
|
||||
* @return the data contained in this packet.
|
||||
*/
|
||||
public String getData() {
|
||||
|
|
@ -107,7 +107,7 @@ public class DataPacketExtension implements ExtensionElement {
|
|||
* character(s) of the data. See <a
|
||||
* href="http://xmpp.org/extensions/xep-0047.html#sec">XEP-0047</a> Section
|
||||
* 6.
|
||||
*
|
||||
*
|
||||
* @return the decoded data
|
||||
*/
|
||||
public byte[] getDecodedData() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaTyp
|
|||
|
||||
/**
|
||||
* Represents a request to open an In-Band Bytestream.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Open extends IQ {
|
||||
|
|
@ -49,7 +49,7 @@ public class Open extends IQ {
|
|||
* 65535. A recommended default value is 4096.
|
||||
* <p>
|
||||
* The data can be sent using IQ stanzas or message stanzas.
|
||||
*
|
||||
*
|
||||
* @param sessionID unique session ID identifying this In-Band Bytestream
|
||||
* @param blockSize block size in which the data will be fragmented
|
||||
* @param stanza stanza type used to encapsulate the data
|
||||
|
|
@ -77,7 +77,7 @@ public class Open extends IQ {
|
|||
* 65535. A recommended default value is 4096.
|
||||
* <p>
|
||||
* The data will be sent using IQ stanzas.
|
||||
*
|
||||
*
|
||||
* @param sessionID unique session ID identifying this In-Band Bytestream
|
||||
* @param blockSize block size in which the data will be fragmented
|
||||
*/
|
||||
|
|
@ -87,7 +87,7 @@ public class Open extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the unique session ID identifying this In-Band Bytestream.
|
||||
*
|
||||
*
|
||||
* @return the unique session ID identifying this In-Band Bytestream
|
||||
*/
|
||||
public String getSessionID() {
|
||||
|
|
@ -96,7 +96,7 @@ public class Open extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the block size in which the data will be fragmented.
|
||||
*
|
||||
*
|
||||
* @return the block size in which the data will be fragmented
|
||||
*/
|
||||
public int getBlockSize() {
|
||||
|
|
@ -105,7 +105,7 @@ public class Open extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the stanza type used to encapsulate the data.
|
||||
*
|
||||
*
|
||||
* @return the stanza type used to encapsulate the data
|
||||
*/
|
||||
public StanzaType getStanza() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
/**
|
||||
* Parses a close In-Band Bytestream packet.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class CloseIQProvider extends IQProvider<Close> {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
/**
|
||||
* Parses an In-Band Bytestream data stanza which can be a stanza extension of
|
||||
* either an IQ stanza or a message stanza.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class DataPacketProvider {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
|
||||
/**
|
||||
* Parses an In-Band Bytestream open packet.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class OpenIQProvider extends IQProvider<Open> {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.filetransfer.StreamNegotiator;
|
|||
* listeners for a SOCKS5 bytestream request InitiationListener will always refuse the request and
|
||||
* reply with a <not-acceptable/> error (<a
|
||||
* href="http://xmpp.org/extensions/xep-0065.html#usecase-alternate">XEP-0065</a> Section 5.2.A2).
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
final class InitiationListener extends AbstractIqRequestHandler {
|
||||
|
|
@ -49,7 +49,7 @@ final class InitiationListener extends AbstractIqRequestHandler {
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @param manager the SOCKS5 Bytestream manager
|
||||
*/
|
||||
protected InitiationListener(Socks5BytestreamManager manager) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
|||
* {@link Socks5BytestreamManager#addIncomingBytestreamListener(BytestreamListener)} and
|
||||
* {@link Socks5BytestreamManager#addIncomingBytestreamListener(BytestreamListener, org.jxmpp.jid.Jid)} for
|
||||
* further details.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public abstract class Socks5BytestreamListener implements BytestreamListener {
|
||||
|
|
@ -39,7 +39,7 @@ public abstract class Socks5BytestreamListener implements BytestreamListener {
|
|||
|
||||
/**
|
||||
* This listener is notified if a SOCKS5 Bytestream request from another user has been received.
|
||||
*
|
||||
*
|
||||
* @param request the incoming SOCKS5 Bytestream request
|
||||
*/
|
||||
public abstract void incomingBytestreamRequest(Socks5BytestreamRequest request);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ import org.jxmpp.jid.Jid;
|
|||
* <p>
|
||||
* If no {@link Socks5BytestreamListener}s are registered, all incoming SOCKS5 Bytestream requests
|
||||
* will be rejected by returning a <not-acceptable/> error to the initiator.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public final class Socks5BytestreamManager extends Manager implements BytestreamManager {
|
||||
|
|
@ -159,7 +159,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* {@link XMPPConnection}.
|
||||
* <p>
|
||||
* If no manager exists a new is created and initialized.
|
||||
*
|
||||
*
|
||||
* @param connection the XMPP connection or <code>null</code> if given connection is
|
||||
* <code>null</code>
|
||||
* @return the Socks5BytestreamManager for the given XMPP connection
|
||||
|
|
@ -178,7 +178,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Private constructor.
|
||||
*
|
||||
*
|
||||
* @param connection the XMPP connection
|
||||
*/
|
||||
private Socks5BytestreamManager(XMPPConnection connection) {
|
||||
|
|
@ -198,7 +198,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* bytestream requests sent in the context of <a
|
||||
* href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See
|
||||
* {@link FileTransferManager})
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -209,7 +209,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Removes the given listener from the list of listeners for all incoming SOCKS5 Bytestream
|
||||
* requests.
|
||||
*
|
||||
*
|
||||
* @param listener the listener to remove
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -231,7 +231,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* bytestream requests sent in the context of <a
|
||||
* href="http://xmpp.org/extensions/xep-0096.html">XEP-0096</a> file transfer. (See
|
||||
* {@link FileTransferManager})
|
||||
*
|
||||
*
|
||||
* @param listener the listener to register
|
||||
* @param initiatorJID the JID of the user that wants to establish a SOCKS5 Bytestream
|
||||
*/
|
||||
|
|
@ -242,7 +242,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Removes the listener for the given user.
|
||||
*
|
||||
*
|
||||
* @param initiatorJID the JID of the user the listener should be removed
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -257,7 +257,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* This method should be used if you are awaiting a SOCKS5 Bytestream request as a reply to
|
||||
* another stanza (e.g. file transfer).
|
||||
*
|
||||
*
|
||||
* @param sessionID to be ignored
|
||||
*/
|
||||
public void ignoreBytestreamRequestOnce(String sessionID) {
|
||||
|
|
@ -310,7 +310,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the timeout to wait for the response to the SOCKS5 Bytestream initialization request.
|
||||
* Default is 10000ms.
|
||||
*
|
||||
*
|
||||
* @return the timeout to wait for the response to the SOCKS5 Bytestream initialization request
|
||||
*/
|
||||
public int getTargetResponseTimeout() {
|
||||
|
|
@ -323,7 +323,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Sets the timeout to wait for the response to the SOCKS5 Bytestream initialization request.
|
||||
* Default is 10000ms.
|
||||
*
|
||||
*
|
||||
* @param targetResponseTimeout the timeout to set
|
||||
*/
|
||||
public void setTargetResponseTimeout(int targetResponseTimeout) {
|
||||
|
|
@ -333,7 +333,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the timeout for connecting to the SOCKS5 proxy selected by the target. Default is
|
||||
* 10000ms.
|
||||
*
|
||||
*
|
||||
* @return the timeout for connecting to the SOCKS5 proxy selected by the target
|
||||
*/
|
||||
public int getProxyConnectionTimeout() {
|
||||
|
|
@ -346,7 +346,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Sets the timeout for connecting to the SOCKS5 proxy selected by the target. Default is
|
||||
* 10000ms.
|
||||
*
|
||||
*
|
||||
* @param proxyConnectionTimeout the timeout to set
|
||||
*/
|
||||
public void setProxyConnectionTimeout(int proxyConnectionTimeout) {
|
||||
|
|
@ -356,7 +356,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns if the prioritization of the last working SOCKS5 proxy on successive SOCKS5
|
||||
* Bytestream connections is enabled. Default is <code>true</code>.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if prioritization is enabled, <code>false</code> otherwise
|
||||
*/
|
||||
public boolean isProxyPrioritizationEnabled() {
|
||||
|
|
@ -366,7 +366,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Enable/disable the prioritization of the last working SOCKS5 proxy on successive SOCKS5
|
||||
* Bytestream connections.
|
||||
*
|
||||
*
|
||||
* @param proxyPrioritizationEnabled enable/disable the prioritization of the last working
|
||||
* SOCKS5 proxy
|
||||
*/
|
||||
|
|
@ -384,7 +384,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* To establish a SOCKS5 Bytestream after negotiation the kind of data to be sent (e.g. file
|
||||
* transfer) use {@link #establishSession(Jid, String)}.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user a SOCKS5 Bytestream should be established
|
||||
* @return the Socket to send/receive data to/from the user
|
||||
* @throws XMPPException if the user doesn't support or accept SOCKS5 Bytestreams, if no Socks5
|
||||
|
|
@ -403,14 +403,14 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Establishes a SOCKS5 Bytestream with the given user using the given session ID and returns
|
||||
* the Socket to send/receive data to/from the user.
|
||||
*
|
||||
*
|
||||
* @param targetJID the JID of the user a SOCKS5 Bytestream should be established
|
||||
* @param sessionID the session ID for the SOCKS5 Bytestream request
|
||||
* @return the Socket to send/receive data to/from the user
|
||||
* @throws IOException if the bytestream could not be established
|
||||
* @throws InterruptedException if the current thread was interrupted while waiting
|
||||
* @throws SmackException if the target does not support SOCKS5.
|
||||
* @throws XMPPException
|
||||
* @throws XMPPException
|
||||
*/
|
||||
@Override
|
||||
public Socks5BytestreamSession establishSession(Jid targetJID, String sessionID)
|
||||
|
|
@ -512,14 +512,14 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns <code>true</code> if the given target JID supports feature SOCKS5 Bytestream.
|
||||
*
|
||||
*
|
||||
* @param targetJID the target JID
|
||||
* @return <code>true</code> if the given target JID supports feature SOCKS5 Bytestream
|
||||
* otherwise <code>false</code>
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private boolean supportsSocks5(Jid targetJID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(targetJID, Bytestream.NAMESPACE);
|
||||
|
|
@ -528,12 +528,12 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns a list of JIDs of SOCKS5 proxies by querying the XMPP server. The SOCKS5 proxies are
|
||||
* in the same order as returned by the XMPP server.
|
||||
*
|
||||
*
|
||||
* @return list of JIDs of SOCKS5 proxies
|
||||
* @throws XMPPErrorException if there was an error querying the XMPP server for SOCKS5 proxies
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<Jid> determineProxies() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
XMPPConnection connection = connection();
|
||||
|
|
@ -580,7 +580,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* SOCKS5 proxy JIDs. The order of the returned list is the same as the given list of JIDs
|
||||
* excluding all SOCKS5 proxies who's network settings could not be determined. If a local
|
||||
* SOCKS5 proxy is running it will be the first item in the list returned.
|
||||
*
|
||||
*
|
||||
* @param proxies a list of SOCKS5 proxy JIDs
|
||||
* @return a list of stream hosts containing the IP address an the port
|
||||
*/
|
||||
|
|
@ -613,7 +613,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns a IQ stanza to query a SOCKS5 proxy its network settings.
|
||||
*
|
||||
*
|
||||
* @param proxy the proxy to query
|
||||
* @return IQ stanza to query a SOCKS5 proxy its network settings
|
||||
*/
|
||||
|
|
@ -627,7 +627,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the stream host information of the local SOCKS5 proxy containing the IP address and
|
||||
* the port or null if local SOCKS5 proxy is not running.
|
||||
*
|
||||
*
|
||||
* @return the stream host information of the local SOCKS5 proxy or null if local SOCKS5 proxy
|
||||
* is not running
|
||||
*/
|
||||
|
|
@ -666,7 +666,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns a SOCKS5 Bytestream initialization request stanza with the given session ID
|
||||
* containing the given stream hosts for the given target JID.
|
||||
*
|
||||
*
|
||||
* @param sessionID the session ID for the SOCKS5 Bytestream
|
||||
* @param targetJID the target JID of SOCKS5 Bytestream request
|
||||
* @param streamHosts a list of SOCKS5 proxies the target should connect to
|
||||
|
|
@ -693,10 +693,10 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
* <p>
|
||||
* Specified in XEP-65 5.3.1 (Example 13)
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param packet Stanza that should be answered with a not-acceptable error
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
protected void replyRejectPacket(IQ packet) throws NotConnectedException, InterruptedException {
|
||||
StanzaError.Builder xmppError = StanzaError.getBuilder(StanzaError.Condition.not_acceptable);
|
||||
|
|
@ -726,7 +726,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns a new unique session ID.
|
||||
*
|
||||
*
|
||||
* @return a new unique session ID
|
||||
*/
|
||||
private static String getNextSessionID() {
|
||||
|
|
@ -738,7 +738,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns the XMPP connection.
|
||||
*
|
||||
*
|
||||
* @return the XMPP connection
|
||||
*/
|
||||
protected XMPPConnection getConnection() {
|
||||
|
|
@ -748,7 +748,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns the {@link BytestreamListener} that should be informed if a SOCKS5 Bytestream request
|
||||
* from the given initiator JID is received.
|
||||
*
|
||||
*
|
||||
* @param initiator the initiator's JID
|
||||
* @return the listener
|
||||
*/
|
||||
|
|
@ -759,7 +759,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
/**
|
||||
* Returns a list of {@link BytestreamListener} that are informed if there are no listeners for
|
||||
* a specific initiator.
|
||||
*
|
||||
*
|
||||
* @return list of listeners
|
||||
*/
|
||||
protected List<BytestreamListener> getAllRequestListeners() {
|
||||
|
|
@ -768,7 +768,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
|
|||
|
||||
/**
|
||||
* Returns the list of session IDs that should be ignored by the InitialtionListener
|
||||
*
|
||||
*
|
||||
* @return list of session IDs
|
||||
*/
|
||||
protected List<String> getIgnoredBytestreamRequests() {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.jxmpp.util.cache.ExpirationCache;
|
|||
|
||||
/**
|
||||
* Socks5BytestreamRequest class handles incoming SOCKS5 Bytestream requests.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Socks5BytestreamRequest implements BytestreamRequest {
|
||||
|
|
@ -76,7 +76,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* Returns the number of connection failures it takes for a particular SOCKS5 proxy to be
|
||||
* blacklisted. When a proxy is blacklisted no more connection attempts will be made to it for a
|
||||
* period of 2 hours. Default is 2.
|
||||
*
|
||||
*
|
||||
* @return the number of connection failures it takes for a particular SOCKS5 proxy to be
|
||||
* blacklisted
|
||||
*/
|
||||
|
|
@ -90,7 +90,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* period of 2 hours. Default is 2.
|
||||
* <p>
|
||||
* Setting the connection failure threshold to zero disables the blacklisting.
|
||||
*
|
||||
*
|
||||
* @param connectFailureThreshold the number of connection failures it takes for a particular
|
||||
* SOCKS5 proxy to be blacklisted
|
||||
*/
|
||||
|
|
@ -100,7 +100,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Creates a new Socks5BytestreamRequest.
|
||||
*
|
||||
*
|
||||
* @param manager the SOCKS5 Bytestream manager
|
||||
* @param bytestreamRequest the SOCKS5 Bytestream initialization packet
|
||||
*/
|
||||
|
|
@ -118,7 +118,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* <p>
|
||||
* You can set the minimum timeout for establishing a connection to one SOCKS5 proxy by invoking
|
||||
* {@link #setMinimumConnectTimeout(int)}.
|
||||
*
|
||||
*
|
||||
* @return the maximum timeout to connect to SOCKS5 proxies
|
||||
*/
|
||||
public int getTotalConnectTimeout() {
|
||||
|
|
@ -137,7 +137,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* <p>
|
||||
* You can set the minimum timeout for establishing a connection to one SOCKS5 proxy by invoking
|
||||
* {@link #setMinimumConnectTimeout(int)}.
|
||||
*
|
||||
*
|
||||
* @param totalConnectTimeout the maximum timeout to connect to SOCKS5 proxies
|
||||
*/
|
||||
public void setTotalConnectTimeout(int totalConnectTimeout) {
|
||||
|
|
@ -147,7 +147,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Returns the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream
|
||||
* request. Default is 2000ms.
|
||||
*
|
||||
*
|
||||
* @return the timeout to connect to one SOCKS5 proxy
|
||||
*/
|
||||
public int getMinimumConnectTimeout() {
|
||||
|
|
@ -160,7 +160,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Sets the timeout to connect to one SOCKS5 proxy while accepting the SOCKS5 Bytestream
|
||||
* request. Default is 2000ms.
|
||||
*
|
||||
*
|
||||
* @param minimumConnectTimeout the timeout to connect to one SOCKS5 proxy
|
||||
*/
|
||||
public void setMinimumConnectTimeout(int minimumConnectTimeout) {
|
||||
|
|
@ -169,7 +169,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns the sender of the SOCKS5 Bytestream initialization request.
|
||||
*
|
||||
*
|
||||
* @return the sender of the SOCKS5 Bytestream initialization request.
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -179,7 +179,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns the session ID of the SOCKS5 Bytestream initialization request.
|
||||
*
|
||||
*
|
||||
* @return the session ID of the SOCKS5 Bytestream initialization request.
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -193,11 +193,11 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
* <p>
|
||||
* Before accepting the SOCKS5 Bytestream request you can set timeouts by invoking
|
||||
* {@link #setTotalConnectTimeout(int)} and {@link #setMinimumConnectTimeout(int)}.
|
||||
*
|
||||
*
|
||||
* @return the socket to send/receive data
|
||||
* @throws InterruptedException if the current thread was interrupted while waiting
|
||||
* @throws XMPPErrorException
|
||||
* @throws SmackException
|
||||
* @throws XMPPErrorException
|
||||
* @throws SmackException
|
||||
*/
|
||||
@Override
|
||||
public Socks5BytestreamSession accept() throws InterruptedException, XMPPErrorException, SmackException {
|
||||
|
|
@ -266,8 +266,8 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Rejects the SOCKS5 Bytestream request by sending a reject error to the initiator.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
@Override
|
||||
public void reject() throws NotConnectedException, InterruptedException {
|
||||
|
|
@ -277,9 +277,9 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
/**
|
||||
* Cancels the SOCKS5 Bytestream request by sending an error to the initiator and building a
|
||||
* XMPP exception.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
private void cancelRequest() throws XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
String errorMessage = "Could not establish socket with any provided host";
|
||||
|
|
@ -291,7 +291,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns the response to the SOCKS5 Bytestream request containing the SOCKS5 proxy used.
|
||||
*
|
||||
*
|
||||
* @param selectedHost the used SOCKS5 proxy
|
||||
* @return the response to the SOCKS5 Bytestream request
|
||||
*/
|
||||
|
|
@ -306,7 +306,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Increments the connection failure counter by one for the given address.
|
||||
*
|
||||
*
|
||||
* @param address the address the connection failure counter should be increased
|
||||
*/
|
||||
private static void incrementConnectionFailures(String address) {
|
||||
|
|
@ -316,7 +316,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
|
|||
|
||||
/**
|
||||
* Returns how often the connection to the given address failed.
|
||||
*
|
||||
*
|
||||
* @param address the address
|
||||
* @return number of connection failures
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
|||
|
||||
/**
|
||||
* Socks5BytestreamSession class represents a SOCKS5 Bytestream session.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Socks5BytestreamSession implements BytestreamSession {
|
||||
|
|
@ -45,7 +45,7 @@ public class Socks5BytestreamSession implements BytestreamSession {
|
|||
/**
|
||||
* Returns <code>true</code> if the session is established through a direct connection between
|
||||
* the initiator and target, <code>false</code> if the session is mediated over a SOCKS proxy.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if session is a direct connection, <code>false</code> if session is
|
||||
* mediated over a SOCKS5 proxy
|
||||
*/
|
||||
|
|
@ -56,7 +56,7 @@ public class Socks5BytestreamSession implements BytestreamSession {
|
|||
/**
|
||||
* Returns <code>true</code> if the session is mediated over a SOCKS proxy, <code>false</code>
|
||||
* if this session is established through a direct connection between the initiator and target.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if session is mediated over a SOCKS5 proxy, <code>false</code> if
|
||||
* session is a direct connection
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
|||
* The SOCKS5 client class handles establishing a connection to a SOCKS5 proxy. Connecting to a
|
||||
* SOCKS5 proxy requires authentication. This implementation only supports the no-authentication
|
||||
* authentication method.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Socks5Client {
|
||||
|
|
@ -56,7 +56,7 @@ public class Socks5Client {
|
|||
|
||||
/**
|
||||
* Constructor for a SOCKS5 client.
|
||||
*
|
||||
*
|
||||
* @param streamHost containing network settings of the SOCKS5 proxy
|
||||
* @param digest identifying the SOCKS5 Bytestream
|
||||
*/
|
||||
|
|
@ -68,14 +68,14 @@ public class Socks5Client {
|
|||
/**
|
||||
* Returns the initialized socket that can be used to transfer data between peers via the SOCKS5
|
||||
* proxy.
|
||||
*
|
||||
*
|
||||
* @param timeout timeout to connect to SOCKS5 proxy in milliseconds
|
||||
* @return socket the initialized socket
|
||||
* @throws IOException if initializing the socket failed due to a network error
|
||||
* @throws TimeoutException if connecting to SOCKS5 proxy timed out
|
||||
* @throws InterruptedException if the current thread was interrupted while waiting
|
||||
* @throws SmackException if the connection to the SOCKS5 proxy failed
|
||||
* @throws XMPPException
|
||||
* @throws XMPPException
|
||||
*/
|
||||
public Socket getSocket(int timeout) throws IOException, InterruptedException,
|
||||
TimeoutException, SmackException, XMPPException {
|
||||
|
|
@ -139,10 +139,10 @@ public class Socks5Client {
|
|||
* Initializes the connection to the SOCKS5 proxy by negotiating authentication method and
|
||||
* requesting a stream for the given digest. Currently only the no-authentication method is
|
||||
* supported by the Socks5Client.
|
||||
*
|
||||
*
|
||||
* @param socket connected to a SOCKS5 proxy
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void establish(Socket socket) throws SmackException, IOException {
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ public class Socks5Client {
|
|||
* type "domain" and the digest as address.
|
||||
* <p>
|
||||
* (see <a href="http://tools.ietf.org/html/rfc1928">RFC1928</a>)
|
||||
*
|
||||
*
|
||||
* @return SOCKS5 connection request message
|
||||
*/
|
||||
private byte[] createSocks5ConnectRequest() {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.jxmpp.jid.Jid;
|
|||
* to the local SOCKS5 proxy differs form the regular way to connect to a SOCKS5 proxy. Additionally
|
||||
* a remote SOCKS5 proxy has to be activated by the initiator before data can be transferred between
|
||||
* the peers.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Socks5ClientForInitiator extends Socks5Client {
|
||||
|
|
@ -56,7 +56,7 @@ public class Socks5ClientForInitiator extends Socks5Client {
|
|||
|
||||
/**
|
||||
* Creates a new SOCKS5 client for the initiators side.
|
||||
*
|
||||
*
|
||||
* @param streamHost containing network settings of the SOCKS5 proxy
|
||||
* @param digest identifying the SOCKS5 Bytestream
|
||||
* @param connection the XMPP connection
|
||||
|
|
@ -107,10 +107,10 @@ public class Socks5ClientForInitiator extends Socks5Client {
|
|||
/**
|
||||
* Activates the SOCKS5 Bytestream by sending an XMPP SOCKS5 Bytestream activation stanza to the
|
||||
* SOCKS5 proxy.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackException if there was no response from the server.
|
||||
*/
|
||||
private void activate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
|
|
@ -121,7 +121,7 @@ public class Socks5ClientForInitiator extends Socks5Client {
|
|||
|
||||
/**
|
||||
* Returns a SOCKS5 Bytestream activation packet.
|
||||
*
|
||||
*
|
||||
* @return SOCKS5 Bytestream activation packet
|
||||
*/
|
||||
private Bytestream createStreamHostActivation() {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ import org.jivesoftware.smack.util.StringUtils;
|
|||
* with other address types</li>
|
||||
* </ul>
|
||||
* (see <a href="http://tools.ietf.org/html/rfc1928">RFC 1928</a>)
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public final class Socks5Proxy {
|
||||
|
|
@ -131,7 +131,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Returns true if the local Socks5 proxy should be started. Default is true.
|
||||
*
|
||||
*
|
||||
* @return if the local Socks5 proxy should be started
|
||||
*/
|
||||
public static boolean isLocalSocks5ProxyEnabled() {
|
||||
|
|
@ -140,7 +140,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Sets if the local Socks5 proxy should be started. Default is true.
|
||||
*
|
||||
*
|
||||
* @param localSocks5ProxyEnabled if the local Socks5 proxy should be started
|
||||
*/
|
||||
public static void setLocalSocks5ProxyEnabled(boolean localSocks5ProxyEnabled) {
|
||||
|
|
@ -149,7 +149,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Return the port of the local Socks5 proxy. Default is 7777.
|
||||
*
|
||||
*
|
||||
* @return the port of the local Socks5 proxy
|
||||
*/
|
||||
public static int getLocalSocks5ProxyPort() {
|
||||
|
|
@ -159,7 +159,7 @@ public final class Socks5Proxy {
|
|||
/**
|
||||
* Sets the port of the local Socks5 proxy. Default is 7777. If you set the port to a negative
|
||||
* value Smack tries the absolute value and all following until it finds an open port.
|
||||
*
|
||||
*
|
||||
* @param localSocks5ProxyPort the port of the local Socks5 proxy to set
|
||||
*/
|
||||
public static void setLocalSocks5ProxyPort(int localSocks5ProxyPort) {
|
||||
|
|
@ -171,7 +171,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Returns the local SOCKS5 proxy server.
|
||||
*
|
||||
*
|
||||
* @return the local SOCKS5 proxy server
|
||||
*/
|
||||
public static synchronized Socks5Proxy getSocks5Proxy() {
|
||||
|
|
@ -260,7 +260,7 @@ public final class Socks5Proxy {
|
|||
* Note that the list of addresses initially contains the address returned by
|
||||
* <code>InetAddress.getLocalHost().getHostAddress()</code>. You can replace the list of
|
||||
* addresses by invoking {@link #replaceLocalAddresses(Collection)}.
|
||||
*
|
||||
*
|
||||
* @param address the local network address to add
|
||||
*/
|
||||
public void addLocalAddress(String address) {
|
||||
|
|
@ -275,7 +275,7 @@ public final class Socks5Proxy {
|
|||
/**
|
||||
* Removes the given address from the list of local network addresses. This address will then no
|
||||
* longer be used of outgoing SOCKS5 Bytestream requests.
|
||||
*
|
||||
*
|
||||
* @param address the local network address to remove
|
||||
* @return true if the address was removed.
|
||||
*/
|
||||
|
|
@ -288,7 +288,7 @@ public final class Socks5Proxy {
|
|||
/**
|
||||
* Returns an set of the local network addresses that will be used for streamhost
|
||||
* candidates of outgoing SOCKS5 Bytestream requests.
|
||||
*
|
||||
*
|
||||
* @return set of the local network addresses
|
||||
*/
|
||||
public List<String> getLocalAddresses() {
|
||||
|
|
@ -304,7 +304,7 @@ public final class Socks5Proxy {
|
|||
* want to define their order. This may be necessary if your application is running on a machine
|
||||
* with multiple network interfaces or if you want to provide your public address in case you
|
||||
* are behind a NAT router.
|
||||
*
|
||||
*
|
||||
* @param addresses the new list of local network addresses
|
||||
*/
|
||||
public void replaceLocalAddresses(Collection<String> addresses) {
|
||||
|
|
@ -319,7 +319,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Returns the port of the local SOCKS5 proxy server. If it is not running -1 will be returned.
|
||||
*
|
||||
*
|
||||
* @return the port of the local SOCKS5 proxy server or -1 if proxy is not running
|
||||
*/
|
||||
public int getPort() {
|
||||
|
|
@ -333,7 +333,7 @@ public final class Socks5Proxy {
|
|||
* Returns the socket for the given digest. A socket will be returned if the given digest has
|
||||
* been in the list of allowed transfers (see {@link #addTransfer(String)}) while the peer
|
||||
* connected to the SOCKS5 proxy.
|
||||
*
|
||||
*
|
||||
* @param digest identifying the connection
|
||||
* @return socket or null if there is no socket for the given digest
|
||||
*/
|
||||
|
|
@ -345,7 +345,7 @@ public final class Socks5Proxy {
|
|||
* Add the given digest to the list of allowed transfers. Only connections for allowed transfers
|
||||
* are stored and can be retrieved by invoking {@link #getSocket(String)}. All connections to
|
||||
* the local SOCKS5 proxy that don't contain an allowed digest are discarded.
|
||||
*
|
||||
*
|
||||
* @param digest to be added to the list of allowed transfers
|
||||
*/
|
||||
public void addTransfer(String digest) {
|
||||
|
|
@ -358,7 +358,7 @@ public final class Socks5Proxy {
|
|||
* <p>
|
||||
* The digest should be removed after establishing the SOCKS5 Bytestream is finished, an error
|
||||
* occurred while establishing the connection or if the connection is not allowed anymore.
|
||||
*
|
||||
*
|
||||
* @param digest to be removed from the list of allowed transfers
|
||||
*/
|
||||
protected void removeTransfer(String digest) {
|
||||
|
|
@ -369,7 +369,7 @@ public final class Socks5Proxy {
|
|||
/**
|
||||
* Returns <code>true</code> if the local SOCKS5 proxy server is running, otherwise
|
||||
* <code>false</code>.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if the local SOCKS5 proxy server is running, otherwise
|
||||
* <code>false</code>
|
||||
*/
|
||||
|
|
@ -423,7 +423,7 @@ public final class Socks5Proxy {
|
|||
|
||||
/**
|
||||
* Negotiates a SOCKS5 connection and stores it on success.
|
||||
*
|
||||
*
|
||||
* @param socket connection to the client
|
||||
* @throws SmackException if client requests a connection in an unsupported way
|
||||
* @throws IOException if a network error occurred
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jxmpp.jid.Jid;
|
|||
|
||||
/**
|
||||
* A collection of utility methods for SOcKS5 messages.
|
||||
*
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class Socks5Utils {
|
||||
|
|
@ -34,7 +34,7 @@ public class Socks5Utils {
|
|||
/**
|
||||
* Returns a SHA-1 digest of the given parameters as specified in <a
|
||||
* href="http://xmpp.org/extensions/xep-0065.html#impl-socks5">XEP-0065</a>.
|
||||
*
|
||||
*
|
||||
* @param sessionID for the SOCKS5 Bytestream
|
||||
* @param initiatorJID JID of the initiator of a SOCKS5 Bytestream
|
||||
* @param targetJID JID of the target of a SOCKS5 Bytestream
|
||||
|
|
@ -51,7 +51,7 @@ public class Socks5Utils {
|
|||
* message or a SOCKS5 response message.
|
||||
* <p>
|
||||
* (see <a href="http://tools.ietf.org/html/rfc1928">RFC1928</a>)
|
||||
*
|
||||
*
|
||||
* @param in the DataInputStream to read the message from
|
||||
* @return the SOCKS5 message
|
||||
* @throws IOException if a network error occurred
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import org.jxmpp.jid.Jid;
|
|||
|
||||
/**
|
||||
* A stanza representing part of a SOCKS5 Bytestream negotiation.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public class Bytestream extends IQ {
|
||||
|
|
@ -61,7 +61,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* A constructor where the session ID can be specified.
|
||||
*
|
||||
*
|
||||
* @param SID The session ID related to the negotiation.
|
||||
* @see #setSessionID(String)
|
||||
*/
|
||||
|
|
@ -73,7 +73,7 @@ public class Bytestream extends IQ {
|
|||
/**
|
||||
* Set the session ID related to the bytestream. The session ID is a unique identifier used to
|
||||
* differentiate between stream negotiations.
|
||||
*
|
||||
*
|
||||
* @param sessionID the unique session ID that identifies the transfer.
|
||||
*/
|
||||
public void setSessionID(final String sessionID) {
|
||||
|
|
@ -82,7 +82,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the session ID related to the bytestream negotiation.
|
||||
*
|
||||
*
|
||||
* @return Returns the session ID related to the bytestream negotiation.
|
||||
* @see #setSessionID(String)
|
||||
*/
|
||||
|
|
@ -92,7 +92,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Set the transport mode. This should be put in the initiation of the interaction.
|
||||
*
|
||||
*
|
||||
* @param mode the transport mode, either UDP or TCP
|
||||
* @see Mode
|
||||
*/
|
||||
|
|
@ -102,7 +102,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the transport mode.
|
||||
*
|
||||
*
|
||||
* @return Returns the transport mode.
|
||||
* @see #setMode(Mode)
|
||||
*/
|
||||
|
|
@ -112,7 +112,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Adds a potential stream host that the remote user can connect to to receive the file.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the stream host.
|
||||
* @param address The internet address of the stream host.
|
||||
* @return The added stream host.
|
||||
|
|
@ -123,7 +123,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Adds a potential stream host that the remote user can connect to to receive the file.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the stream host.
|
||||
* @param address The internet address of the stream host.
|
||||
* @param port The port on which the remote host is seeking connections.
|
||||
|
|
@ -138,7 +138,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Adds a potential stream host that the remote user can transfer the file through.
|
||||
*
|
||||
*
|
||||
* @param host The potential stream host.
|
||||
*/
|
||||
public void addStreamHost(final StreamHost host) {
|
||||
|
|
@ -147,7 +147,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the list of stream hosts contained in the packet.
|
||||
*
|
||||
*
|
||||
* @return Returns the list of stream hosts contained in the packet.
|
||||
*/
|
||||
public List<StreamHost> getStreamHosts() {
|
||||
|
|
@ -156,7 +156,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the stream host related to the given JID, or null if there is none.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the desired stream host.
|
||||
* @return Returns the stream host related to the given JID, or null if there is none.
|
||||
*/
|
||||
|
|
@ -175,7 +175,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the count of stream hosts contained in this packet.
|
||||
*
|
||||
*
|
||||
* @return Returns the count of stream hosts contained in this packet.
|
||||
*/
|
||||
public int countStreamHosts() {
|
||||
|
|
@ -185,7 +185,7 @@ public class Bytestream extends IQ {
|
|||
/**
|
||||
* Upon connecting to the stream host the target of the stream replies to the initiator with the
|
||||
* JID of the SOCKS5 host that they used.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the used host.
|
||||
*/
|
||||
public void setUsedHost(final Jid JID) {
|
||||
|
|
@ -194,7 +194,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the SOCKS5 host connected to by the remote user.
|
||||
*
|
||||
*
|
||||
* @return Returns the SOCKS5 host connected to by the remote user.
|
||||
*/
|
||||
public StreamHostUsed getUsedHost() {
|
||||
|
|
@ -204,7 +204,7 @@ public class Bytestream extends IQ {
|
|||
/**
|
||||
* Returns the activate element of the stanza sent to the proxy host to verify the identity of
|
||||
* the initiator and match them to the appropriate stream.
|
||||
*
|
||||
*
|
||||
* @return Returns the activate element of the stanza sent to the proxy host to verify the
|
||||
* identity of the initiator and match them to the appropriate stream.
|
||||
*/
|
||||
|
|
@ -216,7 +216,7 @@ public class Bytestream extends IQ {
|
|||
* Upon the response from the target of the used host the activate stanza is sent to the SOCKS5
|
||||
* proxy. The proxy will activate the stream or return an error after verifying the identity of
|
||||
* the initiator, using the activate packet.
|
||||
*
|
||||
*
|
||||
* @param targetID The JID of the target of the file transfer.
|
||||
*/
|
||||
public void setToActivate(final Jid targetID) {
|
||||
|
|
@ -262,7 +262,7 @@ public class Bytestream extends IQ {
|
|||
/**
|
||||
* Stanza extension that represents a potential SOCKS5 proxy for the file transfer. Stream hosts
|
||||
* are forwarded to the target of the file transfer who then chooses and connects to one.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public static class StreamHost implements NamedElement {
|
||||
|
|
@ -281,7 +281,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the stream host.
|
||||
* @param address The internet address of the stream host.
|
||||
* @param port port of the stream host.
|
||||
|
|
@ -294,7 +294,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the JID of the stream host.
|
||||
*
|
||||
*
|
||||
* @return Returns the JID of the stream host.
|
||||
*/
|
||||
public Jid getJID() {
|
||||
|
|
@ -303,7 +303,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the internet address of the stream host.
|
||||
*
|
||||
*
|
||||
* @return Returns the internet address of the stream host.
|
||||
*/
|
||||
public String getAddress() {
|
||||
|
|
@ -312,7 +312,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the port on which the potential stream host would accept the connection.
|
||||
*
|
||||
*
|
||||
* @return Returns the port on which the potential stream host would accept the connection.
|
||||
*/
|
||||
public int getPort() {
|
||||
|
|
@ -342,7 +342,7 @@ public class Bytestream extends IQ {
|
|||
/**
|
||||
* After selected a SOCKS5 stream host and successfully connecting, the target of the file
|
||||
* transfer returns a byte stream stanza with the stream host used extension.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public static class StreamHostUsed implements NamedElement {
|
||||
|
|
@ -353,7 +353,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
*
|
||||
* @param JID The JID of the selected stream host.
|
||||
*/
|
||||
public StreamHostUsed(final Jid JID) {
|
||||
|
|
@ -362,7 +362,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the JID of the selected stream host.
|
||||
*
|
||||
*
|
||||
* @return Returns the JID of the selected stream host.
|
||||
*/
|
||||
public Jid getJID() {
|
||||
|
|
@ -385,7 +385,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* The stanza sent by the stream initiator to the stream proxy to activate the connection.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public static class Activate implements NamedElement {
|
||||
|
|
@ -396,7 +396,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Default constructor specifying the target of the stream.
|
||||
*
|
||||
*
|
||||
* @param target The target of the stream.
|
||||
*/
|
||||
public Activate(final Jid target) {
|
||||
|
|
@ -405,7 +405,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* Returns the target of the activation.
|
||||
*
|
||||
*
|
||||
* @return Returns the target of the activation.
|
||||
*/
|
||||
public Jid getTarget() {
|
||||
|
|
@ -429,7 +429,7 @@ public class Bytestream extends IQ {
|
|||
|
||||
/**
|
||||
* The stream can be either a TCP stream or a UDP stream.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public enum Mode {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
|
||||
/**
|
||||
* Parses a bytestream packet.
|
||||
*
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
*/
|
||||
public class BytestreamsProvider extends IQProvider<Bytestream> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue