gnunet-service-xdht_datacache.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 dht/gnunet-service-dht_datacache.h
  19. * @brief GNUnet DHT service's datacache integration
  20. * @author Christian Grothoff
  21. * @author Nathan Evans
  22. */
  23. #ifndef GNUNET_SERVICE_DHT_DATACACHE_H
  24. #define GNUNET_SERVICE_DHT_DATACACHE_H
  25. #include "gnunet_util_lib.h"
  26. #include "gnunet_block_lib.h"
  27. /**
  28. * Handle a datum we've received from another peer. Cache if
  29. * possible.
  30. *
  31. * @param expiration when will the reply expire
  32. * @param key the query this reply is for
  33. * @param put_path_length number of peers in 'put_path'
  34. * @param put_path path the reply took on put
  35. * @param type type of the reply
  36. * @param data_size number of bytes in 'data'
  37. * @param data application payload data
  38. */
  39. void
  40. GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
  41. const struct GNUNET_HashCode * key,
  42. unsigned int put_path_length,
  43. const struct GNUNET_PeerIdentity *put_path,
  44. enum GNUNET_BLOCK_Type type, size_t data_size,
  45. const void *data);
  46. /**
  47. * Handle a GET request we've received from another peer.
  48. *
  49. * @param key the query
  50. * @param type requested data type
  51. * @param xquery extended query
  52. * @param xquery_size number of bytes in xquery
  53. * @param reply_bf where the reply bf is (to be) stored, possibly updated!, can be NULL
  54. * @param reply_bf_mutator mutation value for reply_bf
  55. * @return evaluation result for the local replies
  56. */
  57. enum GNUNET_BLOCK_EvaluationResult
  58. GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
  59. enum GNUNET_BLOCK_Type type, const void *xquery,
  60. size_t xquery_size,
  61. struct GNUNET_CONTAINER_BloomFilter **reply_bf,
  62. uint32_t reply_bf_mutator,
  63. uint32_t get_path_length,
  64. struct GNUNET_PeerIdentity *get_path,
  65. struct GNUNET_PeerIdentity *next_hop,
  66. struct GNUNET_PeerIdentity *source_peer);
  67. /**
  68. * Initialize datacache subsystem.
  69. */
  70. void
  71. GDS_DATACACHE_init (void);
  72. /**
  73. * Shutdown datacache subsystem.
  74. */
  75. void
  76. GDS_DATACACHE_done (void);
  77. #endif