aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-26 18:53:28 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-26 18:53:28 +0000
commit60ff113fe4e7bb71d5696063b9a9b81eba60a108 (patch)
tree8f3ed8cc47be49299a01d8ce1385f012bf19043b /src/dht/gnunet-service-dht.h
parent808e4a55f8ac3516a766873502b9bb020ef3d066 (diff)
downloadgnunet-60ff113fe4e7bb71d5696063b9a9b81eba60a108.tar.gz
gnunet-60ff113fe4e7bb71d5696063b9a9b81eba60a108.zip
refactor DHT for new service API
Diffstat (limited to 'src/dht/gnunet-service-dht.h')
-rw-r--r--src/dht/gnunet-service-dht.h113
1 files changed, 108 insertions, 5 deletions
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index 4684c2324..bc7a48b5a 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011 GNUnet e.V. 3 Copyright (C) 2009-2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -29,6 +29,7 @@
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31#include "gnunet_transport_service.h" 31#include "gnunet_transport_service.h"
32#include "gnunet_block_lib.h"
32 33
33#define DEBUG_DHT GNUNET_EXTRA_LOGGING 34#define DEBUG_DHT GNUNET_EXTRA_LOGGING
34 35
@@ -38,6 +39,11 @@
38extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; 39extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
39 40
40/** 41/**
42 * Handle for the service.
43 */
44extern struct GNUNET_SERVICE_Handle *GDS_service;
45
46/**
41 * Our handle to the BLOCK library. 47 * Our handle to the BLOCK library.
42 */ 48 */
43extern struct GNUNET_BLOCK_Context *GDS_block_context; 49extern struct GNUNET_BLOCK_Context *GDS_block_context;
@@ -48,14 +54,111 @@ extern struct GNUNET_BLOCK_Context *GDS_block_context;
48extern struct GNUNET_STATISTICS_Handle *GDS_stats; 54extern struct GNUNET_STATISTICS_Handle *GDS_stats;
49 55
50/** 56/**
51 * Handle to our server. 57 * Our HELLO
52 */ 58 */
53extern struct GNUNET_SERVER_Handle *GDS_server; 59extern struct GNUNET_MessageHeader *GDS_my_hello;
60
61
54 62
55/** 63/**
56 * Our HELLO 64 * Handle a reply we've received from another peer. If the reply
65 * matches any of our pending queries, forward it to the respective
66 * client(s).
67 *
68 * @param expiration when will the reply expire
69 * @param key the query this reply is for
70 * @param get_path_length number of peers in @a get_path
71 * @param get_path path the reply took on get
72 * @param put_path_length number of peers in @a put_path
73 * @param put_path path the reply took on put
74 * @param type type of the reply
75 * @param data_size number of bytes in @a data
76 * @param data application payload data
57 */ 77 */
58extern struct GNUNET_MessageHeader *GDS_my_hello; 78void
79GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
80 const struct GNUNET_HashCode *key,
81 unsigned int get_path_length,
82 const struct GNUNET_PeerIdentity *get_path,
83 unsigned int put_path_length,
84 const struct GNUNET_PeerIdentity *put_path,
85 enum GNUNET_BLOCK_Type type, size_t data_size,
86 const void *data);
87
59 88
89/**
90 * Check if some client is monitoring GET messages and notify
91 * them in that case.
92 *
93 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
94 * @param type The type of data in the request.
95 * @param hop_count Hop count so far.
96 * @param path_length number of entries in path (or 0 if not recorded).
97 * @param path peers on the GET path (or NULL if not recorded).
98 * @param desired_replication_level Desired replication level.
99 * @param key Key of the requested data.
100 */
101void
102GDS_CLIENTS_process_get (uint32_t options,
103 enum GNUNET_BLOCK_Type type,
104 uint32_t hop_count,
105 uint32_t desired_replication_level,
106 unsigned int path_length,
107 const struct GNUNET_PeerIdentity *path,
108 const struct GNUNET_HashCode *key);
109
110
111/**
112 * Check if some client is monitoring GET RESP messages and notify
113 * them in that case.
114 *
115 * @param type The type of data in the result.
116 * @param get_path Peers on GET path (or NULL if not recorded).
117 * @param get_path_length number of entries in @a get_path.
118 * @param put_path peers on the PUT path (or NULL if not recorded).
119 * @param put_path_length number of entries in @a get_path.
120 * @param exp Expiration time of the data.
121 * @param key Key of the @a data.
122 * @param data Pointer to the result data.
123 * @param size Number of bytes in @a data.
124 */
125void
126GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
127 const struct GNUNET_PeerIdentity *get_path,
128 unsigned int get_path_length,
129 const struct GNUNET_PeerIdentity *put_path,
130 unsigned int put_path_length,
131 struct GNUNET_TIME_Absolute exp,
132 const struct GNUNET_HashCode * key,
133 const void *data,
134 size_t size);
135
136
137/**
138 * Check if some client is monitoring PUT messages and notify
139 * them in that case.
140 *
141 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
142 * @param type The type of data in the request.
143 * @param hop_count Hop count so far.
144 * @param path_length number of entries in path (or 0 if not recorded).
145 * @param path peers on the PUT path (or NULL if not recorded).
146 * @param desired_replication_level Desired replication level.
147 * @param exp Expiration time of the data.
148 * @param key Key under which data is to be stored.
149 * @param data Pointer to the data carried.
150 * @param size Number of bytes in data.
151 */
152void
153GDS_CLIENTS_process_put (uint32_t options,
154 enum GNUNET_BLOCK_Type type,
155 uint32_t hop_count,
156 uint32_t desired_replication_level,
157 unsigned int path_length,
158 const struct GNUNET_PeerIdentity *path,
159 struct GNUNET_TIME_Absolute exp,
160 const struct GNUNET_HashCode * key,
161 const void *data,
162 size_t size);
60 163
61#endif 164#endif