gnunet-service-fs_indexing.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2009, 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 fs/gnunet-service-fs_indexing.h
  19. * @brief indexing for the file-sharing service
  20. * @author Christian Grothoff
  21. */
  22. #ifndef GNUNET_SERVICE_FS_INDEXING_H
  23. #define GNUNET_SERVICE_FS_INDEXING_H
  24. #include "gnunet_block_lib.h"
  25. #include "gnunet_core_service.h"
  26. #include "gnunet_datastore_service.h"
  27. #include "gnunet_peer_lib.h"
  28. #include "gnunet_protocols.h"
  29. #include "gnunet_signatures.h"
  30. #include "gnunet_util_lib.h"
  31. /**
  32. * We've received an on-demand encoded block from the datastore.
  33. * Attempt to do on-demand encoding and (if successful), call the
  34. * continuation with the resulting block. On error, clean up and ask
  35. * the datastore for more results.
  36. *
  37. * @param key key for the content
  38. * @param size number of bytes in data
  39. * @param data content stored
  40. * @param type type of the content
  41. * @param priority priority of the content
  42. * @param anonymity anonymity-level for the content
  43. * @param expiration expiration time for the content
  44. * @param uid unique identifier for the datum;
  45. * maybe 0 if no unique identifier is available
  46. * @param cont function to call with the actual block (at most once, on success)
  47. * @param cont_cls closure for cont
  48. * @return GNUNET_OK on success
  49. */
  50. int
  51. GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t size,
  52. const void *data, enum GNUNET_BLOCK_Type type,
  53. uint32_t priority, uint32_t anonymity,
  54. struct GNUNET_TIME_Absolute expiration,
  55. uint64_t uid,
  56. GNUNET_DATASTORE_DatumProcessor cont,
  57. void *cont_cls);
  58. /**
  59. * Handle INDEX_START-message.
  60. *
  61. * @param cls closure
  62. * @param client identification of the client
  63. * @param message the actual message
  64. */
  65. void
  66. GNUNET_FS_handle_index_start (void *cls, struct GNUNET_SERVER_Client *client,
  67. const struct GNUNET_MessageHeader *message);
  68. /**
  69. * Handle INDEX_LIST_GET-message.
  70. *
  71. * @param cls closure
  72. * @param client identification of the client
  73. * @param message the actual message
  74. */
  75. void
  76. GNUNET_FS_handle_index_list_get (void *cls, struct GNUNET_SERVER_Client *client,
  77. const struct GNUNET_MessageHeader *message);
  78. /**
  79. * Handle UNINDEX-message.
  80. *
  81. * @param cls closure
  82. * @param client identification of the client
  83. * @param message the actual message
  84. */
  85. void
  86. GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client,
  87. const struct GNUNET_MessageHeader *message);
  88. /**
  89. * Initialize the indexing submodule.
  90. *
  91. * @param c configuration to use
  92. * @param d datastore to use
  93. * @return GNUNET_OK on success
  94. */
  95. int
  96. GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c,
  97. struct GNUNET_DATASTORE_Handle *d);
  98. /**
  99. * Shutdown the module.
  100. */
  101. void
  102. GNUNET_FS_indexing_done (void);
  103. #endif