XPSockets: XPSockets Index Page

XPSockets Index Page

1

Introduction

XPSockets is a method for accessing TCPIP networking functions from a cross platform common layer

Using XPSockets

Include files are in the Includes directory.
Use "XPSockets.h" to access all the C++ insterface to sockets or, include "XPSocket.h" to only use the old C style functions.

There are four compiled libraries in the Libs directory:
XPSocketsDS and XPSocketsRS for debug and release single thread applications.
XPSocketsDM and XPSocketsRM for debug and release multi-threaded applications.
XPSocketsDMDLL and XPSocketsRMDLL for debug and release multi-threaded DLL applications.
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: File Index

XPSockets File List

Here is a list of all documented files with brief descriptions:
XPSocket.cpp
XPSocket.h [code]
XPSocketClass.h [code]
XPSockets.h [code]
XPSocketUrgentClass.h [code]
XPStream.h [code]
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPSocket.cpp File Reference

XPSocket.cpp File Reference

#include "RNPlatform/Inc/MemoryTracking.h"
#include <assert.h>
#include <stdio.h>
#include "debug.h"
#include "RNXPSockets/Inc/XPSocket.h"
#include "RNPlatform/Inc/ThreadClass.h"
#include "RNPlatform/Inc/SysTime.h"
#include <list>

Include dependency graph for XPSocket.cpp:

Defines

#define | RNmax(a, b) (((a) > (b)) ? (a) : (b))
#define | RNmin(a, b) (((a) < (b)) ? (a) : (b))
#define | closesocket close
#define | ioctlsocket ioctl
#define | SOCKET int
#define | INVALID_SOCKET -1
#define | SOCKET_ERROR -1
#define | WSAEWOULDBLOCK EWOULDBLOCK
#define | WSAECONNRESET ECONNRESET
#define | WSAENOTCONN ENOTCONN
#define | NO_NAGLE

Functions

int | WSAGetLastError (void)
void | XPSock_Poll (void)
int | XPSock_Init (void)
int | XPSock_Quit (void)
t_XPSocket * | XPSock_Create (void)
int | XPSock_SetSendBuffer (t_XPSocket *socket, int size)
int | XPSock_SetRecvBuffer (t_XPSocket *socket, int size)
int | XPSock_Connect (t_XPSocket *socket, const t_XPAddress *addr)
int | XPSock_Send (t_XPSocket *socket, const char *data, const int len)
int | XPSock_Recv (t_XPSocket *socket, char *data, int maxlen, int flag)
int | XPSock_Close (t_XPSocket *socket)
int | XPSock_Listen (t_XPSocket *socket, int port)
t_XPSocket * | XPSock_Accept (t_XPSocket *socket)
int | XPSock_GetAddress (t_XPSocket *socket, t_XPAddress *addr)
int | XPSock_GetPeerAddress (t_XPSocket *socket, t_XPAddress *addr)
int | XPSock_UrgentSetRawMode (t_XPSocket *socket, bool RawMode)
t_XPSocket * | XPSock_UrgentCreate (int port)
int | XPSock_UrgentMakeBroadcast (t_XPSocket *socket)
int | XPSock_ProcessACKS (void)
int | XPSock_UrgentSendWithACK (t_XPSocket *socket, const char *data, int len, const t_XPAddress *addr)
int | XPSock_UrgentSend (t_XPSocket *socket, const char *data, int len, const t_XPAddress *addr)
int | XPSock_UrgentRecv (t_XPSocket *socket, char *const data, int maxlen, int flag, t_XPAddress *const addr)
int | XPSock_UrgentListen (t_XPSocket *socket)
char * | XPSock_TranslateError (int error)
char * | XPSock_TranslateErrorLong (int error)
int | XPSock_GetHostName (char *name, int name_len)
int | XPSock_GetHostAddress (XPAddress *addr)
int | XPSock_Resolve (t_XPAddress *resolve, const char *input)
int | XPSock_UtilityGetFragment (char *buffer, int maxlen)
int | XPSock_UtilityGetInt (char *buffer, int offset)
void | XPSock_UtilitySetInt (char *buffer, int offset, int value)
short | XPSock_UtilityGetShort (char *buffer, int offset)
void | XPSock_UtilitySetShort (char *buffer, int offset, short value)
int | XPSock_UtilityChecksum (char *buffer, int length)
void | XPSock_SentHistogram (unsigned int *classes, int numClasses)
void | XPSock_RecvHistogram (unsigned int *classes, int numClasses)
int | XPSock_GetHardwareStatus (void)

Variables

int | asocket_lasterror = XPSOCK_EOK
int | asocket_packets_got = 0
int | asocket_packets_sent = 0
int | asocket_packets_got_size = 0
int | asocket_packets_sent_size = 0
MutexClass | g_xpsockets_lockclass
bool | gXPSock_PacketLossEmulation = false
float | gXPSock_PacketLossEmulationPercent = 0.0f
bool | gXPSock_PacketLatencyEmulation = false
float | gXPSock_PacketLatencyEmulationBase = 0.0f
float | gXPSock_PacketLatencyEmulationJitter = 0.0f

Detailed Description

Simple local host packet stuff A lot like standard sockets, but made simpler with all the error handling done internally

Handles all these protocols transparently:

Localhost sockets. TCPIP using streamed and UDP connections.

Sockets with a permanent connection and also connectionless sockets are implemented. Every urgent socket call can be thought of as mapping to equivilent UDP packet protocols.

Define Documentation

#define NO_NAGLE

Use this to turn off the Nagle packet compression algorithm

Function Documentation

t_XPSocket* XPSock_Accept ( t_XPSocket * socket )

Tries to accept any incoming connections and creates a connected socket if successfull.

Parameters:
socket the socket pointer
Returns:
returns the new socket conenction that got accepted or an XPSOCK error code or null for no socket

int XPSock_Close ( t_XPSocket * socket )

Closes a socket

Parameters:
socket the socket pointer
Returns:
returns an XPSOCK error code, XPSOCK_EOK is no error.

int XPSock_Connect | ( | t_XPSocket * | socket,
 |  | const t_XPAddress * | addr
 | ) |

Connect to a machine address

Parameters:
socket | the socket pointer
addr | the address to connect to. If addr is NULL then a local connect is tried
Returns:
returns an XPSOCK error code, XPSOCK_EOK is no error.

t_XPSocket* XPSock_Create ( void )

Creates a socket

Returns:
returns the socket pointer or XPSOCK_EERROR if an error occured

int XPSock_GetAddress | ( | t_XPSocket * | socket,
 |  | t_XPAddress * | addr
 | ) |

Fills in the internet address and port of a socket to the address structure.

Parameters:
socket | the socket pointer
addr | the address structure to fill in
Returns:
returns XPSOCK_EOK or an XPSOCK error code.

int XPSock_GetHardwareStatus ( void )

Gets the status of the network hardware used by this socket interface.

Returns:

int XPSock_GetHostAddress ( XPAddress * addr )

Gets the host machine address

Parameters:
addr the XPAddress to fill in
Returns:
returns an XPSOCK error code.

int XPSock_GetHostName | ( | char * | name,
 |  | int | name_len
 | ) |

Gets the host machine name

Parameters:
name | pointer to a buffer to receive the machines textual name
name_len | the length of the buffer
Returns:
returns an XPSOCK error code.

int XPSock_GetPeerAddress | ( | t_XPSocket * | socket,
 |  | t_XPAddress * | addr
 | ) |

Fills in the internet address of the peer of a socket to the address structure.

Parameters:
socket | the socket pointer
addr | the address structure to fill in
Returns:
returns XPSOCK_EOK or an XPSOCK error code.

int XPSock_Init ( void )

This inits the socket interface

int XPSock_Listen | ( | t_XPSocket * | socket,
 |  | int | port
 | ) |

Sets a socket to be a listen socket for a certain port number. This should only really be used for a server not the client as it is better network programming practise.

Parameters:
socket | the socket pointer
port | the port number to listen from
Returns:
returns an XPSOCK error code, XPSOCK_EOK is no error.

int XPSock_ProcessACKS ( void )

Propcesses the socket ACK queue. Returns the number of pending ACKs left to be received for outbound data. This should be called once a frame if urgent sockets with ACKs are used

Returns:
returns the number of pending socket ACKs.

int XPSock_Quit ( void )

Quits all sockets and exits

