roo_transport
API Documentation for roo_transport
Loading...
Searching...
No Matches
in_buffer.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "roo_backport.h"
4
#include "roo_backport/byte.h"
5
#include "
roo_transport/link/internal/seq_num.h
"
6
#include "roo_logging.h"
7
8
namespace
roo_transport
{
9
namespace
internal {
10
11
class
InBuffer
{
12
public
:
13
enum
Type
{
kUnset
,
kData
,
kFin
};
14
InBuffer
() : type_(
kUnset
), size_(0) {}
15
16
void
clear
() {
17
type_ =
kUnset
;
18
size_ = 0;
19
}
20
21
void
set
(
Type
type
,
const
roo::byte* payload, uint8_t
size
) {
22
CHECK_LE(
size
, 248);
23
memcpy(payload_, payload,
size
);
24
type_ =
type
;
25
size_ =
size
;
26
}
27
28
const
roo::byte*
data
()
const
{
return
payload_; }
29
Type
type
()
const
{
return
type_; }
30
uint8_t
size
()
const
{
return
size_; }
31
32
private
:
33
Type
type_;
34
uint8_t size_;
35
roo::byte payload_[248];
36
};
37
38
}
// namespace internal
39
}
// namespace roo_transport
roo_transport::internal::InBuffer
Definition
in_buffer.h:11
roo_transport::internal::InBuffer::Type
Type
Definition
in_buffer.h:13
roo_transport::internal::InBuffer::kData
@ kData
Definition
in_buffer.h:13
roo_transport::internal::InBuffer::kUnset
@ kUnset
Definition
in_buffer.h:13
roo_transport::internal::InBuffer::kFin
@ kFin
Definition
in_buffer.h:13
roo_transport::internal::InBuffer::size
uint8_t size() const
Definition
in_buffer.h:30
roo_transport::internal::InBuffer::type
Type type() const
Definition
in_buffer.h:29
roo_transport::internal::InBuffer::data
const roo::byte * data() const
Definition
in_buffer.h:28
roo_transport::internal::InBuffer::InBuffer
InBuffer()
Definition
in_buffer.h:14
roo_transport::internal::InBuffer::set
void set(Type type, const roo::byte *payload, uint8_t size)
Definition
in_buffer.h:21
roo_transport::internal::InBuffer::clear
void clear()
Definition
in_buffer.h:16
roo_transport
Definition
in_buffer.h:8
seq_num.h
temp_repos
roo_transport
src
roo_transport
link
internal
in_buffer.h
Generated by
1.9.8