C# Class NewTOAPIA.Net.PacketBase

The base class for network packet data. A network packet consists of a payload, and a header. The implementation is based on the BufferChunk object. This additional layer of abstraction allows a subclass to implement packets that represent a specific protocol, such as RTP, without having to subclass the BufferChunk object. Additionally, the Packetizer object deals with packets in the abstract, so, this class serves as the base class for all streams that are to be packetized.
Show file Open project: Wiladams/NewTOAPIA Class Usage Examples

Protected Properties

Property Type Description
buffer BufferChunk

Public Methods

Method Description
AppendPayload ( BufferChunk data ) : void
AppendPayload ( Int32 data ) : void
AppendPayload ( IntPtr ptr, int length ) : void
PacketBase ( ) : System

Creates a max size packet

PacketBase ( BufferChunk buffer ) : System

Create a packet from an existing buffer

PacketBase ( PacketBase packet ) : System

Create a packet from an existing packet

PacketBase ( int packetSize ) : System

Creates a packet of the given size

ReleaseBuffer ( ) : BufferChunk

Release the BufferChunk held by this packet so it can be reused outside the scope of this packet.

Reset ( ) : void

Protected Methods

Method Description
OnReset ( ) : void
ValidateBuffer ( BufferChunk buffer ) : void

Make sure the provided buffer might be a real Rtp Packet (version == 2)

Method Details

AppendPayload() public method

public AppendPayload ( BufferChunk data ) : void
data BufferChunk
return void

AppendPayload() public method

public AppendPayload ( Int32 data ) : void
data System.Int32
return void

AppendPayload() public method

public AppendPayload ( IntPtr ptr, int length ) : void
ptr System.IntPtr
length int
return void

OnReset() protected method

protected OnReset ( ) : void
return void

PacketBase() public method

Creates a max size packet
public PacketBase ( ) : System
return System

PacketBase() public method

Create a packet from an existing buffer
public PacketBase ( BufferChunk buffer ) : System
buffer BufferChunk
return System

PacketBase() public method

Create a packet from an existing packet
public PacketBase ( PacketBase packet ) : System
packet PacketBase
return System

PacketBase() public method

Creates a packet of the given size
public PacketBase ( int packetSize ) : System
packetSize int
return System

ReleaseBuffer() public method

Release the BufferChunk held by this packet so it can be reused outside the scope of this packet.
public ReleaseBuffer ( ) : BufferChunk
return BufferChunk

Reset() public method

public Reset ( ) : void
return void

ValidateBuffer() protected method

Make sure the provided buffer might be a real Rtp Packet (version == 2)
protected ValidateBuffer ( BufferChunk buffer ) : void
buffer BufferChunk
return void

Property Details

buffer protected property

Buffer to contain the raw data
protected BufferChunk buffer
return BufferChunk