NET Class Reference

#include <net.h>

Collaboration diagram for NET:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NET ()
 ~NET ()
void Init ()
bool Connect (string host, int port)
void Update ()
bool Server ()
bool Connected ()
void Disconnect ()
void Send (void *data, int size)
int RecvBlock (void *dest, int destsize, int timeout)
int NumBufferedPackets ()
PBUFFERGetBuffer (int idx)
int GetMaxBuffers ()
int GetTxBytes ()
int GetRxBytes ()
int ClearStats ()

Private Member Functions

void WriteToPacket (UDPpacket *p, Uint8 control, void *data, int size)
bool IsEqualToPacket (UDPpacket *p, Uint8 control, void *data, int size)
int UDPSend (UDPpacket *p, int channel)
int UDPRecv (UDPpacket *p, int channel, int timeout)
bool ClientHandshake ()
bool ServerHandshake ()
int BufferPacket (UDPpacket *newp)

Private Attributes

IPaddress remote_ip
UDPsocket remote_socket
UDPpacket * pout
UDPpacket * pin
bool server
bool connected
PBUFFER buffer [PACKET_BUFFER_LEN]
unsigned int datacounter_tx
unsigned int datacounter_rx

Detailed Description

Definition at line 88 of file net.h.


Constructor & Destructor Documentation

NET::NET  ) 
 

Definition at line 8 of file net.cpp.

References datacounter_rx, datacounter_tx, NULL, pin, pout, remote_socket, and server.

NET::~NET  ) 
 

Definition at line 17 of file net.cpp.

References Disconnect().


Member Function Documentation

int NET::BufferPacket UDPpacket *  newp  )  [private]
 

Definition at line 396 of file net.cpp.

References buffer, datacounter_rx, and PACKET_BUFFER_LEN.

Referenced by Update().

int NET::ClearStats  )  [inline]
 

Definition at line 129 of file net.h.

References datacounter_rx, and datacounter_tx.

Referenced by MULTIPLAY::UpdateStats().

bool NET::ClientHandshake  )  [private]
 

Definition at line 233 of file net.cpp.

References connected, CONTROL_HANDSHAKE, HANDSHAKEREPLYSTR, HANDSHAKESTR, HANDSHAKETIMEOUT, IsEqualToPacket(), NET_DEBUG, pin, pout, UDP_FAILURE, UDP_SUCCESS, UDP_TIMEOUT, UDPRecv(), UDPSend(), and WriteToPacket().

Referenced by Connect().

bool NET::Connect string  host,
int  port
 

Definition at line 23 of file net.cpp.

References ClientHandshake(), MAX_PACKET_SIZE, NET_DEBUG, NULL, pin, pout, remote_ip, remote_socket, and server.

Referenced by MULTIPLAY::Connect(), and MULTIPLAY::Host().

bool NET::Connected  ) 
 

Definition at line 94 of file net.cpp.

References connected.

Referenced by MULTIPLAY::Connected().

void NET::Disconnect  ) 
 

Definition at line 104 of file net.cpp.

References connected, NULL, and remote_socket.

Referenced by MULTIPLAY::Disconnect(), and ~NET().

PBUFFER* NET::GetBuffer int  idx  )  [inline]
 

Definition at line 125 of file net.h.

References buffer.

Referenced by MULTIPLAY::ReceivePacketArray(), and MULTIPLAY::ReceiveState().

int NET::GetMaxBuffers  )  [inline]
 

Definition at line 126 of file net.h.

References PACKET_BUFFER_LEN.

Referenced by MULTIPLAY::ReceivePacketArray(), and MULTIPLAY::ReceiveState().

int NET::GetRxBytes  )  [inline]
 

Definition at line 128 of file net.h.

References datacounter_rx.

Referenced by MULTIPLAY::UpdateStats().

int NET::GetTxBytes  )  [inline]
 

Definition at line 127 of file net.h.

References datacounter_tx.

Referenced by MULTIPLAY::UpdateStats().

void NET::Init  ) 
 

Definition at line 3 of file net.cpp.

Referenced by InitGameData().

bool NET::IsEqualToPacket UDPpacket *  p,
Uint8  control,
void *  data,
int  size
[private]
 

