SOLA
Loading...
Searching...
No Matches
solanet
include
solanet
network_udp
network_udp.h
1
// Copyright The SOLA Contributors
2
//
3
// Licensed under the MIT License.
4
// For details on the licensing terms, see the LICENSE file.
5
// SPDX-License-Identifier: MIT
6
7
#ifndef SOLANET_NETWORK_UDP_NETWORK_H_
8
#define SOLANET_NETWORK_UDP_NETWORK_H_
9
10
#include <cstdint>
11
#include <functional>
12
#include <memory>
13
#include <string>
14
15
#include "message.h"
16
17
namespace
solanet {
18
class
Network
{
19
public
:
25
explicit
Network
(
const
std::function<
void
(
const
Message
&)> &callback);
26
27
Network
(
const
std::string &ip,
const
std::function<
void
(
const
Message
&)> &callback);
28
29
~Network
();
30
31
// Forbid copy/move operations
32
Network
(
const
Network
&) =
delete
;
33
Network
&operator=(
const
Network
&) =
delete
;
34
Network
(
const
Network
&&) =
delete
;
35
Network
&operator=(
Network
&&) =
delete
;
36
41
void
send
(
const
Message
&msg);
42
43
uint16_t getPort()
const
;
44
45
std::string getIP()
const
;
46
47
std::string getConnectionString()
const
{
return
getIP() +
":"
+ std::to_string(getPort()); }
48
49
private
:
50
class
Impl
;
51
std::unique_ptr<Impl> pimpl_;
52
};
53
}
// namespace solanet
54
55
#endif
// SOLANET_NETWORK_UDP_NETWORK_H_
solanet::Network::Impl
Definition
ns3SolaNet.cpp:37
solanet::Message
Definition
message.h:14
solanet::Network
Definition
network_udp.h:18
solanet::Network::send
void send(const Message &msg)
Definition
ns3SolaNet.cpp:156
Generated by
1.9.8