struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
- * When does the address expire.
+ * When was the address generated.
*/
- struct GNUNET_TIME_AbsoluteNBO expiration;
+ struct GNUNET_TIME_AbsoluteNBO mono_time;
/**
* Hash of the address.
*
* @param address text address at @a communicator to sign
* @param nt network type of @a address
- * @param expiration how long is @a address valid
+ * @param mono_time monotonic time at which @a address was valid
* @param private_key signing key to use
* @param result[out] where to write address record (allocated)
* @param result_size[out] set to size of @a result
*/
void
-GNUNET_HELLO_sign_address (const char *address,
- enum GNUNET_NetworkType nt,
- struct GNUNET_TIME_Absolute expiration,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
- void **result,
- size_t *result_size)
+GNUNET_HELLO_sign_address (
+ const char *address,
+ enum GNUNET_NetworkType nt,
+ struct GNUNET_TIME_Absolute mono_time,
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
+ void **result,
+ size_t *result_size)
{
struct SignedAddress sa;
struct GNUNET_CRYPTO_EddsaSignature sig;
sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS);
sa.purpose.size = htonl (sizeof (sa));
- sa.expiration = GNUNET_TIME_absolute_hton (expiration);
- GNUNET_CRYPTO_hash (address,
- strlen (address),
- &sa.h_addr);
+ sa.mono_time = GNUNET_TIME_absolute_hton (mono_time);
+ GNUNET_CRYPTO_hash (address, strlen (address), &sa.h_addr);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_eddsa_sign (private_key,
- &sa.purpose,
- &sig));
+ GNUNET_CRYPTO_eddsa_sign (private_key, &sa.purpose, &sig));
sig_str = NULL;
- (void) GNUNET_STRINGS_base64_encode (&sig,
- sizeof (sig),
- &sig_str);
- *result_size = 1 + GNUNET_asprintf ((char **) result,
- "%s;%llu;%u;%s",
- sig_str,
- (unsigned long long) expiration.abs_value_us,
- (unsigned int) nt,
- address);
+ (void) GNUNET_STRINGS_base64_encode (&sig, sizeof (sig), &sig_str);
+ *result_size =
+ 1 + GNUNET_asprintf ((char **) result,
+ "%s;%llu;%u;%s",
+ sig_str,
+ (unsigned long long) mono_time.abs_value_us,
+ (unsigned int) nt,
+ address);
GNUNET_free (sig_str);
}
* @param raw_size size of @a raw
* @param pid public key to use for signature verification
* @param nt[out] set to network type
- * @param expiration[out] how long is the address valid
+ * @param mono_time[out] when was the address generated
* @return NULL on error, otherwise the address
*/
char *
GNUNET_HELLO_extract_address (const void *raw,
- size_t raw_size,
- const struct GNUNET_PeerIdentity *pid,
- enum GNUNET_NetworkType *nt,
- struct GNUNET_TIME_Absolute *expiration)
+ size_t raw_size,
+ const struct GNUNET_PeerIdentity *pid,
+ enum GNUNET_NetworkType *nt,
+ struct GNUNET_TIME_Absolute *mono_time)
{
const struct GNUNET_CRYPTO_EddsaPublicKey *public_key = &pid->public_key;
const char *raws = raw;
const char *sc2;
const char *sc3;
const char *raw_addr;
- struct GNUNET_TIME_Absolute raw_expiration;
+ struct GNUNET_TIME_Absolute raw_mono_time;
struct SignedAddress sa;
struct GNUNET_CRYPTO_EddsaSignature *sig;
GNUNET_break_op (0);
return NULL;
}
- if (NULL == (sc = strchr (raws,
- ';')))
+ if (NULL == (sc = strchr (raws, ';')))
{
GNUNET_break_op (0);
return NULL;
}
- if (NULL == (sc2 = strchr (sc + 1,
- ';')))
+ if (NULL == (sc2 = strchr (sc + 1, ';')))
{
GNUNET_break_op (0);
return NULL;
}
- if (NULL == (sc3 = strchr (sc2 + 1,
- ';')))
+ if (NULL == (sc3 = strchr (sc2 + 1, ';')))
{
GNUNET_break_op (0);
return NULL;
}
- if (1 != sscanf (sc + 1,
- "%llu;%u;",
- &raw_us,
- &raw_nt))
+ if (1 != sscanf (sc + 1, "%llu;%u;", &raw_us, &raw_nt))
{
GNUNET_break_op (0);
return NULL;
}
- raw_expiration.abs_value_us = raw_us;
- if (0 == GNUNET_TIME_absolute_get_remaining (raw_expiration).rel_value_us)
- return NULL; /* expired */
+ raw_mono_time.abs_value_us = raw_us;
sig = NULL;
if (sizeof (struct GNUNET_CRYPTO_EddsaSignature) !=
- GNUNET_STRINGS_base64_decode (raws,
- sc - raws,
- (void **) &sig))
+ GNUNET_STRINGS_base64_decode (raws, sc - raws, (void **) &sig))
{
GNUNET_break_op (0);
GNUNET_free_non_null (sig);
sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS);
sa.purpose.size = htonl (sizeof (sa));
- sa.expiration = GNUNET_TIME_absolute_hton (raw_expiration);
- GNUNET_CRYPTO_hash (raw_addr,
- strlen (raw_addr),
- &sa.h_addr);
+ sa.mono_time = GNUNET_TIME_absolute_hton (raw_mono_time);
+ GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.h_addr);
if (GNUNET_YES !=
GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS,
- &sa.purpose,
- sig,
- public_key))
+ &sa.purpose,
+ sig,
+ public_key))
{
GNUNET_break_op (0);
GNUNET_free (sig);
return NULL;
}
GNUNET_free (sig);
- *expiration = raw_expiration;
+ *mono_time = raw_mono_time;
*nt = (enum GNUNET_NetworkType) raw_nt;
return GNUNET_strdup (raw_addr);
}
*
* @param address a peer's address
* @return NULL if the address is mal-formed, otherwise the prefix
- */
+ */
char *
GNUNET_HELLO_address_to_prefix (const char *address)
{
dash = strchr (address, '-');
if (NULL == dash)
return NULL;
- return GNUNET_strndup (address,
- dash - address);
+ return GNUNET_strndup (address, dash - address);
}
#define GNUNET_HELLO_LIB_H
#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
* when a #GNUNET_HELLO_Message is created
*/
enum GNUNET_HELLO_AddressInfo local_info;
-
};
*
* @param addr address to free
*/
-#define GNUNET_HELLO_address_free(addr) GNUNET_free(addr)
+#define GNUNET_HELLO_address_free(addr) GNUNET_free (addr)
GNUNET_NETWORK_STRUCT_BEGIN
* The public key of the peer.
*/
struct GNUNET_CRYPTO_EddsaPublicKey publicKey;
-
};
GNUNET_NETWORK_STRUCT_END
-
/**
* Return HELLO type
*
* @return number of bytes written or 0, #GNUNET_SYSERR to signal the
* end of the iteration.
*/
-typedef ssize_t
-(*GNUNET_HELLO_GenerateAddressListCallback) (void *cls,
- size_t max,
- void *buf);
+typedef ssize_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls,
+ size_t max,
+ void *buf);
/**
* #GNUNET_NO to delete it from the HELLO
* #GNUNET_SYSERR to stop iterating (but keep current address)
*/
-typedef int
-(*GNUNET_HELLO_AddressIterator) (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration);
+typedef int (*GNUNET_HELLO_AddressIterator) (
+ void *cls,
+ const struct GNUNET_HELLO_Address *address,
+ struct GNUNET_TIME_Absolute expiration);
/**
struct GNUNET_HELLO_Message *
GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
int return_modified,
- GNUNET_HELLO_AddressIterator it, void *it_cls);
+ GNUNET_HELLO_AddressIterator it,
+ void *it_cls);
/**
* @param it_cls closure for @a it
*/
void
-GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message *new_hello,
- const struct GNUNET_HELLO_Message *old_hello,
- struct GNUNET_TIME_Absolute expiration_limit,
- GNUNET_HELLO_AddressIterator it,
- void *it_cls);
+GNUNET_HELLO_iterate_new_addresses (
+ const struct GNUNET_HELLO_Message *new_hello,
+ const struct GNUNET_HELLO_Message *old_hello,
+ struct GNUNET_TIME_Absolute expiration_limit,
+ GNUNET_HELLO_AddressIterator it,
+ void *it_cls);
/**
* @param name name of the transport plugin to load
* @return NULL if a plugin with name @a name is not known/loadable
*/
-typedef struct GNUNET_TRANSPORT_PluginFunctions *
-(*GNUNET_HELLO_TransportPluginsFind) (const char *name);
+typedef struct GNUNET_TRANSPORT_PluginFunctions *(
+ *GNUNET_HELLO_TransportPluginsFind) (const char *name);
/**
GNUNET_HELLO_TransportPluginsFind plugins_find);
-
/* NG API */
#include "gnunet_nt_lib.h"
*
* @param address text address to sign
* @param nt network type of @a address
- * @param expiration how long is @a address valid
+ * @param mono_time when was @a address valid
* @param private_key signing key to use
* @param result[out] where to write address record (allocated)
* @param result_size[out] set to size of @a result
*/
void
-GNUNET_HELLO_sign_address (const char *address,
- enum GNUNET_NetworkType nt,
- struct GNUNET_TIME_Absolute expiration,
- const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
- void **result,
- size_t *result_size);
+GNUNET_HELLO_sign_address (
+ const char *address,
+ enum GNUNET_NetworkType nt,
+ struct GNUNET_TIME_Absolute mono_time,
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key,
+ void **result,
+ size_t *result_size);
/**
* @param raw_size size of @a raw
* @param pid public key to use for signature verification
* @param nt[out] set to network type
- * @param expiration[out] how long is the address valid
+ * @param mono_time[out] when was the address generated
* @return NULL on error, otherwise the address
*/
char *
size_t raw_size,
const struct GNUNET_PeerIdentity *pid,
enum GNUNET_NetworkType *nt,
- struct GNUNET_TIME_Absolute *expiration);
+ struct GNUNET_TIME_Absolute *mono_time);
/**
GNUNET_HELLO_address_to_prefix (const char *address);
-#if 0 /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
/* ifndef GNUNET_HELLO_LIB_H */
#endif
-/** @} */ /* end of group */
+/** @} */ /* end of group */
/* end of gnunet_hello_lib.h */
* @return ats application handle, NULL on error
*/
struct GNUNET_TRANSPORT_ApplicationHandle *
-GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
+GNUNET_TRANSPORT_application_init (
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* @param ch handle to destroy
*/
void
-GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch);
+GNUNET_TRANSPORT_application_done (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch);
/**
*
* @param ch handle
* @param peer identity of the peer we have an address for
- * @param expiration when does @a addr expire; used by TRANSPORT to know when
- * to definitively give up attempting to validate
* @param nt network type of @a addr (as claimed by the other peer);
* used by TRANSPORT to avoid trying @a addr's that really cannot work
* due to network type missmatches
* @param addr address to validate
*/
void
-GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch,
- const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_TIME_Absolute expiration,
- enum GNUNET_NetworkType nt,
- const char *addr);
+GNUNET_TRANSPORT_application_validate (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch,
+ const struct GNUNET_PeerIdentity *peer,
+ enum GNUNET_NetworkType nt,
+ const char *addr);
-/** @} */ /* end of group */
+/** @} */ /* end of group */
#endif
/* end of file gnunet_ats_application_service.h */
&ub->sender.public_key))
{
char *addr_s;
- struct GNUNET_TIME_Absolute expiration;
enum GNUNET_NetworkType nt;
addr_s =
sockaddr_to_udpaddr_string ((const struct sockaddr *) &sa, salen);
GNUNET_STATISTICS_update (stats, "# broadcasts received", 1, GNUNET_NO);
- /* expire at the broadcast frequency, as then we'll get the next one
- * anyway */
- expiration = GNUNET_TIME_relative_to_absolute (BROADCAST_FREQUENCY);
/* use our own mechanism to determine network type */
nt =
GNUNET_NT_scanner_get_type (is, (const struct sockaddr *) &sa, salen);
- GNUNET_TRANSPORT_application_validate (ah,
- &ub->sender,
- expiration,
- nt,
- addr_s);
+ GNUNET_TRANSPORT_application_validate (ah, &ub->sender, nt, addr_s);
GNUNET_free (addr_s);
return;
}
*/
static unsigned int pa_count;
+/**
+ * Monotonic time we use for HELLOs generated at this time. TODO: we
+ * should increase this value from time to time (i.e. whenever a
+ * `struct AddressListEntry` actually expires), but IF we do this, we
+ * must also update *all* (remaining) addresses in the PEERSTORE at
+ * that time! (So for now only increased when the peer is restarted,
+ * which hopefully roughly matches whenever our addresses change.)
+ */
+static struct GNUNET_TIME_Absolute hello_mono_time;
+
/**
* Get an offset into the transmission history buffer for `struct
expiration = GNUNET_TIME_relative_to_absolute (ale->expiration);
GNUNET_HELLO_sign_address (ale->address,
ale->nt,
- expiration,
+ hello_mono_time,
GST_my_private_key,
&addr,
&addr_len);
*
* @param pid peer the @a address is for
* @param address an address to reach @a pid (presumably)
- * @param expiration when did @a pid claim @a address will become invalid
*/
static void
start_address_validation (const struct GNUNET_PeerIdentity *pid,
- const char *address,
- struct GNUNET_TIME_Absolute expiration)
+ const char *address)
{
struct GNUNET_TIME_Absolute now;
struct ValidationState *vs;
struct CheckKnownAddressContext ckac = {.address = address, .vs = NULL};
- if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
- return; /* expired */
(void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
pid,
&check_known_address,
now = GNUNET_TIME_absolute_get ();
vs = GNUNET_new (struct ValidationState);
vs->pid = *pid;
- vs->valid_until = expiration;
+ vs->valid_until =
+ GNUNET_TIME_relative_to_absolute (ADDRESS_VALIDATION_LIFETIME);
vs->first_challenge_use = now;
vs->validation_rtt = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
GNUNET_break (0);
return;
}
- start_address_validation (&pr->pid,
- (const char *) record->value,
- record->expiry);
+ start_address_validation (&pr->pid, (const char *) record->value);
}
struct TransportClient *tc = cls;
char *address;
enum GNUNET_NetworkType nt;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Absolute mono_time;
(void) cls;
// OPTIMIZE-FIXME: checking that we know this address already should
ntohs (hdr->header.size) - sizeof (*hdr),
&hdr->peer,
&nt,
- &expiration);
+ &mono_time);
if (NULL == address)
{
GNUNET_break_op (0);
return;
}
- start_address_validation (&hdr->peer, address, expiration);
+ start_address_validation (&hdr->peer, address);
GNUNET_free (address);
GNUNET_SERVICE_client_continue (tc->client);
}
{
struct TransportClient *tc = cls;
- start_address_validation (&m->peer,
- (const char *) &m[1],
- GNUNET_TIME_absolute_ntoh (m->expiration));
+ start_address_validation (&m->peer, (const char *) &m[1]);
GNUNET_SERVICE_client_continue (tc->client);
}
(void) cls;
(void) service;
/* setup globals */
+ hello_mono_time = GNUNET_TIME_absolute_get_monotonic (c);
GST_cfg = c;
backtalkers = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
pending_acks = GNUNET_CONTAINER_multishortmap_create (32768, GNUNET_YES);
*/
struct GNUNET_PeerIdentity peer;
- /**
- * When does the address expire?
- */
- struct GNUNET_TIME_AbsoluteNBO expiration;
-
/* followed by 0-terminated address to validate */
};
#include "transport.h"
-#define LOG(kind,...) GNUNET_log_from(kind, "transport-application-api", __VA_ARGS__)
+#define LOG(kind, ...) \
+ GNUNET_log_from (kind, "transport-application-api", __VA_ARGS__)
/**
ch->mq = NULL;
}
ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff);
- ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff,
- &reconnect_task,
- ch);
+ ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff, &reconnect_task, ch);
}
* @param error details about the error
*/
static void
-error_handler (void *cls,
- enum GNUNET_MQ_Error error)
+error_handler (void *cls, enum GNUNET_MQ_Error error)
{
struct GNUNET_TRANSPORT_ApplicationHandle *ch = cls;
if (NULL == ch->mq)
return GNUNET_SYSERR;
- ev = GNUNET_MQ_msg (m,
- GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST);
+ ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST);
m->pk = htonl ((uint32_t) sh->pk);
m->bw = sh->bw;
m->peer = *peer;
static void
reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
{
- static const struct GNUNET_MQ_MessageHandler handlers[] = {
- { NULL, 0, 0 }
- };
+ static const struct GNUNET_MQ_MessageHandler handlers[] = {{NULL, 0, 0}};
GNUNET_assert (NULL == ch->mq);
- ch->mq = GNUNET_CLIENT_connect (ch->cfg,
- "transport",
- handlers,
- &error_handler,
- ch);
+ ch->mq =
+ GNUNET_CLIENT_connect (ch->cfg, "transport", handlers, &error_handler, ch);
if (NULL == ch->mq)
{
force_reconnect (ch);
* @return transport application handle, NULL on error
*/
struct GNUNET_TRANSPORT_ApplicationHandle *
-GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
+GNUNET_TRANSPORT_application_init (
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_TRANSPORT_ApplicationHandle *ch;
ch = GNUNET_new (struct GNUNET_TRANSPORT_ApplicationHandle);
ch->cfg = cfg;
- ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32,
- GNUNET_YES);
+ ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES);
reconnect (ch);
return ch;
}
* @return #GNUNET_OK (continue to iterate)
*/
static int
-free_sug_handle (void *cls,
- const struct GNUNET_PeerIdentity *key,
- void *value)
+free_sug_handle (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct GNUNET_TRANSPORT_ApplicationSuggestHandle *cur = value;
* @param ch handle to release
*/
void
-GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
+GNUNET_TRANSPORT_application_done (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch)
{
if (NULL != ch->mq)
{
* @return suggest handle, NULL if a request is already pending
*/
struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
-GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle *ch,
- const struct GNUNET_PeerIdentity *peer,
- enum GNUNET_MQ_PreferenceKind pk,
- struct GNUNET_BANDWIDTH_Value32NBO bw)
+GNUNET_TRANSPORT_application_suggest (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch,
+ const struct GNUNET_PeerIdentity *peer,
+ enum GNUNET_MQ_PreferenceKind pk,
+ struct GNUNET_BANDWIDTH_Value32NBO bw)
{
struct GNUNET_TRANSPORT_ApplicationSuggestHandle *s;
s->id = *peer;
s->pk = pk;
s->bw = bw;
- (void) GNUNET_CONTAINER_multipeermap_put (ch->sug_requests,
- &s->id,
- s,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ (void) GNUNET_CONTAINER_multipeermap_put (
+ ch->sug_requests,
+ &s->id,
+ s,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Requesting TRANSPORT to suggest address for `%s'\n",
GNUNET_i2s (peer));
if (NULL == ch->mq)
return s;
- GNUNET_assert (GNUNET_OK ==
- transmit_suggestion (ch,
- &s->id,
- s));
+ GNUNET_assert (GNUNET_OK == transmit_suggestion (ch, &s->id, s));
return s;
}
* @param sh handle to stop
*/
void
-GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh)
+GNUNET_TRANSPORT_application_suggest_cancel (
+ struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh)
{
struct GNUNET_TRANSPORT_ApplicationHandle *ch = sh->ch;
struct GNUNET_MQ_Envelope *ev;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Telling TRANSPORT we no longer care for an address for `%s'\n",
GNUNET_i2s (&sh->id));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests,
- &sh->id,
- sh));
+ GNUNET_assert (
+ GNUNET_OK ==
+ GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, &sh->id, sh));
if (NULL == ch->mq)
{
GNUNET_free (sh);
return;
}
- ev = GNUNET_MQ_msg (m,
- GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL);
+ ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL);
m->pk = htonl ((uint32_t) sh->pk);
m->bw = sh->bw;
m->peer = sh->id;
- GNUNET_MQ_send (ch->mq,
- ev);
+ GNUNET_MQ_send (ch->mq, ev);
GNUNET_free (sh);
}
-
/**
* An application (or a communicator) has received a HELLO (or other address
* data of another peer) and wants TRANSPORT to validate that the address is
*
* @param ch handle
* @param peer identity of the peer we have an address for
- * @param expiration when does @a addr expire; used by TRANSPORT to know when
- * to definitively give up attempting to validate
* @param nt network type of @a addr (as claimed by the other peer);
* used by TRANSPORT to avoid trying @a addr's that really cannot work
* due to network type missmatches
* @param addr address to validate
*/
void
-GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch,
- const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_TIME_Absolute expiration,
- enum GNUNET_NetworkType nt,
- const char *addr)
+GNUNET_TRANSPORT_application_validate (
+ struct GNUNET_TRANSPORT_ApplicationHandle *ch,
+ const struct GNUNET_PeerIdentity *peer,
+ enum GNUNET_NetworkType nt,
+ const char *addr)
{
struct GNUNET_MQ_Envelope *ev;
struct RequestHelloValidationMessage *m;
if (NULL == ch->mq)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Address validation for %s:%s skipped as transport is not connected\n",
- GNUNET_i2s (peer),
- addr);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_WARNING,
+ "Address validation for %s:%s skipped as transport is not connected\n",
+ GNUNET_i2s (peer),
+ addr);
return;
}
alen = strlen (addr) + 1;
- ev = GNUNET_MQ_msg_extra (m,
- alen,
- GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION);
+ ev =
+ GNUNET_MQ_msg_extra (m,
+ alen,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION);
m->peer = *peer;
- m->expiration = GNUNET_TIME_absolute_hton (expiration);
m->nt = htonl ((uint32_t) nt);
- memcpy (&m[1],
- addr,
- alen);
- GNUNET_MQ_send (ch->mq,
- ev);
+ memcpy (&m[1], addr, alen);
+ GNUNET_MQ_send (ch->mq, ev);
}