*/
snprintf (command, LINE_LEN,
"netsh interface ipv6 delete address \"%s\" store=persistent",
- device_visible_name, address);
+ device_visible_name);
/*
* Set the address
*/
*/
snprintf (command, LINE_LEN,
"netsh interface ipv4 delete address \"%s\" gateway=all store=persistent",
- device_visible_name, address);
+ device_visible_name);
/*
* Set the address
*/
CloseHandle (tap_handle);
}
+
+
/**
* Open VPN tunnel interface.
*
if ( (1 < argc) && (0 != strcmp (argv[1], "-d"))){
privilege_testing = TRUE;
- fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]);
+ fprintf (stderr,
+ "%s",
+ "DEBUG: Running binary in privilege testing mode.");
argv++;
argc--;
}
if (6 != argc)
{
- fprintf (stderr, "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n", argv[0]);
+ fprintf (stderr,
+ "%s",
+ "FATAL: must supply 6 arguments\nUsage:\ngnunet-helper-exit [-d] <if name prefix> <uplink-interface name> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n");
return 1;
}
* @param buf the buffer to copy to
* @return bytes passed
*/
-size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
+static size_t
+send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
{
- struct Node *n = cls;
- struct Experimentation_Request msg;
- size_t msg_size = sizeof (msg);
- size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count;
- size_t total_size = msg_size + ri_size;
-
- memset (buf, '\0', bufsize);
- n->cth = NULL;
- if (buf == NULL)
+ struct Node *n = cls;
+ struct Experimentation_Request msg;
+ size_t msg_size = sizeof (msg);
+ size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count;
+ size_t total_size = msg_size + ri_size;
+
+ n->cth = NULL;
+ if (NULL == buf)
{
/* client disconnected */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n");
GNUNET_SCHEDULER_add_now (&remove_request, n);
return 0;
}
+ memset (buf, '\0', bufsize);
GNUNET_assert (bufsize >= total_size);
msg.msg.size = htons (total_size);
*
* @param peer the peer to send to
*/
-static void send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
+static void
+send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
{
struct Node *n;
struct NodeComCtx *e_ctx;
void
GED_scheduler_handle_start (struct Node *n, struct Experiment *e)
{
- struct ScheduledExperiment *se;
-
- if ((NULL != (se = find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO))) ||
- (NULL != (se = find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO))))
- {
- GNUNET_break_op (0);
- return;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s message from peer %s for experiment `%s'\n",
- "START", GNUNET_i2s (&n->id), e->name);
-
- GED_scheduler_add (n, e, GNUNET_NO);
+ if ((NULL != find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO)) ||
+ (NULL != find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO)))
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received %s message from peer %s for experiment `%s'\n",
+ "START", GNUNET_i2s (&n->id), e->name);
+ GED_scheduler_add (n, e, GNUNET_NO);
}
+
/**
* Handle a START_ACK message from a remote node
*
po->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Timeout while trying to publish data\n");
- if (NULL == po->fs)
- GNUNET_TESTBED_operation_done (po->fs_op);
- else
- GNUNET_TESTBED_operation_done (po->fs_op);
+ GNUNET_TESTBED_operation_done (po->fs_op);
GNUNET_FS_publish_stop (po->publish_context);
po->publish_cont (po->publish_cont_cls, NULL, NULL);
(void) GNUNET_DISK_directory_remove (po->publish_tmp_file);
GNUNET_SCHEDULER_add_continuation (dop->download_cont,
dop->download_cont_cls,
GNUNET_SCHEDULER_REASON_TIMEOUT);
- if (NULL == dop->fs)
- GNUNET_TESTBED_operation_done (dop->fs_op);
- else
- GNUNET_TESTBED_operation_done (dop->fs_op);
+ GNUNET_TESTBED_operation_done (dop->fs_op);
GNUNET_FS_uri_destroy (dop->uri);
GNUNET_free (dop);
}
"(%llu,%llu,%llu)",
&x, &y, &t))
{
- p = GNUNET_malloc (sizeof (struct Pattern));
+ p = GNUNET_new (struct Pattern);
p->x = x;
p->y = y;
p->delay.rel_value_us = (uint64_t) t;
static int
check_lowlevel_connections (int port, int protocol)
{
+#ifdef MINGW
+ /* not supported */
+ return count;
+#else
FILE *f;
char * cmdline;
char * proto;
char line[1024];
int count = -1;
-#ifdef MINGW
- /* not supported */
- return count;
-#else
- switch (protocol) {
+ switch (protocol)
+ {
case tcp:
proto = "-t";
break;
{
/* read */
//printf ("%s", line);
- count ++;
+ count++;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%i TCP connections established with port %u\n",
- count, port);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%i TCP connections established with port %u\n",
+ count, port);
pclose (f);
GNUNET_free (cmdline);
*/
struct GNUNET_MESH_Peer
{
- /**
- * ID of the peer in short form
- */
+ /**
+ * ID of the peer in short form
+ */
GNUNET_PEER_Id id;
/**
/**
* Flag indicating whether service has informed about its connection
+ * FIXME-BART: is this flag used? Seems dead right now...
*/
int connected;
struct GNUNET_MESH_TransmitHandle *th;
struct GNUNET_MESH_TransmitHandle *next;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "destroy_tunnel %X\n", t->tid);
-
if (NULL == t)
{
GNUNET_break (0);
return;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "destroy_tunnel %X\n",
+ t->tid);
h = t->mesh;
GNUNET_CONTAINER_DLL_remove (h->tunnels_head, h->tunnels_tail, t);
t = retrieve_tunnel (h, ntohl (dmsg->tid));
payload = (struct GNUNET_MessageHeader *) &dmsg[1];
- LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on tunnel %s [%X]\n",
- t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck",
- GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)), ntohl (dmsg->tid));
if (NULL == t)
{
/* Tunnel was ignored/destroyed, probably service didn't get it yet */
LOG (GNUNET_ERROR_TYPE_DEBUG, " ignored!\n");
return;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " %s data on tunnel %s [%X]\n",
+ t->tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV ? "fwd" : "bck",
+ GNUNET_i2s (GNUNET_PEER_resolve2(t->peer)),
+ ntohl (dmsg->tid));
type = ntohs (payload->type);
LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %u\n", type);
for (i = 0; i < h->n_handlers; i++)
/**
* Flag indicating whether service has informed about its connection
+ * FIXME-BART: is this flag used? Seems dead right now...
*/
int connected;
char *hostkey_file;
GNUNET_assert (nsh == cls);
- if (NULL != zone)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Expected empty zone but received zone private key\n"));
+ if (NULL != zone)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Expected empty zone but received zone private key\n"));
GNUNET_break (0);
if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (endbadly_task);
+ GNUNET_SCHEDULER_cancel (endbadly_task);
endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
return;
- }
- if ((NULL != label) || (NULL != rd) || (0 != rd))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Expected no zone content but received data\n"));
+ }
+ if ((NULL != label) || (NULL != rd) || (0 != rd_count))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Expected no zone content but received data\n"));
GNUNET_break (0);
if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (endbadly_task);
+ GNUNET_SCHEDULER_cancel (endbadly_task);
endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
return;
- }
+ }
zi = NULL;
endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
return;
}
- if ((NULL != label) || (NULL != rd) || (0 != rd))
+ if ((NULL != label) || (NULL != rd) || (0 != rd_count))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Expected no zone content but received data\n"));
if (argc > 1 && 0 != strcmp (argv[1], "-d")){
privilege_testing = TRUE;
- fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]);
+ fprintf (stderr,
+ "%s",
+ "DEBUG: Running binary in privilege testing mode.");
argv++;
argc--;
}
if (argc != 4)
{
fprintf (stderr,
- "This program must be started with our IP, the targets external IP, and our port as arguments.\n");
+ "%s",
+ "This program must be started with our IP, the targets external IP, and our port as arguments.\n");
return 1;
}
if ((1 != inet_pton (AF_INET, argv[1], &external)) ||
(1 != inet_pton (AF_INET, argv[2], &target)))
{
- fprintf (stderr, "Error parsing IPv4 address: %s\n", strerror (errno));
+ fprintf (stderr,
+ "Error parsing IPv4 address: %s\n",
+ strerror (errno));
return 1;
}
if ((1 != sscanf (argv[3], "%u", &p)) || (0 == p) || (0xFFFF < p))
{
- fprintf (stderr, "Error parsing port value `%s'\n", argv[3]);
+ fprintf (stderr,
+ "Error parsing port value `%s'\n",
+ argv[3]);
return 1;
}
port = (uint16_t) p;
if (0 != WSAStartup (MAKEWORD (2, 1), &wsaData))
{
- fprintf (stderr, "Failed to find Winsock 2.1 or better.\n");
+ fprintf (stderr,
+ "%s",
+ "Failed to find Winsock 2.1 or better.\n");
return 2;
}
if (1 != inet_pton (AF_INET, DUMMY_IP, &dummy))
{
- fprintf (stderr, "Internal error converting dummy IP to binary.\n");
+ fprintf (stderr,
+ "%s",
+ "Internal error converting dummy IP to binary.\n");
return 2;
}
if (-1 == (rawsock = make_raw_socket ()))
WSADATA wsaData;
unsigned int alt = 0;
- if (argc > 1 && 0 != strcmp (argv[1], "-d")){
- privilege_testing = TRUE;
- fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]);
- argv++;
- argc--;
- }
+ if ( (argc > 1) && (0 != strcmp (argv[1], "-d")))
+ {
+ privilege_testing = TRUE;
+ fprintf (stderr,
+ "%s",
+ "DEBUG: Running binary in privilege testing mode.");
+ argv++;
+ argc--;
+ }
if (2 != argc)
{
};
-/**
- * Context for the stats task?
- */
-struct StatsContext
-{
-
- /**
- * How many messages have peers received during the test.
- */
- unsigned long long total_nse_received_messages;
-
- /**
- * How many messages have peers send during the test (should be == received).
- */
- unsigned long long total_nse_transmitted_messages;
-
- /**
- * How many messages have travelled an edge in both directions.
- */
- unsigned long long total_nse_cross;
-
- /**
- * How many extra messages per edge (corrections) have been received.
- */
- unsigned long long total_nse_extra;
-
- /**
- * How many messages have been discarded.
- */
- unsigned long long total_discarded;
-};
-
-
/**
* Operation map entry
*/
/**
* Callback function to process statistic values.
*
- * @param cls struct StatsContext
+ * @param cls `struct NSEPeer`
* @param subsystem name of subsystem that created the statistic
* @param name the name of the datum
* @param value the current value
- * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
- * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
+ * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
static int
-stat_iterator (void *cls, const char *subsystem, const char *name,
- uint64_t value, int is_persistent)
+stat_iterator (void *cls,
+ const char *subsystem,
+ const char *name,
+ uint64_t value, int is_persistent)
{
char *output_buffer;
struct GNUNET_TIME_Absolute now;
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
- if (-1 == (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL)))
+ if (0 >= (int) (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("No files found in `%s'\n"),
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
- if (0 >= num_peers || NULL == search_strings)
+ if ( (0 == num_peers) || (NULL == search_strings))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Error loading search strings. Exiting.\n"));
/* Initialize peers */
peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers);
for (i = 0; i < num_peers; i++)
- {
peers[i].id = i;
- }
GNUNET_CONFIGURATION_set_value_number (cfg,
"TESTBED", "OVERLAY_RANDOM_LINKS",
* GNUnet source code.
*
* This is primarily a helper function used internally
- * by 'GNUNET_TESTING_peer_configure'.
+ * by #GNUNET_TESTING_peer_configure.
*
* @param system the testing system handle
* @param key_number desired pre-created hostkey to obtain
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
- if (NULL == private_key)
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Error while decoding key %u\n"), key_number);
- return NULL;
- }
GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &public_key);
GNUNET_CRYPTO_hash (&public_key,
sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
read (i, readbuf, sizeof (readbuf));
if (0 > ret)
{
- fprintf (stderr, "Read error from STDIN: %s\n", strerror (errno));
- break; break;
+ fprintf (stderr,
+ "Read error from STDIN: %s\n",
+ strerror (errno));
+ break;
}
if (0 == ret)
{
WSACleanup();
#endif
return 1; /* we never exit 'normally' */
-}
\ No newline at end of file
+}
int run_without_scheduler)
{
struct CommandContext cc;
+#if ENABLE_NLS
char *path;
+#endif
char *loglev;
char *logfile;
int ret;
size_t strl;
/* Hopefully it will allocate us NUL-terminated strings... */
split_u8argv[i] = (char *) u16_to_u8 (wargv[i], wcslen (wargv[i]) + 1, NULL, &strl);
- if (split_u8argv == NULL)
+ if (NULL == split_u8argv[i])
{
int j;
for (j = 0; j < i; j++)
*/
snprintf (command, LINE_LEN,
"netsh interface ipv6 delete address \"%s\" store=persistent",
- device_visible_name, address);
+ device_visible_name);
/*
* Set the address
*/
/* Did it work?*/
if (0 != ret)
- fprintf (stderr, "FATAL: removing IPv6 address failed: %s\n", strerror (ret));
+ fprintf (stderr,
+ "FATAL: removing IPv6 address failed: %s\n",
+ strerror (ret));
}
/* Did it work?*/
if (0 != ret)
- fprintf (stderr, "FATAL: Setting IPv4 address failed: %s\n", strerror (ret));
+ fprintf (stderr,
+ "FATAL: Setting IPv4 address failed: %s\n",
+ strerror (ret));
return ret;
}
*/
snprintf (command, LINE_LEN,
"netsh interface ipv4 delete address \"%s\" gateway=all store=persistent",
- device_visible_name, address);
+ device_visible_name);
/*
* Set the address
*/
if (argc > 1 && 0 != strcmp (argv[1], "-d")){
privilege_testing = TRUE;
- fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]);
+ fprintf (stderr,
+ "%s",
+ "DEBUG: Running binary in privilege testing mode.");
argv++;
argc--;
}
if (6 != argc)
{
- fprintf (stderr, "FATAL: must supply 5 arguments\nUsage:\ngnunet-helper-vpn [-d] <if name prefix> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n", argv[0]);
+ fprintf (stderr,
+ "%s",
+ "FATAL: must supply 5 arguments\nUsage:\ngnunet-helper-vpn [-d] <if name prefix> <address6 or \"-\"> <netbits6> <address4 or \"-\"> <netmask4>\n");
return 1;
}