int XPSock_Recv | ( | t_XPSocket * | socket,
 |  | char * | data,
 |  | int | maxlen,
 |  | int | flag
 | ) |

Tries to receive data from a socket

Parameters:
socket | the socket pointer
data | a char pointer to the data buffer
maxlen | the meximum length of the data buffer to receive to
flag | the flag to use for this operation. Removes the read message from the queue unless XPSOCKF_PEEK is used
Returns:
returns the number of bytes read or 0 if no data is pending or an XPSOCK_EERROR error code.

void XPSock_RecvHistogram | ( | unsigned int * | classes,
 |  | int | numClasses
 | ) |

Supplies a histogram table and the size of the table for sent packets. Each class entry corresponds to a size of packet.

Parameters:
classes | The pointer to the array of classes.
numClasses | The number of classes in the array.

int XPSock_Resolve | ( | t_XPAddress * | resolve,
 |  | const char * | input
 | ) |

Handy routine to resolve anything into an address

Parameters:
resolve | the address structure to fill in with the result
input | the textual name of a machine name to resolve
Returns:
returns an XPSOCK error code.

int XPSock_Send | ( | t_XPSocket * | socket,
 |  | const char * | data,
 |  | const int | len
 | ) |

Tries to send data via the socket

Parameters:
socket | the socket pointer
data | a char pointer to the data buffer
len | the length of the data to send
Returns:
returns The number of bytes sent or an SOCKET_ERROR error code, XPSOCK_EOK is no error.

void XPSock_SentHistogram | ( | unsigned int * | classes,
 |  | int | numClasses
 | ) |

Supplies a histogram table and the size of the table for sent packets. Each class entry corresponds to a size of packet.

Parameters:
classes | The pointer to the array of classes.
numClasses | The number of classes in the array.

int XPSock_SetRecvBuffer | ( | t_XPSocket * | socket,
 |  | int | size
 | ) |

Sets the size of the recv buffer for a socket

Parameters:
socket | the socket pointer
size | The size to set the recv buffer to or -1 to only return the value
Returns:
the new size of the recv buffer

int XPSock_SetSendBuffer | ( | t_XPSocket * | socket,
 |  | int | size
 | ) |

Sets the size of the send buffer for a socket

Parameters:
socket | the socket pointer
size | The size to set the send buffer to or -1 to only return the value
Returns:
the new size of the send buffer

char* XPSock_TranslateError ( int error )

This translates an XP socket error to a text string

Parameters:
error the XPSOCK error number
Returns:
returns a pointer to an XPSOCK error string.

char* XPSock_TranslateErrorLong ( int error )

This translates an XP socket error to a long descriptive text string

Parameters:
error the XPSOCK error number
Returns:
returns a pointer to an XPSOCK long error string.

t_XPSocket* XPSock_UrgentCreate ( int port )

Creates an urgent socket Returns XPSOCK_EERROR if an error occured If port is zero (0) then the network layer will pick a port number to be bound to Using a value of zero for the port when operating a client is advised since the any chosen port might already be in use

Parameters:
port the port number to use
Returns:
returns a pointer to new socket or an XPSOCK error code.

int XPSock_UrgentListen ( t_XPSocket * socket )

Marks the urgent socket as being a server socket rather than a client socket Useless under Winsock but may be usefull for future implementation

Parameters:
socket the socket pointer
Returns:
returns an XPSOCK error code.

int XPSock_UrgentMakeBroadcast ( t_XPSocket * socket )

Makes an urgent socket broadcast capable

Parameters:
socket the socket pointer
Returns:
returns an XPSOCK error code.

int XPSock_UrgentRecv | ( | t_XPSocket * | socket,
 |  | char *const | data,
 |  | int | maxlen,
 |  | int | flag,
 |  | t_XPAddress *const | addr
 | ) |

Receives data from an urgent socket

Parameters:
socket | the socket pointer
data | pointer to a data buffer
maximum | length of the data buffer
flag | the flag to use for this operation. Removes the read message from the queue unless XPSOCK_FPEEK is used
addr | the address of the sending socket for any data received
Returns:
returns thje length of the data received or 0 if no data is pending or an XPSOCK_EERROR error code

int XPSock_UrgentSend | ( | t_XPSocket * | socket,
 |  | const char * | data,
 |  | int | len,
 |  | const t_XPAddress * | addr
 | ) |

Send an urgent packet from the socket to the specified address. This will return XPSOCK_EUDPSENDFAILED if this method doesn't exist. If so use a non-urgent socket

Parameters:
socket | the socket pointer
data | the pointer to the data to send
len | the length of the data to send
the | addres and port number to send to
Returns:
returns an XPSOCK error code.

int XPSock_UrgentSendWithACK | ( | t_XPSocket * | socket,
 |  | const char * | data,
 |  | int | len,
 |  | const t_XPAddress * | addr
 | ) |

Sends data via the urgent socket to the supplied address and requests that the data is ACK'd and gaurenteed to be received This will return XPSOCK_EUDPSENDFAILED if this method doesn't exist. If so use a non-urgent socket

Parameters:
socket | the socket pointer
data | the pointer to the data to send
len | the length of the data to send
the | address and port number to send to
Returns:
returns an XPSOCK error code.

int XPSock_UrgentSetRawMode | ( | t_XPSocket * | socket,
 |  | bool | RawMode
 | ) |

Sets the raw mode for urgent sockets to be true or false. If true then the ACK layer will not add sequence data.

Parameters:
socket | the socket pointer
RawMode | the bool status of the raw mode send to set

int XPSock_UtilityChecksum | ( | char * | buffer,
 |  | int | length
 | ) |

Simple function to perform a quick checksum of data

Parameters:
buffer | the data buffer to checksum
length | the length of the data buffer
Returns:
the checksum for this data

int XPSock_UtilityGetFragment | ( | char * | buffer,
 |  | int | maxlen
 | ) |

A handy function that gets the length of the next data fragment Nice for buffers that start with two bytes that describe the length of the packet

Parameters:
buffer | pointer ot a data buffer
maxlen | the length of this buffer
Returns:
returns the fragment size or an XPSOCK error code if the buffer is too small

int XPSock_UtilityGetInt | ( | char * | buffer,
 |  | int | offset
 | ) |

Extracts an int from a buffer given an offset

Parameters:
buffer | the pointer to the buffer
offset | the offsrt in the buffer containing the int
Returns:
returns an int

short XPSock_UtilityGetShort | ( | char * | buffer,
 |  | int | offset
 | ) |

Extracts a short from a buffer given an offset

Parameters:
buffer | the pointer to the buffer
offset | the offsrt in the buffer containing the short
Returns:
returns a short

void XPSock_UtilitySetInt | ( | char * | buffer,
 |  | int | offset,
 |  | int | value
 | ) |

Encodes an int into a buffer at a given an offset

Parameters:
buffer | the pointer to the buffer
offset | the offsrt in the buffer containing the int
value | the value to encode in the buffer

void XPSock_UtilitySetShort | ( | char * | buffer,
 |  | int | offset,
 |  | short | value
 | ) |

Encodes a short into a buffer at a given an offset

Parameters:
buffer | the pointer to the buffer
offset | the offsrt in the buffer containing the short
value | the value to encode in the buffer

Variable Documentation

int asocket_lasterror = XPSOCK_EOK

asocket_lasterror This contains the last error value returned from any of the socket functions

int asocket_packets_got = 0

Total number of packets received

int asocket_packets_got_size = 0

Total byte size of packets received

int asocket_packets_sent = 0

Total number of packets sent

int asocket_packets_sent_size = 0

Total byte size of packets sent

Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
RNReplicaNet::XPAddress
RNReplicaNet::XPSocket
RNReplicaNet::XPSocketUrgent
RNReplicaNet::XPStream
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: RNReplicaNet::XPAddress Struct Reference

RNReplicaNet::XPAddress

RNReplicaNet::XPAddress Struct Reference

#include <XPSocket.h>

List of all members.

Public Member Functions

XPAddress (std::string addr)
XPAddress (const int port, unsigned char addr1, unsigned char addr2, unsigned char addr3, unsigned char addr4)
XPAddress ()
std::string | Export (void)

Public Attributes

int | port
unsigned char | addr [4]

Detailed Description

This is an address that the sockets use

Constructor & Destructor Documentation

XPAddress::XPAddress ( std::string addr )

ctor that accepts a std::string in the form xx.xx.xx.xx:xx and converts it to an address

