Initial Commit:

- Create single library for all Core RedA functions/classes
- Working version
This commit is contained in:
Charl Wentzel
2016-05-17 07:38:33 +02:00
commit 264169e525
11 changed files with 1033 additions and 0 deletions

42
SocketCore.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* SocketCore.h
*
* Created on: 13 May 2016
* Author: wentzelc
*/
#ifndef SOCKETCORE_H_
#define SOCKETCORE_H_
// redA Libraries
/* none */
// Standard C/C++ Libraries
/* none */
//---------------------------------------------------------------------------
// Types required for sockets
typedef enum { ctNone = 0, ctServer = 1, ctRemoteClient = 2, ctClient = 3 } ESockConnectType;
const char SockConnectTypeName[][15] = { "None", "Server", "RemoteClient", "Client" };
typedef enum { ssNone = 0, ssWaitingtoOpen = 1, ssOpen = 2, ssDataWaiting = 3, ssClosed = 4, ssFailed = 5 } ESocketState;
const char SocketStateName[][15] = { "None", "WaitingToOpen", "Open", "DataWaiting", "Closed", "Failed" };
//---------------------------------------------------------------------------
// Socket Functions
int OpenTCPserverSocket( const char *pServerName, const char *ServerAddress, int PortNo, bool KeepAlive );
int OpenTCPinClientSocket();
int OpenTCPoutClientSocket( const char *pServerName, const char *ServerAddress, int PortNo, bool KeepAlive );
ESocketState GetServerState();
ESocketState GetClientState();
bool CloseTCPSocket( ESockConnectType SocketType );
bool ReadClientSocket();
bool MaintainSocket( int PortHandle );
//---------------------------------------------------------------------------
#endif /* SOCKETCORE_H_ */