mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 06:16:38 +00:00
Many tweaks to stream memory allocation, including but not limited to streams now are shared_ptrs.
This commit is contained in:
@@ -7,11 +7,12 @@ class EQStream;
|
||||
#include "clientversions.h"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
class StructStrategy {
|
||||
public:
|
||||
//the encoder takes ownership of the supplied packet, and may enqueue multiple resulting packets into the stream
|
||||
typedef void (*Encoder)(EQApplicationPacket **p, EQStream *dest, bool ack_req);
|
||||
typedef void(*Encoder)(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
||||
//the decoder may only edit the supplied packet, producing a single packet for eqemu to consume.
|
||||
typedef void (*Decoder)(EQApplicationPacket *p);
|
||||
|
||||
@@ -19,7 +20,7 @@ public:
|
||||
virtual ~StructStrategy() {}
|
||||
|
||||
//this method takes an eqemu struct, and enqueues the produced structs into the stream.
|
||||
void Encode(EQApplicationPacket **p, EQStream *dest, bool ack_req) const;
|
||||
void Encode(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req) const;
|
||||
//this method takes an EQ wire struct, and converts it into an eqemu struct
|
||||
void Decode(EQApplicationPacket *p) const;
|
||||
|
||||
@@ -29,10 +30,10 @@ public:
|
||||
protected:
|
||||
//some common coders:
|
||||
//Print an error saying unknown struct/opcode and drop it
|
||||
static void ErrorEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req);
|
||||
static void ErrorEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
||||
static void ErrorDecoder(EQApplicationPacket *p);
|
||||
//pass the packet through without modification (emu == EQ) (default)
|
||||
static void PassEncoder(EQApplicationPacket **p, EQStream *dest, bool ack_req);
|
||||
static void PassEncoder(EQApplicationPacket **p, std::shared_ptr<EQStream> dest, bool ack_req);
|
||||
static void PassDecoder(EQApplicationPacket *p);
|
||||
|
||||
Encoder encoders[_maxEmuOpcode];
|
||||
|
||||
Reference in New Issue
Block a user