XPAddress::XPAddress | ( | const int | port,
 |  | unsigned char | addr1,
 |  | unsigned char | addr2,
 |  | unsigned char | addr3,
 |  | unsigned char | addr4
 | ) |

ctor for XPAddress that allows the structure to be constructed in a C++ fashion

XPAddress::XPAddress ( )

default ctor, all members are left alone

Member Function Documentation

std::string XPAddress::Export ( void )

Exports the XPAddress as a std::string

Returns:
returns the std::string version of this XPAddress

Member Data Documentation

unsigned char RNReplicaNet::XPAddress::addr[4]

The IP addr for this structure

int RNReplicaNet::XPAddress::port

The port number for this address

The documentation for this struct was generated from the following files:
  • XPSocket.h
  • XPSocket.cpp
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: RNReplicaNet::XPSocket Class Reference

RNReplicaNet::XPSocket

RNReplicaNet::XPSocket Class Reference

#include <XPSocketClass.h>

Inheritance diagram for RNReplicaNet::XPSocket:

[legend]
List of all members.

Public Member Functions

XPSocket ()
virtual | ~XPSocket ()
virtual int | Create (void)
int | Connect (const XPAddress &addr)
int | Send (const char *data)
int | Send (const char *data, const int len)
int | Recv (char *const data, const int maxlen)
int | Close (void)
int | Listen (const int port=XPSOCK_PORT_ANY)
XPSocket * | Accept (void)
int | SetSendBuffer (const int size)
int | SetRecvBuffer (const int size)
int | GetAddress (XPAddress *const addr)
int | GetPeerAddress (XPAddress *const addr)
int | MutateSocket (XPSocket *socket)
bool | IsAlive (void)
t_XPSocket * | GetSocketPointer (void)

Static Public Member Functions

static int | GetLastError (void)
static int | GetMaxPacketSize (void)

Friends

class | XPSocketUrgent

Detailed Description

This class is a socket which is a potential connection of actualy connection to a machine somewhere else in the world. This uses the underlying XPSocket library which in turn uses the winsock or berkley sockets API. Most member functions return an XPSOCK_EERROR code. XPSOCK_EOK indicates no error. XPSOCK_EWOULDBLOCK is a non-fatal error and means the socket operation would have blocked the current thread at this point. If XPSOCK_EERROR is returned the user should use XPSocket::GetLastError() to find out the actual error code

Constructor & Destructor Documentation

XPSocket::XPSocket ( )

The ctor for an XPSocket This checks to make sure sockets are active and sets some initial states. At this point no connection is made for the socket

XPSocket::~XPSocket ( ) [virtual]

The dtor for an XPSocket This cleans up everything for this socket

Member Function Documentation

XPSocket * XPSocket::Accept ( void )

Accepts any pending connections for this socket. This should be used with the Listen() member function

Returns:
returns NULL if no connection was pending or returns the pointer to the new connected XPSocket or pcXPSOCK_EERROR if an error occured

Reimplemented in RNReplicaNet::XPStream.

int XPSocket::Close ( void )

Closes the socket but does not delete the memory for the XPSocket class

Returns:
returns an XPSOCK_EERROR code.

Reimplemented in RNReplicaNet::XPStream.

int XPSocket::Connect ( const XPAddress & addr )

Tries to connect this socket to a network address

Parameters:
addr the address to try to connect to
Returns:
returns an XPSOCK_EERROR code.

int XPSocket::Create ( void ) [virtual]

Creates a TCP style socket. This is the first stage to creating a connection

Returns:
returns an XPSOCK_EERROR code.

Reimplemented in RNReplicaNet::XPStream.

int XPSocket::GetAddress ( XPAddress *const addr )

Fills in the internet address and port of the socket to the address structure.

Parameters:
addr the address structure to fill in
Returns:
returns XPSOCK_EOK or an XPSOCK_EERROR error code.

int XPSocket::GetLastError ( void ) [static]

Gets the last error reported by the XPSocket API

Returns:
returns an XPSOCK_EERROR code.

static int RNReplicaNet::XPSocket::GetMaxPacketSize ( void ) [inline, static]

Returns the maximum size for a packet

Returns:
the maximum size for a data packet for this socket

Reimplemented in RNReplicaNet::XPSocketUrgent, and RNReplicaNet::XPStream.

int XPSocket::GetPeerAddress ( XPAddress *const addr )

Fills in the internet address of the peer of the socket to the address structure.

Parameters:
addr the address structure to fill in
Returns:
returns XPSOCK_EOK or an XPSOCK_EERROR error code.

t_XPSocket * XPSocket::GetSocketPointer ( void )

Access for the t_XPSocket pointer

Returns:
The t_XPSocket pointer associated with this class

bool XPSocket::IsAlive ( void )

Tests the alive state of the socket

Returns:
returns true if the socket is alive or false if the socket is dead

int XPSocket::Listen ( const int port = XPSOCK_PORT_ANY )

Makes the socket listen on a certain port number

Parameters:
port the port number to listen on for incoming connections
Returns:
returns an XPSOCK_EERROR code.

int XPSocket::MutateSocket ( XPSocket * socket )

Mutates this socket class to use a socket

Parameters:
socket the socket to mutate to
Returns:
returns XPSOCK_EOK or an XPSOCK_EERROR error code.

int XPSocket::Recv | ( | char *const | data,
 |  | const int | maxlen
 | ) |

Tries to receive data that is waiting for this socket

Parameters:
data | the pointer to the buffer to receive the data
maxlen | the maximum length of the data buffer
Returns:
returns the length of the data received or 0 for no data pending or an XPSOCK_EERROR code.

Reimplemented in RNReplicaNet::XPStream.

int XPSocket::Send | ( | const char * | data,
 |  | const int | len
 | ) |

Sends data to the peer (the connected machine) for this socket

Parameters:
data | the pointer to the data to send
len | the length of the data to send
Returns:
returns an XPSOCK_EERROR code.

Reimplemented in RNReplicaNet::XPStream.

int XPSocket::Send ( const char * data )

Sends a NULL terminated string to the peer (the connected machine) for this socket

Parameters:
data The pointer to the NULL terminated string
Returns:
returns an XPSOCK_EERROR code.

int XPSocket::SetRecvBuffer ( const int size )

Sets the size of the recv buffer for the socket

Parameters:
size The size to set the recv buffer to or -1 to only return the value
Returns:
the new size of the recv buffer

int XPSocket::SetSendBuffer ( const int size )

Sets the size of the send buffer for the socket

Parameters:
size The size to set the send buffer to or -1 to only return the value
Returns:
the new size of the send buffer

The documentation for this class was generated from the following files:
  • XPSocketClass.h
  • XPSocketClass.cpp
Generated on Sun Oct 30 01:12:23 2005 for XPSockets by doxygen 1.4.1


XPSockets: RNReplicaNet::XPSocketUrgent Class Reference

RNReplicaNet::XPSocketUrgent

RNReplicaNet::XPSocketUrgent Class Reference

#include <XPSocketUrgentClass.h>

Inheritance diagram for RNReplicaNet::XPSocketUrgent:

[legend]
Collaboration diagram for RNReplicaNet::XPSocketUrgent:

[legend]
List of all members.

Public Member Functions

int | Create (const int port=XPSOCK_PORT_ANY)
int | SetRawMode (const bool RawMode=true)
int | MakeBroadcast (void)
int | ProcessACKS (void)
int | SendWithACK (const char *data, const int len, const XPAddress &addr)
int | Send (const char *data, const XPAddress &addr)
int | Send (const char *data, const int len, const XPAddress &addr)
int | Recv (char *const data, const int maxlen, XPAddress *const addr)

Static Public Member Functions

static int | GetMaxPacketSize (void)

Detailed Description

An extension to the normal XPSocket class that handles urgent but unreliable packets. This call also makes use of the function in the XPSocket base class Most member functions return an XPSOCK_EERROR code. XPSOCK_EOK indicates no error. XPSOCK_EWOULDBLOCK is a non-fatal error and means the socket operation would have blocked the current thread at this point. If XPSOCK_EERROR is returned the user should use XPSocket::GetLastError() to find out the actual error code

Member Function Documentation

int XPSocketUrgent::Create ( const int port = XPSOCK_PORT_ANY )

