本文整理汇总了C++中AddressList::add_property方法的典型用法代码示例。如果您正苦于以下问题:C++ AddressList::add_property方法的具体用法?C++ AddressList::add_property怎么用?C++ AddressList::add_property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddressList
的用法示例。
在下文中一共展示了AddressList::add_property方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: na
/// main method for manual testing
void
test(const char* logname)
{
hostaddresslist_t& ntlpv4addr= gconf.getparref< hostaddresslist_t >(gistconf_localaddrv4);
hostaddresslist_t& ntlpv6addr= gconf.getparref< hostaddresslist_t >(gistconf_localaddrv6);
// check whether all addresses are really pure IPv4
if (ntlpv4addr.empty() == false) {
hostaddresslist_t::iterator it= ntlpv4addr.begin();
while (it != ntlpv4addr.end())
{
if ( !it->is_ipv4() )
{
WLog("main", "Detected non IPv4 address, removing " << *it );
it= ntlpv4addr.erase(it);
}
else
it++;
} // end while
}
// check whether all addresses are really pure IPv6
if (ntlpv6addr.empty() == false) {
hostaddresslist_t::iterator it= ntlpv6addr.begin();
while (it != ntlpv6addr.end())
{
if ( !it->is_ipv6() )
{
WLog("main", "Detected non-IPv6 address, removing " << *it );
it= ntlpv6addr.erase(it);
}
else
it++;
} // end while
}
// this will set default values
NTLPStarterParam ntlppar;
AddressList *addresses = new AddressList();
if (ntlpv4addr.size() == 0 && ntlpv6addr.size() == 0) {
addresses->add_host_prop(NULL, AddressList::ConfiguredAddr_P);
}
if (!ntlpv4addr.empty())
{
hostaddresslist_t::iterator it= ntlpv4addr.begin();
while (it != ntlpv4addr.end())
{
netaddress na(*it);
na.set_pref_len(32);
addresses->add_property(na, AddressList::ConfiguredAddr_P);
it++;
} // end while
}
if (!ntlpv6addr.empty())
{
hostaddresslist_t::iterator it= ntlpv6addr.begin();
while (it != ntlpv6addr.end())
{
netaddress na(*it);
na.set_pref_len(128);
addresses->add_property(na, AddressList::ConfiguredAddr_P);
it++;
} // end while
}
// set specified IP addresses
ntlppar.addresses = addresses;
// fill the parameters from configfile or command line
// (parameters given by command line will override these)
if (config[gconf.parname(gistconf_udpport)].empty() == false) gconf.setpar(gistconf_udpport, (uint16) StringToInt(config[gconf.parname(gistconf_udpport)]));
if (config[gconf.parname(gistconf_tcpport)].empty() == false) gconf.setpar(gistconf_tcpport, (uint16) StringToInt(config[gconf.parname(gistconf_tcpport)]));
if (config[gconf.parname(gistconf_sctpport)].empty() == false) gconf.setpar(gistconf_sctpport, (uint16) StringToInt(config[gconf.parname(gistconf_sctpport)]));
if (config[gconf.parname(gistconf_tlsport)].empty() == false) gconf.setpar(gistconf_tlsport, (uint16) StringToInt(config[gconf.parname(gistconf_tlsport)]));
if (config[gconf.parname(gistconf_retrylimit)].empty() == false) gconf.setpar(gistconf_retrylimit, (uint32) StringToInt(config[ gconf.parname(gistconf_retrylimit)]));
if (config[gconf.parname(gistconf_retryperiod)].empty() == false) gconf.setpar(gistconf_retryperiod, (uint32) StringToInt(config[ gconf.parname(gistconf_retryperiod)]));
if (config[gconf.parname(gistconf_retryfactor)].empty() == false) gconf.setpar(gistconf_retryfactor, StringToDouble(config[ gconf.parname(gistconf_retryfactor)]));
if (config[gconf.parname(gistconf_rs_validity_time)].empty() == false) gconf.setpar(gistconf_rs_validity_time, (uint32) StringToInt(config[ gconf.parname(gistconf_rs_validity_time)]));
if (config[gconf.parname(gistconf_refresh_limit)].empty() == false) gconf.setpar(gistconf_refresh_limit, (uint32) StringToInt(config[ gconf.parname(gistconf_refresh_limit)]));
if (config[gconf.parname(gistconf_ma_hold_time)].empty() == false) gconf.setpar(gistconf_ma_hold_time, (uint32) StringToInt(config[ gconf.parname(gistconf_ma_hold_time)]));
if (config[gconf.parname(gistconf_secrets_refreshtime)].empty() == false) gconf.setpar(gistconf_secrets_refreshtime, (uint32) StringToInt(config[ gconf.parname(gistconf_secrets_refreshtime)]));
if (config[gconf.parname(gistconf_secrets_count)].empty() == false) gconf.setpar(gistconf_secrets_count, (uint32) StringToInt(config[ gconf.parname(gistconf_secrets_count)]));
if (config[gconf.parname(gistconf_secrets_length)].empty() == false) gconf.setpar(gistconf_secrets_length, (uint16) StringToInt(config[ gconf.parname(gistconf_secrets_length)]));
if (config[gconf.parname(gistconf_delayedstate)].empty() == false) gconf.setpar(gistconf_delayedstate, StringToBool(config[ gconf.parname(gistconf_delayedstate)]));
if (config[gconf.parname(gistconf_senddatainquery)].empty() == false) gconf.setpar(gistconf_senddatainquery, StringToBool(config[ gconf.parname(gistconf_senddatainquery)]));
if (config[gconf.parname(gistconf_confirmrequired)].empty() == false) gconf.setpar(gistconf_confirmrequired, StringToBool(config[ gconf.parname(gistconf_confirmrequired)]));
if (config[gconf.parname(gistconf_reqhelloecho)].empty() == false) gconf.setpar(gistconf_reqhelloecho, StringToBool(config[ gconf.parname(gistconf_reqhelloecho)]));
if (config[gconf.parname(gistconf_advertise_sctp)].empty() == false) gconf.setpar(gistconf_advertise_sctp, StringToBool(config[ gconf.parname(gistconf_advertise_sctp)]));
if (config[gconf.parname(gistconf_verbose_error_responses)].empty() == false) gconf.setpar(gistconf_verbose_error_responses, StringToBool(config[ gconf.parname(gistconf_verbose_error_responses)]));
if (config[gconf.parname(gistconf_debug_tp)].empty() == false) gconf.setpar(gistconf_debug_tp, StringToBool(config[ gconf.parname(gistconf_debug_tp)]));
#ifdef USE_FLOWINFO
// Create a flowinfoservice thread
FlowinfoParam fiparam;
//.........这里部分代码省略.........