예제 #1
0
		void EMailConvergenceLayer::queue(const dtn::core::Node &node,
				const dtn::net::BundleTransfer &job)
		{
			// Check if node supports email convergence layer
			const std::list<dtn::core::Node::URI> uri_list = node.get(dtn::core::Node::CONN_EMAIL);
			if (uri_list.empty())
			{
				dtn::net::TransferAbortedEvent::raise(node.getEID(), job.getBundle(),
						dtn::net::TransferAbortedEvent::REASON_UNDEFINED);
				return;
			}

			// Get recipient
			std::string recipient = dtn::utils::Utils::tokenize("//", node.getEID().getString())[1];

			// Create new Task
			EMailSmtpService::Task *t = new EMailSmtpService::Task(node, job, recipient);

			// Submit Task
			if(_config.getSmtpSubmitInterval() <= 0)
			{
				_smtp.submitNow(t);
			}else{
				_smtp.queueTask(t);
			}

			IBRCOMMON_LOGGER(info) << "EMail Convergence Layer: Bundle " << t->getJob().getBundle().toString() << " stored in submit queue" << IBRCOMMON_LOGGER_ENDL;

		}
bool dtn::dht::DHTNameService::isNeighbourAnnouncable(
		const dtn::core::Node &node) {
	if (!_config.isNeighbourAnnouncementEnabled())
		return false;
	// If forwarding of bundles is disabled, do not announce the neighbors to
	// prevent receiving bundles for neighbor EIDs, which would not be forwarded
	if (!daemon::Configuration::getInstance().getNetwork().doForwarding()) {
		return false;
	}


	// get the merged node object
	const dtn::core::Node n = dtn::core::BundleCore::getInstance().getConnectionManager().getNeighbor(
			node.getEID());

	// Ignore all none discovered and none static nodes
	// They could only be discovered by the DHT,
	// so they are not really close neighbours and could be found directly in the DHT.
	// This prevents the node to be announced by all neighbours, how found this node
	std::set<dtn::core::Node::Type> types = n.getTypes();
	if (types.find(dtn::core::Node::NODE_DISCOVERED) == types.end()
			&& (types.find(dtn::core::Node::NODE_STATIC_GLOBAL) == types.end())) {
		return false;
	}
	// Proof, if the neighbour has told us, that he don't want to be published on the DHT
	std::list<dtn::core::Node::Attribute> services = n.get("dhtns");
	if (!services.empty()) {
		for (std::list<dtn::core::Node::Attribute>::const_iterator service =
				services.begin(); service != services.end(); ++service) {
			bool proxy = true;
			std::vector < string > parameters = dtn::utils::Utils::tokenize(
					";", (*service).value);
			std::vector<string>::const_iterator param_iter = parameters.begin();

			while (param_iter != parameters.end()) {
				std::vector < string > p = dtn::utils::Utils::tokenize("=",
						(*param_iter));
				if (p[0].compare("proxy") == 0) {
					std::stringstream proxy_stream;
					proxy_stream << p[1];
					proxy_stream >> proxy;
				}
				++param_iter;
			}
			if (!proxy)
				return false;
		}
	}