## org.red5.server.net.rtmp.codec
Class RTMP

    java.lang.Object
      org.red5.server.net.protocol.ProtocolState
          org.red5.server.net.rtmp.codec.RTMP

    public class RTMP

extends ProtocolState

RTMP is the RTMP protocol state representation.

Field Summary
`static int` `DEFAULT_CHUNK_SIZE` Default chunk size.
`static boolean` `MODE_CLIENT` Client mode.
`static boolean` `MODE_SERVER` Server mode.
`static byte` `STATE_CONNECT` Connect state.
`static byte` `STATE_CONNECTED` Connected.
`static byte` `STATE_DISCONNECTED` Disconnected.
`static byte` `STATE_EDGE_CONNECT_ORIGIN_SENT` Sent the connect message to origin.
`static byte` `STATE_EDGE_DISCONNECTING` Edge is disconnecting, waiting Origin close connection.
`static byte` `STATE_ERROR` Error.
`static byte` `STATE_HANDSHAKE` Handshake state.
`static byte` `STATE_ORIGIN_CONNECT_FORWARDED` Forwarded client's connect call to origin.

Fields inherited from class org.red5.server.net.protocol.ProtocolState
`DECODER_BUFFER, DECODER_CONTINUE, DECODER_OK, SESSION_KEY`

Constructor Summary
`RTMP(boolean mode)` Creates RTMP object with initial mode.

Method Summary
`IConnection.Encoding` `getEncoding()` Getter for encoding version.
`Integer` `getLastFullTimestampWritten(int channelId)`
`int` `getLastReadChannel()` Return channel being read last.
`Header` `getLastReadHeader(int channelId)` Return last read header for channel.
`Packet` `getLastReadPacket(int channelId)` Return last read packet for channel.
`Header` `getLastReadPacketHeader(int channelId)`
`int` `getLastWriteChannel()` Getter for channel being written last.
`Header` `getLastWriteHeader(int channelId)` Return last written header for channel.
`Packet` `getLastWritePacket(int channelId)` Return packet that has been written last.
`boolean` `getMode()` Return current mode.
`int` `getReadChunkSize()` Getter for write chunk size.
`byte` `getState()` Return current state.
`int` `getWriteChunkSize()` Getter for write chunk size.
`boolean` `isDebug()` Getter for debug.
`void` `setDebug(boolean debug)` Setter for debug.
`void` `setEncoding(IConnection.Encoding encoding)` Setter for encoding version.
`void` `setHandshake(IoBuffer data, int start, int length)` Store the handshake sent to the client.
`void` `setLastFullTimestampWritten(int channelId, int timer)`
`void` `setLastReadHeader(int channelId, Header header)` Setter for last read header.
`void` `setLastReadPacket(int channelId, Packet packet)` Setter for last read packet.
`void` `setLastReadPacketHeader(int channelId, Header header)`
`void` `setLastWriteHeader(int channelId, Header header)` Setter for last written header.
`void` `setLastWritePacket(int channelId, Packet packet)` Setter for last written packet.
`void` `setReadChunkSize(int readChunkSize)` Setter for read chunk size.
`void` `setState(byte state)` Setter for state.
`void` `setWriteChunkSize(int writeChunkSize)` Setter for write chunk size.
`String` `toString()`
`boolean` `validateHandshakeReply(IoBuffer data, int start, int length)` Check if the handshake reply received from a client contains valid data.

Methods inherited from class org.red5.server.net.protocol.ProtocolState
`bufferDecoding, canContinueDecoding, canStartDecoding, continueDecoding, getDecoderBufferAmount, hasDecodedObject, startDecoding`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### STATE_CONNECT

    public static final byte STATE_CONNECT

  Connect state.

  See Also:
    Constant Field Values

### STATE_HANDSHAKE

    public static final byte STATE_HANDSHAKE

  Handshake state. Server sends handshake request to client right after connection estabilished.

  See Also:
    Constant Field Values

### STATE_CONNECTED

    public static final byte STATE_CONNECTED

  Connected.

  See Also:
    Constant Field Values

### STATE_ERROR

    public static final byte STATE_ERROR

  Error.

  See Also:
    Constant Field Values

### STATE_DISCONNECTED

    public static final byte STATE_DISCONNECTED

  Disconnected.

  See Also:
    Constant Field Values

### STATE_EDGE_CONNECT_ORIGIN_SENT

    public static final byte STATE_EDGE_CONNECT_ORIGIN_SENT

  Sent the connect message to origin.

  See Also:
    Constant Field Values

### STATE_ORIGIN_CONNECT_FORWARDED

    public static final byte STATE_ORIGIN_CONNECT_FORWARDED

  Forwarded client's connect call to origin.

  See Also:
    Constant Field Values

### STATE_EDGE_DISCONNECTING

    public static final byte STATE_EDGE_DISCONNECTING

  Edge is disconnecting, waiting Origin close connection.

  See Also:
    Constant Field Values

