hostlist-client.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2009 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17. /**
  18. * @file hostlist/hostlist-client.h
  19. * @brief hostlist support. Downloads HELLOs via HTTP.
  20. * @author Christian Grothoff
  21. */
  22. #ifndef HOSTLIST_CLIENT_H
  23. #define HOSTLIST_CLIENT_H
  24. #include "gnunet_core_service.h"
  25. #include "gnunet_statistics_service.h"
  26. #include "gnunet_util_lib.h"
  27. #include "gnunet_time_lib.h"
  28. /**
  29. * Maximum number of hostlist that are saved
  30. */
  31. #define MAX_NUMBER_HOSTLISTS 30
  32. /**
  33. * Time intervall hostlists are saved to disk
  34. */
  35. #define SAVING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
  36. /**
  37. * Time interval between two hostlist tests
  38. */
  39. #define TESTING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
  40. /**
  41. * Time interval for download dispatcher before a download is re-scheduled
  42. */
  43. #define WAITING_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
  44. /**
  45. * Defines concerning the hostlist quality metric
  46. */
  47. /**
  48. * Initial quality of a new created hostlist
  49. */
  50. #define HOSTLIST_INITIAL 10000
  51. /**
  52. * Value subtracted each time a hostlist download fails
  53. */
  54. #define HOSTLIST_FAILED_DOWNLOAD 100
  55. /**
  56. * Value added each time a hostlist download is successful
  57. */
  58. #define HOSTLIST_SUCCESSFUL_DOWNLOAD 100
  59. /**
  60. * Value added for each valid HELLO recived during a hostlist download
  61. */
  62. #define HOSTLIST_SUCCESSFUL_HELLO 1
  63. /**
  64. * Start downloading hostlists from hostlist servers as necessary.
  65. *
  66. * @param c the configuration to use
  67. * @param st hande for publishing statistics
  68. * @param ch set to handler for connect notifications
  69. * @param dh set to handler for disconnect notifications
  70. * @param msgh set to handler for message handler notifications
  71. * @param learn set if client is learning new hostlists
  72. * @return GNUNET_OK on success
  73. */
  74. int
  75. GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c,
  76. struct GNUNET_STATISTICS_Handle *st,
  77. GNUNET_CORE_ConnectEventHandler *ch,
  78. GNUNET_CORE_DisconnectEventHandler *dh,
  79. GNUNET_CORE_MessageCallback *msgh, int learn);
  80. /**
  81. * Stop downloading hostlists from hostlist servers as necessary.
  82. */
  83. void
  84. GNUNET_HOSTLIST_client_stop (void);
  85. #endif
  86. /* end of hostlist-client.h */