Creates an urgent socket. Communication through this socket is faster but less reliable. A mechanism is supplied to enable data to be sent in a reliable manner but at the expense of CPU time and network bandwidth Returns XPSOCK_EERROR if an error occurred If port is zero (0) or XPSOCK_PORT_ANY then the network layer will pick a port number to be bound to Using a value of zero for the port when operating a client is advised since the any chosen port might already be in use

Returns:
returns a pointer to new socket or an XPSOCK_EERROR error code.

static int RNReplicaNet::XPSocketUrgent::GetMaxPacketSize ( void ) [inline, static]

Returns the maximum size for a packet

Returns:
the maximum size for a data packet for this socket

Reimplemented from RNReplicaNet::XPSocket.

int XPSocketUrgent::MakeBroadcast ( void )

Makes an urgent socket broadcast capable

Returns:
returns an XPSOCK error code.

int XPSocketUrgent::ProcessACKS ( void )

Processes the socket ACK queue. Returns the number of pending ACKs left to be received for outbound data. This should be called once a frame if urgent sockets with ACKs are used

Returns:
returns the number of pending socket ACKs.

int XPSocketUrgent::Recv | ( | char *const | data,
 |  | const int | maxlen,
 |  | XPAddress *const | addr
 | ) |

Receives data from an urgent socket

Parameters:
data | pointer to a data buffer
maximum | length of the data buffer
addr | the address of the sending socket for any data received
Returns:
returns the length of the data received or 0 if no data pending or an XPSOCK_EERROR error code

int XPSocketUrgent::Send | ( | const char * | data,
 |  | const int | len,
 |  | const XPAddress & | addr
 | ) |

Send an urgent packet from the socket to the specified address. The data sent is not guaranteed to arrive at the destination. This will return XPSOCK_EUDPSENDFAILED if this method doesn't exist. If so use a non-urgent socket

Parameters:
data | the pointer to the data to send
len | the length of the data to send
the | address and port number to send to
Returns:
returns an XPSOCK_EERROR error code.

int XPSocketUrgent::Send | ( | const char * | data,
 |  | const XPAddress & | addr
 | ) |

Sends a NULL terminated string to the peer (the connected machine) for this socket

Parameters:
data The pointer to the NULL terminated string
Returns:
returns an XPSOCK_EERROR code.

int XPSocketUrgent::SendWithACK | ( | const char * | data,
 |  | const int | len,
 |  | const XPAddress & | addr
 | ) |

Sends data via the urgent socket to the supplied address and requests that the data is ACK'd and guaranteed to be received This will return XPSOCK_EUDPSENDFAILED if this method doesn't exist. If so use a non-urgent socket

Parameters:
data | the pointer to the data to send
len | the length of the data to send
the | addres and port number to send to
Returns:
returns an XPSOCK_EERROR error code.

int XPSocketUrgent::SetRawMode ( const bool RawMode = true )

Sets the raw mode for urgent sockets to be true or false. If true then the ACK layer will not add sequence data.

Parameters:
RawMode the bool status of the raw mode send to set. The default is to be true.
Returns:
returns an XPSOCK error code.

The documentation for this class was generated from the following files:
  • XPSocketUrgentClass.h
  • XPSocketUrgentClass.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: RNReplicaNet::XPStream Class Reference

RNReplicaNet::XPStream

RNReplicaNet::XPStream Class Reference

#include <XPStream.h>

Inheritance diagram for RNReplicaNet::XPStream:

[legend]
Collaboration diagram for RNReplicaNet::XPStream:

[legend]
List of all members.

Public Member Functions

XPStream ()
virtual | ~XPStream ()
int | Create ()
int | Close ()
XPStream * | Accept (void)
int | Send (const char *data, const int len)
int | Recv (char *const data, const int maxlen)
int | GetMaxPacketSize (void)

Detailed Description

An implementation enabling a program to send packets via the sockets interface and not lose packet integrity by the transport medium fragmenting packets Most member functions return an XPSOCK_EERROR code. XPSOCK_EOK indicates no error. XPSOCK_EWOULDBLOCK is a non-fatal error and means the socket operation would have blocked the current thread at this point. If XPSOCK_EERROR is returned the user should use XPSocket::GetLastError() to find out the actual error code

Todo:
The XPStream relies too heavily on the underlying XPSocket API. Consider separating this API from the socket base class

Constructor & Destructor Documentation

XPStream::XPStream ( )

The ctor for an XPStream At this point no connection is made for the stream

XPStream::~XPStream ( ) [virtual]

The dtor for an XPStream This cleans up everything for this stream

Member Function Documentation

XPStream * XPStream::Accept ( void )

Accepts any pending connections for this stream. This should be used with the Listen() member function defined in the XPSocket base class

Returns:
returns NULL if no connection was pending or returns the pointer to the new connected XPStream or pcXPSOCK_EERROR if an error occured

Reimplemented from RNReplicaNet::XPSocket.

int XPStream::Close ( )

Closes a XPStream

Returns:
returns an XPSOCK_EERROR code

Reimplemented from RNReplicaNet::XPSocket.

int XPStream::Create ( ) [virtual]

Creates a XPStream

Returns:
returns an XPSOCK_EERROR code

Reimplemented from RNReplicaNet::XPSocket.

int RNReplicaNet::XPStream::GetMaxPacketSize ( void ) [inline]

Returns the maximum size for a packet

Returns:
the maximum size for a data packet for this stream

Reimplemented from RNReplicaNet::XPSocket.

int XPStream::Recv | ( | char *const | data,
 |  | const int | maxlen
 | ) |

Tries to recv a packet from the stream

Parameters:
data | the pointer to the data buffer to receive the packet
maxlen | the maximum length of the data buffer
Returns:
returns the length of the data received or 0 for no data pending or an XPSOCK_EERROR code.

Reimplemented from RNReplicaNet::XPSocket.

int XPStream::Send | ( | const char * | data,
 |  | const int | len
 | ) |

Sends a packet from the connected stream

Parameters:
data | the pointer to the data to send
len | the length of the data to send
Returns:
returns an XPSOCK_EERROR code

Reimplemented from RNReplicaNet::XPSocket.

The documentation for this class was generated from the following files:
  • XPStream.h
  • XPStream.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Hierarchical Index

XPSockets Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:

  • ImpairedPacket
  • RNReplicaNet::s_XPErrorTranslate
  • RNReplicaNet::s_XPSocket
  • RNReplicaNet::XPAddress
  • RNReplicaNet::XPSocket
    • RNReplicaNet::XPSocketUrgent
    • RNReplicaNet::XPStream
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: Class Members

Here is a list of all documented class members with links to the class documentation for each member:

  • Accept() : RNReplicaNet::XPStream, RNReplicaNet::XPSocket
  • addr : RNReplicaNet::XPAddress
  • Close() : RNReplicaNet::XPStream, RNReplicaNet::XPSocket
  • Connect() : RNReplicaNet::XPSocket
  • Create() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • Export() : RNReplicaNet::XPAddress
  • GetAddress() : RNReplicaNet::XPSocket
  • GetLastError() : RNReplicaNet::XPSocket
  • GetMaxPacketSize() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • GetPeerAddress() : RNReplicaNet::XPSocket
  • GetSocketPointer() : RNReplicaNet::XPSocket
  • IsAlive() : RNReplicaNet::XPSocket
  • Listen() : RNReplicaNet::XPSocket
  • MakeBroadcast() : RNReplicaNet::XPSocketUrgent
  • MutateSocket() : RNReplicaNet::XPSocket
  • port : RNReplicaNet::XPAddress
  • ProcessACKS() : RNReplicaNet::XPSocketUrgent
  • Recv() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • Send() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • SendWithACK() : RNReplicaNet::XPSocketUrgent
  • SetRawMode() : RNReplicaNet::XPSocketUrgent
  • SetRecvBuffer() : RNReplicaNet::XPSocket
  • SetSendBuffer() : RNReplicaNet::XPSocket
  • XPAddress() : RNReplicaNet::XPAddress
  • XPSocket() : RNReplicaNet::XPSocket
  • XPStream() : RNReplicaNet::XPStream
  • ~XPSocket() : RNReplicaNet::XPSocket
  • ~XPStream() : RNReplicaNet::XPStream
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: Directory Hierarchy

XPSockets Directories

This directory hierarchy is sorted roughly, but not completely, alphabetically:
  • ReplicaNetWork
    • RNXPSockets
      • Inc
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: C:/Work/ReplicaNetWork/ Directory Reference

ReplicaNetWork

ReplicaNetWork Directory Reference

Directories

