test_ats_api_common.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2010,2011 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 ats/test_ats_api_common.h
  19. * @brief shared definitions for ats testcases
  20. * @author Christian Grothoff
  21. * @author Matthias Wachs
  22. */
  23. #include "platform.h"
  24. #include "gnunet_ats_service.h"
  25. #include "gnunet-service-ats_addresses.h"
  26. #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
  27. struct Test_Address
  28. {
  29. char *plugin;
  30. size_t plugin_len;
  31. void *addr;
  32. size_t addr_len;
  33. struct GNUNET_ATS_Properties properties;
  34. void *session;
  35. };
  36. struct PeerContext
  37. {
  38. struct GNUNET_PeerIdentity id;
  39. struct Test_Address *addr;
  40. unsigned long long bw_out_assigned;
  41. unsigned long long bw_in_assigned;
  42. };
  43. void
  44. free_test_address (struct Test_Address *dest);
  45. void
  46. create_test_address (struct Test_Address *dest, char * plugin, void *session, void *addr, size_t addrlen);
  47. int
  48. compare_addresses (const struct GNUNET_HELLO_Address *address1, void *session1,
  49. const struct GNUNET_HELLO_Address *address2, void *session2);
  50. struct ATS_Address *
  51. create_address (const struct GNUNET_PeerIdentity *peer,
  52. const char *plugin_name,
  53. const void *plugin_addr, size_t plugin_addr_len,
  54. uint32_t session_id);
  55. /**
  56. * Load quotas for networks from configuration
  57. *
  58. * @param cfg configuration handle
  59. * @param out_dest where to write outbound quotas
  60. * @param in_dest where to write inbound quotas
  61. * @param dest_length length of inbound and outbound arrays
  62. * @return number of networks loaded
  63. */
  64. unsigned int
  65. load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
  66. unsigned long long *out_dest,
  67. unsigned long long *in_dest,
  68. int dest_length);
  69. /* end of file test_ats_api_common.h */