aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-05 09:36:02 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-05 09:36:02 +0000
commitfb567582ca24ac7450336782365e86a177d8a472 (patch)
tree053b29071811155a328bf8dec1f1c922997fe02f /src/transport/gnunet-service-transport_validation.h
parentec057166095a225d45be16e66671e0f7f74cbef2 (diff)
downloadgnunet-fb567582ca24ac7450336782365e86a177d8a472.tar.gz
gnunet-fb567582ca24ac7450336782365e86a177d8a472.zip
more refactoring
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.h')
-rw-r--r--src/transport/gnunet-service-transport_validation.h61
1 files changed, 55 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h
index 9768c425e..0d6e0ef5a 100644
--- a/src/transport/gnunet-service-transport_validation.h
+++ b/src/transport/gnunet-service-transport_validation.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file transport/gnunet-service-transport_validation.h 22 * @file transport/gnunet-service-transport_validation.h
23 * @brief plugin management API 23 * @brief address validation API
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_SERVICE_TRANSPORT_VALIDATION_H 26#ifndef GNUNET_SERVICE_TRANSPORT_VALIDATION_H
@@ -31,33 +31,49 @@
31 31
32 32
33/** 33/**
34 * 34 * Start the validation subsystem.
35 */ 35 */
36void 36void
37GST_validation_start (void); 37GST_validation_start (void);
38 38
39 39
40/** 40/**
41 * 41 * Stop the validation subsystem.
42 */ 42 */
43void 43void
44GST_validation_stop (void); 44GST_validation_stop (void);
45 45
46 46
47/** 47/**
48 * We've received a PING. If appropriate, generate a PONG.
48 * 49 *
50 * @param sender peer sending the PING
51 * @param hdr the PING
52 * @param plugin_name name of plugin that received the PING
53 * @param sender_address address of the sender as known to the plugin, NULL
54 * if we did not initiate the connection
55 * @param sender_address_len number of bytes in sender_address
49 */ 56 */
50int 57void
51GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, 58GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
52 const struct GNUNET_MessageHeader *hdr, 59 const struct GNUNET_MessageHeader *hdr,
53 const char *plugin_name, 60 const char *plugin_name,
54 const void *sender_address, 61 const void *sender_address,
55 size_t sender_address_len); 62 size_t sender_address_len);
56 63
64
57/** 65/**
66 * We've received a PONG. Check if it matches a pending PING and
67 * mark the respective address as confirmed.
58 * 68 *
69 * @param sender peer sending the PONG
70 * @param hdr the PONG
71 * @param plugin_name name of plugin that received the PONG
72 * @param sender_address address of the sender as known to the plugin, NULL
73 * if we did not initiate the connection
74 * @param sender_address_len number of bytes in sender_address
59 */ 75 */
60int 76void
61GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, 77GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
62 const struct GNUNET_MessageHeader *hdr, 78 const struct GNUNET_MessageHeader *hdr,
63 const char *plugin_name, 79 const char *plugin_name,
@@ -66,21 +82,36 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
66 82
67 83
68/** 84/**
85 * We've received a HELLO, check which addresses are new and trigger
86 * validation.
69 * 87 *
88 * @param hello the HELLO we received
70 */ 89 */
71void 90void
72GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello); 91GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello);
73 92
74 93
94/**
95 * Opaque handle to stop incremental validation address callbacks.
96 */
75struct GST_ValidationIteratorContext; 97struct GST_ValidationIteratorContext;
76 98
99
77/** 100/**
101 * Function called for each address (or address status change) that
102 * the validation module is aware of (for the given target).
103 *
104 * @param cls closure
105 * @param target peer this change is about, never NULL
78 * @param last_validated_at is FOREVER if the address has not been validated (we're currently checking) 106 * @param last_validated_at is FOREVER if the address has not been validated (we're currently checking)
79 * is ZERO if the address was validated a long time ago (from PEERINFO) 107 * is ZERO if the address was validated a long time ago (from PEERINFO)
80 * is a time in the past if this process validated the address 108 * is a time in the past if this process validated the address
81 * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO) 109 * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO)
82 * is ZERO if the address is considered valid (no validation needed) 110 * is ZERO if the address is considered valid (no validation needed)
83 * is a time in the future if we're currently denying re-validation 111 * is a time in the future if we're currently denying re-validation
112 * @param plugin_name name of the plugin
113 * @param plugin_address binary address
114 * @param plugin_address_len length of address
84 */ 115 */
85typedef void (*GST_ValidationAddressCallback)(void *cls, 116typedef void (*GST_ValidationAddressCallback)(void *cls,
86 const struct GNUNET_PeerIdentity *target, 117 const struct GNUNET_PeerIdentity *target,
@@ -90,13 +121,31 @@ typedef void (*GST_ValidationAddressCallback)(void *cls,
90 const void *plugin_address, 121 const void *plugin_address,
91 size_t plugin_address_len); 122 size_t plugin_address_len);
92 123
124
125/**
126 * Call the given function for each address for the given target.
127 * Can either give a snapshot (synchronous API) or be continuous.
128 *
129 * @param target peer information is requested for
130 * @param snapshot_only GNUNET_YES to iterate over addresses once, GNUNET_NO to
131 * continue to give information about addresses as it evolves
132 * @param cb function to call; will not be called after this function returns
133 * if snapshot_only is GNUNET_YES
134 * @param cb_cls closure for 'cb'
135 * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES
136 */
93struct GST_ValidationIteratorContext * 137struct GST_ValidationIteratorContext *
94GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, 138GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
139 int snapshot_only,
95 GST_ValidationAddressCallback cb, 140 GST_ValidationAddressCallback cb,
96 void *cb_cls); 141 void *cb_cls);
97 142
98 143
99 144/**
145 * Cancel an active validation address iteration.
146 *
147 * @param ctx the context of the operation that is cancelled
148 */
100void 149void
101GST_validation_get_addresses_cancel (struct GST_ValidationIteratorContext *ctx); 150GST_validation_get_addresses_cancel (struct GST_ValidationIteratorContext *ctx);
102 151