using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.Sys.Network
{
public abstract class Packet {
protected byte[] mData;
// This is a method and not a read only property to "signify" to
// user that it is not a direct access, but incurs a performance
// penalty to call
public byte[] GetData() {
Conclude();
return mData;
}
///
/// Initializes the Packet with some data and sets a size for the header. This is used to determine the size of the bytearray.
///
/// A bytearray used to initialize the size of the packet.
/// Used to determine the difference between the header and the body.
/// Always 0
protected int Initialize(byte[] aData, int aHeaderSize) {
mData = new byte[aData.Length + aHeaderSize];
aData.CopyTo(mData, aHeaderSize);
return 0;
}
///
/// Concludes the Packet
///
protected virtual void Conclude() {
}
}
}