当前位置: 首页>>代码示例>>C++>>正文


C++ IPacket类代码示例

本文整理汇总了C++中IPacket的典型用法代码示例。如果您正苦于以下问题:C++ IPacket类的具体用法?C++ IPacket怎么用?C++ IPacket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void	BlueVexWrapper::RelayToServer(const unsigned char* bytes, int length, IProxy* proxy, IModule* module)
{
	IPacket* packet = proxy->CreatePacket(bytes, length);
    packet->SetFlag(IPacket::PacketFlag_Hidden);
	proxy->RelayDataToServer(packet,module);
	delete packet;
}
开发者ID:ChefKeeper,项目名称:bluevex,代码行数:7,代码来源:BlueVexWrapper.cpp

示例2: OnRestoreCharacter

int StateLobby::OnRestoreCharacter (IPacket &packet)
{
    if (!m_loaded)
        return MSG_ERROR_ORDER;

    std::string name = packet.Read();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    player_iterator i = FindCharacterIndex(name);

    if ( i != m_player_list.end() )
    {
        (*i)->restore();
        (*i)->set_timeleft(0);

        boost::shared_ptr<OPacket> pkt(new OPacket);
        srv_pkt::Lobby(pkt,srv_pkt::LOBBY_ACTION_RESTORE);
        m_connection->Send(pkt);

        DB::PLAYER::Restore query;
        query(m_server->DBConnection(),(*i)->ID());
    }
    else
        return MSG_ERROR_ARG;

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:29,代码来源:server_state_lobby.cpp

示例3: OnTicket

int StateGlobal::OnTicket (const IPacket &packet)
{
    Ticket ticket;

    ticket.ID = packet.Read<uint32_t>();

    ticket.usr = packet.Read();

    ticket.pw = packet.Read();

    ticket.IP = packet.Read();

    ticket.AccountID = packet.Read<uint32_t>();

    ticket.access_lv  = packet.Read<uint8_t>();

    ticket.sec_lv = packet.Read<uint8_t>();

    ticket.silk = packet.Read<uint32_t>();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    m_service->addTicket(ticket);

    return MSG_SUCCESS;
}
开发者ID:npcdoom,项目名称:ZelosOnline,代码行数:27,代码来源:state_global.cpp

示例4: SimpleLog

	void IsdnL2::DataReq(QVector<byte> l3data)
	{
        SimpleLog("DataReq from L3", m_logKinds.general);
        IPacket* pPacket = m_pInfra->CreatePacket<IPacket>();
        pPacket->Fill(l3data);
        //m_l2obj.DatReq( pPacket->Clone() );
        m_l2obj.DatReq( pPacket );
    }
开发者ID:ixc-software,项目名称:lucksi,代码行数:8,代码来源:isdnl2.cpp

示例5: decode

/**将缓冲区的数据 解码为请求,并且放置请求队列
 */
void Connection::decode(){
	IPacket *p = NULL;
	_readlock.lock();
	while(  (p = _streamer->decodeToPacket(_readbuf) ) !=NULL ){
		p->setConnection( const_cast<const Connection*>(this) );
		Transport::instance().getWritePacketQueue()->push(p);	
	}
	_readlock.unlock();
}
开发者ID:huangsusjtu,项目名称:framework,代码行数:11,代码来源:connection.cpp

示例6: OnGMCommand_AllowLogout

int StateGame::OnGMCommand_AllowLogout (IPacket &packet)
{
    std::string playerName = packet.Read();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:9,代码来源:handler_gm.cpp

示例7: OnGMCommand_RecallGuild

int StateGame::OnGMCommand_RecallGuild (IPacket &packet)
{
    std::string guildName = packet.Read();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:9,代码来源:handler_gm.cpp

示例8: OnGMCommand_LieName

int StateGame::OnGMCommand_LieName (IPacket &packet)
{
    std::string name = packet.Read();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:9,代码来源:handler_gm.cpp

示例9: PrintPacketToSyslog

void PrintPacketToSyslog (const IPacket &packet)
{
    std::stringstream ss;

    const char *buffer = (const char*)packet.buffer();

    for (int i = 0; i < packet.size(); ++i)
        ss << std::hex << std::setw(2) << std::setfill('0') << ((int)buffer[i] & 0xFF) << " ";

    syslog(LOG_DEBUG,"Hexed Packet:\n%s",ss.str().c_str());
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:11,代码来源:packet_util_functions.cpp

示例10: sendPacket

bool Server::sendPacket (IPacket& packet) {
	buffer_t b;
	packet.toBuffer (b); 

	THeader h;

	h.type = packet.getType ();
	h.size = b.size ();
	THeader* tHPtr = &h;
	send (ConnectSocket, reinterpret_cast<char*>(tHPtr), sizeof (h), 0); 
	send (ConnectSocket, &b[0], b.size(), 0);
	return true;
}
开发者ID:KrystianD,项目名称:AdminTools,代码行数:13,代码来源:serverWin.cpp

示例11: return

IPacket *PacketBuilder::build(char *data, int clientId)
{
  int opcode = *(int *)(data + 4);

  if (builder_.find(opcode) != builder_.end())
  {
    IPacket *packet;
    if ((packet = (this->*builder_[opcode])(opcode, data + HEADER_SIZE)) == nullptr)
      return (nullptr);
    packet->setClientId(clientId);
    return (packet);
  }
  return (nullptr);
}
开发者ID:alliaces,项目名称:RWars,代码行数:14,代码来源:PacketBuilder.cpp

示例12: OnWhoIs

int IStateHandshake::OnWhoIs (const IPacket &packet)
{
    std::string srvID = packet.Read();

    uint8_t resv = packet.Read<uint8_t>();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    if (resv || srvID != m_SrvID)
        return MSG_ERROR_ARG;

    OnConfig();

    return MSG_SUCCESS;
}
开发者ID:Favorek,项目名称:ZelosOnline,代码行数:16,代码来源:state_handshake.cpp

示例13: OnValidateCharacterName

int StateLobby::OnValidateCharacterName (IPacket &packet)
{
    std::string name = packet.Read();

    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    if (IsNameValid(name))
    {
        boost::shared_ptr<OPacket> pkt(new OPacket);
        srv_pkt::Lobby(pkt,srv_pkt::LOBBY_ACTION_VALIDATE_NAME);
        m_connection->Send(pkt);
    }

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:16,代码来源:server_state_lobby.cpp

示例14: OnStatsStrInc

int StateGame::OnStatsStrInc (IPacket &packet)
{
    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    boost::shared_ptr<Player> player = static_cast<srv::Connection*>(m_connection)->GetPlayer();

    if (!player)
        return MSG_ERROR;

    if  (player->get_stat())
    {
        player->inc_str();

        DB::PLAYER::Stats query;
        query(m_server->DBConnection(),player);

        boost::shared_ptr<OPacket> pkt(new OPacket);
        srv_pkt::IncStr(pkt);
        m_connection->Send(pkt);

        boost::shared_ptr<Party> party = player->get_party();

        if (party)
        {
            party->SendHPMPNotification(player->GetUniqueID(),player->hp(),player->max_hp(),player->mp(),
                player->max_mp());
        }
    }

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:32,代码来源:handler_stats.cpp

示例15: OnGMCommand_SpawnAllUniques

int StateGame::OnGMCommand_SpawnAllUniques (IPacket &packet)
{
    if (!packet.EndOfStream())
        return MSG_ERROR_SIZE;

    return MSG_SUCCESS;
}
开发者ID:ghostuser846,项目名称:eSRO,代码行数:7,代码来源:handler_gm.cpp


注:本文中的IPacket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。