directory RNXPSockets
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: C:/Work/ReplicaNetWork/RNXPSockets/ Directory Reference

RNXPSockets Directory Reference

Directories

directory | Inc

Files

file | XPSocket.cpp
file | XPSocketClass.cpp
file | XPSockets.cpp
file | XPSocketUrgentClass.cpp
file | XPStream.cpp
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: C:/Work/ReplicaNetWork/RNXPSockets/Inc/ Directory Reference

Inc Directory Reference

Files

file | XPSocket.h [code]
file | XPSocketClass.h [code]
file | XPSockets.h [code]
file | XPSocketUrgentClass.h [code]
file | XPStream.h [code]
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: File Members

Here is a list of all documented file members with links to the documentation:

- a -

  • asocket_lasterror : XPSocket.cpp
  • asocket_packets_got : XPSocket.cpp
  • asocket_packets_got_size : XPSocket.cpp
  • asocket_packets_sent : XPSocket.cpp
  • asocket_packets_sent_size : XPSocket.cpp

- n -

  • NO_NAGLE : XPSocket.cpp

- x -

  • XPSock_Accept() : XPSocket.cpp
  • XPSock_Close() : XPSocket.cpp
  • XPSock_Connect() : XPSocket.cpp
  • XPSock_Create() : XPSocket.cpp
  • XPSock_GetAddress() : XPSocket.cpp
  • XPSock_GetHardwareStatus() : XPSocket.cpp
  • XPSock_GetHostAddress() : XPSocket.cpp
  • XPSock_GetHostName() : XPSocket.cpp
  • XPSock_GetPeerAddress() : XPSocket.cpp
  • XPSock_Init() : XPSocket.cpp
  • XPSock_Listen() : XPSocket.cpp
  • XPSock_ProcessACKS() : XPSocket.cpp
  • XPSock_Quit() : XPSocket.cpp
  • XPSock_Recv() : XPSocket.cpp
  • XPSock_RecvHistogram() : XPSocket.cpp
  • XPSock_Resolve() : XPSocket.cpp
  • XPSock_Send() : XPSocket.cpp
  • XPSock_SentHistogram() : XPSocket.cpp
  • XPSock_SetRecvBuffer() : XPSocket.cpp
  • XPSock_SetSendBuffer() : XPSocket.cpp
  • XPSock_TranslateError() : XPSocket.cpp
  • XPSock_TranslateErrorLong() : XPSocket.cpp
  • XPSock_UrgentCreate() : XPSocket.cpp
  • XPSock_UrgentListen() : XPSocket.cpp
  • XPSock_UrgentMakeBroadcast() : XPSocket.cpp
  • XPSock_UrgentRecv() : XPSocket.cpp
  • XPSock_UrgentSend() : XPSocket.cpp
  • XPSock_UrgentSendWithACK() : XPSocket.cpp
  • XPSock_UrgentSetRawMode() : XPSocket.cpp
  • XPSock_UtilityChecksum() : XPSocket.cpp
  • XPSock_UtilityGetFragment() : XPSocket.cpp
  • XPSock_UtilityGetInt() : XPSocket.cpp
  • XPSock_UtilityGetShort() : XPSocket.cpp
  • XPSock_UtilitySetInt() : XPSocket.cpp
  • XPSock_UtilitySetShort() : XPSocket.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Page Index

XPSockets Related Pages

Here is a list of all related documentation pages:
  • Todo List
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Todo List

Todo List

Class RNReplicaNet::XPStream
The XPStream relies too heavily on the underlying XPSocket API. Consider separating this API from the socket base class
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: Graphical Class Hierarchy

Go to the textual class hierarchy

Generated on Sun Oct 30 01:12:25 2005 for XPSockets by doxygen 1.4.1


XPSockets: Member List

RNReplicaNet::XPSocket Member List

This is the complete list of members for RNReplicaNet::XPSocket, including all inherited members.

Accept(void) | RNReplicaNet::XPSocket |
Close(void) | RNReplicaNet::XPSocket |
Connect(const XPAddress &addr) | RNReplicaNet::XPSocket |
Create(void) | RNReplicaNet::XPSocket | [virtual]
GetAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetLastError(void) | RNReplicaNet::XPSocket | [static]
GetMaxPacketSize(void) | RNReplicaNet::XPSocket | [inline, static]
GetPeerAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetSocketPointer(void) | RNReplicaNet::XPSocket |
IsAlive(void) | RNReplicaNet::XPSocket |
Listen(const int port=XPSOCK_PORT_ANY) | RNReplicaNet::XPSocket |
MutateSocket(XPSocket *socket) | RNReplicaNet::XPSocket |
Recv(char *const data, const int maxlen) | RNReplicaNet::XPSocket |
Send(const char *data) | RNReplicaNet::XPSocket |
Send(const char *data, const int len) | RNReplicaNet::XPSocket |
SetRecvBuffer(const int size) | RNReplicaNet::XPSocket |
SetSendBuffer(const int size) | RNReplicaNet::XPSocket |
XPSocket() | RNReplicaNet::XPSocket |
XPSocketUrgent (defined in RNReplicaNet::XPSocket) | RNReplicaNet::XPSocket | [friend]
~XPSocket() | RNReplicaNet::XPSocket | [virtual]

Generated on Sun Oct 30 01:12:23 2005 for XPSockets by doxygen 1.4.1


XPSockets: Member List

RNReplicaNet::XPSocketUrgent Member List

This is the complete list of members for RNReplicaNet::XPSocketUrgent, including all inherited members.

Accept(void) | RNReplicaNet::XPSocket |
Close(void) | RNReplicaNet::XPSocket |
Connect(const XPAddress &addr) | RNReplicaNet::XPSocket |
Create(const int port=XPSOCK_PORT_ANY) | RNReplicaNet::XPSocketUrgent |
RNReplicaNet::XPSocket::Create(void) | RNReplicaNet::XPSocket | [virtual]
GetAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetLastError(void) | RNReplicaNet::XPSocket | [static]
GetMaxPacketSize(void) | RNReplicaNet::XPSocketUrgent | [inline, static]
GetPeerAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetSocketPointer(void) | RNReplicaNet::XPSocket |
IsAlive(void) | RNReplicaNet::XPSocket |
Listen(const int port=XPSOCK_PORT_ANY) | RNReplicaNet::XPSocket |
MakeBroadcast(void) | RNReplicaNet::XPSocketUrgent |
MutateSocket(XPSocket *socket) | RNReplicaNet::XPSocket |
ProcessACKS(void) | RNReplicaNet::XPSocketUrgent |
Recv(char *const data, const int maxlen, XPAddress *const addr) | RNReplicaNet::XPSocketUrgent |
RNReplicaNet::XPSocket::Recv(char *const data, const int maxlen) | RNReplicaNet::XPSocket |
Send(const char *data, const XPAddress &addr) | RNReplicaNet::XPSocketUrgent |
Send(const char *data, const int len, const XPAddress &addr) | RNReplicaNet::XPSocketUrgent |
RNReplicaNet::XPSocket::Send(const char *data) | RNReplicaNet::XPSocket |
RNReplicaNet::XPSocket::Send(const char *data, const int len) | RNReplicaNet::XPSocket |
SendWithACK(const char *data, const int len, const XPAddress &addr) | RNReplicaNet::XPSocketUrgent |
SetRawMode(const bool RawMode=true) | RNReplicaNet::XPSocketUrgent |
SetRecvBuffer(const int size) | RNReplicaNet::XPSocket |
SetSendBuffer(const int size) | RNReplicaNet::XPSocket |
XPSocket() | RNReplicaNet::XPSocket |
XPSocketUrgent() (defined in RNReplicaNet::XPSocketUrgent) | RNReplicaNet::XPSocketUrgent | [inline]
XPSocketUrgent (defined in RNReplicaNet::XPSocket) | RNReplicaNet::XPSocket | [friend]
~XPSocket() | RNReplicaNet::XPSocket | [virtual]
~XPSocketUrgent() (defined in RNReplicaNet::XPSocketUrgent) | RNReplicaNet::XPSocketUrgent | [inline, virtual]

Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Member List

RNReplicaNet::XPStream Member List

This is the complete list of members for RNReplicaNet::XPStream, including all inherited members.

