("Control services and the Automated Restart Manager (ARM)"),
options, &run, NULL))
{
+ GNUNET_free ((void *) argv);
return ret;
}
-
+ GNUNET_free ((void*) argv);
return 1;
}
DEFAULTSERVICES =
BINARY = gnunet-service-arm
OPTIONS = -L ERROR
-# DEBUG = YES
#PREFIX = valgrind --tool=memcheck --leak-check=yes
[resolver]
-# DEBUG = YES
PORT = 23355
# PREFIX = valgrind
[do-nothing]
-#DEBUG = YES
AUTOSTART = NO
PORT = 2223
HOSTNAME = localhost
[statistics]
AUTOSTART = YES
-# DEBUG = NO
[dns]
#include "gnunet_program_lib.h"
#include "gnunet_protocols.h"
-#define VERBOSE GNUNET_NO
-
#define START_ARM GNUNET_YES
#define LOG_BACKOFF GNUNET_NO
if (msg == NULL)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n");
-#endif
if (shutdown_ctx->cont != NULL)
shutdown_ctx->cont (shutdown_ctx->cont_cls, GNUNET_NO);
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN:
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received confirmation for service shutdown.\n");
-#endif
shutdown_ctx->confirmed = GNUNET_YES;
GNUNET_CLIENT_receive (shutdown_ctx->sock,
&service_shutdown_handler, shutdown_ctx,
char *const argv[] = {
"test-exponential-backoff",
"-c", "test_arm_api_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-exponential-backoff",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
init ();
#include "gnunet-service-ats_addresses_mlp.h"
#endif
-#define VERBOSE GNUNET_NO
-
#define ATS_BLOCKING_DELTA GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100)
enum ATS_Mode
return old;
}
+
+#if DEADCODE
static int
compare_address_session_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
* @param addr existing address record
* @return existing address record, NULL for none
*/
-struct ATS_Address *
+static struct ATS_Address *
find_exact_address (const struct GNUNET_PeerIdentity *peer,
const struct ATS_Address *addr)
{
&compare_address_session_it, &cac);
return cac.exact_address;
}
+#endif
void
if (aa->session_id != 0)
GNUNET_break (0 == strcmp (info->plugin, aa->plugin));
/* session died */
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deleting session for peer `%s': `%s' %u\n",
GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
-#endif
aa->session_id = 0;
if (GNUNET_YES == aa->active)
/* session == 0 and addrlen == 0 : destroy address */
if (aa->addr_len == 0)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deleting session and address for peer `%s': `%s' %u\n",
GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
-#endif
(void) destroy_address (aa);
}
else
return GNUNET_OK;
}
+
void
GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, const void *plugin_addr,
}
-void request_address_mlp (const struct GNUNET_PeerIdentity *peer)
+static void
+request_address_mlp (const struct GNUNET_PeerIdentity *peer)
{
struct ATS_Address *aa;
aa = NULL;
}
-void request_address_simple (const struct GNUNET_PeerIdentity *peer)
+
+static void
+request_address_simple (const struct GNUNET_PeerIdentity *peer)
{
struct ATS_Address *aa;
aa = NULL;
return GNUNET_OK;
}
+
void
GAS_addresses_handle_backoff_reset (const struct GNUNET_PeerIdentity *peer)
{
void *it_cls;
};
-int peerinfo_it (void *cls,
- const struct GNUNET_HashCode * key,
- void *value)
+
+static int
+peerinfo_it (void *cls,
+ const struct GNUNET_HashCode * key,
+ void *value)
{
struct PeerInfoIteratorContext *pi_ctx = cls;
struct ATS_Address *addr = (struct ATS_Address *) value;
return GNUNET_YES;
}
+
/**
* Return all peers currently known to ATS
*
GNUNET_PROGRAM_run (argc, argv,
"perf_ats_mlp", "nohelp", options,
&check, NULL);
-
-
+ GNUNET_free ((void *) argv);
return ret;
}
UNIXPATH = /tmp/test-ats-scheduling-arm.sock
[ats]
-#DEBUG = YES
#PREFIX = valgrind --leak-check=full
AUTOSTART = YES
PORT = 12002
#include "gnunet_ats_service.h"
#include "gnunet_transport_service.h"
-#define START_ARM GNUNET_YES
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
#include "gnunet_arm_service.h"
#include "gnunet_chat_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on passing the test?
*/
struct PeerContext
{
struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
struct Wanted
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
GNUNET_free (binary);
}
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
static void
timeout_kill (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Timed out, stopping the test.\n");
-#endif
+ fprintf (stderr,
+ "Timed out, stopping the test.\n");
kill_task = GNUNET_SCHEDULER_NO_TASK;
if (wait_task != GNUNET_SCHEDULER_NO_TASK)
{
{
struct Wanted *want = cls;
-#if VERBOSE
- printf ("%s has joined\n", want->me);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%s has joined\n", want->me);
if (NULL != want->next_task)
GNUNET_SCHEDULER_add_now (want->next_task, want->next_task_cls);
return GNUNET_OK;
struct Wanted *want = cls;
struct GNUNET_HashCode sender;
-#if VERBOSE
- printf ("%s - told that %s has %s\n", want->me,
- member_info ==
- NULL ? NULL : GNUNET_CONTAINER_meta_data_get_by_type (member_info,
- EXTRACTOR_METATYPE_TITLE),
- member_info == NULL ? "left" : "joined");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%s - told that %s has %s\n", want->me,
+ member_info ==
+ NULL ? NULL : GNUNET_CONTAINER_meta_data_get_by_type (member_info,
+ EXTRACTOR_METATYPE_TITLE),
+ member_info == NULL ? "left" : "joined");
GNUNET_CRYPTO_hash (member_id,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
{
struct Wanted *want = cls;
-#if VERBOSE
- printf ("%s - told that %s said %s\n", want->me,
- meta == NULL ? NULL : GNUNET_CONTAINER_meta_data_get_by_type (meta,
- EXTRACTOR_METATYPE_TITLE),
- message);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+
+ "%s - told that %s said %s\n", want->me,
+ meta == NULL ? NULL : GNUNET_CONTAINER_meta_data_get_by_type (meta,
+ EXTRACTOR_METATYPE_TITLE),
+ message);
if ((0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
{
struct Wanted *want = cls;
-#if VERBOSE
- printf ("%s - told that %s acknowledged message #%d\n", want->me,
- GNUNET_CONTAINER_meta_data_get_by_type (want->meta,
- EXTRACTOR_METATYPE_TITLE),
- orig_seq_number);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%s - told that %s acknowledged message #%d\n", want->me,
+ GNUNET_CONTAINER_meta_data_get_by_type (want->meta,
+ EXTRACTOR_METATYPE_TITLE),
+ orig_seq_number);
if ((0 == memcmp (receiver, want->sender, sizeof (struct GNUNET_HashCode))) &&
(orig_seq_number == want->sequence_number) &&
(timestamp.abs_value >= want->timestamp.abs_value))
{
GNUNET_SCHEDULER_Task task = cls;
-#if VERBOSE
- printf ("Waiting...\n");
-#endif
if (is_ready)
{
wait_task = GNUNET_SCHEDULER_NO_TASK;
static void
disconnect_alice (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Alice is leaving.\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Alice is leaving.\n");
if (is_p2p)
stop_arm (&p2);
GNUNET_CHAT_leave_room (alice_room);
static void
disconnect_bob (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Bod is leaving.\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Bob is leaving.\n");
alice_wanted.meta = NULL;
alice_wanted.sender = &bob;
alice_wanted.msg = NULL;
static void
send_to_alice (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Bob says 'Hi!'\n");
-#endif
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Bob says 'Hi!'\n");
alice_wanted.meta = bob_meta;
alice_wanted.sender = &bob;
alice_wanted.msg = "Hi Alice!";
enum GNUNET_CHAT_MsgOptions options;
uint32_t *seq = NULL;
-#if VERBOSE
- printf ("Alice says 'Hi!'\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Alice says 'Hi!'\n");
if (is_ackn)
{
options = GNUNET_CHAT_MSG_ACKNOWLEDGED;
static void
join_bob_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Bob joining\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Bob joining\n");
alice_wanted.meta = bob_meta;
alice_wanted.sender = &bob;
alice_wanted.msg = NULL;
static void
join_alice_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- printf ("Alice joining\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Alice joining\n");
alice_wanted.next_task = &join_bob_task;
alice_wanted.next_task_cls = NULL;
alice_room =
"test-chat",
"-c",
"test_chat_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
};
GNUNET_log_setup ("test_chat",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
if (strstr (argv[0], "p2p") != NULL)
{
#define VERBOSE GNUNET_NO
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on passing the test?
*/
struct PeerContext
{
struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
struct Wanted
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
GNUNET_free (binary);
}
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
-# DEBUG = YES
# USERNAME =
# MAXBUF =
# TIMEOUT =
#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
#define MTYPE 12345
struct PeerContext
struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
struct GNUNET_MessageHeader *hello;
int connect_status;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static struct PeerContext p1;
static int ok;
-#if VERBOSE
#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
-#else
-#define OKPP do { ok++; } while (0)
-#endif
static void
static void
terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
- FPRINTF (stderr, "ENDING ANGRILY %u\n", ok);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ENDING ANGRILY %u\n", ok);
GNUNET_break (0);
if (NULL != p1.ch)
{
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
NULL, NULL,
binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
+
static int
check ()
{
char *const argv[] = { "test-core-api",
"-c",
"test_core_api_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-core-api",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
#include "gnunet_transport_service.h"
#include <gauger.h>
-#define START_ARM GNUNET_YES
-
/**
* Note that this value must not significantly exceed
* 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
struct GNUNET_MessageHeader *hello;
struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
int connect_status;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static struct PeerContext p1;
GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
GNUNET_CORE_disconnect (p1.ch);
p1.ch = NULL;
+ GNUNET_free_non_null (p1.hello);
GNUNET_CORE_disconnect (p2.ch);
p2.ch = NULL;
+ GNUNET_free_non_null (p2.hello);
if (connect_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (connect_task);
GNUNET_TRANSPORT_disconnect (p1.th);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received (my) `%s' from transport service\n", "HELLO");
GNUNET_assert (message != NULL);
- p->hello = GNUNET_malloc (ntohs (message->size));
- memcpy (p->hello, message, ntohs (message->size));
+ p->hello = GNUNET_copy_message (message);
if ((p == &p1) && (p2.th != NULL))
GNUNET_TRANSPORT_offer_hello (p2.th, message, NULL, NULL);
if ((p == &p2) && (p1.th != NULL))
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
[core]
PORT = 12490
UNIXPATH = /tmp/gnunet-core-asym-recv-p1-service-core.sock
-DEBUG = NO
[core]
PORT = 22490
UNIXPATH = /tmp/gnunet-core-asym-recv-p2-service-core.sock
-DEBUG = NO
[ats]
PORT = 22491
[core]
PORT = 12490
UNIXPATH = /tmp/gnunet-core-asym-send-p1-service-core.sock
-DEBUG = NO
[core]
PORT = 22490
UNIXPATH = /tmp/gnunet-core-asym-send-p2-service-core.sock
-DEBUG = NO
[ats]
PORT = 22491
#define ASYMMETRIC_SEND_LIMITED 1
#define ASYMMETRIC_RECV_LIMITED 2
-#define START_ARM GNUNET_YES
-
/**
* Note that this value must not significantly exceed
* 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
struct GNUNET_STATISTICS_Handle *stats;
struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
int connect_status;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static struct PeerContext p1;
p1.th = NULL;
GNUNET_TRANSPORT_disconnect (p2.th);
p2.th = NULL;
+ GNUNET_free_non_null (p1.hello);
+ GNUNET_free_non_null (p2.hello);
}
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
GNUNET_assert (p->stats != NULL);
static void
stop_arm (struct PeerContext *p)
{
-#if START_ARM
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
[core]
PORT = 12480
UNIXPATH = /tmp/gnunet-core-sym-p1-service-core.sock
-DEBUG = NO
[ats]
PORT = 12481
[core]
PORT = 22480
UNIXPATH = /tmp/gnunet-core-sym-p2-service-core.sock
-DEBUG = NO
[ats]
PORT = 22482
if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
{
FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
+ GNUNET_free (libname);
+ GNUNET_free (name);
return NULL;
}
GNUNET_free (libname);
UNIX_MATCH_UID = YES
UNIX_MATCH_GID = YES
# DISABLE_SOCKET_FORWARDING = NO
-# DEBUG = YES
# USERNAME =
# MAXBUF =
# TIMEOUT =
PORT = 2092
[dht]
-DEBUG = NO
PORT = 12370
[block]
[transport]
plugins = tcp
-DEBUG = NO
NEIGHBOUR_LIMIT = 50
PORT = 2091
AUTOSTART = NO
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
-
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor",
- gettext_noop
- ("Monitor DNS queries."), options,
- &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor",
+ gettext_noop
+ ("Monitor DNS queries."), options,
+ &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
- gettext_noop
- ("Change DNS replies to point elsewhere."), options,
- &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
+ gettext_noop
+ ("Change DNS replies to point elsewhere."), options,
+ &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
[dv]
AUTOSTART = YES
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
BINARY = gnunet-service-dv
#include "gnunet_testing_lib.h"
#include "gnunet_core_service.h"
-#define VERBOSE 1
-
#define TEST_ALL GNUNET_NO
/**
{
if (emsg != NULL)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
-#endif
if (ok == 0)
ok = 666;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers successfully shut down!\n");
-#endif
}
}
struct TestMessageContext *free_pos;
die_task = GNUNET_SCHEDULER_NO_TASK;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Called finish testing, stopping daemons.\n");
-#endif
peer_pos = all_peers;
while (peer_pos != NULL)
{
}
GNUNET_free (free_pos);
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n",
transmit_ready_scheduled, transmit_ready_failed,
transmit_ready_called);
-#endif
-
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling daemons_stop\n");
-#endif
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "daemons_stop finished\n");
-#endif
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
struct TestMessageContext *pos = cls;
/* Disconnect from the respective cores */
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 1 `%4s'\n",
GNUNET_i2s (&pos->peer1->id));
-#endif
if (pos->peer1handle != NULL)
GNUNET_CORE_disconnect (pos->peer1handle);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from peer 2 `%4s'\n",
GNUNET_i2s (&pos->peer2->id));
-#endif
if (pos->peer2handle != NULL)
GNUNET_CORE_disconnect (pos->peer2handle);
/* Set handles to NULL so test case can be ended properly */
{
struct TestMessageContext *pos = cls;
struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *) message;
-
-#if VERBOSE
uint32_t distance;
-#endif
+
if (pos->uid != ntohl (msg->uid))
return GNUNET_OK;
-
-#if VERBOSE
distance = get_atsi_distance (atsi, atsi_count);
-#endif
GNUNET_assert (0 ==
memcmp (peer, &pos->peer1->id,
sizeof (struct GNUNET_PeerIdentity)));
if (total_other_expected_messages == 0)
{
total_messages_received++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received message from `%4s', type %d, uid %u, distance %u.\n",
GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid),
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Total messages received %d, expected %d.\n",
total_messages_received, expected_messages);
-#endif
}
else
{
total_other_messages++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received message from `%4s', type %d, uid %u, distance %u.\n",
GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid),
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Total OTHER messages received %d, expected %d.\n",
total_other_messages, total_other_expected_messages);
-#endif
}
if ((total_messages_received == expected_messages) &&
(total_other_messages == 0))
{
GNUNET_SCHEDULER_cancel (die_task);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Scheduling timeout from DV connections.\n");
-#endif
die_task =
GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly,
"waiting for DV peers to connect!");
m->header.size = htons (sizeof (struct GNUNET_TestMessage));
m->uid = htonl (pos->uid);
transmit_ready_called++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"transmit ready for peer %s\ntransmit_ready's scheduled %d, transmit_ready's called %d\n",
GNUNET_i2s (&pos->peer1->id), transmit_ready_scheduled,
transmit_ready_called);
-#endif
return sizeof (struct GNUNET_TestMessage);
}
if (0 == memcmp (&pos->peer1->id, peer, sizeof (struct GNUNET_PeerIdentity)))
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core connection from `%s' to `%4s' verfied, sending message!\n",
GNUNET_i2s (&pos->peer2->id), GNUNET_h2s (&peer->hashPubKey));
-#endif
if (NULL ==
GNUNET_CORE_notify_transmit_ready (pos->peer1handle, GNUNET_YES, 0,
TIMEOUT, &pos->peer2->id,
init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server,
const struct GNUNET_PeerIdentity *my_identity)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core connection to `%4s' established, awaiting connections.\n",
GNUNET_i2s (my_identity));
-#endif
total_server_connections++;
}
if (0 == memcmp (&pos->peer2->id, peer, sizeof (struct GNUNET_PeerIdentity)))
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core connection from `%s' to `%4s' verified.\n",
GNUNET_i2s (&pos->peer1->id), GNUNET_h2s (&peer->hashPubKey));
-#endif
/*
* Connect to the receiving peer
*/
const struct GNUNET_PeerIdentity *my_identity)
{
total_server_connections++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core connection to `%4s' established, awaiting connections...\n",
GNUNET_i2s (my_identity));
-#endif
}
&send_test_messages, pos);
return; /* Otherwise we'll double schedule messages here! */
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Attempting to send test message from %s to %s\n",
pos->peer1->shortname, pos->peer2->shortname);
-#endif
/*
* Connect to the sending peer
*/
GNUNET_SCHEDULER_add_now (&end_badly,
"send_other_messages had 0 messages to send, no DV connections made!");
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Preparing to send %d other test messages\n",
total_other_expected_messages);
-#endif
-
GNUNET_SCHEDULER_add_now (&send_test_messages, other_test_messages);
if (GNUNET_SCHEDULER_NO_TASK != die_task)
GNUNET_SCHEDULER_cancel (die_task);
if (emsg == NULL)
{
total_connections++;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connected peer %s to peer %s, distance %u\n",
first_daemon->shortname, second_daemon->shortname, distance);
-#endif
temp_context = GNUNET_malloc (sizeof (struct TestMessageContext));
temp_context->peer1 = first_daemon;
temp_context->peer2 = second_daemon;
test_messages = temp_context;
expected_messages++;
}
-#if VERBOSE
else
{
failed_connections++;
"Failed to connect peer %s to peer %s with error :\n%s\n",
first_daemon->shortname, second_daemon->shortname, emsg);
}
-#endif
if (total_connections == expected_connections)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created %u total connections, which is our target number! Calling send messages.\n",
total_connections);
-#endif
if (GNUNET_SCHEDULER_NO_TASK != die_task)
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_NO_TASK;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Have %d total connections, %d failed connections, Want %d (at least %d)\n",
total_connections, failed_connections, expected_connections,
expected_connections -
(unsigned int) (fail_percentage * expected_connections));
-#endif
}
}
second_shortname = GNUNET_strdup (GNUNET_i2s (peer));
distance = get_atsi_distance (atsi, atsi_count);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connected peer %s to peer %s, distance %u\n", d->shortname,
second_shortname, distance);
-#endif
-
second_daemon =
GNUNET_CONTAINER_multihashmap_get (peer_daemon_hash, &peer->hashPubKey);
return;
}
GNUNET_assert (id != NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
(num_peers - peers_left) + 1, num_peers);
-#endif
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multihashmap_put (peer_daemon_hash,
&id->hashPubKey, d,
if (peers_left == 0)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now creating topology!\n", num_peers);
-#endif
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_NO_TASK;
expected_connections = -1;
connect_topology_option,
connect_topology_option_modifier,
TIMEOUT, 12, NULL, NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have %d expected connections\n",
expected_connections);
-#endif
}
if (expected_connections == GNUNET_SYSERR)
"Hostkey callback received error: %s\n", emsg);
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostkey created for peer `%s'\n",
GNUNET_i2s (id));
-#endif
peers_left--;
if (peers_left == 0)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d hostkeys created, now creating topology!\n", num_peers);
-#endif
if (GNUNET_SCHEDULER_NO_TASK != die_task)
{
GNUNET_SCHEDULER_cancel (die_task);
(pg, topology, blacklist_topology,
blacklist_transports) != GNUNET_SYSERR)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Topology set up, now starting peers!\n");
-#endif
GNUNET_TESTING_daemons_continue_startup (pg);
/* Set up task in case topology creation doesn't finish
* within a reasonable amount of time */
FPRINTF (dotOutFile, "%s", "strict graph G {\n");
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting daemons based on config file %s\n", cfgfile);
-#endif
-
if (GNUNET_YES !=
GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
&test_directory))
char *const argv[] = { "test-transport-dv",
"-c",
"test_transport_dv_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
int ret;
GNUNET_log_setup ("test-transport-dv",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
/**
PORT = 2564
[transport]
-DEBUG = YES
PORT = 2565
PLUGINS = tcp dv
BLACKLIST_FILE = $SERVICEHOME/blacklist
[dv]
AUTOSTART = YES
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
BINARY = gnunet-service-dv
[testing]
NUM_PEERS = 3
ADDITIONAL_MESSAGES = 10
-DEBUG = NO
WEAKRANDOM = YES
TOPOLOGY = CLIQUE
CONNECT_TOPOLOGY = LINE
#include "platform.h"
#include "gnunet_fragmentation_lib.h"
-#define VERBOSE GNUNET_NO
-
#define DETAILS GNUNET_NO
/**
"-c",
"test_fragmentation_data.conf",
"-L",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL
};
unsigned int i;
GNUNET_log_setup ("test-fragmentation",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
for (i = 0; i < NUM_MSGS; i++)
GNUNET_BANDWIDTH_tracker_init (&trackers[i],
# Do we require users that want to access file-sharing to be in the 'gnunet' group?
UNIX_MATCH_GID = YES
-# DEBUG = YES
# Maximum number of requests this peer tracks (important for
# memory consumption; 2k RAM/request is not unusual)
sigpipe = NULL;
GNUNET_free (cfg_filename);
cfg_filename = NULL;
+ GNUNET_free ((void*) argv);
return ok;
}
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-directory [OPTIONS] FILENAME",
- gettext_noop
- ("Display contents of a GNUnet directory"),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-directory [OPTIONS] FILENAME",
+ gettext_noop
+ ("Display contents of a GNUnet directory"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-directory.c */
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-download [OPTIONS] URI",
- gettext_noop
- ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-download [OPTIONS] URI",
+ gettext_noop
+ ("Download files from GNUnet using a GNUnet CHK or LOC URI (gnunet://fs/chk/...)"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-download.c */
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
-
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]",
- gettext_noop ("Special file-sharing operations"),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]",
+ gettext_noop ("Special file-sharing operations"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-fs.c */
/* this is the expensive operation, *afterwards* we'll check for aborts */
meta = GNUNET_CONTAINER_meta_data_create ();
- if (NULL != plugins)
- EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
+ EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
slen = strlen (item->filename) + 1;
size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
if (-1 == size)
FPRINTF (stderr,
"%s",
"gnunet-helper-fs-publish needs exactly one or two arguments\n");
+ GNUNET_free ((void*) argv);
return 1;
}
filename_expanded = argv[1];
&root))
{
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
+ EXTRACTOR_plugin_remove_all (plugins);
+ GNUNET_free ((void*) argv);
return 2;
}
/* signal that we're done counting files, so that a percentage of
progress can now be calculated */
if (GNUNET_OK !=
write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0))
+ {
+ EXTRACTOR_plugin_remove_all (plugins);
+ GNUNET_free ((void*) argv);
return 3;
+ }
if (NULL != root)
{
if (GNUNET_OK !=
{
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
free_tree (root);
+ EXTRACTOR_plugin_remove_all (plugins);
+ GNUNET_free ((void*) argv);
return 4;
}
free_tree (root);
}
/* enable "clean" shutdown by telling parent that we are done */
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0);
- if (NULL != plugins)
- EXTRACTOR_plugin_remove_all (plugins);
-
+ EXTRACTOR_plugin_remove_all (plugins);
+ GNUNET_free ((void*) argv);
return 0;
}
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-pseudonym [OPTIONS]",
- gettext_noop ("Manage GNUnet pseudonyms."),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-pseudonym [OPTIONS]",
+ gettext_noop ("Manage GNUnet pseudonyms."),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-pseudonym.c */
0, &GNUNET_GETOPT_set_one, &verbose},
GNUNET_GETOPT_OPTION_END
};
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "GNUnet publish starts\n");
bo.expiration_time =
GNUNET_FS_year_to_time (GNUNET_FS_get_current_year () + 2);
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
-
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-publish [OPTIONS] FILENAME",
- gettext_noop
- ("Publish a file or directory on GNUnet"),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-publish [OPTIONS] FILENAME",
+ gettext_noop
+ ("Publish a file or directory on GNUnet"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-publish.c */
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-search [OPTIONS] KEYWORD",
- gettext_noop
- ("Search GNUnet for files that were published on GNUnet"),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-search [OPTIONS] KEYWORD",
+ gettext_noop
+ ("Search GNUnet for files that were published on GNUnet"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-search.c */
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-unindex [OPTIONS] FILENAME",
- gettext_noop
- ("Unindex a file that was previously indexed with gnunet-publish."),
- options, &run, NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-unindex [OPTIONS] FILENAME",
+ gettext_noop
+ ("Unindex a file that was previously indexed with gnunet-publish."),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-unindex.c */
_("GNUnet DNS-to-GNS proxy (a DNS server)"),
options,
&run, NULL)) ? 0 : 1;
-
+ GNUNET_free ((void*) argv);
return ret;
}
_("GNUnet GNS first come first serve registration service"),
options,
&run, NULL)) ? 0 : 1;
-
+ GNUNET_free ((void*) argv);
return ret;
}
_("GNUnet GNS access tool"),
options,
&run, NULL)) ? 0 : 1;
-
+ GNUNET_free ((void*) argv);
return ret;
}
[dht]
UNIXPATH = /tmp/gnunet-service-dht.sock
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core dht namestore gns
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
// to convert structures returned as BLOBs.
//
-VOID FixList(PCHAR ** List, PCHAR Base)
+VOID
+FixList(PCHAR ** List, PCHAR Base)
{
if(*List)
{
// Routine to convert a hostent returned in a BLOB to one with
// usable pointers. The structure is converted in-place.
//
-VOID UnpackHostEnt(struct hostent * hostent)
+VOID
+UnpackHostEnt(struct hostent * hostent)
{
PCHAR pch;
FixList(&hostent->h_addr_list, pch);
}
-void
+
+static void
print_hostent (struct hostent *he)
{
int i;
char **pAlias;
+
printf("\tOfficial name: %s\n", he->h_name);
- for (pAlias = he->h_aliases; *pAlias != 0; pAlias++) {
+ for (i=0, pAlias = he->h_aliases; *pAlias != 0; pAlias++) {
printf("\tAlternate name #%d: %s\n", ++i, *pAlias);
}
printf("\tAddress type: ");
}
}
+
int
main (int argc, char **argv)
{
#include "platform.h"
#include "gnunet_hello_lib.h"
-#define DEBUG GNUNET_EXTRA_LOGGING
-
-#define VERBOSE GNUNET_NO
-
/**
* Closure for 'add_to_buf'.
*/
#include "platform.h"
#include "gnunet_hello_lib.h"
-#define DEBUG GNUNET_NO
-
-#define VERBOSE GNUNET_NO
-
-
static size_t
my_addr_gen (void *cls, size_t max, void *buf)
{
size_t ret;
struct GNUNET_HELLO_Address address;
-#if DEBUG
- FPRINTF (stderr, "DEBUG: my_addr_gen called with i = %d\n", *i);
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "DEBUG: my_addr_gen called with i = %d\n", *i);
if (0 == *i)
return 0;
memset (&address.peer, 0, sizeof (struct GNUNET_PeerIdentity));
{
unsigned int *i = cls;
-#if DEBUG
- FPRINTF (stderr, "DEBUG: check_addr called with i = %d and addrlen = %u\n",
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "DEBUG: check_addr called with i = %d and addrlen = %u\n",
*i, (unsigned int) address->address_length);
-#endif
GNUNET_assert (address->address_length > 0);
GNUNET_assert (*i & (1 << (address->address_length - 1)));
*i -= (1 << (address->address_length - 1));
{
unsigned int *i = cls;
-#if DEBUG
- FPRINTF (stderr, "DEBUG: remove_some called with i = %d and addrlen = %u\n",
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "DEBUG: remove_some called with i = %d and addrlen = %u\n",
*i, (unsigned int) address->address_length);
-#endif
GNUNET_assert (address->address_length > 0);
if (*i & (1 << (address->address_length - 1)))
{
GNUNET_log_setup ("test-hello", "DEBUG", NULL);
startup_time = GNUNET_TIME_absolute_get ();
memset (&publicKey, 42, sizeof (publicKey));
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing HELLO creation (without addresses)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing HELLO creation (without addresses)...\n");
i = 0;
msg1 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
GNUNET_assert (msg1 != NULL);
GNUNET_assert (0 < GNUNET_HELLO_size (msg1));
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing address iteration (empty set)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing address iteration (empty set)...\n");
GNUNET_assert (NULL ==
GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr,
&i));
-
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing HELLO creation (with one address)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing HELLO creation (with one address)...\n");
i = 1;
msg2 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
GNUNET_assert (msg2 != NULL);
GNUNET_assert (GNUNET_HELLO_size (msg1) < GNUNET_HELLO_size (msg2));
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing address iteration (one address)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing address iteration (one address)...\n");
i = 1;
GNUNET_assert (NULL ==
GNUNET_HELLO_iterate_addresses (msg2, GNUNET_NO, &check_addr,
&i));
GNUNET_assert (i == 0);
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing get_key from HELLO...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing get_key from HELLO...\n");
GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_key (msg2, &pk));
GNUNET_assert (0 == memcmp (&publicKey, &pk, sizeof (pk)));
GNUNET_free (msg1);
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing HELLO creation (with two addresses)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing HELLO creation (with two addresses)...\n");
i = 2;
msg3 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
GNUNET_assert (msg3 != NULL);
GNUNET_assert (GNUNET_HELLO_size (msg2) < GNUNET_HELLO_size (msg3));
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing address iteration (two addresses)...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing address iteration (two addresses)...\n");
i = 3;
GNUNET_assert (NULL ==
GNUNET_HELLO_iterate_addresses (msg3, GNUNET_NO, &check_addr,
&i));
GNUNET_assert (i == 0);
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing HELLO merge...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing HELLO merge...\n");
msg1 = GNUNET_HELLO_merge (msg2, msg3);
GNUNET_assert (GNUNET_HELLO_size (msg1) == GNUNET_HELLO_size (msg3));
GNUNET_assert (i == 0);
GNUNET_free (msg1);
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing address iteration to copy HELLO...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing address iteration to copy HELLO...\n");
i = 2;
msg1 = GNUNET_HELLO_iterate_addresses (msg3, GNUNET_YES, &remove_some, &i);
GNUNET_assert (msg1 != NULL);
GNUNET_assert (i == 0);
GNUNET_free (msg1);
-#if VERBOSE
- FPRINTF (stderr, "%s", "Testing delta address iteration...\n");
-#endif
+ GNUNTE_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Testing delta address iteration...\n");
i = 2;
GNUNET_HELLO_iterate_new_addresses (msg3, msg2, startup_time, &check_addr,
&i);
GNUNET_PROGRAM_run (argc, argv, "hostlist",
_("GNUnet hostlist server and client"), options,
&run, NULL)) ? 0 : 1;
-
+ GNUNET_free ((void*) argv);
return ret;
}
[transport]
PORT = 12965
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-DEBUG = NO
[core]
PORT = 12970
#include "gnunet_arm_service.h"
#include "gnunet_transport_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
-
/**
* How long until we give up on transmitting the message?
*/
struct GNUNET_TRANSPORT_Handle *th;
struct GNUNET_MessageHeader *hello;
struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static struct PeerContext p1;
{
if (peer == NULL)
return;
-#if VERBOSE
- FPRINTF (stderr, "Peer %s connected\n", GNUNET_i2s (peer));
-#endif
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n");
ok = 0;
if (timeout_task != GNUNET_SCHEDULER_NO_TASK)
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th =
GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL);
{
struct PeerContext *p = cls;
-#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n");
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
{
char *const argv[] = { "test-gnunet-daemon-hostlist",
"-c", "test_gnunet_daemon_hostlist_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-3");
GNUNET_log_setup ("test-gnunet-daemon-hostlist",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
ret = check ();
if (ret == 0)
AUTOSTART = NO
[nat]
-RETURN_LOCAL_ADDRESSES = YES
\ No newline at end of file
+RETURN_LOCAL_ADDRESSES = YES
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
* @file include/platform.h
- * @brief plaform specifics
- *
+ * @brief plaform specific includes and defines
* @author Nils Durner
- *
+ * @author Christian Grothoff
* This file should never be included by installed
- * header files (thos starting with "gnunet_").
+ * header files (those starting with "gnunet_").
*/
-
#ifndef PLATFORM_H
#define PLATFORM_H
#ifdef SOMEBSD
#include <net/if.h>
#endif
-#ifdef GNUNET_freeBSD
+#ifdef FREEBSD
#include <semaphore.h>
#endif
#ifdef DARWIN
ATS_EXEC_INTERVAL = 30000
[transport]
-#DEBUG = YES
#PREFIX = valgrind --alloc-fn=GNUNET_xmalloc_ --alloc-fn=GNUNET_xmalloc_unchecked_ --alloc-fn=GNUNET_xrealloc_ --alloc-fn=GNUNET_xgrow_ --massif-out-file=massif_client.out --tool=massif
AUTOSTART = YES
PORT = 20029
[transport]
PREFIX = valgrind --leak-check=full
-#DEBUG = YES
AUTOSTART = YES
PORT = 20029
HOSTNAME = localhost
[transport]
PREFIX = valgrind --leak-check=full
-#DEBUG = YES
AUTOSTART = YES
PORT = 20029
HOSTNAME = localhost
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
-
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "cn",
- gettext_noop ("help text"), options, &run,
- NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "cn",
+ gettext_noop ("help text"), options, &run,
+ NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of connection_watchdog.c */
[lockmanager]
-DEBUG = YES
AUTOSTART = NO
PORT = 12112
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core lockmanager
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
GNUNET_PROGRAM_run (argc, argv, "gnunet-regex-profiler [OPTIONS] hosts-file policy-dir search-strings-file",
_("Profiler for regex/mesh"),
options, &run, NULL);
+ GNUNET_free ((void*) argv);
if (GNUNET_OK != ret)
return ret;
if (GNUNET_OK != result)
[arm]
DEFAULTSERVICES = core mesh dht statistics
PORT = 12003
-DEBUG = NO
[fs]
AUTOSTART = NO
[transport]
AUTOSTART = YES
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM = 127.0.0.1; 192.168.1.0/24;
ACCEPT_FROM6 = ::1;
NEIGHBOUR_LIMIT = 50
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
AUTOSTART = NO
[mesh]
-DEBUG = YES
AUTOSTART = YES
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
PORT = 10012
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
#include "platform.h"
#include "gnunet_testing_lib.h"
-#define VERBOSE GNUNET_YES
#define REMOVE_DIR GNUNET_YES
/**
"test: Shutdown of peers failed! (%s)\n", emsg);
ok--;
}
-#if VERBOSE
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: All peers successfully shut down!\n");
}
-#endif
GNUNET_CONFIGURATION_destroy (testing_cfg);
}
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
-#endif
-
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
}
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "************************************************************\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
+ "test: Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
peers_running = GNUNET_TESTING_daemons_running (pg);
if (0 < failed_connections)
{
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_mesh_2dtorus",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
- GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
- "use_progressbars", "YES");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
"num_peers", &num_peers))
argv[0],
"-c",
"test_mesh_2dtorus.conf",
-#if VERBOSE
- "-L",
- "DEBUG",
-#endif
NULL
};
[arm]
PORT = 10010
DEFAULTSERVICES = core dht mesh
-#DEBUG = YES
[statistics]
AUTOSTART = YES
PORT = 10000
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[mesh]
PORT = 10005
-DEBUG=YES
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
# PREFIX = valgrind --leak-check=full
F2F = NO
CONNECT_TIMEOUT = 600 s
CONNECT_ATTEMPTS = 2
-DEBUG = YES
HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
AUTOSTART = NO
[mesh]
-DEBUG = YES
AUTOSTART = YES
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
# PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
#include "gnunet_testing_lib.h"
#include "gnunet_mesh_service.h"
-#define VERBOSE GNUNET_YES
#define REMOVE_DIR GNUNET_YES
#define MESH_REGEX_PEERS 4
for (i = 0; i < MESH_REGEX_PEERS; i++)
ok[i] = GNUNET_NO;
}
-#if VERBOSE
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: All peers successfully shut down!\n");
}
-#endif
GNUNET_CONFIGURATION_destroy (testing_cfg);
}
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
-#endif
shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
}
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "test: Have %u connections\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
peers_running = GNUNET_TESTING_daemons_running (pg);
if (0 < failed_connections)
{
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_mesh_regex",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
- GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
- "use_progressbars", "YES");
-#endif
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
"num_peers", &num_peers))
argv[0],
"-c",
"test_mesh_2dtorus.conf",
-#if VERBOSE
- "-L",
- "DEBUG",
-#endif
NULL
};
int result;
#include <gauger.h>
-#define VERBOSE GNUNET_YES
#define REMOVE_DIR GNUNET_YES
struct MeshPeer
{
if (emsg != NULL)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutdown of peers failed!\n");
-#endif
ok--;
}
else
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All peers successfully shut down!\n");
-#endif
}
GNUNET_CONFIGURATION_destroy (testing_cfg);
}
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Ending test.\n");
-#endif
-
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
}
app = (GNUNET_MESH_ApplicationType) 0;
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"connecting to mesh service of peer %s\n",
GNUNET_i2s (&d1->id));
"connecting to mesh service of peer %s\n",
GNUNET_i2s (&d3->id));
}
-#endif
h1 = GNUNET_MESH_connect (d1->cfg, (void *) 1L, NULL, &tunnel_cleaner,
handlers, &app);
h2 = GNUNET_MESH_connect (d2->cfg, (void *) 2L, &incoming_tunnel,
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "************************************************************\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peer Group started successfully!\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Have %u connections\n",
+ "Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
if (data_file != NULL)
{
buf = NULL;
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_mesh_small",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting daemons.\n");
- GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
- "use_progressbars", "YES");
-#endif
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
"num_peers", &num_peers))
argv[0],
"-c",
"test_mesh_small.conf",
-#if VERBOSE
- "-L",
- "DEBUG",
-#endif
NULL
};
int argc2 = (sizeof (argv2) / sizeof (char *)) - 1;
test_name = "speed ack";
ok_goal = TOTAL_PACKETS * 2 + 3;
argv2 [3] = NULL; // remove -L DEBUG
-#if VERBOSE
- argc2 -= 2;
-#endif
}
else if (strstr (argv[0], "test_mesh_small_speed") != NULL)
{
[mesh]
PORT = 10005
-DEBUG = YES
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
REFRESH_PATH_TIME = 5 s
[arm]
PORT = 10010
DEFAULTSERVICES = core dht mesh
-#DEBUG = YES
[statistics]
AUTOSTART = YES
PORT = 10000
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
F2F = NO
CONNECT_TIMEOUT = 660 s
CONNECT_ATTEMPTS = 2
-DEBUG = YES
HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
#define MESH_TUNNEL_TREE_C
#endif
-#define VERBOSE 1
-
-int failed;
-int cb_call;
-struct GNUNET_PeerIdentity *pi[10];
-struct MeshTunnelTree *tree;
+static int failed;
+static int cb_call;
+static struct GNUNET_PeerIdentity *pi[10];
+static struct MeshTunnelTree *tree;
static void
cb (void *cls, GNUNET_PEER_Id peer_id)
failed = 0;
cb_call = 0;
GNUNET_log_setup ("test_mesh_api_tree",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
for (i = 0; i < 10; i++)
{
_("GNUnet zone manipulation tool"),
options,
&run, NULL))
+ {
+ GNUNET_free ((void*) argv);
return 1;
-
+ }
+ GNUNET_free ((void*) argv);
return ret;
}
{
size_t rd_ser_len;
size_t name_len;
- char * name_tmp;
- char * rd_ser;
+ char *name_tmp;
+ char *rd_ser;
struct GNUNET_CRYPTO_RsaSignaturePurpose *sig_purpose;
struct GNUNET_TIME_AbsoluteNBO *expire_tmp;
struct GNUNET_TIME_AbsoluteNBO expire_nbo = GNUNET_TIME_absolute_hton (freshness);
#include "gnunet_namestore_service.h"
#include "namestore.h"
-#define VERBOSE GNUNET_NO
-
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
static int res;
GNUNET_PROGRAM_run (argc, argv, "gnunet-nat-server [options] PORT",
_("GNUnet NAT traversal test helper daemon"), options,
&run, NULL))
+ {
+ GNUNET_free ((void*) argv);
return 1;
+ }
+ GNUNET_free ((void*) argv);
return 0;
}
#include "gnunet_scheduler_lib.h"
#include "gnunet_nat_lib.h"
-
-#define VERBOSE GNUNET_NO
-
/* Time to wait before stopping NAT, in seconds */
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
"-c",
"test_nat_data.conf",
"-L",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL
};
GNUNET_log_setup ("test-nat-mini",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse
#PREFIX = valgrind --leak-check=full --log-file=valgrind_nse.%p
AUTOSTART = NO
-DEBUG = YES
# Overriding network settings for faster testing (do NOT use
# these values in production just because they are here)
WORKDELAY = 60 s
PORT = 0
DEFAULTSERVICES = core
UNIXPATH = /tmp/test-nse-service-arm.unix
-#DEBUG = YES
[statistics]
AUTOSTART = YES
F2F = NO
CONNECT_TIMEOUT = 360 s
CONNECT_ATTEMPTS = 3
-DEBUG = YES
#HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
HOSTKEYSFILE = hostkeys.dat
MAX_CONCURRENT_SSH = 20
#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse
#PREFIX = valgrind --leak-check=full --log-file=valgrind_nse.%p
AUTOSTART = YES
-DEBUG = NO
PROOFFILE = $SERVICEHOME/proof.nse
# Overriding network settings for faster testing (do NOT use
# these values in production just because they are here)
PORT = 22354
DEFAULTSERVICES = nse core
UNIXPATH = /tmp/test-nse-service-arm.unix
-#DEBUG = YES
[fs]
AUTOSTART = NO
F2F = NO
CONNECT_TIMEOUT = 60 s
CONNECT_ATTEMPTS = 3
-#DEBUG = YES
HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 20
USE_PROGRESSBARS = YES
1, &GNUNET_GETOPT_set_string, &put_uri},
GNUNET_GETOPT_OPTION_END
};
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-peerinfo",
- gettext_noop ("Print information about peers."),
- options, &run, NULL)) ? 0 : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-peerinfo",
+ gettext_noop ("Print information about peers."),
+ options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-peerinfo.c */
[peerinfo]
PORT = 22354
-DEBUG = NO
[dns]
AUTOSTART = NO
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
-
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-pt",
- gettext_noop
- ("Daemon to run to perform IP protocol translation to GNUnet"),
- options, &run, NULL)) ? 0 : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-pt",
+ gettext_noop
+ ("Daemon to run to perform IP protocol translation to GNUnet"),
+ options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
*
* @return 0 if ok, non 0 on error.
*/
-int
+static int
filecheck (const char *filename)
{
int error = 0;
- FILE *fp = NULL;
+ FILE *fp;
// Check if file was created and delete it again
- fp = fopen (filename, "r");
-
- if (NULL == fp)
+ if (NULL == (fp = fopen (filename, "r")))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not find graph %s\n", filename);
- return ++error;
+ return 1;
}
- fseek (fp, 0L, SEEK_END);
+ GNUNET_break (0 == fseek (fp, 0L, SEEK_END));
if (1 > ftell (fp))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Graph writing failed, got empty file (%s)!\n", filename);
- error++;
+ "Graph writing failed, got empty file (%s)!\n",
+ filename);
+ error = 2;
}
-
- error += fclose (fp);
+
+ GNUNET_assert (0 == fclose (fp));
if (!KEEP_FILES)
{
if (0 != unlink (filename))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not remove temp files (%s)\n",
- filename);
- }
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "unlink", filename);
}
-
-
return error;
}
+
int
main (int argc, char *argv[])
{
- GNUNET_log_setup ("test-regex", "WARNING", NULL);
-
int error;
struct GNUNET_REGEX_Automaton *a;
unsigned int i;
const char *filename = "test_graph.dot";
-
- error = 0;
-
const char *regex[12] = {
"ab(c|d)+c*(a(b|c)+d)+(bla)+",
"(bla)*",
"PADPADPADPADPADPabcdefghixxxxxxxxxxxxxjklmnop*qstoisdjfguisdfguihsdfgbdsuivggsd"
};
+ GNUNET_log_setup ("test-regex", "WARNING", NULL);
+ error = 0;
for (i = 0; i < 12; i++)
{
// Check NFA graph creation
&GNUNET_GETOPT_set_uint, &remote_port},
GNUNET_GETOPT_OPTION_END
};
-
remote_port = 0;
remote_host = NULL;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-statistics [options [value]]",
- gettext_noop
- ("Print statistics about GNUnet operations."),
- options, &run, NULL)) ? ret : 1;
-
- GNUNET_free_non_null(remote_host);
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-statistics [options [value]]",
+ gettext_noop
+ ("Print statistics about GNUnet operations."),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free_non_null (remote_host);
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-statistics.c */
[statistics]
PORT = 22353
UNIXPATH = /tmp/test-statistics-service-statistics.unix
-#DEBUG = YES
[arm]
PORT = 22354
DEFAULTSERVICES =
UNIXPATH = /tmp/test-statistics-service-arm.unix
-# DEBUG = YES
[fs]
AUTOSTART = NO
* @brief Testcases for Stream API halfclosed connections between 2 peers
* @author Sree Harsha Totakura
*/
-
-#include <string.h>
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "gnunet_mesh_service.h"
#include "gnunet_stream_lib.h"
-#define VERBOSE 1
-
/**
* Number of peers
*/
AUTOSTART = NO
[mesh]
-DEBUG = YES
AUTOSTART = YES
ACCEPT_FROM = 127.0.0.1;
HOSTNAME = localhost
# PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core lockmanager
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[testing_old]
NUM_PEERS = 5
-DEBUG = YES
HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
/* FIMXE: add options here */
GNUNET_GETOPT_OPTION_END
};
-
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-template",
- gettext_noop ("help text"), options, &run,
- NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-template",
+ gettext_noop ("help text"), options, &run,
+ NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-template.c */
GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler [OPTIONS] hosts-file",
_("Profiler for testbed"),
options, &run, NULL);
+ GNUNET_free ((void*) argv);
if (GNUNET_OK != ret)
return ret;
if (GNUNET_OK != result)
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core transport
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core transport
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core transport
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
[transport]
PLUGINS = tcp
-DEBUG = NO
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
NEIGHBOUR_LIMIT = 50
[arm]
DEFAULTSERVICES = core transport
PORT = 12366
-DEBUG = NO
[transport-tcp]
TIMEOUT = 300 s
[TESTING]
NUM_PEERS = 5
WEAKRANDOM = YES
-DEBUG = YES
HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
GNUNET_YES, &GNUNET_GETOPT_set_string, &create_cfg_template},
GNUNET_GETOPT_OPTION_END
};
-
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-testing",
- gettext_noop ("Command line tool to access the testing library"), options, &run,
- NULL)) ? ret : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-testing",
+ gettext_noop ("Command line tool to access the testing library"), options, &run,
+ NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-testing.c */
test_testing_topology_scale_free
if ENABLE_TEST_RUN
-TESTS = \
- test_testing \
- test_testing_connect \
- test_testing_reconnect \
- test_testing_group \
- test_testing_peergroup
+# Don't bother to test old-testing at this point
+#TESTS = \
+# test_testing \
+# test_testing_connect \
+# test_testing_reconnect \
+# test_testing_group \
+# test_testing_peergroup
endif
[arm]
PORT = 10010
DEFAULTSERVICES = core
-#DEBUG = YES
[statistics]
AUTOSTART = YES
PORT = 10000
[dht]
-DEBUG = NO
AUTOSTART = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
F2F = NO
CONNECT_TIMEOUT = 600 s
CONNECT_ATTEMPTS = 2
-DEBUG = YES
HOSTKEYSFILE = ${DATADIR}/testing_hostkeys.dat
MAX_CONCURRENT_SSH = 10
USE_PROGRESSBARS = YES
_
("GNUnet topology control (maintaining P2P mesh and F2F constraints)"),
options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
return ret;
}
[transport]
PORT = 2665
PLUGINS = tcp
-#DEBUG = YES
#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
#PREFIX = valgrind --tool=memcheck --log-file=logs%p
[core]
PORT = 2670
-#DEBUG = YES
[topology]
-# DEBUG = YES
#PREFIX = valgrind --tool=memcheck
[fs]
("Direct access to transport service."), options,
&run, NULL);
GNUNET_free ((void *) argv);
-
if (GNUNET_OK == res)
return ret;
- else
- return 1;
-
-
+ return 1;
}
[transport]
#PREFIX = valgrind --leak-check=full
PORT = 12001
-#DEBUG = YES
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
[ats]
-#DEBUG = YES
WAN_QUOTA_IN = unlimited
WAN_QUOTA_OUT = unlimited
PORT = 12006
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
[ats]
-#DEBUG = YES
WAN_QUOTA_IN = unlimited
WAN_QUOTA_OUT = unlimited
PORT = 12016
[transport]
PORT = 12004
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-#DEBUG = YES
[transport-tcp]
PORT = 12005
PORT = 12001
PLUGINS = tcp
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-#DEBUG = YES
UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
[transport]
-#DEBUG = YES
PORT = 12081
PLUGINS = http_client
#BINARY = .libs/gnunet-service-transport
UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
[transport]
-#DEBUG = YES
PORT = 12091
PLUGINS = http_server
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
[transport]
-#DEBUG = YES
PORT = 12091
PLUGINS = http_client
#BINARY = .libs/gnunet-service-transport
[ats]
-#DEBUG = YES
WAN_QUOTA_IN = unlimited
WAN_QUOTA_OUT = unlimited
PORT = 12006
PORT = 12101
PLUGINS = https_client
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-DEBUG = NO
PORT = 12111
PLUGINS = https_server
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-DEBUG = NO
PORT = 12181
PLUGINS = http_client
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-#DEBUG = YES
PORT = 12191
PLUGINS = http_server
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-#DEBUG = YES
PORT = 12010
PLUGINS = tcp
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-#DEBUG = YES
PORT = 29542
PLUGINS = tcp
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-#DEBUG = YES
PORT = 45923
PLUGINS = tcp
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-#DEBUG = YES
PORT = 12001
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
PLUGINS = tcp
-#DEBUG = YES
UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
[transport]
-#DEBUG = YES
PORT = 12081
PLUGINS = http_client
#BINARY = .libs/gnunet-service-transport
UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
[transport]
-#DEBUG = YES
PORT = 12091
PLUGINS = http_server
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
PORT = 12101
PLUGINS = https_client
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-DEBUG = NO
PORT = 12111
PLUGINS = https_server
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-DEBUG = NO
PORT = 12061
PLUGINS = udp
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
-DEBUG = NO
PORT = 12071
PLUGINS = udp
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-DEBUG = NO
TESTMODE = 1
[arm]
-DEBUG = YES
PORT = 12164
UNIXPATH = /tmp/gnunet-p1-service-arm.sock
[transport]
PORT = 12160
PLUGINS = wlan
-#DEBUG = YES
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600
[arm]
PORT = 12174
-DEBUG = YES
UNIXPATH = /tmp/gnunet-p2-service-arm.sock
[statistics]
[transport]
PORT = 12170
PLUGINS = wlan
-#DEBUG = YES
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
{
struct PeerContext *p = cls;
+ char *p2_s;
+ struct PeerContext *p2;
- /* Find PeerContext */
- GNUNET_assert (p != 0);
- GNUNET_assert (p->tth != NULL);
- struct PeerContext *p2 = find_peer_context (p->tth, peer);
-
- if (p == NULL)
- return;
+ GNUNET_assert (NULL != p);
+ GNUNET_assert (NULL != p->tth);
+ p2 = find_peer_context (p->tth, peer);
if (p->nc != NULL)
p->nc (p->cb_cls, peer, ats, ats_count);
- char *p2_s;
-
if (p2 != NULL)
GNUNET_asprintf (&p2_s, "%u (`%s')", p2->no, GNUNET_i2s (&p2->id));
else
}
-
/* end of transport-testing.c */
1, &GNUNET_GETOPT_set_string, &value },
GNUNET_GETOPT_OPTION_END
};
-
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]",
- gettext_noop ("Manipulate GNUnet configuration files"),
- options, &run, NULL)) ? 0 : ret;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]",
+ gettext_noop ("Manipulate GNUnet configuration files"),
+ options, &run, NULL)) ? 0 : ret;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-config.c */
0, &GNUNET_GETOPT_set_one, &weak_random },
GNUNET_GETOPT_OPTION_END
};
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-ecc [OPTIONS] keyfile",
- gettext_noop ("Manipulate GNUnet private ECC key files"),
- options, &run, NULL)) ? 0 : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-ecc [OPTIONS] keyfile",
+ gettext_noop ("Manipulate GNUnet private ECC key files"),
+ options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-ecc.c */
0, &GNUNET_GETOPT_set_one, &reverse },
GNUNET_GETOPT_OPTION_END
};
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]",
- gettext_noop ("Use build-in GNUnet stub resolver"),
- options, &run, NULL)) ? 0 : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]",
+ gettext_noop ("Use build-in GNUnet stub resolver"),
+ options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-resolver.c */
* @return 0 ok, 1 on error
*/
int
-main (int argc, char *const *argv)
+main (int argc, char *const*argv)
{
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
{ 'g', "generate-keys", "COUNT",
0, &GNUNET_GETOPT_set_one, &weak_random },
GNUNET_GETOPT_OPTION_END
};
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile",
- gettext_noop ("Manipulate GNUnet private RSA key files"),
- options, &run, NULL)) ? 0 : 1;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile",
+ gettext_noop ("Manipulate GNUnet private RSA key files"),
+ options, &run, NULL)) ? 0 : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-rsa.c */
GNUNET_GETOPT_OPTION_END
};
struct GNUNET_SIGNAL_Context *shc_chld;
+ int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
GNUNET_assert (sigpipe != NULL);
shc_chld =
GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
- if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI",
- gettext_noop ("Perform default-actions for GNUnet URIs"),
- options, &run, NULL))
- return 1;
+ ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI",
+ gettext_noop ("Perform default-actions for GNUnet URIs"),
+ options, &run, NULL);
GNUNET_SIGNAL_handler_uninstall (shc_chld);
shc_chld = NULL;
GNUNET_DISK_pipe_close (sigpipe);
sigpipe = NULL;
- return ret;
+ GNUNET_free ((void *) argv);
+ return (GNUNET_OK == ret) ? 0 : 1;
}
/* end of gnunet-uri.c */
while (NULL != fgets (line, sizeof (line), f))
{
if ((1 ==
- SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%s", dir)) &&
+ SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%1023s", dir)) &&
(NULL != (lgu = strstr (dir, "libgnunetutil"))))
{
lgu[0] = '\0';
static GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier read_task;
+
static void
runone (void);
GNUNET_OS_process_destroy (proc);
proc = NULL;
}
+ if (GNUNET_SCHEDULER_NO_TASK != read_task)
+ {
+ GNUNET_SCHEDULER_cancel (read_task);
+ read_task = GNUNET_SCHEDULER_NO_TASK;
+ }
GNUNET_DISK_pipe_close (pipe_stdout);
if (ok == 1)
{
long delays[8];
int rd;
+ read_task = GNUNET_SCHEDULER_NO_TASK;
rd = GNUNET_DISK_file_read (stdout_read_handle, buf_ptr,
sizeof (buf) - bytes);
if (rd > 0)
#if VERBOSE
FPRINTF (stderr, "got %d bytes, reading more\n", rd);
#endif
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- stdout_read_handle, &read_call,
- (void *) stdout_read_handle);
+ read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+ stdout_read_handle, &read_call,
+ stdout_read_handle);
return;
}
buf_ptr = buf;
memset (&buf, 0, sizeof (buf));
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- stdout_read_handle, &read_call,
- (void *) stdout_read_handle);
+ read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+ stdout_read_handle, &read_call,
+ stdout_read_handle);
}
static void
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
"gnunet-service-resolver", "-", NULL);
sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
+ GNUNET_free (fn);
if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
}
+ GNUNET_free (fn);
GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
GNUNET_OS_process_destroy (proc);
proc = NULL;
ret = GNUNET_PLUGIN_unload (libname, "out");
GNUNET_assert (NULL != ret);
GNUNET_assert (0 == strcmp (ret, "World"));
+ GNUNET_free (ret);
}
[resolver]
PORT = 22354
HOSTNAME = localhost
-DEBUG = YES
#include "gnunet_time_lib.h"
static struct GNUNET_SERVER_MessageStreamTokenizer * mst;
-static int ret;
+
/* Callback destroying mst with data in buffer */
static int
return GNUNET_SYSERR;
}
-/**
- * Main method
- */
-static int
-check ()
-{
+int
+main (int argc, char *argv[])
+{
struct GNUNET_PeerIdentity id;
struct GNUNET_MessageHeader msg[2];
- /* Prepare */
- memset (&id, sizeof (id), '\0');
+ GNUNET_log_setup ("test_server_mst_interrupt", "WARNING", NULL);
+ memset (&id, 0, sizeof (id));
msg[0].size = htons (sizeof (msg));
msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY));
-
mst = GNUNET_SERVER_mst_create(mst_cb, NULL);
-
- GNUNET_SERVER_mst_receive(mst, &id, (const char *) &msg, 2 * sizeof (msg), GNUNET_NO, GNUNET_NO);
-
+ GNUNET_SERVER_mst_receive (mst, &id,
+ (const char *) &msg, 2 * sizeof (msg),
+ GNUNET_NO, GNUNET_NO);
/* If we reach this line, it did not crash */
- ret = 0;
-
- return ret;
-}
-
-int
-main (int argc, char *argv[])
-{
- ret = 1;
-
- GNUNET_log_setup ("test_server", "WARNING", NULL);
- check ();
-
- return ret;
+ return 0;
}
/* end of test_server_mst_interrupt.c */
GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
GNUNET_GETOPT_OPTION_END
};
-
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-vpn",
- gettext_noop
- ("Setup tunnels via VPN."), options,
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-vpn",
+ gettext_noop
+ ("Setup tunnels via VPN."), options,
&run, NULL)) ? ret : 1;
+ GNUNET_free ((void *) argv);
+ return ret;
}