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

public class Bytestream extends IQ
A stanza representing part of a SOCKS5 Bytestream negotiation.
  • 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

      Returns the transport mode.
      Returns:
      Returns the transport mode.
      See Also:
    • addStreamHost

      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(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

      Adds a potential stream host that the remote user can transfer the file through.
      Parameters:
      host - The potential stream host.
    • getStreamHosts

      Returns the list of stream hosts contained in the packet.
      Returns:
      Returns the list of stream hosts contained in the packet.
    • getStreamHost

      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(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

      Returns the SOCKS5 host connected to by the remote user.
      Returns:
      Returns the SOCKS5 host connected to by the remote user.
    • 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(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

      Description copied from class: IQ
      This method must be overwritten by IQ subclasses to create their child content. It is important you don't use the builder to add the final end tag. This will be done automatically by IQ.IQChildElementXmlStringBuilder after eventual existing ExtensionElements have been added.

      For example to create an IQ with a extra attribute and an additional child element

       
       <iq to='foo@example.org' id='123'>
         <bar xmlns='example:bar' extraAttribute='blaz'>
            <extraElement>elementText</extraElement>
         </bar>
       </iq>
       
       
      the body of the getIQChildElementBuilder looks like
       
       // The builder 'xml' will already have the child element and the 'xmlns' attribute added
       // So the current builder state is "<bar xmlns='example:bar'"
       xml.attribute("extraAttribute", "blaz");
       xml.rightAngleBracket();
       xml.element("extraElement", "elementText");
       // Do not close the 'bar' attribute by calling xml.closeElement('bar')
       
       
      If your IQ only contains attributes and no child elements, i.e. it can be represented as empty element, then you can mark it as such.
       xml.attribute("myAttribute", "myAttributeValue");
       xml.setEmptyElement();
       
      If your IQ does not contain any attributes or child elements (besides ExtensionElements), consider sub-classing SimpleIQ instead.
      Specified by:
      getIQChildElementBuilder in class IQ
      Parameters:
      xml - a pre-created builder which already has the child element and the 'xmlns' attribute set.
      Returns:
      the build to create the IQ child content.