#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 |
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.
|
Use this to turn off the Nagle packet compression algorithm |
|
Tries to accept any incoming connections and creates a connected socket if successfull.
|
|
Closes a socket
|
|
Connect to a machine address
|
|
Creates a socket
|
|
Fills in the internet address and port of a socket to the address structure.
|
|
Gets the status of the network hardware used by this socket interface.
|
|
Gets the host machine address
|
|
Gets the host machine name
|
|
Fills in the internet address of the peer of a socket to the address structure.
|
|
This inits the socket interface |
|
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.
|
|
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
|
|
Quits all sockets and exits |
|
Tries to receive data from a socket
|
|
Supplies a histogram table and the size of the table for sent packets. Each class entry corresponds to a size of packet.
|
|
Handy routine to resolve anything into an address
|
|
Tries to send data via the socket
|
|
Supplies a histogram table and the size of the table for sent packets. Each class entry corresponds to a size of packet.
|
|
Sets the size of the recv buffer for a socket
|
|
Sets the size of the send buffer for a socket
|
|
This translates an XP socket error to a text string
|
|
This translates an XP socket error to a long descriptive text string
|
|
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
|
|
Marks the urgent socket as being a server socket rather than a client socket Useless under Winsock but may be usefull for future implementation
|
|
Makes an urgent socket broadcast capable
|
|
Receives data from an urgent socket
|
|
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
|
|
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
|
|
Sets the raw mode for urgent sockets to be true or false. If true then the ACK layer will not add sequence data.
|
|
Simple function to perform a quick checksum of data
|
|
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
|
|
Extracts an int from a buffer given an offset
|
|
Extracts a short from a buffer given an offset
|
|
Encodes an int into a buffer at a given an offset
|
|
Encodes a short into a buffer at a given an offset
|
|
asocket_lasterror This contains the last error value returned from any of the socket functions |
|
Total number of packets received |
|
Total byte size of packets received |
|
Total number of packets sent |
|
Total byte size of packets sent |