本文整理汇总了C++中IBRCOMMON_LOGGER_DEBUG_TAG函数的典型用法代码示例。如果您正苦于以下问题:C++ IBRCOMMON_LOGGER_DEBUG_TAG函数的具体用法?C++ IBRCOMMON_LOGGER_DEBUG_TAG怎么用?C++ IBRCOMMON_LOGGER_DEBUG_TAG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IBRCOMMON_LOGGER_DEBUG_TAG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
void IPNDAgent::leave(const ibrcommon::vinterface &iface, const ibrcommon::vaddress &addr) throw ()
{
IBRCOMMON_LOGGER_DEBUG_TAG(TAG, 10) << "Leave " << iface.toString() << " (" << addr.toString() << ", family: " << addr.family() << ")" << IBRCOMMON_LOGGER_ENDL;
// get all sockets bound to the given interface
ibrcommon::socketset ifsocks = _socket.get(iface);
for (ibrcommon::socketset::iterator it = ifsocks.begin(); it != ifsocks.end(); ++it)
{
ibrcommon::multicastsocket *msock = dynamic_cast<ibrcommon::multicastsocket*>(*it);
if (msock == NULL) continue;
if (msock->get_address() == addr) {
// remove the socket
_socket.remove(msock);
// shutdown the socket
try {
msock->down();
} catch (const ibrcommon::socket_exception &ex) {
IBRCOMMON_LOGGER_DEBUG_TAG(IPNDAgent::TAG, 10) << "leave failed: " << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
// delete the socket
delete msock;
return;
}
}
}
示例2: throw
void NativeSession::receive() throw (NativeSessionException)
{
Registration ® = _registration;
try {
try {
const dtn::data::MetaBundle id = reg.receiveMetaBundle();
if (id.procflags & dtn::data::PrimaryBlock::APPDATA_IS_ADMRECORD) {
// transform custody signals & status reports into notifies
fireNotificationAdministrativeRecord(id);
// announce the delivery of this bundle
reg.delivered(id);
} else {
IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "fire notification for new bundle " << id.toString() << IBRCOMMON_LOGGER_ENDL;
// put the bundle into the API queue
_bundle_queue.push(id);
// notify the client about the new bundle
fireNotificationBundle(id);
}
} catch (const dtn::storage::NoBundleFoundException&) {
IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 25) << "no more bundles found - wait until we are notified" << IBRCOMMON_LOGGER_ENDL;
reg.wait_for_bundle();
}
} catch (const ibrcommon::QueueUnblockedException &ex) {
throw NativeSessionException(std::string("loop aborted - ") + ex.what());
} catch (const std::exception &ex) {
throw NativeSessionException(std::string("loop aborted - ") + ex.what());
}
}
示例3: throw
void SecurityManager::fastverify(const dtn::data::Bundle &bundle) const throw (VerificationFailedException)
{
// do a fast verify without manipulating the bundle
const dtn::daemon::Configuration::Security &secconf = dtn::daemon::Configuration::getInstance().getSecurity();
if (secconf.getLevel() & dtn::daemon::Configuration::Security::SECURITY_LEVEL_ENCRYPTED)
{
// check if the bundle is encrypted and throw an exception if not
//throw VerificationFailedException("Bundle is not encrypted");
IBRCOMMON_LOGGER_DEBUG_TAG("SecurityManager", 10) << "encryption required, verify bundle: " << bundle.toString() << IBRCOMMON_LOGGER_ENDL;
if (std::count(bundle.begin(), bundle.end(), dtn::security::PayloadConfidentialBlock::BLOCK_TYPE) == 0)
throw VerificationFailedException("No PCB available!");
}
if (secconf.getLevel() & dtn::daemon::Configuration::Security::SECURITY_LEVEL_SIGNED)
{
// check if the bundle is signed and throw an exception if not
//throw VerificationFailedException("Bundle is not signed");
IBRCOMMON_LOGGER_DEBUG_TAG("SecurityManager", 10) << "signature required, verify bundle: " << bundle.toString() << IBRCOMMON_LOGGER_ENDL;
if (std::count(bundle.begin(), bundle.end(), dtn::security::PayloadIntegrityBlock::BLOCK_TYPE) == 0)
throw VerificationFailedException("No PIB available!");
}
if (secconf.getLevel() & dtn::daemon::Configuration::Security::SECURITY_LEVEL_AUTHENTICATED)
{
// check if the bundle is signed and throw an exception if not
//throw VerificationFailedException("Bundle is not signed");
IBRCOMMON_LOGGER_DEBUG_TAG("SecurityManager", 10) << "authentication required, verify bundle: " << bundle.toString() << IBRCOMMON_LOGGER_ENDL;
if (std::count(bundle.begin(), bundle.end(), dtn::security::BundleAuthenticationBlock::BLOCK_TYPE) == 0)
throw VerificationFailedException("No BAB available!");
}
}
示例4: IBRCOMMON_LOGGER_DEBUG_TAG
void NativeSession::fireNotificationAdministrativeRecord(const dtn::data::MetaBundle &bundle)
{
// load the whole bundle
const dtn::data::Bundle b = dtn::core::BundleCore::getInstance().getStorage().get(bundle);
// get the payload block of the bundle
const dtn::data::PayloadBlock &payload = b.find<dtn::data::PayloadBlock>();
try {
// try to decode as status report
dtn::data::StatusReportBlock report;
report.read(payload);
IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "fire notification for status report" << IBRCOMMON_LOGGER_ENDL;
// fire the status report notification
fireNotificationStatusReport(b.source, report);
} catch (const dtn::data::StatusReportBlock::WrongRecordException&) {
// this is not a status report
}
try {
// try to decode as custody signal
dtn::data::CustodySignalBlock custody;
custody.read(payload);
IBRCOMMON_LOGGER_DEBUG_TAG(NativeSession::TAG, 20) << "fire notification for custody signal" << IBRCOMMON_LOGGER_ENDL;
// fire the custody signal notification
fireNotificationCustodySignal(b.source, custody);
} catch (const dtn::data::CustodySignalBlock::WrongRecordException&) {
// this is not a custody report
}
}
示例5: throw
void IPNDAgent::join(const ibrcommon::vinterface &iface) throw ()
{
// register as discovery handler for this interface
dtn::core::BundleCore::getInstance().getDiscoveryAgent().registerService(iface, this);
// do not create sockets for any interface
if (!iface.isAny()) {
// subscribe to NetLink events on our interfaces
ibrcommon::LinkManager::getInstance().addEventListener(iface, this);
/**
* create sockets for each address on the interface
*/
const std::list<ibrcommon::vaddress> addrs = iface.getAddresses();
for (std::list<ibrcommon::vaddress>::const_iterator it = addrs.begin(); it != addrs.end(); ++it)
{
const ibrcommon::vaddress addr = (*it);
// join to all multicast addresses on this interface
join(iface, addr);
}
}
/**
* subscribe to multicast address on this interface using the sockets bound to any address
*/
const ibrcommon::vinterface any_iface(ibrcommon::vinterface::ANY);
ibrcommon::socketset anysocks = _socket.get(any_iface);
for (ibrcommon::socketset::iterator it = anysocks.begin(); it != anysocks.end(); ++it)
{
ibrcommon::multicastsocket *msock = dynamic_cast<ibrcommon::multicastsocket*>(*it);
if (msock == NULL) continue;
for (std::set<ibrcommon::vaddress>::const_iterator addr_it = _destinations.begin(); addr_it != _destinations.end(); ++addr_it)
{
const ibrcommon::vaddress &addr = (*addr_it);
// join only if family matches
if (addr.family() != msock->get_family()) continue;
try {
msock->join(addr, iface);
IBRCOMMON_LOGGER_DEBUG_TAG(IPNDAgent::TAG, 10) << "Joined " << addr.toString() << " on " << iface.toString() << IBRCOMMON_LOGGER_ENDL;
} catch (const ibrcommon::socket_raw_error &e) {
if (e.error() == EADDRINUSE) {
// silent error
} else if (e.error() == 92) {
// silent error - protocol not available
} else {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, warning) << "Join to " << addr.toString() << " failed on " << iface.toString() << "; " << e.what() << IBRCOMMON_LOGGER_ENDL;
}
} catch (const ibrcommon::socket_exception &e) {
IBRCOMMON_LOGGER_DEBUG_TAG(IPNDAgent::TAG, 10) << "Join to " << addr.toString() << " failed on " << iface.toString() << "; " << e.what() << IBRCOMMON_LOGGER_ENDL;
}
}
}
}
示例6: IBRCOMMON_LOGGER_DEBUG_TAG
dtn::data::MetaBundle OrderedStreamHandler::get(const dtn::data::Timeout timeout)
{
Registration ® = _client.getRegistration();
IBRCOMMON_LOGGER_DEBUG_TAG("OrderedStreamHandler", 20) << "get()" << IBRCOMMON_LOGGER_ENDL;
dtn::data::MetaBundle bundle;
while (true)
{
try {
bundle = reg.receiveMetaBundle();
// discard bundle if they are not from the specified peer
if ((!_group) && (bundle.source != _peer))
{
IBRCOMMON_LOGGER_DEBUG_TAG("OrderedStreamHandler", 30) << "get(): bundle source " << bundle.source.getString() << " not expected - discard" << IBRCOMMON_LOGGER_ENDL;
continue;
}
break;
} catch (const dtn::storage::NoBundleFoundException&) {
IBRCOMMON_LOGGER_DEBUG_TAG("OrderedStreamHandler", 30) << "get(): no bundle found wait for notify" << IBRCOMMON_LOGGER_ENDL;
reg.wait_for_bundle(timeout);
}
}
return bundle;
}
示例7: elements_read
std::istream& DeliveryPredictabilityMap::deserialize(std::istream& stream)
{
data::Number elements_read(0);
data::Number map_size;
stream >> map_size;
while(elements_read < map_size)
{
/* read the EID */
data::Number eid_len;
stream >> eid_len;
// create a buffer for the EID
std::vector<char> eid_cstr(eid_len.get<size_t>());
// read the EID string
stream.read(&eid_cstr[0], eid_cstr.size());
// convert the string into an EID object
dtn::data::EID eid(std::string(eid_cstr.begin(), eid_cstr.end()));
if(eid == data::EID())
throw dtn::InvalidDataException("EID could not be casted, while parsing a dp_map.");
/* read the probability (float) */
float f;
dtn::data::Number float_len;
stream >> float_len;
// create a buffer for the data string
std::vector<char> f_cstr(float_len.get<size_t>());
// read the data string
stream.read(&f_cstr[0], f_cstr.size());
// convert string data into a stringstream
std::stringstream ss(std::string(f_cstr.begin(), f_cstr.end()));
// convert string data into a float
ss >> f;
if(ss.fail())
throw dtn::InvalidDataException("Float could not be casted, while parsing a dp_map.");
/* check if f is in a proper range */
if(f < 0 || f > 1)
continue;
/* insert the data into the map */
_predictmap[eid] = f;
elements_read += 1;
}
IBRCOMMON_LOGGER_DEBUG_TAG("DeliveryPredictabilityMap", 20) << "Deserialized with " << _predictmap.size() << " items." << IBRCOMMON_LOGGER_ENDL;
IBRCOMMON_LOGGER_DEBUG_TAG("DeliveryPredictabilityMap", 60) << *this << IBRCOMMON_LOGGER_ENDL;
return stream;
}
示例8: IBRCOMMON_LOGGER_DEBUG_TAG
void FileMonitor::scan()
{
IBRCOMMON_LOGGER_DEBUG_TAG("FileMonitor", 5) << "scan for file changes" << IBRCOMMON_LOGGER_ENDL;
std::set<ibrcommon::File> watch_set;
for (watch_set::iterator iter = _watchset.begin(); iter != _watchset.end(); ++iter)
{
const ibrcommon::File &path = (*iter);
std::list<ibrcommon::File> files;
if (path.getFiles(files) == 0)
{
for (std::list<ibrcommon::File>::iterator iter = files.begin(); iter != files.end(); ++iter)
{
watch_set.insert(*iter);
}
}
else
{
IBRCOMMON_LOGGER_TAG("FileMonitor", error) << "scan of " << path.getPath() << " failed" << IBRCOMMON_LOGGER_ENDL;
}
}
// check for new directories
for (std::set<ibrcommon::File>::iterator iter = watch_set.begin(); iter != watch_set.end(); ++iter)
{
const ibrcommon::File &path = (*iter);
if (path.isDirectory() && !path.isSystem())
{
if (!isActive(path)) {
adopt(path);
}
}
}
// look for gone directories
for (std::map<ibrcommon::File, dtn::core::Node>::iterator iter = _active_paths.begin(); iter != _active_paths.end();)
{
const ibrcommon::File &path = (*iter).first;
const dtn::core::Node &node = (*iter).second;
if (watch_set.find(path) == watch_set.end())
{
dtn::core::BundleCore::getInstance().getConnectionManager().remove(node);
IBRCOMMON_LOGGER_DEBUG_TAG("FileMonitor", 5) << "Node on drive gone: " << node.getEID().getString() << IBRCOMMON_LOGGER_ENDL;
_active_paths.erase(iter++);
}
else
{
++iter;
}
}
}
示例9: throw
void dtn::dht::DHTNameService::componentDown() throw () {
// un-register as discovery beacon handler
dtn::core::BundleCore::getInstance().getDiscoveryAgent().unregisterService(this);
this->_exiting = true;
IBRCOMMON_LOGGER_DEBUG_TAG("DHTNameService", 25) << "DHT will be shut down"
<< IBRCOMMON_LOGGER_ENDL;
ssize_t written = ::write(_interrupt_pipe[1], "i", 1);
if (written < 1) {
IBRCOMMON_LOGGER_DEBUG_TAG("DHTNameService", 25) << "DHT pipeline trick failed"
<< IBRCOMMON_LOGGER_ENDL;
}
}
示例10: IBRCOMMON_LOGGER_DEBUG_TAG
std::char_traits<char>::int_type DatagramConnection::Stream::overflow(std::char_traits<char>::int_type c)
{
IBRCOMMON_LOGGER_DEBUG_TAG(DatagramConnection::TAG, 40) << "Stream::overflow()" << IBRCOMMON_LOGGER_ENDL;
if (_abort) throw DatagramException("stream aborted");
char *ibegin = &_out_buf[0];
char *iend = pptr();
// mark the buffer for outgoing data as free
// the +1 sparse the first byte in the buffer and leave room
// for the processing flags of the segment
setp(&_out_buf[0], &_out_buf[0] + _buf_size - 1);
if (!std::char_traits<char>::eq_int_type(c, std::char_traits<char>::eof()))
{
*iend++ = std::char_traits<char>::to_char_type(c);
}
// bytes to send
const dtn::data::Length bytes = (iend - ibegin);
// if there is nothing to send, just return
if (bytes == 0)
{
IBRCOMMON_LOGGER_DEBUG_TAG(DatagramConnection::TAG, 35) << "Stream::overflow() nothing to sent" << IBRCOMMON_LOGGER_ENDL;
return std::char_traits<char>::not_eof(c);
}
try {
// disable skipping if this is the first segment
if (_first_segment) _skip = false;
// send segment to CL, use callback interface
if (!_skip) _callback.stream_send(&_out_buf[0], bytes, _last_segment);
// set the flags for the next segment
_first_segment = _last_segment;
_last_segment = false;
} catch (const DatagramException &ex) {
IBRCOMMON_LOGGER_DEBUG_TAG(DatagramConnection::TAG, 35) << "Stream::overflow() exception: " << ex.what() << IBRCOMMON_LOGGER_ENDL;
// close this stream
close();
// re-throw the DatagramException
throw;
}
return std::char_traits<char>::not_eof(c);
}
示例11: throw
void SecurityManager::verifyPIB(dtn::data::Bundle &bundle) const throw (VerificationFailedException)
{
IBRCOMMON_LOGGER_DEBUG_TAG("SecurityManager", 10) << "verify signed bundle: " << bundle.toString() << IBRCOMMON_LOGGER_ENDL;
// iterate through all blocks
for (dtn::data::Bundle::iterator it = bundle.begin(); it != bundle.end();)
{
const dtn::data::Block &block = (**it);
if (block.getType() == dtn::security::PayloadConfidentialBlock::BLOCK_TYPE) {
// payload after a PCB can not verified until the payload is decrypted
break;
}
try {
const dtn::security::PayloadIntegrityBlock& pib = dynamic_cast<const dtn::security::PayloadIntegrityBlock&>(block);
const SecurityKey key = SecurityKeyManager::getInstance().get(pib.getSecuritySource(bundle), SecurityKey::KEY_PUBLIC);
// try to verify the bundle with the key for the current PIB
dtn::security::PayloadIntegrityBlock::verify(bundle, key);
// if we are the security destination
if (pib.isSecurityDestination(bundle, dtn::core::BundleCore::local)) {
// remove the valid PIB
bundle.erase(it++);
} else {
++it;
}
// set the verify bit, after verification
bundle.set(dtn::data::PrimaryBlock::DTNSEC_STATUS_VERIFIED, true);
IBRCOMMON_LOGGER_DEBUG_TAG("SecurityManager", 5) << "Bundle " << bundle.toString() << " successfully verified" << IBRCOMMON_LOGGER_ENDL;
continue;
} catch (const dtn::security::VerificationSkippedException&) {
// un-set the verify bit
bundle.set(dtn::data::PrimaryBlock::DTNSEC_STATUS_VERIFIED, false);
} catch (const SecurityKey::KeyNotFoundException&) {
// un-set the verify bit
bundle.set(dtn::data::PrimaryBlock::DTNSEC_STATUS_VERIFIED, false);
} catch (const std::bad_cast&) {
// current block is not a PIB
}
++it;
}
}
示例12: throw
void AbstractWorker::AbstractWorkerAsync::run() throw ()
{
dtn::storage::BundleStorage &storage = BundleCore::getInstance().getStorage();
try {
while (_running)
{
dtn::data::BundleID id = _receive_bundles.getnpop(true);
try {
dtn::data::Bundle b = storage.get( id );
prepareBundle(b);
_worker.callbackBundleReceived( b );
// create meta bundle for futher processing
const dtn::data::MetaBundle meta = dtn::data::MetaBundle::create(b);
// raise bundle event
dtn::core::BundleEvent::raise(meta, BUNDLE_DELIVERED);
if (b.get(dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON))
{
// remove the bundle from the storage
dtn::core::BundlePurgeEvent::raise(meta);
}
} catch (const ibrcommon::Exception &ex) {
IBRCOMMON_LOGGER_DEBUG_TAG("AbstractWorker", 15) << ex.what() << IBRCOMMON_LOGGER_ENDL;
};
yield();
}
} catch (const ibrcommon::QueueUnblockedException&) {
// queue was aborted by another call
}
}
示例13: n
void DiscoveryAgent::onBeaconReceived(const DiscoveryBeacon &beacon)
{
// ignore own beacons
if (beacon.getEID() == dtn::core::BundleCore::local) return;
// convert the announcement into NodeEvents
Node n(beacon.getEID());
const std::list<DiscoveryService> &services = beacon.getServices();
for (std::list<DiscoveryService>::const_iterator iter = services.begin(); iter != services.end(); ++iter)
{
const dtn::data::Number to_value = _config.timeout();
const DiscoveryService &s = (*iter);
// get protocol from tag
const dtn::core::Node::Protocol p = s.getProtocol();
if (p == dtn::core::Node::CONN_EMAIL)
{
// Set timeout
dtn::data::Number to_value_mailcl = to_value;
size_t configTime = dtn::daemon::Configuration::getInstance().getEMail().getNodeAvailableTime();
if(configTime > 0)
to_value_mailcl = configTime;
n.add(Node::URI(Node::NODE_DISCOVERED, Node::CONN_EMAIL, s.getParameters(), to_value_mailcl, 20));
}
else if ((p == dtn::core::Node::CONN_UNSUPPORTED) || (p == dtn::core::Node::CONN_UNDEFINED))
{
n.add(Node::Attribute(Node::NODE_DISCOVERED, s.getName(), s.getParameters(), to_value, 20));
}
else
{
n.add(Node::URI(Node::NODE_DISCOVERED, p, s.getParameters(), to_value, 20));
}
}
// announce NodeInfo to ConnectionManager
dtn::core::BundleCore::getInstance().getConnectionManager().updateNeighbor(n);
// if continuous announcements are disabled, then reply to this message
if (!_config.announce())
{
// first check if another announcement was sent during the same seconds
const dtn::data::Timestamp ts = dtn::utils::Clock::getMonotonicTimestamp();
if (_last_announce_sent != ts)
{
IBRCOMMON_LOGGER_DEBUG_TAG("DiscoveryAgent", 55) << "reply with discovery beacon" << IBRCOMMON_LOGGER_ENDL;
// reply with an own announcement
onAdvertise();
// remember timestamp of last sent discovery
_last_announce_sent = ts;
}
}
}
示例14: throw
void DatagramConnection::setup() throw ()
{
IBRCOMMON_LOGGER_DEBUG_TAG(DatagramConnection::TAG, 40) << "setup()" << IBRCOMMON_LOGGER_ENDL;
_callback.connectionUp(this);
_sender.start();
}
示例15: catch
void IPNDAgent::send(const DiscoveryAnnouncement &a, const ibrcommon::vinterface &iface, const ibrcommon::vaddress &addr)
{
// serialize announcement
stringstream ss; ss << a;
const std::string data = ss.str();
ibrcommon::socketset fds = _send_socket.get(iface);
// send out discovery announcements on all bound sockets
// (hopefully only one per interface)
for (ibrcommon::socketset::const_iterator iter = fds.begin(); iter != fds.end(); ++iter)
{
ibrcommon::udpsocket &sock = dynamic_cast<ibrcommon::udpsocket&>(**iter);
try {
// prevent broadcasting in the wrong address family
if (addr.family() != sock.get_family()) continue;
sock.sendto(data.c_str(), data.length(), 0, addr);
} catch (const ibrcommon::socket_exception &e) {
IBRCOMMON_LOGGER_DEBUG_TAG(IPNDAgent::TAG, 5) << "can not send message to " << addr.toString() << " via " << sock.get_address().toString() << "/" << iface.toString() << "; socket exception: " << e.what() << IBRCOMMON_LOGGER_ENDL;
} catch (const ibrcommon::vaddress::address_exception &ex) {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, warning) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}
}