aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-08 23:20:42 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-08 23:20:42 +0000
commita983a0267109b1b6a8e16e476e2f2956a8771b94 (patch)
tree79bcae73cdb7b87b4f55d4396e79baea76ef53a6 /src/transport/gnunet-service-transport_validation.h
parenta3f8ef5b89dc44fc3acfb8f081a502f3409e4224 (diff)
downloadgnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.tar.gz
gnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.zip
refactoring how we handle peer addresses in peerinfo/ats/transport/hello subsystems -- use a struct instead of 3--4 arguments
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.h')
-rw-r--r--src/transport/gnunet-service-transport_validation.h44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h
index 2d93e508e..a3692e3cf 100644
--- a/src/transport/gnunet-service-transport_validation.h
+++ b/src/transport/gnunet-service-transport_validation.h
@@ -29,6 +29,7 @@
29#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
30#include "gnunet_transport_plugin.h" 30#include "gnunet_transport_plugin.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_hello_lib.h"
32 33
33 34
34/** 35/**
@@ -50,20 +51,16 @@ GST_validation_stop (void);
50 * Based on this, the validation module will measure latency for the 51 * Based on this, the validation module will measure latency for the
51 * address more or less often. 52 * address more or less often.
52 * 53 *
53 * @param sender peer 54 * @param sender peer FIXME: redundant!
54 * @param plugin_name name of plugin 55 * @param address the address
55 * @param session session 56 * @param session session
56 * @param sender_address address of the sender as known to the plugin, NULL
57 * if we did not initiate the connection
58 * @param sender_address_len number of bytes in sender_address
59 * @param in_use GNUNET_YES if we are now using the address for a connection, 57 * @param in_use GNUNET_YES if we are now using the address for a connection,
60 * GNUNET_NO if we are no longer using the address for a connection 58 * GNUNET_NO if we are no longer using the address for a connection
61 */ 59 */
62void 60void
63GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender, 61GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
64 const char *plugin_name, struct Session *session, 62 const struct GNUNET_HELLO_Address *address,
65 const void *sender_address, 63 struct Session *session,
66 size_t sender_address_len,
67 int in_use); 64 int in_use);
68 65
69 66
@@ -72,19 +69,15 @@ GST_validation_set_address_use (const struct GNUNET_PeerIdentity *sender,
72 * address. 69 * address.
73 * 70 *
74 * @param sender peer 71 * @param sender peer
75 * @param plugin_name name of plugin 72 * @param address the address
76 * @param session session 73 * @param session session
77 * @param sender_address address of the sender as known to the plugin, NULL
78 * if we did not initiate the connection
79 * @param sender_address_len number of bytes in sender_address
80 * @return observed latency of the address, FOREVER if the address was 74 * @return observed latency of the address, FOREVER if the address was
81 * never successfully validated 75 * never successfully validated
82 */ 76 */
83struct GNUNET_TIME_Relative 77struct GNUNET_TIME_Relative
84GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender, 78GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender,
85 const char *plugin_name, struct Session *session, 79 const struct GNUNET_HELLO_Address *address,
86 const void *sender_address, 80 struct Session *session);
87 size_t sender_address_len);
88 81
89 82
90/** 83/**
@@ -92,18 +85,14 @@ GST_validation_get_address_latency (const struct GNUNET_PeerIdentity *sender,
92 * 85 *
93 * @param sender peer sending the PING 86 * @param sender peer sending the PING
94 * @param hdr the PING 87 * @param hdr the PING
95 * @param plugin_name name of plugin that received the PING 88 * @param sender_address address of the sender, NULL if we did not initiate
96 * @param session session we got the PING from 89 * @param session session we got the PING from
97 * @param sender_address address of the sender as known to the plugin, NULL
98 * if we did not initiate the connection
99 * @param sender_address_len number of bytes in sender_address
100 */ 90 */
101void 91void
102GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, 92GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
103 const struct GNUNET_MessageHeader *hdr, 93 const struct GNUNET_MessageHeader *hdr,
104 const char *plugin_name, struct Session *session, 94 const struct GNUNET_HELLO_Address *sender_address,
105 const void *sender_address, 95 struct Session *session);
106 size_t sender_address_len);
107 96
108 97
109/** 98/**
@@ -134,29 +123,22 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello);
134 * 123 *
135 * @param cls closure 124 * @param cls closure
136 * @param public_key public key for the peer, never NULL 125 * @param public_key public key for the peer, never NULL
137 * @param target peer this change is about, never NULL
138 * @param valid_until is ZERO if we never validated the address, 126 * @param valid_until is ZERO if we never validated the address,
139 * otherwise a time up to when we consider it (or was) valid 127 * otherwise a time up to when we consider it (or was) valid
140 * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO) 128 * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO)
141 * is ZERO if the address is considered valid (no validation needed) 129 * is ZERO if the address is considered valid (no validation needed)
142 * otherwise a time in the future if we're currently denying re-validation 130 * otherwise a time in the future if we're currently denying re-validation
143 * @param plugin_name name of the plugin 131 * @param address the address
144 * @param plugin_address binary address
145 * @param plugin_address_len length of address
146 */ 132 */
147typedef void (*GST_ValidationAddressCallback) (void *cls, 133typedef void (*GST_ValidationAddressCallback) (void *cls,
148 const struct 134 const struct
149 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded 135 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
150 * public_key, 136 * public_key,
151 const struct GNUNET_PeerIdentity
152 * target,
153 struct GNUNET_TIME_Absolute 137 struct GNUNET_TIME_Absolute
154 valid_until, 138 valid_until,
155 struct GNUNET_TIME_Absolute 139 struct GNUNET_TIME_Absolute
156 validation_block, 140 validation_block,
157 const char *plugin_name, 141 const struct GNUNET_HELLO_Address *address);
158 const void *plugin_address,
159 size_t plugin_address_len);
160 142
161 143
162/** 144/**