aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gns_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-05 20:00:21 +0100
committerChristian Grothoff <christian@grothoff.org>2018-03-05 20:00:34 +0100
commit0f4032609d5372978e0c038ee05f51ce9c131876 (patch)
tree3fb3beaf77177f4aca197a350b6dd0381fe1a502 /src/gns/gns_api.c
parent044170c00077438d30ab0c832a7193eb093aae30 (diff)
downloadgnunet-0f4032609d5372978e0c038ee05f51ce9c131876.tar.gz
gnunet-0f4032609d5372978e0c038ee05f51ce9c131876.zip
add convenience API to gnunetgns lib
Diffstat (limited to 'src/gns/gns_api.c')
-rw-r--r--src/gns/gns_api.c52
1 files changed, 5 insertions, 47 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 84c4ae189..ff67f0205 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016, 2018 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
@@ -31,7 +31,7 @@
31#include "gnunet_protocols.h" 31#include "gnunet_protocols.h"
32#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
33#include "gns.h" 33#include "gns.h"
34#include "gnunet_gns_service.h" 34#include "gns_api.h"
35 35
36 36
37#define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__) 37#define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__)
@@ -81,50 +81,6 @@ struct GNUNET_GNS_LookupRequest
81 81
82 82
83/** 83/**
84 * Connection to the GNS service.
85 */
86struct GNUNET_GNS_Handle
87{
88
89 /**
90 * Configuration to use.
91 */
92 const struct GNUNET_CONFIGURATION_Handle *cfg;
93
94 /**
95 * Connection to service (if available).
96 */
97 struct GNUNET_MQ_Handle *mq;
98
99 /**
100 * Head of linked list of active lookup requests.
101 */
102 struct GNUNET_GNS_LookupRequest *lookup_head;
103
104 /**
105 * Tail of linked list of active lookup requests.
106 */
107 struct GNUNET_GNS_LookupRequest *lookup_tail;
108
109 /**
110 * Reconnect task
111 */
112 struct GNUNET_SCHEDULER_Task *reconnect_task;
113
114 /**
115 * How long do we wait until we try to reconnect?
116 */
117 struct GNUNET_TIME_Relative reconnect_backoff;
118
119 /**
120 * Request Id generator. Incremented by one for each request.
121 */
122 uint32_t r_id_gen;
123
124};
125
126
127/**
128 * Reconnect to GNS service. 84 * Reconnect to GNS service.
129 * 85 *
130 * @param handle the handle to the GNS service 86 * @param handle the handle to the GNS service
@@ -201,7 +157,8 @@ check_result (void *cls,
201 size_t mlen = ntohs (lookup_msg->header.size) - sizeof (*lookup_msg); 157 size_t mlen = ntohs (lookup_msg->header.size) - sizeof (*lookup_msg);
202 uint32_t rd_count = ntohl (lookup_msg->rd_count); 158 uint32_t rd_count = ntohl (lookup_msg->rd_count);
203 struct GNUNET_GNSRECORD_Data rd[rd_count]; 159 struct GNUNET_GNSRECORD_Data rd[rd_count];
204 160
161 (void) cls;
205 if (GNUNET_SYSERR == 162 if (GNUNET_SYSERR ==
206 GNUNET_GNSRECORD_records_deserialize (mlen, 163 GNUNET_GNSRECORD_records_deserialize (mlen,
207 (const char*) &lookup_msg[1], 164 (const char*) &lookup_msg[1],
@@ -423,4 +380,5 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
423 return lr; 380 return lr;
424} 381}
425 382
383
426/* end of gns_api.c */ 384/* end of gns_api.c */