summaryrefslogtreecommitdiffstats
path: root/fnet/src/examples/ping/packets.h
blob: 39dae75a16f3dfc427671c95163ed080707064da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once


enum {
    PCODE_PING_REQUEST = 1,
    PCODE_PING_REPLY   = 2
};


class PingRequest : public FNET_Packet
{
public:
    virtual uint32_t GetPCODE();
    virtual uint32_t GetLength();
    virtual void Encode(FNET_DataBuffer *);
    virtual bool Decode(FNET_DataBuffer *src, uint32_t len);
};


class PingReply : public FNET_Packet
{
public:
    virtual uint32_t GetPCODE();
    virtual uint32_t GetLength();
    virtual void Encode(FNET_DataBuffer *);
    virtual bool Decode(FNET_DataBuffer *src, uint32_t len);
};


class PingPacketFactory : public FNET_IPacketFactory
{
public:
    virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context);
};