Accept(void) | RNReplicaNet::XPStream |
Close() | RNReplicaNet::XPStream |
Connect(const XPAddress &addr) | RNReplicaNet::XPSocket |
Create() | RNReplicaNet::XPStream | [virtual]
GetAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetLastError(void) | RNReplicaNet::XPSocket | [static]
GetMaxPacketSize(void) | RNReplicaNet::XPStream | [inline]
GetPeerAddress(XPAddress *const addr) | RNReplicaNet::XPSocket |
GetSocketPointer(void) | RNReplicaNet::XPSocket |
IsAlive(void) | RNReplicaNet::XPSocket |
Listen(const int port=XPSOCK_PORT_ANY) | RNReplicaNet::XPSocket |
MutateSocket(XPSocket *socket) | RNReplicaNet::XPSocket |
Recv(char *const data, const int maxlen) | RNReplicaNet::XPStream |
Send(const char *data, const int len) | RNReplicaNet::XPStream |
RNReplicaNet::XPSocket::Send(const char *data) | RNReplicaNet::XPSocket |
SetRecvBuffer(const int size) | RNReplicaNet::XPSocket |
SetSendBuffer(const int size) | RNReplicaNet::XPSocket |
XPSocket() | RNReplicaNet::XPSocket |
XPSocketUrgent (defined in RNReplicaNet::XPSocket) | RNReplicaNet::XPSocket | [friend]
XPStream() | RNReplicaNet::XPStream |
~XPSocket() | RNReplicaNet::XPSocket | [virtual]
~XPStream() | RNReplicaNet::XPStream | [virtual]

Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Class Members - Functions

  • Accept() : RNReplicaNet::XPStream, RNReplicaNet::XPSocket
  • Close() : RNReplicaNet::XPStream, RNReplicaNet::XPSocket
  • Connect() : RNReplicaNet::XPSocket
  • Create() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • Export() : RNReplicaNet::XPAddress
  • GetAddress() : RNReplicaNet::XPSocket
  • GetLastError() : RNReplicaNet::XPSocket
  • GetMaxPacketSize() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • GetPeerAddress() : RNReplicaNet::XPSocket
  • GetSocketPointer() : RNReplicaNet::XPSocket
  • IsAlive() : RNReplicaNet::XPSocket
  • Listen() : RNReplicaNet::XPSocket
  • MakeBroadcast() : RNReplicaNet::XPSocketUrgent
  • MutateSocket() : RNReplicaNet::XPSocket
  • ProcessACKS() : RNReplicaNet::XPSocketUrgent
  • Recv() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • Send() : RNReplicaNet::XPStream, RNReplicaNet::XPSocketUrgent, RNReplicaNet::XPSocket
  • SendWithACK() : RNReplicaNet::XPSocketUrgent
  • SetRawMode() : RNReplicaNet::XPSocketUrgent
  • SetRecvBuffer() : RNReplicaNet::XPSocket
  • SetSendBuffer() : RNReplicaNet::XPSocket
  • XPAddress() : RNReplicaNet::XPAddress
  • XPSocket() : RNReplicaNet::XPSocket
  • XPStream() : RNReplicaNet::XPStream
  • ~XPSocket() : RNReplicaNet::XPSocket
  • ~XPStream() : RNReplicaNet::XPStream
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: Class Members - Variables

  • addr : RNReplicaNet::XPAddress
  • port : RNReplicaNet::XPAddress
Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: File Members - Defines

  • NO_NAGLE : XPSocket.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: File Members - Functions

x

