Buildable state with converting hex packet dumps

This commit is contained in:
Akkadius 2015-01-18 03:53:35 -06:00
parent 14bac9f8c0
commit 83906af9b6
8 changed files with 19 additions and 10 deletions

View File

@ -1112,7 +1112,7 @@ uint32 newlength=0;
ProcessQueue();
} else {
Log.Out(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L);
_hex(NET__NET_CREATE_HEX, buffer, length);
Log.Hex(Logs::Netcode, buffer, length);
}
}

View File

@ -24,6 +24,7 @@
#include "database.h"
#include "misc.h"
#include <iostream>
#include <fstream>
#include <string>
@ -173,7 +174,7 @@ void EQEmuLogSys::Hex(uint16 log_category, const void *data, unsigned long lengt
// log_message(type, "%s", buffer); //%s is to prevent % escapes in the ascii
}
}
/*
void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) {
return;
char buffer[196];
@ -181,7 +182,7 @@ void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) {
//log_message(type,buffer);
EQEmuLogSys::Hex(log_category, (const char *)p->pBuffer, p->size);
}
*/
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
{
va_list args;

View File

@ -129,8 +129,7 @@ public:
void MakeDirectory(std::string directory_name);
void SetCurrentTimeStamp(char* time_stamp);
void StartFileLogs(const std::string log_name);
void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding);
void Raw(uint16 log_category, uint16 seq, const BasePacket *p);
void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding = 4);
struct LogSettings{
uint8 log_to_file;

View File

@ -46,7 +46,16 @@ const LogTypeStatus *log_type_info = real_log_type_info;
z
void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding) {
if(!is_log_enabled(type))
return;
char buffer[80];
uint32 offset;
for(offset=0;offset<length;offset+=16) {
build_hex_line((const char *)data,length,offset,buffer,padding);
// log_message(type, "%s", buffer); //%s is to prevent % escapes in the ascii
}
}
void log_packet(LogType type, const BasePacket *p) {
if(!is_log_enabled(type))

View File

@ -68,7 +68,7 @@ bool LauncherLink::Process() {
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket())) {
_hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size);
Log.Hex(Logs::Netcode, pack->pBuffer, pack->size);
if (!authenticated) {
if (WorldConfig::get()->SharedKey.length() > 0) {
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {

View File

@ -97,7 +97,7 @@ bool LoginServer::Process() {
while((pack = tcpc->PopPacket()))
{
Log.Out(Logs::Detail, Logs::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode);
_hex(WORLD__LS_TRACE,pack->pBuffer,pack->size);
Log.Hex(Logs::Netcode, pack->pBuffer, pack->size);
switch(pack->opcode) {
case 0:

View File

@ -177,7 +177,7 @@ bool ZoneServer::Process() {
}
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket())) {
_hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size);
Log.Hex(Logs::Netcode, pack->pBuffer, pack->size);
if (!authenticated) {
if (WorldConfig::get()->SharedKey.length() > 0) {
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {

View File

@ -141,7 +141,7 @@ void WorldServer::Process() {
ServerPacket *pack = 0;
while((pack = tcpc.PopPacket())) {
Log.Out(Logs::Detail, Logs::Zone_Server, "Got 0x%04x from world:", pack->opcode);
_hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size);
Log.Hex(Logs::Netcode, pack->pBuffer, pack->size);
switch(pack->opcode) {
case 0: {
break;