aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-30 00:02:26 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-30 00:02:26 +0000
commitb2f1bcafa32963ef1bbb9c00ea7b75c933c2016e (patch)
tree213cf86c269c6f61cfae3cb8e350d5ee1eb7f136 /src
parentd3ab6b114ef933c3810919f8bdb9f8c3ceb13774 (diff)
downloadgnunet-b2f1bcafa32963ef1bbb9c00ea7b75c933c2016e.tar.gz
gnunet-b2f1bcafa32963ef1bbb9c00ea7b75c933c2016e.zip
applying patch from #3148 (by shedatc) to make gnunet-helper-nat-client compile on FreeBSD
Diffstat (limited to 'src')
-rw-r--r--src/gns/gnunet-gns-proxy.c16
-rw-r--r--src/include/gnunet_datastore_service.h33
-rw-r--r--src/nat/Makefile.am10
-rw-r--r--src/nat/gnunet-helper-nat-client.c5
-rw-r--r--src/nat/gnunet-helper-nat-server.c5
5 files changed, 40 insertions, 29 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index e464ffa3e..38324eb41 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -813,34 +813,28 @@ mhd_content_cb (void *cls,
813static int 813static int
814check_ssl_certificate (struct Socks5Request *s5r) 814check_ssl_certificate (struct Socks5Request *s5r)
815{ 815{
816 struct curl_tlsinfo tlsinfo;
817 unsigned int cert_list_size; 816 unsigned int cert_list_size;
818 const gnutls_datum_t *chainp; 817 const gnutls_datum_t *chainp;
819 union { 818 const struct curl_tlsinfo *tlsinfo;
820 struct curl_tlsinfo *tlsinfo;
821 struct curl_slist *to_slist;
822 } gptr;
823 char certdn[GNUNET_DNSPARSER_MAX_NAME_LENGTH + 3]; 819 char certdn[GNUNET_DNSPARSER_MAX_NAME_LENGTH + 3];
824 size_t size; 820 size_t size;
825 gnutls_x509_crt_t x509_cert; 821 gnutls_x509_crt_t x509_cert;
826 int rc; 822 int rc;
827 const char *name; 823 const char *name;
828 824
829 memset (&tlsinfo, 0, sizeof (tlsinfo));
830 gptr.tlsinfo = &tlsinfo;
831 if (CURLE_OK != 825 if (CURLE_OK !=
832 curl_easy_getinfo (s5r->curl, 826 curl_easy_getinfo (s5r->curl,
833 CURLINFO_TLS_SESSION, 827 CURLINFO_TLS_SESSION,
834 &gptr)) 828 &tlsinfo))
835 return GNUNET_SYSERR; 829 return GNUNET_SYSERR;
836 if (CURLSSLBACKEND_GNUTLS != tlsinfo.ssl_backend) 830 if (CURLSSLBACKEND_GNUTLS != tlsinfo->ssl_backend)
837 { 831 {
838 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 832 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
839 _("Unsupported CURL SSL backend %d\n"), 833 _("Unsupported CURL SSL backend %d\n"),
840 tlsinfo.ssl_backend); 834 tlsinfo->ssl_backend);
841 return GNUNET_SYSERR; 835 return GNUNET_SYSERR;
842 } 836 }
843 chainp = gnutls_certificate_get_peers (tlsinfo.internals, &cert_list_size); 837 chainp = gnutls_certificate_get_peers (tlsinfo->internals, &cert_list_size);
844 if ( (! chainp) || (0 == cert_list_size) ) 838 if ( (! chainp) || (0 == cert_list_size) )
845 return GNUNET_SYSERR; 839 return GNUNET_SYSERR;
846 840
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h
index 3bbdc3c8a..9a9ba5429 100644
--- a/src/include/gnunet_datastore_service.h
+++ b/src/include/gnunet_datastore_service.h
@@ -83,9 +83,9 @@ GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, int drop);
83 * operation. 83 * operation.
84 * 84 *
85 * @param cls closure 85 * @param cls closure
86 * @param success GNUNET_SYSERR on failure (including timeout/queue drop) 86 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop)
87 * GNUNET_NO if content was already there 87 * #GNUNET_NO if content was already there
88 * GNUNET_YES (or other positive value) on success 88 * #GNUNET_YES (or other positive value) on success
89 * @param min_expiration minimum expiration time required for 0-priority content to be stored 89 * @param min_expiration minimum expiration time required for 0-priority content to be stored
90 * by the datacache at this time, zero for unknown, forever if we have no 90 * by the datacache at this time, zero for unknown, forever if we have no
91 * space for 0-priority content 91 * space for 0-priority content
@@ -146,7 +146,7 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, uint64_t amount,
146 * (if other requests of higher priority are in the queue) 146 * (if other requests of higher priority are in the queue)
147 * @param timeout timeout for the operation 147 * @param timeout timeout for the operation
148 * @param cont continuation to call when done 148 * @param cont continuation to call when done
149 * @param cont_cls closure for cont 149 * @param cont_cls closure for @a cont
150 * @return NULL if the entry was not queued, otherwise a handle that can be used to 150 * @return NULL if the entry was not queued, otherwise a handle that can be used to
151 * cancel; note that even if NULL is returned, the callback will be invoked 151 * cancel; note that even if NULL is returned, the callback will be invoked
152 * (or rather, will already have been invoked) 152 * (or rather, will already have been invoked)
@@ -180,7 +180,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid,
180 * (if other requests of higher priority are in the queue) 180 * (if other requests of higher priority are in the queue)
181 * @param timeout how long to wait at most for a response 181 * @param timeout how long to wait at most for a response
182 * @param cont continuation to call when done 182 * @param cont continuation to call when done
183 * @param cont_cls closure for cont 183 * @param cont_cls closure for @a cont
184 * @return NULL if the entry was not queued, otherwise a handle that can be used to 184 * @return NULL if the entry was not queued, otherwise a handle that can be used to
185 * cancel; note that even if NULL is returned, the callback will be invoked 185 * cancel; note that even if NULL is returned, the callback will be invoked
186 * (or rather, will already have been invoked) 186 * (or rather, will already have been invoked)
@@ -206,7 +206,7 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h,
206 * (if other requests of higher priority are in the queue) 206 * (if other requests of higher priority are in the queue)
207 * @param timeout how long to wait at most for a response 207 * @param timeout how long to wait at most for a response
208 * @param cont continuation to call when done 208 * @param cont continuation to call when done
209 * @param cont_cls closure for cont 209 * @param cont_cls closure for @a cont
210 * @return NULL if the entry was not queued, otherwise a handle that can be used to 210 * @return NULL if the entry was not queued, otherwise a handle that can be used to
211 * cancel; note that even if NULL is returned, the callback will be invoked 211 * cancel; note that even if NULL is returned, the callback will be invoked
212 * (or rather, will already have been invoked) 212 * (or rather, will already have been invoked)
@@ -223,22 +223,21 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid,
223 223
224 224
225/** 225/**
226 * Explicitly remove some content from the database. 226 * Explicitly remove some content from the database. @a cont will be
227 * The "cont"inuation will be called with status 227 * called with status #GNUNET_OK if content was removed, #GNUNET_NO if
228 * "GNUNET_OK" if content was removed, "GNUNET_NO" 228 * no matching entry was found and #GNUNET_SYSERR on all other types
229 * if no matching entry was found and "GNUNET_SYSERR" 229 * of errors.
230 * on all other types of errors.
231 * 230 *
232 * @param h handle to the datastore 231 * @param h handle to the datastore
233 * @param key key for the value 232 * @param key key for the value
234 * @param size number of bytes in data 233 * @param size number of bytes in @a data
235 * @param data content stored 234 * @param data content stored
236 * @param queue_priority ranking of this request in the priority queue 235 * @param queue_priority ranking of this request in the priority queue
237 * @param max_queue_size at what queue size should this request be dropped 236 * @param max_queue_size at what queue size should this request be dropped
238 * (if other requests of higher priority are in the queue) 237 * (if other requests of higher priority are in the queue)
239 * @param timeout how long to wait at most for a response 238 * @param timeout how long to wait at most for a response
240 * @param cont continuation to call when done 239 * @param cont continuation to call when done
241 * @param cont_cls closure for cont 240 * @param cont_cls closure for @a cont
242 * @return NULL if the entry was not queued, otherwise a handle that can be used to 241 * @return NULL if the entry was not queued, otherwise a handle that can be used to
243 * cancel; note that even if NULL is returned, the callback will be invoked 242 * cancel; note that even if NULL is returned, the callback will be invoked
244 * (or rather, will already have been invoked) 243 * (or rather, will already have been invoked)
@@ -268,13 +267,13 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
268 * maybe 0 if no unique identifier is available 267 * maybe 0 if no unique identifier is available
269 */ 268 */
270typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, 269typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
271 const struct GNUNET_HashCode * key, 270 const struct GNUNET_HashCode *key,
272 size_t size, const void *data, 271 size_t size, const void *data,
273 enum GNUNET_BLOCK_Type type, 272 enum GNUNET_BLOCK_Type type,
274 uint32_t priority, 273 uint32_t priority,
275 uint32_t anonymity, 274 uint32_t anonymity,
276 struct GNUNET_TIME_Absolute 275 struct GNUNET_TIME_Absolute expiration,
277 expiration, uint64_t uid); 276 uint64_t uid);
278 277
279 278
280/** 279/**
@@ -294,7 +293,7 @@ typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
294 * @param timeout how long to wait at most for a response 293 * @param timeout how long to wait at most for a response
295 * @param proc function to call on a matching value; 294 * @param proc function to call on a matching value;
296 * or with a NULL value if no datum matches 295 * or with a NULL value if no datum matches
297 * @param proc_cls closure for proc 296 * @param proc_cls closure for @a proc
298 * @return NULL if the entry was not queued, otherwise a handle that can be used to 297 * @return NULL if the entry was not queued, otherwise a handle that can be used to
299 * cancel 298 * cancel
300 */ 299 */
diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am
index 6690026d2..e5630519c 100644
--- a/src/nat/Makefile.am
+++ b/src/nat/Makefile.am
@@ -21,6 +21,14 @@ if LINUX
21install-exec-hook: 21install-exec-hook:
22 $(top_srcdir)/src/nat/install-nat-helper.sh $(libexecdir) $(SUDO_BINARY) || true 22 $(top_srcdir)/src/nat/install-nat-helper.sh $(libexecdir) $(SUDO_BINARY) || true
23else 23else
24if XFREEBSD
25 NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client
26 NATSERVER = gnunet-helper-nat-server.c
27 NATCLIENT = gnunet-helper-nat-client.c
28install-exec-hook:
29 $(top_srcdir)/src/nat/install-nat-helper.sh $(libexecdir) $(SUDO_BINARY) || true
30endif
31else
24install-exec-hook: 32install-exec-hook:
25endif 33endif
26 34
@@ -97,4 +105,4 @@ test_nat_test_LDADD = \
97 105
98EXTRA_DIST = \ 106EXTRA_DIST = \
99 test_nat_data.conf \ 107 test_nat_data.conf \
100 test_nat_test_data.conf \ No newline at end of file 108 test_nat_test_data.conf
diff --git a/src/nat/gnunet-helper-nat-client.c b/src/nat/gnunet-helper-nat-client.c
index bb31570b5..46d51a38c 100644
--- a/src/nat/gnunet-helper-nat-client.c
+++ b/src/nat/gnunet-helper-nat-client.c
@@ -61,6 +61,11 @@
61#include <netinet/ip_icmp.h> 61#include <netinet/ip_icmp.h>
62#include <netinet/in.h> 62#include <netinet/in.h>
63 63
64/* The following constant is missing from FreeBSD 9.2 */
65#ifndef ICMP_TIME_EXCEEDED
66#define ICMP_TIME_EXCEEDED 11
67#endif
68
64/** 69/**
65 * Must match IP given in the server. 70 * Must match IP given in the server.
66 */ 71 */
diff --git a/src/nat/gnunet-helper-nat-server.c b/src/nat/gnunet-helper-nat-server.c
index 37b875ee4..71057beec 100644
--- a/src/nat/gnunet-helper-nat-server.c
+++ b/src/nat/gnunet-helper-nat-server.c
@@ -65,6 +65,11 @@
65#include <netinet/ip_icmp.h> 65#include <netinet/ip_icmp.h>
66#include <netinet/in.h> 66#include <netinet/in.h>
67 67
68/* The following constant is missing from FreeBSD 9.2 */
69#ifndef ICMP_TIME_EXCEEDED
70#define ICMP_TIME_EXCEEDED 11
71#endif
72
68/** 73/**
69 * Should we print some debug output? 74 * Should we print some debug output?
70 */ 75 */