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

Fields
`static int` `DEFAULT_CHUNK_SIZE` Default chunk size.
`static byte` `STATE_CONNECT` Connect state.
`static byte` `STATE_CONNECTED` Connected.
`static byte` `STATE_DISCONNECTED` Disconnected.
`static byte` `STATE_DISCONNECTING` In the processing of disconnecting
`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.
`String[]` `states`

### Fields inherited from class org.red5.server.net.protocol.ProtocolState

`DECODER_BUFFER, DECODER_CONTINUE, DECODER_OK, SESSION_KEY`

### Constructor Summary

Constructors
Constructor and Description
`RTMP()` Creates RTMP object; essentially for storing session information.

### Method Summary

Methods
`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.
`int` `getReadChunkSize()` Getter for write chunk size.
`byte` `getState()` Return current state.
`int` `getWriteChunkSize()` Getter for write chunk size.
`boolean` `isDebug()` Getter for debug.
`boolean` `isEncrypted()`
`void` `setDebug(boolean debug)` Setter for debug.
`void` `setEncoding(IConnection.Encoding encoding)` Setter for encoding version.
`void` `setEncrypted(boolean encrypted)`
`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()`

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

#### states

    public String[] states

#### 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 established.

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_DISCONNECTING

    public static final byte STATE_DISCONNECTING

In the processing of disconnecting

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

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

Creates RTMP object; essentially for storing session information.

### Method Detail

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

#### isEncrypted

    public boolean isEncrypted()

Returns:
  the encrypted

#### setEncrypted

    public void setEncrypted(boolean encrypted)

Parameters:
  `encrypted` - the encrypted to set

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

#### 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)

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`