Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
actor-incubator
Commits
60c7e61e
Commit
60c7e61e
authored
Oct 11, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup packet_writer
parent
31434abc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
libcaf_net/caf/net/packet_writer.hpp
libcaf_net/caf/net/packet_writer.hpp
+9
-4
libcaf_net/caf/net/packet_writer_impl.hpp
libcaf_net/caf/net/packet_writer_impl.hpp
+1
-1
No files found.
libcaf_net/caf/net/packet_writer.hpp
View file @
60c7e61e
...
@@ -27,19 +27,22 @@
...
@@ -27,19 +27,22 @@
namespace
caf
{
namespace
caf
{
namespace
net
{
namespace
net
{
/// Implements an interface for packet writing in application-layers.
class
packet_writer
{
class
packet_writer
{
public:
public:
using
buffer_type
=
std
::
vector
<
byte
>
;
using
buffer_type
=
std
::
vector
<
byte
>
;
//
virtual ~packet_writer() = default;
virtual
~
packet_writer
()
=
default
;
/// Returns the next header_buffer from transport
virtual
buffer_type
next_header_buffer
()
=
0
;
virtual
buffer_type
next_header_buffer
()
=
0
;
/// Returns the next payload_buffer from transport
virtual
buffer_type
next_buffer
()
=
0
;
virtual
buffer_type
next_buffer
()
=
0
;
//
TODO: some documentation
//
/ Convenience function to write a packet consisting of multiple buffers.
//
First buffer is header.
//
/ @param buffers the buffers that make up the packet. first buffer should
//
Following buffers are one or more payload buffers for this packet
.
//
/ contain the header
.
/// @warning takes ownership of `buffers`.
/// @warning takes ownership of `buffers`.
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
write_packet
(
Ts
&
...
buffers
)
{
void
write_packet
(
Ts
&
...
buffers
)
{
...
@@ -48,6 +51,8 @@ public:
...
@@ -48,6 +51,8 @@ public:
}
}
protected:
protected:
/// Actual write_packet implementation.
/// @param buffers `span` containing all buffers of a packet.
virtual
void
write_impl
(
span
<
buffer_type
*>
buffers
)
=
0
;
virtual
void
write_impl
(
span
<
buffer_type
*>
buffers
)
=
0
;
};
};
...
...
libcaf_net/caf/net/packet_writer_impl.hpp
View file @
60c7e61e
...
@@ -27,7 +27,7 @@ namespace caf {
...
@@ -27,7 +27,7 @@ namespace caf {
namespace
net
{
namespace
net
{
/// Implements the interface for transport and application policies and
/// Implements the interface for transport and application policies and
/// dispatches member functions either to `
decorator
` or `parent`.
/// dispatches member functions either to `
object
` or `parent`.
template
<
class
Object
,
class
Parent
>
template
<
class
Object
,
class
Parent
>
class
packet_writer_impl
final
:
public
packet_writer
{
class
packet_writer_impl
final
:
public
packet_writer
{
public:
public:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment