コード例 #1
0
/**
 * Adapter function called to establish a connection to
 * the NSE service.
 *
 * @param cls closure
 * @param cfg configuration of the peer to connect to; will be available until
 *          GNUNET_TESTBED_operation_done() is called on the operation returned
 *          from GNUNET_TESTBED_service_connect()
 * @return service handle to return in 'op_result', NULL on error
 */
static void *
nse_connect_adapter (void *cls,
		     const struct GNUNET_CONFIGURATION_Handle *cfg)
{
  return GNUNET_NSE_connect (cfg,
			     &handle_estimate,
			     cls);
}
コード例 #2
0
/**
 * Initialize NSE subsystem.
 */
void
GDS_NSE_init ()
{
  unsigned long long hops;

  if ( (GNUNET_YES ==
	GNUNET_CONFIGURATION_have_value (GDS_cfg,
					 "dht",
					 "FORCE_NSE")) &&
       (GNUNET_OK ==
	GNUNET_CONFIGURATION_get_value_number (GDS_cfg,
					       "dht",
					       "FORCE_NSE",
					       &hops)) )
  {
    log_of_network_size_estimate = (double) hops;
    return;
  }
  nse = GNUNET_NSE_connect (GDS_cfg, &update_network_size_estimate, NULL);
}
コード例 #3
0
ファイル: NetworkManager.cpp プロジェクト: bratao/cangote
/**
 * Function to call to start our services
 */
void NetworkManager::start(struct GNUNET_CONFIGURATION_Handle *config)
{
    m_config = config;


    //Connect to peerinfo
    if (NULL == (m_peerInfo = GNUNET_PEERINFO_connect (config)))
    {
        qWarning("Failed to connect to PeerInfo service");
    }

    //Initialize transport plugins
    m_gnunetTransportPlugins = new GnunetTransportPlugins(config,this);

    //Connect to peerinfo notifications
    m_peerInfoNotify =   GNUNET_PEERINFO_notify (config, NULL, peerinfoProcessorCallback, this);
    if (m_peerInfoNotify == NULL) {
        qWarning("Failed to connect to PeerInfo Notify service");
    }

    //Connect to the ats service
    m_ats = GNUNET_ATS_performance_init (config, ATSstatusChangeCallback, this);
    if (m_ats == NULL) {
        qWarning("Failed to connect to ATS service");
    }

    //Monitor peer for connected transports
    m_peerMonitoring = GNUNET_TRANSPORT_monitor_peers (config,
                                                       NULL,
                                                       GNUNET_NO,
                                                       GNUNET_TIME_UNIT_FOREVER_REL,
                                                       &transportPeerChangeCallback,
                                                       NULL);

    //Monitor peer for validated transports
    m_peerTransportValidation = GNUNET_TRANSPORT_monitor_validation_entries (config,
                                                                             NULL,
                                                                             GNUNET_NO,
                                                                             GNUNET_TIME_UNIT_FOREVER_REL,
                                                                             &validationMonitorCallback,
                                                                             NULL);

    //Connect to core to receive all income and outcome messages ( for bandwidth calculation)
    m_core = GNUNET_CORE_connect (m_config, this, NULL,
                                  notifyConnectCallback, notifyDisconnectCallback,
                                  incomeMsgCallback, GNUNET_YES, outcomeMsgCallback, GNUNET_YES, NULL);

    //Inicialize NSE
    struct GNUNET_NSE_Handle *nse;
    nse = GNUNET_NSE_connect (config, checkNseMessageCallback, this);






    if(m_peerInfoNotify && m_ats && nse)
    {
        //status->setOkState();
    }



}