- x -

  • XPSock_Accept() : XPSocket.cpp
  • XPSock_Close() : XPSocket.cpp
  • XPSock_Connect() : XPSocket.cpp
  • XPSock_Create() : XPSocket.cpp
  • XPSock_GetAddress() : XPSocket.cpp
  • XPSock_GetHardwareStatus() : XPSocket.cpp
  • XPSock_GetHostAddress() : XPSocket.cpp
  • XPSock_GetHostName() : XPSocket.cpp
  • XPSock_GetPeerAddress() : XPSocket.cpp
  • XPSock_Init() : XPSocket.cpp
  • XPSock_Listen() : XPSocket.cpp
  • XPSock_ProcessACKS() : XPSocket.cpp
  • XPSock_Quit() : XPSocket.cpp
  • XPSock_Recv() : XPSocket.cpp
  • XPSock_RecvHistogram() : XPSocket.cpp
  • XPSock_Resolve() : XPSocket.cpp
  • XPSock_Send() : XPSocket.cpp
  • XPSock_SentHistogram() : XPSocket.cpp
  • XPSock_SetRecvBuffer() : XPSocket.cpp
  • XPSock_SetSendBuffer() : XPSocket.cpp
  • XPSock_TranslateError() : XPSocket.cpp
  • XPSock_TranslateErrorLong() : XPSocket.cpp
  • XPSock_UrgentCreate() : XPSocket.cpp
  • XPSock_UrgentListen() : XPSocket.cpp
  • XPSock_UrgentMakeBroadcast() : XPSocket.cpp
  • XPSock_UrgentRecv() : XPSocket.cpp
  • XPSock_UrgentSend() : XPSocket.cpp
  • XPSock_UrgentSendWithACK() : XPSocket.cpp
  • XPSock_UrgentSetRawMode() : XPSocket.cpp
  • XPSock_UtilityChecksum() : XPSocket.cpp
  • XPSock_UtilityGetFragment() : XPSocket.cpp
  • XPSock_UtilityGetInt() : XPSocket.cpp
  • XPSock_UtilityGetShort() : XPSocket.cpp
  • XPSock_UtilitySetInt() : XPSocket.cpp
  • XPSock_UtilitySetShort() : XPSocket.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: File Members - Variables

  • asocket_lasterror : XPSocket.cpp
  • asocket_packets_got : XPSocket.cpp
  • asocket_packets_got_size : XPSocket.cpp
  • asocket_packets_sent : XPSocket.cpp
  • asocket_packets_sent_size : XPSocket.cpp
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! A template class */
template<class T> class Templ { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented
                  public Templ<int>
{
  private:
    Used *m_usedClass;
};
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 240 this will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled black box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
The arrows have the following meaning:
  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
Generated on Sun Oct 30 01:12:24 2005 for XPSockets by doxygen 1.4.1


XPSockets: Member List

RNReplicaNet::XPAddress Member List

This is the complete list of members for RNReplicaNet::XPAddress, including all inherited members.

addr | RNReplicaNet::XPAddress
Export(void) | RNReplicaNet::XPAddress
port | RNReplicaNet::XPAddress
XPAddress(std::string addr) | RNReplicaNet::XPAddress
XPAddress(const int port, unsigned char addr1, unsigned char addr2, unsigned char addr3, unsigned char addr4) | RNReplicaNet::XPAddress
XPAddress() | RNReplicaNet::XPAddress

Generated on Sun Oct 30 01:12:22 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPSocket.h Source File

XPSocket.h

00001 /* START_LICENSE_HEADER
00002
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009
00010 END_LICENSE_HEADER */
00011 /* XPSocket.h */
00012 #ifndef _XPSOCK_H_
00013 #define _XPSOCK_H_
00014
00015 #include <string>
00016
00017 namespace RNReplicaNet
00018 {
00019
00020 #define _XPSOCK_VERSION 1100
00021
00022
00023 /* Some error return defines */
00027 #define XPSOCK_EOK                  (0)
00028 #define XPSOCK_EERROR               (-1)
00029 #define XPSOCK_EWOULDBLOCK          (-2)
00030 #define XPSOCK_ECLOSED              (-3)
00031 #define XPSOCK_ENOEXIST             (-4)
00032 #define XPSOCK_ENOMEMORY            (-5)
00033 #define XPSOCK_ENOTASOCKET          (-6)
00034 #define XPSOCK_ECANTLISTEN          (-7)
00035 #define XPSOCK_ENOTALISTEN          (-8)
00036 #define XPSOCK_ENOTCONNECTED        (-9)
00037 #define XPSOCK_EBUFFEROVERFLOW      (-10)
00038 #define XPSOCK_EUDPSENDFAILED       (-11)
00039 #define XPSOCK_ECANTBIND            (-12)
00040 #define XPSOCK_ECANTRESOLVE         (-13)
00041 #define XPSOCK_EURGENTTOOBIG        (-14)
00042 #define XPSOCK_BUFFERTOOSMALL       (-15)
00043 #define XPSOCK_ILLEGALOPERATION     (-16)
00044 #define XPSOCK_ECONNINPROGRESS      (-17)
00045 #define XPSOCK_ESTACKSTARTFAILURE   (-18)
00047 #define pXPSOCK_EERROR  ((t_XPSocket *) XPSOCK_EERROR)
00049 /* Probable XP socket types */
00050 #define XPSOCK_TLOCALHOST   (0)
00051 #define XPSOCK_TINET        (1)
00052
00053 /* XP socket status */
00054 #define XPSOCK_SNULL        (0)
00055 #define XPSOCK_SLISTEN      (1)
00056 #define XPSOCK_SCONNECT     (2)
00057 #define XPSOCK_SCLOSE       (3)
00058
00059 /* Flags to pass to XPSock_Recv */
00060 #define XPSOCK_FNULL            (0)
00061 #define XPSOCK_FPEEK            (1)
00063 #define XPSOCK_FACK             (2)
00066 #define XPSOCK_PORT_ANY         (0)
00067 #define XPSOCK_PORT_LOCAL       (-1)
00069 #define XPSOCK_MAXPACKETSIZE    (8192)
00071 #define XPSOCK_URGENTMAXPACKETSIZE  (2048)
00073 /* Some constants for the local loop back sockets */
00074 #define XPSOCK_LOOPBACKBUFFER   20480
00075
00076 /* Flags returned by XPSock_GetHardwareStatus */
00077 #define XPSOCK_HARDWARE_AVAILABLE           (1<<0)
00078 #define XPSOCK_HARDWARE_CABLE_CONNECTED     (1<<1)
00079 #define XPSOCK_HARDWARE_10MBS               (1<<2)
00080 #define XPSOCK_HARDWARE_100MBS              (1<<3)
00081 #define XPSOCK_HARDWARE_FULL_DUPLEX         (1<<4)
00082 #define XPSOCK_HARDWARE_HALF_DUPLEX         (1<<5)
00083
00084
00085 /* Structs and their type defs */
00086
00090 struct XPAddress
00091 {
00095     XPAddress(std::string addr);
00096
00100     XPAddress(const int port,unsigned char addr1,unsigned char addr2,unsigned char addr3,unsigned char addr4);
00101
00105     XPAddress();
00106
00111     std::string Export(void);
00112
00113     int port;
00114     unsigned char addr[4];
00115 };
00116 typedef struct XPAddress t_XPAddress;
00117 typedef struct XPAddress XPAddress;
00118
00119 /* A useful operator to compare addresses */
00120 inline bool operator== (const t_XPAddress& a,const t_XPAddress& b)
00121 {
00122     return (a.addr[0] == b.addr[0]) && (a.addr[1] == b.addr[1]) && (a.addr[2] == b.addr[2]) && (a.addr[3] == b.addr[3])/* && (a.port == b.port)*/;
00123 }
00124
00125 inline bool operator!= (const t_XPAddress& a,const t_XPAddress& b)
00126 {
00127     return !(a == b);
00128 }
00129
00130 typedef struct s_XPSocket t_XPSocket;
00131
00132 typedef struct s_XPSocket {
00133     int type;
00134     int state;
00135     int total_sent;
00136     int total_received;
00137     int total_accepts;
00138     int total_connects;
00139     int urgent;
00140     t_XPAddress addr;
00141     int wins_socket;
00142     t_XPSocket *loopback_socket;
00143     char *loopback_recvbuffer;
00144     int loopback_recvpos;
00145     int loopback_readpos;
00146     int loopback_pending;
00147     int port;
00148     } t_XPSocket;
00150 typedef struct s_XPErrorTranslate {
00151     int error;
00152     char *text;
00153     char *longtext;
00154     } t_XPErrorTranslate;
00156 /* Macros to make life easier */
00157 #define XPSOCK_PARANOID(x)  if ((x) == NULL || (x) == pXPSOCK_EERROR)\
00158     {\
00159         asocket_lasterror = XPSOCK_ENOTASOCKET;\
00160         return XPSOCK_EERROR;\
00161     }
00162
00163
00164 #define XPSOCK_S_PARANOID(x)    if ((x) == NULL || (x) == pXPSOCK_EERROR)\
00165     {\
00166         asocket_lasterror = XPSOCK_ENOTASOCKET;\
00167         return (t_XPSocket *) XPSOCK_EERROR;\
00168     }
00169
00170 } // namespace RNXPSockets
00171
00172 // Return error values are either pXPSOCK_EERROR, XPSOCK_EERROR or pXPSOCK_EOK
00173
00174 /* All the global functions */
00175 extern int XPSock_Init(void);
00176 extern int XPSock_Quit(void);
00177 extern RNReplicaNet::t_XPSocket *XPSock_Create(void);
00178 extern int XPSock_SetSendBuffer(RNReplicaNet::t_XPSocket * /*socket*/,int /*size*/);
00179 extern int XPSock_SetRecvBuffer(RNReplicaNet::t_XPSocket * /*socket*/,int /*size*/);
00180 extern int XPSock_Connect(RNReplicaNet::t_XPSocket * /*socket*/,const RNReplicaNet::t_XPAddress * /*addr*/);
00181 extern int XPSock_Send(RNReplicaNet::t_XPSocket * /*socket*/,const char * /*data*/,const int /*len*/);
00182 extern int XPSock_Recv(RNReplicaNet::t_XPSocket * /*socket*/,char * /*data*/,int /*maxlen*/,int /*flag*/);
00183 extern int XPSock_Close(RNReplicaNet::t_XPSocket * /*socket*/);
00184 extern int XPSock_Listen(RNReplicaNet::t_XPSocket * /*socket*/,int /*port*/);
00185 extern RNReplicaNet::t_XPSocket *XPSock_Accept(RNReplicaNet::t_XPSocket * /*socket*/);
00186
00187 extern int XPSock_GetAddress(RNReplicaNet::t_XPSocket * /*socket*/,RNReplicaNet::t_XPAddress * /*addr*/);
00188 extern int XPSock_GetPeerAddress(RNReplicaNet::t_XPSocket * /*socket*/,RNReplicaNet::t_XPAddress * /*addr*/);
00189
00190 extern int XPSock_UrgentSetRawMode(RNReplicaNet::t_XPSocket * /*socket*/,bool /*RawMode*/);
00191 extern RNReplicaNet::t_XPSocket *XPSock_UrgentCreate(int /*port*/);
00192 extern int XPSock_UrgentMakeBroadcast(RNReplicaNet::t_XPSocket * /*socket*/);
00193 extern int XPSock_ProcessACKS(void);
00194 extern int XPSock_UrgentSendWithACK(RNReplicaNet::t_XPSocket * /*socket*/,const char * /*data*/,int /*len*/,const RNReplicaNet::t_XPAddress * /*addr*/);
00195 extern int XPSock_UrgentSend(RNReplicaNet::t_XPSocket * /*socket*/,const char * /*data*/,int /*len*/,const RNReplicaNet::t_XPAddress * /*addr*/);
00196 extern int XPSock_UrgentRecv(RNReplicaNet::t_XPSocket * /*socket*/,char *const /*data*/,int /*maxlen*/,int /*flag*/,RNReplicaNet::t_XPAddress *const /*addr*/);
00197 extern int XPSock_UrgentListen(RNReplicaNet::t_XPSocket * /*socket*/);
00198
00199 extern char *XPSock_TranslateError(int /*errno*/);
00200 extern char *XPSock_TranslateErrorLong(int /*errno*/);
00201
00202 extern int XPSock_GetHostName(char * /*name*/,int /*name_len*/);
00203 extern int XPSock_GetHostAddress(RNReplicaNet::XPAddress * /*addr*/);
00204 extern int XPSock_Resolve(RNReplicaNet::t_XPAddress * /*resolve*/,const char * /*input*/);
00205
00206 extern int XPSock_UtilityGetFragment(char * /*buffer*/,int /*maxlen*/);
00207 extern int XPSock_UtilityGetInt(char * /*buffer*/,int /*offset*/);
00208 extern void XPSock_UtilitySetInt(char * /*buffer*/,int /*offset*/,int /*value*/);
00209 extern short XPSock_UtilityGetShort(char * /*buffer*/,int /*offset*/);
00210 extern void XPSock_UtilitySetShort(char * /*buffer*/,int /*offset*/,short /*value*/);
00211
00212 extern int XPSock_UtilityChecksum(char * /*buffer*/,int /*length*/);
00213
00214 extern void XPSock_Poll(void);
00215
00216 extern void XPSock_SentHistogram(unsigned int * /*classes*/,int /*numClasses*/);
00217 extern void XPSock_RecvHistogram(unsigned int * /*classes*/,int /*numClasses*/);
00218
00219 extern int XPSock_GetHardwareStatus(void);
00220
00221 // The global variables
00222 extern int asocket_lasterror;
00224 /* Extern the counters */
00225 extern int  asocket_packets_got;
00226 extern int  asocket_packets_sent;
00227 extern int  asocket_packets_got_size;
00228 extern int  asocket_packets_sent_size;
00230 // Only use these if you know exactly what you are doing
00231 extern bool gXPSock_PacketLossEmulation;
00232 extern float gXPSock_PacketLossEmulationPercent;
00233 extern bool gXPSock_PacketLatencyEmulation;
00234 extern float gXPSock_PacketLatencyEmulationBase;
00235 extern float gXPSock_PacketLatencyEmulationJitter;
00236
00237 #endif
00238
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPSocketClass.h Source File

XPSocketClass.h

00001 /* START_LICENSE_HEADER
00002
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009
00010 END_LICENSE_HEADER */
00011 /* A class implementation of the C style XPSocket library */
00012 #ifndef __XPSOCKETCLASS_H__
00013 #define __XPSOCKETCLASS_H__
00014
00015 #include "XPSocket.h"
00016
00017 namespace RNReplicaNet
00018 {
00019
00027 class XPSocket
00028 {
00029 public:
00030 friend class XPSocketUrgent;
00031 //friend class XPStream;
00036     XPSocket();
00037
00042     virtual ~XPSocket();
00043
00048     static int GetLastError(void);
00049
00054     virtual int Create(void);
00055
00061     int Connect(const XPAddress &addr);
00062
00068     int Send(const char *data);
00069
00076     int Send(const char *data,const int len);
00077
00084     int Recv(char *const data,const int maxlen);
00085
00090     int Close(void);
00091
00097     int Listen(const int port = XPSOCK_PORT_ANY);
00098
00103     XPSocket *Accept(void);
00104
00110     int SetSendBuffer(const int size);
00111
00117     int SetRecvBuffer(const int size);
00118
00124     int GetAddress(XPAddress *const addr);
00125
00131     int GetPeerAddress(XPAddress *const addr);
00132
00137     static int GetMaxPacketSize(void)   {return XPSOCK_MAXPACKETSIZE;};
00138
00144     int MutateSocket(XPSocket *socket);
00145
00150     bool IsAlive(void);
00151
00156     t_XPSocket *GetSocketPointer(void);
00157
00158 private:
00159
00160     t_XPSocket *mSocket;
00162     enum SocketState
00163     {
00164         TypeUndefined = 0,
00165         TypeTCP = 1,
00166         TypeUDP = 2
00167     };
00169     SocketState mSocketState;
00170 };
00171
00172 /* To implement */
00173 #if 0
00174
00175 extern char *XPSock_TranslateError(int /*errno*/);
00176 extern char *XPSock_TranslateErrorLong(int /*errno*/);
00177
00178 extern int XPSock_GetHostName(char * /*name*/,int /*name_len*/);
00179 extern int XPSock_Resolve(t_XPAddress * /*resolve*/,char * /*input*/);
00180
00181 extern int XPSock_UtilityGetFragment(char * /*buffer*/,int /*maxlen*/);
00182 extern int XPSock_UtilityGetInt(char * /*buffer*/,int /*offset*/);
00183 extern void XPSock_UtilitySetInt(char * /*buffer*/,int /*offset*/,int /*value*/);
00184 extern short XPSock_UtilityGetShort(char * /*buffer*/,int /*offset*/);
00185 extern void XPSock_UtilitySetShort(char * /*buffer*/,int /*offset*/,short /*value*/);
00186 #endif
00187
00188 /* A macro to make our life easier */
00189 #define SOCKET_ASSERT_TYPE(x) \
00190     if (mSocketState == (x))    \
00191     {   \
00192         assert(0 && "XPSOCK_ILLEGALOPERATION"); \
00193         asocket_lasterror = XPSOCK_ILLEGALOPERATION;    \
00194         return XPSOCK_EERROR;   \
00195     }   \
00196     if ((x) == TypeUDP) \
00197     {   \
00198         mSocketState = TypeTCP; \
00199     }   \
00200     else    \
00201     {   \
00202         mSocketState = TypeUDP; \
00203     }
00204
00205 #define SOCKET_ASSERT_TYPEP(x) \
00206     if (mSocketState == (x))    \
00207     {   \
00208         assert(0 && "XPSOCK_ILLEGALOPERATION"); \
00209         asocket_lasterror = XPSOCK_ILLEGALOPERATION;    \
00210         return pcXPSOCK_EERROR; \
00211     }   \
00212     if ((x) == TypeUDP) \
00213     {   \
00214         mSocketState = TypeTCP; \
00215     }   \
00216     else    \
00217     {   \
00218         mSocketState = TypeUDP; \
00219     }
00220
00221 #define pcXPSOCK_EERROR  ((XPSocket *) XPSOCK_EERROR)
00223 } // namespace RNXPSockets
00224
00225 #endif
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPSockets.h Source File

XPSockets.h

00001 /* START_LICENSE_HEADER
00002
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009
00010 END_LICENSE_HEADER */
00011 #ifndef __XPSOCKETS_H__
00012 #define __XPSOCKETS_H__
00013
00014 #define _XPSOCKETS_VERSION 2000
00015
00016 #include "RNXPSockets/Inc/XPSocket.h"
00017 #include "RNXPSockets/Inc/XPSocketClass.h"
00018 #include "RNXPSockets/Inc/XPSocketUrgentClass.h"
00019 #include "RNXPSockets/Inc/XPStream.h"
00020
00021 #endif
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPSocketUrgentClass.h Source File

XPSocketUrgentClass.h

00001 /* START_LICENSE_HEADER
00002
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009
00010 END_LICENSE_HEADER */
00011 #ifndef __XPSOCKETURGENTCLASS_H__
00012 #define __XPSOCKETURGENTCLASS_H__
00013
00014 #include "XPSocketClass.h"
00015
00016 namespace RNReplicaNet
00017 {
00018
00025 class XPSocketUrgent : public XPSocket
00026 {
00027 public:
00028     XPSocketUrgent() {};
00029     virtual ~XPSocketUrgent() {};
00030
00038     int Create(const int port = XPSOCK_PORT_ANY);
00039
00045     int SetRawMode(const bool RawMode = true);
00046
00051     int MakeBroadcast(void);
00052
00058     int ProcessACKS(void);
00059
00069     int SendWithACK(const char *data,const int len,const XPAddress &addr);
00070
00076     int Send(const char *data,const XPAddress &addr);
00077
00086     int Send(const char *data,const int len,const XPAddress &addr);
00087
00095     int Recv(char *const data,const int maxlen,XPAddress *const addr);
00096
00101     static int GetMaxPacketSize(void)   {return XPSOCK_URGENTMAXPACKETSIZE;};
00102
00103 private:
00104 };
00105
00106 } // namespace RNXPSockets
00107
00108 #endif
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1


XPSockets: XPStream.h Source File

XPStream.h

00001 /* START_LICENSE_HEADER
00002
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001-2005 Replica Software
00005
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009
00010 END_LICENSE_HEADER */
00011 #ifndef __XPSTREAM_H__
00012 #define __XPSTREAM_H__
00013
00014 #include "XPSocketClass.h"
00015
00016 namespace RNReplicaNet
00017 {
00018
00026 class XPStream : public XPSocket
00027 {
00028 public:
00033     XPStream();
00034
00039     virtual ~XPStream();
00040
00045     int Create();
00046
00051     int Close();
00052
00057     XPStream *Accept(void);
00058
00065     int Send(const char *data,const int len);
00066
00073     int Recv(char *const data,const int maxlen);
00074
00079     int GetMaxPacketSize(void)  {return XPSOCK_MAXPACKETSIZE-2;};   /* Why -2 because each stream packet uses 2 bytes to describe the original length */
00080
00081 private:
00082     char *mTempBuffer;
00083     char *mBuffer;
00084     int mPacketBlocks;
00085     int mBufferEndPoint;
00086     int mBufferStartPoint;
00087     int mBufferSize;
00088 };
00089
00090 } // namespace RNXPSockets
00091
00092 #endif
Generated on Sun Oct 30 01:12:21 2005 for XPSockets by doxygen 1.4.1