Skip to content

Commit

Permalink
Packet logs have more info about decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianposton committed May 16, 2017
1 parent 006297a commit 64b87e1
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 26 deletions.
16 changes: 8 additions & 8 deletions src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6058,8 +6058,8 @@ void EQInterface::createWorldLog(void)

connect(m_packet, SIGNAL(rawWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t)),
m_worldLog, SLOT(rawStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t)));
connect(m_packet, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)),
m_worldLog, SLOT(decodedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));
connect(m_packet, SIGNAL(decryptedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
m_worldLog, SLOT(decryptedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)));
}

void EQInterface::createZoneLog(void)
Expand All @@ -6082,8 +6082,8 @@ void EQInterface::createZoneLog(void)

connect(m_packet, SIGNAL(rawZonePacket(const uint8_t*, size_t, uint8_t, uint16_t)),
m_zoneLog, SLOT(rawStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t)));
connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)),
m_zoneLog, SLOT(decodedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));
connect(m_packet, SIGNAL(decryptedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
m_zoneLog, SLOT(decryptedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)));
}

void EQInterface::createBazaarLog(void)
Expand Down Expand Up @@ -6129,10 +6129,10 @@ void EQInterface::createUnknownZoneLog(void)
m_unknownZoneLog->setView(pSEQPrefs->getPrefBool("ViewUnknown", section,
false));

connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
connect(m_packet, SIGNAL(decryptedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
m_unknownZoneLog, SLOT(zonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));

connect(m_packet, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
connect(m_packet, SIGNAL(decryptedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
m_unknownZoneLog, SLOT(worldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
}

Expand All @@ -6159,8 +6159,8 @@ void EQInterface::createOPCodeMonitorLog(const QString& opCodeList)
m_opcodeMonitorLog->setLog(pSEQPrefs->getPrefBool("Log", section, false));
m_opcodeMonitorLog->setView(pSEQPrefs->getPrefBool("View", section, false));

connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
m_opcodeMonitorLog, SLOT(packet(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
connect(m_packet, SIGNAL(decryptedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
m_opcodeMonitorLog, SLOT(packet(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)));
}


Expand Down
8 changes: 4 additions & 4 deletions src/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@ void EQPacket::connectStream(EQPacketStream* stream)
SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));

connect(stream,
SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
SIGNAL(decryptedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
this,
SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
SIGNAL(decryptedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)));
}
break;
case world2client:
Expand All @@ -529,9 +529,9 @@ void EQPacket::connectStream(EQPacketStream* stream)
SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));

connect(stream,
SIGNAL(decodedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
SIGNAL(decryptedPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)),
this,
SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
SIGNAL(decryptedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool, bool)));
}
break;
default :
Expand Down
8 changes: 4 additions & 4 deletions src/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ class EQPacket : public QObject
uint16_t opcode);
void decodedWorldPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry);
void decodedWorldPacket(const uint8_t* data, size_t len, uint8_t dir,
void decryptedWorldPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry,
bool unknown);
bool unknown, bool decryptionApplied);
void rawZonePacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode);
void decodedZonePacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry);
void decodedZonePacket(const uint8_t* data, size_t len, uint8_t dir,
void decryptedZonePacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry,
bool unknown);
bool unknown, bool decryptionApplied);

private:

Expand Down
10 changes: 6 additions & 4 deletions src/packetlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,14 @@ void PacketStreamLog::rawStreamPacket(const uint8_t* data, size_t len,
logData(data, len, dir, opcode, "[Raw]");
}

void PacketStreamLog::decodedStreamPacket(const uint8_t* data, size_t len,
void PacketStreamLog::decryptedStreamPacket(const uint8_t* data, size_t len,
uint8_t dir, uint16_t opcode,
const EQPacketOPCode* opcodeEntry)
const EQPacketOPCode* opcodeEntry,
bool unknown, bool decryptionApplied)
{
// if ((opcode != 0x0028) && (opcode != 0x003f) && (opcode != 0x025e))
logData(data, len, dir, opcode, opcodeEntry, "[Decoded]");
QString prefix = (decryptionApplied ? "[Decoded,Decrypted]" : "[Decoded]");
logData(data, len, dir, opcode, opcodeEntry, prefix);
}

//----------------------------------------------------------------------
Expand Down Expand Up @@ -524,7 +526,7 @@ void OPCodeMonitorPacketLog::init(QString monitoredOPCodes)
void OPCodeMonitorPacketLog::packet(const uint8_t* data, size_t len,
uint8_t dir, uint16_t opcode,
const EQPacketOPCode* opcodeEntry,
bool unknown)
bool unknown, bool decryptionApplied)
{
unsigned int uiOpCodeIndex = 0;
unsigned int uiIndex = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/packetlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ class PacketStreamLog : public PacketLog
public slots:
void rawStreamPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode);
void decodedStreamPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry);
void decryptedStreamPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry,
bool unknown, bool decryptionApplied);

protected:
bool m_raw;
Expand Down Expand Up @@ -149,7 +150,7 @@ class OPCodeMonitorPacketLog : public PacketLog
public slots:
void packet(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry,
bool unknown);
bool unknown, bool decryptionApplied);

protected:
#define OPCODE_SLOTS 15
Expand Down
10 changes: 9 additions & 1 deletion src/packetstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,15 @@ void EQPacketStream::dispatchPacket(uint8_t* data, size_t len,
len, opCode, EQStreamStr[m_streamid], m_streamid);
}

emit decodedPacket(data, len, m_dir, opCode, opcodeEntry, unknown);
if (decryptedData)
{
emit decryptedPacket(decryptedData, len, m_dir, opCode, opcodeEntry, unknown, true);
}
else
{
emit decryptedPacket(data, len, m_dir, opCode, opcodeEntry, unknown, false);
}

if (decryptedData != NULL)
free(decryptedData);
}
Expand Down
4 changes: 2 additions & 2 deletions src/packetstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class EQPacketStream : public QObject
uint16_t opcode);
void decodedPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry);
void decodedPacket(const uint8_t* data, size_t len, uint8_t dir,
void decryptedPacket(const uint8_t* data, size_t len, uint8_t dir,
uint16_t opcode, const EQPacketOPCode* opcodeEntry,
bool unknown);
bool unknown, bool decryptionApplied);

// this signals stream closure
void closing(uint32_t sessionId, EQStreamID streamId);
Expand Down

0 comments on commit 64b87e1

Please sign in to comment.