/*
    Copyright 2004-2005 Electronic Arts Inc.
*/

// --- Include guard

#ifndef EA_GAMETALK_GAMETALKPROTOCOL_H
#define EA_GAMETALK_GAMETALKPROTOCOL_H

// --- Includes
#include "GameTalk/IGameTalkProtocol.h"

// --- Forward Declare
class bFunkServer;

namespace EA
{
    namespace GameTalk
    {
		class GameTalkProtocol : public IGameTalkProtocol
        {
        public:
            GameTalkProtocol(const char* const ipAddress, const int port = EA::GameTalk::IGameTalkProtocol::DEFAULT_GAMETALK_PORT);
            GameTalkProtocol(const int port = 9876);
            virtual ~GameTalkProtocol();

			virtual bool IsConnected() { return true; };
            virtual bool Send(void* buffer, size_t msgSize);
            virtual int Poll();
			virtual bool Connect();

        private:
            GameTalkProtocol(const GameTalkProtocol& nc);
            GameTalkProtocol & operator=(const GameTalkProtocol& nc);

			static void HandleBFuncMessage(const void* data, int size);

			bFunkServer* mServer;

			static GameTalkProtocol* mInstance;
        };
    }
}

#endif  //  EA_GAMETALK_GAMETALKPROTOCOL_H


