Nearly completed work on Jingle SOCKS5

This commit is contained in:
vanitasvitae 2017-07-21 23:05:46 +02:00
parent a77360d060
commit 639c951fd6
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
117 changed files with 1363 additions and 911 deletions

View File

@ -35,10 +35,10 @@ import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smackx.jet.element.JetSecurityElement;
import org.jivesoftware.smackx.jingle.JingleUtil;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle_filetransfer.OutgoingJingleFileOffer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;

View File

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jet.element;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.jet.JetManager;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement;
/**
* Implementation of the Jingle security element as specified in XEP-XXXX (Jingle Encrypted Transfers).

View File

@ -26,9 +26,9 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;

View File

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.jingle_filetransfer;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jxmpp.jid.FullJid;

View File

@ -29,12 +29,12 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.jingle.JingleUtil;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle3.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;

View File

@ -19,8 +19,8 @@ package org.jivesoftware.smackx.jingle_filetransfer;
import java.util.ArrayList;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle.JingleUtil;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler;

View File

@ -28,9 +28,9 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
import org.jivesoftware.smackx.jingle.transports.JingleTransportManager;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;

View File

@ -24,7 +24,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;

View File

@ -25,7 +25,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
/**
* Created by vanitas on 21.06.17.

View File

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback;
import java.io.File;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle_filetransfer.handler.FileTransferHandler;
/**

View File

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.callback;
import java.io.File;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
/**
* Callback used to accept/decline file requests.

View File

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
/**
* Checksum element.

View File

@ -18,8 +18,8 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
import java.util.List;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
/**
* File element.

View File

@ -21,7 +21,7 @@ import java.util.Date;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
/**
* Content of type File.

View File

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.jingle_filetransfer.handler;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
/**
* Handler that provides some control over the JingleFileOffer session.

View File

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.jingle_filetransfer.listener;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle_filetransfer.callback.IncomingFileOfferCallback;
/**

View File

@ -23,7 +23,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;

View File

@ -24,8 +24,8 @@ import java.util.ArrayList;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle3.provider.JingleContentDescriptionProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;

View File

@ -22,7 +22,7 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smackx.hashes.HashManager;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle_filetransfer.element.Checksum;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;
import org.jivesoftware.smackx.jingle_filetransfer.element.Range;

View File

@ -29,12 +29,12 @@ import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smackx.hashes.HashManager;
import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.jingle.JingleUtil;
import org.jivesoftware.smackx.jingle.transport.legacy.JingleUtil;
import org.jivesoftware.smackx.jingle.JingleUtilTest;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.transports.jingle_ibb.element.JingleIBBTransport;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransferChild;

View File

@ -0,0 +1,31 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle;
import org.jivesoftware.smackx.jingle.internal.Content;
/**
* User callback that the user can use to control a jingle content.
*/
public abstract class Callback {
private final Content content;
public Callback(Content content) {
this.content = content;
}
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3;
package org.jivesoftware.smackx.jingle;
import org.jxmpp.jid.FullJid;

View File

@ -0,0 +1,31 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle;
import org.jivesoftware.smackx.jingle.callbacks.ContentAddCallback;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.internal.Content;
/**
* Manager for JingleDescription components.
*/
public interface JingleDescriptionManager {
String getNamespace();
JingleElement notifyContentListeners(Content content, ContentAddCallback callback);
}

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle;
import java.util.ArrayList;
import java.util.Collections;
@ -13,24 +29,24 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.jingle3.adapter.JingleDescriptionAdapter;
import org.jivesoftware.smackx.jingle3.adapter.JingleSecurityAdapter;
import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedDescriptionException;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedSecurityException;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedTransportException;
import org.jivesoftware.smackx.jingle3.internal.Session;
import org.jivesoftware.smackx.jingle3.provider.JingleContentDescriptionProvider;
import org.jivesoftware.smackx.jingle3.provider.JingleContentSecurityProvider;
import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.adapter.JingleDescriptionAdapter;
import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.exception.UnsupportedTransportException;
import org.jivesoftware.smackx.jingle.provider.JingleContentSecurityProvider;
import org.jivesoftware.smackx.jingle.adapter.JingleSecurityAdapter;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.exception.UnsupportedDescriptionException;
import org.jivesoftware.smackx.jingle.exception.UnsupportedSecurityException;
import org.jivesoftware.smackx.jingle.internal.Session;
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jxmpp.jid.FullJid;
/**
* Created by vanitas on 18.07.17.
* Manager for Jingle (XEP-0166).
*/
public class JingleManager extends Manager {
private static final WeakHashMap<XMPPConnection, JingleManager> INSTANCES = new WeakHashMap<>();

View File

@ -0,0 +1,25 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle;
/**
* Manager for JingleSecurity components.
*/
public interface JingleSecurityManager {
String getNamespace();
}

View File

@ -0,0 +1,32 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle;
import org.jivesoftware.smackx.jingle.internal.Content;
import org.jivesoftware.smackx.jingle.internal.Transport;
/**
* Manager for JingleTransport components.
*/
public interface JingleTransportManager extends Comparable<JingleTransportManager> {
String getNamespace();
Transport<?> createTransport(Content content);
Transport<?> createTransport(Content content, Transport<?> peersTransport);
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3;
package org.jivesoftware.smackx.jingle;
public enum Role {
initiator,

View File

@ -0,0 +1,30 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.adapter;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.internal.Description;
/**
* Adapter that creates a Description object from an element.
*/
public interface JingleDescriptionAdapter<D extends Description<?>> {
D descriptionFromElement(JingleContentDescriptionElement element);
String getNamespace();
}

View File

@ -0,0 +1,30 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.adapter;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle.internal.Security;
/**
* Adapter that creates a Security object from an element.
*/
public interface JingleSecurityAdapter<S extends Security<?>> {
S securityFromElement(JingleContentSecurityElement element);
String getNamespace();
}

View File

@ -0,0 +1,30 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.adapter;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.internal.Transport;
/**
* Adapter that creates a Transport element from an element.
*/
public interface JingleTransportAdapter<T extends Transport<?>> {
T transportFromElement(JingleContentTransportElement element);
String getNamespace();
}

View File

@ -0,0 +1,27 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.callbacks;
/**
* Callback that gets called when the user accepts a content-add request.
*/
public interface ContentAddCallback {
void acceptContentAdd();
void rejectContentAdd();
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.HashMap;
import java.util.Map;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.NamedElement;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.Collections;
import java.util.List;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.util.Objects;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.ExtensionElement;

View File

@ -1,4 +1,4 @@
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.NamedElement;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.NamedElement;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.Collections;
import java.util.List;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import org.jivesoftware.smack.packet.NamedElement;

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.Locale;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;
import java.util.HashMap;
import java.util.Map;

View File

@ -18,4 +18,4 @@
/**
* Stanzas and Extension Elements for <a href="https://xmpp.org/extensions/xep-0166.html">XEP-0166: Jingle</a>.
*/
package org.jivesoftware.smackx.jingle3.element;
package org.jivesoftware.smackx.jingle.element;

View File

@ -0,0 +1,35 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.exception;
/**
* Exception that gets thrown when an unknown/unsupported description element is received.
*/
public class UnsupportedDescriptionException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedDescriptionException(String namespace) {
super("Description with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -0,0 +1,35 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.exception;
/**
* Exception that gets thrown when an unknown/unsupported security element gets received.
*/
public class UnsupportedSecurityException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedSecurityException(String namespace) {
super("Security with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -0,0 +1,35 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.exception;
/**
* Exception that gets thrown when an unknown/unsupported transport element gets received.
*/
public class UnsupportedTransportException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedTransportException(String namespace) {
super("Transport with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3.internal;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import java.util.ArrayList;
import java.util.Collections;
@ -7,15 +23,15 @@ import java.util.List;
import java.util.Set;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.jingle3.Callback;
import org.jivesoftware.smackx.jingle3.JingleManager;
import org.jivesoftware.smackx.jingle3.adapter.JingleDescriptionAdapter;
import org.jivesoftware.smackx.jingle3.adapter.JingleSecurityAdapter;
import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.adapter.JingleDescriptionAdapter;
import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.Callback;
import org.jivesoftware.smackx.jingle.adapter.JingleSecurityAdapter;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
/**
* Internal class that holds the state of a content in a modifiable form.

View File

@ -0,0 +1,39 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
/**
* Class that represents a contents description component.
*/
public abstract class Description<D extends JingleContentDescriptionElement> {
private Content parent;
public abstract D getElement();
public void setParent(Content parent) {
if (this.parent != parent) {
this.parent = parent;
}
}
public Content getParent() {
return parent;
}
}

View File

@ -0,0 +1,54 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import org.jivesoftware.smackx.jingle.element.JingleAction;
/**
* Object that represents a pending jingle action. A pending jingle action is an action that was sent to the peer,
* but a response hasn't yet received.
*/
public abstract class PendingJingleAction {
private final JingleAction action;
private final Content affectedContent;
public PendingJingleAction(JingleAction action, Content content) {
this.action = action;
this.affectedContent = content;
}
public JingleAction getAction() {
return action;
}
public Content getAffectedContent() {
return affectedContent;
}
public static class TransportReplace extends PendingJingleAction {
private final Transport<?> newTransport;
public TransportReplace(Content content, Transport<?> newTransport) {
super(JingleAction.transport_replace, content);
this.newTransport = newTransport;
}
public Transport<?> getNewTransport() {
return newTransport;
}
}
}

View File

@ -0,0 +1,43 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityInfoElement;
/**
* Class that represents a contents security component.
*/
public abstract class Security<D extends JingleContentSecurityElement> {
private Content parent;
public abstract D getElement();
public abstract JingleElement handleSecurityInfo(JingleContentSecurityInfoElement element);
public void setParent(Content parent) {
if (this.parent != parent) {
this.parent = parent;
}
}
public Content getParent() {
return parent;
}
}

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3.internal;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import java.util.ArrayList;
import java.util.Collections;
@ -13,26 +29,26 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.jingle3.JingleDescriptionManager;
import org.jivesoftware.smackx.jingle3.JingleManager;
import org.jivesoftware.smackx.jingle3.Role;
import org.jivesoftware.smackx.jingle3.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle3.callbacks.ContentAddCallback;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedDescriptionException;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedSecurityException;
import org.jivesoftware.smackx.jingle3.exception.UnsupportedTransportException;
import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.Role;
import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle.callbacks.ContentAddCallback;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.exception.UnsupportedDescriptionException;
import org.jivesoftware.smackx.jingle.exception.UnsupportedSecurityException;
import org.jivesoftware.smackx.jingle.exception.UnsupportedTransportException;
import org.jivesoftware.smackx.jingle.JingleDescriptionManager;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
import org.jxmpp.jid.FullJid;
/**
* Created by vanitas on 17.07.17.
* Class that represents a Jingle session.
*/
public class Session {
private static final Logger LOGGER = Logger.getLogger(Session.class.getName());

View File

@ -1,17 +1,32 @@
package org.jivesoftware.smackx.jingle3.internal;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener;
import org.jxmpp.jid.FullJid;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
/**
* Created by vanitas on 18.07.17.
* Class that represents a contents transport component.
*/
public abstract class Transport<D extends JingleContentTransportElement> {
@ -21,10 +36,6 @@ public abstract class Transport<D extends JingleContentTransportElement> {
private Transport peersProposal;
private boolean isPeersProposal;
public Transport(Content content) {
this.parent = content;
}
public abstract D getElement();
public void addCandidate(TransportCandidate<?> candidate) {
@ -60,15 +71,11 @@ public abstract class Transport<D extends JingleContentTransportElement> {
public abstract String getNamespace();
public abstract void establishIncomingBytestreamSession(FullJid peer,
String transportSessionId,
BytestreamSessionEstablishedListener listener,
XMPPConnection connection);
public abstract void establishIncomingBytestreamSession(BytestreamSessionEstablishedListener listener,
XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException;
public abstract void establishOutgoingBytestreamSession(FullJid peer,
String transportSessionId,
BytestreamSessionEstablishedListener listener,
XMPPConnection connection);
public abstract void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener,
XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException;
public void setPeersProposal(Transport peersProposal) {
this.peersProposal = peersProposal;

View File

@ -0,0 +1,48 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.internal;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement;
/**
* Class that represents a transports candidate component.
*/
public abstract class TransportCandidate<E extends JingleContentTransportCandidateElement> {
private Transport<?> parent;
private int priority;
public void setParent(Transport<?> transport) {
if (parent != transport) {
parent = transport;
}
}
public Transport<?> getParent() {
return parent;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public abstract E getElement();
}

View File

@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Florian Schmaus
* Copyright 2017 Florian Schmaus, Paul Schaub
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.xmlpull.v1.XmlPullParser;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -1,7 +1,7 @@
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle.element.JingleContentSecurityElement;
import org.xmlpull.v1.XmlPullParser;

View File

@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.xmlpull.v1.XmlPullParser;

View File

@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.jingle3.element.JingleErrorElement;
import org.jivesoftware.smackx.jingle.element.JingleErrorElement;
import org.xmlpull.v1.XmlPullParser;

View File

@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;
import java.util.logging.Logger;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement.Reason;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement.Reason;
import org.jxmpp.jid.FullJid;
import org.xmlpull.v1.XmlPullParser;

View File

@ -18,4 +18,4 @@
/**
* Providers and parsers for <a href="https://xmpp.org/extensions/xep-0166.html">XEP-0166: Jingle</a>.
*/
package org.jivesoftware.smackx.jingle3.provider;
package org.jivesoftware.smackx.jingle.provider;

View File

@ -0,0 +1,30 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
/**
* Listener that can be registered to get notified about established Bytestreams.
*/
public interface BytestreamSessionEstablishedListener {
void onBytestreamSessionEstablished(BytestreamSession session);
void onBytestreamSessionFailed(Exception exception);
}

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_ibb;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
@ -8,16 +24,15 @@ import org.jivesoftware.smackx.bytestreams.BytestreamListener;
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle3.internal.Transport;
import org.jivesoftware.smackx.jingle3.internal.TransportCandidate;
import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener;
import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element.JingleIBBTransportElement;
import org.jxmpp.jid.FullJid;
import org.jivesoftware.smackx.jingle.internal.Transport;
import org.jivesoftware.smackx.jingle.internal.TransportCandidate;
import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle.internal.Session;
import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement;
/**
* Created by vanitas on 18.07.17.
* Jingle InBandBytestream Transport component.
*/
public class JingleIBBTransport extends Transport<JingleIBBTransportElement> {
@ -36,6 +51,14 @@ public class JingleIBBTransport extends Transport<JingleIBBTransportElement> {
this(StringUtils.randomString(10), JingleIBBTransportElement.DEFAULT_BLOCK_SIZE);
}
public Short getBlockSize() {
return blockSize;
}
public String getSid() {
return streamId;
}
@Override
public JingleIBBTransportElement getElement() {
return new JingleIBBTransportElement(streamId, blockSize);
@ -47,13 +70,14 @@ public class JingleIBBTransport extends Transport<JingleIBBTransportElement> {
}
@Override
public void establishIncomingBytestreamSession(final FullJid peer, final String transportSessionId, final BytestreamSessionEstablishedListener listener, XMPPConnection connection) {
public void establishIncomingBytestreamSession(final BytestreamSessionEstablishedListener listener, final XMPPConnection connection) {
final Session session = getParent().getParent();
InBandBytestreamManager.getByteStreamManager(connection)
.addIncomingBytestreamListener(new BytestreamListener() {
@Override
public void incomingBytestreamRequest(BytestreamRequest request) {
if (request.getFrom().asFullJidIfPossible().equals(peer)
&& request.getSessionID().equals(transportSessionId)) {
if (request.getFrom().asFullJidIfPossible().equals(session.getPeer())
&& request.getSessionID().equals(getSid())) {
BytestreamSession bytestreamSession;
try {
@ -69,12 +93,13 @@ public class JingleIBBTransport extends Transport<JingleIBBTransportElement> {
}
@Override
public void establishOutgoingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) {
public void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection) {
Session session = getParent().getParent();
InBandBytestreamManager inBandBytestreamManager = InBandBytestreamManager.getByteStreamManager(connection);
inBandBytestreamManager.setDefaultBlockSize(blockSize);
try {
BytestreamSession session = inBandBytestreamManager.establishSession(peer, transportSessionId);
listener.onBytestreamSessionEstablished(session);
BytestreamSession bytestreamSession = inBandBytestreamManager.establishSession(session.getPeer(), getSid());
listener.onBytestreamSessionEstablished(bytestreamSession);
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException | SmackException.NotConnectedException e) {
listener.onBytestreamSessionFailed(e);
}
@ -88,6 +113,5 @@ public class JingleIBBTransport extends Transport<JingleIBBTransportElement> {
@Override
public void handleTransportInfo(JingleContentTransportInfoElement info) {
// Nothing to do.
}
}

View File

@ -0,0 +1,37 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_ibb;
import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement;
/**
* Adapter for Jingle InBandBytestream transports.
*/
public class JingleIBBTransportAdapter implements JingleTransportAdapter<JingleIBBTransport> {
@Override
public JingleIBBTransport transportFromElement(JingleContentTransportElement element) {
JingleIBBTransportElement transport = (JingleIBBTransportElement) element;
return new JingleIBBTransport(transport.getSid(), transport.getBlockSize());
}
@Override
public String getNamespace() {
return JingleIBBTransport.NAMESPACE;
}
}

View File

@ -0,0 +1,40 @@
package org.jivesoftware.smackx.jingle.transport.jingle_ibb;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle.JingleTransportManager;
import org.jivesoftware.smackx.jingle.internal.Content;
import org.jivesoftware.smackx.jingle.internal.Transport;
/**
* Created by vanitas on 21.07.17.
*/
public class JingleIBBTransportManager extends Manager implements JingleTransportManager {
public static final short MAX_BLOCKSIZE = 8192;
private JingleIBBTransportManager(XMPPConnection connection) {
super(connection);
}
@Override
public String getNamespace() {
return JingleIBBTransport.NAMESPACE;
}
@Override
public Transport<?> createTransport(Content content) {
return new JingleIBBTransport();
}
@Override
public Transport<?> createTransport(Content content, Transport<?> peersTransport) {
JingleIBBTransport other = (JingleIBBTransport) peersTransport;
return new JingleIBBTransport(other.getSid(), (short) Math.min(other.getBlockSize(), MAX_BLOCKSIZE));
}
@Override
public int compareTo(JingleTransportManager manager) {
return 0;
}
}

View File

@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element;
package org.jivesoftware.smackx.jingle.transport.jingle_ibb.element;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.JingleIBBTransport;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_ibb.JingleIBBTransport;
/**
* Transport Element for JingleInBandBytestream transports.

View File

@ -19,4 +19,4 @@
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0261: Jingle In-Band Bytestreams</a>.
* Element classes.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element;
package org.jivesoftware.smackx.jingle.transport.jingle_ibb.element;

View File

@ -18,4 +18,4 @@
/**
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0261: Jingle In-Band Bytestreams</a>.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb;
package org.jivesoftware.smackx.jingle.transport.jingle_ibb;

View File

@ -14,24 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.provider;
package org.jivesoftware.smackx.jingle.transport.jingle_ibb.provider;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.JingleIBBTransport;
import org.jivesoftware.smackx.jingle3.transport.jingle_ibb.element.JingleIBBTransportElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transport.jingle_ibb.JingleIBBTransport;
import org.jivesoftware.smackx.jingle.transport.jingle_ibb.element.JingleIBBTransportElement;
import org.xmlpull.v1.XmlPullParser;
/**
* Parse JingleByteStreamTransport elements.
*/
public class JingleIBBTransportProvider extends JingleContentTransportProvider <JingleIBBTransportElement> {
public class JingleIBBTransportProvider extends JingleContentTransportProvider<JingleIBBTransportElement> {
@Override
public JingleIBBTransportElement parse(XmlPullParser parser, int initialDepth) throws Exception {
Short blockSize = ParserUtils.getShortAttribute(parser, JingleIBBTransportElement.ATTR_BLOCK_SIZE);
String sid = parser.getAttributeValue(null, JingleIBBTransportElement.ATTR_SID);
return new JingleIBBTransportElement(blockSize, sid);
return new JingleIBBTransportElement(sid, blockSize);
}
@Override

View File

@ -19,4 +19,4 @@
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0261: Jingle In-Band Bytestreams</a>.
* Provider classes.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_ibb.provider;
package org.jivesoftware.smackx.jingle.transport.jingle_ibb.provider;

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_s5b;
import java.io.IOException;
import java.util.Collections;
@ -9,29 +25,30 @@ import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Utils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle3.internal.Content;
import org.jivesoftware.smackx.jingle3.internal.Transport;
import org.jivesoftware.smackx.jingle3.internal.TransportCandidate;
import org.jivesoftware.smackx.jingle3.transport.BytestreamSessionEstablishedListener;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement;
import org.jivesoftware.smackx.jingle.transport.BytestreamSessionEstablishedListener;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle.internal.Content;
import org.jivesoftware.smackx.jingle.internal.Transport;
import org.jivesoftware.smackx.jingle.internal.TransportCandidate;
import org.jxmpp.jid.FullJid;
/**
* Created by vanitas on 19.07.17.
* Jingle SOCKS5Bytestream transport component.
*/
public class JingleS5BTransport extends Transport<JingleS5BTransportElement> {
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1";
public static final String NAMESPACE = NAMESPACE_V1;
public static final int MAX_TIMEOUT = 10 * 1000;
private final String sid;
private String dstAddr;
@ -42,22 +59,25 @@ public class JingleS5BTransport extends Transport<JingleS5BTransportElement> {
/**
* Create fresh JingleS5BTransport.
* @param content parent content.
* @param initiator initiator.
* @param responder responder.
*/
public JingleS5BTransport(Content content) {
super(content);
this.sid = StringUtils.randomString(24);
this.dstAddr = Socks5Utils.createDigest(sid, content.getParent().getInitiator(), content.getParent().getResponder());
this.mode = Bytestream.Mode.tcp;
public JingleS5BTransport(FullJid initiator, FullJid responder, String sid, List<TransportCandidate<?>> candidates) {
this(sid, Socks5Utils.createDigest(sid, initiator, responder), Bytestream.Mode.tcp, candidates);
}
public JingleS5BTransport(Content content, String sid, String dstAddr, Bytestream.Mode mode, List<JingleS5BTransportCandidate> candidates) {
super(content);
public JingleS5BTransport(Content content, JingleS5BTransport other, List<TransportCandidate<?>> candidates) {
this(other.getSid(),
Socks5Utils.createDigest(other.getSid(), content.getParent().getInitiator(), content.getParent().getResponder()),
other.mode, candidates);
}
public JingleS5BTransport(String sid, String dstAddr, Bytestream.Mode mode, List<TransportCandidate<?>> candidates) {
this.sid = sid;
this.dstAddr = dstAddr;
this.mode = mode;
for (TransportCandidate<JingleS5BTransportCandidateElement> c : (candidates != null ?
for (TransportCandidate<?> c : (candidates != null ?
candidates : Collections.<JingleS5BTransportCandidate>emptySet())) {
addCandidate(c);
}
@ -77,6 +97,10 @@ public class JingleS5BTransport extends Transport<JingleS5BTransportElement> {
return builder.build();
}
public String getSid() {
return sid;
}
public String getDstAddr() {
return dstAddr;
}
@ -91,12 +115,27 @@ public class JingleS5BTransport extends Transport<JingleS5BTransportElement> {
}
@Override
public void establishIncomingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) {
Socks5Proxy.getSocks5Proxy().addTransfer(dstAddr);
public void establishIncomingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection)
throws SmackException.NotConnectedException, InterruptedException {
establishBytestreamSession(listener, connection);
}
@Override
public void establishOutgoingBytestreamSession(FullJid peer, String transportSessionId, BytestreamSessionEstablishedListener listener, XMPPConnection connection) {
public void establishOutgoingBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection)
throws SmackException.NotConnectedException, InterruptedException {
establishBytestreamSession(listener, connection);
}
void establishBytestreamSession(BytestreamSessionEstablishedListener listener, XMPPConnection connection)
throws SmackException.NotConnectedException, InterruptedException {
Socks5Proxy.getSocks5Proxy().addTransfer(dstAddr);
JingleS5BTransportManager transportManager = JingleS5BTransportManager.getInstanceFor(connection);
this.selectedCandidate = connectToCandidates(MAX_TIMEOUT);
if (selectedCandidate == null) {
connection.createStanzaCollectorAndSend(transportManager.createCandidateError(this));
}
}
@ -150,7 +189,6 @@ public class JingleS5BTransport extends Transport<JingleS5BTransportElement> {
}
Iterator<TransportCandidate<?>> ourCandidates = getCandidates().iterator();
while (ourCandidates.hasNext()) {
JingleS5BTransportCandidate candidate = (JingleS5BTransportCandidate) ourCandidates.next();
if (candidate.getCandidateId().equals(candidateId)) {

View File

@ -0,0 +1,48 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_s5b;
import java.util.ArrayList;
import org.jivesoftware.smackx.jingle.adapter.JingleTransportAdapter;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement;
/**
* Adapter for Jingle SOCKS5Bytestream components.
*/
public class JingleS5BTransportAdapter implements JingleTransportAdapter<JingleS5BTransport> {
@Override
public JingleS5BTransport transportFromElement(JingleContentTransportElement element) {
JingleS5BTransportElement s5b = (JingleS5BTransportElement) element;
ArrayList<JingleS5BTransportCandidate> candidates = new ArrayList<>();
for (JingleContentTransportCandidateElement e : element.getCandidates()) {
candidates.add(JingleS5BTransportCandidate.fromElement((JingleS5BTransportCandidateElement) e));
}
return new JingleS5BTransport(s5b.getSid(), s5b.getDestinationAddress(), s5b.getMode(), candidates);
}
@Override
public String getNamespace() {
return JingleS5BTransport.NAMESPACE;
}
}

View File

@ -1,4 +1,20 @@
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b;
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_s5b;
import java.io.IOException;
import java.net.Socket;
@ -9,12 +25,12 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Client;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5ClientForInitiator;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle3.internal.Session;
import org.jivesoftware.smackx.jingle3.internal.TransportCandidate;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.internal.Session;
import org.jivesoftware.smackx.jingle.internal.TransportCandidate;
/**
* Created by vanitas on 19.07.17.
* Jingle SOCKS5Bytestream transport candidate.
*/
public class JingleS5BTransportCandidate extends TransportCandidate<JingleS5BTransportCandidateElement> {

View File

@ -0,0 +1,280 @@
/**
*
* Copyright 2017 Paul Schaub
*
* 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.jivesoftware.smackx.jingle.transport.jingle_s5b;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager;
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.internal.Content;
import org.jivesoftware.smackx.jingle.internal.Session;
import org.jivesoftware.smackx.jingle.internal.Transport;
import org.jivesoftware.smackx.jingle.internal.TransportCandidate;
import org.jivesoftware.smackx.jingle.provider.JingleContentProviderManager;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider.JingleS5BTransportProvider;
import org.jivesoftware.smackx.jingle.JingleTransportManager;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jxmpp.jid.Jid;
/**
* Manager for Jingle SOCKS5 Bytestream transports (XEP-0261).
*/
public final class JingleS5BTransportManager extends Manager implements JingleTransportManager {
private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportManager.class.getName());
private final Socks5BytestreamManager socks5BytestreamManager = Socks5BytestreamManager.getBytestreamManager(connection());
private static final WeakHashMap<XMPPConnection, JingleS5BTransportManager> INSTANCES = new WeakHashMap<>();
private List<Bytestream.StreamHost> localStreamHosts = null;
private List<Bytestream.StreamHost> availableStreamHosts = null;
private static boolean useLocalCandidates = true;
private static boolean useExternalCandidates = true;
private JingleS5BTransportManager(XMPPConnection connection) {
super(connection);
JingleContentProviderManager.addJingleContentTransportProvider(getNamespace(), new JingleS5BTransportProvider());
connection.addConnectionListener(new ConnectionListener() {
@Override
public void connected(XMPPConnection connection) {
}
@Override
public void authenticated(XMPPConnection connection, boolean resumed) {
if (connection.equals(connection())) {
try {
Socks5Proxy socks5Proxy = Socks5Proxy.getSocks5Proxy();
if (!socks5Proxy.isRunning()) {
socks5Proxy.start();
}
localStreamHosts = queryLocalStreamHosts();
availableStreamHosts = queryAvailableStreamHosts();
} catch (InterruptedException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) {
LOGGER.log(Level.WARNING, "Could not query available StreamHosts: " + e, e);
}
}
}
@Override
public void connectionClosed() {
Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
if (proxy.isRunning()) {
Socks5Proxy.getSocks5Proxy().stop();
}
}
@Override
public void connectionClosedOnError(Exception e) {
}
@Override
public void reconnectionSuccessful() {
}
@Override
public void reconnectingIn(int seconds) {
}
@Override
public void reconnectionFailed(Exception e) {
}
});
}
public static JingleS5BTransportManager getInstanceFor(XMPPConnection connection) {
JingleS5BTransportManager manager = INSTANCES.get(connection);
if (manager == null) {
manager = new JingleS5BTransportManager(connection);
INSTANCES.put(connection, manager);
}
return manager;
}
@Override
public String getNamespace() {
return JingleS5BTransport.NAMESPACE;
}
@Override
public Transport<?> createTransport(Content content) {
Session session = content.getParent();
List<TransportCandidate<?>> candidates = collectCandidates();
return new JingleS5BTransport(session.getInitiator(), session.getResponder(), StringUtils.randomString(24), candidates);
}
@Override
public Transport<?> createTransport(Content content, Transport<?> peersTransport) {
JingleS5BTransport transport = (JingleS5BTransport) peersTransport;
List<TransportCandidate<?>> candidates = collectCandidates();
return new JingleS5BTransport(content, transport, candidates);
}
private List<TransportCandidate<?>> collectCandidates() {
List<TransportCandidate<?>> candidates = new ArrayList<>();
//Local host
if (JingleS5BTransportManager.isUseLocalCandidates()) {
for (Bytestream.StreamHost host : getLocalStreamHosts()) {
candidates.add(new JingleS5BTransportCandidate(StringUtils.randomString(16), host, 100, JingleS5BTransportCandidateElement.Type.direct));
}
}
List<Bytestream.StreamHost> remoteHosts = Collections.emptyList();
if (JingleS5BTransportManager.isUseExternalCandidates()) {
try {
remoteHosts = getAvailableStreamHosts();
} catch (InterruptedException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | SmackException.NoResponseException e) {
LOGGER.log(Level.WARNING, "Could not determine available StreamHosts.", e);
}
}
for (Bytestream.StreamHost host : remoteHosts) {
candidates.add(new JingleS5BTransportCandidate(StringUtils.randomString(16), host, 0, JingleS5BTransportCandidateElement.Type.proxy));
}
return candidates;
}
private List<Bytestream.StreamHost> queryAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
List<Jid> proxies = socks5BytestreamManager.determineProxies();
return determineStreamHostInfo(proxies);
}
private List<Bytestream.StreamHost> queryLocalStreamHosts() {
return socks5BytestreamManager.getLocalStreamHost();
}
public List<Bytestream.StreamHost> getAvailableStreamHosts() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
if (availableStreamHosts == null) {
availableStreamHosts = queryAvailableStreamHosts();
}
return availableStreamHosts;
}
public List<Bytestream.StreamHost> getLocalStreamHosts() {
if (localStreamHosts == null) {
localStreamHosts = queryLocalStreamHosts();
}
return localStreamHosts;
}
public List<Bytestream.StreamHost> determineStreamHostInfo(List<Jid> proxies) {
List<Bytestream.StreamHost> streamHosts = new ArrayList<>();
Iterator<Jid> iterator = proxies.iterator();
while (iterator.hasNext()) {
Jid proxy = iterator.next();
Bytestream request = new Bytestream();
request.setType(IQ.Type.get);
request.setTo(proxy);
try {
Bytestream response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
streamHosts.addAll(response.getStreamHosts());
}
catch (Exception e) {
iterator.remove();
}
}
return streamHosts;
}
private JingleElement createTransportInfo(JingleS5BTransport transport, JingleS5BTransportInfoElement info) {
Content content = transport.getParent();
Session session = content.getParent();
JingleElement.Builder jb = JingleElement.getBuilder()
.setSessionId(session.getSessionId())
.setInitiator(session.getInitiator())
.setAction(JingleAction.transport_info);
JingleContentElement.Builder cb = JingleContentElement.getBuilder()
.setCreator(content.getCreator())
.setName(content.getName())
.setSenders(content.getSenders());
JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder()
.setTransportInfo(info)
.setStreamId(transport.getSid());
JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
jingle.setFrom(session.getOurJid());
jingle.setTo(session.getPeer());
return jingle;
}
JingleElement createCandidateUsed(JingleS5BTransport transport, JingleS5BTransportCandidate candidate) {
return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateUsed(candidate.getCandidateId()));
}
JingleElement createCandidateError(JingleS5BTransport transport) {
return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateError());
}
JingleElement createProxyError(JingleS5BTransport transport) {
return createTransportInfo(transport, JingleS5BTransportInfoElement.ProxyError());
}
JingleElement createCandidateActivated(JingleS5BTransport transport, JingleS5BTransportCandidate candidate) {
return createTransportInfo(transport, JingleS5BTransportInfoElement.CandidateActivated(candidate.getCandidateId()));
}
public static void setUseLocalCandidates(boolean localCandidates) {
JingleS5BTransportManager.useLocalCandidates = localCandidates;
}
public static void setUseExternalCandidates(boolean externalCandidates) {
JingleS5BTransportManager.useExternalCandidates = externalCandidates;
}
public static boolean isUseLocalCandidates() {
return useLocalCandidates;
}
public static boolean isUseExternalCandidates() {
return useExternalCandidates;
}
@Override
public int compareTo(JingleTransportManager manager) {
return 0;
}
}

View File

@ -14,15 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements;
import java.util.logging.Logger;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate;
@ -33,8 +31,6 @@ import org.jxmpp.stringprep.XmppStringprepException;
*/
public final class JingleS5BTransportCandidateElement extends JingleContentTransportCandidateElement {
private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportCandidateElement.class.getName());
public static final String ATTR_CID = "cid";
public static final String ATTR_HOST = "host";
public static final String ATTR_JID = "jid";

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element;
import java.util.ArrayList;
import java.util.List;
@ -22,15 +22,15 @@ import java.util.List;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransport;
/**
* Socks5Bytestream transport element.
*/
public class JingleS5BTransportElement extends JingleContentTransportElement {
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1";
public static final String ATTR_DSTADDR = "dstaddr";
public static final String ATTR_MODE = "mode";
public static final String ATTR_SID = "sid";
@ -61,7 +61,7 @@ public class JingleS5BTransportElement extends JingleContentTransportElement {
@Override
public String getNamespace() {
return NAMESPACE_V1;
return JingleS5BTransport.NAMESPACE;
}
@Override
@ -132,22 +132,6 @@ public class JingleS5BTransportElement extends JingleContentTransportElement {
return this;
}
public Builder setCandidateUsed(String candidateId) {
return setTransportInfo(JingleS5BTransportInfoElement.CandidateUsed(candidateId));
}
public Builder setCandidateActivated(String candidateId) {
return setTransportInfo(JingleS5BTransportInfoElement.CandidateActivated(candidateId));
}
public Builder setCandidateError() {
return setTransportInfo(JingleS5BTransportInfoElement.CandidateError());
}
public Builder setProxyError() {
return setTransportInfo(JingleS5BTransportInfoElement.ProxyError());
}
public JingleS5BTransportElement build() {
return new JingleS5BTransportElement(streamId, candidates, info, dstAddr, mode);
}

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportInfoElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfoElement;
/**
* Class representing possible SOCKS5 TransportInfo elements.

View File

@ -19,4 +19,4 @@
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0260: Jingle SOCKS5 Bytestreams</a>.
* Element classes.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.element;

View File

@ -18,4 +18,4 @@
/**
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0260: Jingle SOCKS5 Bytestreams</a>.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b;

View File

@ -14,24 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider;
import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.tcp;
import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.udp;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_CID;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_HOST;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_JID;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_PORT;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_PRIORITY;
import static org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement.ATTR_TYPE;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_CID;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_HOST;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_JID;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_PORT;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_PRIORITY;
import static org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement.ATTR_TYPE;
import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.START_TAG;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransport;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement;
import org.xmlpull.v1.XmlPullParser;
@ -115,4 +116,9 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
}
return builder.build();
}
@Override
public String getNamespace() {
return JingleS5BTransport.NAMESPACE;
}
}

View File

@ -19,4 +19,4 @@
* Smack's API for <a href="https://xmpp.org/extensions/xep-0261.html">XEP-0260: Jingle SOCKS5 Bytestreams</a>.
* Provider classes.
*/
package org.jivesoftware.smackx.jingle3.transport.jingle_s5b.provider;
package org.jivesoftware.smackx.jingle.transport.jingle_s5b.provider;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle3.transport.legacy;
package org.jivesoftware.smackx.jingle.transport.legacy;
import java.io.IOException;
import java.net.Socket;
@ -35,14 +35,14 @@ import org.jivesoftware.smackx.bytestreams.socks5.Socks5Utils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.jingle.transports.JingleTransportInitiationCallback;
import org.jivesoftware.smackx.jingle.transports.JingleTransportSession;
import org.jivesoftware.smackx.jingle3.JingleManager;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTransportInfoElement;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidateElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.JingleS5BTransportManager;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportCandidateElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportElement;
import org.jivesoftware.smackx.jingle.transport.jingle_s5b.element.JingleS5BTransportInfoElement;
/**
* Handler that handles Jingle Socks5Bytestream transports (XEP-0260).
@ -50,27 +50,6 @@ import org.jivesoftware.smackx.jingle3.transport.jingle_s5b.elements.JingleS5BTr
public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BTransportElement> {
private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportSession.class.getName());
private JingleTransportInitiationCallback callback;
public JingleS5BTransportSession(JingleSession jingleSession) {
super(jingleSession);
}
private UsedCandidate ourChoice, theirChoice;
@Override
public JingleS5BTransportElement createTransport() {
if (ourProposal == null) {
ourProposal = createTransport(JingleManager.randomId(), Bytestream.Mode.tcp);
}
return ourProposal;
}
@Override
public void setTheirProposal(JingleContentTransportElement transport) {
theirProposal = (JingleS5BTransportElement) transport;
}
public JingleS5BTransportElement createTransport(String sid, Bytestream.Mode mode) {
JingleS5BTransportElement.Builder jb = JingleS5BTransportElement.getBuilder()
.setStreamId(sid).setMode(mode).setDestinationAddress(
@ -339,22 +318,4 @@ public class JingleS5BTransportSession extends JingleTransportSession<JingleS5BT
}
}
@Override
public JingleS5BTransportManager transportManager() {
return JingleS5BTransportManager.getInstanceFor(jingleSession.getConnection());
}
private static class UsedCandidate {
private final Socket socket;
private final JingleS5BTransportElement transport;
private final JingleS5BTransportCandidateElement candidate;
public UsedCandidate(JingleS5BTransportElement transport, JingleS5BTransportCandidateElement candidate, Socket socket) {
this.socket = socket;
this.transport = transport;
this.candidate = candidate;
}
}
private static final UsedCandidate CANDIDATE_FAILURE = new UsedCandidate(null, null, null);
}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.jingle;
package org.jivesoftware.smackx.jingle.transport.legacy;
import java.util.Collections;
import java.util.List;
@ -22,12 +22,12 @@ import java.util.List;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
import org.jivesoftware.smackx.jingle3.element.JingleContentElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleErrorElement;
import org.jivesoftware.smackx.jingle3.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle.element.JingleElement;
import org.jivesoftware.smackx.jingle.element.JingleErrorElement;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.jivesoftware.smackx.jingle.element.JingleAction;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jxmpp.jid.FullJid;

View File

@ -1,15 +0,0 @@
package org.jivesoftware.smackx.jingle3;
import org.jivesoftware.smackx.jingle3.internal.Content;
/**
* Created by vanitas on 18.07.17.
*/
public abstract class Callback {
private final Content content;
public Callback(Content content) {
this.content = content;
}
}

View File

@ -1,15 +0,0 @@
package org.jivesoftware.smackx.jingle3;
import org.jivesoftware.smackx.jingle3.callbacks.ContentAddCallback;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.internal.Content;
/**
* Created by vanitas on 19.07.17.
*/
public interface JingleDescriptionManager {
String getNamespace();
JingleElement notifyContentListeners(Content content, ContentAddCallback callback);
}

View File

@ -1,9 +0,0 @@
package org.jivesoftware.smackx.jingle3;
/**
* Created by vanitas on 19.07.17.
*/
public interface JingleSecurityManager {
String getNamespace();
}

View File

@ -1,10 +0,0 @@
package org.jivesoftware.smackx.jingle3;
import org.jivesoftware.smackx.jingle3.internal.Session;
/**
* Created by vanitas on 19.07.17.
*/
public interface JingleSessionInitiateListener {
void onJingleSessionInitiate(Session session);
}

View File

@ -1,9 +0,0 @@
package org.jivesoftware.smackx.jingle3;
/**
* Created by vanitas on 19.07.17.
*/
public interface JingleTransportManager extends Comparable<JingleTransportManager> {
String getNamespace();
}

View File

@ -1,14 +0,0 @@
package org.jivesoftware.smackx.jingle3.adapter;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
import org.jivesoftware.smackx.jingle3.internal.Description;
/**
* Created by vanitas on 18.07.17.
*/
public interface JingleDescriptionAdapter<D extends Description<?>> {
D descriptionFromElement(JingleContentDescriptionElement element);
String getNamespace();
}

View File

@ -1,14 +0,0 @@
package org.jivesoftware.smackx.jingle3.adapter;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle3.internal.Security;
/**
* Created by vanitas on 18.07.17.
*/
public interface JingleSecurityAdapter<S extends Security<?>> {
S securityFromElement(JingleContentSecurityElement element);
String getNamespace();
}

View File

@ -1,14 +0,0 @@
package org.jivesoftware.smackx.jingle3.adapter;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportElement;
import org.jivesoftware.smackx.jingle3.internal.Transport;
/**
* Created by vanitas on 18.07.17.
*/
public interface JingleTransportAdapter<T extends Transport<?>> {
T transportFromElement(JingleContentTransportElement element);
String getNamespace();
}

View File

@ -1,11 +0,0 @@
package org.jivesoftware.smackx.jingle3.callbacks;
/**
* Created by vanitas on 19.07.17.
*/
public interface ContentAddCallback {
void acceptContentAdd();
void rejectContentAdd();
}

View File

@ -1,19 +0,0 @@
package org.jivesoftware.smackx.jingle3.exception;
/**
* Created by vanitas on 18.07.17.
*/
public class UnsupportedDescriptionException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedDescriptionException(String namespace) {
super("Description with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -1,19 +0,0 @@
package org.jivesoftware.smackx.jingle3.exception;
/**
* Created by vanitas on 18.07.17.
*/
public class UnsupportedSecurityException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedSecurityException(String namespace) {
super("Security with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -1,19 +0,0 @@
package org.jivesoftware.smackx.jingle3.exception;
/**
* Created by vanitas on 18.07.17.
*/
public class UnsupportedTransportException extends Exception {
private static final long serialVersionUID = 1L;
private final String namespace;
public UnsupportedTransportException(String namespace) {
super("Transport with namespace " + namespace + " not supported.");
this.namespace = namespace;
}
public String getNamespace() {
return namespace;
}
}

View File

@ -1,23 +0,0 @@
package org.jivesoftware.smackx.jingle3.internal;
import org.jivesoftware.smackx.jingle3.element.JingleContentDescriptionElement;
/**
* Created by vanitas on 18.07.17.
*/
public abstract class Description<D extends JingleContentDescriptionElement> {
private Content parent;
public abstract D getElement();
public void setParent(Content parent) {
if (this.parent != parent) {
this.parent = parent;
}
}
public Content getParent() {
return parent;
}
}

View File

@ -1,37 +0,0 @@
package org.jivesoftware.smackx.jingle3.internal;
import org.jivesoftware.smackx.jingle3.element.JingleAction;
/**
* Created by vanitas on 19.07.17.
*/
public abstract class PendingJingleAction {
private final JingleAction action;
private final Content affectedContent;
public PendingJingleAction(JingleAction action, Content content) {
this.action = action;
this.affectedContent = content;
}
public JingleAction getAction() {
return action;
}
public Content getAffectedContent() {
return affectedContent;
}
public static class TransportReplace extends PendingJingleAction {
private final Transport<?> newTransport;
public TransportReplace(Content content, Transport<?> newTransport) {
super(JingleAction.transport_replace, content);
this.newTransport = newTransport;
}
public Transport<?> getNewTransport() {
return newTransport;
}
}
}

View File

@ -1,27 +0,0 @@
package org.jivesoftware.smackx.jingle3.internal;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityElement;
import org.jivesoftware.smackx.jingle3.element.JingleElement;
import org.jivesoftware.smackx.jingle3.element.JingleContentSecurityInfoElement;
/**
* Created by vanitas on 18.07.17.
*/
public abstract class Security<D extends JingleContentSecurityElement> {
private Content parent;
public abstract D getElement();
public abstract JingleElement handleSecurityInfo(JingleContentSecurityInfoElement element);
public void setParent(Content parent) {
if (this.parent != parent) {
this.parent = parent;
}
}
public Content getParent() {
return parent;
}
}

View File

@ -1,32 +0,0 @@
package org.jivesoftware.smackx.jingle3.internal;
import org.jivesoftware.smackx.jingle3.element.JingleContentTransportCandidateElement;
/**
* Created by vanitas on 21.07.17.
*/
public abstract class TransportCandidate<E extends JingleContentTransportCandidateElement> {
private Transport<?> parent;
private int priority;
public void setParent(Transport<?> transport) {
if (parent != transport) {
parent = transport;
}
}
public Transport<?> getParent() {
return parent;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public abstract E getElement();
}

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