Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIPC_MESSAGE_H
Toshihiro Shimizu 890ddd
#define TIPC_MESSAGE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Toonz includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//Qt includes
Toshihiro Shimizu 890ddd
#include <qdatastream></qdatastream>
Toshihiro Shimizu 890ddd
#include <qlocalsocket></qlocalsocket>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tipc.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZCORE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace tipc
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
//    TIPC Message Parser declaration
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class MessageParser
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	friend class Server;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QLocalSocket *m_socket;
Toshihiro Shimizu 890ddd
	tipc::Stream *m_stream;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	virtual QString header() const = 0;
Toshihiro Shimizu 890ddd
	virtual void operator()(Message &msg) = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QLocalSocket *socket() { return m_socket; }
Toshihiro Shimizu 890ddd
	tipc::Stream *stream() { return m_stream; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
//    Default Message Types declaration
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum DefMsgEnum { SHMEM_REQUEST,
Toshihiro Shimizu 890ddd
				  SHMEM_RELEASE,
Toshihiro Shimizu 890ddd
				  TMPFILE_REQUEST,
Toshihiro Shimizu 890ddd
				  TMPFILE_RELEASE,
Toshihiro Shimizu 890ddd
				  QUIT_ON_ERROR };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <defmsgenum msgtype=""></defmsgenum>
Toshihiro Shimizu 890ddd
class DVAPI DefaultMessageParser : public MessageParser
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	QString header() const;
Toshihiro Shimizu 890ddd
	void operator()(Message &msg);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/* Default commands syntaxes:
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
SHMEM_REQUEST
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  Syntax: $shmem_request <shmem id=""> <nbytes></nbytes></shmem>
Toshihiro Shimizu 890ddd
  Reply: ok | err
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
SHMEM_RELEASE
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  Syntax: $shmem_release <shmem id=""></shmem>
Toshihiro Shimizu 890ddd
  Reply: ok | err
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TMPFILE_REQUEST
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  Syntax: $tmpfile_request <file id=""></file>
Toshihiro Shimizu 890ddd
  Reply: ok <file path="">\n | err</file>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TMPFILE_RELEASE
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  Syntax: $tmpfile_release <file id=""></file>
Toshihiro Shimizu 890ddd
  Reply: ok | err
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
QUIT_ON_ERROR
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  Syntax: $quit_on_error
Toshihiro Shimizu 890ddd
  Reply: ok
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} //namespace tipc
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif //TIPC_MESSAGE_H