{
if ((a->record_type == b->record_type) &&
(a->expiration_time == b->expiration_time) &&
- ((a->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
- == (b->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION) ) &&
+ ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)
+ == (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) ) &&
(a->data_size == b->data_size) &&
(0 == memcmp (a->data, b->data, a->data_size)))
return GNUNET_YES;
vpn = (struct vpn_data*)data;
GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer);
- if (GNUNET_OK != GNUNET_asprintf (&vpn_str, "%d:%s:%s",
+ if (GNUNET_OK != GNUNET_asprintf (&vpn_str, "%hu %s %s",
vpn->proto,
(char*)&s_peer,
(char*)&vpn[1]))
case GNUNET_DNSPARSER_TYPE_SRV:
srv = (struct srv_data*)data;
- if (GNUNET_OK != GNUNET_asprintf (&srv_str, "%d:%d:%d:%s",
+ if (GNUNET_OK != GNUNET_asprintf (&srv_str, "%d %d %d %s",
ntohs (srv->prio),
ntohs (srv->weight),
ntohs (srv->port),
uint32_t soa_retry;
uint32_t soa_expire;
uint32_t soa_min;
- struct GNUNET_CRYPTO_HashAsciiEncoded s_peer;
+ char s_peer[104];
char s_serv[253];
struct vpn_data* vpn;
uint16_t proto;
+ int ret;
switch (type)
{
return GNUNET_OK;
case GNUNET_NAMESTORE_TYPE_VPN:
-
- if (4 != SSCANF (s,"%hu:%s:%s",
- &proto, (char*)&s_peer, s_serv))
+ ret = SSCANF (s,"%hu %s %s",
+ &proto, s_peer, s_serv);
+ if (3 != ret)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse VPN record string %s %d\n", s, ret);
return GNUNET_SYSERR;
}
*data_size = sizeof (struct vpn_data) + strlen (s_serv) + 1;
return name_map[i].name;
}
+/**
+ * Test if a given record is expired.
+ *
+ * @return GNUNET_YES if the record is expired,
+ * GNUNET_NO if not
+ */
+int
+GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd)
+{
+ struct GNUNET_TIME_Absolute at;
+
+ if (0 != (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
+ return GNUNET_NO;
+ at.abs_value = rd->expiration_time;
+ return (0 == GNUNET_TIME_absolute_get_remaining (at).rel_value) ? GNUNET_YES : GNUNET_NO;
+}
/* end of namestore_common.c */