Halyri - Udp-client  0.9.1
 All Classes Namespaces Functions Enumerations Properties
ControlPacket Class Reference

Class representing a control packet for the protocol defined and implement by the UdpMediaClientSocket. This packet consist of a packet type identifier, sender GUID, a Int64 sequence number, target GUID and a command. More...

Inherits INetworkPacket.

Public Types

enum  CommandType : byte { RequestEnableRouting, RequestDisableRouting, Statistics }
 

Public Member Functions

 ControlPacket ()
 Initializes a new ControlPacket instance with no parameters. More...
 
 ControlPacket (string sourceGuid, string targetGuid, CommandType command, byte[] payload, Int64 sequenceNumber)
 Initializes a new ControlPacket instance that has the specified source and target Guids, command, payload data and sequence number. More...
 
 ControlPacket (string sourceGuid, string targetGuid, CommandType command, Int64 sequenceNumber)
 Initializes a new ControlPacket instance that has the specified source and target Guids, command and sequence number. More...
 
 ControlPacket (string sourceGuid, string targetGuid, CommandType command, byte[] payload)
 Initializes a new ControlPacket instance that has the specified source and target Guids, command and payload data. More...
 
 ControlPacket (string sourceGuid, string targetGuid, CommandType command)
 Initializes a new ControlPacket instance that has the specified source and target Guids and command. More...
 
 ControlPacket (byte[] sourceGuid, byte[] targetGuid, CommandType command, byte[] payload)
 Initializes a new ControlPacket instance that has the specified source and target Guids, command and payload data. More...
 
void FromBytes (byte[] packetBytes)
 Sets the state of this packet from the provided array of bytes. If the array does not containt a valid byte representation of this type of packet, throws an ArgumentException. More...
 
byte[] GetBytes (long sequenceNumber)
 
byte[] GetBytes ()
 Converts this packet to a byte array for network transfer. The sequence number specified in the packet will be used. More...
 
- Public Member Functions inherited from INetworkPacket
byte[] GetBytes (Int64 sequence)
 Converts this packet to a byte array for network transfer. The specified seqeuence number will be used in the packet header. More...
 

Public Attributes

const byte PacketId = 2
 
const int HeaderLengthInOctets = 42
 

Properties

string SourceGuid [get]
 String represenstation of the Guid identifying the sender More...
 
string TargetGuid [get]
 String represenstation of the Guid identifying the target More...
 
Int64 Sequence [get, set]
 Packet sequence number More...
 
CommandType Command [get]
 Packet command More...
 
byte[] PayloadData [get]
 Packet payload data. Can be null. More...
 

Detailed Description

Class representing a control packet for the protocol defined and implement by the UdpMediaClientSocket. This packet consist of a packet type identifier, sender GUID, a Int64 sequence number, target GUID and a command.

<author>Veli-Mikko Puupponen</author> Control packets are primarily user to request server packet routing from one client to another.

This packet can have optional payload data.

Constructor & Destructor Documentation

Initializes a new ControlPacket instance with no parameters.

ControlPacket ( string  sourceGuid,
string  targetGuid,
CommandType  command,
byte[]  payload,
Int64  sequenceNumber 
)

Initializes a new ControlPacket instance that has the specified source and target Guids, command, payload data and sequence number.

Throws an ArgumentException if source or target Guid is malformed.

Parameters
sourceGuidString representation of the sender's Guid
sourceGuidString representation of the target's Guid
commandPacket command
payloadOptional payload data
sequenceNumberPacket sequence number
ControlPacket ( string  sourceGuid,
string  targetGuid,
CommandType  command,
Int64  sequenceNumber 
)

Initializes a new ControlPacket instance that has the specified source and target Guids, command and sequence number.

Throws an ArgumentException if source or target Guid is malformed.

Parameters
sourceGuidString representation of the sender's Guid
sourceGuidString representation of the target's Guid
commandPacket command
sequenceNumberPacket sequence number
ControlPacket ( string  sourceGuid,
string  targetGuid,
CommandType  command,
byte[]  payload 
)

Initializes a new ControlPacket instance that has the specified source and target Guids, command and payload data.

Throws an ArgumentException if source or target Guid is malformed.

Parameters
sourceGuidString representation of the sender's Guid
sourceGuidString representation of the target's Guid
commandPacket command
payloadOptional payload data
ControlPacket ( string  sourceGuid,
string  targetGuid,
CommandType  command 
)

Initializes a new ControlPacket instance that has the specified source and target Guids and command.

Throws an ArgumentException if source or target Guid is malformed.

Parameters
sourceGuidString representation of the sender's Guid
sourceGuidString representation of the target's Guid
commandPacket command
ControlPacket ( byte[]  sourceGuid,
byte[]  targetGuid,
CommandType  command,
byte[]  payload 
)

Initializes a new ControlPacket instance that has the specified source and target Guids, command and payload data.

Throws an ArgumentException if any of the arguments is null.

Parameters
sourceGuidByte representation of the sender's Guid
sourceGuidByte representation of the target's Guid
commandPacket command
payloadOptional payload data

Member Function Documentation

void FromBytes ( byte[]  packetBytes)

Sets the state of this packet from the provided array of bytes. If the array does not containt a valid byte representation of this type of packet, throws an ArgumentException.

Throws an ArgumentException if the provided array does not containt a valid byte repsentation of the packet type.

Parameters
packetBytesByte representation of a packet with the same type as this packet

Implements INetworkPacket.

byte [] GetBytes ( )

Converts this packet to a byte array for network transfer. The sequence number specified in the packet will be used.

Throws an ArgumentException if the packet is not in a properly initializes state.

Returns
A byte array containing data and transfer header for this packet

Implements INetworkPacket.

Property Documentation

CommandType Command
get

Packet command

byte [] PayloadData
get

Packet payload data. Can be null.

Int64 Sequence
getset

Packet sequence number

string SourceGuid
get

String represenstation of the Guid identifying the sender

string TargetGuid
get

String represenstation of the Guid identifying the target


The documentation for this class was generated from the following file: