Blame toonz/sources/include/ttcpip.h
|
Toshihiro Shimizu |
890ddd |
#ifndef TTCPIP_H
|
|
Toshihiro Shimizu |
890ddd |
#define TTCPIP_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
262a92 |
#include <memory></memory>
|
|
Shinya Kitaoka |
262a92 |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qstring></qstring>
|
|
Toshihiro Shimizu |
890ddd |
#include <qthread></qthread>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TFARM_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI __declspec(dllexport)
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI __declspec(dllimport)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TTcpIpServerImp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFARMAPI TTcpIpServer : public QThread
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int m_exitCode;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TTcpIpServer(int port);
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TTcpIpServer();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getPort() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void run();
|
|
Toshihiro Shimizu |
890ddd |
int shutdown();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onReceive(int socket, const QString &data) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void sendReply(int socket, const QString &reply);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getExitCode() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
262a92 |
std::shared_ptr<ttcpipserverimp> m_imp;</ttcpipserverimp>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum {
|
|
Toshihiro Shimizu |
890ddd |
OK,
|
|
Toshihiro Shimizu |
890ddd |
STARTUP_FAILED,
|
|
Toshihiro Shimizu |
890ddd |
HOST_UNKNOWN,
|
|
Toshihiro Shimizu |
890ddd |
SOCKET_CREATION_FAILED,
|
|
Toshihiro Shimizu |
890ddd |
CONNECTION_FAILED,
|
|
Toshihiro Shimizu |
890ddd |
CONNECTION_REFUSED,
|
|
Toshihiro Shimizu |
890ddd |
CONNECTION_TIMEDOUT,
|
|
Toshihiro Shimizu |
890ddd |
SEND_FAILED,
|
|
Toshihiro Shimizu |
890ddd |
RECEIVE_FAILED
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFARMAPI TTcpIpClient
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TTcpIpClient();
|
|
Toshihiro Shimizu |
890ddd |
~TTcpIpClient();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int connect(const QString &name, const QString &addr, int port, int &sock);
|
|
Toshihiro Shimizu |
890ddd |
int disconnect(int sock);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int send(int sock, const QString &data);
|
|
Toshihiro Shimizu |
890ddd |
int send(int sock, const QString &data, QString &reply);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|