You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
/******************************************************************************
|
|
Copyright(C):2015~2018 hzleaper
|
|
FileName:$FILE_BASE$.$FILE_EXT$
|
|
Author:zhikun wu
|
|
Email:zk.wu@hzleaper.com
|
|
Tools:vs2010 pc on company
|
|
Created:$DATE$
|
|
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
|
|
*******************************************************************************/
|
|
#ifndef __TP_NET_SERVER_H
|
|
#define __TP_NET_SERVER_H
|
|
|
|
#include "zclasses.h"
|
|
#include "tpProtocol.h"
|
|
|
|
typedef struct tagTP_NET_SERVER_PARAM{
|
|
class INetServerCallback* pCallback;
|
|
const char* szJsonText;//toJsonObject
|
|
}TP_NET_SERVER_PARAM;
|
|
#define NET_PARAM_KEY_IP "ip"
|
|
#define NET_PARAM_KEY_PORT "port"
|
|
|
|
class INetServer
|
|
{
|
|
public:
|
|
INetServer(){}
|
|
virtual ~INetServer(){}
|
|
|
|
virtual const ClientsStatusMap IGetClientsStatus() = 0;
|
|
virtual const TpServerStatus IGetServerStatus() = 0;
|
|
|
|
virtual void IStartServer() = 0;
|
|
virtual void IStopServer() = 0;
|
|
|
|
virtual void ISendMessage(const QString& strClient, TP_PROTOCOL_MESSAGE& msg) = 0;
|
|
virtual void ISendBinaryData(const QString& strClient, TP_PROTOCOL_MESSAGE& msg, QByteArray& binaryData) = 0;
|
|
};
|
|
|
|
class INetServerCallback
|
|
{
|
|
public:
|
|
INetServerCallback() {}
|
|
virtual ~INetServerCallback() {}
|
|
|
|
virtual void onServerMessageRecevied(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg) = 0;
|
|
virtual void onServerDataReceived(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData) = 0;
|
|
virtual void onServerDataSentEnd() = 0;
|
|
virtual void onClientConnected(const QString& strClient) = 0;
|
|
virtual void onClientDisconnected(const QString& strClient) = 0;
|
|
};
|
|
|
|
#endif //__TP_NET_SERVER_H
|