summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 19:24:12 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 19:24:12 +0000
commit427dd6f998fb1fde515a3b5c800f9f6d308197b2 (patch)
tree8cbe9bf7b43fafae07ed1a25753ccccdbe430148 /src
parentb18fa7b1e7fcb4d48e2ef314a7d822ccddd8bd60 (diff)
-towards addressing #3047, note this causes the code to FTBFS
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm_api.c2
-rw-r--r--src/arm/mockup-service.c7
-rw-r--r--src/hello/hello.c10
-rw-r--r--src/include/gnunet_arm_service.h5
-rw-r--r--src/include/gnunet_client_lib.h5
-rw-r--r--src/include/gnunet_common.h70
-rw-r--r--src/include/gnunet_configuration_lib.h3
-rw-r--r--src/include/gnunet_crypto_lib.h31
-rw-r--r--src/include/gnunet_hello_lib.h3
-rw-r--r--src/include/gnunet_strings_lib.h4
-rw-r--r--src/include/gnunet_util_lib.h4
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c50
-rw-r--r--src/peerinfo/peerinfo_api.c7
-rw-r--r--src/peerinfo/peerinfo_api_notify.c3
-rw-r--r--src/statistics/gnunet-statistics.c2
-rw-r--r--src/statistics/statistics_api.c5
-rw-r--r--src/testing/testing.c7
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/common_allocation.c2
-rw-r--r--src/util/common_endian.c2
-rw-r--r--src/util/common_logging.c27
-rw-r--r--src/util/configuration.c3
-rw-r--r--src/util/connection.c2
-rw-r--r--src/util/container_bloomfilter.c4
-rw-r--r--src/util/container_meta_data.c5
-rw-r--r--src/util/container_multihashmap.c4
-rw-r--r--src/util/container_multihashmap32.c4
-rw-r--r--src/util/container_multipeermap.c4
-rw-r--r--src/util/crypto_crc.c3
-rw-r--r--src/util/crypto_ecc.c5
-rw-r--r--src/util/crypto_hash.c5
-rw-r--r--src/util/crypto_random.c4
-rw-r--r--src/util/crypto_symmetric.c3
-rw-r--r--src/util/disk.c6
-rw-r--r--src/util/disk.h6
-rw-r--r--src/util/getopt.c4
-rw-r--r--src/util/getopt_helpers.c2
-rw-r--r--src/util/gnunet-ecc.c11
-rw-r--r--src/util/mq.c2
-rw-r--r--src/util/network.c2
-rw-r--r--src/util/os_installation.c6
-rw-r--r--src/util/os_network.c4
-rw-r--r--src/util/os_priority.c6
-rw-r--r--src/util/peer.c23
-rw-r--r--src/util/plugin.c4
-rw-r--r--src/util/program.c10
-rw-r--r--src/util/scheduler.c6
-rw-r--r--src/util/server.c1
-rw-r--r--src/util/server_mst.c6
-rw-r--r--src/util/server_nc.c7
-rw-r--r--src/util/server_tc.c6
-rw-r--r--src/util/service.c11
-rw-r--r--src/util/signal.c3
-rw-r--r--src/util/strings.c3
-rw-r--r--src/util/test_client.c7
-rw-r--r--src/util/test_common_allocation.c2
-rw-r--r--src/util/test_common_endian.c2
-rw-r--r--src/util/test_common_logging.c2
-rw-r--r--src/util/test_common_logging_dummy.c4
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c6
-rw-r--r--src/util/test_configuration.c4
-rw-r--r--src/util/test_connection.c5
-rw-r--r--src/util/test_connection_addressing.c5
-rw-r--r--src/util/test_connection_receive_cancel.c5
-rw-r--r--src/util/test_connection_timeout.c5
-rw-r--r--src/util/test_connection_timeout_no_connect.c5
-rw-r--r--src/util/test_connection_transmit_cancel.c5
-rw-r--r--src/util/test_container_bloomfilter.c3
-rw-r--r--src/util/test_container_heap.c3
-rw-r--r--src/util/test_container_meta_data.c3
-rw-r--r--src/util/test_container_multihashmap.c3
-rw-r--r--src/util/test_container_multihashmap32.c3
-rw-r--r--src/util/test_container_multipeermap.c3
-rw-r--r--src/util/test_container_slist.c3
-rw-r--r--src/util/test_crypto_crc.c3
-rw-r--r--src/util/test_crypto_hash.c4
-rw-r--r--src/util/test_crypto_random.c3
-rw-r--r--src/util/test_crypto_symmetric.c3
-rw-r--r--src/util/test_disk.c4
-rw-r--r--src/util/test_getopt.c4
-rw-r--r--src/util/test_mq_client.c1
-rw-r--r--src/util/test_os_network.c4
-rw-r--r--src/util/test_os_start_process.c6
-rw-r--r--src/util/test_peer.c9
-rw-r--r--src/util/test_plugin.c2
-rw-r--r--src/util/test_program.c5
-rw-r--r--src/util/test_scheduler.c5
-rw-r--r--src/util/test_server.c6
-rw-r--r--src/util/test_server_disconnect.c6
-rw-r--r--src/util/test_server_mst_interrupt.c6
-rw-r--r--src/util/test_server_with_client.c6
-rw-r--r--src/util/test_server_with_client_unix.c6
-rw-r--r--src/util/test_service.c8
-rw-r--r--src/util/test_strings.c3
-rw-r--r--src/util/test_strings_to_data.c4
-rw-r--r--src/util/time.c2
96 files changed, 213 insertions, 391 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 116b3a517..f844551e4 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -25,8 +25,8 @@
* @author LRN
*/
#include "platform.h"
-#include "gnunet_arm_service.h"
#include "gnunet_util_lib.h"
+#include "gnunet_arm_service.h"
#include "gnunet_protocols.h"
#include "arm.h"
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index 2e021627e..d525dfbd9 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -20,13 +20,8 @@
#include <stdlib.h>
#include "platform.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_getopt_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_service_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_strings_lib.h"
-#include "gnunet_time_lib.h"
static int special_ret = 0;
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 53003e296..9e246d473 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -296,9 +296,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
insize = msize - sizeof (struct GNUNET_HELLO_Message);
wpos = 0;
woff = (ret != NULL) ? (char *) &ret[1] : NULL;
- GNUNET_CRYPTO_hash (&msg->publicKey,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
- &address.peer.hashPubKey);
+ address.peer.public_key = msg->publicKey;
while (insize > 0)
{
esize = get_hello_address_size (inptr, insize, &alen);
@@ -549,7 +547,7 @@ GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
*
* @param hello the hello message
* @param peer where to store the peer's identity
- * @return GNUNET_SYSERR if the HELLO was malformed
+ * @return #GNUNET_SYSERR if the HELLO was malformed
*/
int
GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello,
@@ -560,9 +558,7 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello,
if ((ret < sizeof (struct GNUNET_HELLO_Message)) ||
(ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
return GNUNET_SYSERR;
- GNUNET_CRYPTO_hash (&hello->publicKey,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
- &peer->hashPubKey);
+ peer->public_key = hello->publicKey;
return GNUNET_OK;
}
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index a6244b5bc..7c35b0b20 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -35,10 +35,7 @@ extern "C"
#endif
#endif
-#include "gnunet_configuration_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
/**
* Version of the arm API.
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index d6eaca56a..e4cdd26cc 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -37,11 +37,6 @@ extern "C"
#endif
#endif
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
/**
* Opaque handle for a connection to a service.
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 6c27b88a3..ab639122c 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -248,24 +248,6 @@ struct GNUNET_MessageHeader
};
-
-/**
- * @brief A SHA-512 hashcode
- */
-struct GNUNET_HashCode
-{
- uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
-};
-
-
-/**
- * The identity of the host (basically the SHA-512 hashcode of
- * it's public key).
- */
-struct GNUNET_PeerIdentity
-{
- struct GNUNET_HashCode hashPubKey;
-};
GNUNET_NETWORK_STRUCT_END
/**
@@ -273,9 +255,9 @@ GNUNET_NETWORK_STRUCT_END
*
* @param cls closure
* @param filename complete filename (absolute path)
- * @return GNUNET_OK to continue to iterate,
- * GNUNET_NO to stop iteration with no error,
- * GNUNET_SYSERR to abort iteration with error!
+ * @return #GNUNET_OK to continue to iterate,
+ * #GNUNET_NO to stop iteration with no error,
+ * #GNUNET_SYSERR to abort iteration with error!
*/
typedef int (*GNUNET_FileNameCallback) (void *cls, const char *filename);
@@ -325,8 +307,10 @@ GNUNET_get_log_skip ();
#if !defined(GNUNET_CULL_LOGGING)
int
-GNUNET_get_log_call_status (int caller_level, const char *comp,
- const char *file, const char *function, int line);
+GNUNET_get_log_call_status (int caller_level,
+ const char *comp,
+ const char *file,
+ const char *function, int line);
#endif
@@ -529,7 +513,7 @@ GNUNET_h2s_full (const struct GNUNET_HashCode * hc);
*
* @param pid the peer identity
* @return string form of the pid; will be overwritten by next
- * call to GNUNET_i2s.
+ * call to #GNUNET_i2s.
*/
const char *
GNUNET_i2s (const struct GNUNET_PeerIdentity *pid);
@@ -543,7 +527,7 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid);
*
* @param pid the peer identity
* @return string form of the pid; will be overwritten by next
- * call to GNUNET_i2s.
+ * call to #GNUNET_i2s.
*/
const char *
GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid);
@@ -688,8 +672,8 @@ GNUNET_ntoh_double (double d);
/**
* @ingroup memory
- * Allocate a struct or union of the given 'type'.
- * Wrapper around GNUNET_malloc that returns a pointer
+ * Allocate a struct or union of the given @a type.
+ * Wrapper around #GNUNET_malloc that returns a pointer
* to the newly created object of the correct type.
*
* @param type name of the struct or union, i.e. pass 'struct Foo'.
@@ -741,17 +725,17 @@ GNUNET_ntoh_double (double d);
* @ingroup memory
* Wrapper around free. Frees the memory referred to by ptr.
* Note that is is generally better to free memory that was
- * allocated with GNUNET_array_grow using GNUNET_array_grow(mem, size, 0) instead of GNUNET_free.
+ * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free.
*
* @param ptr location where to free the memory. ptr must have
- * been returned by GNUNET_strdup, GNUNET_strndup, GNUNET_malloc or GNUNET_array_grow earlier.
+ * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier.
*/
#define GNUNET_free(ptr) GNUNET_xfree_(ptr, __FILE__, __LINE__)
/**
* @ingroup memory
* Free the memory pointed to by ptr if ptr is not NULL.
- * Equivalent to if (ptr!=null)GNUNET_free(ptr).
+ * Equivalent to `if (NULL != ptr) GNUNET_free(ptr)`.
*
* @param ptr the location in memory to free
*/
@@ -759,7 +743,7 @@ GNUNET_ntoh_double (double d);
/**
* @ingroup memory
- * Wrapper around GNUNET_strdup. Makes a copy of the zero-terminated string
+ * Wrapper around #GNUNET_xstrdup_. Makes a copy of the zero-terminated string
* pointed to by a.
*
* @param a pointer to a zero-terminated string
@@ -769,7 +753,7 @@ GNUNET_ntoh_double (double d);
/**
* @ingroup memory
- * Wrapper around GNUNET_strndup. Makes a partial copy of the string
+ * Wrapper around #GNUNET_xstrndup_. Makes a partial copy of the string
* pointed to by a.
*
* @param a pointer to a string
@@ -781,8 +765,8 @@ GNUNET_ntoh_double (double d);
/**
* @ingroup memory
* Grow a well-typed (!) array. This is a convenience
- * method to grow a vector <tt>arr</tt> of size <tt>size</tt>
- * to the new (target) size <tt>tsize</tt>.
+ * method to grow a vector @a arr of size @a size
+ * to the new (target) size @a tsize.
* <p>
*
* Example (simple, well-typed stack):
@@ -826,7 +810,7 @@ GNUNET_ntoh_double (double d);
* Like snprintf, just aborts if the buffer is of insufficient size.
*
* @param buf pointer to buffer that is written to
- * @param size number of bytes in buf
+ * @param size number of bytes in @a buf
* @param format format strings
* @param ... data for format string
* @return number of bytes written to buf or negative value on error
@@ -853,7 +837,7 @@ GNUNET_asprintf (char **buf, const char *format, ...);
/**
* Allocate memory. Checks the return value, aborts if no more
* memory is available. Don't use GNUNET_xmalloc_ directly. Use the
- * GNUNET_malloc macro.
+ * #GNUNET_malloc macro.
* The memory will be zero'ed out.
*
* @param size number of bytes to allocate
@@ -868,7 +852,7 @@ GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber);
/**
* Allocate and initialize memory. Checks the return value, aborts if no more
* memory is available. Don't use GNUNET_xmemdup_ directly. Use the
- * GNUNET_memdup macro.
+ * #GNUNET_memdup macro.
*
* @param buf buffer to initialize from (must contain size bytes)
* @param size number of bytes to allocate
@@ -885,7 +869,7 @@ GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename,
* Allocate memory. This function does not check if the allocation
* request is within reasonable bounds, allowing allocations larger
* than 40 MB. If you don't expect the possibility of very large
- * allocations, use GNUNET_malloc instead. The memory will be zero'ed
+ * allocations, use #GNUNET_malloc instead. The memory will be zero'ed
* out.
*
* @param size number of bytes to allocate
@@ -896,6 +880,7 @@ GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename,
void *
GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber);
+
/**
* Reallocate memory. Checks the return value, aborts if no more
* memory is available.
@@ -903,10 +888,11 @@ GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber);
void *
GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber);
+
/**
* Free memory. Merely a wrapper for the case that we
* want to keep track of allocations. Don't use GNUNET_xfree_
- * directly. Use the GNUNET_free macro.
+ * directly. Use the #GNUNET_free macro.
*
* @param ptr pointer to memory to free
* @param filename where is this call being made (for debugging)
@@ -917,7 +903,7 @@ GNUNET_xfree_ (void *ptr, const char *filename, int linenumber);
/**
- * Dup a string. Don't call GNUNET_xstrdup_ directly. Use the GNUNET_strdup macro.
+ * Dup a string. Don't call GNUNET_xstrdup_ directly. Use the #GNUNET_strdup macro.
* @param str string to duplicate
* @param filename where is this call being made (for debugging)
* @param linenumber line where this call is being made (for debugging)
@@ -927,7 +913,7 @@ char *
GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber);
/**
- * Dup partially a string. Don't call GNUNET_xstrndup_ directly. Use the GNUNET_strndup macro.
+ * Dup partially a string. Don't call GNUNET_xstrndup_ directly. Use the #GNUNET_strndup macro.
*
* @param str string to duplicate
* @param len length of the string to duplicate
@@ -944,7 +930,7 @@ GNUNET_xstrndup_ (const char *str, size_t len, const char *filename,
* Grows old by (*oldCount-newCount)*elementSize
* bytes and sets *oldCount to newCount.
*
- * Don't call GNUNET_xgrow_ directly. Use the GNUNET_array_grow macro.
+ * Don't call GNUNET_xgrow_ directly. Use the #GNUNET_array_grow macro.
*
* @param old address of the pointer to the array
* *old may be NULL
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 98602f8b9..74f7bf5ce 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -37,9 +37,6 @@ extern "C"
#endif
#endif
-#include "gnunet_common.h"
-#include "gnunet_time_lib.h"
-
/**
* A configuration object.
*/
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 1d000c29a..a0935363b 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -43,11 +43,30 @@ extern "C"
#endif
#endif
+/**
+ * @brief A 512-bit hashcode
+ */
+struct GNUNET_HashCode;
+
+/**
+ * The identity of the host (wraps the signing key of the peer).
+ */
+struct GNUNET_PeerIdentity;
+
#include "gnunet_common.h"
#include "gnunet_scheduler_lib.h"
/**
+ * @brief A 512-bit hashcode
+ */
+struct GNUNET_HashCode
+{
+ uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
+};
+
+
+/**
* Maximum length of an ECC signature.
* Note: round up to multiple of 8 minus 2 for alignment.
*/
@@ -170,6 +189,16 @@ struct GNUNET_CRYPTO_EccPublicSignKey
};
+
+/**
+ * The identity of the host (wraps the signing key of the peer).
+ */
+struct GNUNET_PeerIdentity
+{
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
+};
+
+
/**
* Public ECC key (always for NIST P-521) encoded in a format suitable
* for network transmission and encryption (ECDH).
@@ -556,7 +585,7 @@ GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc);
*/
void
GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
- struct GNUNET_HashCode * result);
+ struct GNUNET_HashCode *result);
/**
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 6ecf8754a..901aa4f24 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -35,8 +35,7 @@ extern "C"
#endif
#endif
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
/**
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index 8fd7a4e10..1fe04da6b 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -55,7 +55,7 @@ extern "C"
*
* @param fancy_size human readable string (i.e. 1 MB)
* @param size set to the size in bytes
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size,
@@ -68,7 +68,7 @@ GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size,
*
* @param fancy_time human readable string (i.e. 1 minute)
* @param rtime set to the relative time
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time,
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index b5aa1a0e0..025dbed90 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -36,14 +36,14 @@ extern "C"
#endif
#endif
+#include "gnunet_crypto_lib.h"
#include "gnunet_common.h"
#include "gnunet_bandwidth_lib.h"
#include "gnunet_bio_lib.h"
+#include "gnunet_connection_lib.h"
#include "gnunet_client_lib.h"
#include "gnunet_configuration_lib.h"
-#include "gnunet_connection_lib.h"
#include "gnunet_container_lib.h"
-#include "gnunet_crypto_lib.h"
#include "gnunet_disk_lib.h"
#include "gnunet_getopt_lib.h"
#include "gnunet_helper_lib.h"
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index f0e298cf5..cf28484eb 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -136,7 +136,7 @@ struct NotificationContext
* The in-memory list of known hosts, mapping of
* host IDs to 'struct HostEntry*' values.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *hostmap;
+static struct GNUNET_CONTAINER_MultiPeerMap *hostmap;
/**
* Clients to immediately notify about all changes.
@@ -249,13 +249,12 @@ count_addresses (void *cls, const struct GNUNET_HELLO_Address *address,
static char *
get_host_filename (const struct GNUNET_PeerIdentity *id)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded fil;
char *fn;
if (NULL == networkIdDirectory)
return NULL;
- GNUNET_CRYPTO_hash_to_enc (&id->hashPubKey, &fil);
- GNUNET_asprintf (&fn, "%s%s%s", networkIdDirectory, DIR_SEPARATOR_STR, &fil);
+ GNUNET_asprintf (&fn, "%s%s%s", networkIdDirectory, DIR_SEPARATOR_STR,
+ GNUNET_i2s_full (id));
return fn;
}
@@ -441,7 +440,7 @@ add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity)
struct ReadHostFileContext r;
char *fn;
- entry = GNUNET_CONTAINER_multihashmap_get (hostmap, &identity->hashPubKey);
+ entry = GNUNET_CONTAINER_multipeermap_get (hostmap, identity);
if (NULL == entry)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding new peer `%s'\n", GNUNET_i2s (identity));
@@ -449,7 +448,7 @@ add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity)
GNUNET_NO);
entry = GNUNET_malloc (sizeof (struct HostEntry));
entry->identity = *identity;
- GNUNET_CONTAINER_multihashmap_put (hostmap, &entry->identity.hashPubKey, entry,
+ GNUNET_CONTAINER_multipeermap_put (hostmap, &entry->identity, entry,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
notify_all (entry);
fn = get_host_filename (identity);
@@ -576,7 +575,9 @@ hosts_directory_scan_callback (void *cls, const char *fullname)
remove_garbage (fullname);
return GNUNET_OK;
}
- if (GNUNET_OK == GNUNET_CRYPTO_hash_from_string (filename, &identity.hashPubKey))
+ if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename,
+ strlen (filename),
+ &identity.public_key))
{
if (0 != memcmp (&id, &identity, sizeof (id_friend)))
{
@@ -699,7 +700,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
int pos;
char *buffer;
- host = GNUNET_CONTAINER_multihashmap_get (hostmap, &peer->hashPubKey);
+ host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer);
GNUNET_assert (NULL != host);
friend_hello_type = GNUNET_HELLO_is_friend_only (hello);
@@ -830,7 +831,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
* @return GNUNET_YES (continue to iterate)
*/
static int
-add_to_tc (void *cls, const struct GNUNET_HashCode * key, void *value)
+add_to_tc (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct TransmitContext *tc = cls;
struct HostEntry *pos = value;
@@ -848,8 +849,9 @@ add_to_tc (void *cls, const struct GNUNET_HashCode * key, void *value)
GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
sizeof (struct InfoMessage));
memcpy (&im[1], pos->hello, hs);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending public HELLO with size %u for peer `%4s'\n",
- hs, GNUNET_h2s (key));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending public HELLO with size %u for peer `%4s'\n",
+ hs, GNUNET_i2s (key));
}
else if ((pos->friend_only_hello != NULL) && (GNUNET_YES == tc->friend_only))
{
@@ -858,13 +860,15 @@ add_to_tc (void *cls, const struct GNUNET_HashCode * key, void *value)
GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
sizeof (struct InfoMessage));
memcpy (&im[1], pos->friend_only_hello, hs);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending friend-only HELLO with size %u for peer `%4s'\n",
- hs, GNUNET_h2s (key));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending friend-only HELLO with size %u for peer `%4s'\n",
+ hs, GNUNET_i2s (key));
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding no HELLO for peer `%s'\n",
- GNUNET_h2s (key));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding no HELLO for peer `%s'\n",
+ GNUNET_i2s (key));
}
im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
@@ -1027,7 +1031,7 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client,
"GET", GNUNET_i2s (&lpm->peer));
tcx.friend_only = ntohl (lpm->include_friend_only);
tcx.tc = GNUNET_SERVER_transmit_context_create (client);
- GNUNET_CONTAINER_multihashmap_get_multiple (hostmap, &lpm->peer.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_get_multiple (hostmap, &lpm->peer,
&add_to_tc, &tcx);
GNUNET_SERVER_transmit_context_append_data (tcx.tc, NULL, 0,
GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
@@ -1053,7 +1057,7 @@ handle_get_all (void *cls, struct GNUNET_SERVER_Client *client,
tcx.friend_only = ntohl (lapm->include_friend_only);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' message received\n", "GET_ALL");
tcx.tc = GNUNET_SERVER_transmit_context_create (client);
- GNUNET_CONTAINER_multihashmap_iterate (hostmap, &add_to_tc, &tcx);
+ GNUNET_CONTAINER_multipeermap_iterate (hostmap, &add_to_tc, &tcx);
GNUNET_SERVER_transmit_context_append_data (tcx.tc, NULL, 0,
GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
GNUNET_SERVER_transmit_context_run (tcx.tc, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -1071,7 +1075,7 @@ handle_get_all (void *cls, struct GNUNET_SERVER_Client *client,
* @return GNUNET_YES (always, continue to iterate)
*/
static int
-do_notify_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
+do_notify_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct NotificationContext *nc = cls;
struct HostEntry *he = value;
@@ -1124,7 +1128,7 @@ handle_notify (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_CONTAINER_DLL_insert (nc_head, nc_tail, nc);
GNUNET_SERVER_client_mark_monitor (client);
GNUNET_SERVER_notification_context_add (notify_list, client);
- GNUNET_CONTAINER_multihashmap_iterate (hostmap, &do_notify_entry, nc);
+ GNUNET_CONTAINER_multipeermap_iterate (hostmap, &do_notify_entry, nc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -1159,7 +1163,7 @@ disconnect_cb (void *cls,struct GNUNET_SERVER_Client *client)
* @return GNUNET_YES (continue to iterate)
*/
static int
-free_host_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
+free_host_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
struct HostEntry *he = value;
@@ -1191,8 +1195,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_CONTAINER_DLL_remove (nc_head, nc_tail, cur);
GNUNET_free (cur);
}
- GNUNET_CONTAINER_multihashmap_iterate (hostmap, &free_host_entry, NULL);
- GNUNET_CONTAINER_multihashmap_destroy (hostmap);
+ GNUNET_CONTAINER_multipeermap_iterate (hostmap, &free_host_entry, NULL);
+ GNUNET_CONTAINER_multipeermap_destroy (hostmap);
if (NULL != stats)
{
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
@@ -1228,7 +1232,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
int noio;
int use_included;
- hostmap = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_YES);
+ hostmap = GNUNET_CONTAINER_multipeermap_create (1024, GNUNET_YES);
stats = GNUNET_STATISTICS_create ("peerinfo", cfg);
notify_list = GNUNET_SERVER_notification_context_create (server, 0);
noio = GNUNET_CONFIGURATION_get_value_yesno (cfg, "peerinfo", "NO_IO");
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index faa56e908..fad77a194 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -24,11 +24,8 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_time_lib.h"
#include "peerinfo.h"
#define LOG(kind,...) GNUNET_log_from (kind, "peerinfo-api",__VA_ARGS__)
@@ -558,7 +555,7 @@ peerinfo_handler (void *cls, const struct GNUNET_MessageHeader *msg)
/* bogus message (from a different iteration call?); out of sequence! */
LOG (GNUNET_ERROR_TYPE_ERROR,
"Received HELLO for peer `%s', expected peer `%s'\n",
- GNUNET_h2s (&im->peer.hashPubKey),
+ GNUNET_i2s (&im->peer),
GNUNET_i2s (&ic->peer));
GNUNET_break (0);
diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c
index 194664d62..f5a076a20 100644
--- a/src/peerinfo/peerinfo_api_notify.c
+++ b/src/peerinfo/peerinfo_api_notify.c
@@ -24,10 +24,9 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet_protocols.h"
-#include "gnunet_time_lib.h"
#include "peerinfo.h"
#define LOG(kind,...) GNUNET_log_from (kind, "nse-api",__VA_ARGS__)
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index 8dc84190d..d05765c4a 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -25,8 +25,6 @@
* @author Igor Wronsky
*/
#include "platform.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_program_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "statistics.h"
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c
index 1a767e9e7..7aa109930 100644
--- a/src/statistics/statistics_api.c
+++ b/src/statistics/statistics_api.c
@@ -24,13 +24,10 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
-#include "gnunet_container_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
#include "gnunet_statistics_service.h"
-#include "gnunet_strings_lib.h"
#include "statistics.h"
/**
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 8502809f3..10d25637e 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -701,7 +701,6 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
struct GNUNET_PeerIdentity *id)
{
struct GNUNET_CRYPTO_EccPrivateKey *private_key;
- struct GNUNET_CRYPTO_EccPublicSignKey public_key;
if ((NULL == id) || (NULL == system->hostkeys_data))
return NULL;
@@ -716,10 +715,8 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &public_key);
- GNUNET_CRYPTO_hash (&public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
- &(id->hashPubKey));
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key,
+ &id->public_key);
return private_key;
}
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index ee3349db7..564204862 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -416,7 +416,7 @@ test_os_network_LDADD = \
test_peer_SOURCES = \
test_peer.c
test_peer_LDADD = \
-$(top_builddir)/src/util/libgnunetutil.la
+$(top_builddir)/src/util/libgnunetutil.la -lgcrypt
test_plugin_SOURCES = \
test_plugin.c
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index a7f6d1c67..27dda5e59 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -24,7 +24,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/src/util/common_endian.c b/src/util/common_endian.c
index 3d69f99e3..247e9e876 100644
--- a/src/util/common_endian.c
+++ b/src/util/common_endian.c
@@ -25,7 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__)
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 0c9973d44..6493aae38 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -25,7 +25,6 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include <regex.h>
@@ -1082,16 +1081,19 @@ GNUNET_h2s_full (const struct GNUNET_HashCode * hc)
*
* @param pid the peer identity
* @return string form of the pid; will be overwritten by next
- * call to GNUNET_i2s.
+ * call to #GNUNET_i2s.
*/
const char *
GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
{
- static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
-
- GNUNET_CRYPTO_hash_to_enc (&pid->hashPubKey, &ret);
- ret.encoding[4] = '\0';
- return (const char *) ret.encoding;
+ static char buf[256];
+ char *ret;
+
+ ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pid->public_key);
+ strcpy (buf, ret);
+ GNUNET_free (ret);
+ buf[4] = '\0';
+ return buf;
}
@@ -1102,15 +1104,18 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
*
* @param pid the peer identity
* @return string form of the pid; will be overwritten by next
- * call to GNUNET_i2s.
+ * call to #GNUNET_i2s_full.
*/
const char *
GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid)
{
- static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
+ static char buf[256];
+ char *ret;
- GNUNET_CRYPTO_hash_to_enc (&pid->hashPubKey, &ret);
- return (const char *) ret.encoding;
+ ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pid->public_key);
+ strcpy (buf, ret);
+ GNUNET_free (ret);
+ return buf;
}
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 0899ed7c9..69e2168c1 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -25,10 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_strings_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/connection.c b/src/util/connection.c
index 3290abcfc..e90fa9f51 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -30,9 +30,7 @@
* These rules should apply in general, but for this
* module they are VERY, VERY important.
*/
-
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_resolver_service.h"
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 825a45f55..f9487f98f 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -40,9 +40,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_disk_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 777e0b6c3..6e77c40a2 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -25,10 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_strings_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#include <extractor.h>
#include <zlib.h>
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index 5d12644cf..24eae9f0d 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -24,9 +24,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c
index 29ad14d3a..5448a3cde 100644
--- a/src/util/container_multihashmap32.c
+++ b/src/util/container_multihashmap32.c
@@ -26,9 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c
index 6519f6c84..54a1d1635 100644
--- a/src/util/container_multipeermap.c
+++ b/src/util/container_multipeermap.c
@@ -24,9 +24,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c
index 82ca59456..cda6243be 100644
--- a/src/util/crypto_crc.c
+++ b/src/util/crypto_crc.c
@@ -28,8 +28,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index e393ad1e5..770b0c37c 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -25,7 +25,6 @@
*/
#include "platform.h"
#include <gcrypt.h>
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#define EXTRA_CHECKS ALLOW_EXTRA_CHECKS
@@ -746,7 +745,6 @@ GNUNET_CRYPTO_get_host_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_PeerIdentity *dst)
{
struct GNUNET_CRYPTO_EccPrivateKey *priv;
- struct GNUNET_CRYPTO_EccPublicSignKey pub;
if (NULL == (priv = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg)))
{
@@ -754,9 +752,8 @@ GNUNET_CRYPTO_get_host_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
_("Could not load peer's private key\n"));
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &dst->public_key);
GNUNET_free (priv);
- GNUNET_CRYPTO_hash (&pub, sizeof (pub), &dst->hashPubKey);
return GNUNET_OK;
}
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index e1997c3bb..67cf92d17 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -26,10 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 935bbc3ea..e3388faad 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -25,9 +25,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c
index 3e4f9d748..3cc546652 100644
--- a/src/util/crypto_symmetric.c
+++ b/src/util/crypto_symmetric.c
@@ -26,8 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/disk.c b/src/util/disk.c
index 066b0b99b..7729fd8ee 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -26,12 +26,8 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_directories.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_strings_lib.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include "disk.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/disk.h b/src/util/disk.h
index 890281a93..fa786ea68 100644
--- a/src/util/disk.h
+++ b/src/util/disk.h
@@ -26,7 +26,7 @@
#ifndef GNUNET_DISK_H_
#define GNUNET_DISK_H_
-#include "gnunet_disk_lib.h"
+#include "gnunet_util_lib.h"
/**
* Retrieve OS file handle
@@ -34,8 +34,8 @@
* @internal
* @param fh GNUnet file descriptor
* @param dst destination buffer
- * @param dst_len length of dst
- * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ * @param dst_len length of @a dst
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
int
GNUNET_DISK_internal_file_handle_ (const struct GNUNET_DISK_FileHandle *fh,
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 936e3b1e3..7b2f3cf5d 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -37,10 +37,8 @@ Copyright (C) 2006 Christian Grothoff
* replace main GNU getopt parser with one that
* actually fits our API.
*/
-
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_getopt_lib.h"
+#include "gnunet_util_lib.h"
#ifdef VMS
#include <unixlib.h>
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index 349f9e477..798ced005 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -23,9 +23,7 @@
* @brief implements command line that sets option
* @author Christian Grothoff
*/
-
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 9f76d6b8e..59c0f5fe2 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -111,7 +111,6 @@ run (void *cls, char *const *args, const char *cfgfile,
{
struct GNUNET_CRYPTO_EccPrivateKey *pk;
struct GNUNET_CRYPTO_EccPublicSignKey pub;
- struct GNUNET_PeerIdentity pid;
if (NULL == args[0])
{
@@ -137,12 +136,14 @@ run (void *cls, char *const *args, const char *cfgfile,
}
if (print_peer_identity)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded enc;
+ char *str;
GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
- GNUNET_CRYPTO_hash (&pub, sizeof (pub), &pid.hashPubKey);
- GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc);
- fprintf (stdout, "%s\n", enc.encoding);
+ str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub);
+ fprintf (stdout,
+ "%s\n",
+ str);
+ GNUNET_free (str);
}
GNUNET_free (pk);
}
diff --git a/src/util/mq.c b/src/util/mq.c
index 289ac1ade..733329a2c 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -23,9 +23,7 @@
* @file util/mq.c
* @brief general purpose request queue
*/
-
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "mq",__VA_ARGS__)
diff --git a/src/util/network.c b/src/util/network.c
index c0b977368..162948420 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -25,8 +25,8 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "disk.h"
#include "gnunet_util_lib.h"
+#include "disk.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index a596ca2c0..06eb4ed60 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -30,11 +30,7 @@
#include <unistr.h> /* for u16_to_u8 */
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
#if DARWIN
#include <mach-o/ldsyms.h>
#include <mach-o/dyld.h>
diff --git a/src/util/os_network.c b/src/util/os_network.c
index b11f07157..4d9155ae2 100644
--- a/src/util/os_network.c
+++ b/src/util/os_network.c
@@ -27,10 +27,8 @@
* @author Jake Dust
* @author LRN
*/
-
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index f019bd605..7a6d93858 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -25,11 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_strings_lib.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#include "disk.h"
#include <unistr.h>
diff --git a/src/util/peer.c b/src/util/peer.c
index e58b96211..08062e364 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -23,7 +23,6 @@
* @brief peer-ID table that assigns integer IDs to peer-IDs to save memory
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_peer_lib.h"
@@ -56,11 +55,11 @@ struct PeerEntry
static struct PeerEntry **table;
/**
- * Hashmap of PeerIdentities to "struct PeerEntry"
+ * Peermap of PeerIdentities to "struct PeerEntry"
* (for fast lookup). NULL until the library
* is actually being used.
*/
-static struct GNUNET_CONTAINER_MultiHashMap *map;
+static struct GNUNET_CONTAINER_MultiPeerMap *map;
/**
* Size of the "table".
@@ -89,7 +88,7 @@ GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid)
return 0;
if (NULL == map)
return 0;
- e = GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
+ e = GNUNET_CONTAINER_multipeermap_get (map, pid);
if (NULL == e)
return 0;
GNUNET_assert (e->rc > 0);
@@ -114,8 +113,8 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
if (NULL == pid)
return 0;
if (NULL == map)
- map = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
- e = GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
+ map = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES);
+ e = GNUNET_CONTAINER_multipeermap_get (map, pid);
if (NULL != e)
{
GNUNET_assert (e->rc > 0);
@@ -145,8 +144,8 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
table[ret]->rc = 1;
table[ret]->pid = ret;
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (map,
- &table[ret]->id.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_put (map,
+ &table[ret]->id,
table[ret],
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return ret;
@@ -178,8 +177,8 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count)
if (0 == table[id]->rc)
{
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id]->id.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (map,
+ &table[id]->id,
table[id]));
table[id]->pid = free_list_start;
free_list_start = id;
@@ -206,8 +205,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
if (0 == table[id]->rc)
{
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id]->id.hashPubKey,
+ GNUNET_CONTAINER_multipeermap_remove (map,
+ &table[id]->id,
table[id]));
table[id]->pid = free_list_start;
free_list_start = id;
diff --git a/src/util/plugin.c b/src/util/plugin.c
index b22976574..fe8281c32 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -26,9 +26,7 @@
#include "platform.h"
#include <ltdl.h>
-#include "gnunet_common.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_plugin_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/program.c b/src/util/program.c
index 16a2f5086..aae58db49 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -25,15 +25,9 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_directories.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_resolver_service.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_directories.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index b7c24e2ad..a38bebf84 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -24,11 +24,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_signal_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#include "disk.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util-scheduler", __VA_ARGS__)
diff --git a/src/util/server.c b/src/util/server.c
index 9e88992ca..dce03bdcf 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -25,7 +25,6 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
diff --git a/src/util/server_mst.c b/src/util/server_mst.c
index 7eac75bed..34ffc6da7 100644
--- a/src/util/server_mst.c
+++ b/src/util/server_mst.c
@@ -25,11 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#if HAVE_UNALIGNED_64_ACCESS
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index 37dd9d84c..d11025680 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -26,12 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util-server-nc", __VA_ARGS__)
diff --git a/src/util/server_tc.c b/src/util/server_tc.c
index f02d06d2c..780b5f003 100644
--- a/src/util/server_tc.c
+++ b/src/util/server_tc.c
@@ -26,11 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/service.c b/src/util/service.c
index b91be9664..cab8a8aef 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -24,17 +24,10 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_directories.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
+#include "gnunet_directories.h"
#include "gnunet_resolver_service.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
#if HAVE_MALLINFO
#include <malloc.h>
diff --git a/src/util/signal.c b/src/util/signal.c
index c3f5f023e..edce5f653 100644
--- a/src/util/signal.c
+++ b/src/util/signal.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_signal_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/strings.c b/src/util/strings.c
index 6380ea5ec..3d061fb57 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -29,8 +29,7 @@
#if HAVE_ICONV
#include <iconv.h>
#endif
-#include "gnunet_common.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
#include <unicase.h>
#include <unistr.h>
#include <uniconv.h>
diff --git a/src/util/test_client.c b/src/util/test_client.c
index 7d7ec8cff..6dfb8349a 100644
--- a/src/util/test_client.c
+++ b/src/util/test_client.c
@@ -22,12 +22,7 @@
* @brief tests for client.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 14325
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c
index 438d39751..0c6f5fc5a 100644
--- a/src/util/test_common_allocation.c
+++ b/src/util/test_common_allocation.c
@@ -23,7 +23,7 @@
* @brief testcase for common_allocation.c
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
static int
check ()
diff --git a/src/util/test_common_endian.c b/src/util/test_common_endian.c
index a709abec6..8974b43fe 100644
--- a/src/util/test_common_endian.c
+++ b/src/util/test_common_endian.c
@@ -22,7 +22,7 @@
* @brief testcase for common_endian.c
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
#define CHECK(n) if (n != GNUNET_htonll(GNUNET_ntohll(n))) return 1;
diff --git a/src/util/test_common_logging.c b/src/util/test_common_logging.c
index 934586926..2bf719782 100644
--- a/src/util/test_common_logging.c
+++ b/src/util/test_common_logging.c
@@ -24,7 +24,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
+#include "gnunet_util_lib.h"
static void
my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component,
diff --git a/src/util/test_common_logging_dummy.c b/src/util/test_common_logging_dummy.c
index 679dd9178..fcdf9cd27 100644
--- a/src/util/test_common_logging_dummy.c
+++ b/src/util/test_common_logging_dummy.c
@@ -28,9 +28,7 @@
#undef GNUNET_EXTRA_LOGGING
#define GNUNET_EXTRA_LOGGING GNUNET_YES
-#include "gnunet_common.h"
-#include "gnunet_time_lib.h"
-#include "gnunet_network_lib.h"
+#include "gnunet_util_lib.h"
/**
* Artificial delay attached to each log call that is not skipped out.
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index 8edf95194..c608d59c5 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -24,11 +24,7 @@
* @author LRN
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_network_lib.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#define VERBOSE GNUNET_NO
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 62ad5fa92..2d2806956 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -24,9 +24,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_disk_lib.h"
+#include "gnunet_util_lib.h"
/* Test Configuration Diffs Options */
diff --git a/src/util/test_connection.c b/src/util/test_connection.c
index 1ba20498f..124f3c9d3 100644
--- a/src/util/test_connection.c
+++ b/src/util/test_connection.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_connection_addressing.c b/src/util/test_connection_addressing.c
index eeb610dd1..ea6acdd53 100644
--- a/src/util/test_connection_addressing.c
+++ b/src/util/test_connection_addressing.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_connection_receive_cancel.c b/src/util/test_connection_receive_cancel.c
index 99905e232..e47712d3f 100644
--- a/src/util/test_connection_receive_cancel.c
+++ b/src/util/test_connection_receive_cancel.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_connection_timeout.c b/src/util/test_connection_timeout.c
index 6608e18db..27170ed41 100644
--- a/src/util/test_connection_timeout.c
+++ b/src/util/test_connection_timeout.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_connection_timeout_no_connect.c b/src/util/test_connection_timeout_no_connect.c
index 50eaf709a..cf1f8ecde 100644
--- a/src/util/test_connection_timeout_no_connect.c
+++ b/src/util/test_connection_timeout_no_connect.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c, doing timeout which connect failure
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 13425
diff --git a/src/util/test_connection_transmit_cancel.c b/src/util/test_connection_transmit_cancel.c
index 195ac689b..c5fa5cc32 100644
--- a/src/util/test_connection_transmit_cancel.c
+++ b/src/util/test_connection_transmit_cancel.c
@@ -22,10 +22,7 @@
* @brief tests for connection.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_container_bloomfilter.c b/src/util/test_container_bloomfilter.c
index f9743bdca..f568e2548 100644
--- a/src/util/test_container_bloomfilter.c
+++ b/src/util/test_container_bloomfilter.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#define K 4
#define SIZE 65536
diff --git a/src/util/test_container_heap.c b/src/util/test_container_heap.c
index a2a004aa7..7ae7f05af 100644
--- a/src/util/test_container_heap.c
+++ b/src/util/test_container_heap.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
static int
iterator_callback (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
diff --git a/src/util/test_container_meta_data.c b/src/util/test_container_meta_data.c
index fe1dd79c1..2da3bb251 100644
--- a/src/util/test_container_meta_data.c
+++ b/src/util/test_container_meta_data.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_meta_data_destroy(m); return 1; }
diff --git a/src/util/test_container_multihashmap.c b/src/util/test_container_multihashmap.c
index 6b079a109..a66ae6d82 100644
--- a/src/util/test_container_multihashmap.c
+++ b/src/util/test_container_multihashmap.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_multihashmap_destroy(m); return 1; }
#define CHECK(c) { if (! (c)) ABORT(); }
diff --git a/src/util/test_container_multihashmap32.c b/src/util/test_container_multihashmap32.c
index 7997c73ac..af21ecec9 100644
--- a/src/util/test_container_multihashmap32.c
+++ b/src/util/test_container_multihashmap32.c
@@ -26,8 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_multihashmap32_destroy(m); return 1; }
#define CHECK(c) { if (! (c)) ABORT(); }
diff --git a/src/util/test_container_multipeermap.c b/src/util/test_container_multipeermap.c
index aa67eb5e0..5eda0c8aa 100644
--- a/src/util/test_container_multipeermap.c
+++ b/src/util/test_container_multipeermap.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (NULL != m) GNUNET_CONTAINER_multipeermap_destroy(m); return 1; }
#define CHECK(c) { if (! (c)) ABORT(); }
diff --git a/src/util/test_container_slist.c b/src/util/test_container_slist.c
index 1b63d3dbc..8b4ff93d0 100644
--- a/src/util/test_container_slist.c
+++ b/src/util/test_container_slist.c
@@ -25,8 +25,7 @@
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_container_lib.h"
+#include "gnunet_util_lib.h"
int
main (int argc, char *argv[])
diff --git a/src/util/test_crypto_crc.c b/src/util/test_crypto_crc.c
index 99eca0cc0..3000fed34 100644
--- a/src/util/test_crypto_crc.c
+++ b/src/util/test_crypto_crc.c
@@ -27,8 +27,7 @@
* @brief testcase for crypto_crc.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
static int expected[] = {
-1223996378, 929797997, -1048047323, 1791081351, -425765913, 2138425902,
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c
index 9e10702ce..1a3f90957 100644
--- a/src/util/test_crypto_hash.c
+++ b/src/util/test_crypto_hash.c
@@ -24,9 +24,7 @@
* @brief Test for crypto_hash.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
static char block[65536];
diff --git a/src/util/test_crypto_random.c b/src/util/test_crypto_random.c
index 681947a60..11af6580a 100644
--- a/src/util/test_crypto_random.c
+++ b/src/util/test_crypto_random.c
@@ -24,8 +24,7 @@
* @brief testcase for crypto_random.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
static int
test (enum GNUNET_CRYPTO_Quality mode)
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c
index b350e9efe..90214a4b5 100644
--- a/src/util/test_crypto_symmetric.c
+++ b/src/util/test_crypto_symmetric.c
@@ -24,8 +24,7 @@
* @brief test for AES ciphers
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
+#include "gnunet_util_lib.h"
#define TESTSTRING "Hello World!"
#define INITVALUE "InitializationVectorValueinitializationvectorvalue"
diff --git a/src/util/test_disk.c b/src/util/test_disk.c
index 7fc8618ce..7579ac7dc 100644
--- a/src/util/test_disk.c
+++ b/src/util/test_disk.c
@@ -24,9 +24,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
#define TESTSTRING "Hello World\0"
diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c
index 313167d17..9e56bc843 100644
--- a/src/util/test_getopt.c
+++ b/src/util/test_getopt.c
@@ -22,9 +22,7 @@
* @brief testcase for util/getopt.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_getopt_lib.h"
+#include "gnunet_util_lib.h"
static int
diff --git a/src/util/test_mq_client.c b/src/util/test_mq_client.c
index 18cd8a948..4e460ebdb 100644
--- a/src/util/test_mq_client.c
+++ b/src/util/test_mq_client.c
@@ -23,7 +23,6 @@
* @brief tests for mq with connection client
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#define PORT 23336
diff --git a/src/util/test_os_network.c b/src/util/test_os_network.c
index 2cdd75040..b46ef8f1d 100644
--- a/src/util/test_os_network.c
+++ b/src/util/test_os_network.c
@@ -22,9 +22,7 @@
* @brief testcase for util/os_network.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
/**
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index 124b364fb..2b1d9070c 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -26,11 +26,7 @@
* correct data "HELLO" is read then all is well.
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
#include "disk.h"
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index fa4d31b8d..51f759867 100644
--- a/src/util/test_peer.c
+++ b/src/util/test_peer.c
@@ -24,8 +24,8 @@
*/
#include "platform.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_peer_lib.h"
+#include "gnunet_util_lib.h"
+#include <gcrypt.h>
#define NUMBER_OF_PEERS 10
@@ -42,8 +42,9 @@ generatePeerIdList ()
for (i = 0; i < NUMBER_OF_PEERS; i++)
{
- GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
- &pidArr[i].hashPubKey);
+ gcry_randomize (&pidArr[i],
+ sizeof (struct GNUNET_PeerIdentity),
+ GCRY_STRONG_RANDOM);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i]));
}
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c
index f2abfa77d..e819e678a 100644
--- a/src/util/test_plugin.c
+++ b/src/util/test_plugin.c
@@ -22,7 +22,7 @@
* @brief testcase for plugin.c
*/
#include "platform.h"
-#include "gnunet_plugin_lib.h"
+#include "gnunet_util_lib.h"
static void
diff --git a/src/util/test_program.c b/src/util/test_program.c
index faeb4e716..6f4a035ad 100644
--- a/src/util/test_program.c
+++ b/src/util/test_program.c
@@ -22,10 +22,7 @@
* @brief tests for program.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
static int setme1, setme2;
diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c
index 50354825a..70ff95550 100644
--- a/src/util/test_scheduler.c
+++ b/src/util/test_scheduler.c
@@ -22,10 +22,7 @@
* @brief tests for the scheduler
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
-#include "gnunet_disk_lib.h"
+#include "gnunet_util_lib.h"
struct GNUNET_DISK_PipeHandle *p;
diff --git a/src/util/test_server.c b/src/util/test_server.c
index 454fc6413..c39744f8a 100644
--- a/src/util/test_server.c
+++ b/src/util/test_server.c
@@ -22,11 +22,7 @@
* @brief tests for server.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_server_disconnect.c b/src/util/test_server_disconnect.c
index b54df4889..917784d8e 100644
--- a/src/util/test_server_disconnect.c
+++ b/src/util/test_server_disconnect.c
@@ -22,11 +22,7 @@
* @brief tests for server.c, specifically GNUNET_SERVER_client_disconnect
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_server_mst_interrupt.c b/src/util/test_server_mst_interrupt.c
index 8fd7a2b54..cfd891522 100644
--- a/src/util/test_server_mst_interrupt.c
+++ b/src/util/test_server_mst_interrupt.c
@@ -22,12 +22,8 @@
* @brief test for interrupt message processing in server_mst.c
*/
#include "platform.h"
-#include "gnunet_common.h"
#include "gnunet_protocols.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
static struct GNUNET_SERVER_MessageStreamTokenizer * mst;
diff --git a/src/util/test_server_with_client.c b/src/util/test_server_with_client.c
index c49456301..01971d96d 100644
--- a/src/util/test_server_with_client.c
+++ b/src/util/test_server_with_client.c
@@ -24,11 +24,7 @@
* client_get_address and receive_done (resume processing)
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 22335
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c
index 57a67d3f4..30e993411 100644
--- a/src/util/test_server_with_client_unix.c
+++ b/src/util/test_server_with_client_unix.c
@@ -24,11 +24,7 @@
* client_get_address and receive_done (resume processing)
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define MY_TYPE 128
diff --git a/src/util/test_service.c b/src/util/test_service.c
index bdd3d8521..eee0cecc1 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -23,13 +23,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_service_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define PORT 12435
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index e0c3cfebf..f6f872211 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -22,8 +22,7 @@
* @brief testcase for strings.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
#define WANT(a,b) if (0 != strcmp(a,b)) { fprintf(stderr, "Got `%s', wanted `%s'\n", b, a); GNUNET_free(b); GNUNET_break(0); return 1;} else { GNUNET_free (b); }
diff --git a/src/util/test_strings_to_data.c b/src/util/test_strings_to_data.c
index 2ac680b83..125101e55 100644
--- a/src/util/test_strings_to_data.c
+++ b/src/util/test_strings_to_data.c
@@ -22,9 +22,7 @@
* @brief testcase for strings.c
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
int
diff --git a/src/util/time.c b/src/util/time.c
index fea0947bd..6b1b43062 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -24,7 +24,7 @@
* @brief functions for handling time and time arithmetic
*/
#include "platform.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)