w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RethBuf.ipp
Go to the documentation of this file.
1// $Id: RethBuf.ipp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-12-18 1089 1.0.1 use c++ style casts
8// 2017-02-25 856 1.0 Initial version
9// 2017-02-12 850 0.1 First draft
10// ---------------------------------------------------------------------------
11
16#include "RethTools.hpp"
17
18// all method definitions in namespace Retro
19namespace Retro {
20
21//------------------------------------------+-----------------------------------
23
24inline void RethBuf::Clear()
25{
26 fSize = 0;
27 return;
28}
29
30//------------------------------------------+-----------------------------------
32
33inline void RethBuf::SetSize(uint16_t size)
34{
35 fSize = size;
36 return;
37}
38
39//------------------------------------------+-----------------------------------
41
42inline void RethBuf::SetTime()
43{
44 fTime.GetClock(CLOCK_REALTIME);
45 return;
46}
47
48//------------------------------------------+-----------------------------------
50
51inline void RethBuf::SetTime(const Rtime& time)
52{
53 fTime = time;
54 return;
55}
56
57//------------------------------------------+-----------------------------------
59
60inline uint16_t RethBuf::Size() const
61{
62 return fSize;
63}
64
65//------------------------------------------+-----------------------------------
67
68inline const Rtime& RethBuf::Time() const
69{
70 return fTime;
71}
72
73//------------------------------------------+-----------------------------------
75
76inline const uint8_t* RethBuf::Buf8() const
77{
78 return fBuf;
79}
80
81//------------------------------------------+-----------------------------------
83
84inline const uint16_t* RethBuf::Buf16() const
85{
86 return reinterpret_cast<uint16_t*>(const_cast<uint8_t*>(fBuf));
87}
88
89//------------------------------------------+-----------------------------------
91
92inline const uint32_t* RethBuf::Buf32() const
93{
94 return reinterpret_cast<uint32_t*>(const_cast<uint8_t*>(fBuf));
95}
96
97//------------------------------------------+-----------------------------------
99
100inline uint8_t* RethBuf::Buf8()
101{
102 return fBuf;
103}
104
105//------------------------------------------+-----------------------------------
107
108inline uint16_t* RethBuf::Buf16()
109{
110 return reinterpret_cast<uint16_t*>(fBuf);
111}
112
113//------------------------------------------+-----------------------------------
115
116inline uint32_t* RethBuf::Buf32()
117{
118 return reinterpret_cast<uint32_t*>(fBuf);
119}
120
121//------------------------------------------+-----------------------------------
123
124inline void RethBuf::SetMacDestination(uint64_t mac)
125{
127 return;
128}
129
130//------------------------------------------+-----------------------------------
132
133inline void RethBuf::SetMacSource(uint64_t mac)
134{
136 return;
137}
138
139//------------------------------------------+-----------------------------------
141
142inline uint64_t RethBuf::MacDestination() const
143{
145}
146
147//------------------------------------------+-----------------------------------
149
150inline uint64_t RethBuf::MacSource() const
151{
153}
154
155//------------------------------------------+-----------------------------------
157
158inline bool RethBuf::IsMcast() const
159{
160 return fBuf[0] & 0x1; // odd first byte destination MAC
161}
162
163//------------------------------------------+-----------------------------------
165
166inline bool RethBuf::IsBcast() const
167{
168 return Buf16()[0] == 0xffff && Buf16()[1] == 0xffff && Buf16()[2] == 0xffff;
169}
170
171
172} // end namespace Retro
void SetTime()
FIXME_docs.
Definition: RethBuf.ipp:42
bool IsMcast() const
FIXME_docs.
Definition: RethBuf.ipp:158
bool IsBcast() const
FIXME_docs.
Definition: RethBuf.ipp:166
void SetMacSource(uint64_t mac)
FIXME_docs.
Definition: RethBuf.ipp:133
const uint8_t * Buf8() const
FIXME_docs.
Definition: RethBuf.ipp:76
uint8_t fBuf[kMaxSize+kCrcSize]
Definition: RethBuf.hpp:78
void SetMacDestination(uint64_t mac)
FIXME_docs.
Definition: RethBuf.ipp:124
uint64_t MacDestination() const
FIXME_docs.
Definition: RethBuf.ipp:142
uint64_t MacSource() const
FIXME_docs.
Definition: RethBuf.ipp:150
static const size_t kWOffDstMac
offset dst mac in 16 bit wrds
Definition: RethBuf.hpp:71
static const size_t kWOffSrcMac
offset src mac in 16 bit wrds
Definition: RethBuf.hpp:72
const uint16_t * Buf16() const
FIXME_docs.
Definition: RethBuf.ipp:84
void SetSize(uint16_t size)
FIXME_docs.
Definition: RethBuf.ipp:33
uint16_t Size() const
FIXME_docs.
Definition: RethBuf.ipp:60
void Clear()
FIXME_docs.
Definition: RethBuf.ipp:24
const uint32_t * Buf32() const
FIXME_docs.
Definition: RethBuf.ipp:92
uint16_t fSize
Definition: RethBuf.hpp:77
const Rtime & Time() const
FIXME_docs.
Definition: RethBuf.ipp:68
FIXME_docs.
Definition: Rtime.hpp:25
void GetClock(clockid_t clkid)
FIXME_docs.
Definition: Rtime.cpp:41
void Mac2WList(uint64_t mac, uint16_t wlist[3])
FIXME_docs.
Definition: RethTools.ipp:21
uint64_t WList2Mac(const uint16_t wlist[3])
FIXME_docs.
Definition: RethTools.ipp:32
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47