Beispiel #1
1
 template<typename... Args> explicit
 tuntap_base(const Args&... args)
     : super(args...),
       m_interface(kwget(interface, tuntap_default_name, args...)),
       m_type_str(kwget(type, tuntap_default_type, args...)),
       m_type(iface_type())
 {
     create();
     read_mtu();
 }
Beispiel #2
0
    template<typename... Args> explicit
    eth_topology(const Args&... args)
        : super(args...),
          m_source(m_source_buf),
          m_destination(m_destination_buf),
          m_neighbor(m_neighbor_buf),
          m_helper(m_helper_buf),
          m_two_hop(m_two_hop_buf)
    {
        constexpr const char *def = NULL;
        const char *source_tmp = kwget(source, def, args...);
        const char *destination_tmp = kwget(destination, def, args...);
        const char *neighbor_tmp = kwget(neighbor, def, args...);
        const char *helper_tmp = kwget(helper, def, args...);
        const char *two_hop_tmp = kwget(two_hop, def, args...);

        if (!parse_address(source_tmp, m_source))
            m_source = NULL;

        if (!parse_address(destination_tmp, m_destination))
            m_destination = NULL;

        if (!parse_address(neighbor_tmp, m_neighbor))
            m_neighbor = NULL;

        if (!parse_address(helper_tmp, m_helper))
            m_helper = NULL;

        if (!parse_address(two_hop_tmp, m_two_hop))
            m_two_hop = NULL;
    }
Beispiel #3
0
    counters(const Args&... args)
        : super(args...)
    {
        double r = kwget(redundancy, .10, args...);
        size_t g = kwget(symbols, 100, args...);

        m_symbols = g;
        m_redundant = g*(r/2);
        m_wm_high = g + g*.05;
        m_wm_low = 2;
        ratio_packets = g*.8 + m_redundant;
        std::cout << "ratio: " << ratio_packets << std::endl;
        std::cout << "redundancy: " << r << std::endl;
        std::cout << "symbols: " << g << std::endl;
    }
Beispiel #4
0
 template<typename... Args> explicit
 loss(const Args&... args)
     : super(args...),
       m_generator(time(0)),
       m_dist(kwget(loss_prob, .5, args...))
 {}
Beispiel #5
0
Val kwget(const Kwarg<Key>& key, Val value,
        const Kwarg<bool>& param, const Args&... more) {
    return kwget(key, value, param = true, more...);
}
Beispiel #6
0
Val kwget(const Kwarg<Key>& key, Val value,
        const KwargsImpl::Param<Par>& param, const Args&... more) {
    if (&key == param.key)
        return KwargsImpl::Ret<Val, decltype(param.value)>()(param.value);
    return kwget(key, value, more...);
}
Beispiel #7
0
 template<typename... Args> explicit
 inet_sock(const Args&... args)
     : m_port(kwget(port, default_port, args...)),
       m_local_address(kwget(local_address, default_local, args...)),
       m_remote_address(kwget(remote_address, default_remote, args...))
 {}