本文整理汇总了C++中IBRCOMMON_LOGGER_TAG函数的典型用法代码示例。如果您正苦于以下问题:C++ IBRCOMMON_LOGGER_TAG函数的具体用法?C++ IBRCOMMON_LOGGER_TAG怎么用?C++ IBRCOMMON_LOGGER_TAG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IBRCOMMON_LOGGER_TAG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EVP_MD_CTX_cleanup
void RSASHA256Stream::reset()
{
EVP_MD_CTX_cleanup(&_ctx);
EVP_MD_CTX_init(&_ctx);
if (!_verify)
{
if (!EVP_SignInit_ex(&_ctx, EVP_sha256(), NULL))
{
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the signature function" << IBRCOMMON_LOGGER_ENDL;
ERR_print_errors_fp(stderr);
}
}
else
{
if (!EVP_VerifyInit_ex(&_ctx, EVP_sha256(), NULL))
{
IBRCOMMON_LOGGER_TAG("RSASHA256Stream", critical) << "failed to initialize the verfication function" << IBRCOMMON_LOGGER_ENDL;
ERR_print_errors_fp(stderr);
}
}
_sign_valid = false;
}
示例2: throw
void IPNDAgent::listen(const ibrcommon::vinterface &iface) throw ()
{
// create sockets for all addresses on the interface
std::list<ibrcommon::vaddress> addrs = iface.getAddresses();
for (std::list<ibrcommon::vaddress>::iterator iter = addrs.begin(); iter != addrs.end(); ++iter) {
ibrcommon::vaddress &addr = (*iter);
try {
// handle the addresses according to their family
switch (addr.family()) {
case AF_INET:
case AF_INET6:
{
ibrcommon::udpsocket *sock = new ibrcommon::udpsocket(addr);
if (_send_socket_state) sock->up();
_send_socket.add(sock, iface);
break;
}
default:
break;
}
} catch (const ibrcommon::vaddress::address_exception &ex) {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, warning) << ex.what() << IBRCOMMON_LOGGER_ENDL;
} catch (const ibrcommon::socket_exception &ex) {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, warning) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}
}
示例3: 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)
{
try {
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;
}
} catch (const std::bad_cast&) {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, error) << "Socket for sending isn't a udpsocket." << IBRCOMMON_LOGGER_ENDL;
}
}
}
示例4: throw
void TCPConnection::eventConnectionUp(const dtn::streams::StreamContactHeader &header) throw ()
{
_peer = header;
// copy old attributes and urls to the new node object
Node n_old = _node;
_node = Node(header._localeid);
_node += n_old;
// check if the peer has the same EID
if (_node.getEID() == dtn::core::BundleCore::getInstance().local)
{
// abort the connection
shutdown();
IBRCOMMON_LOGGER_TAG(TCPConnection::TAG, warning) << "connection to local endpoint rejected" << IBRCOMMON_LOGGER_ENDL;
return;
}
_keepalive_timeout = header._keepalive * 1000;
try {
// initiate extended handshake (e.g. TLS)
initiateExtendedHandshake();
} catch (const ibrcommon::Exception &ex) {
IBRCOMMON_LOGGER_TAG(TCPConnection::TAG, warning) << ex.what() << IBRCOMMON_LOGGER_ENDL;
// abort the connection
shutdown();
return;
}
// set the timer
timeval timeout;
timerclear(&timeout);
// set the incoming timer if set (> 0)
if (_peer._keepalive > 0)
{
timeout.tv_sec = header._keepalive * 2;
}
// change time-out
_socket_stream->setTimeout(timeout);
try {
// enable idle timeout
size_t _idle_timeout = dtn::daemon::Configuration::getInstance().getNetwork().getTCPIdleTimeout();
if (_idle_timeout > 0)
{
(*getProtocolStream()).enableIdleTimeout(_idle_timeout);
}
} catch (const ibrcommon::Exception&) {};
// raise up event
ConnectionEvent::raise(ConnectionEvent::CONNECTION_UP, _node);
}
示例5: throw
void IPNDAgent::join(const ibrcommon::vinterface &iface, const ibrcommon::vaddress &addr) throw ()
{
IBRCOMMON_LOGGER_DEBUG_TAG(TAG, 10) << "Join on " << iface.toString() << " (" << addr.toString() << ", family: " << addr.family() << ")" << IBRCOMMON_LOGGER_ENDL;
// only join IPv6 and IPv4 addresses
if ((addr.family() != AF_INET) && (addr.family() != AF_INET6)) return;
// do not join on loopback interfaces
if (addr.isLocal()) return;
// create a multicast socket and bind to given addr
ibrcommon::multicastsocket *msock = new ibrcommon::multicastsocket(addr);
// if we are in UP state
if (_state) {
try {
// bring up
msock->up();
// listen to multicast addresses
for (std::set<ibrcommon::vaddress>::const_iterator it_addr = _destinations.begin(); it_addr != _destinations.end(); ++it_addr)
{
if (msock->get_family() != it_addr->family())
continue;
try {
msock->join(*it_addr, iface);
} 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 " << (*it_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 " << (*it_addr).toString() << " failed on " << iface.toString() << "; " << e.what() << IBRCOMMON_LOGGER_ENDL;
}
}
} catch (const ibrcommon::socket_exception &ex) {
IBRCOMMON_LOGGER_TAG(IPNDAgent::TAG, error) << "Join failed on " << iface.toString() << " (" << addr.toString() << ", family: " << addr.family() << ")" << "; " << ex.what() << IBRCOMMON_LOGGER_ENDL;
delete msock;
return;
}
}
// add multicast socket to _socket
_socket.add(msock, iface);
}
示例6: throw
void SQLiteBundleSet::expire(const dtn::data::Timestamp timestamp) throw ()
{
// we can not expire bundles if we have no idea of time
if (timestamp == 0) return;
// do not expire if its not the time
if (_next_expiration > timestamp) return;
// look for expired bundles and announce them in the listener
if (_listener != NULL) {
try {
SQLiteDatabase::Statement st(_sqldb._database, SQLiteDatabase::_sql_queries[SQLiteDatabase::BUNDLE_SET_GET_EXPIRED]);
sqlite3_bind_int64(*st, 1, _set_id);
// set expiration timestamp
sqlite3_bind_int64(*st, 2, timestamp.get<uint64_t>());
while (st.step() == SQLITE_ROW)
{
dtn::data::BundleID id;
get_bundleid(st, id);
const dtn::data::MetaBundle bundle = dtn::data::MetaBundle::create(id);
// raise bundle expired event
_listener->eventBundleExpired(bundle);
}
} catch (const SQLiteDatabase::SQLiteQueryException &ex) {
IBRCOMMON_LOGGER_TAG(SQLiteDatabase::TAG, error) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}
// delete expired bundles
try {
SQLiteDatabase::Statement st(_sqldb._database, SQLiteDatabase::_sql_queries[SQLiteDatabase::BUNDLE_SET_EXPIRE]);
sqlite3_bind_int64(*st, 1, _set_id);
// set expiration timestamp
sqlite3_bind_int64(*st, 2, timestamp.get<uint64_t>());
st.step();
} catch (const SQLiteDatabase::SQLiteQueryException &ex) {
IBRCOMMON_LOGGER_TAG(SQLiteDatabase::TAG, error) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
// rebuild the bloom filter
rebuild_bloom_filter();
}
示例7: l
dtn::data::Bundle MemoryBundleStorage::get(const dtn::data::BundleID &id)
{
try {
ibrcommon::MutexLock l(_bundleslock);
for (bundle_list::const_iterator iter = _bundles.begin(); iter != _bundles.end(); ++iter)
{
const dtn::data::Bundle &bundle = (*iter);
if (id == bundle)
{
if (_faulty) {
throw dtn::SerializationFailedException("bundle get failed due to faulty setting");
}
return bundle;
}
}
} catch (const dtn::SerializationFailedException &ex) {
// bundle loading failed
IBRCOMMON_LOGGER_TAG(MemoryBundleStorage::TAG, error) << "Error while loading bundle data: " << ex.what() << IBRCOMMON_LOGGER_ENDL;
// the bundle is broken, delete it
remove(id);
throw BundleStorage::BundleLoadException();
}
throw NoBundleFoundException();
}
示例8: timerclear
void Clock::setOffset(const struct timeval &tv)
{
if (!Clock::shouldModifyClock())
{
if (!Clock::_offset_init)
{
timerclear(&Clock::_offset);
Clock::_offset_init = true;
}
timeradd(&Clock::_offset, &tv, &Clock::_offset);
IBRCOMMON_LOGGER_TAG("Clock", info) << "new local offset: " << Clock::toDouble(_offset) << "s" << IBRCOMMON_LOGGER_ENDL;
}
else
{
struct timezone tz;
struct timeval now;
::gettimeofday(&now, &tz);
// adjust by the offset
timersub(&now, &tv, &now);
#ifndef __WIN32__
// set the local clock to the new timestamp
::settimeofday(&now, &tz);
#endif
}
}
示例9: decrypt
bool PayloadConfidentialBlock::decryptPayload(dtn::data::Bundle& bundle, const unsigned char ephemeral_key[ibrcommon::AES128Stream::key_size_in_bytes], const uint32_t salt)
{
// TODO handle fragmentation
PayloadConfidentialBlock& pcb = bundle.find<PayloadConfidentialBlock>();
dtn::data::PayloadBlock& plb = bundle.find<dtn::data::PayloadBlock>();
// the array for the extracted iv
unsigned char iv[ibrcommon::AES128Stream::iv_len];
pcb._ciphersuite_params.get(SecurityBlock::initialization_vector, iv, ibrcommon::AES128Stream::iv_len);
// the array for the extracted tag
unsigned char tag[ibrcommon::AES128Stream::tag_len];
pcb._security_result.get(SecurityBlock::PCB_integrity_check_value, tag, ibrcommon::AES128Stream::tag_len);
// get the reference to the corresponding BLOB object
ibrcommon::BLOB::Reference blobref = plb.getBLOB();
// decrypt the payload and get the integrity signature (tag)
{
ibrcommon::BLOB::iostream stream = blobref.iostream();
ibrcommon::AES128Stream decrypt(ibrcommon::CipherStream::CIPHER_DECRYPT, *stream, ephemeral_key, salt, iv);
((ibrcommon::CipherStream&)decrypt).decrypt(*stream);
// get the decrypt tag
if (!decrypt.verify(tag))
{
IBRCOMMON_LOGGER_TAG("PayloadConfidentialBlock", error) << "integrity signature of the decrypted payload is invalid" << IBRCOMMON_LOGGER_ENDL;
return false;
}
}
return true;
}
示例10: 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;
}
}
}
}
示例11: sighandler_func
void sighandler_func(int signal)
{
IBRCOMMON_LOGGER_TAG(TAG,notice) << "got signal " << signal << IBRCOMMON_LOGGER_ENDL;
switch (signal)
{
case SIGTERM:
case SIGINT:
{
//stop waiting and stop running, on SIGINT or SIGTERM
ibrcommon::MutexLock l(_wait_cond);
_running = false;
_wait_cond.signal(true);
break;
}
#ifndef __WIN32__
case SIGUSR1:
{
//stop waiting on SIGUSR1 -> "quickscan"
ibrcommon::MutexLock l(_wait_cond);
_wait_abort = true;
_wait_cond.signal(true);
break;
}
#endif
default:
break;
}
}
示例12: throw
void EventDebugger::raiseEvent(const dtn::core::Event *evt) throw ()
{
// print event
if (evt->isLoggable())
{
IBRCOMMON_LOGGER_TAG(evt->getName(), notice) << evt->getMessage() << IBRCOMMON_LOGGER_ENDL;
}
}
示例13: throw
void FileMonitor::componentUp() throw ()
{
// routine checked for throw() on 15.02.2013
try {
_socket.up();
} catch (const ibrcommon::socket_exception &ex) {
IBRCOMMON_LOGGER_TAG("FileMonitor", error) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}
示例14: throw
void FloodRoutingExtension::componentDown() throw ()
{
try {
// stop the thread
stop();
join();
} catch (const ibrcommon::ThreadException &ex) {
IBRCOMMON_LOGGER_TAG(FloodRoutingExtension::TAG, error) << "componentDown failed: " << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}
示例15: throw
void Client::eventConnectionDown() throw ()
{
_inqueue.abort();
try {
_receiver.stop();
} catch (const ibrcommon::ThreadException &ex) {
IBRCOMMON_LOGGER_TAG("Client", error) << ex.what() << IBRCOMMON_LOGGER_ENDL;
}
}