Definition at line 114 of file net.cpp.

References REPLAY::Get_FuncNetControl(), NET_DEBUG, NULL, and replay.

Referenced by ClientHandshake(), and ServerHandshake().

int NET::NumBufferedPackets  ) 
 

Definition at line 424 of file net.cpp.

References buffer, and PACKET_BUFFER_LEN.

Referenced by MULTIPLAY::SendState().

int NET::RecvBlock void *  dest,
int  destsize,
int  timeout
 

Definition at line 346 of file net.cpp.

References NET_DEBUG, pin, UDP_SUCCESS, and UDPRecv().

void NET::Send void *  data,
int  size
 

Definition at line 313 of file net.cpp.

References NET_DEBUG, NULL, and pout.

Referenced by MULTIPLAY::SendPacketArray().

bool NET::Server  )  [inline]
 

Definition at line 119 of file net.h.

References server.

Referenced by MULTIPLAY::Server().

bool NET::ServerHandshake  )  [private]
 

Definition at line 276 of file net.cpp.

References connected, CONTROL_HANDSHAKE, HANDSHAKEREPLYSTR, HANDSHAKESTR, IsEqualToPacket(), NET_DEBUG, pin, pout, remote_socket, UDPSend(), and WriteToPacket().

Referenced by Update().

int NET::UDPRecv UDPpacket *  p,
int  channel,
int  timeout
[private]
 

Definition at line 199 of file net.cpp.

References datacounter_rx, remote_socket, UDP_FAILURE, UDP_SUCCESS, and UDP_TIMEOUT.

Referenced by ClientHandshake(), and RecvBlock().

int NET::UDPSend UDPpacket *  p,
int  channel
[private]
 

Definition at line 189 of file net.cpp.

References datacounter_tx, remote_socket, UDP_FAILURE, and UDP_SUCCESS.

Referenced by ClientHandshake(), and ServerHandshake().

void NET::Update  ) 
 

Definition at line 76 of file net.cpp.

References BufferPacket(), connected, NULL, pin, remote_socket, and ServerHandshake().

void NET::WriteToPacket UDPpacket *  p,
Uint8  control,
void *  data,
int  size
[private]
 

Definition at line 155 of file net.cpp.

References REPLAY::Get_FuncNetControl(), NET_DEBUG, NULL, and replay.

Referenced by ClientHandshake(), and ServerHandshake().


Member Data Documentation

PBUFFER NET::buffer[PACKET_BUFFER_LEN] [private]
 

Definition at line 98 of file net.h.

Referenced by BufferPacket(), GetBuffer(), and NumBufferedPackets().

bool NET::connected [private]
 

Definition at line 96 of file net.h.

Referenced by ClientHandshake(), Connected(), Disconnect(), ServerHandshake(), and Update().

unsigned int NET::datacounter_rx [private]
 

Definition at line 111 of file net.h.

Referenced by BufferPacket(), ClearStats(), GetRxBytes(), NET(), and UDPRecv().

unsigned int NET::datacounter_tx [private]
 

Definition at line 110 of file net.h.

Referenced by ClearStats(), GetTxBytes(), NET(), and UDPSend().

UDPpacket * NET::pin [private]
 

Definition at line 93 of file net.h.

Referenced by ClientHandshake(), Connect(), NET(), RecvBlock(), ServerHandshake(), and Update().

UDPpacket* NET::pout [private]
 

Definition at line 93 of file net.h.

Referenced by ClientHandshake(), Connect(), NET(), Send(), and ServerHandshake().

IPaddress NET::remote_ip [private]
 

Definition at line 91 of file net.h.

Referenced by Connect().

UDPsocket NET::remote_socket [private]
 

Definition at line 92 of file net.h.

Referenced by Connect(), Disconnect(), NET(), ServerHandshake(), UDPRecv(), UDPSend(), and Update().

bool NET::server [private]
 

Definition at line 95 of file net.h.

Referenced by Connect(), NET(), and Server().


The documentation for this class was generated from the following files:
Generated on Thu Oct 19 04:12:07 2006 by  doxygen 1.4.6