本文整理汇总了C++中AddressList类的典型用法代码示例。如果您正苦于以下问题:C++ AddressList类的具体用法?C++ AddressList怎么用?C++ AddressList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AddressList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG_DEBUG
Uint16 SubnetTopology::createSourcePath(Address32 source, Address32 destination, Uint16 traffic, bool managementPath,
Uint8 maxHops) {
LOG_DEBUG("createSourcePath(" << ToStr(source) << ", " << ToStr(destination) << ", traffic = " << traffic
<< ", maxHops = " << (int) maxHops << ")");
AddressList addressList;
DijkstraSearch::searchDijkstra(source, destination, nodes, addressList);
if (addressList.size() == 0) {
LOG_DEBUG("createPath: There is no path between the " << ToStr(source) << " and " << ToStr(destination));
} else {
//LOG_DEBUG("createPath() : the path is : " << NE::Model::Topology::nodesToString(sourcePath));
}
Path path(getNextPathId(), source, destination, RoutingTypes::SOURCE_ROUTING, traffic);
path.setSourcePath(addressList);
paths[path.getGraphId()] = path;
LOG_TRACE("createSourcePath end");
return path.getGraphId();
}
示例2: hostDnsServers
int VBoxNetDhcp::hostDnsServers(const ComHostPtr& host,
const RTNETADDRIPV4& networkid,
const AddressToOffsetMapping& mapping,
AddressList& servers)
{
ComBstrArray strs;
HRESULT hrc = host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(strs));
if (FAILED(hrc))
return VERR_NOT_FOUND;
/*
* Recent fashion is to run dnsmasq on 127.0.1.1 which we
* currently can't map. If that's the only nameserver we've got,
* we need to use DNS proxy for VMs to reach it.
*/
bool fUnmappedLoopback = false;
for (size_t i = 0; i < strs.size(); ++i)
{
RTNETADDRIPV4 addr;
int rc;
rc = RTNetStrToIPv4Addr(com::Utf8Str(strs[i]).c_str(), &addr);
if (RT_FAILURE(rc))
continue;
if (addr.au8[0] == 127)
{
AddressToOffsetMapping::const_iterator remap(mapping.find(addr));
if (remap != mapping.end())
{
int offset = remap->second;
addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u) + offset);
}
else
{
fUnmappedLoopback = true;
continue;
}
}
servers.push_back(addr);
}
if (servers.empty() && fUnmappedLoopback)
{
RTNETADDRIPV4 proxy;
proxy.u = networkid.u | RT_H2N_U32_C(1U);
servers.push_back(proxy);
}
return VINF_SUCCESS;
}
示例3: onTxAbort
/*** On abort, unroll allocs, clear lists, exit epoch */
void onTxAbort()
{
AddressList::iterator i, e;
for (i = allocs.begin(), e = allocs.end(); i != e; ++i) {
free(*i);
}
frees.reset();
allocs.reset();
*my_ts = 1+*my_ts;
}
示例4: onTxCommit
/*** On commit, perform frees, clear lists, exit epoch */
void onTxCommit()
{
AddressList::iterator i, e;
for (i = frees.begin(), e = frees.end(); i != e; ++i) {
schedForReclaim(*i);
}
frees.reset();
allocs.reset();
*my_ts = 1+*my_ts;
}
示例5: AutoCollectAddresses
void AutoCollectAddresses(const Message *message,
MAction autocollectFlag,
bool senderOnly,
bool collectNamed,
const String& bookName,
const String& groupName,
wxFrame *frame)
{
static const MessageAddressType addressTypesToCollect[] =
{
// In this array, the values corresponding to 'Sender' headers
// (e.g. From and ReplyTo) must appear before the others. And if
// some other 'sender' headers must be taken into account, the ending
// index in the for loop below (named stopAt) must be changed.
MAT_REPLYTO,
MAT_FROM,
MAT_TO,
MAT_CC,
};
// the email addresses we have already seen
wxArrayString addressesSeen;
const size_t stopAt = senderOnly ? 2 : WXSIZEOF(addressTypesToCollect);
for ( size_t n = 0; n < stopAt; n++ )
{
AddressList *addrList = message->GetAddressList(addressTypesToCollect[n]);
if ( !addrList )
continue;
for ( Address *addr = addrList->GetFirst();
addr;
addr = addrList->GetNext(addr) )
{
const String email = addr->GetEMail();
if ( addressesSeen.Index(email) == wxNOT_FOUND )
{
addressesSeen.Add(email);
AutoCollectAddress(email,
addr->GetName(),
autocollectFlag,
collectNamed,
bookName,
groupName,
frame);
}
}
addrList->DecRef();
}
}
示例6: parseAddressList
AddrSpecList VacationDialog::mailAliases() const {
QCString text = mMailAliasesEdit->text().latin1(); // ### IMAA: !ok
AddressList al;
const char * s = text.begin();
parseAddressList( s, text.end(), al );
AddrSpecList asl;
for ( AddressList::const_iterator it = al.begin() ; it != al.end() ; ++it ) {
const MailboxList & mbl = (*it).mailboxList;
for ( MailboxList::const_iterator jt = mbl.begin() ; jt != mbl.end() ; ++jt )
asl.push_back( (*jt).addrSpec );
}
return asl;
}
示例7: NetException
const IpAddress& NetworkInterfaceImpl::get_dest_address(AddressList::size_type index) const {
if (!is_p2p()) {
throw NetException("Unsupported operation");
} else if (index < m_address_list.size()) {
return std::get<NetworkInterface::BROADCAST_ADDRESS>(m_address_list[index]);
}
throw NetException("IpAddress of NetworkInterface not found");
}
示例8: AddressList
void AddressCluster::sList()
{
AddressList* newdlg = new AddressList(this, "AddressList", true);
if (newdlg)
{
int id = newdlg->exec();
if (id != QDialog::Rejected)
{
setId(id);
_selected = true;
}
}
else
QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.")
.arg(__FILE__)
.arg(__LINE__),
tr("Could not instantiate a List Dialog"));
}
示例9: onTxAbort
/*** On abort, unroll allocs, clear lists, exit epoch */
void onTxAbort()
{
return;
// printf("on tx abort\n");
AddressList::iterator i, e;
/*
if (allocs.size() > 0){
printf("WARNING: Aborted a transaction that allocated"
"elements. Sitevm wont' free those elements (but support for"
"this is coming soon!).\n");
}
*/
/*
//This is already done as part of sitevm now.
for (i = allocs.begin(), e = allocs.end(); i != e; ++i)
sitefree(*i);
*/
frees.reset();
allocs.reset();
*my_ts = 1+*my_ts;
}
示例10: main
//----------------------------------------------------------------------------------------------------------------
/// @brief
/// prints menu and takes appropriate action
//----------------------------------------------------------------------------------------------------------------
int main(void)
{
AddressList addresses;
int choice;
printMenu();
cin>>choice;
while(choice != 6)
{
switch (choice)
{
case 1:
addresses.addAddress();
break;
case 2:
addresses.delAddress();
break;
case 3:
addresses.editAddress();
break;
case 4:
addresses.genBcards();
break;
case 5:
addresses.genAcards();
break;
default:
cout<<"invalid input";
break;
}
printMenu();
cin>>choice;
}
}
示例11: hostDnsServers
/**
* @note: const dropped here, because of map<K,V>::operator[] which isn't const, map<K,V>::at() has const
* variant but it's C++11.
*/
int hostDnsServers(const ComHostPtr& host, const RTNETADDRIPV4& networkid,
/*const*/ AddressToOffsetMapping& mapping, AddressList& servers)
{
servers.clear();
ComBstrArray strs;
if (SUCCEEDED(host->COMGETTER(NameServers)(ComSafeArrayAsOutParam(strs))))
{
RTNETADDRIPV4 addr;
int rc;
for (unsigned int i = 0; i < strs.size(); ++i)
{
rc = RTNetStrToIPv4Addr(com::Utf8Str(strs[i]).c_str(), &addr);
if (RT_SUCCESS(rc))
{
if (addr.au8[0] == 127)
{
/* XXX: here we want map<K,V>::at(const K& k) const */
if (mapping[addr] != 0)
{
addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u)
+ mapping[addr]);
}
else
continue; /* XXX: Warning here (local mapping wasn't registered) */
}
servers.push_back(addr);
}
}
}
else
return VERR_NOT_FOUND;
return VINF_SUCCESS;
}
示例12: localMappings
int VBoxNetDhcp::fetchAndUpdateDnsInfo()
{
ComHostPtr host;
if (SUCCEEDED(virtualbox->COMGETTER(Host)(host.asOutParam())))
{
AddressToOffsetMapping mapIp4Addr2Off;
int rc = localMappings(m_NATNetwork, mapIp4Addr2Off);
/* XXX: here could be several cases: 1. COM error, 2. not found (empty) 3. ? */
AssertMsgRCReturn(rc, ("Can't fetch local mappings"), rc);
RTNETADDRIPV4 address = getIpv4Address();
RTNETADDRIPV4 netmask = getIpv4Netmask();
AddressList nameservers;
rc = hostDnsServers(host, networkid(address, netmask), mapIp4Addr2Off, nameservers);
AssertMsgRCReturn(rc, ("Debug me!!!"), rc);
/* XXX: Search strings */
std::string domain;
rc = hostDnsDomain(host, domain);
AssertMsgRCReturn(rc, ("Debug me!!"), rc);
{
VBoxNetALock(this);
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
confManager->flushAddressList(RTNET_DHCP_OPT_DNS);
for (AddressList::iterator it = nameservers.begin(); it != nameservers.end(); ++it)
confManager->addToAddressList(RTNET_DHCP_OPT_DNS, *it);
confManager->setString(RTNET_DHCP_OPT_DOMAIN_NAME, domain);
}
}
return VINF_SUCCESS;
}
示例13: switch
int SearchTask::valueSearchResults()
{
const int cbRate = 15;
int scans = 0;
int length;
unsigned int readLen;
unsigned long section, size;
char finalDumpBytes[3];
char *dataBuf;
switch (m_searchValueType)
{
case SEARCH_VALUE_TYPE_1BYTE: length = 1; break;
case SEARCH_VALUE_TYPE_2BYTE: length = 2; break;
default: length = 4; break;
}
unsigned resListSize = getNumberOfResults(*m_results);
for (ResultList::iterator it=m_results->begin(); it!=m_results->end(); ++it) //read each section
{
if (it->second.size() == 0)
continue;
AddressList keep;
m_valueSearcher.clear();
section = it->first;
size = it->second.size();
if (size > 10) //lets grab the chunk!
{
if (m_cancel)
return TASK_ERROR_CANCEL;
if (section+RANGE_INTERVAL < 0xFFFFFFFF-3 && m_ccapi->readMemory(section+RANGE_INTERVAL, 3) == 0)
{
dataBuf = m_ccapi->getData(readLen);
memcpy(finalDumpBytes, dataBuf, readLen);
}
if (m_ccapi->readMemory(section, RANGE_INTERVAL) == 0)
{
dataBuf = m_ccapi->getData(readLen);
if (m_ccapi->insertData(readLen, finalDumpBytes, 3))
{
for (AddressList::iterator addrIt = it->second.begin(); addrIt != it->second.end();) //read all addresses in a section
{
if (m_valueSearcher.digestValue(&dataBuf[((*addrIt)->address) - section], *addrIt, section)) //we need to keep it!
keep.push_back(*addrIt);
addrIt++;
if (scans % cbRate == 0) progressCallback(this, scans, resListSize);
scans++;
}
it->second = keep;
}
}
}
else
{
for (AddressList::iterator addrIt = it->second.begin(); addrIt != it->second.end();) //read all addresses in asection
{
if (m_cancel)
return TASK_ERROR_CANCEL;
if (m_ccapi->readMemory(((*addrIt)->address), length) == 0)
{
dataBuf = m_ccapi->getData(readLen);
if (m_valueSearcher.digestValue(dataBuf, *addrIt, section)) //we need to keep it!
keep.push_back(*addrIt);
addrIt++;
if (scans % cbRate == 0) progressCallback(this, scans, resListSize);
scans++;
}
}
it->second = keep;
}
}
m_taskState = Task::COMPLETE;
progressCallback(this, resListSize, resListSize);
return TASK_ERROR_NONE;
}
示例14: test
/// 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;
//.........这里部分代码省略.........
示例15: txFree
/*** Wrapper to thread-specific allocator for freeing memory */
void txFree(void* ptr)
{
if ((*my_ts)&1) {
frees.insert(ptr);
} else {
free(ptr);
}
}