Documentation of the code done by Sam
This commit is contained in:
parent
407f3c5c9a
commit
3c681352da
|
@ -13,6 +13,10 @@ namespace Oyster
|
||||||
class IQueue
|
class IQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//---------------------------------------------
|
||||||
|
//standard operations of the std::queue
|
||||||
|
//---------------------------------------------
|
||||||
virtual ~IQueue() {};
|
virtual ~IQueue() {};
|
||||||
virtual void Push( Type item ) = 0;
|
virtual void Push( Type item ) = 0;
|
||||||
virtual Type Pop() = 0;
|
virtual Type Pop() = 0;
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Thread safe queue implemented
|
// Thread safe queue implemented
|
||||||
// with single linked list.
|
// with single linked list and template.
|
||||||
|
// uses mutex to lock the queue
|
||||||
|
// otherwise its a standard queue
|
||||||
// Created by Sam Svensson 2013
|
// Created by Sam Svensson 2013
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Oyster
|
||||||
Connection( int socket ) { this->socket = socket; };
|
Connection( int socket ) { this->socket = socket; };
|
||||||
virtual ~Connection();
|
virtual ~Connection();
|
||||||
|
|
||||||
|
|
||||||
virtual int InitiateServer( unsigned short port );
|
virtual int InitiateServer( unsigned short port );
|
||||||
virtual int InitiateClient();
|
virtual int InitiateClient();
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ namespace Oyster
|
||||||
|
|
||||||
virtual int Disconnect();
|
virtual int Disconnect();
|
||||||
virtual int Connect( unsigned short port , const char serverName[] );
|
virtual int Connect( unsigned short port , const char serverName[] );
|
||||||
|
|
||||||
virtual int Listen();
|
virtual int Listen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -14,13 +14,25 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int Disconnect() = 0;
|
|
||||||
|
//sends and recieve functions with bytearrays,
|
||||||
|
//will send to the users connection via socket
|
||||||
virtual int Send( OysterByte& bytes ) = 0;
|
virtual int Send( OysterByte& bytes ) = 0;
|
||||||
virtual int Recieve( OysterByte& bytes) = 0;
|
virtual int Recieve( OysterByte& bytes) = 0;
|
||||||
|
|
||||||
|
//initiates sockets and address for server and client
|
||||||
virtual int InitiateServer( unsigned short port ) { return false; };
|
virtual int InitiateServer( unsigned short port ) { return false; };
|
||||||
virtual int InitiateClient() { return false; };
|
virtual int InitiateClient() { return false; };
|
||||||
|
|
||||||
|
//Listen function to let client connect, only used by the server
|
||||||
virtual int Listen() { return -1; };
|
virtual int Listen() { return -1; };
|
||||||
|
|
||||||
|
//enables the client to connect with a server with use of name and port
|
||||||
|
//(servers uses Listen instead of connect)
|
||||||
virtual int Connect( unsigned short port, const char serverName[] ) { return false; };
|
virtual int Connect( unsigned short port, const char serverName[] ) { return false; };
|
||||||
|
|
||||||
|
//Disconnects the client or server TODO: optimize!
|
||||||
|
virtual int Disconnect() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//packs and unpacks packages for sending or recieving over the connection
|
||||||
virtual void Pack (Protocols::ProtocolHeader &header, OysterByte& bytes) = 0;
|
virtual void Pack (Protocols::ProtocolHeader &header, OysterByte& bytes) = 0;
|
||||||
virtual void Unpack (Protocols::ProtocolSet* set, OysterByte& bytes ) = 0;
|
virtual void Unpack (Protocols::ProtocolSet* set, OysterByte& bytes ) = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
#ifndef NETWORK_DEPENDENCIES_PROTOCOLS_H
|
#ifndef NETWORK_DEPENDENCIES_PROTOCOLS_H
|
||||||
#define NETWORK_DEPENDENCIES_PROTOCOLS_H
|
#define NETWORK_DEPENDENCIES_PROTOCOLS_H
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Created by Sam Svensson 2013 //
|
// Created by Sam Svensson 2013
|
||||||
//////////////////////////////////
|
// Holder structs for our protocols
|
||||||
|
// with the use of union.
|
||||||
|
// each packagetyp
|
||||||
|
// is linked to a protocol
|
||||||
|
//////////////////////////////////////
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue