本文整理汇总了C++中Address类的典型用法代码示例。如果您正苦于以下问题:C++ Address类的具体用法?C++ Address怎么用?C++ Address使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsingAddress
void parsingAddress(Address &a)
{
QString line = a.getRawAddressString();
a.setCorrect(false);
int n1=line.indexOf('(');
if (n1>0 && (line.indexOf(')',n1)>0))
{
int n2=line.indexOf(')', n1);
int n3=n2-n1;
a.setAdditional(line.mid(n1+1, n3-1));
line.remove(n1, n3+1);
}
QRegExp reg(BaseRegPattern, Qt::CaseInsensitive);
int pos=reg.indexIn(line);
if(pos==-1)
{
a.setCorrect(false);
// reg.setPattern(PatternForNotCorrect);
// pos=reg.indexIn(line);
// if(pos!=-1)
// {
// QStringList caps = reg.capturedTexts();
// a.setBuildId(caps.at(3));
// a.setStreetId(caps.at(1));
// }
}
else
{
a.setCorrect(true);
QStringList caps = reg.capturedTexts();
a.setBuildId(caps.at(19));
a.setStreetId(caps.at(1));
a.setTypeOfFSubj(caps.at(4));
a.setFsubj(caps.at(3));
a.setDistrict(caps.at(7));
a.setTypeOfCity1(caps.at(9));
a.setCity1(caps.at(10));
a.setTypeOfCity2(caps.at(12));
a.setCity2(caps.at(13));
a.setStreet(caps.at(16));
a.setTypeOfStreet(caps.at(17));
a.setBuild(caps.at(23));
a.setKorp(caps.at(28));
a.setLitera(caps.at(25)+caps.at(26)+caps.at(29));
// if(a.getBuildId()==14042969)
// {
// int n=0;
// foreach (QString s, caps) {
// qDebug().noquote() << "[" << n << "]=" << s;
// n++;
// }
// qDebug().noquote() << a.toString(PARSED);
// assert(0);
// }
}
}
示例2: b
void NetInterface::handlePunch(const Address &theAddress, BitStream *stream)
{
S32 i, j;
NetConnection *conn = nullptr;
Nonce firstNonce;
firstNonce.read(stream);
ByteBuffer b(firstNonce.data, Nonce::NonceSize);
TNLLogMessageV(LogNetInterface, ("Received punch packet from %s - %s", theAddress.toString(), b.encodeBase64()->getBuffer()));
for(i = 0; i < mPendingConnections.size(); i++)
{
conn = mPendingConnections[i];
ConnectionParameters &theParams = conn->getConnectionParameters();
if(conn->getConnectionState() != NetConnection::SendingPunchPackets)
continue;
if((theParams.mIsInitiator && firstNonce != theParams.mServerNonce) ||
(!theParams.mIsInitiator && firstNonce != theParams.mNonce))
continue;
// first see if the address is in the possible addresses list:
for(j = 0; j < theParams.mPossibleAddresses.size(); j++)
if(theAddress == theParams.mPossibleAddresses[j])
break;
// if there was an exact match, just exit the loop, or
// continue on to the next pending if this is not an initiator:
if(j != theParams.mPossibleAddresses.size())
{
if(theParams.mIsInitiator)
break;
else
continue;
}
// if there was no exact match, we may have a funny NAT in the
// middle. But since a packet got through from the remote host
// we'll want to send a punch to the address it came from, as long
// as only the port is not an exact match:
for(j = 0; j < theParams.mPossibleAddresses.size(); j++)
if(theAddress.isEqualAddress(theParams.mPossibleAddresses[j]))
break;
// if the address wasn't even partially in the list, just exit out
if(j == theParams.mPossibleAddresses.size())
continue;
// otherwise, as long as we don't have too many ping addresses,
// add this one to the list:
if(theParams.mPossibleAddresses.size() < 5)
theParams.mPossibleAddresses.push_back(theAddress);
// if this is the initiator of the arranged connection, then
// process the punch packet from the remote host by issueing a
// connection request.
if(theParams.mIsInitiator)
break;
}
if(i == mPendingConnections.size())
return;
ConnectionParameters &theParams = conn->getConnectionParameters();
SymmetricCipher theCipher(theParams.mArrangedSecret);
if(!stream->decryptAndCheckHash(NetConnection::MessageSignatureBytes, stream->getBytePosition(), &theCipher))
return;
Nonce nextNonce;
nextNonce.read(stream);
if(nextNonce != theParams.mNonce)
return;
// see if the connection needs to be authenticated or uses key exchange
if(stream->readFlag())
{
if(stream->readFlag())
{
theParams.mCertificate = new Certificate(stream);
if(!theParams.mCertificate->isValid() || !conn->validateCertficate(theParams.mCertificate, true))
return;
theParams.mPublicKey = theParams.mCertificate->getPublicKey();
}
else
{
theParams.mPublicKey = new AsymmetricKey(stream);
if(!theParams.mPublicKey->isValid() || !conn->validatePublicKey(theParams.mPublicKey, true))
return;
}
if(mPrivateKey.isNull() || mPrivateKey->getKeySize() != theParams.mPublicKey->getKeySize())
{
// we don't have a private key, so generate one for this connection
theParams.mPrivateKey = new AsymmetricKey(theParams.mPublicKey->getKeySize());
}
else
theParams.mPrivateKey = mPrivateKey;
//.........这里部分代码省略.........
示例3:
BreakpointLocationSP
BreakpointResolver::AddLocation(Address loc_addr, bool *new_location)
{
loc_addr.Slide(m_offset);
return m_breakpoint->AddLocation(loc_addr, new_location);
}
示例4: stf
inline void MacroAssembler::stf(FloatRegisterImpl::Width w, FloatRegister d, const Address& a, int offset) {
relocate(a.rspec(offset));
if (a.has_index()) { assert(offset == 0, ""); stf(w, d, a.base(), a.index() ); }
else { stf(w, d, a.base(), a.disp() + offset); }
}
示例5: main
int main( int argc, char * argv[] )
{
// initialize socket layer
if ( !InitializeSockets() )
{
printf( "failed to initialize sockets\n" );
return 1;
}
// create socket
int port = 30000;
if ( argc == 2 )
port = atoi( argv[1] );
printf( "creating socket on port %d\n", port );
Socket socket;
if ( !socket.Open( port ) )
{
printf( "failed to create socket!\n" );
return 1;
}
// read in addresses.txt to get the set of addresses we will send packets to
vector<Address> addresses;
string line;
ifstream file( "addresses.txt" );
if ( !file.is_open() )
{
printf( "failed to open 'addresses.txt'\n" );
return 1;
}
while ( !file.eof() )
{
getline( file, line );
int a,b,c,d,port;
if ( sscanf( line.c_str(), "%d.%d.%d.%d:%d", &a, &b, &c, &d, &port ) == 5 )
addresses.push_back( Address( a,b,c,d,port ) );
}
file.close();
// send and receive packets until the user ctrl-breaks...
while ( true )
{
const char data[] = "hello world!";
for ( int i = 0; i < (int) addresses.size(); ++i )
socket.Send( addresses[i], data, sizeof( data ) );
while ( true )
{
Address sender;
unsigned char buffer[256];
int bytes_read = socket.Receive( sender, buffer, sizeof( buffer ) );
if ( !bytes_read )
break;
printf( "received packet from %d.%d.%d.%d:%d (%d bytes)\n", sender.GetA(), sender.GetB(), sender.GetC(), sender.GetD(), sender.GetPort(), bytes_read );
}
wait_seconds( 1.0f );
}
// shutdown socket layer
ShutdownSockets();
return 0;
}
示例6: add
// form effective addresses this way:
inline void MacroAssembler::add(const Address& a, Register d, int offset) {
if (a.has_index()) add(a.base(), a.index(), d);
else { add(a.base(), a.disp() + offset, d, a.rspec(offset)); offset = 0; }
if (offset != 0) add(d, offset, d);
}
示例7: prefetch
inline void MacroAssembler::prefetch(const Address& a, PrefetchFcn f, int offset) {
relocate(a.rspec(offset));
assert(!a.has_index(), "");
prefetch(a.base(), a.disp() + offset, f);
}
示例8: L1CacheMachIDToProcessorNum
bool TransactionConflictManager::shouldNackStore(Address addr, uint64 remote_timestamp, MachineID remote_id){
bool existConflict = false;
int remote_proc = L1CacheMachIDToProcessorNum(remote_id);
int remote_thread = 0;
int remote_logical_proc_num = remote_proc * RubyConfig::numberofSMTThreads() + remote_thread;
string conflict_res_policy(XACT_CONFLICT_RES);
if (XACT_EAGER_CD && !XACT_LAZY_VM){
if (XACT_MGR->isInWriteFilterSummary(addr)){
for (int i = 0; i < RubyConfig::numberofSMTThreads(); i++){
setLowestConflictLevel(i, addr, true);
}
if (conflict_res_policy == "TIMESTAMP"){
assert(!OpalInterface::isOpalLoaded());
if (getTimestamp(0) >= remote_timestamp){
XACT_MGR->setAbortFlag(0, addr);
if (ATMTP_ENABLED) {
XACT_MGR->setCPS_coh(0);
}
setEnemyProcessor(0, remote_logical_proc_num);
m_magicWaitingOn[0] = remote_logical_proc_num;
m_magicWaitingTime[0] = remote_timestamp;
m_needMagicWait[0] = true;
// remove this addr from isolation checker
if(XACT_ISOLATION_CHECK){
//cout << "REMOVING ADDR " << addr << " FROM READ SET OF " << getProcID() << endl;
Address temp = addr;
temp.makeLineAddress();
int transactionLevel = XACT_MGR->getTransactionLevel(0);
for(int level=1; level<=transactionLevel; ++level){
g_system_ptr->getXactIsolationChecker()->removeFromWriteSet(getProcID(), temp, level);
}
}
}
}
return true;
} else if (XACT_MGR->isInReadFilterSummary(addr)){
for (int i = 0; i < RubyConfig::numberofSMTThreads(); i++){
setLowestConflictLevel(i, addr, true);
}
if (conflict_res_policy == "HYBRID" || conflict_res_policy == "TIMESTAMP"){
assert(!OpalInterface::isOpalLoaded());
if (getTimestamp(0) >= remote_timestamp){
XACT_MGR->setAbortFlag(0, addr);
if (ATMTP_ENABLED) {
XACT_MGR->setCPS_coh(0);
}
setEnemyProcessor(0, remote_logical_proc_num);
// remove this addr from isolation checker
if(XACT_ISOLATION_CHECK){
//cout << "REMOVING ADDR " << addr << " FROM READ SET OF " << getProcID() << endl;
Address temp = addr;
temp.makeLineAddress();
int transactionLevel = XACT_MGR->getTransactionLevel(0);
for(int level=1; level<=transactionLevel; ++level){
g_system_ptr->getXactIsolationChecker()->removeFromReadSet(getProcID(), temp, level);
}
}
return false;
} else {
return true;
}
}
return true;
}
return false;
} else if (XACT_EAGER_CD && XACT_LAZY_VM){
if (XACT_MGR->isInWriteFilterSummary(addr) ||
XACT_MGR->isInReadFilterSummary(addr)){
assert(!OpalInterface::isOpalLoaded());
if (XACT_MGR->isTokenOwner(0)) return true;
if (conflict_res_policy == "BASE"){
int proc = getLogicalProcID(0);
//cout << "Proc " << proc << " STORE SETTING ABORT FLAG PC = " << SIMICS_get_program_counter(proc) << " Remote Proc = " << remote_logical_proc_num << " RemotePC = " << SIMICS_get_program_counter(remote_logical_proc_num) << " addr = " << addr << endl;
XACT_MGR->setAbortFlag(0, addr);
if (ATMTP_ENABLED) {
XACT_MGR->setCPS_coh(0);
}
setEnemyProcessor(0, remote_logical_proc_num);
// remove this addr from isolation checker
if(XACT_ISOLATION_CHECK){
//cout << "REMOVING ADDR " << addr << " FROM READ SET OF " << getProcID() << endl;
Address temp = addr;
temp.makeLineAddress();
if(XACT_MGR->isInWriteFilterSummary(addr)){
int transactionLevel = XACT_MGR->getTransactionLevel(0);
for(int level=1; level<=transactionLevel; ++level){
g_system_ptr->getXactIsolationChecker()->removeFromWriteSet(getProcID(), temp, level);
}
}
if(XACT_MGR->isInReadFilterSummary(addr)){
int transactionLevel = XACT_MGR->getTransactionLevel(0);
for(int level=1; level<=transactionLevel; ++level){
g_system_ptr->getXactIsolationChecker()->removeFromReadSet(getProcID(), temp, level);
}
}
}
return false;
} else if (conflict_res_policy == "TIMESTAMP"){
if (getTimestamp(0) >= remote_timestamp){
XACT_MGR->setAbortFlag(0, addr);
//.........这里部分代码省略.........
示例9: ResolveRendezvousAddress
/// Locates the address of the rendezvous structure. Returns the address on
/// success and LLDB_INVALID_ADDRESS on failure.
static addr_t ResolveRendezvousAddress(Process *process) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
addr_t info_location;
addr_t info_addr;
Status error;
if (!process) {
if (log)
log->Printf("%s null process provided", __FUNCTION__);
return LLDB_INVALID_ADDRESS;
}
// Try to get it from our process. This might be a remote process and might
// grab it via some remote-specific mechanism.
info_location = process->GetImageInfoAddress();
if (log)
log->Printf("%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
// If the process fails to return an address, fall back to seeing if the
// local object file can help us find it.
if (info_location == LLDB_INVALID_ADDRESS) {
Target *target = &process->GetTarget();
if (target) {
ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(target);
if (addr.IsValid()) {
info_location = addr.GetLoadAddress(target);
if (log)
log->Printf(
"%s resolved via direct object file approach to 0x%" PRIx64,
__FUNCTION__, info_location);
} else {
if (log)
log->Printf("%s FAILED - direct object file approach did not yield a "
"valid address",
__FUNCTION__);
}
}
}
if (info_location == LLDB_INVALID_ADDRESS) {
if (log)
log->Printf("%s FAILED - invalid info address", __FUNCTION__);
return LLDB_INVALID_ADDRESS;
}
if (log)
log->Printf("%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64,
__FUNCTION__, process->GetAddressByteSize(), info_location);
info_addr = process->ReadPointerFromMemory(info_location, error);
if (error.Fail()) {
if (log)
log->Printf("%s FAILED - could not read from the info location: %s",
__FUNCTION__, error.AsCString());
return LLDB_INVALID_ADDRESS;
}
if (info_addr == 0) {
if (log)
log->Printf("%s FAILED - the rendezvous address contained at 0x%" PRIx64
" returned a null value",
__FUNCTION__, info_location);
return LLDB_INVALID_ADDRESS;
}
return info_addr;
}
示例10: upBound
//dump method
void TVF::dump(Address& a, unsigned length, const unsigned char* data) {
Address lowBound;
Address upBound(1);
unsigned index = 0;
if(length > index && a == lowBound) {
_cutoffFrequency = data[index];
index++;
++a;
}
++lowBound;
++upBound;
if(length > index && a == lowBound) {
_resonance = data[index];
index++;
++a;
}
++lowBound;
++upBound;
if(length > index && a == lowBound) {
_cutoffPointKeyFollow = (FracKeyFollow)data[index];
index++;
++a;
}
++lowBound;
upBound += DUMP_KEYBIAS_LENGTH;
if(length > index && a >= lowBound && a < upBound) {
Address la = a - lowBound;
Address prela = la;
BaseKeyBias::dump(la, length - index, &data[index]);
Address diffa = la - prela;
index += diffa.toInt();
a += diffa;
}
lowBound += DUMP_KEYBIAS_LENGTH;
++upBound;
if(length > index && a == lowBound) {
_ENVDepth = data[index];
index++;
++a;
}
++lowBound;
++upBound;
if(length > index && a == lowBound) {
_velocityRange = data[index];
index++;
++a;
}
++lowBound;
++upBound;
if(length > index && a == lowBound) {
_depthKeyFollow = data[index];
index++;
++a;
}
++lowBound;
++upBound;
if(length > index && a == lowBound) {
_timeKeyFollow = data[index];
index++;
++a;
}
++lowBound;
upBound += DUMP_ENVELOPE_LENGTH;
if(length > index && a >= lowBound && a < upBound) {
Address la = a - lowBound;
Address prela = la;
BaseEnvelope::dump(la, length - index, &data[index]);
Address diffa = la - prela;
index += diffa.toInt();
a += diffa;
}
lowBound += DUMP_ENVELOPE_LENGTH;
upBound += DUMP_MODULATION_LENGTH;
if(length > index && a >= lowBound && a < upBound) {
Address la = a - lowBound;
Address prela = la;
BaseModulation::dump(la, length - index, &data[index]);
Address diffa = la - prela;
index += diffa.toInt();
a += diffa;
}
lowBound += DUMP_MODULATION_LENGTH;
if(length > index && a == lowBound) {
_aftertouchRange = (char)data[index] - 7;
++a;
}
}
示例11: collectArg
QString Log::collectArg(const QString &msg, Address a)
{
return msg.arg(a.toString());
}
示例12: emitAddrOfImagComponent
Address CodeGenFunction::emitAddrOfImagComponent(Address addr,
QualType complexType) {
QualType eltType = complexType->castAs<ComplexType>()->getElementType();
CharUnits offset = getContext().getTypeSizeInChars(eltType);
return Builder.CreateStructGEP(addr, 1, offset, addr.getName() + ".imagp");
}
示例13: emitAddrOfRealComponent
Address CodeGenFunction::emitAddrOfRealComponent(Address addr,
QualType complexType) {
CharUnits offset = CharUnits::Zero();
return Builder.CreateStructGEP(addr, 0, offset, addr.getName() + ".realp");
}
示例14: helper
void CompilerDriver_pix::pixNetworkZoneChecks(Firewall *fw,
list<FWObject*> &all_interfaces)
{
multimap<string, FWObject*> netzone_objects;
Helper helper(NULL);
for (std::list<FWObject*>::iterator i=all_interfaces.begin(); i!=all_interfaces.end(); ++i)
{
Interface *iface = dynamic_cast<Interface*>(*i);
assert(iface);
if (iface->getOptionsObject()->getBool("cluster_interface")) continue;
if (iface->isDedicatedFailover()) continue;
if (iface->isUnprotected()) continue;
/*
* in PIX, we need network zones to be defined for all
* interfaces
*/
string netzone_id = iface->getStr("network_zone");
if (netzone_id=="")
{
QString err("Network zone definition is missing for interface '%1' (%2)");
abort(fw, NULL, NULL,
err.arg(iface->getName().c_str())
.arg(iface->getLabel().c_str()).toStdString());
throw FatalErrorInSingleRuleCompileMode();
}
FWObject *netzone = objdb->findInIndex(
FWObjectDatabase::getIntId(netzone_id));
if (netzone==NULL)
{
QString err("Network zone points at nonexisting object for "
"interface '%1' (%2)");
abort(fw, NULL, NULL,
err.arg(iface->getName().c_str())
.arg(iface->getLabel().c_str()).toStdString());
throw FatalErrorInSingleRuleCompileMode();
}
/*
* netzone may be a group, in which case we need to expand it
* (recursively).
*
* 1. We create new temporary object (type Group).
*
* 2. put it in the database somewhere
*
* 3. add all objects that belong to the network zone to this
* group. We add objects directly, not as a reference.
*
* 4. finally replace reference to the old network zone object in the
* interface with reference to this new group.
*
* 5. we store ID of the original network zone object
* using iface->setStr("orig_netzone_id")
*
* This ensures netzones do not contain other groups and do not
* require any recursive expanding anymore. Since objects were added
* to netzones directly, we do not need to bother with dereferencing,
* too.
*/
list<FWObject*> ol;
helper.expand_group_recursive(netzone, ol);
FWObject *nz = objdb->createObjectGroup();
assert(nz!=NULL);
nz->setName("netzone_" + iface->getLabel());
objdb->add(nz);
for (list<FWObject*>::iterator j=ol.begin(); j!=ol.end(); ++j)
{
Address *addr = Address::cast(*j);
if (addr == NULL || addr->getAddressPtr() == NULL)
{
QString err("Network zone of interface '%1' uses object '%2' "
"that is not an address");
abort(fw, NULL, NULL,
err.arg(iface->getLabel().c_str())
.arg((*j)->getName().c_str()).toStdString());
throw FatalErrorInSingleRuleCompileMode();
}
/*
Commented out for SF bug 3213019
currently we do not support ipv6 with PIX/ASA and FWSM. If user
creates a group to be used as network zone object and places ipv6
address in it, this address should be ignored while compiling the
policy but this should not be an error. Compiler uses network zone
group to do various address matching operations when it tries to
determine an interface for a rule where user did not specify
one. Since we never (should) have ipv6 in policy and nat rules,
compiler is not going to have anything to compare to ipv6 address in
the network zone even if there is one and this ipv6 address is going
to be ignored.
if (addr->getAddressPtr()->isV6())
//.........这里部分代码省略.........
示例15:
// The operator == checks for exact equality only (same section, same offset)
bool
lldb_private::operator== (const Address& a, const Address& rhs)
{
return a.GetOffset() == rhs.GetOffset() &&
a.GetSection() == rhs.GetSection();
}