Class InboundHandshake

java.lang.Object
org.red5.server.net.rtmp.RTMPHandshake
org.red5.server.net.rtmp.InboundHandshake
All Implemented Interfaces:
IHandshake

public class InboundHandshake extends RTMPHandshake
Performs handshaking for server connections.
Author:
Paul Gregoire
  • Field Details

    • s1

      private byte[] s1
    • c1

      private byte[] c1
    • digestPosServer

      private int digestPosServer
    • unvalidatedConnectionAllowed

      private boolean unvalidatedConnectionAllowed
  • Constructor Details

    • InboundHandshake

      public InboundHandshake()
    • InboundHandshake

      public InboundHandshake(byte handshakeType)
    • InboundHandshake

      public InboundHandshake(byte handshakeType, int algorithm)
  • Method Details

    • doHandshake

      public org.apache.mina.core.buffer.IoBuffer doHandshake(org.apache.mina.core.buffer.IoBuffer in)
      Generates response for versioned connections.
      Parameters:
      in - incoming RTMP handshake bytes
      Returns:
      outgoing handshake
    • decodeClientRequest1

      public org.apache.mina.core.buffer.IoBuffer decodeClientRequest1(org.apache.mina.core.buffer.IoBuffer in)
      Decodes the first client request (C1) and returns a server response (S0S1).
       C1 = 1536 bytes from the client
       S0 = 0x03 (server handshake type - 0x03, 0x06, 0x08, or 0x09)
       S1 = 1536 bytes from server
       
      Parameters:
      in - incoming handshake C1
      Returns:
      server response S0+S1
    • decodeClientRequest2

      public boolean decodeClientRequest2(org.apache.mina.core.buffer.IoBuffer in)
      Decodes the second client request (C2) and returns a server response (S2).
       C2 = Copy of S1 bytes
       S2 = Copy of C1 bytes
       
      Parameters:
      in - incoming handshake C2
      Returns:
      true if C2 was processed successfully and false otherwise
    • generateUnversionedHandshake

      private org.apache.mina.core.buffer.IoBuffer generateUnversionedHandshake(byte[] input)
      Generates response for non-versioned connections, such as those before FP9.
      Parameters:
      input - incoming RTMP bytes
      Returns:
      outgoing handshake
    • createHandshakeBytes

      protected void createHandshakeBytes()
      Creates the servers handshake bytes
      Specified by:
      createHandshakeBytes in class RTMPHandshake
    • validate

      public boolean validate(byte[] handshake)
      Determines the validation scheme for given input.
      Specified by:
      validate in interface IHandshake
      Specified by:
      validate in class RTMPHandshake
      Parameters:
      handshake - handshake bytes from the client
      Returns:
      true if client used a supported validation scheme, false if unsupported
    • validateScheme

      private boolean validateScheme(byte[] handshake, int scheme)
    • setHandshakeBytes

      public void setHandshakeBytes(byte[] handshake)
    • getHandshakeBytes

      public byte[] getHandshakeBytes()
    • setUnvalidatedConnectionAllowed

      public void setUnvalidatedConnectionAllowed(boolean unvalidatedConnectionAllowed)