Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cPingGray.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cPingGray_H
6 #define _INC_cPingGray_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "cPingCommon.h"
12 
13 namespace GrayLib
14 {
16  {
21 
22  public:
23  enum HEAD_TYPE
24  {
27  HEAD_LENL = 0,
32  };
33 
34  static const cPingGray k_Def;
35  const void* const m_pPrefix;
36  size_t const m_nPrefixSize;
37 
38  private:
39  virtual HRESULT CheckPingPacket(const BYTE* pData, size_t iLen, size_t* pnPayloadOffset) const override;
40 
41  public:
42  cPingGray(const void* pPrefix, size_t iPrefixSize)
43  : m_pPrefix(pPrefix)
44  , m_nPrefixSize(iPrefixSize)
45  {
46  }
47 
48  virtual size_t MakePingPacket(OUT BYTE* pData, MSGTYPE_TYPE eMsgType, const void* pPayload, size_t nPayloadSize) const override;
49  };
50 };
51 
52 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cPingGray.h:16
HEAD_TYPE
Definition: cPingGray.h:24
@ HEAD_MSGTYPE
MSGTYPE_TYPE.
Definition: cPingGray.h:29
@ HEAD_QTY
number of overhead bytes, not including the m_pPrefix = 4.
Definition: cPingGray.h:31
@ HEAD_LENH
high byte of payload length. does not include this headers length.
Definition: cPingGray.h:28
@ HEAD_CHECK
1 byte of Checksum of all = payload + len + HEAD_MSGTYPE.
Definition: cPingGray.h:30
cPingGray(const void *pPrefix, size_t iPrefixSize)
Definition: cPingGray.h:42
static const cPingGray k_Def
this is the default prefix for those that talk Gray UDP protocol.
Definition: cPingGray.h:34
const void *const m_pPrefix
all packets have this static Prefix. TX and RX.
Definition: cPingGray.h:35
size_t const m_nPrefixSize
fixed length Prefix to id this packet.
Definition: cPingGray.h:36
Definition: cPingCommon.h:16
Definition: cMesh.h:22