fs_test_lib.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2010, 2012 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 fs/fs_test_lib.h
  19. * @brief library routines for testing FS publishing and downloading;
  20. * this code is limited to flat files
  21. * and no keywords (those functions can be tested with
  22. * single-peer setups; this is for testing routing).
  23. * @author Christian Grothoff
  24. */
  25. #ifndef FS_TEST_LIB_H
  26. #define FS_TEST_LIB_H
  27. #include "gnunet_util_lib.h"
  28. #include "gnunet_fs_service.h"
  29. #include "gnunet_testbed_service.h"
  30. /**
  31. * Function signature.
  32. *
  33. * @param cls closure (user defined)
  34. * @param uri a URI, NULL for errors
  35. * @param fn name of the file on disk to be removed upon
  36. * completion, or NULL for inserted files (also NULL on error)
  37. */
  38. typedef void (*GNUNET_FS_TEST_UriContinuation) (void *cls,
  39. const struct GNUNET_FS_Uri *
  40. uri,
  41. const char *fn);
  42. /**
  43. * Publish a file at the given daemon.
  44. *
  45. * @param peer where to publish
  46. * @param timeout if this operation cannot be completed within the
  47. * given period, call the continuation with an error code
  48. * @param anonymity option for publication
  49. * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
  50. * GNUNET_SYSERR for simulation
  51. * @param size size of the file to publish
  52. * @param seed seed to use for file generation
  53. * @param verbose how verbose to be in reporting
  54. * @param cont function to call when done
  55. * @param cont_cls closure for cont
  56. */
  57. void
  58. GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer,
  59. struct GNUNET_TIME_Relative timeout, uint32_t anonymity,
  60. int do_index, uint64_t size, uint32_t seed,
  61. unsigned int verbose,
  62. GNUNET_FS_TEST_UriContinuation cont, void *cont_cls);
  63. /**
  64. * Perform test download.
  65. *
  66. * @param peer which peer to download from
  67. * @param timeout if this operation cannot be completed within the
  68. * given period, call the continuation with an error code
  69. * @param anonymity option for download
  70. * @param seed used for file validation
  71. * @param uri URI of file to download (CHK/LOC only)
  72. * @param verbose how verbose to be in reporting
  73. * @param cont function to call when done
  74. * @param cont_cls closure for cont
  75. */
  76. void
  77. GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer,
  78. struct GNUNET_TIME_Relative timeout,
  79. uint32_t anonymity, uint32_t seed,
  80. const struct GNUNET_FS_Uri *uri, unsigned int verbose,
  81. GNUNET_SCHEDULER_Task cont, void *cont_cls);
  82. #endif