Esempio n. 1
0
m_userinfo const      *Packet_v1_UserInfo::getUserInfo() const
{
  assert(getRequestId() == USERINFO_GETINFO_RESPONSE_OK);
  m_userinfo const    * unserialized =
    unserialize(reinterpret_cast<char const *>(getData(PROTOV1_USERINFO_START_OF_DATA, PROTOV1_USERINFO_DATA_USERINFO)));
  return unserialized;
}
Esempio n. 2
0
void            Packet_v1_UserInfo::setAvatar(char const *avatar)
{
  assert(getRequestId() == USERINFO_GETAVATAR_RESPONSE_OK);
  appendData(PROTOV1_USERINFO_START_OF_DATA,
	     PROTOV1_USERINFO_DATA_AVATAR,
	     reinterpret_cast<byte_t const *>(avatar));
}
Esempio n. 3
0
void            Packet_v1_UserInfo::setUserInfo(m_userinfo const *userinfo)
{
  assert(getRequestId() == USERINFO_GETINFO_RESPONSE_OK);
  char const	* serialized = serialize(userinfo);

  appendData(PROTOV1_USERINFO_START_OF_DATA, PROTOV1_USERINFO_DATA_USERINFO, reinterpret_cast<byte_t const *>(serialized));
}
Esempio n. 4
0
void		Packet_v1::Print_v1(std::string const & componentName, Manager const * manager) const
{
  Print_base();
  std::cout << "[COMPONENTID: " << componentName << " {" << PROTOV1_COMPONENTID_SIZE << "}]"
	    << "[REQUESTID: ";
  COLOR_REVERSE_START;
  std::cout << manager->getRegisteredRequestName(getComponentId(), getRequestId());
  std::cout << " {" << PROTOV1_REQUESTID_SIZE << "}]"
	    << "[SESSIONID: " << getSessionId() << " {" << PROTOV1_SESSIONID_SIZE << "}]"
	    << std::endl;
}
Esempio n. 5
0
EnviJSONRPC::EnviJSONRPC(var data, const bool isRequest)
{
	if (isRequest)
	{
		request 	= data;
		response 	= empty();
		setResponseId (getRequestId());
	}
	else
	{
		request 	= empty();
		response 	= data;
	}
}
Esempio n. 6
0
EnviJSONRPC::EnviJSONRPC(const String &initialData, const bool isRequest)
{
	if (isRequest)
	{
		request 	= JSON::fromString(initialData);
		response 	= empty(true,true);
		setResponseId (getRequestId());
	}
	else
	{
		request 	= empty(true,false);
		response 	= JSON::fromString(initialData);
	}
}
Esempio n. 7
0
void		Packet_v1_Channel::Print_v1_Channel(std::string const &componentName, Manager const * manager) const
{
  Print_v1(componentName, manager);
  std::cout << "[CHANNELID: " << getChannelId() << " {" << PROTOV1_CHANNEL_CHANNELID_SIZE << "}]"
	    << "[CLIENTSESSIONID: " << getClientSessionId() << "{" << PROTOV1_CHANNEL_CLIENTSESSIONID_SIZE << "}]"
	    << std::endl;
  int id = getRequestId();
  if (id == CHANNEL_JOIN || id == CHANNEL_JOIN_OK || id == CHANNEL_JOIN_NOK_ALREADYINCHAN ||
      id == CHANNEL_JOINED || id == CHANNEL_LEAVE_OK || id == CHANNEL_LEAVED)
    std::cout << "# ChannelName: '" << getChannelName() << "'" << std::endl;
  if (id == CHANNEL_JOINED || id == CHANNEL_LEAVED)
    std::cout << "# Login: '******'" << std::endl;
  if (id == CHANNEL_MESSAGE || id == CHANNEL_MESSAGE_RECV)
    std::cout << "# Message: '" << getMessage() << "'" << std::endl;    
}
Esempio n. 8
0
char const	*Packet_v1_Channel::getChannelName() const
{
  assert(getRequestId() == CHANNEL_JOIN ||
	 getRequestId() == CHANNEL_JOIN_OK ||
         getRequestId() == CHANNEL_JOIN_NOK_ALREADYINCHAN ||
         getRequestId() == CHANNEL_JOINED ||
         getRequestId() == CHANNEL_LEAVED ||
         getRequestId() == CHANNEL_LEAVE_OK);
  return reinterpret_cast<char const *>(getData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_CHANNEL_NAME));
}
Esempio n. 9
0
void		Packet_v1_Channel::setChannelName(char const * name)
{
  assert(getRequestId() == CHANNEL_JOIN ||
	 getRequestId() == CHANNEL_JOIN_OK ||
	 getRequestId() == CHANNEL_JOIN_NOK_ALREADYINCHAN ||
         getRequestId() == CHANNEL_JOINED ||
         getRequestId() == CHANNEL_LEAVED ||
	 getRequestId() == CHANNEL_LEAVE_OK);
  appendData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_CHANNEL_NAME, reinterpret_cast<byte_t const *>(name));
}
Esempio n. 10
0
char const      *Packet_v1_UserInfo::getAvatar() const
{
  assert(getRequestId() == USERINFO_GETAVATAR_RESPONSE_OK);
  return reinterpret_cast<char const *>(getData(PROTOV1_USERINFO_START_OF_DATA, PROTOV1_USERINFO_DATA_AVATAR));
}
Esempio n. 11
0
char const	*Packet_v1_Channel::getMessage() const
{
  assert(getRequestId() == CHANNEL_MESSAGE || getRequestId() == CHANNEL_MESSAGE_RECV);
  return reinterpret_cast<char const *>(getData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_MESSAGE));
}
Esempio n. 12
0
void		Packet_v1_Channel::setMessage(char const * message)
{
  assert(getRequestId() == CHANNEL_MESSAGE || getRequestId() == CHANNEL_MESSAGE_RECV);
  appendData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_MESSAGE, reinterpret_cast<byte_t const *>(message));
}
Esempio n. 13
0
char const	*Packet_v1_Channel::getClientLogin() const
{
  assert(getRequestId() == CHANNEL_JOINED ||
	 getRequestId() == CHANNEL_LEAVED);
  return reinterpret_cast<char const *>(getData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_LOGIN));
}
Esempio n. 14
0
void		Packet_v1_Channel::setClientLogin(char const *login)
{
  assert(getRequestId() == CHANNEL_JOINED ||
	 getRequestId() == CHANNEL_LEAVED);
  appendData(PROTOV1_CHANNEL_START_OF_DATA, PROTOV1_CHANNEL_DATA_LOGIN, reinterpret_cast<byte_t const *>(login));
}