### MODE_CLIENT

    public static final boolean MODE_CLIENT

  Client mode.

  See Also:
    Constant Field Values

### MODE_SERVER

    public static final boolean MODE_SERVER

  Server mode.

  See Also:
    Constant Field Values

### DEFAULT_CHUNK_SIZE

    public static final int DEFAULT_CHUNK_SIZE

  Default chunk size. Packets are read and written chunk-by-chunk.

  See Also:
    Constant Field Values

Constructor Detail

### RTMP

    public RTMP(boolean mode)

  Creates RTMP object with initial mode.

  Parameters:
    `mode` - Initial mode

Method Detail

### getMode

    public boolean getMode()

  Return current mode.

  Returns:
    Current mode

### isDebug

    public boolean isDebug()

  Getter for debug.

  Returns:
    Debug state

### setDebug

    public void setDebug(boolean debug)

  Setter for debug.

  Parameters:
    `debug` - Debug flag new value

### getState

    public byte getState()

  Return current state.

  Returns:
    State

### setState

    public void setState(byte state)

  Setter for state.

  Parameters:
    `state` - New state

### setLastReadHeader

    public void setLastReadHeader(int channelId,
                                  Header header)

  Setter for last read header.

  Parameters:
    `channelId` - Channel id
    `header` - Header

### getLastReadHeader

    public Header getLastReadHeader(int channelId)

  Return last read header for channel.

  Parameters:
    `channelId` - Channel id
  Returns:
    Last read header

### setLastWriteHeader

    public void setLastWriteHeader(int channelId,
                                   Header header)

  Setter for last written header.

  Parameters:
    `channelId` - Channel id
    `header` - Header

### getLastWriteHeader

    public Header getLastWriteHeader(int channelId)

  Return last written header for channel.

  Parameters:
    `channelId` - Channel id
  Returns:
    Last written header

### setLastReadPacket

    public void setLastReadPacket(int channelId,
                                  Packet packet)

  Setter for last read packet.

  Parameters:
    `channelId` - Channel id
    `packet` - Packet

### getLastReadPacket

    public Packet getLastReadPacket(int channelId)

  Return last read packet for channel.

  Parameters:
    `channelId` - Channel id
  Returns:
    Last read packet for that channel

### setLastWritePacket

    public void setLastWritePacket(int channelId,
                                   Packet packet)

  Setter for last written packet.

  Parameters:
    `channelId` - Channel id
    `packet` - Last written packet

### getLastWritePacket

    public Packet getLastWritePacket(int channelId)

  Return packet that has been written last.

  Parameters:
    `channelId` - Channel id
  Returns:
    Packet that has been written last

### getLastReadChannel

    public int getLastReadChannel()

  Return channel being read last.

  Returns:
    Last read channel

### getLastWriteChannel

    public int getLastWriteChannel()

  Getter for channel being written last.

  Returns:
    Last write channel

### getReadChunkSize

    public int getReadChunkSize()

  Getter for write chunk size. Data is being read chunk-by-chunk.

  Returns:
    Read chunk size

### setReadChunkSize

    public void setReadChunkSize(int readChunkSize)

  Setter for read chunk size. Data is being read chunk-by-chunk.

  Parameters:
    `readChunkSize` - Value to set for property 'readChunkSize'.

### getWriteChunkSize

    public int getWriteChunkSize()

  Getter for write chunk size. Data is being written chunk-by-chunk.

  Returns:
    Write chunk size

### setWriteChunkSize

    public void setWriteChunkSize(int writeChunkSize)

  Setter for write chunk size.

  Parameters:
    `writeChunkSize` - Write chunk size

### getEncoding

    public IConnection.Encoding getEncoding()

  Getter for encoding version.

  Returns:
    Encoding version

### setEncoding

    public void setEncoding(IConnection.Encoding encoding)

  Setter for encoding version.

  Parameters:
    `encoding` - Encoding version

### setHandshake

    public void setHandshake(IoBuffer data,
                             int start,
                             int length)

  Store the handshake sent to the client.

  Parameters:
    `data` - Handshake data
    `start` - where handshake data starts in data
    `length` - Length of handshake to store

### validateHandshakeReply

    public boolean validateHandshakeReply(IoBuffer data,
                                          int start,
                                          int length)

  Check if the handshake reply received from a client contains valid data.

  Parameters:
    `data` - data
    `start` - where handshake data starts in data
    `length` - length
  Returns:
    true on success; false otherwise

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### setLastFullTimestampWritten

    public void setLastFullTimestampWritten(int channelId,
                                            int timer)

### getLastFullTimestampWritten

    public Integer getLastFullTimestampWritten(int channelId)

### setLastReadPacketHeader

    public void setLastReadPacketHeader(int channelId,
                                        Header header)

### getLastReadPacketHeader

    public Header getLastReadPacketHeader(int channelId)

Copyright © 2006-2010 The Red5 Project