mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Converted all the EQStreams into EQStreamInterfaces, dear god help us.
This commit is contained in:
parent
4cb7d9a352
commit
751e61d6e5
@ -241,7 +241,7 @@ class EQStream : public EQStreamInterface {
|
|||||||
virtual bool CheckState(EQStreamState state) { return GetState() == state; }
|
virtual bool CheckState(EQStreamState state) { return GetState() == state; }
|
||||||
virtual std::string Describe() const { return("Direct EQStream"); }
|
virtual std::string Describe() const { return("Direct EQStream"); }
|
||||||
|
|
||||||
void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
virtual void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
||||||
|
|
||||||
void CheckTimeout(uint32 now, uint32 timeout=30);
|
void CheckTimeout(uint32 now, uint32 timeout=30);
|
||||||
bool HasOutgoingData();
|
bool HasOutgoingData();
|
||||||
@ -250,13 +250,13 @@ class EQStream : public EQStreamInterface {
|
|||||||
void Write(int eq_fd);
|
void Write(int eq_fd);
|
||||||
|
|
||||||
// whether or not the stream has been assigned (we passed our stream match)
|
// whether or not the stream has been assigned (we passed our stream match)
|
||||||
void SetActive(bool val) { streamactive = val; }
|
virtual void SetActive(bool val) { streamactive = val; }
|
||||||
|
|
||||||
//
|
//
|
||||||
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
||||||
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
||||||
|
|
||||||
inline EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
virtual EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
||||||
|
|
||||||
static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq);
|
static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq);
|
||||||
|
|
||||||
@ -306,19 +306,7 @@ class EQStream : public EQStreamInterface {
|
|||||||
const uint64 GetPacketsReceived() { return received_packet_count; }
|
const uint64 GetPacketsReceived() { return received_packet_count; }
|
||||||
|
|
||||||
//used for dynamic stream identification
|
//used for dynamic stream identification
|
||||||
class Signature {
|
virtual MatchState CheckSignature(const Signature *sig);
|
||||||
public:
|
|
||||||
//this object could get more complicated if needed...
|
|
||||||
uint16 ignore_eq_opcode; //0=dont ignore
|
|
||||||
uint16 first_eq_opcode;
|
|
||||||
uint32 first_length; //0=dont check length
|
|
||||||
};
|
|
||||||
typedef enum {
|
|
||||||
MatchNotReady,
|
|
||||||
MatchSuccessful,
|
|
||||||
MatchFailed
|
|
||||||
} MatchState;
|
|
||||||
MatchState CheckSignature(const Signature *sig);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ EQStreamIdentifier::~EQStreamIdentifier() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
void EQStreamIdentifier::RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
||||||
auto p = new Patch;
|
auto p = new Patch;
|
||||||
p->signature = sig;
|
p->signature = sig;
|
||||||
p->name = name;
|
p->name = name;
|
||||||
@ -144,7 +144,7 @@ void EQStreamIdentifier::Process() {
|
|||||||
} //end foreach stream
|
} //end foreach stream
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) {
|
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStreamInterface> &eqs) {
|
||||||
m_streams.push_back(Record(eqs));
|
m_streams.push_back(Record(eqs));
|
||||||
eqs = nullptr;
|
eqs = nullptr;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
|
|||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
|
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStreamInterface> s)
|
||||||
: stream(std::move(s)),
|
: stream(std::move(s)),
|
||||||
expire(STREAM_IDENT_WAIT_MS)
|
expire(STREAM_IDENT_WAIT_MS)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,11 +18,11 @@ public:
|
|||||||
~EQStreamIdentifier();
|
~EQStreamIdentifier();
|
||||||
|
|
||||||
//registration interface.
|
//registration interface.
|
||||||
void RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
void RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
||||||
|
|
||||||
//main processing interface
|
//main processing interface
|
||||||
void Process();
|
void Process();
|
||||||
void AddStream(std::shared_ptr<EQStream> &eqs);
|
void AddStream(std::shared_ptr<EQStreamInterface> &eqs);
|
||||||
EQStreamInterface *PopIdentified();
|
EQStreamInterface *PopIdentified();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -31,7 +31,7 @@ protected:
|
|||||||
class Patch {
|
class Patch {
|
||||||
public:
|
public:
|
||||||
std::string name;
|
std::string name;
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
OpcodeManager ** opcodes;
|
OpcodeManager ** opcodes;
|
||||||
const StructStrategy *structs;
|
const StructStrategy *structs;
|
||||||
};
|
};
|
||||||
@ -40,8 +40,8 @@ protected:
|
|||||||
//pending streams..
|
//pending streams..
|
||||||
class Record {
|
class Record {
|
||||||
public:
|
public:
|
||||||
Record(std::shared_ptr<EQStream> s);
|
Record(std::shared_ptr<EQStreamInterface> s);
|
||||||
std::shared_ptr<EQStream> stream; //we own this
|
std::shared_ptr<EQStreamInterface> stream; //we own this
|
||||||
Timer expire;
|
Timer expire;
|
||||||
};
|
};
|
||||||
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
||||||
|
|||||||
@ -15,11 +15,25 @@ typedef enum {
|
|||||||
} EQStreamState;
|
} EQStreamState;
|
||||||
|
|
||||||
class EQApplicationPacket;
|
class EQApplicationPacket;
|
||||||
|
class OpcodeManager;
|
||||||
|
|
||||||
class EQStreamInterface {
|
class EQStreamInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~EQStreamInterface() {}
|
virtual ~EQStreamInterface() {}
|
||||||
|
|
||||||
|
class Signature {
|
||||||
|
public:
|
||||||
|
//this object could get more complicated if needed...
|
||||||
|
uint16 ignore_eq_opcode; //0=dont ignore
|
||||||
|
uint16 first_eq_opcode;
|
||||||
|
uint32 first_length; //0=dont check length
|
||||||
|
};
|
||||||
|
typedef enum {
|
||||||
|
MatchNotReady,
|
||||||
|
MatchSuccessful,
|
||||||
|
MatchFailed
|
||||||
|
} MatchState;
|
||||||
|
|
||||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0;
|
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0;
|
||||||
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0;
|
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0;
|
||||||
virtual EQApplicationPacket *PopPacket() = 0;
|
virtual EQApplicationPacket *PopPacket() = 0;
|
||||||
@ -30,6 +44,10 @@ public:
|
|||||||
virtual uint16 GetRemotePort() const = 0;
|
virtual uint16 GetRemotePort() const = 0;
|
||||||
virtual bool CheckState(EQStreamState state) = 0;
|
virtual bool CheckState(EQStreamState state) = 0;
|
||||||
virtual std::string Describe() const = 0;
|
virtual std::string Describe() const = 0;
|
||||||
|
virtual void SetActive(bool val) { }
|
||||||
|
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
|
||||||
|
virtual EQStreamState GetState() = 0;
|
||||||
|
virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
|
||||||
|
|
||||||
virtual const uint32 GetBytesSent() const { return 0; }
|
virtual const uint32 GetBytesSent() const { return 0; }
|
||||||
virtual const uint32 GetBytesRecieved() const { return 0; }
|
virtual const uint32 GetBytesRecieved() const { return 0; }
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include "struct_strategy.h"
|
#include "struct_strategy.h"
|
||||||
|
|
||||||
|
|
||||||
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||||
: m_stream(stream),
|
: m_stream(stream),
|
||||||
m_structs(structs),
|
m_structs(structs),
|
||||||
m_opcodes(opcodes)
|
m_opcodes(opcodes)
|
||||||
@ -26,6 +26,16 @@ const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
|
|||||||
return m_structs->ClientVersion();
|
return m_structs->ClientVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EQStreamState EQStreamProxy::GetState()
|
||||||
|
{
|
||||||
|
return m_stream->GetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EQStreamProxy::SetOpcodeManager(OpcodeManager **opm)
|
||||||
|
{
|
||||||
|
return m_stream->SetOpcodeManager(opm);
|
||||||
|
}
|
||||||
|
|
||||||
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
||||||
if(p == nullptr)
|
if(p == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class EQApplicationPacket;
|
|||||||
class EQStreamProxy : public EQStreamInterface {
|
class EQStreamProxy : public EQStreamInterface {
|
||||||
public:
|
public:
|
||||||
//takes ownership of the stream.
|
//takes ownership of the stream.
|
||||||
EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||||
virtual ~EQStreamProxy();
|
virtual ~EQStreamProxy();
|
||||||
|
|
||||||
//EQStreamInterface:
|
//EQStreamInterface:
|
||||||
@ -29,6 +29,8 @@ public:
|
|||||||
virtual bool CheckState(EQStreamState state);
|
virtual bool CheckState(EQStreamState state);
|
||||||
virtual std::string Describe() const;
|
virtual std::string Describe() const;
|
||||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
||||||
|
virtual EQStreamState GetState();
|
||||||
|
virtual void SetOpcodeManager(OpcodeManager **opm);
|
||||||
|
|
||||||
virtual const uint32 GetBytesSent() const;
|
virtual const uint32 GetBytesSent() const;
|
||||||
virtual const uint32 GetBytesRecieved() const;
|
virtual const uint32 GetBytesRecieved() const;
|
||||||
@ -36,8 +38,8 @@ public:
|
|||||||
virtual const uint32 GetBytesRecvPerSecond() const;
|
virtual const uint32 GetBytesRecvPerSecond() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<EQStream> const m_stream; //we own this stream object.
|
std::shared_ptr<EQStreamInterface> const m_stream; //we own this stream object.
|
||||||
const StructStrategy *const m_structs; //we do not own this object.
|
const StructStrategy *const m_structs; //we do not own this object.
|
||||||
//this is a pointer to a pointer to make it less likely that a packet will
|
//this is a pointer to a pointer to make it less likely that a packet will
|
||||||
//reference an invalid opcode manager when they are being reloaded.
|
//reference an invalid opcode manager when they are being reloaded.
|
||||||
OpcodeManager **const m_opcodes; //we do not own this object.
|
OpcodeManager **const m_opcodes; //we do not own this object.
|
||||||
|
|||||||
@ -87,7 +87,7 @@ namespace RoF
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -87,7 +87,7 @@ namespace RoF2
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -83,7 +83,7 @@ namespace SoD
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -83,7 +83,7 @@ namespace SoF
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -17,5 +17,5 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define E(x) static void Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
#define E(x) static void Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req);
|
||||||
#define D(x) static void Decode_##x(EQApplicationPacket *p);
|
#define D(x) static void Decode_##x(EQApplicationPacket *p);
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req)
|
#define ENCODE(x) void Strategy::Encode_##x(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req)
|
||||||
#define DECODE(x) void Strategy::Decode_##x(EQApplicationPacket *__packet)
|
#define DECODE(x) void Strategy::Decode_##x(EQApplicationPacket *__packet)
|
||||||
|
|
||||||
#define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1))
|
#define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1))
|
||||||
|
|||||||
@ -82,7 +82,7 @@ namespace Titanium
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -83,7 +83,7 @@ namespace UF
|
|||||||
|
|
||||||
//ok, now we have what we need to register.
|
//ok, now we have what we need to register.
|
||||||
|
|
||||||
EQStream::Signature signature;
|
EQStreamInterface::Signature signature;
|
||||||
std::string pname;
|
std::string pname;
|
||||||
|
|
||||||
//register our world signature.
|
//register our world signature.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ StructStrategy::StructStrategy() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StructStrategy::Encode(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) const {
|
void StructStrategy::Encode(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req) const {
|
||||||
if((*p)->GetOpcodeBypass() != 0) {
|
if((*p)->GetOpcodeBypass() != 0) {
|
||||||
PassEncoder(p, dest, ack_req);
|
PassEncoder(p, dest, ack_req);
|
||||||
return;
|
return;
|
||||||
@ -36,7 +36,7 @@ void StructStrategy::Decode(EQApplicationPacket *p) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, std::shared_ptr<EQStream> dest, bool ack_req) {
|
void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, std::shared_ptr<EQStreamInterface> dest, bool ack_req) {
|
||||||
EQApplicationPacket *p = *in_p;
|
EQApplicationPacket *p = *in_p;
|
||||||
*in_p = nullptr;
|
*in_p = nullptr;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ void StructStrategy::ErrorDecoder(EQApplicationPacket *p) {
|
|||||||
p->SetOpcode(OP_Unknown);
|
p->SetOpcode(OP_Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StructStrategy::PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) {
|
void StructStrategy::PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req) {
|
||||||
dest->FastQueuePacket(p, ack_req);
|
dest->FastQueuePacket(p, ack_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define STRUCTSTRATEGY_H_
|
#define STRUCTSTRATEGY_H_
|
||||||
|
|
||||||
class EQApplicationPacket;
|
class EQApplicationPacket;
|
||||||
class EQStream;
|
class EQStreamInterface;
|
||||||
#include "emu_opcodes.h"
|
#include "emu_opcodes.h"
|
||||||
#include "emu_versions.h"
|
#include "emu_versions.h"
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ class EQStream;
|
|||||||
class StructStrategy {
|
class StructStrategy {
|
||||||
public:
|
public:
|
||||||
//the encoder takes ownership of the supplied packet, and may enqueue multiple resulting packets into the stream
|
//the encoder takes ownership of the supplied packet, and may enqueue multiple resulting packets into the stream
|
||||||
typedef void(*Encoder)(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
typedef void(*Encoder)(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req);
|
||||||
//the decoder may only edit the supplied packet, producing a single packet for eqemu to consume.
|
//the decoder may only edit the supplied packet, producing a single packet for eqemu to consume.
|
||||||
typedef void (*Decoder)(EQApplicationPacket *p);
|
typedef void (*Decoder)(EQApplicationPacket *p);
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public:
|
|||||||
virtual ~StructStrategy() {}
|
virtual ~StructStrategy() {}
|
||||||
|
|
||||||
//this method takes an eqemu struct, and enqueues the produced structs into the stream.
|
//this method takes an eqemu struct, and enqueues the produced structs into the stream.
|
||||||
void Encode(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) const;
|
void Encode(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req) const;
|
||||||
//this method takes an EQ wire struct, and converts it into an eqemu struct
|
//this method takes an EQ wire struct, and converts it into an eqemu struct
|
||||||
void Decode(EQApplicationPacket *p) const;
|
void Decode(EQApplicationPacket *p) const;
|
||||||
|
|
||||||
@ -30,10 +30,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
//some common coders:
|
//some common coders:
|
||||||
//Print an error saying unknown struct/opcode and drop it
|
//Print an error saying unknown struct/opcode and drop it
|
||||||
static void ErrorEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
static void ErrorEncoder(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req);
|
||||||
static void ErrorDecoder(EQApplicationPacket *p);
|
static void ErrorDecoder(EQApplicationPacket *p);
|
||||||
//pass the packet through without modification (emu == EQ) (default)
|
//pass the packet through without modification (emu == EQ) (default)
|
||||||
static void PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
static void PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStreamInterface> dest, bool ack_req);
|
||||||
static void PassDecoder(EQApplicationPacket *p);
|
static void PassDecoder(EQApplicationPacket *p);
|
||||||
|
|
||||||
Encoder encoders[_maxEmuOpcode];
|
Encoder encoders[_maxEmuOpcode];
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
extern EQEmuLogSys Log;
|
extern EQEmuLogSys Log;
|
||||||
extern LoginServer server;
|
extern LoginServer server;
|
||||||
|
|
||||||
Client::Client(std::shared_ptr<EQStream> c, LSClientVersion v)
|
Client::Client(std::shared_ptr<EQStreamInterface> c, LSClientVersion v)
|
||||||
{
|
{
|
||||||
connection = c;
|
connection = c;
|
||||||
version = v;
|
version = v;
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Constructor, sets our connection to c and version to v
|
* Constructor, sets our connection to c and version to v
|
||||||
*/
|
*/
|
||||||
Client(std::shared_ptr<EQStream> c, LSClientVersion v);
|
Client(std::shared_ptr<EQStreamInterface> c, LSClientVersion v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
@ -129,11 +129,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Gets the connection for this client.
|
* Gets the connection for this client.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<EQStream> GetConnection() { return connection; }
|
std::shared_ptr<EQStreamInterface> GetConnection() { return connection; }
|
||||||
|
|
||||||
EQEmu::Random random;
|
EQEmu::Random random;
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<EQStream> connection;
|
std::shared_ptr<EQStreamInterface> connection;
|
||||||
LSClientVersion version;
|
LSClientVersion version;
|
||||||
LSClientStatus status;
|
LSClientStatus status;
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ ClientManager::~ClientManager()
|
|||||||
void ClientManager::Process()
|
void ClientManager::Process()
|
||||||
{
|
{
|
||||||
ProcessDisconnect();
|
ProcessDisconnect();
|
||||||
std::shared_ptr<EQStream> cur = titanium_stream->Pop();
|
std::shared_ptr<EQStreamInterface> cur = titanium_stream->Pop();
|
||||||
while(cur)
|
while(cur)
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
@ -142,8 +142,8 @@ void ClientManager::ProcessDisconnect()
|
|||||||
list<Client*>::iterator iter = clients.begin();
|
list<Client*>::iterator iter = clients.begin();
|
||||||
while(iter != clients.end())
|
while(iter != clients.end())
|
||||||
{
|
{
|
||||||
std::shared_ptr<EQStream> c = (*iter)->GetConnection();
|
std::shared_ptr<EQStreamInterface> c = (*iter)->GetConnection();
|
||||||
if(c->CheckClosed())
|
if(c->CheckState(CLOSED))
|
||||||
{
|
{
|
||||||
Log.Out(Logs::General, Logs::Login_Server, "Client disconnected from the server, removing client.");
|
Log.Out(Logs::General, Logs::Login_Server, "Client disconnected from the server, removing client.");
|
||||||
delete (*iter);
|
delete (*iter);
|
||||||
|
|||||||
@ -485,7 +485,7 @@ Clientlist::Clientlist(int ChatPort) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::Client(std::shared_ptr<EQStream> eqs) {
|
Client::Client(std::shared_ptr<EQStreamInterface> eqs) {
|
||||||
|
|
||||||
ClientStream = eqs;
|
ClientStream = eqs;
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
|||||||
|
|
||||||
void Clientlist::Process()
|
void Clientlist::Process()
|
||||||
{
|
{
|
||||||
std::shared_ptr<EQStream> eqs;
|
std::shared_ptr<EQStreamInterface> eqs;
|
||||||
|
|
||||||
while ((eqs = chatsf->Pop())) {
|
while ((eqs = chatsf->Pop())) {
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
@ -592,7 +592,7 @@ void Clientlist::Process()
|
|||||||
auto it = ClientChatConnections.begin();
|
auto it = ClientChatConnections.begin();
|
||||||
while (it != ClientChatConnections.end()) {
|
while (it != ClientChatConnections.end()) {
|
||||||
(*it)->AccountUpdate();
|
(*it)->AccountUpdate();
|
||||||
if ((*it)->ClientStream->CheckClosed()) {
|
if ((*it)->ClientStream->CheckState(CLOSED)) {
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = (*it)->ClientStream->GetRemoteIP();
|
in.s_addr = (*it)->ClientStream->GetRemoteIP();
|
||||||
|
|
||||||
|
|||||||
@ -84,10 +84,10 @@ struct CharacterEntry {
|
|||||||
class Client {
|
class Client {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Client(std::shared_ptr<EQStream> eqs);
|
Client(std::shared_ptr<EQStreamInterface> eqs);
|
||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
std::shared_ptr<EQStream> ClientStream;
|
std::shared_ptr<EQStreamInterface> ClientStream;
|
||||||
void AddCharacter(int CharID, const char *CharacterName, int Level);
|
void AddCharacter(int CharID, const char *CharacterName, int Level);
|
||||||
void ClearCharacters() { Characters.clear(); }
|
void ClearCharacters() { Characters.clear(); }
|
||||||
void SendMailBoxes();
|
void SendMailBoxes();
|
||||||
|
|||||||
@ -412,7 +412,7 @@ int main(int argc, char** argv) {
|
|||||||
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
|
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
|
||||||
InterserverTimer.Trigger();
|
InterserverTimer.Trigger();
|
||||||
uint8 ReconnectCounter = 100;
|
uint8 ReconnectCounter = 100;
|
||||||
std::shared_ptr<EQStream> eqs;
|
std::shared_ptr<EQStreamInterface> eqs;
|
||||||
EmuTCPConnection* tcpc;
|
EmuTCPConnection* tcpc;
|
||||||
EQStreamInterface *eqsi;
|
EQStreamInterface *eqsi;
|
||||||
|
|
||||||
|
|||||||
@ -207,7 +207,7 @@ struct ClientReward
|
|||||||
|
|
||||||
class ClientFactory {
|
class ClientFactory {
|
||||||
public:
|
public:
|
||||||
Client *MakeClient(std::shared_ptr<EQStream> ieqs);
|
Client *MakeClient(std::shared_ptr<EQStreamInterface> ieqs);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Client : public Mob
|
class Client : public Mob
|
||||||
|
|||||||
@ -425,7 +425,7 @@ int main(int argc, char** argv) {
|
|||||||
Timer quest_timers(100);
|
Timer quest_timers(100);
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
bool worldwasconnected = worldserver.Connected();
|
bool worldwasconnected = worldserver.Connected();
|
||||||
std::shared_ptr<EQStream> eqss;
|
std::shared_ptr<EQStreamInterface> eqss;
|
||||||
EQStreamInterface *eqsi;
|
EQStreamInterface *eqsi;
|
||||||
uint8 IDLEZONEUPDATE = 200;
|
uint8 IDLEZONEUPDATE = 200;
|
||||||
uint8 ZONEUPDATE = 10;
|
uint8 ZONEUPDATE = 10;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user