w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RlinkPacketBuf.hpp
Go to the documentation of this file.
1// $Id: RlinkPacketBuf.hpp 1198 2019-07-27 19:08:31Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2011-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-07-27 1198 2.0.4 add kNc* definitions
8// 2019-06-07 1160 2.0.3 Stats() not longer const
9// 2018-12-16 1084 2.0.2 use =delete for noncopyable instead of boost
10// 2017-04-07 868 2.0.1 Dump(): add detail arg
11// 2014-11-23 606 2.0 re-organize for rlink v4
12// 2013-04-21 509 1.0.2 add SndAttn() method
13// 2013-01-13 474 1.0.1 add PollAttn() method
14// 2011-04-02 375 1.0 Initial version
15// 2011-03-05 366 0.1 First draft
16// ---------------------------------------------------------------------------
17
18
23#ifndef included_Retro_RlinkPacketBuf
24#define included_Retro_RlinkPacketBuf 1
25
26#include <cstdint>
27#include <ostream>
28#include <vector>
29
30#include "librtools/Rstats.hpp"
31
32#include "RlinkCrc16.hpp"
33
34namespace Retro {
35
37 public:
38
41
42 RlinkPacketBuf(const RlinkPacketBuf&) = delete; // noncopy
43 RlinkPacketBuf& operator=(const RlinkPacketBuf&) = delete; // noncopyable
44
45 size_t PktSize() const;
46
47 uint32_t Flags() const;
48 bool TestFlag(uint32_t mask) const;
49
50 Rstats& Stats();
51 void Dump(std::ostream& os, int ind=0, const char* text=0,
52 int detail=0) const;
53
54 // flag bits (also defined in cpp)
55 static const uint32_t kFlagSopSeen = 1<<0;
56 static const uint32_t kFlagEopSeen = 1<<1;
57 static const uint32_t kFlagNakSeen = 1<<2;
58 static const uint32_t kFlagAttnSeen = 1<<3;
59 static const uint32_t kFlagErrTout = 1<<16;
60 static const uint32_t kFlagErrIO = 1<<17;
61 static const uint32_t kFlagErrFrame = 1<<18;
62 static const uint32_t kFlagErrClobber = 1<<19;
63
64 // some constants (also defined in cpp)
65 static const uint8_t kSymEsc = 0xCA;
66 static const uint8_t kSymFill = 0xD5;
67 static const uint8_t kSymXon = 0x11;
68 static const uint8_t kSymXoff = 0x13;
69 static const uint8_t kSymEdPref = 0x40;
70 static const uint8_t kEcSop = 0x00;
71 static const uint8_t kEcEop = 0x01;
72 static const uint8_t kEcNak = 0x02;
73 static const uint8_t kEcAttn = 0x03;
74 static const uint8_t kEcXon = 0x04;
75 static const uint8_t kEcXoff = 0x05;
76 static const uint8_t kEcFill = 0x06;
77 static const uint8_t kEcEsc = 0x07;
78 static const uint8_t kEcClobber = 0xff;
79 static const uint8_t kNcCcrc = 0x00;
80 static const uint8_t kNcDcrc = 0x01;
81 static const uint8_t kNcFrame = 0x02;
82 static const uint8_t kNcUnused = 0x03;
83 static const uint8_t kNcCmd = 0x04;
84 static const uint8_t kNcCnt = 0x05;
85 static const uint8_t kNcRtOvlf = 0x06;
86 static const uint8_t kNcRtWblk = 0x07;
87 static const uint8_t kNcInval = 0x08;
88
89 protected:
90 void SetFlagBit(uint32_t mask);
91 void ClearFlagBit(uint32_t mask);
92
93 protected:
94 std::vector<uint8_t> fPktBuf;
96 uint32_t fFlags;
98 };
99
100} // end namespace Retro
101
102#include "RlinkPacketBuf.ipp"
103
104#endif
FIXME_docs.
Definition: RlinkCrc16.hpp:24
static const uint8_t kEcXon
VHDL def ec_xon 100.
static const uint8_t kNcCnt
VHDL def nak_cnt 101.
RlinkPacketBuf()
Default constructor.
static const uint8_t kNcRtWblk
VHDL def nak_rtwblk 111.
static const uint8_t kNcUnused
VHDL def nak_unused 011.
RlinkPacketBuf(const RlinkPacketBuf &)=delete
static const uint8_t kNcFrame
VHDL def nak_frame 010.
static const uint32_t kFlagErrTout
err: timeout on read
static const uint8_t kSymEsc
VHDL def escape 1100 1010.
static const uint8_t kEcClobber
invalid Ecode
size_t PktSize() const
FIXME_docs.
~RlinkPacketBuf()
Destructor.
static const uint8_t kEcEsc
VHDL def ec_esc 111.
uint32_t Flags() const
FIXME_docs.
void SetFlagBit(uint32_t mask)
FIXME_docs.
Rstats & Stats()
FIXME_docs.
static const uint8_t kNcCmd
VHDL def nak_cmd 100.
static const uint32_t kFlagSopSeen
sop was seen
static const uint8_t kSymFill
VHDL def fill 1101 0101.
static const uint8_t kNcRtOvlf
VHDL def nak_rtovfl 110.
RlinkCrc16 fCrc
crc accumulator
static const uint8_t kEcSop
VHDL def ec_sop 000.
static const uint32_t kFlagEopSeen
eop was seen
static const uint8_t kNcDcrc
VHDL def nak_dcrc 001.
static const uint32_t kFlagErrFrame
err: frame error
static const uint8_t kEcFill
VHDL def ec_fill 110.
static const uint8_t kNcInval
invalid NAK
std::vector< uint8_t > fPktBuf
packet buffer
static const uint32_t kFlagErrClobber
err: clobbered esc
static const uint32_t kFlagNakSeen
nak was seen
Rstats fStats
statistics
static const uint8_t kEcNak
VHDL def ec_nak 010.
static const uint8_t kEcAttn
VHDL def ec_attn 011.
static const uint8_t kSymEdPref
VHDL def ed_pref 0100 0000.
uint32_t fFlags
request/response flags
static const uint8_t kEcXoff
VHDL def ec_xoff 101.
static const uint8_t kSymXon
VHDL def xon 0001 0001.
static const uint8_t kEcEop
VHDL def ec_eop 001.
void ClearFlagBit(uint32_t mask)
FIXME_docs.
static const uint8_t kSymXoff
VHDL def xoff 0001 0011.
static const uint8_t kNcCcrc
VHDL def nak_ccrc 000.
RlinkPacketBuf & operator=(const RlinkPacketBuf &)=delete
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
bool TestFlag(uint32_t mask) const
FIXME_docs.
static const uint32_t kFlagErrIO
err: IO error on read
static const uint32_t kFlagAttnSeen
attn was seen
FIXME_docs.
Definition: Rstats.hpp:28
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47