-
-/* DLL_? */
-static int
-dll_contains (const char * uri)
-{
- struct Hostlist * pos;
-
- pos = dll_head;
- while (pos != NULL)
- {
- if (0 == strcmp(pos->hostlist_uri, uri) )
- return GNUNET_YES;
- pos = pos->next;
- }
- return GNUNET_NO;
-}
-
-
-/* DLL_? */
-static struct Hostlist *
-dll_get_lowest_quality ( )
-{
- struct Hostlist * pos;
- struct Hostlist * lowest;
-
- if (dll_size == 0)
- return NULL;
- lowest = dll_head;
- pos = dll_head->next;
- while (pos != NULL)
- {
- if (pos->quality < lowest->quality)
- lowest = pos;
- pos = pos->next;
- }
- return lowest;
-}
-
-
-#if DUMMY
-/* TO BE REMOVED later */
-static void dll_insert ( struct Hostlist *hostlist)
-{
- GNUNET_CONTAINER_DLL_insert(dll_head, dll_tail, hostlist);
- dll_size++;
-}
-
-static void create_dummy_entries ()
-{
-
- /* test */
- struct Hostlist * hostlist1;
- hostlist1 = GNUNET_malloc ( sizeof (struct Hostlist) );
- char * str = "uri_1";
-
- GNUNET_CRYPTO_hash_create_random ( GNUNET_CRYPTO_QUALITY_WEAK , &hostlist1->peer.hashPubKey);
- hostlist1->hello_count = 0;
- hostlist1->hostlist_uri = GNUNET_malloc ( strlen(str) +1 );
- strcpy(hostlist1->hostlist_uri,str);
- hostlist1->time_creation = GNUNET_TIME_absolute_get();
- hostlist1->time_last_usage = GNUNET_TIME_absolute_get_zero();
- hostlist1->quality = HOSTLIST_INITIAL - 100;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding test peer '%s' with URI %s and quality %u to dll \n", GNUNET_h2s (&hostlist1->peer.hashPubKey) , hostlist1->hostlist_uri, hostlist1->quality);
- dll_insert (hostlist1);
-
- struct Hostlist * hostlist2;
- hostlist2 = GNUNET_malloc ( sizeof (struct Hostlist) );
- char * str2 = "uri_2";
-
- GNUNET_CRYPTO_hash_create_random ( GNUNET_CRYPTO_QUALITY_WEAK , &hostlist2->peer.hashPubKey);
- hostlist2->hello_count = 0;
- hostlist2->hostlist_uri = GNUNET_malloc ( strlen(str2) +1 );
- strcpy(hostlist2->hostlist_uri,str2);
- hostlist2->time_creation = GNUNET_TIME_absolute_get();
- hostlist2->time_last_usage = GNUNET_TIME_absolute_get_zero();
- hostlist2->quality = HOSTLIST_INITIAL - 200;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding test peer '%s' with URI %s and quality %u to dll \n", GNUNET_h2s (&hostlist2->peer.hashPubKey) , hostlist2->hostlist_uri, hostlist2->quality);
- dll_insert (hostlist2);
-
- struct Hostlist * hostlist3;
- hostlist3 = GNUNET_malloc ( sizeof (struct Hostlist) );
- char * str3 = "uri_3";
-
- GNUNET_CRYPTO_hash_create_random ( GNUNET_CRYPTO_QUALITY_WEAK , &hostlist3->peer.hashPubKey);
- hostlist3->hello_count = 0;
- hostlist3->hostlist_uri = GNUNET_malloc ( strlen(str3) +1 );
- strcpy(hostlist3->hostlist_uri,str3);
- hostlist3->time_creation = GNUNET_TIME_absolute_get();
- hostlist3->time_last_usage = GNUNET_TIME_absolute_get_zero();
- hostlist3->quality = HOSTLIST_INITIAL - 300;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding test peer '%s' with URI %s and quality %u to dll \n", GNUNET_h2s (&hostlist3->peer.hashPubKey) , hostlist3->hostlist_uri, hostlist3->quality);
- dll_insert (hostlist3);
-
-
- struct Hostlist * hostlist4;
- hostlist4 = GNUNET_malloc ( sizeof (struct Hostlist) );
- char * str4 = "uri_4";
-
- GNUNET_CRYPTO_hash_create_random ( GNUNET_CRYPTO_QUALITY_WEAK , &hostlist4->peer.hashPubKey);
- hostlist4->hello_count = 0;
- hostlist4->hostlist_uri = GNUNET_malloc ( strlen(str4) +1 );
- strcpy(hostlist4->hostlist_uri,str4);
- hostlist4->time_creation = GNUNET_TIME_absolute_get();
- hostlist4->time_last_usage = GNUNET_TIME_absolute_get_zero();
- hostlist4->quality = HOSTLIST_INITIAL - 400;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding test peer '%s' with URI %s and quality %u to dll \n", GNUNET_h2s (&hostlist4->peer.hashPubKey) , hostlist4->hostlist_uri, hostlist4->quality);
- dll_insert (hostlist4);
-}
-#endif
-