java.lang.Object
org.jivesoftware.smack.packet.Stanza
org.jivesoftware.smack.packet.IQ
org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream
All Implemented Interfaces:
org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.IqView, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.StanzaView, org.jivesoftware.smack.packet.TopLevelStreamElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement

public class Bytestream extends org.jivesoftware.smack.packet.IQ
A stanza representing part of a SOCKS5 Bytestream negotiation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The stanza sent by the stream initiator to the stream proxy to activate the connection.
    static enum 
    The stream can be either a TCP stream or a UDP stream.
    static class 
    Stanza extension that represents a potential SOCKS5 proxy for the file transfer.
    static class 
    After selected a SOCKS5 stream host and successfully connecting, the target of the file transfer returns a byte stream stanza with the stream host used extension.

    Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ

    org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder, org.jivesoftware.smack.packet.IQ.ResponseType, org.jivesoftware.smack.packet.IQ.Type
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    The XMPP namespace of the SOCKS5 Bytestream.

    Fields inherited from class org.jivesoftware.smack.packet.IQ

    IQ_ELEMENT, QUERY_ELEMENT

    Fields inherited from class org.jivesoftware.smack.packet.Stanza

    DEFAULT_LANGUAGE, ITEM, language, TEXT
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor.
    A constructor where the session ID can be specified.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a potential stream host that the remote user can transfer the file through.
    addStreamHost(org.jxmpp.jid.Jid JID, String address)
    Adds a potential stream host that the remote user can connect to to receive the file.
    addStreamHost(org.jxmpp.jid.Jid JID, String address, int port)
    Adds a potential stream host that the remote user can connect to to receive the file.
    int
    Returns the count of stream hosts contained in this packet.
    protected org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder
    getIQChildElementBuilder(org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder xml)
     
    Returns the transport mode.
    Returns the session ID related to the bytestream negotiation.
    getStreamHost(org.jxmpp.jid.Jid JID)
    Returns the stream host related to the given JID, or null if there is none.
    Returns the list of stream hosts contained in the packet.
    Returns the activate element of the stanza sent to the proxy host to verify the identity of the initiator and match them to the appropriate stream.
    Returns the SOCKS5 host connected to by the remote user.
    void
    Set the transport mode.
    void
    setSessionID(String sessionID)
    Set the session ID related to the bytestream.
    void
    setToActivate(org.jxmpp.jid.Jid targetID)
    Upon the response from the target of the used host the activate stanza is sent to the SOCKS5 proxy.
    void
    setUsedHost(org.jxmpp.jid.Jid JID)
    Upon connecting to the stream host the target of the stream replies to the initiator with the JID of the SOCKS5 host that they used.

    Methods inherited from class org.jivesoftware.smack.packet.IQ

    createErrorResponse, createErrorResponse, createResultIQ, getChildElementName, getChildElementNamespace, getChildElementQName, getChildElementXML, getElementName, getType, setType, toString, toXML

    Methods inherited from class org.jivesoftware.smack.packet.Stanza

    addCommonAttributes, addExtension, addExtensions, appendErrorIfExists, getDefaultLanguage, getError, getExtension, getExtension, getExtensionElement, getExtensions, getExtensions, getExtensions, getExtensions, getExtensionsMap, getFrom, getLanguage, getNamespace, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, logCommonAttributes, overrideExtension, removeExtension, setError, setFrom, setNewStanzaId, setStanzaId, setTo, throwIfNoStanzaId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.jivesoftware.smack.packet.Element

    toXML, toXML

    Methods inherited from interface org.jivesoftware.smack.packet.IqView

    isRequestIQ, isResponseIQ

    Methods inherited from interface org.jivesoftware.smack.packet.StanzaView

    getError, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getStanzaId, getTo, hasExtension, hasExtension, hasExtension

    Methods inherited from interface org.jivesoftware.smack.packet.XmlElement

    getQName
  • Field Details

  • Constructor Details

    • Bytestream

      public Bytestream()
      The default constructor.
    • Bytestream

      public Bytestream(String SID)
      A constructor where the session ID can be specified.
      Parameters:
      SID - The session ID related to the negotiation.
      See Also:
  • Method Details

    • setSessionID

      public void setSessionID(String sessionID)
      Set the session ID related to the bytestream. The session ID is a unique identifier used to differentiate between stream negotiations.
      Parameters:
      sessionID - the unique session ID that identifies the transfer.
    • getSessionID

      public String getSessionID()
      Returns the session ID related to the bytestream negotiation.
      Returns:
      Returns the session ID related to the bytestream negotiation.
      See Also:
    • setMode

      public void setMode(Bytestream.Mode mode)
      Set the transport mode. This should be put in the initiation of the interaction.
      Parameters:
      mode - the transport mode, either UDP or TCP
      See Also:
    • getMode

      public Bytestream.Mode getMode()
      Returns the transport mode.
      Returns:
      Returns the transport mode.
      See Also:
    • addStreamHost

      public Bytestream.StreamHost addStreamHost(org.jxmpp.jid.Jid JID, String address)
      Adds a potential stream host that the remote user can connect to to receive the file.
      Parameters:
      JID - The JID of the stream host.
      address - The internet address of the stream host.
      Returns:
      The added stream host.
    • addStreamHost

      public Bytestream.StreamHost addStreamHost(org.jxmpp.jid.Jid JID, String address, int port)
      Adds a potential stream host that the remote user can connect to to receive the file.
      Parameters:
      JID - The JID of the stream host.
      address - The internet address of the stream host.
      port - The port on which the remote host is seeking connections.
      Returns:
      The added stream host.
    • addStreamHost

      public void addStreamHost(Bytestream.StreamHost host)
      Adds a potential stream host that the remote user can transfer the file through.
      Parameters:
      host - The potential stream host.
    • getStreamHosts

      public List<Bytestream.StreamHost> getStreamHosts()
      Returns the list of stream hosts contained in the packet.
      Returns:
      Returns the list of stream hosts contained in the packet.
    • getStreamHost

      public Bytestream.StreamHost getStreamHost(org.jxmpp.jid.Jid JID)
      Returns the stream host related to the given JID, or null if there is none.
      Parameters:
      JID - The JID of the desired stream host.
      Returns:
      Returns the stream host related to the given JID, or null if there is none.
    • countStreamHosts

      public int countStreamHosts()
      Returns the count of stream hosts contained in this packet.
      Returns:
      Returns the count of stream hosts contained in this packet.
    • setUsedHost

      public void setUsedHost(org.jxmpp.jid.Jid JID)
      Upon connecting to the stream host the target of the stream replies to the initiator with the JID of the SOCKS5 host that they used.
      Parameters:
      JID - The JID of the used host.
    • getUsedHost

      public Bytestream.StreamHostUsed getUsedHost()
      Returns the SOCKS5 host connected to by the remote user.
      Returns:
      Returns the SOCKS5 host connected to by the remote user.
    • getToActivate

      public Bytestream.Activate getToActivate()
      Returns the activate element of the stanza sent to the proxy host to verify the identity of the initiator and match them to the appropriate stream.
      Returns:
      Returns the activate element of the stanza sent to the proxy host to verify the identity of the initiator and match them to the appropriate stream.
    • setToActivate

      public void setToActivate(org.jxmpp.jid.Jid targetID)
      Upon the response from the target of the used host the activate stanza is sent to the SOCKS5 proxy. The proxy will activate the stream or return an error after verifying the identity of the initiator, using the activate packet.
      Parameters:
      targetID - The JID of the target of the file transfer.
    • getIQChildElementBuilder

      protected org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder xml)
      Specified by:
      getIQChildElementBuilder in class org.jivesoftware.smack.packet.IQ