first batch of license fixes (boring)
[oweals/gnunet.git] / src / dht / gnunet-service-dht_routing.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2011 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      Affero General Public License for more details.
14 */
15
16 /**
17  * @file dht/gnunet-service-dht_routing.h
18  * @brief GNUnet DHT tracking of requests for routing replies
19  * @author Christian Grothoff
20  */
21 #ifndef GNUNET_SERVICE_DHT_ROUTING_H
22 #define GNUNET_SERVICE_DHT_ROUTING_H
23
24 #include "gnunet_util_lib.h"
25 #include "gnunet_block_lib.h"
26 #include "gnunet_dht_service.h"
27
28
29 /**
30  * Handle a reply (route to origin).  Only forwards the reply back to
31  * other peers waiting for it.  Does not do local caching or
32  * forwarding to local clients.  Essentially calls
33  * #GDS_NEIGHBOURS_handle_reply() for all peers that sent us a matching
34  * request recently.
35  *
36  * @param type type of the block
37  * @param expiration_time when does the content expire
38  * @param key key for the content
39  * @param put_path_length number of entries in @a put_path
40  * @param put_path peers the original PUT traversed (if tracked)
41  * @param get_path_length number of entries in @a get_path
42  * @param get_path peers this reply has traversed so far (if tracked)
43  * @param data payload of the reply
44  * @param data_size number of bytes in @a data
45  */
46 void
47 GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
48                      struct GNUNET_TIME_Absolute expiration_time,
49                      const struct GNUNET_HashCode *key,
50                      unsigned int put_path_length,
51                      const struct GNUNET_PeerIdentity *put_path,
52                      unsigned int get_path_length,
53                      const struct GNUNET_PeerIdentity *get_path,
54                      const void *data,
55                      size_t data_size);
56
57
58 /**
59  * Add a new entry to our routing table.
60  *
61  * @param sender peer that originated the request
62  * @param type type of the block
63  * @param bg block group to evaluate replies, henceforth owned by routing
64  * @param options options for processing
65  * @param key key for the content
66  * @param xquery extended query
67  * @param xquery_size number of bytes in @a xquery
68  */
69 void
70 GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
71                  enum GNUNET_BLOCK_Type type,
72                  struct GNUNET_BLOCK_Group *bg,
73                  enum GNUNET_DHT_RouteOption options,
74                  const struct GNUNET_HashCode * key,
75                  const void *xquery,
76                  size_t xquery_size);
77
78
79 /**
80  * Initialize routing subsystem.
81  */
82 void
83 GDS_ROUTING_init (void);
84
85
86 /**
87  * Shutdown routing subsystem.
88  */
89 void
90 GDS_ROUTING_done (void);
91
92 #endif