roar
Loading...
Searching...
No Matches
include
roar
url
ipv4.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <boost/fusion/include/adapt_struct.hpp>
4
5
#include <cstdint>
6
#include <string>
7
#include <vector>
8
9
namespace
Roar
10
{
11
struct
Ipv4
12
{
13
uint8_t
octet0
;
14
uint8_t
octet1
;
15
uint8_t
octet2
;
16
uint8_t
octet3
;
17
18
std::vector<uint16_t>
toIpv6Segments
()
const
19
{
20
std::vector<uint16_t> segments(2);
21
segments[0] =
static_cast<
uint16_t
>
(
static_cast<
uint16_t
>
(
octet0
) << 8u) |
22
static_cast<
uint16_t
>
(
static_cast<
uint16_t
>
(
octet1
));
23
segments[1] =
static_cast<
uint16_t
>
(
static_cast<
uint16_t
>
(
octet2
) << 8u) |
24
static_cast<
uint16_t
>
(
static_cast<
uint16_t
>
(
octet3
));
25
return
segments;
26
}
27
28
std::string
toString
()
const
;
29
};
30
}
// namespace Roar
31
32
BOOST_FUSION_ADAPT_STRUCT(
Roar::Ipv4
, octet0, octet1, octet2, octet3)
Roar
Definition
authorization.hpp:10
Roar::Ipv4
Definition
ipv4.hpp:12
Roar::Ipv4::toIpv6Segments
std::vector< uint16_t > toIpv6Segments() const
Definition
ipv4.hpp:18
Roar::Ipv4::octet0
uint8_t octet0
Definition
ipv4.hpp:13
Roar::Ipv4::octet2
uint8_t octet2
Definition
ipv4.hpp:15
Roar::Ipv4::octet3
uint8_t octet3
Definition
ipv4.hpp:16
Roar::Ipv4::toString
std::string toString() const
Definition
ipv4.cpp:7
Roar::Ipv4::octet1
uint8_t octet1
Definition
ipv4.hpp:14
Generated by
1.9.7