CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iNetworkPacket Struct Reference

The application writes an implementation of the network packet interface and a new instance of that implementation is passed to the network manager with each new connection registered. More...

#include <netman.h>

Inheritance diagram for iNetworkPacket:

iBase List of all members.

Public Methods

virtual bool Read (csDataStream &data, iNetworkConnection *socket)=0
 Read in data received over the network.

virtual char * Write (size_t &length)=0
 Returns the packet as flat data which can be sent over the network.

virtual csPtr< iNetworkPacket > New ()=0
 Return a new instance of this implementation.

virtual bool FilterSocket (iNetworkConnection *)=0
 Return true from this function if this packet should be sent over the given socket, false otherwise.


Detailed Description

The application writes an implementation of the network packet interface and a new instance of that implementation is passed to the network manager with each new connection registered.

These packets are used as buffers for incoming data. Other instances are passed to the transmission methods and their data is sent to remote hosts. This is for the CS networking API.

Definition at line 45 of file netman.h.


Member Function Documentation

virtual bool iNetworkPacket::FilterSocket iNetworkConnection   [pure virtual]
 

Return true from this function if this packet should be sent over the given socket, false otherwise.

Used by iNetworkManager::SendToAll() to filter out unwanted sockets. Read-only packets may ignore this.

virtual csPtr<iNetworkPacket> iNetworkPacket::New   [pure virtual]
 

Return a new instance of this implementation.

Used for packets associated with listeners to create a new packet for each new connection created from the listener.

virtual bool iNetworkPacket::Read csDataStream   data,
iNetworkConnection   socket
[pure virtual]
 

Read in data received over the network.

Returns true if the entire packet has been read, and a network event should be posted. Otherwise, further calls to Read() are neccessary. Resets length to the amount of data actually read. If not all the data was read, the remaining data can be assumed to be part of the next packet. Write-only packets may ignore this.

virtual char* iNetworkPacket::Write size_t &    length [pure virtual]
 

Returns the packet as flat data which can be sent over the network.

Sets length to the length of the buffer. Read-only packets may ignore this.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18