shared_ptr<ndn::Data> NdnDataManager::operator[]( shared_ptr<const ndn::Interest> interest ) { Name subname = interest->getName(); auto it = subname.end()-1; while( ( it->isVersion() || it->isSegment() || it->isSegmentOffset() || it->isTimestamp() || it->isSequenceNumber() ) && ( it-- ) != subname.begin() ); subname = subname.getPrefix( it - subname.begin() + 1 ); if( m_producers.find( subname ) != m_producers.end() ) { // find data producer auto producer = m_producers[subname]; // if access level is 0, no access needs to be provided if( interest->getAuthTag().getAccessLevel() == 0 ) { Coordinator:: producerSatisfiedRequest( interest->getName().getPrefix( 2 ), interest->getName() ); return producer->makeData( interest ); } // generate data packet shared_ptr<Data> data = producer->makeData( interest ); // check that the interest's access rights // satisfy the data's requirements if( m_auth_manager->getTagAccess( interest->getAuthTag() ) < data->getAccessLevel() ) { Coordinator:: producerDeniedRequest( interest->getName().getPrefix( 2 ), interest->getName(), "Insufficient Auth" ); return makeNack( *data ); } // check that the data satisfies interest if( interest->matchesData( *data ) ) { Coordinator:: producerSatisfiedRequest( interest->getName().getPrefix(2), interest->getName() ); return data; } } Coordinator::producerOther( interest->getName().getPrefix( 2 ), "No data matching " + interest->getName().toUri() ); return NULL; };
int ServerProxy::handleCheckLoad() { // // Check if we just created the first X channel // but the client side didn't tell us to load // the cache selected at the session negotiation. // This is very likely because the load operation // failed at the remote side, for example because // the cache was invalid or corrupted. // int channelCount = getChannels(channel_x11); if (channelCount != 1) { return 0; } if (control -> PersistentCacheEnableLoad == 1 && control -> PersistentCachePath != NULL && control -> PersistentCacheName != NULL && isTimestamp(timeouts_.loadTs) == 0) { #ifdef WARNING *logofs << "ServerProxy: WARNING! Cache file '" << control -> PersistentCachePath << "/" << control -> PersistentCacheName << "' not loaded.\n" << logofs_flush; #endif // // Remove the cache file. // #ifdef WARNING *logofs << "ServerProxy: WARNING! Removing supposedly " << "incompatible cache '" << control -> PersistentCachePath << "/" << control -> PersistentCacheName << "'.\n" << logofs_flush; #endif handleResetPersistentCache(); } return 1; }