1 #include "hmbdc/Copyright.hpp"
4 #include "hmbdc/app/utils/EpollTask.hpp"
5 #include "hmbdc/app/Config.hpp"
6 #include "hmbdc/text/StringTrieSet.hpp"
7 #include "hmbdc/comm/inet/Misc.hpp"
8 #include "hmbdc/time/Timers.hpp"
9 #include "hmbdc/Exception.hpp"
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netinet/ip.h>
17 #include <arpa/inet.h>
19 namespace hmbdc {
namespace app {
namespace udpcast {
24 fd = socket(AF_INET, SOCK_DGRAM, 0);
26 HMBDC_THROW(runtime_error,
"failed to create socket");
29 comm::inet::getLocalIpMatchMask(cfg.
getExt<
string>(
"ifaceAddr"));
30 struct in_addr localInterface;
31 localInterface.s_addr = inet_addr(iface.c_str());
32 if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF
33 , (
char *)&localInterface,
sizeof(localInterface)) < 0) {
34 HMBDC_THROW(runtime_error,
"failed to set ifaceAddr " << cfg.
getExt<
string>(
"ifaceAddr"));
40 using ptr = std::shared_ptr<Transport>;
45 , mtu_(config_.getExt<
size_t>(
"mtu")) {
47 cfg (hmbdcName_,
"hmbdcName")
48 (schedPolicy_,
"schedPolicy")
49 (schedPriority_,
"schedPriority")
53 char const* hmbdcName()
const {
54 return this->hmbdcName_.c_str();
57 std::tuple<char const*, int> schedSpec()
const {
58 return std::make_tuple(this->schedPolicy_.c_str(), this->schedPriority_);
61 bool operator == (
Transport const& other )
const {
62 return &config_ == &other.config_;
65 bool operator < (
Transport const& other )
const {
66 return &config_ < &other.config_;
70 std::string hmbdcName_;
71 std::string schedPolicy_;
Definition: Transport.hpp:39
class to hold an hmbdc configuration
Definition: Config.hpp:46
Definition: EpollTask.hpp:70
T getExt(const path_type ¶m, bool throwIfMissing=true) const
get a value from the config
Definition: Config.hpp:225
Definition: Transport.hpp:21