Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIPC_MESSAGE_H
Toshihiro Shimizu 890ddd
#define TIPC_MESSAGE_H
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// Toonz includes
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// 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
Shinya Kitaoka 120a6e
namespace tipc {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
//    TIPC Message Parser declaration
Toshihiro Shimizu 890ddd
//********************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class MessageParser {
Shinya Kitaoka 120a6e
  friend class Server;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QLocalSocket *m_socket;
Shinya Kitaoka 120a6e
  tipc::Stream *m_stream;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  virtual QString header() const        = 0;
Shinya Kitaoka 120a6e
  virtual void operator()(Message &msg) = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QLocalSocket *socket() { return m_socket; }
Shinya Kitaoka 120a6e
  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
Shinya Kitaoka 120a6e
enum DefMsgEnum {
Shinya Kitaoka 120a6e
  SHMEM_REQUEST,
Shinya Kitaoka 120a6e
  SHMEM_RELEASE,
Shinya Kitaoka 120a6e
  TMPFILE_REQUEST,
Shinya Kitaoka 120a6e
  TMPFILE_RELEASE,
Shinya Kitaoka 120a6e
  QUIT_ON_ERROR
Shinya Kitaoka 120a6e
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <defmsgenum msgtype=""></defmsgenum>
Shinya Kitaoka d1f6c4
class DVAPI DefaultMessageParser final : public MessageParser {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 473e70
  QString header() const override;
Shinya Kitaoka 473e70
  void operator()(Message &msg) override;
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
Shinya Kitaoka 120a6e
}  // namespace tipc
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // TIPC_MESSAGE_H