gnunet-service-dht_routing.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. This file is part of GNUnet.
  3. (C) 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_routing.h
  19. * @brief GNUnet DHT tracking of requests for routing replies
  20. * @author Christian Grothoff
  21. */
  22. #ifndef GNUNET_SERVICE_DHT_ROUTING_H
  23. #define GNUNET_SERVICE_DHT_ROUTING_H
  24. #include "gnunet_util_lib.h"
  25. #include "gnunet_block_lib.h"
  26. #include "gnunet_dht_service.h"
  27. /**
  28. * Handle a reply (route to origin). Only forwards the reply back to
  29. * other peers waiting for it. Does not do local caching or
  30. * forwarding to local clients. Essentially calls
  31. * GDS_NEIGHBOURS_handle_reply for all peers that sent us a matching
  32. * request recently.
  33. *
  34. * @param type type of the block
  35. * @param expiration_time when does the content expire
  36. * @param key key for the content
  37. * @param put_path_length number of entries in @a put_path
  38. * @param put_path peers the original PUT traversed (if tracked)
  39. * @param get_path_length number of entries in @a get_path
  40. * @param get_path peers this reply has traversed so far (if tracked)
  41. * @param data payload of the reply
  42. * @param data_size number of bytes in @a data
  43. */
  44. void
  45. GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
  46. struct GNUNET_TIME_Absolute expiration_time,
  47. const struct GNUNET_HashCode * key, unsigned int put_path_length,
  48. const struct GNUNET_PeerIdentity *put_path,
  49. unsigned int get_path_length,
  50. const struct GNUNET_PeerIdentity *get_path,
  51. const void *data, size_t data_size);
  52. /**
  53. * Add a new entry to our routing table.
  54. *
  55. * @param sender peer that originated the request
  56. * @param type type of the block
  57. * @param options options for processing
  58. * @param key key for the content
  59. * @param xquery extended query
  60. * @param xquery_size number of bytes in @a xquery
  61. * @param reply_bf bloomfilter to filter duplicates
  62. * @param reply_bf_mutator mutator for @a reply_bf
  63. */
  64. void
  65. GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
  66. enum GNUNET_BLOCK_Type type,
  67. enum GNUNET_DHT_RouteOption options,
  68. const struct GNUNET_HashCode * key, const void *xquery,
  69. size_t xquery_size,
  70. const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
  71. uint32_t reply_bf_mutator);
  72. /**
  73. * Initialize routing subsystem.
  74. */
  75. void
  76. GDS_ROUTING_init (void);
  77. /**
  78. * Shutdown routing subsystem.
  79. */
  80. void
  81. GDS_ROUTING_done (void);
  82. #endif