X-Git-Url: http://git.tdb.fi/?p=libs%2Fnet.git;a=blobdiff_plain;f=source%2Fnet%2Fprotocol.h;fp=source%2Fnet%2Fprotocol.h;h=0721ec5b5403adebb4013e54a07358700beebecc;hp=8068d3275ca292eea2317e9847725f90a0be7524;hb=c2e9e03b191a6ffe44a83be32aadf2a325491c02;hpb=d6ba60220dadabe552f9f7dc2b4fc34b51cf4d32 diff --git a/source/net/protocol.h b/source/net/protocol.h index 8068d32..0721ec5 100644 --- a/source/net/protocol.h +++ b/source/net/protocol.h @@ -226,10 +226,10 @@ protected: public: template - std::size_t serialize(const P &, char *, std::size_t) const; + std::size_t serialize(const P &, char *, std::size_t, unsigned = 0) const; std::size_t get_packet_size(const char *, std::size_t) const; - std::size_t dispatch(ReceiverBase &, const char *, std::size_t) const; + std::size_t dispatch(ReceiverBase &, const char *, std::size_t, unsigned = 0) const; std::uint64_t get_hash() const; }; @@ -265,14 +265,14 @@ const Protocol::PacketTypeDef

&Protocol::get_packet_by_class() const } template -std::size_t Protocol::serialize(const P &pkt, char *buf, std::size_t size) const +std::size_t Protocol::serialize(const P &pkt, char *buf, std::size_t size, unsigned base_id) const { const PacketTypeDef

&pdef = get_packet_by_class

(); if(!pdef.get_id()) throw std::invalid_argument("no packet id"); char *ptr = pdef.serialize(pkt, buf+4, buf+size); size = ptr-buf; - header_def.serialize(PacketHeader(pdef.get_id(), size), buf, buf+4); + header_def.serialize(PacketHeader(base_id+pdef.get_id(), size), buf, buf+4); return size; }