77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/*
|
|
* PVVMUD a 3D MUD
|
|
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*/
|
|
#ifndef _COMMUNICATE_H
|
|
#define _COMMUNICATE_H
|
|
|
|
#include "timekeeper.H"
|
|
#include "manager.H"
|
|
#include "stream.H"
|
|
#include "objectqueue.H"
|
|
#include "message.H"
|
|
#include "socket.H"
|
|
#include "messagelist.H"
|
|
|
|
class CBadProtocolException : public CException {
|
|
public:
|
|
CBadProtocolException();
|
|
};
|
|
|
|
class CCommunicate : public CTimeKeeperItem {
|
|
|
|
CManager * manager;
|
|
CStream * stream;
|
|
|
|
CSocket * m_socket;
|
|
CTimeKeeper * m_timeKeeper;
|
|
|
|
// Write message variables
|
|
CObjectQueue * msgWriteQueue;
|
|
CMessage *currWriteMsg;
|
|
int currWriteDelete;
|
|
|
|
// Read message variables
|
|
CMessageList * msgList;
|
|
CMessage *currReadMsg;
|
|
int readStat;
|
|
|
|
virtual int timeKeeperFD(int event);
|
|
|
|
public:
|
|
CCommunicate(CSocket * socket,CTimeKeeper * timeKeeper);
|
|
virtual ~CCommunicate();
|
|
|
|
CSocket * getSocket();
|
|
|
|
virtual void quit();
|
|
|
|
void readyToRead();
|
|
void readyToWrite();
|
|
|
|
void sendMessage(CMessage * message,int del);
|
|
|
|
void setManager(CManager * manager);
|
|
CManager * getManager();
|
|
|
|
void addMsg(MsgCreateFunc_t msgCreateFunc);
|
|
|
|
};
|
|
|
|
#endif // _COMMUNICATE_H
|