Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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 Framework
Commits
1b2652ee
Commit
1b2652ee
authored
Nov 03, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add functionality for datagram header
parent
b8bb11b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
libcaf_io/caf/io/network/datagram_header.hpp
libcaf_io/caf/io/network/datagram_header.hpp
+29
-1
libcaf_io/src/datagram_header.cpp
libcaf_io/src/datagram_header.cpp
+36
-0
No files found.
libcaf_io/caf/io/network/datagram_header.hpp
View file @
1b2652ee
...
...
@@ -22,17 +22,45 @@
#include <cstdint>
#include "caf/meta/type_name.hpp"
namespace
caf
{
namespace
io
{
namespace
network
{
/// This header adds a sequence number and response port to
/// datagram messages carrying BASP messages.
struct
header
{
struct
datagram_
header
{
uint32_t
sequence_number
;
uint16_t
response_port
;
inline
datagram_header
(
uint32_t
seq
,
uint16_t
port
)
:
sequence_number
(
seq
),
response_port
(
port
)
{
// nop
}
datagram_header
()
=
default
;
};
/// @relates datagram_header
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
datagram_header
&
hdr
)
{
return
f
(
meta
::
type_name
(
"datagram_header"
),
hdr
.
sequence_number
,
hdr
.
response_port
);
}
/// @relates datagram_header
bool
operator
==
(
const
datagram_header
&
lhs
,
const
datagram_header
&
rhs
);
/// @relates datagram_header
inline
bool
operator
!=
(
const
datagram_header
&
lhs
,
const
datagram_header
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
/// Size of the datagram header in serialized form
constexpr
size_t
datagram_header_size
=
sizeof
(
uint32_t
)
+
sizeof
(
uint16_t
);
}
// namespace network
}
// namespace io
}
// namespace caf
...
...
libcaf_io/src/datagram_header.cpp
0 → 100644
View file @
1b2652ee
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/network/datagram_header.hpp"
#include <sstream>
namespace
caf
{
namespace
io
{
namespace
network
{
bool
operator
==
(
const
datagram_header
&
lhs
,
const
datagram_header
&
rhs
)
{
return
lhs
.
sequence_number
==
rhs
.
sequence_number
&&
lhs
.
response_port
==
rhs
.
response_port
;
}
}
// namespace network
}
// namespace io
}
// namespace caf
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