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