/** * Main function that will be run by the scheduler. * * @param cls closure * @param args remaining command-line arguments * @param cfgfile name of the configuration file used (for saving, can be NULL!) * @param cfg configuration */ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { if (args[0] != NULL) { FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]); return; } GNUNET_CORE_iterate_peers (cfg, &connected_peer_callback, NULL); }
/** * @brief This function floods data to all known peers. * * \latexonly \\ \\ \endlatexonly * \em Detailed \em description \n * This function floods data to all known peers. In order to do that it wraps up all parameters necessary in a data structure and initiates iterating * all peers using the appropriate GNUnet function. * * @param sender the peer that initiated the flooding; it may be NULL in case the request originated locally. * @param data the data to flood * @param size the size of the data to flood */ static void gnunet_search_flooding_data_flood(struct GNUNET_PeerIdentity const *sender, void *data, size_t size) { struct gnunet_search_flooding_data_flood_parameters *parameters = (struct gnunet_search_flooding_data_flood_parameters*) GNUNET_malloc( sizeof(struct gnunet_search_flooding_data_flood_parameters)); struct GNUNET_PeerIdentity *_sender; if(sender) { _sender = (struct GNUNET_PeerIdentity*) malloc(sizeof(struct GNUNET_PeerIdentity)); memcpy(_sender, sender, sizeof(struct GNUNET_PeerIdentity)); } else _sender = NULL; parameters->sender = _sender; parameters->data = data; parameters->size = size; GNUNET_CORE_iterate_peers(gnunet_search_globals_cfg, &gnunet_search_flooding_peer_iterate_handler, parameters); }